GigaSpaces XAP 7.0 API

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.

Version:
1.0
Author:
Igor Goldenberg

Nested Class Summary
static class LookupFinder.LookupEntriesComparator
           
 
Field Summary
static String ACTUAL_CLOSE_SYSTEM_PROPERTY
          If this system property is set to "true", close() will actually perform the close operation, otherwise, it will not perform anything.
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, FULL_CLIENT_RETRY_CONNECTION_PROP, FULL_NUMBER_OF_IMPLICIT_INDEXES_PROP, NUMBER_OF_IMPLICIT_INDEXES_DEFAULT, NUMBER_OF_IMPLICIT_INDEXES_PROP
 
Constructor Summary
LookupFinder()
           
 
Method Summary
static void close()
          Closes the lookup finder if the ACTUAL_CLOSE_SYSTEM_PROPERTY is set to "true".
static Object find(Class[] classes, net.jini.core.entry.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, net.jini.core.entry.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, net.jini.core.entry.Entry[] serviceAttributes, String lookupHost, String groups, long timeout, long timeoutInterval, Properties customProps)
          Finds specified server using all the criterions: service name, service classes and service attributes.
static Object find(String serviceName, Class[] classes, net.jini.core.entry.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.
static void forceClose()
          Forces close regardless of the ACTUAL_CLOSE_SYSTEM_PROPERTY system proepty.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, 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

ACTUAL_CLOSE_SYSTEM_PROPERTY

public static final String ACTUAL_CLOSE_SYSTEM_PROPERTY
If this system property is set to "true", close() will actually perform the close operation, otherwise, it will not perform anything. To force close, please call forceClose().

See Also:
Constant Field Values
Constructor Detail

LookupFinder

public LookupFinder()
Method Detail

close

public static void close()
Closes the lookup finder if the ACTUAL_CLOSE_SYSTEM_PROPERTY is set to "true". IF it is not set, will default to "true".


forceClose

public static void forceClose()
Forces close regardless of the ACTUAL_CLOSE_SYSTEM_PROPERTY system proepty.


find

public static Object find(String serviceName,
                          Class[] classes,
                          net.jini.core.entry.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,
                          net.jini.core.entry.Entry[] serviceAttributes,
                          String lookupHost,
                          String groups,
                          long timeout,
                          long timeoutInterval,
                          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
timeoutInterval - The interval we use in order to poll the SDM for lookup items
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,
                          net.jini.core.entry.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,
                          net.jini.core.entry.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.

GigaSpaces XAP 7.0 API

Copyright © GigaSpaces.