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
TheAbstractServiceScheme
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
Fields Modifier and Type Field Description protected D
m_serviceDependencies
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
Constructors Constructor Description AbstractServiceScheme()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected Service
ensureService(String sService, Cluster cluster)
Call theCluster.ensureService(String, String)
method to obtain the service.protected String
getDefaultServiceName()
DefaultServiceName to use if none configured.List<NamedEventInterceptorBuilder>
getEventInterceptorBuilders()
String
getScopedServiceName()
Return the service name with any scoping applied.String
getScopeName()
Return the scope name.ServiceBuilder
getServiceBuilder()
Return theServiceBuilder
that is needed to build a service.D
getServiceDependencies()
Obtains theServiceDependencies
that will be used to configureService
produced by this scheme.String
getServiceName()
Return the service name.XmlElement
getXml()
Deprecated.protected void
injectScopeNameIntoService(Service service)
boolean
isAutoStart()
Return true if the service has auto-start enabled.abstract boolean
isRunningClusterNeeded()
Return true if a running cluster is needed before using a service.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 Detail
-
m_serviceDependencies
protected D extends ServiceDependencies m_serviceDependencies
TheServiceDependencies
to be used to configure the services produced by this scheme.
-
-
Method Detail
-
realizeService
public Service realizeService(ParameterResolver resolver, ClassLoader loader, Cluster cluster)
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
public String getScopeName()
Return the scope name.- Specified by:
getScopeName
in interfaceServiceBuilder
- Returns:
- the scope name
-
setScopeName
@Injectable public void setScopeName(String sName)
Set the scope name.- Parameters:
sName
- the scope name
-
setXml
@Deprecated public void setXml(XmlElement element)
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 public XmlElement 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
@Injectable("autostart") public void setAutoStart(boolean fEnabled)
Set the auto-start enabled flag.- Parameters:
fEnabled
- the auto-start enabled flag
-
getServiceBuilder
public ServiceBuilder 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
@Injectable public void setServiceName(String sName)
Set the service name.- Parameters:
sName
- the service name.
-
getServiceName
public String getServiceName()
Return the service name.- Specified by:
getServiceName
in interfaceServiceScheme
- Returns:
- the service name
-
getScopedServiceName
public String 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
public List<NamedEventInterceptorBuilder> 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
protected void injectScopeNameIntoService(Service service)
- Parameters:
service
- The safe service
-
getServiceDependencies
@Injectable(".") public D getServiceDependencies()
Obtains theServiceDependencies
that will be used to configureService
produced by this scheme.- Returns:
- the
ServiceDependencies
-
setServiceDependencies
public void setServiceDependencies(D dependencies)
Set theServiceDependencies
to be used by this scheme when configuring a newly realizedService
.- Parameters:
dependencies
- theServiceDependencies
object
-
getDefaultServiceName
protected String getDefaultServiceName()
DefaultServiceName to use if none configured.- Returns:
- default service name
-
ensureService
protected Service ensureService(String sService, Cluster cluster)
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
-
-