Class ProxyOnlyServiceRegistryImpl

  • All Implemented Interfaces:
    com.anaptecs.jeaf.core.servicechannel.api.ServiceRegistry

    public final class ProxyOnlyServiceRegistryImpl
    extends java.lang.Object
    implements com.anaptecs.jeaf.core.servicechannel.api.ServiceRegistry
    Class implements a simple service registry that contains service proxies only.
    Version:
    1.0
    Author:
    JEAF Development Team
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addServiceProxies​(java.util.Collection<com.anaptecs.jeaf.core.servicechannel.api.ServiceProxy> pServiceProxies)
      Method adds the passed service proxy as implementation for the corresponding service interface.
      void addServiceProxy​(com.anaptecs.jeaf.core.servicechannel.api.ServiceProxy pServiceProxy)
      Method adds the passed service proxy as implementation for the corresponding service interface.
      void clear()
      Method clears the service registry.
      java.util.Collection<com.anaptecs.jeaf.core.spi.ServiceImplementation> getAllServiceInstances()  
      java.util.Collection<com.anaptecs.jeaf.core.servicechannel.api.ServiceProxy> getAllServiceProxies()
      Method returns all service proxies that are stored in this service registry.
      java.util.Collection<java.lang.Class<? extends com.anaptecs.jeaf.core.api.Service>> getAvailableServiceClasses()
      Method returns the class objects of all services that are available through this service registry.
      com.anaptecs.jeaf.core.spi.ServiceImplementation getServiceInstance​(java.lang.Class<? extends com.anaptecs.jeaf.core.api.Service> pServiceType)  
      com.anaptecs.jeaf.core.servicechannel.api.ServiceProxy getServiceProxy​(java.lang.Class<? extends com.anaptecs.jeaf.core.api.Service> pServiceType)
      Method returns a proxy object for the service that implements the passed service interface.
      boolean isServiceAvailable​(java.lang.Class<? extends com.anaptecs.jeaf.core.api.Service> pServiceClass)
      Method checks if the service registry contains of service of the passed class.
      void registerService​(com.anaptecs.jeaf.core.spi.ServiceImplementation pServiceInstance, com.anaptecs.jeaf.core.servicechannel.api.ServiceProxy pServiceProxy)
      Method registers the service that is provided via the passed service factory.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ProxyOnlyServiceRegistryImpl

        public ProxyOnlyServiceRegistryImpl()
        Initialize object.
    • Method Detail

      • registerService

        public void registerService​(com.anaptecs.jeaf.core.spi.ServiceImplementation pServiceInstance,
                                    com.anaptecs.jeaf.core.servicechannel.api.ServiceProxy pServiceProxy)
        Method registers the service that is provided via the passed service factory.
        Specified by:
        registerService in interface com.anaptecs.jeaf.core.servicechannel.api.ServiceRegistry
        Parameters:
        pServiceInstance - Service instance that should be registered. The parameter must not be null.
        pServiceProxy - Service proxy that belongs to the service implementation. The parameter must not be null.
      • getServiceProxy

        public final com.anaptecs.jeaf.core.servicechannel.api.ServiceProxy getServiceProxy​(java.lang.Class<? extends com.anaptecs.jeaf.core.api.Service> pServiceType)
        Method returns a proxy object for the service that implements the passed service interface.
        Specified by:
        getServiceProxy in interface com.anaptecs.jeaf.core.servicechannel.api.ServiceRegistry
        Parameters:
        pServiceType - Type of service whose proxy object should be returned. The parameter must not be null.
        Returns:
        Service Service implementation of the passed type. The method never returns null.
        See Also:
        ServiceRegistry.getServiceProxy(java.lang.Class)
      • getAllServiceProxies

        public java.util.Collection<com.anaptecs.jeaf.core.servicechannel.api.ServiceProxy> getAllServiceProxies()
        Method returns all service proxies that are stored in this service registry.
        Specified by:
        getAllServiceProxies in interface com.anaptecs.jeaf.core.servicechannel.api.ServiceRegistry
        Returns:
        Collection Collection with all service proxies of this service registry. The method never returns null.
      • addServiceProxy

        public final void addServiceProxy​(com.anaptecs.jeaf.core.servicechannel.api.ServiceProxy pServiceProxy)
        Method adds the passed service proxy as implementation for the corresponding service interface.
        Parameters:
        pServiceProxy - Service proxy that should be added to the service registry. The parameter must not be null and a service proxy of the same service interface must not have been added yet.
        See Also:
        ServiceProxy.getServiceType()
      • addServiceProxies

        public void addServiceProxies​(java.util.Collection<com.anaptecs.jeaf.core.servicechannel.api.ServiceProxy> pServiceProxies)
        Method adds the passed service proxy as implementation for the corresponding service interface.
        Parameters:
        pServiceProxes - Collection with service proxies that should be added to the service registry. The parameter must not be null and a service proxy of the same service interface must not have been added yet.
      • getAvailableServiceClasses

        public java.util.Collection<java.lang.Class<? extends com.anaptecs.jeaf.core.api.Service>> getAvailableServiceClasses()
        Method returns the class objects of all services that are available through this service registry.
        Specified by:
        getAvailableServiceClasses in interface com.anaptecs.jeaf.core.servicechannel.api.ServiceRegistry
        Returns:
        Collection Class objects of all service interfaces that are available this service registry. The method never returns null and all objects within the collection are instances of java.lang.Class.
      • isServiceAvailable

        public boolean isServiceAvailable​(java.lang.Class<? extends com.anaptecs.jeaf.core.api.Service> pServiceClass)
        Method checks if the service registry contains of service of the passed class.
        Specified by:
        isServiceAvailable in interface com.anaptecs.jeaf.core.servicechannel.api.ServiceRegistry
        Parameters:
        pServiceClass - Class of service that should be checked. The parameter must not be null
        Returns:
        boolean Method returns true if the service registry contains the passed service and false in all other cases.
      • clear

        public void clear()
        Method clears the service registry. This means that the references to all services are removed.
      • getServiceInstance

        public com.anaptecs.jeaf.core.spi.ServiceImplementation getServiceInstance​(java.lang.Class<? extends com.anaptecs.jeaf.core.api.Service> pServiceType)
        Specified by:
        getServiceInstance in interface com.anaptecs.jeaf.core.servicechannel.api.ServiceRegistry
      • getAllServiceInstances

        public java.util.Collection<com.anaptecs.jeaf.core.spi.ServiceImplementation> getAllServiceInstances()
        Specified by:
        getAllServiceInstances in interface com.anaptecs.jeaf.core.servicechannel.api.ServiceRegistry