Class AbstractServiceScheme<D extends ServiceDependencies>
java.lang.Object
com.tangosol.coherence.config.scheme.AbstractScheme
com.tangosol.coherence.config.scheme.AbstractServiceScheme<D>
- All Implemented Interfaces:
ServiceBuilder
,Scheme
,ServiceScheme
- Direct Known Subclasses:
AbstractCachingScheme
,InvocationScheme
,RemoteInvocationScheme
public abstract class AbstractServiceScheme<D extends ServiceDependencies>
extends AbstractScheme
implements ServiceBuilder, ServiceScheme
The
AbstractServiceScheme
provides functionality common to all
schemes that use services. Some properties, such as listeners, are optional
and may not apply to every scheme.- Since:
- Coherence 12.1.2
- Author:
- pfm 2011.12.28
-
Field Summary
Modifier and TypeFieldDescriptionprotected D
TheServiceDependencies
to be used to configure the services produced by this scheme.Fields inherited from interface com.tangosol.coherence.config.scheme.ServiceScheme
DELIM_APPLICATION_SCOPE, DELIM_DOMAIN_PARTITION
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Service
ensureService
(String sService, Cluster cluster) Call theCluster.ensureService(String, String)
method to obtain the service.protected String
DefaultServiceName to use if none configured.Return the service name with any scoping applied.Return the scope name.Return theServiceBuilder
that is needed to build a service.Obtains theServiceDependencies
that will be used to configureService
produced by this scheme.Return the service name.getXml()
Deprecated.protected void
injectScopeNameIntoService
(Service service) boolean
Return true if the service has auto-start enabled.abstract boolean
Return true if a running cluster is needed before using a service.realizeService
(ParameterResolver resolver, ClassLoader loader, Cluster cluster) Realize (ensure) a Service.void
setAutoStart
(boolean fEnabled) Set the auto-start enabled flag.void
setScopeName
(String sName) Set the scope name.void
setServiceDependencies
(D dependencies) Set theServiceDependencies
to be used by this scheme when configuring a newly realizedService
.void
setServiceName
(String sName) Set the service name.void
setXml
(XmlElement element) Deprecated.Methods inherited from class com.tangosol.coherence.config.scheme.AbstractScheme
getSchemeName, isAnonymous, setSchemeName, validate
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.tangosol.coherence.config.scheme.Scheme
getSchemeName, isAnonymous
Methods inherited from interface com.tangosol.coherence.config.scheme.ServiceScheme
getServiceType
-
Field Details
-
m_serviceDependencies
TheServiceDependencies
to be used to configure the services produced by this scheme.
-
-
Constructor Details
-
AbstractServiceScheme
public AbstractServiceScheme()
-
-
Method Details
-
realizeService
Realize (ensure) a Service. The returned Service is fully configured and ready to be used.- Specified by:
realizeService
in interfaceServiceBuilder
- Parameters:
resolver
- the ParameterResolverloader
- the ClassLoadercluster
- the Cluster which will already be running if necessary- Returns:
- the Service
-
isRunningClusterNeeded
public abstract boolean isRunningClusterNeeded()Return true if a running cluster is needed before using a service.- Specified by:
isRunningClusterNeeded
in interfaceServiceBuilder
- Returns:
true
if a running cluster is needed before using a service
-
getScopeName
Return the scope name.- Specified by:
getScopeName
in interfaceServiceBuilder
- Returns:
- the scope name
-
setScopeName
Set the scope name.- Parameters:
sName
- the scope name
-
setXml
Deprecated.Deprecated: Set the XML so that we can create a Service using the SafeCluster.ensureService.- Specified by:
setXml
in interfaceServiceBuilder
- Parameters:
element
- the distributed-scheme XML
-
getXml
Deprecated.Return the XmlElement that contains the Service configuration.- Specified by:
getXml
in interfaceServiceBuilder
- Returns:
- the XmlElement
-
isAutoStart
public boolean isAutoStart()Return true if the service has auto-start enabled.- Specified by:
isAutoStart
in interfaceServiceScheme
- Returns:
- the auto-start flag.
-
setAutoStart
Set the auto-start enabled flag.- Parameters:
fEnabled
- the auto-start enabled flag
-
getServiceBuilder
Return theServiceBuilder
that is needed to build a service.- Specified by:
getServiceBuilder
in interfaceServiceScheme
- Returns:
- the
ServiceBuilder
or null if the scheme does not support services.
-
setServiceName
Set the service name.- Parameters:
sName
- the service name.
-
getServiceName
Return the service name.- Specified by:
getServiceName
in interfaceServiceScheme
- Returns:
- the service name
-
getScopedServiceName
Return the service name with any scoping applied. The scoped name in general has the following format:[<domain-partition-name>'/'] [<application-scope>':'] <service-name>
- Specified by:
getScopedServiceName
in interfaceServiceScheme
- Returns:
- the scoped service name
-
getEventInterceptorBuilders
Obtains theList
ofNamedEventInterceptorBuilder
s that have been defined for theServiceScheme
.Note: For those
ServiceScheme
s don't support event interceptors, the returned value must be an empty list.- Specified by:
getEventInterceptorBuilders
in interfaceServiceScheme
- Returns:
- an
List
overNamedEventInterceptorBuilder
s
-
injectScopeNameIntoService
- Parameters:
service
- The safe service
-
getServiceDependencies
Obtains theServiceDependencies
that will be used to configureService
produced by this scheme.- Returns:
- the
ServiceDependencies
-
setServiceDependencies
Set theServiceDependencies
to be used by this scheme when configuring a newly realizedService
.- Parameters:
dependencies
- theServiceDependencies
object
-
getDefaultServiceName
DefaultServiceName to use if none configured.- Returns:
- default service name
-
ensureService
Call theCluster.ensureService(String, String)
method to obtain the service.- Parameters:
sService
- the name of the servicecluster
- theCluster
to obtain the service from- Returns:
- the ensured service
-