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 Details

  • Constructor Details

    • AbstractServiceScheme

      public AbstractServiceScheme()
  • Method Details

    • 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 interface ServiceBuilder
      Parameters:
      resolver - the ParameterResolver
      loader - the ClassLoader
      cluster - 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 interface ServiceBuilder
      Returns:
      true if a running cluster is needed before using a service
    • getScopeName

      public String getScopeName()
      Return the scope name.
      Specified by:
      getScopeName in interface ServiceBuilder
      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 interface ServiceBuilder
      Parameters:
      element - the distributed-scheme XML
    • getXml

      @Deprecated public XmlElement getXml()
      Deprecated.
      Return the XmlElement that contains the Service configuration.
      Specified by:
      getXml in interface ServiceBuilder
      Returns:
      the XmlElement
    • isAutoStart

      public boolean isAutoStart()
      Return true if the service has auto-start enabled.
      Specified by:
      isAutoStart in interface ServiceScheme
      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 the ServiceBuilder that is needed to build a service.
      Specified by:
      getServiceBuilder in interface ServiceScheme
      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 interface ServiceScheme
      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 interface ServiceScheme
      Returns:
      the scoped service name
    • getEventInterceptorBuilders

      public List<NamedEventInterceptorBuilder> getEventInterceptorBuilders()
      Obtains the List of NamedEventInterceptorBuilders that have been defined for the ServiceScheme.

      Note: For those ServiceSchemes don't support event interceptors, the returned value must be an empty list.

      Specified by:
      getEventInterceptorBuilders in interface ServiceScheme
      Returns:
      an List over NamedEventInterceptorBuilders
    • injectScopeNameIntoService

      protected void injectScopeNameIntoService(Service service)
      Get the wrapped Service from the SafeService and invoke setScopeName() on the wrapped Service.
      Parameters:
      service - The safe service
    • getServiceDependencies

      @Injectable(".") public D getServiceDependencies()
      Obtains the ServiceDependencies that will be used to configure Service produced by this scheme.
      Returns:
      the ServiceDependencies
    • setServiceDependencies

      public void setServiceDependencies(D dependencies)
      Set the ServiceDependencies to be used by this scheme when configuring a newly realized Service.
      Parameters:
      dependencies - the ServiceDependencies object
    • getDefaultServiceName

      protected String getDefaultServiceName()
      DefaultServiceName to use if none configured.
      Returns:
      default service name
    • ensureService

      protected Service ensureService(String sService, Cluster cluster)
      Call the Cluster.ensureService(String, String) method to obtain the service.
      Parameters:
      sService - the name of the service
      cluster - the Cluster to obtain the service from
      Returns:
      the ensured service