Class ServerRuntimeBuilder
java.lang.Object
org.apache.cayenne.configuration.server.ServerRuntimeBuilder
public class ServerRuntimeBuilder extends Object
A convenience class to assemble custom ServerRuntime. It allows to easily
configure custom modules, multiple config locations, or quickly create a
global DataSource.
- Since:
- 4.0
-
Constructor Summary
Constructors Modifier Constructor Description protectedServerRuntimeBuilder(String name)Creates a builder with a fixed name of the DataDomain of the resulting ServerRuntime. -
Method Summary
Modifier and Type Method Description ServerRuntimeBuilderaddConfig(String configurationLocation)ServerRuntimeBuilderaddConfigs(String... configurationLocations)ServerRuntimeBuilderaddConfigs(Collection<String> configurationLocations)ServerRuntimeBuilderaddModule(Module module)ServerRuntimeBuilderaddModules(Collection<Module> modules)ServerRuntimebuild()ServerRuntimeBuilderdataSource(DataSource dataSource)Sets a DataSource that will override any DataSources found in the mapping.ServerRuntimeBuilderdisableModulesAutoLoading()Disables DI module auto-loading.ServerRuntimeBuilderjdbcDriver(String driver)Sets a driver Java class for the default DataSource.ServerRuntimeBuilderjndiDataSource(String location)Sets JNDI location for the default DataSource.ServerRuntimeBuildermaxConnections(int maxConnections)ServerRuntimeBuildermaxQueueWaitTime(long maxQueueWaitTime)ServerRuntimeBuilderminConnections(int minConnections)ServerRuntimeBuilderpassword(String password)Sets a password for the default DataSource.ServerRuntimeBuilderurl(String url)Sets a database URL for the default DataSource.ServerRuntimeBuilderuser(String user)Sets a user name for the default DataSource.ServerRuntimeBuildervalidationQuery(String validationQuery)Sets a validation query for the default DataSource.
-
Constructor Details
-
ServerRuntimeBuilder
Creates a builder with a fixed name of the DataDomain of the resulting ServerRuntime. 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 auto-loading. By default auto-loading is enabled based onModuleLoaderservice provider inetrface. If you decide to disable auto-loading, make sure you provide all the modules that you need.- Returns:
- this builder instance.
-
dataSource
Sets a DataSource that will override any DataSources found in the mapping. If the mapping contains no DataNodes, and the DataSource is set with this method, the builder would create a single default DataNode.- See Also:
DataSourceBuilder
-
jndiDataSource
Sets JNDI location for the default DataSource. If the mapping contains no DataNodes, and the DataSource is set with this method, the builder would create a single default DataNode. -
url
Sets a database URL for the default DataSource. -
jdbcDriver
Sets a driver Java class for the default DataSource. -
validationQuery
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
-
user
Sets a user name for the default DataSource. -
password
Sets a password for the default DataSource. -
minConnections
-
maxConnections
-
addConfig
-
addConfigs
-
addConfigs
-
addModule
-
addModules
-
build
-