public class ServerRuntime extends CayenneRuntime
The "Server" prefix in the name is in contrast to ROP "client" (that is started via ClientRuntime). So ServerRuntime is the default Cayenne stack that you should be using in all apps with the exception of client-side ROP.
injector, modules, threadInjector
Modifier | Constructor and Description |
---|---|
protected |
ServerRuntime(Collection<Module> modules)
Creates a server runtime configuring it with a standard set of services
contained in
ServerModule . |
|
ServerRuntime(String[] configurationLocations,
Module... extraModules)
Deprecated.
since 4.0 use
builder() . |
|
ServerRuntime(String configurationLocation,
Module... extraModules)
Deprecated.
since 4.0 use
builder() . |
Modifier and Type | Method and Description |
---|---|
static ServerRuntimeBuilder |
builder()
Creates a builder of ServerRuntime.
|
static ServerRuntimeBuilder |
builder(String name)
Creates a builder of ServerRuntime.
|
DataDomain |
getDataDomain()
Returns the main runtime DataDomain.
|
DataSource |
getDataSource()
Returns a default DataSource for this runtime.
|
DataSource |
getDataSource(String dataNodeName)
Provides access to the JDBC DataSource assigned to a given DataNode.
|
<T> T |
performInTransaction(TransactionalOperation<T> op)
Runs provided operation wrapped in a single transaction.
|
<T> T |
performInTransaction(TransactionalOperation<T> op,
TransactionListener callback)
Runs provided operation wrapped in a single transaction.
|
bindThreadInjector, getChannel, getContext, getContext, getInjector, getModules, getThreadInjector, newContext, newContext, shutdown
@Deprecated public ServerRuntime(String configurationLocation, Module... extraModules)
builder()
.ServerModule
. CayenneServerModule is created with
provided 'configurationLocation'. An optional array of extra modules may
contain service overrides and/or user services.@Deprecated public ServerRuntime(String[] configurationLocations, Module... extraModules)
builder()
.ServerModule
. CayenneServerModule is created with
one or more 'configurationLocations'. An optional array of extra modules
may contain service overrides and/or user services.protected ServerRuntime(Collection<Module> modules)
ServerModule
. CayenneServerModule is created with
one or more 'configurationLocations'. An optional array of extra modules
may contain service overrides and/or user services.public static ServerRuntimeBuilder builder()
public static ServerRuntimeBuilder builder(String name)
name
- optional symbolic name of the created runtime.public <T> T performInTransaction(TransactionalOperation<T> op)
TransactionManager
. Nested
calls to 'performInTransaction' are safe and attached to the same
in-progress transaction. TransactionalOperation can be some arbitrary
user code, which most often than not will consist of multiple Cayenne
operations.public <T> T performInTransaction(TransactionalOperation<T> op, TransactionListener callback)
TransactionManager
. Nested
calls to 'performInTransaction' are safe and attached to the same
in-progress transaction. TransactionalOperation can be some arbitrary
user code, which most often than not will consist of multiple Cayenne
operations.public DataDomain getDataDomain()
CayenneRuntime.getChannel()
. Although users may redefine DataChannel provider
in the DI registry, for instance to decorate this DataDomain with a
custom wrapper.public DataSource getDataSource()
public DataSource getDataSource(String dataNodeName)
Normally Cayenne applications don't need to access DataSource or any other JDBC code directly, however in some unusual conditions it may be needed, and this method provides a shortcut to raw JDBC.
Copyright © 2001–2017 Apache Cayenne. All rights reserved.