org.apache.cayenne.configuration.server

## Class ServerModule

- java.lang.Object
- - org.apache.cayenne.configuration.server.ServerModule

- All Implemented Interfaces:
    Module

      public class ServerModule
      extends Object
      implements Module

  A DI module containing all Cayenne server runtime configuration.
  Since:
    3.1

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected String[]` | `configurationLocations` Deprecated.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ServerModule()` Creates a new `ServerModule`.
    `ServerModule(String firstConfigLocation, String... configurationLocations)` Deprecated. since 4.0 use `ServerRuntimeBuilder.addConfig(String)` and/or `contributeProjectLocations(Binder)` to specify locations.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `configure(Binder binder)`
    `static ListBuilder<DbAdapterDetector>` | `contributeAdapterDetectors(Binder binder)` Provides access to a DI collection builder for `DbAdapterDetector`'s that allows downstream modules to "contribute" their own adapter detectors.
    `static ListBuilder<ExtendedType>` | `contributeDefaultTypes(Binder binder)` Provides access to a DI collection builder for default adapter-agnostic `ExtendedType`'s that allows downstream modules to "contribute" their own types.
    `static ListBuilder<DataChannelFilter>` | `contributeDomainFilters(Binder binder)` Provides access to a DI collection builder for `DataChannelFilter`'s that allows downstream modules to "contribute" their own DataDomain filters
    `static ListBuilder<Object>` | `contributeDomainListeners(Binder binder)` Provides access to a DI collection builder for lifecycle events listeners.
    `static ListBuilder<String>` | `contributeProjectLocations(Binder binder)` Provides access to a DI collection builder for String locations that allows downstream modules to "contribute" their own Cayenne project locations.
    `static MapBuilder<String>` | `contributeProperties(Binder binder)` Provides access to a DI map builder for runtime properties that allows downstream modules to "contribute" their own properties.
    `static ListBuilder<ExtendedTypeFactory>` | `contributeTypeFactories(Binder binder)` Provides access to a DI collection builder for `ExtendedTypeFactory`'s that allows downstream modules to "contribute" their own factories.
    `static ListBuilder<ExtendedType>` | `contributeUserTypes(Binder binder)` Provides access to a DI collection builder for `ExtendedType`'s that allows downstream modules to "contribute" their own types.
    `static ListBuilder<ValueObjectType>` | `contributeValueObjectTypes(Binder binder)`
    `static void` | `setSnapshotCacheSize(Binder binder, int size)` Sets max size of snapshot cache, in pre 4.0 version this was set in the Modeler.
    `static void` | `useExternalTransactions(Binder binder, boolean useExternal)` Sets transaction management to either external or internal transactions.

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

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

- - ### Field Detail

    - #### configurationLocations

          @Deprecated
          protected String[] configurationLocations

      Deprecated.

  - ### Constructor Detail

    - #### ServerModule

          public ServerModule()

      Creates a new `ServerModule`.
      Since:
        4.0

    - #### ServerModule

          @Deprecated
          public ServerModule(String firstConfigLocation,
                                           String... configurationLocations)

      Deprecated. since 4.0 use `ServerRuntimeBuilder.addConfig(String)` and/or `contributeProjectLocations(Binder)` to specify locations.
      Creates a ServerModule with at least one configuration location. For multi-module projects additional locations can be specified as well.

  - ### Method Detail

    - #### useExternalTransactions

          public static void useExternalTransactions(Binder binder,
                                                     boolean useExternal)

      Sets transaction management to either external or internal transactions. Default is internally-managed transactions.
      Parameters:
        `binder` - DI binder passed to the module during injector startup.
        `useExternal` - whether external (true) or internal (false) transaction management should be used.
      Since:
        4.0

    - #### setSnapshotCacheSize

          public static void setSnapshotCacheSize(Binder binder,
                                                  int size)

      Sets max size of snapshot cache, in pre 4.0 version this was set in the Modeler.
      Parameters:
        `binder` - DI binder passed to the module during injector startup.
        `size` - max size of snapshot cache
      Since:
        4.0

    - #### contributeProjectLocations

          public static ListBuilder<String> contributeProjectLocations(Binder binder)

      Provides access to a DI collection builder for String locations that allows downstream modules to "contribute" their own Cayenne project locations.
      Parameters:
        `binder` - DI binder passed to the module during injector startup.
      Returns:
        ListBuilder for String locations.
      Since:
        4.0

    - #### contributeDomainFilters

          public static ListBuilder<DataChannelFilter> contributeDomainFilters(Binder binder)

      Provides access to a DI collection builder for `DataChannelFilter`'s that allows downstream modules to "contribute" their own DataDomain filters
      Parameters:
        `binder` - DI binder passed to the module during injector startup.
      Returns:
        ListBuilder for DataChannelFilter.
      Since:
        4.0

    - #### contributeDomainListeners

          public static ListBuilder<Object> contributeDomainListeners(Binder binder)

      Provides access to a DI collection builder for lifecycle events listeners.
      Parameters:
        `binder` - DI binder passed to the module during injector startup.
      Returns:
        ListBuilder for listener Objects.
      Since:
        4.0

    - #### contributeAdapterDetectors

          public static ListBuilder<DbAdapterDetector> contributeAdapterDetectors(Binder binder)

      Provides access to a DI collection builder for `DbAdapterDetector`'s that allows downstream modules to "contribute" their own adapter detectors.
      Parameters:
        `binder` - DI binder passed to the module during injector startup.
      Returns:
        ListBuilder for DbAdapterDetectors.
      Since:
        4.0

    - #### contributeProperties

          public static MapBuilder<String> contributeProperties(Binder binder)

      Provides access to a DI map builder for runtime properties that allows downstream modules to "contribute" their own properties.
      Parameters:
        `binder` - DI binder passed to the module during injector startup.
      Returns:
        MapBuilder for properties.
      Since:
        4.0

    - #### contributeTypeFactories

          public static ListBuilder<ExtendedTypeFactory> contributeTypeFactories(Binder binder)

      Provides access to a DI collection builder for `ExtendedTypeFactory`'s that allows downstream modules to "contribute" their own factories.
      Parameters:
        `binder` - DI binder passed to the module during injector startup.
      Returns:
        ListBuilder for ExtendedTypes.
      Since:
        4.0

    - #### contributeDefaultTypes

          public static ListBuilder<ExtendedType> contributeDefaultTypes(Binder binder)

      Provides access to a DI collection builder for default adapter-agnostic `ExtendedType`'s that allows downstream modules to "contribute" their own types. "Default" types are loaded before adapter-provided or "user" types, so they may be overridden by those.
      Parameters:
        `binder` - DI binder passed to the module during injector startup.
      Returns:
        ListBuilder for ExtendedTypes.
      Since:
        4.0

    - #### contributeUserTypes

          public static ListBuilder<ExtendedType> contributeUserTypes(Binder binder)

      Provides access to a DI collection builder for `ExtendedType`'s that allows downstream modules to "contribute" their own types. Unlike "default" types (see `contributeDefaultTypes(Binder)`), "user" types are loaded after the adapter-provided types and can override those.
      Parameters:
        `binder` - DI binder passed to the module during injector startup.
      Returns:
        ListBuilder for ExtendedTypes.
      Since:
        4.0

    - #### contributeValueObjectTypes

          public static ListBuilder<ValueObjectType> contributeValueObjectTypes(Binder binder)

      Parameters:
        `binder` - DI binder passed to module during injector startup
      Returns:
        ListBuilder for user-contributed ValueObjectTypes
      Since:
        4.0

    - #### configure

          public void configure(Binder binder)

      Specified by:
        `configure` in interface `Module`

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