org.softamis.cluster4spring.support.context
Class GroupBasedExporterAcceptor<AE extends AutoDiscoveredServiceExporter,SP extends ServicePublisher>

java.lang.Object
  extended by org.softamis.cluster4spring.support.context.DefaultExporterAcceptor<AE,SP>
      extended by org.softamis.cluster4spring.support.context.GroupBasedExporterAcceptor<AE,SP>
Type Parameters:
AE - type of service exporter
SP - type of service publisher
All Implemented Interfaces:
ExporterAcceptor<AE,SP>

public class GroupBasedExporterAcceptor<AE extends AutoDiscoveredServiceExporter,SP extends ServicePublisher>
extends DefaultExporterAcceptor<AE,SP>

Policy that accepts all exporters which has allowsAutoDiscovering property set to true and group equals to publisher' group. This policy is useful if the same server serves several clients and services published for one client should not be availalble for another one. This could be done by separating all own services on the server by groups and using different publishers for each group.

Author:
Andrew Sazonov
See Also:
AutoDiscoveredServiceExporter, ServicePublisher, AutoDiscoveredServiceExporter.isAllowsAutoDiscovering()

Constructor Summary
GroupBasedExporterAcceptor()
           
 
Method Summary
 boolean canAcceptExporterForPublishing(AE aExporter, SP aPublisher)
          Determines whether service exporter by given publisher should be published by given publisher.
protected  boolean equals(java.lang.String aFirst, java.lang.String aSecond)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupBasedExporterAcceptor

public GroupBasedExporterAcceptor()
Method Detail

canAcceptExporterForPublishing

public boolean canAcceptExporterForPublishing(AE aExporter,
                                              SP aPublisher)
Determines whether service exporter by given publisher should be published by given publisher. Current implementation accepts any exporter that has allowsAutoDiscovering property set to true and group equals to publisher' group.

Specified by:
canAcceptExporterForPublishing in interface ExporterAcceptor<AE extends AutoDiscoveredServiceExporter,SP extends ServicePublisher>
Overrides:
canAcceptExporterForPublishing in class DefaultExporterAcceptor<AE extends AutoDiscoveredServiceExporter,SP extends ServicePublisher>
Parameters:
aExporter - exporter
aPublisher - publisher that publishes services
Returns:
true if publisher should publish service exported by exporter

equals

protected boolean equals(java.lang.String aFirst,
                         java.lang.String aSecond)