Package org.apache.cayenne.configuration
Class CayenneRuntime
java.lang.Object
org.apache.cayenne.configuration.CayenneRuntime
- Direct Known Subclasses:
- ClientRuntime,- ServerRuntime
public abstract class CayenneRuntime extends Object
A superclass of various Cayenne runtime stacks. A Runtime is the main access
 point to Cayenne for a user application. It provides a default Cayenne
 configuration as well as a way to customize this configuration via a built-in
 dependency injection (DI) container. In fact implementation-wise, Runtime
 object is just a convenience thin wrapper around a DI 
Injector.- Since:
- 3.1
- 
Field SummaryFields Modifier and Type Field Description protected Injectorinjectorprotected Collection<Module>modulesprotected static ThreadLocal<Injector>threadInjectorA holder of an Injector bound to the current thread.
- 
Constructor SummaryConstructors Modifier Constructor Description protectedCayenneRuntime(Collection<Module> modules)Creates a CayenneRuntime with configuration based on the supplied collection of DI modules.
- 
Method SummaryModifier and Type Method Description static voidbindThreadInjector(Injector injector)Binds a DIInjectorbound to the current thread.DataChannelgetChannel()Returns the runtimeDataChannel.InjectorgetInjector()Returns DI injector used by this runtime.Collection<Module>getModules()Returns the collection of modules used to initialize this runtime.static InjectorgetThreadInjector()Returns theInjectorbound to the current thread.ObjectContextnewContext()Returns a new ObjectContext instance based on the runtime's main DataChannel.ObjectContextnewContext(DataChannel parentChannel)Returns a new ObjectContext which is a child of the specified DataChannel.voidshutdown()Shuts down the DI injector of this runtime, giving all services that need to release some resources a chance to do that.
- 
Field Details- 
threadInjectorA holder of an Injector bound to the current thread. Used mainly to allow serializable contexts to attach to correct Cayenne stack on deserialization.- Since:
- 3.1
 
- 
injector
- 
modules
 
- 
- 
Constructor Details- 
CayenneRuntimeCreates a CayenneRuntime with configuration based on the supplied collection of DI modules.
 
- 
- 
Method Details- 
bindThreadInjectorBinds a DIInjectorbound to the current thread. It is primarily intended for deserialization of ObjectContexts.- Since:
- 3.1
 
- 
getThreadInjectorReturns theInjectorbound to the current thread. Will return null if none is bound.- Since:
- 3.1
 
- 
getModulesReturns the collection of modules used to initialize this runtime.- Since:
- 4.0
 
- 
getInjectorReturns DI injector used by this runtime.
- 
shutdownShuts down the DI injector of this runtime, giving all services that need to release some resources a chance to do that.
- 
getChannelReturns the runtimeDataChannel.
- 
newContextReturns a new ObjectContext instance based on the runtime's main DataChannel.- Since:
- 4.0
 
- 
newContextReturns a new ObjectContext which is a child of the specified DataChannel. This method is used for creation of nested ObjectContexts, with parent ObjectContext passed as an argument.- Since:
- 4.0
 
 
-