org.sapia.soto
Class AttributeServiceSelector

java.lang.Object
  extended by org.sapia.soto.AttributeServiceSelector
All Implemented Interfaces:
ServiceSelector

public class AttributeServiceSelector
extends java.lang.Object
implements ServiceSelector

This class implements a ServiceSelector that selects Soto Services based on their configured attributes.

Usage:

  // container is a SotoContainer or Env instance
  AttributeServiceSelector selector = new AttributeServiceSelector();
  selector
    .addAttribute(
      new Attribute().setName("attribute1")
     )
    .addAttribute(
      new Attribute().setName("attribute2").setValue("value2")
     );
   
  List result = services.lookup(selector, false);
  ...
 

The above example looks for all services that have an "attribute1" attribute AND an "attribute2" attribute with value "value2".

The involved classes support chained invocation, for convenience.

Author:
Yanick Duchesne
Copyright:
Copyright © 2002-2005 Sapia Open Source Software. All Rights Reserved.
License:
Read the license.txt file of the jar or visit the license page at the Sapia OSS web site
See Also:
SotoContainer.lookup(ServiceSelector,boolean), Env.lookup(ServiceSelector, boolean)

Constructor Summary
AttributeServiceSelector()
           
 
Method Summary
 boolean accepts(ServiceMetaData meta)
           
 AttributeServiceSelector addCriteria(Attribute attr)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributeServiceSelector

public AttributeServiceSelector()
Method Detail

addCriteria

public AttributeServiceSelector addCriteria(Attribute attr)

accepts

public boolean accepts(ServiceMetaData meta)
Specified by:
accepts in interface ServiceSelector
Parameters:
meta - a ServiceMetadata.
Returns:
true if this instance determines that the given instance should be returned in the lookup result.
See Also:
ServiceSelector.accepts(org.sapia.soto.ServiceMetaData)


Copyright © 2010 Sapia OSS. All Rights Reserved.