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
TheAbstractServiceSchemeprovides 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 Dm_serviceDependenciesTheServiceDependenciesto 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 ServiceensureService(String sService, Cluster cluster)Call theCluster.ensureService(String, String)method to obtain the service.protected StringgetDefaultServiceName()DefaultServiceName to use if none configured.List<NamedEventInterceptorBuilder>getEventInterceptorBuilders()StringgetScopedServiceName()Return the service name with any scoping applied.StringgetScopeName()Return the scope name.ServiceBuildergetServiceBuilder()Return theServiceBuilderthat is needed to build a service.DgetServiceDependencies()Obtains theServiceDependenciesthat will be used to configureServiceproduced by this scheme.StringgetServiceName()Return the service name.XmlElementgetXml()Deprecated.protected voidinjectScopeNameIntoService(Service service)booleanisAutoStart()Return true if the service has auto-start enabled.abstract booleanisRunningClusterNeeded()Return true if a running cluster is needed before using a service.ServicerealizeService(ParameterResolver resolver, ClassLoader loader, Cluster cluster)Realize (ensure) a Service.voidsetAutoStart(boolean fEnabled)Set the auto-start enabled flag.voidsetScopeName(String sName)Set the scope name.voidsetServiceDependencies(D dependencies)Set theServiceDependenciesto be used by this scheme when configuring a newly realizedService.voidsetServiceName(String sName)Set the service name.voidsetXml(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
TheServiceDependenciesto 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:
realizeServicein 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:
isRunningClusterNeededin interfaceServiceBuilder- Returns:
trueif a running cluster is needed before using a service
-
getScopeName
public String getScopeName()
Return the scope name.- Specified by:
getScopeNamein 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:
setXmlin interfaceServiceBuilder- Parameters:
element- the distributed-scheme XML
-
getXml
@Deprecated public XmlElement getXml()
Deprecated.Return the XmlElement that contains the Service configuration.- Specified by:
getXmlin interfaceServiceBuilder- Returns:
- the XmlElement
-
isAutoStart
public boolean isAutoStart()
Return true if the service has auto-start enabled.- Specified by:
isAutoStartin 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 theServiceBuilderthat is needed to build a service.- Specified by:
getServiceBuilderin interfaceServiceScheme- Returns:
- the
ServiceBuilderor 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:
getServiceNamein 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:
getScopedServiceNamein interfaceServiceScheme- Returns:
- the scoped service name
-
getEventInterceptorBuilders
public List<NamedEventInterceptorBuilder> getEventInterceptorBuilders()
Obtains theListofNamedEventInterceptorBuilders that have been defined for theServiceScheme.Note: For those
ServiceSchemes don't support event interceptors, the returned value must be an empty list.- Specified by:
getEventInterceptorBuildersin interfaceServiceScheme- Returns:
- an
ListoverNamedEventInterceptorBuilders
-
injectScopeNameIntoService
protected void injectScopeNameIntoService(Service service)
- Parameters:
service- The safe service
-
getServiceDependencies
@Injectable(".") public D getServiceDependencies()
Obtains theServiceDependenciesthat will be used to configureServiceproduced by this scheme.- Returns:
- the
ServiceDependencies
-
setServiceDependencies
public void setServiceDependencies(D dependencies)
Set theServiceDependenciesto be used by this scheme when configuring a newly realizedService.- Parameters:
dependencies- theServiceDependenciesobject
-
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- theClusterto obtain the service from- Returns:
- the ensured service
-
-