org.gridbus.broker.util
Class MDSUtil

java.lang.Object
  extended byorg.gridbus.broker.util.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()
          Creates an instance of MDSUtil and initialises any default settings.
 
Method Summary
 java.lang.String[] getAvailableDNs(java.lang.String hostURL)
          Gets the dns which are available for the given host.
 long getCountLimit()
          Gets the current limit on the number of results to be returned.
 org.ietf.jgss.GSSCredential getCredentials()
          Gets the credentials currently being used for authentication.
 int getSearchScope()
          Gets the current search scope for searches.
 int getTimeLimit()
          Gets the current time limit (in ms) to wait for search results.
 boolean isSecure()
          Checks whether secure connections are being used.
 void resetSearchControls()
          Resets the current search controls.
 javax.naming.NamingEnumeration search(java.lang.String hostURL, java.lang.String[] retAttrs)
          Searches for all objects of the host URL.
 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.
 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.
 void setCountLimit(long limit)
          Sets the limit for the maximum number of results to be returned during searches.
 void setSearchScope(int scope)
          Sets the scope to be used during searches.
 void setSecure(org.ietf.jgss.GSSCredential creds)
          Sets up this MDSUtil to use secure connections.
 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()
Creates an instance of MDSUtil and initialises any default settings.

Method Detail

search

public 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 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 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 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 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 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 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 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 int getSearchScope()
Gets the current search scope for searches. Wrapper around SearchControls.getSearchScope()

Returns:
the search scope.
See Also:
SearchControls

resetSearchControls

public void resetSearchControls()
Resets the current search controls.


setSecure

public 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 boolean isSecure()
Checks whether secure connections are being used.

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

getCredentials

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

Returns:
the credentials being used for authentication.

getAvailableDNs

public 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