ServerRuntime (cayenne-doc: Cayenne Documentation 5.0-M2 API)
Description: declaration: package: org.apache.cayenne.configuration.server, class: ServerRuntime

# Class ServerRuntime

java.lang.Object
org.apache.cayenne.runtime.CayenneRuntime
org.apache.cayenne.configuration.server.ServerRuntime

@Deprecated(since="5.0", forRemoval=true) public class ServerRuntime extends CayenneRuntime
Deprecated, for removal: This API element is subject to removal in a future version.
since 5.0, use `CayenneRuntime` class instead
Object representing Cayenne stack. Serves as an entry point to Cayenne for user applications and a factory of ObjectContexts. Implementation is a thin wrapper of the dependency injection container.

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.

Since:
  3.1

- ## Field Summary

  ### Fields inherited from class CayenneRuntime

  `injector, modules, threadInjector`
  Modifier and Type
  Field
  Description
  `protected final Injector`
  `injector`
  `protected final Collection<Module>`
  `modules`
  `protected static final ThreadLocal<Injector>`
  `threadInjector`
  A holder of an Injector bound to the current thread.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static CayenneRuntimeBuilder`
  `builder()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  since 5.0, use `CayenneRuntime.builder()` instead
  `static CayenneRuntimeBuilder`
  `builder(String name)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  since 5.0, use `CayenneRuntime.builder(String)` instead

  ### Methods inherited from class CayenneRuntime

  `bindThreadInjector, getChannel, getDataDomain, getDataSource, getDataSource, getInjector, getModules, getThreadInjector, newContext, newContext, performInTransaction, performInTransaction, performInTransaction, performInTransaction, shutdown`
  Modifier and Type
  Method
  Description
  `static void`
  `bindThreadInjector(Injector injector)`
  Binds a DI `Injector` bound to the current thread.
  `DataChannel`
  `getChannel()`
  Returns the runtime `DataChannel`.
  `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.
  `Injector`
  `getInjector()`
  Returns DI injector used by this runtime.
  `Collection<Module>`
  `getModules()`
  Returns the collection of modules used to initialize this runtime.
  `static Injector`
  `getThreadInjector()`
  Returns the `Injector` bound to the current thread.
  `ObjectContext`
  `newContext()`
  Returns a new ObjectContext instance based on the runtime's main DataChannel.
  `ObjectContext`
  `newContext(DataChannel parentChannel)`
  Returns a new ObjectContext which is a child of the specified DataChannel.
  `<T> T`
  `performInTransaction(TransactionalOperation<T> op)`
  Runs provided operation wrapped in a single transaction.
  `<T> T`
  `performInTransaction(TransactionalOperation<T> op, TransactionDescriptor descriptor)`
  Runs provided operation wrapped in a single transaction.
  `<T> T`
  `performInTransaction(TransactionalOperation<T> op, TransactionListener callback)`
  Runs provided operation wrapped in a single transaction.
  `<T> T`
  `performInTransaction(TransactionalOperation<T> op, TransactionListener callback, TransactionDescriptor descriptor)`
  Runs provided operation wrapped in a single transaction.
  `void`
  `shutdown()`
  Shuts down the DI injector of this runtime, giving all services that need to release some resources a chance to do that.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### builder

    @Deprecated(since="5.0", forRemoval=true) public static CayenneRuntimeBuilder builder()
    Deprecated, for removal: This API element is subject to removal in a future version.
    since 5.0, use `CayenneRuntime.builder()` instead
    Creates a builder of CayenneRuntime.
    Returns:
      a builder of CayenneRuntime.
    Since:
      4.0

  - ### builder

    @Deprecated(since="5.0", forRemoval=true) public static CayenneRuntimeBuilder builder(String name)
    Deprecated, for removal: This API element is subject to removal in a future version.
    since 5.0, use `CayenneRuntime.builder(String)` instead
    Creates a builder of CayenneRuntime.
    Parameters:
      `name` - optional symbolic name of the created runtime.
    Returns:
      a named builder of CayenneRuntime.