org.apache.cayenne.configuration.server

## 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
    Constructor and Description
    `ServerRuntimeBuilder()` Deprecated. since 4.0.M5 in favor of `ServerRuntime.builder()`
    `ServerRuntimeBuilder(String name)` Deprecated. since 4.0.M5 in favor of `ServerRuntime.builder(String)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `ServerRuntimeBuilder` | `addConfig(String configurationLocation)`
    `ServerRuntimeBuilder` | `addConfigs(Collection<String> configurationLocations)`
    `ServerRuntimeBuilder` | `addConfigs(String... configurationLocations)`
    `ServerRuntimeBuilder` | `addModule(Module module)`
    `ServerRuntimeBuilder` | `addModules(Collection<Module> modules)`
    `ServerRuntime` | `build()`
    `static ServerRuntimeBuilder` | `builder()` Deprecated. since 4.0.M5 in favor of `ServerRuntime.builder()`
    `static ServerRuntimeBuilder` | `builder(String name)` Deprecated. since 4.0.M5 in favor of `ServerRuntime.builder(String)`
    `ServerRuntimeBuilder` | `dataSource(DataSource dataSource)` Sets a DataSource that will override any DataSources found in the mapping.
    `ServerRuntimeBuilder` | `disableModulesAutoLoading()` Disables DI module auto-loading.
    `ServerRuntimeBuilder` | `jdbcDriver(String driver)` Sets a driver Java class for the default DataSource.
    `ServerRuntimeBuilder` | `jndiDataSource(String location)` Sets JNDI location for the default DataSource.
    `ServerRuntimeBuilder` | `maxConnections(int maxConnections)`
    `ServerRuntimeBuilder` | `maxQueueWaitTime(long maxQueueWaitTime)`
    `ServerRuntimeBuilder` | `minConnections(int minConnections)`
    `ServerRuntimeBuilder` | `password(String password)` Sets a password for the default DataSource.
    `ServerRuntimeBuilder` | `url(String url)` Sets a database URL for the default DataSource.
    `ServerRuntimeBuilder` | `user(String user)` Sets a user name for the default DataSource.
    `ServerRuntimeBuilder` | `validationQuery(String validationQuery)` Sets a validation query for the default DataSource.

    - ### Methods inherited from class java.lang.Object

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

- - ### Constructor Detail

    - #### ServerRuntimeBuilder

          @Deprecated
          public ServerRuntimeBuilder()

      Deprecated. since 4.0.M5 in favor of `ServerRuntime.builder()`
      Creates an empty builder.

    - #### ServerRuntimeBuilder

          @Deprecated
          public ServerRuntimeBuilder(String name)

      Deprecated. since 4.0.M5 in favor of `ServerRuntime.builder(String)`
      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 Detail

    - #### builder

          @Deprecated
          public static ServerRuntimeBuilder builder()

      Deprecated. since 4.0.M5 in favor of `ServerRuntime.builder()`

    - #### builder

          @Deprecated
          public static ServerRuntimeBuilder builder(String name)

      Deprecated. since 4.0.M5 in favor of `ServerRuntime.builder(String)`

    - #### disableModulesAutoLoading

          public ServerRuntimeBuilder disableModulesAutoLoading()

      Disables DI module auto-loading. By default auto-loading is enabled based on `ModuleLoader` service provider inetrface. If you decide to disable auto-loading, make sure you provide all the modules that you need.
      Returns:
        this builder instance.

    - #### dataSource

          public ServerRuntimeBuilder dataSource(DataSource 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

          public ServerRuntimeBuilder jndiDataSource(String location)

      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

          public ServerRuntimeBuilder url(String url)

      Sets a database URL for the default DataSource.

    - #### jdbcDriver

          public ServerRuntimeBuilder jdbcDriver(String driver)

      Sets a driver Java class for the default DataSource.

    - #### validationQuery

          public ServerRuntimeBuilder validationQuery(String 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

          public ServerRuntimeBuilder maxQueueWaitTime(long maxQueueWaitTime)

    - #### user

          public ServerRuntimeBuilder user(String user)

      Sets a user name for the default DataSource.

    - #### password

          public ServerRuntimeBuilder password(String password)

      Sets a password for the default DataSource.

    - #### minConnections

          public ServerRuntimeBuilder minConnections(int minConnections)

    - #### maxConnections

          public ServerRuntimeBuilder maxConnections(int maxConnections)

    - #### addConfig

          public ServerRuntimeBuilder addConfig(String configurationLocation)

    - #### addConfigs

          public ServerRuntimeBuilder addConfigs(String... configurationLocations)

    - #### addConfigs

          public ServerRuntimeBuilder addConfigs(Collection<String> configurationLocations)

    - #### addModule

          public ServerRuntimeBuilder addModule(Module module)

    - #### addModules

          public ServerRuntimeBuilder addModules(Collection<Module> modules)

    - #### build

          public ServerRuntime build()

Copyright © 2001–2018 Apache Cayenne. All rights reserved.