Overview | Package | Class | Tree | Deprecated | Index | Help
| SolarMetric Kodo JDO 2.5.8 generated on January 11 2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.solarmetric.kodo.query
Class QueryImpl

    java.lang.Object
      |
      +--com.solarmetric.kodo.query.QueryImpl

All Implemented Interfaces:
  com.solarmetric.kodo.query.KodoQuery, Query, com.solarmetric.kodo.query.Resolver, Serializable

Direct Known Subclasses:
  JDBCQuery

public abstract class QueryImpl
extends Object
implements com.solarmetric.kodo.query.KodoQuery, com.solarmetric.kodo.query.Resolver

Abstract implementation of the `Query` interface.

See Also:
  Serialized Form

Inner Class Summary
`(package private) class` | `QueryImpl.AggregateQueryExecutor` An AggregateQueryExecutor executes multiple Queries and returns a MergedResultList with the appropriate ordering (if more than one query needs to be executed).
`(package private) class` | `QueryImpl.DatastoreQueryExecutor` The DatastoreQueryExecutor executes the query against the implementation's overridden `QueryImpl.DatastoreQueryExecutor.executeQuery(java.util.Map)` method.
`(package private) class` | `QueryImpl.InMemoryQueryExecutor` The InMemoryQueryExecutor evaluates an InMemoryExpression against either a candidate collection or an Extent.
`(package private) static interface` | `QueryImpl.ParsedExpression` A ParsedExpression represents either an in-memory or implementation-specific parsed expression.
`(package private) class` | `QueryImpl.QueryExecutionManager` The QueryExecutionManager handles caching a parsed expression, and aggregating multiple query execution results.
`(package private) static interface` | `QueryImpl.QueryExecutor` A QueryExecutor provides a uniform interface to the mechanism for executing either a in-memory or datasource Query.
`static class` | `QueryImpl.QueryResultComparator` A `Comparator` implementation that performs the comparison based on the ordering specification of the `QueryImpl`.

Fields inherited from interface com.solarmetric.kodo.query.KodoQuery
`FLUSH_ALWAYS, FLUSH_ALWAYS_MODE, FLUSH_NEVER, FLUSH_NEVER_MODE, FLUSH_WITH_CONNECTION, FLUSH_WITH_CONNECTION_MODE`

Constructor Summary
`QueryImpl(PersistenceManagerImpl pm)` Construct a query managed by the given persistence manager.
`QueryImpl(PersistenceManagerImpl pm, Object copy)` Construct a query managed by the given persistence manager, copying the candidate class, filter, parameters, variables, ordering, and options from the given query.

Method Summary
`Class` | `classForName(String name)`
`protected abstract void` | `close(List result)` Close the given query result.
`void` | `close(Object queryResult)` Close the given query result.
`void` | `closeAll()` Close all query results.
`void` | `compile()`
`void` | `declareImports(String imports)`
`void` | `declareParameters(String parameters)`
`void` | `declareVariables(String variables)`
`Object` | `execute()`
`Object` | `execute(Object p1)`
`Object` | `execute(Object p1, Object p2)`
`Object` | `execute(Object p1, Object p2, Object p3)`
`protected abstract ResultList` | `executeQuery(ClassMetaData type, boolean subclasses, com.solarmetric.kodo.query.ExpressionFactory factory, com.solarmetric.kodo.query.Expression exp, Map params)` Execute the given expression against the given candidate extent.
`Object` | `executeWithArray(Object[] params)`
`Object` | `executeWithMap(Map params)`
`Set` | `getAccessPathClasses()`
`Class` | `getCandidateClass()`
`Collection` | `getCandidateCollection()`
`Extent` | `getCandidateExtent()`
`protected abstract com.solarmetric.kodo.query.ExpressionFactory` | `getExpressionFactory(ClassMetaData type)` Return an `ExpressionFactory` to use to create an expression to be executed against an extent.
`String` | `getFilter()`
`FilterListener` | `getFilterListener(String tag)`
`int` | `getFlushBeforeQueries()`
`boolean` | `getIgnoreCache()`
`String` | `getOrdering()`
`Comparator` | `getOrderingComparator()` Returns a `QueryImpl.QueryResultComparator` that is able to order individual items in the list according to the `setOrdering(java.lang.String)` specification.
`Class` | `getParameterClass(String name)`
`String[][]` | `getParameterDeclarations()`
`PersistenceManager` | `getPersistenceManager()`
`boolean` | `getQueryCacheEnabled()`
`boolean` | `getSortDirection(int orderingIndex)`
`protected abstract FilterListener` | `getStandardFilterListener(String tag)` Return the standard filter extension for the given tag, or null if none.
`Class` | `getVariableClass(String name)`
`boolean` | `isParameter(String name)`
`boolean` | `isVariable(String name)`
`protected void` | `lock()` Synchronizes on an internal lock if the `Multithreaded` flat is set in the persistence manager.
`void` | `registerListener(FilterListener listener)` Register a filter listener for this particular query.
`void` | `setCandidates(Collection candidateCollection)`
`void` | `setCandidates(Extent candidateExtent)`
`void` | `setClass(Class candidateClass)`
`void` | `setFilter(String filter)`
`void` | `setFlushBeforeQueries(int flush)`
`void` | `setIgnoreCache(boolean flag)`
`void` | `setOrdering(String ordering)`
`void` | `setQueryCacheEnabled(boolean enabled)`
`String` | `toString()`
`protected void` | `unlock()` Releases the internal lock.

Methods inherited from class java.lang.Object
`, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### QueryImpl

    public QueryImpl(PersistenceManagerImpl pm)

  Construct a query managed by the given persistence manager.

### QueryImpl

    public QueryImpl(PersistenceManagerImpl pm,
                     Object copy)

  Construct a query managed by the given persistence manager, copying the candidate class, filter, parameters, variables, ordering, and options from the given query. If not null, the given query must also be a QueryImpl instance.

Method Detail

### getPersistenceManager

    public PersistenceManager getPersistenceManager()

  Specified by:
    `getPersistenceManager` in interface `Query`

### setClass

    public void setClass(Class candidateClass)

  Specified by:
    `setClass` in interface `Query`

### setCandidates

    public void setCandidates(Collection candidateCollection)

  Specified by:
    `setCandidates` in interface `Query`

### setCandidates

    public void setCandidates(Extent candidateExtent)

  Specified by:
    `setCandidates` in interface `Query`

### setFilter

    public void setFilter(String filter)

  Specified by:
    `setFilter` in interface `Query`

### declareImports

    public void declareImports(String imports)

  Specified by:
    `declareImports` in interface `Query`

### declareVariables

    public void declareVariables(String variables)

  Specified by:
    `declareVariables` in interface `Query`

### declareParameters

    public void declareParameters(String parameters)

  Specified by:
    `declareParameters` in interface `Query`

### setOrdering

    public void setOrdering(String ordering)

  Specified by:
    `setOrdering` in interface `Query`

### setIgnoreCache

    public void setIgnoreCache(boolean flag)

  Specified by:
    `setIgnoreCache` in interface `Query`

### getIgnoreCache

    public boolean getIgnoreCache()

  Specified by:
    `getIgnoreCache` in interface `Query`

### compile

    public void compile()

  Specified by:
    `compile` in interface `Query`

### execute

    public Object execute()

  Specified by:
    `execute` in interface `Query`

### execute

    public Object execute(Object p1)

  Specified by:
    `execute` in interface `Query`

### execute

    public Object execute(Object p1,
                          Object p2)

  Specified by:
    `execute` in interface `Query`

### execute

    public Object execute(Object p1,
                          Object p2,
                          Object p3)

  Specified by:
    `execute` in interface `Query`

### executeWithArray

    public Object executeWithArray(Object[] params)

  Specified by:
    `executeWithArray` in interface `Query`

### executeWithMap

    public Object executeWithMap(Map params)

  Specified by:
    `executeWithMap` in interface `Query`

### closeAll

    public void closeAll()

  Close all query results.
  Specified by:
    `closeAll` in interface `Query`

### close

    public void close(Object queryResult)

  Close the given query result.
  Specified by:
    `close` in interface `Query`

### registerListener

    public void registerListener(FilterListener listener)

  Register a filter listener for this particular query.

### executeQuery

    protected abstract ResultList executeQuery(ClassMetaData type,
                                               boolean subclasses,
                                               com.solarmetric.kodo.query.ExpressionFactory factory,
                                               com.solarmetric.kodo.query.Expression exp,
                                               Map params)

  Execute the given expression against the given candidate extent.
  Parameters:
    `type` - the base type the query should match
    `subclasses` - true if subclasses should be included in the results
    `factory` - the expression factory used to compile the expression
    `exp` - the compiled expression for the parsed query
    `params` - map of parameter names to values
  Returns:
    a list of matching objects

### getExpressionFactory

    protected abstract com.solarmetric.kodo.query.ExpressionFactory getExpressionFactory(ClassMetaData type)

  Return an `ExpressionFactory` to use to create an expression to be executed against an extent. Each factory will be used to compile one filter only.

### getStandardFilterListener

    protected abstract FilterListener getStandardFilterListener(String tag)

  Return the standard filter extension for the given tag, or null if none. This method is called only after checking the listeners that have been added to this particular query and the user-defined listeners in the `Configuration`.

### close

    protected abstract void close(List result)

  Close the given query result.

### getSortDirection

    public boolean getSortDirection(int orderingIndex)

  Specified by:
    `getSortDirection` in interface `com.solarmetric.kodo.query.Resolver`

### isParameter

    public boolean isParameter(String name)

  Specified by:
    `isParameter` in interface `com.solarmetric.kodo.query.Resolver`

### isVariable

    public boolean isVariable(String name)

  Specified by:
    `isVariable` in interface `com.solarmetric.kodo.query.Resolver`

### getParameterClass

    public Class getParameterClass(String name)

  Specified by:
    `getParameterClass` in interface `com.solarmetric.kodo.query.Resolver`

### getVariableClass

    public Class getVariableClass(String name)

  Specified by:
    `getVariableClass` in interface `com.solarmetric.kodo.query.Resolver`

### classForName

    public Class classForName(String name)

  Specified by:
    `classForName` in interface `com.solarmetric.kodo.query.Resolver`

### getFilterListener

    public FilterListener getFilterListener(String tag)

  Specified by:
    `getFilterListener` in interface `com.solarmetric.kodo.query.Resolver`

### getCandidateExtent

    public Extent getCandidateExtent()

  Specified by:
    `getCandidateExtent` in interface `com.solarmetric.kodo.query.KodoQuery`

### getCandidateCollection

    public Collection getCandidateCollection()

  Specified by:
    `getCandidateCollection` in interface `com.solarmetric.kodo.query.KodoQuery`

### lock

    protected void lock()

  Synchronizes on an internal lock if the `Multithreaded` flat is set in the persistence manager. Make sure to call `unlock()` in a finally clause of the same method.

### unlock

    protected void unlock()

  Releases the internal lock.

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### getCandidateClass

    public Class getCandidateClass()

  Specified by:
    `getCandidateClass` in interface `com.solarmetric.kodo.query.KodoQuery`

### getParameterDeclarations

    public String[][] getParameterDeclarations()

  Specified by:
    `getParameterDeclarations` in interface `com.solarmetric.kodo.query.KodoQuery`

### getAccessPathClasses

    public Set getAccessPathClasses()

  Specified by:
    `getAccessPathClasses` in interface `com.solarmetric.kodo.query.KodoQuery`

### getFilter

    public String getFilter()

  Specified by:
    `getFilter` in interface `com.solarmetric.kodo.query.KodoQuery`

### getOrdering

    public String getOrdering()

  Specified by:
    `getOrdering` in interface `com.solarmetric.kodo.query.KodoQuery`

### setQueryCacheEnabled

    public void setQueryCacheEnabled(boolean enabled)

  Specified by:
    `setQueryCacheEnabled` in interface `com.solarmetric.kodo.query.KodoQuery`

### getQueryCacheEnabled

    public boolean getQueryCacheEnabled()

  Specified by:
    `getQueryCacheEnabled` in interface `com.solarmetric.kodo.query.KodoQuery`

### setFlushBeforeQueries

    public void setFlushBeforeQueries(int flush)

  Specified by:
    `setFlushBeforeQueries` in interface `com.solarmetric.kodo.query.KodoQuery`

### getFlushBeforeQueries

    public int getFlushBeforeQueries()

  Specified by:
    `getFlushBeforeQueries` in interface `com.solarmetric.kodo.query.KodoQuery`

### getOrderingComparator

    public Comparator getOrderingComparator()

  Returns a `QueryImpl.QueryResultComparator` that is able to order individual items in the list according to the `setOrdering(java.lang.String)` specification. This will be used when results ordering need to be evaluated in-memory.
  Returns:
    a `QueryImpl.QueryResultComparator` to order query results, or null if `setOrdering(java.lang.String)` has not been called for this Query.

Overview | Package | Class | Tree | Deprecated | Index | Help
| SolarMetric Kodo JDO 2.5.8 generated on January 11 2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2001,2002,2003 SolarMetric, Inc. All Rights Reserved.