Class PersistenceEnvironmentParamBuilder
java.lang.Object
com.tangosol.coherence.config.builder.PersistenceEnvironmentParamBuilder
- All Implemented Interfaces:
ParameterizedBuilder<com.oracle.coherence.persistence.PersistenceEnvironment>
public class PersistenceEnvironmentParamBuilder
extends Object
implements ParameterizedBuilder<com.oracle.coherence.persistence.PersistenceEnvironment>
Build a
PersistenceEnvironment
.
Provide a means to get a PersistenceEnvironmentParamBuilder.PersistenceEnvironmentInfo
without
creating a PersistenceEnvironment
to be used by a viewer.
Defaulting built into the builder so same defaults whether read in from xml configuration or constructed solely by builder api.
- Since:
- Coherence 12.2.1
- Author:
- jf 2015.03.12
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
APersistenceEnvironmentInfo
implementation that exposes the active, snapshot and trash directories, in addition to the persistence mode.Nested classes/interfaces inherited from interface com.tangosol.coherence.config.builder.ParameterizedBuilder
ParameterizedBuilder.ReflectionSupport
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final SafePersistenceWrappers.FailureContinuationFactory
Default failure continuation factory that provides continuations that only throw PersistenceExceptions.protected ParameterizedBuilder
<com.oracle.coherence.persistence.PersistenceEnvironment<ReadBuffer>> AParameterizedBuilder
that creates aPersistenceEnvironment
.protected String
The active directory used by persistence.protected String
The backup directory used by persistence.protected String
The events directory used by persistence.protected String
The mode used by persistence; either active, active-backup, active-async or on-demand.protected String
The snapshot directory used by persistence.protected String
The trash directory used by persistence. -
Constructor Summary
ConstructorDescriptionConstruct aPersistenceEnvironment
builder. -
Method Summary
Modifier and TypeMethodDescriptionprotected ResolvableParameterList
createResolver
(String sClusterName, String sServiceName) Create aresolver
based on the provided cluster, service name and the state of this builder (active, snapshot and trash directories).static String
Return the default 'base' persistence directory.getPersistenceEnvironmentInfo
(String sClusterName, String sServiceName) Return aPersistenceEnvironmentParamBuilder.PersistenceEnvironmentInfo
encapsulating the configuration this builder uses to constructenvironments
.protected boolean
isActive()
Return true if the persistence mode is active.protected boolean
Return true if the persistence mode is active-backup.com.oracle.coherence.persistence.PersistenceEnvironment
<ReadBuffer> realize
(ParameterResolver resolver, ClassLoader loader, ParameterList listParameters) Realizes (creates if necessary) an instance of a object of type T, using the providedParameterResolver
to resolve values any referencedParameter
s.void
setActiveDirectory
(String sPathname) Set the persistence active directory.void
setBackupDirectory
(String sPathname) Set the persistence backup directory.void
setCustomEnvironment
(ParameterizedBuilder<com.oracle.coherence.persistence.PersistenceEnvironment<ReadBuffer>> bldrPersistence) Set abuilder
to be used instantiate the appropriatePersistenceEnvironment
.void
setEventsDirectory
(String sPathname) Set the persistence active directory.void
setPersistenceMode
(String sMode) Set persistence mode.void
setPersistenceSnapshotDirectory
(String sPathname) Set the persistence snapshot directory.void
setPersistenceTrashDirectory
(String sPathname) Set the persistence trash directory.toString()
protected com.oracle.coherence.persistence.PersistenceEnvironment
<ReadBuffer> wrap
(com.oracle.coherence.persistence.PersistenceEnvironment<ReadBuffer> env) Wrap aPersistenceEnvironment
with a SafePersistenceEnvironment.
-
Field Details
-
DEFAULT_FACTORY
Default failure continuation factory that provides continuations that only throw PersistenceExceptions. -
m_sMode
The mode used by persistence; either active, active-backup, active-async or on-demand. -
m_sActive
The active directory used by persistence. -
m_sBackup
The backup directory used by persistence. -
m_sEvents
The events directory used by persistence. -
m_sSnapshot
The snapshot directory used by persistence. -
m_sTrash
The trash directory used by persistence. -
m_bldr
protected ParameterizedBuilder<com.oracle.coherence.persistence.PersistenceEnvironment<ReadBuffer>> m_bldrAParameterizedBuilder
that creates aPersistenceEnvironment
.
-
-
Constructor Details
-
PersistenceEnvironmentParamBuilder
public PersistenceEnvironmentParamBuilder()Construct aPersistenceEnvironment
builder.
-
-
Method Details
-
realize
public com.oracle.coherence.persistence.PersistenceEnvironment<ReadBuffer> realize(ParameterResolver resolver, ClassLoader loader, ParameterList listParameters) Description copied from interface:ParameterizedBuilder
Realizes (creates if necessary) an instance of a object of type T, using the providedParameterResolver
to resolve values any referencedParameter
s.- Specified by:
realize
in interfaceParameterizedBuilder<com.oracle.coherence.persistence.PersistenceEnvironment>
- Parameters:
resolver
- theParameterResolver
for resolving namedParameter
sloader
- theClassLoader
for loading any necessary classes and ifnull
theClassLoader
used to load the builder will be used insteadlistParameters
- an optionalParameterList
(may benull
) to be used for realizing the instance, eg: used as constructor parameters- Returns:
- an instance of T
-
getPersistenceEnvironmentInfo
public PersistenceEnvironmentParamBuilder.PersistenceEnvironmentInfo getPersistenceEnvironmentInfo(String sClusterName, String sServiceName) Return aPersistenceEnvironmentParamBuilder.PersistenceEnvironmentInfo
encapsulating the configuration this builder uses to constructenvironments
.- Parameters:
sClusterName
- the cluster namesServiceName
- the service name- Returns:
- a PersistenceEnvironmentInfo encapsulating the configuration this builder uses to construct environments
-
getPersistenceMode
-
setPersistenceMode
Set persistence mode.- Parameters:
sMode
- active, active-backup, active-async or on-demand
-
setActiveDirectory
Set the persistence active directory.- Parameters:
sPathname
- either relative or absolute pathname
-
setBackupDirectory
Set the persistence backup directory.- Parameters:
sPathname
- either relative or absolute pathname
-
setEventsDirectory
Set the persistence active directory.- Parameters:
sPathname
- either relative or absolute pathname
-
setPersistenceSnapshotDirectory
Set the persistence snapshot directory.- Parameters:
sPathname
- either relative or absolute pathname
-
setPersistenceTrashDirectory
Set the persistence trash directory.- Parameters:
sPathname
- either relative or absolute pathname
-
setCustomEnvironment
@Injectable("instance") public void setCustomEnvironment(ParameterizedBuilder<com.oracle.coherence.persistence.PersistenceEnvironment<ReadBuffer>> bldrPersistence) Set abuilder
to be used instantiate the appropriatePersistenceEnvironment
.- Parameters:
bldrPersistence
- the builder that creates a PersistenceEnvironment
-
toString
-
wrap
protected com.oracle.coherence.persistence.PersistenceEnvironment<ReadBuffer> wrap(com.oracle.coherence.persistence.PersistenceEnvironment<ReadBuffer> env) Wrap aPersistenceEnvironment
with a SafePersistenceEnvironment.- Parameters:
env
- a wrapped PersistenceEnvironment- Returns:
- a wrapped PersistenceEnvironment
-
createResolver
Create aresolver
based on the provided cluster, service name and the state of this builder (active, snapshot and trash directories).- Parameters:
sClusterName
- the name of the clustersServiceName
- the name of the service- Returns:
- a resolver based on the provided cluster and service name
-
isActive
protected boolean isActive()Return true if the persistence mode is active.- Returns:
- true if the persistence mode is active
-
isActiveBackup
protected boolean isActiveBackup()Return true if the persistence mode is active-backup.- Returns:
- true if the persistence mode is active-backup
-
getDefaultPersistenceEnvironmentHomeDirectory
Return the default 'base' persistence directory.This location is the base for active, snapshot and trash locations if they have not been specified in the operational configuration.
The default base location is
$HOME/coherence
. This location can be overridden by specifying the JVM argument: -D"coherence.distributed.persistence.base.dir".- Returns:
- default base directory for persistence
-