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 aPersistenceEnvironment.Provide a means to get a
PersistenceEnvironmentParamBuilder.PersistenceEnvironmentInfowithout creating aPersistenceEnvironmentto 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
Nested Classes Modifier and Type Class Description static classPersistenceEnvironmentParamBuilder.PersistenceEnvironmentInfoAPersistenceEnvironmentInfoimplementation 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
Fields Modifier and Type Field Description protected static SafePersistenceWrappers.FailureContinuationFactoryDEFAULT_FACTORYDefault failure continuation factory that provides continuations that only throw PersistenceExceptions.protected ParameterizedBuilder<com.oracle.coherence.persistence.PersistenceEnvironment<ReadBuffer>>m_bldrAParameterizedBuilderthat creates aPersistenceEnvironment.protected Stringm_sActiveThe active directory used by persistence.protected Stringm_sBackupThe backup directory used by persistence.protected Stringm_sEventsThe events directory used by persistence.protected Stringm_sModeThe mode used by persistence; either active, active-backup, active-async or on-demand.protected Stringm_sSnapshotThe snapshot directory used by persistence.protected Stringm_sTrashThe trash directory used by persistence.
-
Constructor Summary
Constructors Constructor Description PersistenceEnvironmentParamBuilder()Construct aPersistenceEnvironmentbuilder.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ResolvableParameterListcreateResolver(String sClusterName, String sServiceName)Create aresolverbased on the provided cluster, service name and the state of this builder (active, snapshot and trash directories).static StringgetDefaultPersistenceEnvironmentHomeDirectory()Return the default 'base' persistence directory.PersistenceEnvironmentParamBuilder.PersistenceEnvironmentInfogetPersistenceEnvironmentInfo(String sClusterName, String sServiceName)Return aPersistenceEnvironmentParamBuilder.PersistenceEnvironmentInfoencapsulating the configuration this builder uses to constructenvironments.StringgetPersistenceMode()protected booleanisActive()Return true if the persistence mode is active.protected booleanisActiveBackup()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 providedParameterResolverto resolve values any referencedParameters.voidsetActiveDirectory(String sPathname)Set the persistence active directory.voidsetBackupDirectory(String sPathname)Set the persistence backup directory.voidsetCustomEnvironment(ParameterizedBuilder<com.oracle.coherence.persistence.PersistenceEnvironment<ReadBuffer>> bldrPersistence)Set abuilderto be used instantiate the appropriatePersistenceEnvironment.voidsetEventsDirectory(String sPathname)Set the persistence active directory.voidsetPersistenceMode(String sMode)Set persistence mode.voidsetPersistenceSnapshotDirectory(String sPathname)Set the persistence snapshot directory.voidsetPersistenceTrashDirectory(String sPathname)Set the persistence trash directory.StringtoString()protected com.oracle.coherence.persistence.PersistenceEnvironment<ReadBuffer>wrap(com.oracle.coherence.persistence.PersistenceEnvironment<ReadBuffer> env)Wrap aPersistenceEnvironmentwith a SafePersistenceEnvironment.
-
-
-
Field Detail
-
DEFAULT_FACTORY
protected static final SafePersistenceWrappers.FailureContinuationFactory DEFAULT_FACTORY
Default failure continuation factory that provides continuations that only throw PersistenceExceptions.
-
m_sMode
protected String m_sMode
The mode used by persistence; either active, active-backup, active-async or on-demand.
-
m_sActive
protected String m_sActive
The active directory used by persistence.
-
m_sBackup
protected String m_sBackup
The backup directory used by persistence.
-
m_sEvents
protected String m_sEvents
The events directory used by persistence.
-
m_sSnapshot
protected String m_sSnapshot
The snapshot directory used by persistence.
-
m_sTrash
protected String m_sTrash
The trash directory used by persistence.
-
m_bldr
protected ParameterizedBuilder<com.oracle.coherence.persistence.PersistenceEnvironment<ReadBuffer>> m_bldr
AParameterizedBuilderthat creates aPersistenceEnvironment.
-
-
Method Detail
-
realize
public com.oracle.coherence.persistence.PersistenceEnvironment<ReadBuffer> realize(ParameterResolver resolver, ClassLoader loader, ParameterList listParameters)
Description copied from interface:ParameterizedBuilderRealizes (creates if necessary) an instance of a object of type T, using the providedParameterResolverto resolve values any referencedParameters.- Specified by:
realizein interfaceParameterizedBuilder<com.oracle.coherence.persistence.PersistenceEnvironment>- Parameters:
resolver- theParameterResolverfor resolving namedParametersloader- theClassLoaderfor loading any necessary classes and ifnulltheClassLoaderused 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.PersistenceEnvironmentInfoencapsulating 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
public String getPersistenceMode()
-
setPersistenceMode
@Injectable("persistence-mode") public void setPersistenceMode(String sMode)
Set persistence mode.- Parameters:
sMode- active, active-backup, active-async or on-demand
-
setActiveDirectory
@Injectable("active-directory") public void setActiveDirectory(String sPathname)
Set the persistence active directory.- Parameters:
sPathname- either relative or absolute pathname
-
setBackupDirectory
@Injectable("backup-directory") public void setBackupDirectory(String sPathname)
Set the persistence backup directory.- Parameters:
sPathname- either relative or absolute pathname
-
setEventsDirectory
@Injectable("events-directory") public void setEventsDirectory(String sPathname)
Set the persistence active directory.- Parameters:
sPathname- either relative or absolute pathname
-
setPersistenceSnapshotDirectory
@Injectable("snapshot-directory") public void setPersistenceSnapshotDirectory(String sPathname)
Set the persistence snapshot directory.- Parameters:
sPathname- either relative or absolute pathname
-
setPersistenceTrashDirectory
@Injectable("trash-directory") public void setPersistenceTrashDirectory(String sPathname)
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 abuilderto be used instantiate the appropriatePersistenceEnvironment.- Parameters:
bldrPersistence- the builder that creates a PersistenceEnvironment
-
wrap
protected com.oracle.coherence.persistence.PersistenceEnvironment<ReadBuffer> wrap(com.oracle.coherence.persistence.PersistenceEnvironment<ReadBuffer> env)
Wrap aPersistenceEnvironmentwith a SafePersistenceEnvironment.- Parameters:
env- a wrapped PersistenceEnvironment- Returns:
- a wrapped PersistenceEnvironment
-
createResolver
protected ResolvableParameterList createResolver(String sClusterName, String sServiceName)
Create aresolverbased 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
public static String 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
-
-