com.artima.place
Class MulticastDiscoveryLink

java.lang.Object
  |
  +--com.artima.place.MulticastDiscoveryLink
All Implemented Interfaces:
Link, java.io.Serializable

public final class MulticastDiscoveryLink
extends java.lang.Object
implements Link

A Link that performs queries in lookup services located via multicast discovery.

See Also:
Serialized Form

Constructor Summary
MulticastDiscoveryLink(net.jini.core.lookup.ServiceTemplate template)
          Construct a MulticastDiscoveryLink with the passed ServiceTemplate.
MulticastDiscoveryLink(java.lang.String[] groups, net.jini.core.lookup.ServiceTemplate template)
          Construct a MulticastDiscoveryLink with the passed groups String array and ServiceTemplate.
 
Method Summary
 LinkActivation activate(ActivationClient al)
          Retrieve this service.
 java.lang.String[] getGroups()
          Returns the groups used by this link in performing multicast discovery when activated.
 net.jini.core.lookup.ServiceTemplate getServiceTemplate()
          Returns a duplicate of the ServiceTemplace used in lookups when this link is activated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MulticastDiscoveryLink

public MulticastDiscoveryLink(net.jini.core.lookup.ServiceTemplate template)
                       throws java.io.IOException,
                              java.lang.ClassNotFoundException
Construct a MulticastDiscoveryLink with the passed ServiceTemplate.

The activate method will perform multicast discovery of all reachable lookup services, and query each discovered lookup service with the passed ServiceTemplate.

Parameters:
template - the ServiceTemplate with which to peform lookups when this link is activated
Throws:
java.io.IOException - if an I/O error occurs when attempting to serialize or deserialize the ServiceTemplate.
java.lang.ClassNotFoundException - if a class can't be found when attempting deserialize the duplicate ServiceTemplate.

MulticastDiscoveryLink

public MulticastDiscoveryLink(java.lang.String[] groups,
                              net.jini.core.lookup.ServiceTemplate template)
                       throws java.io.IOException,
                              java.lang.ClassNotFoundException
Construct a MulticastDiscoveryLink with the passed groups String array and ServiceTemplate.

The activate method will perform multicast discovery, and query each discovered lookup service with the passed ServiceTemplate. Does multicast discovery and lookups. When this link is activated it will just keep trying until either a match is found or the user aborts. If multiple matches are found, a random match is returned.

Parameters:
groups - an array of String group names with which perform multicast discovery when this link is activated.
template - the ServiceTemplate with which to peform lookups when this link is activated
Method Detail

activate

public LinkActivation activate(ActivationClient al)
Retrieve this service. The activate method will return promptly, returning a LinkActivation object that enables clients to abort an activation. Invoking activate again while an activation is currently in progress just starts a new activation independent of the already running one.
Specified by:
activate in interface Link
Parameters:
al - the ActivationClient that will be notified when this link activation completes
Returns:
the LinkActivation object with which the client can interact with this activation of this Link
Throws:
NullPointerException - if passed activationClient is null

getServiceTemplate

public net.jini.core.lookup.ServiceTemplate getServiceTemplate()
                                                        throws java.io.IOException,
                                                               java.lang.ClassNotFoundException
Returns a duplicate of the ServiceTemplace used in lookups when this link is activated. The duplicate is created by serializing and then deserializing the actual ServiceTemplate.
Returns:
a duplicate of the ServiceTemplate used by this link when activated
Throws:
java.io.IOException - if an I/O error occurs when attempting to duplicate the ServiceTemplate.
java.lang.ClassNotFoundException - if a class can't be found when attempting deserialize the duplicate ServiceTemplate.

getGroups

public java.lang.String[] getGroups()
Returns the groups used by this link in performing multicast discovery when activated. A null return value indicates this link will attempt discovery of all reachable lookup services when activated.
Returns:
the groups used by this link in performing multiat discovery when activated