Search in sources :

Example 1 with NestedQueryCache

use of org.apache.cayenne.cache.NestedQueryCache in project cayenne by apache.

the class DataContextFactory method createFromDataContext.

protected ObjectContext createFromDataContext(DataContext parent) {
    // child ObjectStore should not have direct access to snapshot cache, so do not
    // pass it in constructor.
    ObjectStore objectStore = objectStoreFactory.createObjectStore(null);
    DataContext context = newInstance(parent, objectStore);
    context.setValidatingObjectsOnCommit(parent.isValidatingObjectsOnCommit());
    context.setUsingSharedSnapshotCache(parent.isUsingSharedSnapshotCache());
    context.setQueryCache(new NestedQueryCache(queryCache));
    context.setTransactionFactory(transactionFactory);
    return context;
}
Also used : ObjectStore(org.apache.cayenne.access.ObjectStore) DataContext(org.apache.cayenne.access.DataContext) NestedQueryCache(org.apache.cayenne.cache.NestedQueryCache)

Example 2 with NestedQueryCache

use of org.apache.cayenne.cache.NestedQueryCache in project cayenne by apache.

the class CayenneContextFactory method createContext.

public ObjectContext createContext(DataChannel parent) {
    boolean changeEvents = properties.getBoolean(ClientConstants.ROP_CONTEXT_CHANGE_EVENTS_PROPERTY, false);
    boolean lifecycleEvents = properties.getBoolean(ClientConstants.ROP_CONTEXT_LIFECYCLE_EVENTS_PROPERTY, false);
    CayenneContext context = newInstance(parent, changeEvents, lifecycleEvents);
    context.setQueryCache(new NestedQueryCache(queryCache));
    return context;
}
Also used : NestedQueryCache(org.apache.cayenne.cache.NestedQueryCache) CayenneContext(org.apache.cayenne.CayenneContext)

Example 3 with NestedQueryCache

use of org.apache.cayenne.cache.NestedQueryCache in project cayenne by apache.

the class BaseContext method attachToRuntime.

/**
 * Attaches this context to the CayenneRuntime whose Injector is passed as
 * an argument to this method.
 *
 * @since 3.1
 */
protected void attachToRuntime(Injector injector) {
    // TODO: nested contexts handling??
    attachToChannel(injector.getInstance(DataChannel.class));
    setQueryCache(new NestedQueryCache(injector.getInstance(QueryCache.class)));
}
Also used : NestedQueryCache(org.apache.cayenne.cache.NestedQueryCache)

Example 4 with NestedQueryCache

use of org.apache.cayenne.cache.NestedQueryCache in project cayenne by apache.

the class DataContextFactory method createFromGenericChannel.

protected ObjectContext createFromGenericChannel(DataChannel parent) {
    // for new dataRowStores use the same name for all stores
    // it makes it easier to track the event subject
    DataRowStore snapshotCache = (dataDomain.isSharedCacheEnabled()) ? dataDomain.getSharedSnapshotCache() : dataRowStoreFactory.createDataRowStore(dataDomain.getName());
    DataContext context = newInstance(parent, objectStoreFactory.createObjectStore(snapshotCache));
    context.setValidatingObjectsOnCommit(dataDomain.isValidatingObjectsOnCommit());
    context.setQueryCache(new NestedQueryCache(queryCache));
    return context;
}
Also used : DataContext(org.apache.cayenne.access.DataContext) NestedQueryCache(org.apache.cayenne.cache.NestedQueryCache) DataRowStore(org.apache.cayenne.access.DataRowStore)

Example 5 with NestedQueryCache

use of org.apache.cayenne.cache.NestedQueryCache in project cayenne by apache.

the class DataContextFactory method createdFromDataDomain.

protected ObjectContext createdFromDataDomain(DataDomain parent) {
    // for new dataRowStores use the same name for all stores
    // it makes it easier to track the event subject
    DataRowStore snapshotCache = (parent.isSharedCacheEnabled()) ? parent.getSharedSnapshotCache() : dataRowStoreFactory.createDataRowStore(parent.getName());
    DataContext context = newInstance(parent, objectStoreFactory.createObjectStore(snapshotCache));
    context.setValidatingObjectsOnCommit(parent.isValidatingObjectsOnCommit());
    context.setQueryCache(new NestedQueryCache(queryCache));
    context.setTransactionFactory(transactionFactory);
    return context;
}
Also used : DataContext(org.apache.cayenne.access.DataContext) NestedQueryCache(org.apache.cayenne.cache.NestedQueryCache) DataRowStore(org.apache.cayenne.access.DataRowStore)

Aggregations

NestedQueryCache (org.apache.cayenne.cache.NestedQueryCache)6 DataContext (org.apache.cayenne.access.DataContext)3 DataRowStore (org.apache.cayenne.access.DataRowStore)2 CayenneContext (org.apache.cayenne.CayenneContext)1 DataChannelFilter (org.apache.cayenne.DataChannelFilter)1 DataChannelQueryFilter (org.apache.cayenne.DataChannelQueryFilter)1 DataChannelSyncFilter (org.apache.cayenne.DataChannelSyncFilter)1 DataDomain (org.apache.cayenne.access.DataDomain)1 DataNode (org.apache.cayenne.access.DataNode)1 DataRowStoreFactory (org.apache.cayenne.access.DataRowStoreFactory)1 ObjectStore (org.apache.cayenne.access.ObjectStore)1 DataChannelDescriptor (org.apache.cayenne.configuration.DataChannelDescriptor)1 DataNodeDescriptor (org.apache.cayenne.configuration.DataNodeDescriptor)1 EventManager (org.apache.cayenne.event.EventManager)1 DataMap (org.apache.cayenne.map.DataMap)1 EntitySorter (org.apache.cayenne.map.EntitySorter)1