jgroup.jini
Class LookupManager

java.lang.Object
  |
  +--jgroup.jini.LookupManager

public class LookupManager
extends java.lang.Object

The LookupManager class can be used to interrogate a lookup service in order to obtain a proxy for a service. LookupManager is only a convenience class, which invokes the discovery protocol in order to obtain a proxy for the lookup service and then interrogate it opportunely. The Jgroup programmer can use different techniques to perform the lookup, as illustrated in the Jini specification.

In order to search for a group which has joined the Jini federation, a GroupEntry entry containing the group name must be included in the template.

Since:
Jgroup 1.1
Author:
Alberto Montresor

Inner Class Summary
private  class LookupManager.Listener
          Listener for Discovery events
 
Field Summary
private static LookupManager manager
          Singleton manager
private  java.util.LinkedList registrars
           
 
Constructor Summary
private LookupManager()
          Private constructor for singleton use
 
Method Summary
private  void discarded(net.jini.discovery.DiscoveryEvent ev)
           
private  void discovered(net.jini.discovery.DiscoveryEvent ev)
           
static java.lang.Object lookup(net.jini.core.lookup.ServiceTemplate template)
          Perform a lookup in the lookup service, searching for the specified object with the specified attributes.
static java.lang.Object lookup(net.jini.core.lookup.ServiceTemplate template, int timeout)
          Perform a lookup in the lookup service, searching for the specified object with the specified attributes.
private  java.lang.Object searchDiscovered(net.jini.core.lookup.ServiceTemplate template, int timeout)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

manager

private static LookupManager manager
Singleton manager

registrars

private java.util.LinkedList registrars
Constructor Detail

LookupManager

private LookupManager()
               throws java.io.IOException
Private constructor for singleton use
Throws:
java.io.IOException - an error occurred in starting discovery
Method Detail

lookup

public static java.lang.Object lookup(net.jini.core.lookup.ServiceTemplate template)
                               throws java.io.IOException
Perform a lookup in the lookup service, searching for the specified object with the specified attributes.
Parameters:
template - template of the service to be searched
Returns:
a proxy for the service, or null is no service can be found with the specified template
Throws:
java.io.IOException - an error occurred in doing lookup

lookup

public static java.lang.Object lookup(net.jini.core.lookup.ServiceTemplate template,
                                      int timeout)
                               throws java.io.IOException
Perform a lookup in the lookup service, searching for the specified object with the specified attributes.
Parameters:
template - template of the service to be searched
timeout - maximum time allowed for the lookup operation
Returns:
a proxy for the service, or null is no service can be found with the specified template
Throws:
java.io.IOException - an error occurred in doing lookup

discovered

private void discovered(net.jini.discovery.DiscoveryEvent ev)

discarded

private void discarded(net.jini.discovery.DiscoveryEvent ev)

searchDiscovered

private java.lang.Object searchDiscovered(net.jini.core.lookup.ServiceTemplate template,
                                          int timeout)
                                   throws java.rmi.RemoteException