org.gridbus.broker.farming.globus
Class MDSUtil

java.lang.Object
  extended by org.gridbus.broker.farming.globus.MDSUtil

public class MDSUtil
extends java.lang.Object

Privides a utility class for accessing directory information. Wraps around DirContext class.

Author:
Hussein Gibbins (hag@cs.mu.oz.au)
See Also:
DirContext

Field Summary
static java.lang.String DEFAULT_CONTEXTNAME
           
static java.lang.String DEFAULT_FILTER
           
 
Constructor Summary
MDSUtil()
           
 
Method Summary
static java.lang.String[] getAvailableDNs(java.lang.String hostURL)
          Gets the dns which are available for the given host.
static long getCountLimit()
          Gets the current limit on the number of results to be returned.
static org.ietf.jgss.GSSCredential getCredentials()
          Gets the credentials currently being used for authentication.
static int getSearchScope()
          Gets the current search scope for searches.
static int getTimeLimit()
          Gets the current time limit (in ms) to wait for search results.
static boolean isSecure()
          Checks whether secure connections are being used.
static void resetSearchControls()
          Resets the current search controls.
static javax.naming.NamingEnumeration search(java.lang.String hostURL, java.lang.String[] retAttrs)
          Searches for all objects of the host URL.
static javax.naming.NamingEnumeration search(java.lang.String hostURL, java.lang.String filter, java.lang.String[] retAttrs)
          Searches for objects matching the given filter of the hsot URL.
static javax.naming.NamingEnumeration search(java.lang.String hostURL, java.lang.String contextName, java.lang.String filter, java.lang.String[] retAttrs)
          Searches objects matching the given filter of the host URL.
static void setCountLimit(long limit)
          Sets the limit for the maximum number of results to be returned during searches.
static void setSearchScope(int scope)
          Sets the scope to be used during searches.
static void setSecure(org.ietf.jgss.GSSCredential creds)
          Sets up this MDSUtil to use secure connections.
static void setTimeLimit(int ms)
          Sets the time limit (in ms) to wait for search results.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CONTEXTNAME

public static final java.lang.String DEFAULT_CONTEXTNAME
See Also:
Constant Field Values

DEFAULT_FILTER

public static final java.lang.String DEFAULT_FILTER
See Also:
Constant Field Values
Constructor Detail

MDSUtil

public MDSUtil()
Method Detail

search

public static javax.naming.NamingEnumeration search(java.lang.String hostURL,
                                                    java.lang.String[] retAttrs)
                                             throws javax.naming.NamingException
Searches for all objects of the host URL. Returns results for the given set of attributes. Performs connection and disconnection of the host.

Parameters:
hostURL - URL of the host to search.
retAttrs - - the attributes to return. null indicates that all attributes are to be returned; an empty array indicates that none are to be returned.
Returns:
the search results.
Throws:
javax.naming.NamingException

search

public static javax.naming.NamingEnumeration search(java.lang.String hostURL,
                                                    java.lang.String filter,
                                                    java.lang.String[] retAttrs)
                                             throws javax.naming.NamingException
Searches for objects matching the given filter of the hsot URL. Returns results for the given set of attributes. Performs connection and disconnection of the host.

Parameters:
hostURL - URL of the host to search.
filter - the filter expression to use for the search.
retAttrs - the attributes to return. null indicates that all attributes are to be returned; an empty array indicates that none are to be returned.
Returns:
the search results.
Throws:
javax.naming.NamingException

search

public static javax.naming.NamingEnumeration search(java.lang.String hostURL,
                                                    java.lang.String contextName,
                                                    java.lang.String filter,
                                                    java.lang.String[] retAttrs)
                                             throws javax.naming.NamingException
Searches objects matching the given filter of the host URL. Begins search at the given context name. Returns results for the given set of attributes. Performs connection and disconnection of the host.

Parameters:
hostURL - URL of the host to search.
contextName - the name of the context to search.
filter - the filter expression to use for the search.
retAttrs - the attributes to return. null indicates that all attributes are to be returned; an empty array indicates that none are to be returned.
Returns:
the search results.
Throws:
javax.naming.NamingException

setTimeLimit

public static void setTimeLimit(int ms)
Sets the time limit (in ms) to wait for search results. Wrapper around SearchControls.setTimeLimit(int)

Parameters:
ms - the time to wait for results.
See Also:
SearchControls

setCountLimit

public static void setCountLimit(long limit)
Sets the limit for the maximum number of results to be returned during searches. Wrapper around SearchControls.setCountLimit(long)

Parameters:
limit - maximum number of results to return.
See Also:
SearchControls

setSearchScope

public static void setSearchScope(int scope)
Sets the scope to be used during searches. Wrapper around SearchControls.setSearchScope(int)

Parameters:
scope - the scope to be used during searches. SearchControls.SUBTREE_SCOPE, SearchControls.OBJECT_SCOPE or SearchControls.ONELEVEL_SCOPE
See Also:
SearchControls

getTimeLimit

public static int getTimeLimit()
Gets the current time limit (in ms) to wait for search results. Wrapper around SearchControls.getTimeLimit()

Returns:
the maximum time to wait for results.
See Also:
SearchControls

getCountLimit

public static long getCountLimit()
Gets the current limit on the number of results to be returned. Wrapper around SearchControls.getCountLimit()

Returns:
the maximum number of results to return.
See Also:
SearchControls

getSearchScope

public static int getSearchScope()
Gets the current search scope for searches. Wrapper around SearchControls.getSearchScope()

Returns:
the search scope.
See Also:
SearchControls

resetSearchControls

public static void resetSearchControls()
Resets the current search controls.


setSecure

public static void setSecure(org.ietf.jgss.GSSCredential creds)
Sets up this MDSUtil to use secure connections.

Parameters:
creds - credentials to use during authentication. null if anonymous connections are to be used.

isSecure

public static boolean isSecure()
Checks whether secure connections are being used.

Returns:
true if security is being used, false otherwise.

getCredentials

public static org.ietf.jgss.GSSCredential getCredentials()
Gets the credentials currently being used for authentication.

Returns:
the credentials being used for authentication.

getAvailableDNs

public static java.lang.String[] getAvailableDNs(java.lang.String hostURL)
                                          throws javax.naming.NamingException
Gets the dns which are available for the given host.

Parameters:
hostURL - url for the host to look up.
Returns:
a list of available dns.
Throws:
javax.naming.NamingException