Package org.apache.cayenne.runtime
Class CayenneRuntimeBuilder
java.lang.Object
org.apache.cayenne.runtime.CayenneRuntimeBuilder
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.runtimepackage
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCayenneRuntimeBuilder(String name) Creates a builder with a fixed name of the DataDomain of the resulting CayenneRuntime. -
Method Summary
Modifier and TypeMethodDescriptionaddConfigs(String... configurationLocations) addConfigs(Collection<String> configurationLocations) addDataNode(DataSource dataSource, String... linkedDataMaps) addDataNode(DataNodeDescriptor node, String... linkedDataMaps) addModules(Collection<Module> modules) build()dataSource(DataSource dataSource) Deprecated, for removal: This API element is subject to removal in a future version.defaultDataNode(DataSource dataSource) Will create a default DataNode based on the provided DataSource that will handle all DataMaps not explicitly linked to other DataNodes.defaultDataNode(DataNodeDescriptor defaultNode) Disables DI module autoloading.jdbcDriver(String driver) Deprecated, for removal: This API element is subject to removal in a future version.in favor ofdefaultDataNode(DataSource)maxConnections(int maxConnections) Deprecated, for removal: This API element is subject to removal in a future version.in favor ofdefaultDataNode(DataSource)maxQueueWaitTime(long maxQueueWaitTime) Deprecated, for removal: This API element is subject to removal in a future version.in favor ofdefaultDataNode(DataSource)minConnections(int minConnections) Deprecated, for removal: This API element is subject to removal in a future version.in favor ofdefaultDataNode(DataSource)Deprecated, for removal: This API element is subject to removal in a future version.in favor ofdefaultDataNode(DataSource)Deprecated, for removal: This API element is subject to removal in a future version.in favor ofdefaultDataNode(DataSource)Deprecated, for removal: This API element is subject to removal in a future version.in favor ofdefaultDataNode(DataSource)validationQuery(String validationQuery) Deprecated, for removal: This API element is subject to removal in a future version.in favor ofdefaultDataNode(DataSource)
-
Constructor Details
-
CayenneRuntimeBuilder
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
Disables DI module autoloading. By default, autoloading is enabled based onModuleLoaderservice 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 ofdefaultDataNode(DataSource) -
defaultDataNode
Will create a default DataNode based on the provided DataSource that will handle all DataMaps not explicitly linked to other DataNodes. -
addDataNode
-
addDataNode
-
defaultDataNode
-
url
Deprecated, for removal: This API element is subject to removal in a future version.in favor ofdefaultDataNode(DataSource)Sets a database URL for the default DataSource. -
jdbcDriver
Deprecated, for removal: This API element is subject to removal in a future version.in favor ofdefaultDataNode(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 ofdefaultDataNode(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 ofdefaultDataNode(DataSource) -
user
Deprecated, for removal: This API element is subject to removal in a future version.in favor ofdefaultDataNode(DataSource)Sets a user name for the default DataSource. -
password
Deprecated, for removal: This API element is subject to removal in a future version.in favor ofdefaultDataNode(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 ofdefaultDataNode(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 ofdefaultDataNode(DataSource) -
addConfig
-
addConfigs
-
addConfigs
-
addModule
-
addModules
-
build
-
defaultDataNode(DataSource)