public class DataDomain extends Object implements QueryEngine, DataChannel
FLUSH_CASCADE_SYNC, FLUSH_NOCASCADE_SYNC, GRAPH_CHANGED_SUBJECT, GRAPH_FLUSHED_SUBJECT, GRAPH_ROLLEDBACK_SUBJECT, ROLLBACK_CASCADE_SYNC
Constructor and Description |
---|
DataDomain(String name)
Creates a DataDomain and assigns it a name.
|
DataDomain(String name,
Map<String,String> properties)
Deprecated.
since 4.0 unused
|
Modifier and Type | Method and Description |
---|---|
void |
addDataMap(DataMap dataMap) |
void |
addFilter(DataChannelFilter filter)
Adds a new filter, immediately calling its 'init' method.
|
void |
addListener(Object listener)
Adds a listener, mapping its methods to events based on annotations.
|
void |
addNode(DataNode node)
Adds new DataNode.
|
protected void |
checkStopped()
Checks that Domain is not stopped.
|
DataMap |
getDataMap(String mapName) |
Collection<DataMap> |
getDataMaps()
Returns a collection of registered DataMaps.
|
DataNode |
getDataNode(String nodeName)
Returns registered DataNode whose name matches
name
parameter. |
Collection<DataNode> |
getDataNodes()
Returns an unmodifiable collection of DataNodes associated with this
domain.
|
DataRowStoreFactory |
getDataRowStoreFactory() |
DataNode |
getDefaultNode()
An optional DataNode that is used for DataMaps that are not linked to a
DataNode explicitly.
|
EntityResolver |
getEntityResolver()
Returns an EntityResolver that stores mapping information for this
domain.
|
EntitySorter |
getEntitySorter() |
EventManager |
getEventManager()
Returns EventManager used by this DataDomain.
|
List<DataChannelFilter> |
getFilters()
Returns an unmodifiable list of filters registered with this DataDomain.
|
int |
getMaxIdQualifierSize()
Returns a maximum number of object IDs to match in a single query for
queries that select objects based on collection of ObjectIds.
|
String |
getName()
Returns "name" property value.
|
Map<String,String> |
getProperties() |
QueryCache |
getQueryCache()
Returns shared
QueryCache used by this DataDomain. |
DataRowStore |
getSharedSnapshotCache()
Returns snapshots cache for this DataDomain, lazily initializing it on
the first call if 'sharedCacheEnabled' flag is true.
|
void |
initWithProperties(Map<String,String> properties)
Deprecated.
since 4.0 properties are processed by the DI provider.
|
boolean |
isSharedCacheEnabled()
Returns
true if DataContexts produced by this DataDomain are
using shared DataRowStore. |
boolean |
isValidatingObjectsOnCommit()
Returns whether child DataContexts default behavior is to perform object
validation before commit is executed.
|
DataNode |
lookupDataNode(DataMap map)
Returns a DataNode that should handle queries for all entities in a
DataMap.
|
QueryResponse |
onQuery(ObjectContext originatingContext,
Query query)
Runs query returning generic QueryResponse.
|
GraphDiff |
onSync(ObjectContext originatingContext,
GraphDiff changes,
int syncType)
Only handles commit-type synchronization, ignoring any other type.
|
void |
performQueries(Collection<? extends Query> queries,
OperationObserver callback)
Routes queries to appropriate DataNodes for execution.
|
void |
removeDataMap(String mapName)
Removes named DataMap from this DataDomain and any underlying DataNodes
that include it.
|
void |
removeDataNode(String nodeName)
Removes a DataNode from DataDomain.
|
void |
removeFilter(DataChannelFilter filter)
Removes a filter from the filter chain.
|
protected void |
resetProperties() |
void |
setDataRowStoreFactory(DataRowStoreFactory dataRowStoreFactory) |
void |
setDefaultNode(DataNode defaultNode) |
void |
setEntityResolver(EntityResolver entityResolver)
Sets EntityResolver.
|
void |
setEntitySorter(EntitySorter entitySorter) |
void |
setEventManager(EventManager eventManager)
Sets EventManager used by this DataDomain.
|
void |
setMaxIdQualifierSize(int maxIdQualifierSize) |
void |
setName(String name)
Sets "name" property to a new value.
|
void |
setQueryCache(QueryCache queryCache) |
void |
setSharedCacheEnabled(boolean sharedCacheEnabled) |
void |
setSharedSnapshotCache(DataRowStore snapshotCache)
Shuts down the previous cache instance, sets cache to the new
DataSowStore instance and updates two properties of the new DataSowStore:
name and eventManager.
|
void |
setValidatingObjectsOnCommit(boolean flag)
Sets the property defining whether child DataContexts should perform
object validation before commit is executed.
|
void |
shutdown()
Shutdowns all owned data nodes and marks this domain as stopped.
|
String |
toString() |
public static final String SHARED_CACHE_ENABLED_PROPERTY
public static final boolean SHARED_CACHE_ENABLED_DEFAULT
public static final String VALIDATING_OBJECTS_ON_COMMIT_PROPERTY
public static final boolean VALIDATING_OBJECTS_ON_COMMIT_DEFAULT
@Deprecated public static final String USING_EXTERNAL_TRANSACTIONS_PROPERTY
Constants.SERVER_EXTERNAL_TX_PROPERTY
.@Deprecated public static final boolean USING_EXTERNAL_TRANSACTIONS_DEFAULT
Constants.SERVER_EXTERNAL_TX_PROPERTY
.protected JdbcEventLogger jdbcEventLogger
protected TransactionManager transactionManager
protected DataRowStoreFactory dataRowStoreFactory
protected int maxIdQualifierSize
protected List<DataChannelFilter> filters
protected DataNode defaultNode
protected EntityResolver entityResolver
protected DataRowStore sharedSnapshotCache
protected String name
protected QueryCache queryCache
protected boolean sharedCacheEnabled
protected boolean validatingObjectsOnCommit
protected EventManager eventManager
protected EntitySorter entitySorter
protected boolean stopped
public DataDomain(String name)
@Deprecated public DataDomain(String name, Map<String,String> properties)
name
- DataDomain name. Domain can be located using its name in the
Configuration object.properties
- A Map containing domain configuration properties.protected void checkStopped() throws DomainStoppedException
DomainStoppedException
public EntitySorter getEntitySorter()
public void setEntitySorter(EntitySorter entitySorter)
protected void resetProperties()
@Deprecated public void initWithProperties(Map<String,String> properties)
public EventManager getEventManager()
getEventManager
in interface DataChannel
public void setEventManager(EventManager eventManager)
public String getName()
public void setName(String name)
public boolean isSharedCacheEnabled()
true
if DataContexts produced by this DataDomain are
using shared DataRowStore. Returns false
if each DataContext
would work with its own DataRowStore. Note that this setting can be
overwritten per DataContext.public void setSharedCacheEnabled(boolean sharedCacheEnabled)
public boolean isValidatingObjectsOnCommit()
public void setValidatingObjectsOnCommit(boolean flag)
public Map<String,String> getProperties()
public DataRowStore getSharedSnapshotCache()
public void setSharedSnapshotCache(DataRowStore snapshotCache)
public void addDataMap(DataMap dataMap)
public void removeDataMap(String mapName)
public void removeDataNode(String nodeName)
public Collection<DataMap> getDataMaps()
public Collection<DataNode> getDataNodes()
public void addNode(DataNode node)
public DataNode getDataNode(String nodeName)
name
parameter.public DataNode lookupDataNode(DataMap map)
public void setEntityResolver(EntityResolver entityResolver)
@BeforeScopeEnd public void shutdown()
public void performQueries(Collection<? extends Query> queries, OperationObserver callback)
performQueries
in interface QueryEngine
public QueryResponse onQuery(ObjectContext originatingContext, Query query)
onQuery
in interface DataChannel
originatingContext
- an ObjectContext that originated the query, used to
register result objects.public EntityResolver getEntityResolver()
getEntityResolver
in interface QueryEngine
getEntityResolver
in interface DataChannel
public GraphDiff onSync(ObjectContext originatingContext, GraphDiff changes, int syncType)
onSync
in interface DataChannel
originatingContext
- an ObjectContext that initiated the sync. Can be null.changes
- diff from the context that initiated the sync.syncType
- One of DataChannel.FLUSH_NOCASCADE_SYNC
, DataChannel.FLUSH_CASCADE_SYNC
,
DataChannel.ROLLBACK_CASCADE_SYNC
.public QueryCache getQueryCache()
QueryCache
used by this DataDomain.public void setQueryCache(QueryCache queryCache)
public DataRowStoreFactory getDataRowStoreFactory()
public void setDataRowStoreFactory(DataRowStoreFactory dataRowStoreFactory)
public List<DataChannelFilter> getFilters()
Filter ordering note: filters are applied in reverse order of their occurrence in the filter list. I.e. the last filter in the list called first in the chain.
public void addFilter(DataChannelFilter filter)
public void removeFilter(DataChannelFilter filter)
public void addListener(Object listener)
public DataNode getDefaultNode()
public void setDefaultNode(DataNode defaultNode)
public int getMaxIdQualifierSize()
setMaxIdQualifierSize(int)
or changing
the value for property
Constants.SERVER_MAX_ID_QUALIFIER_SIZE_PROPERTY
.public void setMaxIdQualifierSize(int maxIdQualifierSize)
Copyright © 2001–2018 Apache Cayenne. All rights reserved.