org.apache.openjpa.persistence
Class FetchPlanImpl

java.lang.Object
  extended by org.apache.openjpa.persistence.FetchPlanImpl
All Implemented Interfaces:
FetchPlan
Direct Known Subclasses:
JDBCFetchPlanImpl

public class FetchPlanImpl
extends Object
implements FetchPlan

Implements FetchPlan via delegation to FetchConfiguration.

Since:
0.4.1
Author:
Abe White, Pinaki Poddar

Field Summary
protected static Map<String,HintValueConverter[]> _hints
          Structure holds one or more converters for a user-specified hint value.
protected static Map<String,List<String>> _precedence
          Structure holds ranking of equivalent hint keys.
 
Fields inherited from interface org.apache.openjpa.persistence.FetchPlan
DEFAULT, DEPTH_INFINITE, GROUP_ALL, GROUP_DEFAULT
 
Constructor Summary
FetchPlanImpl(FetchConfiguration fetch)
          Constructor; supply delegate.
 
Method Summary
 FetchPlan addFetchGroup(String group)
          Adds group to the set of fetch group to use when loading objects.
 FetchPlan addFetchGroups(Collection groups)
          Adds groups to the set of fetch group names to use when loading objects.
 FetchPlan addFetchGroups(String... groups)
          Adds groups to the set of fetch group names to use when loading objects.
 FetchPlan addField(Class cls, String field)
          Adds field to the set of field names to use when loading objects.
 FetchPlan addField(String field)
          Adds field to the set of fully-qualified field names to use when loading objects.
 FetchPlan addFields(Class cls, Collection fields)
          Adds fields to the set of field names to use when loading objects.
 FetchPlan addFields(Class cls, String... fields)
          Adds fields to the set of field names to use when loading objects.
 FetchPlan addFields(Collection fields)
          Adds fields to the set of fully-qualified field names to use when loading objects.
 FetchPlan addFields(String... fields)
          Adds fields to the set of fully-qualified field names to use when loading objects.
 FetchPlan clearFetchGroups()
          Clears the set of fetch group names to use wen loading data.
 FetchPlan clearFields()
          Clears the set of field names to use wen loading data.
(package private)  Object convertHintValue(String key, Object value)
           
 boolean equals(Object other)
           
 DataCacheRetrieveMode getCacheRetrieveMode()
          Gets the current retrieve mode for data cache.
 DataCacheStoreMode getCacheStoreMode()
          Gets the current storage mode for data cache.
 FetchConfiguration getDelegate()
          Delegate.
 boolean getExtendedPathLookup()
          Affirms if extended path lookup feature is active.
 int getFetchBatchSize()
          Return the fetch batch size for large result set support.
 Collection<String> getFetchGroups()
          Returns the names of the fetch groups that this component will use when loading objects.
 Collection<String> getFields()
          Returns the fully qualified names of the fields that this component will use when loading objects.
 Object getHint(String key)
          Get the hint value for the given key.
 Map<String,Object> getHints()
          Get the hints and their values currently set on this receiver.
 PessimisticLockScope getLockScope()
          The lock scope to use for locking loaded objects.
 int getLockTimeout()
          The number of milliseconds to wait for an object lock, or -1 for no limit.
 int getMaxFetchDepth()
          The maximum fetch depth when loading an object.
 boolean getQueryResultCache()
           
 boolean getQueryResultCacheEnabled()
          Return whether or not query caching is enabled.
 int getQueryTimeout()
          The number of milliseconds to wait for a query, or -1 for no limit.
 LockModeType getReadLockMode()
          The lock level to use for locking loaded objects.
 LockModeType getWriteLockMode()
          The lock level to use for locking dirtied objects.
 boolean hasField(Class cls, String field)
          Return true if the given field has been added.
 boolean hasField(String field)
          Return true if the given field has been added.
 int hashCode()
           
(package private)  boolean intersects(Collection<String> keys, Collection<String> b)
           
(package private)  boolean isRecognizedHint(String key)
           
protected  DelegatingFetchConfiguration newDelegatingFetchConfiguration(FetchConfiguration fetch)
          Create a new exception-translating delegating fetch configuration.
protected static void registerHint(String[] keys, HintValueConverter... converters)
          Registers a hint key with its value converters.
 FetchPlan removeFetchGroup(String group)
          Remove the given fetch group.
 FetchPlan removeFetchGroups(Collection groups)
          Removes groups from the set of fetch group names to use when loading objects.
 FetchPlan removeFetchGroups(String... groups)
          Removes groups from the set of fetch group names to use when loading objects.
 FetchPlan removeField(Class cls, String field)
          Remove the given field.
 FetchPlan removeField(String field)
          Remove the given fully-qualified field.
 FetchPlan removeFields(Class cls, Collection fields)
          Removes fields from the set of field names to use when loading objects.
 FetchPlan removeFields(Class cls, String... fields)
          Removes fields from the set of field names to use when loading objects.
 FetchPlan removeFields(Collection fields)
          Removes fields from the set of fully-qualified field names to use when loading objects.
 FetchPlan removeFields(String... fields)
          Removes fields from the set of fully-qualified field names to use when loading objects.
 FetchPlan resetFetchGroups()
          Resets the set of fetch groups to the list in the global configuration.
 FetchPlan setCacheRetrieveMode(DataCacheRetrieveMode mode)
          Sets the current retrieve mode for data cache.
 FetchPlan setCacheStoreMode(DataCacheStoreMode mode)
          Sets the current storage mode for data cache.
 FetchPlan setExtendedPathLookup(boolean flag)
          Sets extended path lookup feature.
 FetchPlan setFetchBatchSize(int fetchBatchSize)
          Set the fetch batch size for large result set support.
 void setHint(String key, Object value)
          Sets the hint after converting the value appropriately.
 void setHints(Map<String,Object> hints)
           
 FetchPlan setLockScope(PessimisticLockScope scope)
          The lock scope to use for locking loaded objects.
 FetchPlan setLockTimeout(int timeout)
          The number of milliseconds to wait for an object lock, or -1 for no limit.
 FetchPlan setMaxFetchDepth(int depth)
          The maximum fetch depth when loading an object.
 FetchPlan setQueryResultCache(boolean cache)
           
 FetchPlan setQueryResultCacheEnabled(boolean cache)
          Control whether or not query caching is enabled.
 FetchPlan setQueryTimeout(int timeout)
          The number of milliseconds to wait for a query, or -1 for no limit.
 FetchPlan setReadLockMode(LockModeType mode)
          The lock level to use for locking loaded objects.
 FetchPlan setWriteLockMode(LockModeType mode)
          The lock level to use for locking dirtied objects.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_precedence

protected static Map<String,List<String>> _precedence
Structure holds ranking of equivalent hint keys. Each entry value is a list of other keys that are higher rank than the entry key.


_hints

protected static Map<String,HintValueConverter[]> _hints
Structure holds one or more converters for a user-specified hint value.

Constructor Detail

FetchPlanImpl

public FetchPlanImpl(FetchConfiguration fetch)
Constructor; supply delegate.

Method Detail

registerHint

protected static void registerHint(String[] keys,
                                   HintValueConverter... converters)
Registers a hint key with its value converters.

Parameters:
keys - a set of keys in increasing order of ranking. Can not be null or empty.
converters - array of converters that are attempts in order to convert a user-specified hint value to a value that is consumable by the kernel.

newDelegatingFetchConfiguration

protected DelegatingFetchConfiguration newDelegatingFetchConfiguration(FetchConfiguration fetch)
Create a new exception-translating delegating fetch configuration.


getDelegate

public FetchConfiguration getDelegate()
Delegate.

Specified by:
getDelegate in interface FetchPlan

getMaxFetchDepth

public int getMaxFetchDepth()
Description copied from interface: FetchPlan
The maximum fetch depth when loading an object.

Specified by:
getMaxFetchDepth in interface FetchPlan

setMaxFetchDepth

public FetchPlan setMaxFetchDepth(int depth)
Description copied from interface: FetchPlan
The maximum fetch depth when loading an object.

Specified by:
setMaxFetchDepth in interface FetchPlan

getFetchBatchSize

public int getFetchBatchSize()
Description copied from interface: FetchPlan
Return the fetch batch size for large result set support. Defaults to the openjpa.FetchBatchSize setting. Note that this property will be ignored under some data stores.

Specified by:
getFetchBatchSize in interface FetchPlan

setFetchBatchSize

public FetchPlan setFetchBatchSize(int fetchBatchSize)
Description copied from interface: FetchPlan
Set the fetch batch size for large result set support. Defaults to the openjpa.FetchBatchSize setting. Note that this property will be ignored under some data stores.

Specified by:
setFetchBatchSize in interface FetchPlan

getQueryResultCacheEnabled

public boolean getQueryResultCacheEnabled()
Description copied from interface: FetchPlan
Return whether or not query caching is enabled. If this returns true but the datacache plugin is not installed, caching will not be enabled. If this returns false, query caching will not be used even if the datacache plugin is installed.

Specified by:
getQueryResultCacheEnabled in interface FetchPlan

setQueryResultCacheEnabled

public FetchPlan setQueryResultCacheEnabled(boolean cache)
Description copied from interface: FetchPlan
Control whether or not query caching is enabled. This has no effect if the datacache plugin is not installed, or if the query cache size is set to zero.

Specified by:
setQueryResultCacheEnabled in interface FetchPlan

getQueryResultCache

public boolean getQueryResultCache()
Specified by:
getQueryResultCache in interface FetchPlan

setQueryResultCache

public FetchPlan setQueryResultCache(boolean cache)
Specified by:
setQueryResultCache in interface FetchPlan

getFetchGroups

public Collection<String> getFetchGroups()
Description copied from interface: FetchPlan
Returns the names of the fetch groups that this component will use when loading objects. Defaults to the openjpa.FetchGroups setting.

Specified by:
getFetchGroups in interface FetchPlan

addFetchGroup

public FetchPlan addFetchGroup(String group)
Description copied from interface: FetchPlan
Adds group to the set of fetch group to use when loading objects.

Specified by:
addFetchGroup in interface FetchPlan

addFetchGroups

public FetchPlan addFetchGroups(String... groups)
Description copied from interface: FetchPlan
Adds groups to the set of fetch group names to use when loading objects.

Specified by:
addFetchGroups in interface FetchPlan

addFetchGroups

public FetchPlan addFetchGroups(Collection groups)
Description copied from interface: FetchPlan
Adds groups to the set of fetch group names to use when loading objects.

Specified by:
addFetchGroups in interface FetchPlan

removeFetchGroup

public FetchPlan removeFetchGroup(String group)
Description copied from interface: FetchPlan
Remove the given fetch group.

Specified by:
removeFetchGroup in interface FetchPlan

removeFetchGroups

public FetchPlan removeFetchGroups(String... groups)
Description copied from interface: FetchPlan
Removes groups from the set of fetch group names to use when loading objects.

Specified by:
removeFetchGroups in interface FetchPlan

removeFetchGroups

public FetchPlan removeFetchGroups(Collection groups)
Description copied from interface: FetchPlan
Removes groups from the set of fetch group names to use when loading objects.

Specified by:
removeFetchGroups in interface FetchPlan

clearFetchGroups

public FetchPlan clearFetchGroups()
Description copied from interface: FetchPlan
Clears the set of fetch group names to use wen loading data. After this operation is invoked, only those fields in the default fetch group (and any requested field) will be loaded when loading an object.

Specified by:
clearFetchGroups in interface FetchPlan

resetFetchGroups

public FetchPlan resetFetchGroups()
Description copied from interface: FetchPlan
Resets the set of fetch groups to the list in the global configuration.

Specified by:
resetFetchGroups in interface FetchPlan

getFields

public Collection<String> getFields()
Description copied from interface: FetchPlan
Returns the fully qualified names of the fields that this component will use when loading objects. Defaults to the empty set.

Specified by:
getFields in interface FetchPlan

hasField

public boolean hasField(String field)
Description copied from interface: FetchPlan
Return true if the given field has been added.

Specified by:
hasField in interface FetchPlan

hasField

public boolean hasField(Class cls,
                        String field)
Description copied from interface: FetchPlan
Return true if the given field has been added.

Specified by:
hasField in interface FetchPlan

addField

public FetchPlan addField(String field)
Description copied from interface: FetchPlan
Adds field to the set of fully-qualified field names to use when loading objects.

Specified by:
addField in interface FetchPlan

addField

public FetchPlan addField(Class cls,
                          String field)
Description copied from interface: FetchPlan
Adds field to the set of field names to use when loading objects.

Specified by:
addField in interface FetchPlan

addFields

public FetchPlan addFields(String... fields)
Description copied from interface: FetchPlan
Adds fields to the set of fully-qualified field names to use when loading objects.

Specified by:
addFields in interface FetchPlan

addFields

public FetchPlan addFields(Class cls,
                           String... fields)
Description copied from interface: FetchPlan
Adds fields to the set of field names to use when loading objects.

Specified by:
addFields in interface FetchPlan

addFields

public FetchPlan addFields(Collection fields)
Description copied from interface: FetchPlan
Adds fields to the set of fully-qualified field names to use when loading objects.

Specified by:
addFields in interface FetchPlan

addFields

public FetchPlan addFields(Class cls,
                           Collection fields)
Description copied from interface: FetchPlan
Adds fields to the set of field names to use when loading objects.

Specified by:
addFields in interface FetchPlan

removeField

public FetchPlan removeField(String field)
Description copied from interface: FetchPlan
Remove the given fully-qualified field.

Specified by:
removeField in interface FetchPlan

removeField

public FetchPlan removeField(Class cls,
                             String field)
Description copied from interface: FetchPlan
Remove the given field.

Specified by:
removeField in interface FetchPlan

removeFields

public FetchPlan removeFields(String... fields)
Description copied from interface: FetchPlan
Removes fields from the set of fully-qualified field names to use when loading objects.

Specified by:
removeFields in interface FetchPlan

removeFields

public FetchPlan removeFields(Class cls,
                              String... fields)
Description copied from interface: FetchPlan
Removes fields from the set of field names to use when loading objects.

Specified by:
removeFields in interface FetchPlan

removeFields

public FetchPlan removeFields(Collection fields)
Description copied from interface: FetchPlan
Removes fields from the set of fully-qualified field names to use when loading objects.

Specified by:
removeFields in interface FetchPlan

removeFields

public FetchPlan removeFields(Class cls,
                              Collection fields)
Description copied from interface: FetchPlan
Removes fields from the set of field names to use when loading objects.

Specified by:
removeFields in interface FetchPlan

clearFields

public FetchPlan clearFields()
Description copied from interface: FetchPlan
Clears the set of field names to use wen loading data. After this operation is invoked, only those fields in the configured fetch groups will be loaded when loading an object.

Specified by:
clearFields in interface FetchPlan

getLockTimeout

public int getLockTimeout()
Description copied from interface: FetchPlan
The number of milliseconds to wait for an object lock, or -1 for no limit.

Specified by:
getLockTimeout in interface FetchPlan

setLockTimeout

public FetchPlan setLockTimeout(int timeout)
Description copied from interface: FetchPlan
The number of milliseconds to wait for an object lock, or -1 for no limit.

Specified by:
setLockTimeout in interface FetchPlan

getLockScope

public PessimisticLockScope getLockScope()
Description copied from interface: FetchPlan
The lock scope to use for locking loaded objects.

Specified by:
getLockScope in interface FetchPlan

setLockScope

public FetchPlan setLockScope(PessimisticLockScope scope)
Description copied from interface: FetchPlan
The lock scope to use for locking loaded objects.

Specified by:
setLockScope in interface FetchPlan

getQueryTimeout

public int getQueryTimeout()
Description copied from interface: FetchPlan
The number of milliseconds to wait for a query, or -1 for no limit.

Specified by:
getQueryTimeout in interface FetchPlan

setQueryTimeout

public FetchPlan setQueryTimeout(int timeout)
Description copied from interface: FetchPlan
The number of milliseconds to wait for a query, or -1 for no limit.

Specified by:
setQueryTimeout in interface FetchPlan

getReadLockMode

public LockModeType getReadLockMode()
Description copied from interface: FetchPlan
The lock level to use for locking loaded objects.

Specified by:
getReadLockMode in interface FetchPlan

setReadLockMode

public FetchPlan setReadLockMode(LockModeType mode)
Description copied from interface: FetchPlan
The lock level to use for locking loaded objects.

Specified by:
setReadLockMode in interface FetchPlan

getWriteLockMode

public LockModeType getWriteLockMode()
Description copied from interface: FetchPlan
The lock level to use for locking dirtied objects.

Specified by:
getWriteLockMode in interface FetchPlan

setWriteLockMode

public FetchPlan setWriteLockMode(LockModeType mode)
Description copied from interface: FetchPlan
The lock level to use for locking dirtied objects.

Specified by:
setWriteLockMode in interface FetchPlan

getExtendedPathLookup

public boolean getExtendedPathLookup()
Description copied from interface: FetchPlan
Affirms if extended path lookup feature is active.

Specified by:
getExtendedPathLookup in interface FetchPlan

setExtendedPathLookup

public FetchPlan setExtendedPathLookup(boolean flag)
Description copied from interface: FetchPlan
Sets extended path lookup feature.

Specified by:
setExtendedPathLookup in interface FetchPlan

getHint

public Object getHint(String key)
Description copied from interface: FetchPlan
Get the hint value for the given key.

Specified by:
getHint in interface FetchPlan
Returns:
null if the key has not been set.

setHint

public void setHint(String key,
                    Object value)
Sets the hint after converting the value appropriately. If a higher ranking equivalent hint is already set, then bypasses this hint.

Specified by:
setHint in interface FetchPlan
value - the value of the hint.

setHints

public void setHints(Map<String,Object> hints)

getHints

public Map<String,Object> getHints()
Description copied from interface: FetchPlan
Get the hints and their values currently set on this receiver.

Specified by:
getHints in interface FetchPlan
Returns:
empty map if no hint has been set.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object other)
Overrides:
equals in class Object

getCacheRetrieveMode

public DataCacheRetrieveMode getCacheRetrieveMode()
Description copied from interface: FetchPlan
Gets the current retrieve mode for data cache.

Specified by:
getCacheRetrieveMode in interface FetchPlan

getCacheStoreMode

public DataCacheStoreMode getCacheStoreMode()
Description copied from interface: FetchPlan
Gets the current storage mode for data cache.

Specified by:
getCacheStoreMode in interface FetchPlan

setCacheStoreMode

public FetchPlan setCacheStoreMode(DataCacheStoreMode mode)
Description copied from interface: FetchPlan
Sets the current storage mode for data cache.

Specified by:
setCacheStoreMode in interface FetchPlan

setCacheRetrieveMode

public FetchPlan setCacheRetrieveMode(DataCacheRetrieveMode mode)
Description copied from interface: FetchPlan
Sets the current retrieve mode for data cache.

Specified by:
setCacheRetrieveMode in interface FetchPlan

convertHintValue

Object convertHintValue(String key,
                        Object value)

isRecognizedHint

boolean isRecognizedHint(String key)

intersects

boolean intersects(Collection<String> keys,
                   Collection<String> b)


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.