com.j_spaces.core.client
Class LookupFinder

java.lang.Object
  extended by com.j_spaces.core.client.LookupFinder
All Implemented Interfaces:
com.j_spaces.core.Constants.Client

public class LookupFinder
extends Object
implements com.j_spaces.core.Constants.Client

LookupFinder is a generalized concept of the SpaceFinder utility. It simplifies the process of service lookup and acquiring a proxy of this service. The lookup performed on three criterions: service name, service class and service attributes. Any one of the above criterion can be null.


Field Summary
static long DEFAULT_TIMEOUT
          Default service lookup timeout Default value is 5 seconds
 
Fields inherited from interface com.j_spaces.core.Constants.Client
CLIENT_RETRY_CONNECTION_DEFAULT, CLIENT_RETRY_CONNECTION_PROP, CLIENT_THREAD_POOL_MAX_SIZE, CLIENT_THREAD_POOL_MAX_SIZE_DEFAULT, CLIENT_THREAD_POOL_MIN_SIZE, CLIENT_THREAD_POOL_MIN_SIZE_DEFAULT, FULL_CLIENT_RETRY_CONNECTION_PROP, FULL_NUMBER_OF_IMPLICIT_INDEXES_PROP, MAX_THREAD_POOL_SIZE, MIN_THREAD_POOL_SIZE, NOTIFY, NUMBER_OF_IMPLICIT_INDEXES_DEFAULT, NUMBER_OF_IMPLICIT_INDEXES_PROP, PROXY
 
Constructor Summary
LookupFinder()
           
 
Method Summary
static Object find(Class[] classes, Entry[] srvAttr, String lookupHost, long timeout, Properties customProps)
          Finds specified service according to service classes and service attributes.
static Object find(String serviceName, Class[] classes, Entry[] serviceAttributes, String lookupHost, String groups, long timeout)
          Finds specified server using all the criterion: service name, service classes and service attributes.
static Object find(String serviceName, Class[] classes, Entry[] serviceAttributes, String lookupHost, String groups, long timeout, Properties customProps)
          Finds specified server using all the criterions: service name, service classes and service attributes.
static Object find(String serviceName, Class srvClass, String lookupHost, long timeout, Properties customProps)
          Finds specified service according to service name and service class only.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TIMEOUT

public static final long DEFAULT_TIMEOUT
Default service lookup timeout Default value is 5 seconds

See Also:
Constant Field Values
Constructor Detail

LookupFinder

public LookupFinder()
Method Detail

find

public static Object find(String serviceName,
                          Class[] classes,
                          Entry[] serviceAttributes,
                          String lookupHost,
                          String groups,
                          long timeout,
                          Properties customProps)
                   throws FinderException
Finds specified server using all the criterions: service name, service classes and service attributes.

Parameters:
serviceName - Service name. Can be null.
classes - Array of service class. Can be null
serviceAttributes - Array of service attributes. Can be null
lookupHost - A hostname of the computer running the Jini Lookup service where the search to be done If null then the search is issued on any available Jini Lookup service using multicast protocol.
groups - Comma separated string of groups that the service belongs to
timeout - lookup timeout
customProps - The custom properties object which might contain overwrites to the configuration. In our case, it can include the unicast list of hosts which we will lookup upon using unicast discovery.
Returns:
Object reference to service proxy
Throws:
FinderException - Failed to find desired serviceName.

find

public static Object find(String serviceName,
                          Class[] classes,
                          Entry[] serviceAttributes,
                          String lookupHost,
                          String groups,
                          long timeout)
                   throws FinderException
Finds specified server using all the criterion: service name, service classes and service attributes.

Parameters:
serviceName - Service name. Can be null.
classes - Array of service class. Can be null
serviceAttributes - Array of service attributes. Can be null
lookupHost - A hostname of the computer running the Jini Lookup service where the search to be done If null then the search is issued on any available Jini Lookup service using multicast protocol.
groups - Comma separated string of groups that the service belongs to
timeout - lookup timeout
Returns:
Object reference to service proxy
Throws:
FinderException - Failed to find desired serviceName.

find

public static Object find(String serviceName,
                          Class srvClass,
                          String lookupHost,
                          long timeout,
                          Properties customProps)
                   throws FinderException
Finds specified service according to service name and service class only.

Parameters:
serviceName - Service name. Can be null.
srvClass - Service classes. Can be null
lookupHost - A hostname of the computer running the Jini Lookup service where the search to be done If null then the search is issued on any available Jini Lookup service
timeout - lookup timeout
customProps - The custom properties object which might contain overwrites to the configuration. In our case, it might include the unicast list of hosts which we will lookup upon using unicast discovery.
Returns:
Object reference to service proxy
Throws:
FinderException - Failed to find desired serviceName.

find

public static Object find(Class[] classes,
                          Entry[] srvAttr,
                          String lookupHost,
                          long timeout,
                          Properties customProps)
                   throws FinderException
Finds specified service according to service classes and service attributes.

Parameters:
classes - Array of service classes. Can be null
srvAttr - Array of service attributes. Can be null
lookupHost - A hostname of the computer running the Jini Lookup service where the search to be done If null then the search is issued on any available Jini Lookup service
timeout - lookup timeout
customProps - The custom properties object which might contain overwrites to the configuration. In our case, it can include the unicast list of hosts which we will lookup upon using unicast discovery.
Returns:
Object reference to service proxy
Throws:
FinderException - Failed to find desired serviceName.