# Class CayenneRuntimeBuilder

java.lang.Object
org.apache.cayenne.runtime.CayenneRuntimeBuilder

public class CayenneRuntimeBuilder extends Object
A convenience class to assemble custom `CayenneRuntime`. It allows to easily configure custom modules, multiple config locations, or quickly create a global `DataSource`.

Since:
  5.0 renamed from ServerRuntimeBuilder and moved to `org.apache.cayenne.runtime` package

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `CayenneRuntimeBuilder(String name)`
  Creates a builder with a fixed name of the DataDomain of the resulting CayenneRuntime.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `CayenneRuntimeBuilder`
  `addConfig(String configurationLocation)`
  `CayenneRuntimeBuilder`
  `addConfigs(String... configurationLocations)`
  `CayenneRuntimeBuilder`
  `addConfigs(Collection<String> configurationLocations)`
  `CayenneRuntimeBuilder`
  `addDataNode(DataSource dataSource, String... linkedDataMaps)`
  `CayenneRuntimeBuilder`
  `addDataNode(DataNodeDescriptor node, String... linkedDataMaps)`
  `CayenneRuntimeBuilder`
  `addModule(Module module)`
  `CayenneRuntimeBuilder`
  `addModules(Collection<Module> modules)`
  `CayenneRuntime`
  `build()`
  `CayenneRuntimeBuilder`
  `dataSource(DataSource dataSource)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  in favor of `defaultDataNode(DataSource)`
  `CayenneRuntimeBuilder`
  `defaultDataNode(DataSource dataSource)`
  Will create a default DataNode based on the provided DataSource that will handle all DataMaps not explicitly linked to other DataNodes.
  `CayenneRuntimeBuilder`
  `defaultDataNode(DataNodeDescriptor defaultNode)`
  `CayenneRuntimeBuilder`
  `disableModulesAutoLoading()`
  Disables DI module autoloading.
  `CayenneRuntimeBuilder`
  `jdbcDriver(String driver)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  in favor of `defaultDataNode(DataSource)`
  `CayenneRuntimeBuilder`
  `maxConnections(int maxConnections)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  in favor of `defaultDataNode(DataSource)`
  `CayenneRuntimeBuilder`
  `maxQueueWaitTime(long maxQueueWaitTime)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  in favor of `defaultDataNode(DataSource)`
  `CayenneRuntimeBuilder`
  `minConnections(int minConnections)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  in favor of `defaultDataNode(DataSource)`
  `CayenneRuntimeBuilder`
  `password(String password)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  in favor of `defaultDataNode(DataSource)`
  `CayenneRuntimeBuilder`
  `url(String url)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  in favor of `defaultDataNode(DataSource)`
  `CayenneRuntimeBuilder`
  `user(String user)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  in favor of `defaultDataNode(DataSource)`
  `CayenneRuntimeBuilder`
  `validationQuery(String validationQuery)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  in favor of `defaultDataNode(DataSource)`

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### CayenneRuntimeBuilder

    protected CayenneRuntimeBuilder(String name)
    Creates a builder with a fixed name of the DataDomain of the resulting CayenneRuntime. Specifying explicit name is often needed for consistency in runtimes merged from multiple configs, each having its own name.

- ## Method Details

  - ### disableModulesAutoLoading

    public CayenneRuntimeBuilder disableModulesAutoLoading()
    Disables DI module autoloading. By default, autoloading is enabled based on `ModuleLoader` service provider interface. If you decide to disable it, make sure you explicitly provide all the modules that you need.

  - ### dataSource

    @Deprecated(since="5.0", forRemoval=true) public CayenneRuntimeBuilder dataSource(DataSource dataSource)
    Deprecated, for removal: This API element is subject to removal in a future version.
    in favor of `defaultDataNode(DataSource)`

  - ### defaultDataNode

    public CayenneRuntimeBuilder defaultDataNode(DataSource dataSource)
    Will create a default DataNode based on the provided DataSource that will handle all DataMaps not explicitly linked to other DataNodes.

  - ### addDataNode

    public CayenneRuntimeBuilder addDataNode(DataNodeDescriptor node, String... linkedDataMaps)

  - ### addDataNode

    public CayenneRuntimeBuilder addDataNode(DataSource dataSource, String... linkedDataMaps)

  - ### defaultDataNode

    public CayenneRuntimeBuilder defaultDataNode(DataNodeDescriptor defaultNode)

  - ### url

    @Deprecated(since="5.0", forRemoval=true) public CayenneRuntimeBuilder url(String url)
    Deprecated, for removal: This API element is subject to removal in a future version.
    in favor of `defaultDataNode(DataSource)`
    Sets a database URL for the default DataSource.

  - ### jdbcDriver

    @Deprecated(since="5.0", forRemoval=true) public CayenneRuntimeBuilder jdbcDriver(String driver)
    Deprecated, for removal: This API element is subject to removal in a future version.
    in favor of `defaultDataNode(DataSource)`
    Sets a driver Java class for the default DataSource.

  - ### validationQuery

    @Deprecated(since="5.0", forRemoval=true) public CayenneRuntimeBuilder validationQuery(String validationQuery)
    Deprecated, for removal: This API element is subject to removal in a future version.
    in favor of `defaultDataNode(DataSource)`
    Sets a validation query for the default DataSource.
    Parameters:
      `validationQuery` - a SQL string that returns some result. It will be used to validate connections in the pool.

  - ### maxQueueWaitTime

    @Deprecated(since="5.0", forRemoval=true) public CayenneRuntimeBuilder maxQueueWaitTime(long maxQueueWaitTime)
    Deprecated, for removal: This API element is subject to removal in a future version.
    in favor of `defaultDataNode(DataSource)`

  - ### user

    @Deprecated(since="5.0", forRemoval=true) public CayenneRuntimeBuilder user(String user)
    Deprecated, for removal: This API element is subject to removal in a future version.
    in favor of `defaultDataNode(DataSource)`
    Sets a user name for the default DataSource.

  - ### password

    @Deprecated(since="5.0", forRemoval=true) public CayenneRuntimeBuilder password(String password)
    Deprecated, for removal: This API element is subject to removal in a future version.
    in favor of `defaultDataNode(DataSource)`
    Sets a password for the default DataSource.

  - ### minConnections

    @Deprecated(since="5.0", forRemoval=true) public CayenneRuntimeBuilder minConnections(int minConnections)
    Deprecated, for removal: This API element is subject to removal in a future version.
    in favor of `defaultDataNode(DataSource)`

  - ### maxConnections

    @Deprecated(since="5.0", forRemoval=true) public CayenneRuntimeBuilder maxConnections(int maxConnections)
    Deprecated, for removal: This API element is subject to removal in a future version.
    in favor of `defaultDataNode(DataSource)`

  - ### addConfig

    public CayenneRuntimeBuilder addConfig(String configurationLocation)

  - ### addConfigs

    public CayenneRuntimeBuilder addConfigs(String... configurationLocations)

  - ### addConfigs

    public CayenneRuntimeBuilder addConfigs(Collection<String> configurationLocations)

  - ### addModule

    public CayenneRuntimeBuilder addModule(Module module)

  - ### addModules

    public CayenneRuntimeBuilder addModules(Collection<Module> modules)

  - ### build

    public CayenneRuntime build()