org.livetribe.slp
Class Scopes

java.lang.Object
  extended by org.livetribe.slp.Scopes

public class Scopes
extends Object

Scopes are case insensitive string labels used to group together related services. Both DirectoryAgent and ServiceAgent have assigned one or more scopes so that they can advertise services belonging to the scopes they've been assigned. The scope assigned by default to DirectoryAgents and UserAgents is the DEFAULT scope.

Version:
$Rev: 258 $ $Date: 2006-08-23 15:45:17 +0200 (Wed, 23 Aug 2006) $

Field Summary
static Scopes DEFAULT
          The DEFAULT scope is just like any other scope, only that's used by DirectoryAgents and ServiceAgents as their default scope.
static Scopes WILDCARD
          The WILDCARD scope is special, as it does not match any scope, and all other scopes will match it.
 
Constructor Summary
Scopes(String[] scopes)
          Creates a Scopes object containing the given scope strings.
 
Method Summary
 String[] asStringArray()
          Returns the scope strings contained by this Scopes object.
 boolean equals(Object obj)
           
 int hashCode()
           
 boolean isDefaultScope()
          Returns true if this Scopes object is the default scope, false otherwise.
 boolean isWildcardScope()
          Returns true if this Scopes object is the wildcard scope, false otherwise.
 boolean match(Scopes other)
          Matches the given Scopes argument against this Scopes object.
 String toString()
           
 boolean weakMatch(Scopes other)
          Matches the given Scopes argument against this Scopes object, more weakly than match(Scopes).
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT

public static final Scopes DEFAULT
The DEFAULT scope is just like any other scope, only that's used by DirectoryAgents and ServiceAgents as their default scope.

See Also:
WILDCARD

WILDCARD

public static final Scopes WILDCARD
The WILDCARD scope is special, as it does not match any scope, and all other scopes will match it. It may be used during queries, when one wants to retrieve services registered in all scopes.

See Also:
DEFAULT
Constructor Detail

Scopes

public Scopes(String[] scopes)
Creates a Scopes object containing the given scope strings.

Parameters:
scopes - The scope strings to be contained by this Scopes object
Method Detail

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

match

public boolean match(Scopes other)
Matches the given Scopes argument against this Scopes object. If this Scopes is the wildcard scope, always returns false. If the given Scopes is the wildcard scope, always returns true.

Parameters:
other - The Scopes to match
Returns:
True if all scopes specified by the given Scopes argument are also scopes of this Scopes object.
See Also:
weakMatch(Scopes)

weakMatch

public boolean weakMatch(Scopes other)
Matches the given Scopes argument against this Scopes object, more weakly than match(Scopes). If this Scopes is the wildcard scope, always returns false. If the given Scopes is the wildcard scope, always returns true.

Parameters:
other - The Scopes to match
Returns:
True if at least one of the scopes specified by the given Scopes argument is also a scope of this Scopes object.
See Also:
match(Scopes)

asStringArray

public String[] asStringArray()
Returns the scope strings contained by this Scopes object.


isWildcardScope

public boolean isWildcardScope()
Returns true if this Scopes object is the wildcard scope, false otherwise.

See Also:
WILDCARD

isDefaultScope

public boolean isDefaultScope()
Returns true if this Scopes object is the default scope, false otherwise.

See Also:
DEFAULT

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2006-2012 LiveTribe. All Rights Reserved.