org.softamis.cluster4spring.support.context
Class GenericServicePublisher<EC extends AutoDiscoveredServiceExporter>

java.lang.Object
  extended by org.softamis.cluster4spring.support.context.AbstractServicePublisher<EC>
      extended by org.softamis.cluster4spring.support.context.GenericServicePublisher<EC>
All Implemented Interfaces:
java.util.EventListener, ServicePublisher, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener
Direct Known Subclasses:
DefaultServicePublisher, RmiServicePublisher

public class GenericServicePublisher<EC extends AutoDiscoveredServiceExporter>
extends AbstractServicePublisher<EC>

Generic implementation of ServicePublisher which uses ProvidingRegistry as distributed storage of services locations.

Author:
Andrew Sazonov

Field Summary
protected  org.softamis.net.registry.ProvidingRegistry<java.lang.String,ServiceMoniker> fServicesRegistry
          Registry used to publish information about auto-discoverable services
 
Fields inherited from class org.softamis.cluster4spring.support.context.AbstractServicePublisher
fAutodiscoveredExporterClass, fAutodiscoveredServicesInfo, fBeanName, fCacheAutoDiscoveredServicesInfo, fContext, fExporterAcceptor, fProtocolName, fServerID, fServerType, fServiceGroup
 
Fields inherited from interface org.softamis.cluster4spring.ServicePublisher
SERVER_TYPE_DELIMITER
 
Constructor Summary
GenericServicePublisher()
           
 
Method Summary
 void afterPropertiesSet()
          Called by Spring as part of bean lifecycle.
protected  void doRegisterServiceInServicesRegistry(java.lang.String aServiceKey, ServiceMoniker aMoniker)
          Notifies underlying services registry that information about service should be published
protected  void doUnregisterServiceInServicesRegistry(java.lang.String aServiceKey)
          Notifies that service under given key should be unregistered in underlying services registry
 org.softamis.net.registry.ProvidingRegistry<java.lang.String,ServiceMoniker> getServicesRegistry()
          Returns registry used to publish information about auto-discoverable services
 void setServicesRegistry(org.softamis.net.registry.ProvidingRegistry<java.lang.String,ServiceMoniker> aServicesRegistry)
          Sets registry used to publish information about auto-discoverable services
 
Methods inherited from class org.softamis.cluster4spring.support.context.AbstractServicePublisher
collectAutoDiscoveredServices, contextClosed, contextRefreshed, createDefaultExporterAcceptor, createServiceInfos, createServiceMoniker, createServicesGroup, doGetAutoDiscoveredServices, getAutodiscoveredExporterClass, getProtocolName, getPublisherName, getServerID, getServerType, getServiceGroup, getServiceKey, isCacheAutoDiscoveredServicesInfo, onApplicationEvent, prepareServiceURL, publishService, publishServices, setApplicationContext, setBeanName, setCacheAutoDiscoveredServicesInfo, setExporterAcceptor, setServerID, setServerType, setServiceGroup, unPublishService, unPublishServices
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fServicesRegistry

protected org.softamis.net.registry.ProvidingRegistry<java.lang.String,ServiceMoniker> fServicesRegistry
Registry used to publish information about auto-discoverable services

Constructor Detail

GenericServicePublisher

public GenericServicePublisher()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Description copied from class: AbstractServicePublisher
Called by Spring as part of bean lifecycle. Performs checking that service group is specified externally (or creates default group name). Also checks whether ExporterAcceptor is specified and if necessary creates default one.

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Overrides:
afterPropertiesSet in class AbstractServicePublisher<EC extends AutoDiscoveredServiceExporter>
Throws:
java.lang.Exception
See Also:
AbstractServicePublisher.createServicesGroup(), AbstractServicePublisher.createDefaultExporterAcceptor()

doUnregisterServiceInServicesRegistry

protected void doUnregisterServiceInServicesRegistry(java.lang.String aServiceKey)
Description copied from class: AbstractServicePublisher
Notifies that service under given key should be unregistered in underlying services registry

Specified by:
doUnregisterServiceInServicesRegistry in class AbstractServicePublisher<EC extends AutoDiscoveredServiceExporter>
Parameters:
aServiceKey - key for service that should be unregistered

doRegisterServiceInServicesRegistry

protected void doRegisterServiceInServicesRegistry(java.lang.String aServiceKey,
                                                   ServiceMoniker aMoniker)
Description copied from class: AbstractServicePublisher
Notifies underlying services registry that information about service should be published

Specified by:
doRegisterServiceInServicesRegistry in class AbstractServicePublisher<EC extends AutoDiscoveredServiceExporter>
Parameters:
aServiceKey - key for service
aMoniker - service information

getServicesRegistry

public org.softamis.net.registry.ProvidingRegistry<java.lang.String,ServiceMoniker> getServicesRegistry()
Returns registry used to publish information about auto-discoverable services

Returns:
registry

setServicesRegistry

public void setServicesRegistry(org.softamis.net.registry.ProvidingRegistry<java.lang.String,ServiceMoniker> aServicesRegistry)
Sets registry used to publish information about auto-discoverable services

Parameters:
aServicesRegistry - registry