org.globus.mds
Class MDS

java.lang.Object
  extended byorg.globus.mds.MDS
All Implemented Interfaces:
Serializable

Deprecated. Please use JNDI (with LDAP provider) or Netscape Directory SDK directly to access MDS.

public class MDS
extends Object
implements Serializable

The interface to the Monitoring and Discovery Service.

USING THE MDS CLASS

The intention of the MDS class is to simplify the connection to the Monitoring and Discovery Service (MDS). This includes:
  1. establishing a conection to an MDS Server,
  2. quering for contents in the MDS,
  3. printing the result of a query, and
  4. disconecting from the MDS Server.
The main motivation for this class is to have an intermediate Application Layer which can be easily adapted to different LDAP client libraries (JNDI, Netscape SDK, Microsoft SDK). To adapt to the differnt API's only a limited number of routines have to be ported. The current release is based on JNDI.

Connecting

The first step in using the class is to establish a connection, which is done in the following way:
MDS mds = new MDS("www.globus.org", "389", "o=Globus, c=US");
The parameters to the mds class are simply the DNS name of the MDS server and the port number for the connection. The default values for the connection to the MDS are set to ldap://mds.globus.org:389, which are used in case no parameters are specified:
MDS mds = new MDS();

Searching

Searching the MDS is done with LDAP queries in respect to a base directory specified by a distingished name (DN). The top level of a globus related seraches is:
o=Globus, c=US
A search is invoked in the following way:
NamingEnumeration result;
result = mds.search("o=Globus, c=US", "(objectclass=*)", MDS.ONELEVEL_SCOPE);
The search result is stored in a NamingEnumeration as provided by JNDI.

Printing

A result from a search can be modified by the appropiate JNDI functions. A simple print function is provided which is intended to simplify debugging and programming development:
mds.print(result, false);

Example

The following example shows a program which connets to the MDS, and prints all ComputeResources located at Argonne National Laboratory:
MDS mds = new MDS("mds.globus.org", "389");
try {
mds.connect();
String bindDN =
"o=Argonne National Laboratory, o=Globus,c=US";
Vector result;
result = mds.search(bindDN,
"(objectclass=GlobusComputeResource)", MDS.ONELEVEL_SCOPE);
System.out.println(results);
mds.disconnect();
} catch(MDSException e) {
System.err.println( "Error:"+ e.getLdapMessage() );
}

See Also:
Serialized Form

Field Summary
protected  LdapContext ctx
          Deprecated.  
protected static String DEFAULT_CTX
          Deprecated.  
protected  Properties env
          Deprecated.  
protected  int limit
          Deprecated.  
static int OBJECT_SCOPE
          Deprecated.  
static int ONELEVEL_SCOPE
          Deprecated.  
static int SUBTREE_SCOPE
          Deprecated.  
protected  int timeout
          Deprecated.  
protected  int version
          Deprecated.  
 
Constructor Summary
MDS()
          Deprecated. initilaizes a connetion to the MDS database with its default values
MDS(GlobusURL spec)
          Deprecated. initilaizes a connetion to the MDS database using the specified LDAP URL
MDS(String hostname, String port)
          Deprecated. initilaizes a connetion to the MDS database to the speified host and port
MDS(String hostname, String port, String baseDN)
          Deprecated. initilaizes a connetion to the MDS database to the speified host and port
 
Method Summary
 void addAttribute(String dn, MDSResult at)
          Deprecated. adds attributes to an entry.
 void addEntry(String dn, MDSResult at)
          Deprecated. adds attributes specified in a Attributes to an Object.
 void addPropertyChangeListener(PropertyChangeListener l)
          Deprecated.  
 void connect()
          Deprecated. connects to the specified server
 void connect(String managerDN, String password)
          Deprecated. connects and authenticates to the specified server
protected  SearchControls createConstraints(int scope, String[] attrToReturn)
          Deprecated.  
 void deleteAttribute(String dn, String attr)
          Deprecated. deletes a specific attribute of an entry.
 void deleteEntry(String dn)
          Deprecated. deletes a specific object specified by the dn.
 void deleteTree(String dn, boolean deleteItSelf)
          Deprecated. deletes a subtree starting from dn
 void deleteValues(String dn, MDSResult at)
          Deprecated. deletes attributes of an entry.
 void disconnect()
          Deprecated. disconnects from the MDS server
 MDSResult getAttributes(String dn)
          Deprecated. This methods returns that attributes of the specified distinguished name.
 MDSResult getAttributes(String dn, String[] attributes)
          Deprecated. This methods returns that attributes of the specified distinguished name.
 String getBaseDN()
          Deprecated. returns the baseDN currently used
 String getHostname()
          Deprecated. gets the hostname
 int getLdapVersion()
          Deprecated. gets ldap protocol version
 String getPort()
          Deprecated. gets the port
 int getSearchLimit()
          Deprecated. gets search limit
 int getSearchTimeout()
          Deprecated. returns search timeout
 String getURL()
          Deprecated. gets the URL
 Hashtable list(String baseDN)
          Deprecated. Lists the objects bound to the argument.
 void reconnect()
          Deprecated. reconnects to the server.
 void removePropertyChangeListener(PropertyChangeListener l)
          Deprecated.  
 void renameEntry(String oldDN, String newDN)
          Deprecated. renames an object in an LDAP database.
 void renameEntry(String oldDN, String newDN, boolean deleteOldDN)
          Deprecated. renames an object in an LDAP database.
 Hashtable search(String filter, int searchScope)
          Deprecated. issues a specified search to the MDS.
 Hashtable search(String filter, String[] attrToReturn, int searchScope)
          Deprecated. issues a specified search to the MDS starting from the base DN.
 Hashtable search(String baseDN, String filter, int searchScope)
          Deprecated. issues a specified search to the MDS starting from the base DN.
 Hashtable search(String baseDN, String filter, String[] attrToReturn, int searchScope)
          Deprecated. issues a specified search to the MDS starting from the base DN.
 NamingEnumeration searchl(String baseDN, String filter, String[] attrToReturn, int searchScope)
          Deprecated. Issues a search starting from the basDN.
 void setBaseDN(String baseDN)
          Deprecated. sets the baseDN to the specified value
 void setHostname(String hostname)
          Deprecated. sets the hostname to the specified value
 void setLdapVersion(int newVersion)
          Deprecated. sets ldap protocol version
 void setPort(String port)
          Deprecated. Sets the port to the specified value
 void setSearchLimit(int newLimit)
          Deprecated. sets search limit - number of returned entries
 void setSearchTimeout(int newTimeout)
          Deprecated. sets search timeout
 void updateAttribute(String dn, MDSResult at)
          Deprecated. updates attributes of an entry.
 void updateEntry(String dn, MDSResult at)
          Deprecated. updates specifed dn with attributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

limit

protected int limit
Deprecated. 

timeout

protected int timeout
Deprecated. 

version

protected int version
Deprecated. 

SUBTREE_SCOPE

public static final int SUBTREE_SCOPE
Deprecated. 
See Also:
Constant Field Values

ONELEVEL_SCOPE

public static final int ONELEVEL_SCOPE
Deprecated. 
See Also:
Constant Field Values

OBJECT_SCOPE

public static final int OBJECT_SCOPE
Deprecated. 
See Also:
Constant Field Values

DEFAULT_CTX

protected static final String DEFAULT_CTX
Deprecated. 
See Also:
Constant Field Values

ctx

protected LdapContext ctx
Deprecated. 

env

protected Properties env
Deprecated. 
Constructor Detail

MDS

public MDS()
Deprecated. 
initilaizes a connetion to the MDS database with its default values


MDS

public MDS(String hostname,
           String port)
Deprecated. 
initilaizes a connetion to the MDS database to the speified host and port

Parameters:
hostname - specifies the hostname to which to connect
port - is the port on which the conection is established

MDS

public MDS(String hostname,
           String port,
           String baseDN)
Deprecated. 
initilaizes a connetion to the MDS database to the speified host and port

Parameters:
hostname - specifies the hostname to which to connect
port - is the port on which the conection is established
baseDN - is the base DN from which searches are rooted

MDS

public MDS(GlobusURL spec)
Deprecated. 
initilaizes a connetion to the MDS database using the specified LDAP URL

Parameters:
spec - the LDAP URL spec from which connection information is derived
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)
Deprecated. 

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)
Deprecated. 

setBaseDN

public void setBaseDN(String baseDN)
Deprecated. 
sets the baseDN to the specified value

Parameters:
baseDN -

getBaseDN

public String getBaseDN()
Deprecated. 
returns the baseDN currently used

Returns:
DN the baseDN

setPort

public void setPort(String port)
Deprecated. 
Sets the port to the specified value

Parameters:
port -

getPort

public String getPort()
Deprecated. 
gets the port

Returns:
port the port

setHostname

public void setHostname(String hostname)
Deprecated. 
sets the hostname to the specified value

Parameters:
hostname -

getHostname

public String getHostname()
Deprecated. 
gets the hostname

Returns:
hostname gets the hostname

getURL

public String getURL()
Deprecated. 
gets the URL

Returns:
the url string

setSearchTimeout

public void setSearchTimeout(int newTimeout)
Deprecated. 
sets search timeout

Parameters:
newTimeout -

getSearchTimeout

public int getSearchTimeout()
Deprecated. 
returns search timeout

Returns:
int timeout

setSearchLimit

public void setSearchLimit(int newLimit)
Deprecated. 
sets search limit - number of returned entries

Parameters:
newLimit -

getSearchLimit

public int getSearchLimit()
Deprecated. 
gets search limit

Returns:
int search limit

setLdapVersion

public void setLdapVersion(int newVersion)
Deprecated. 
sets ldap protocol version

Parameters:
newVersion -

getLdapVersion

public int getLdapVersion()
Deprecated. 
gets ldap protocol version

Returns:
ldap version 2 or 3

connect

public void connect()
             throws MDSException
Deprecated. 
connects to the specified server

Throws:
an - MDSexception if unable to connect
MDSException

connect

public void connect(String managerDN,
                    String password)
             throws MDSException
Deprecated. 
connects and authenticates to the specified server

Parameters:
managerDN - specifies the distingushed name of the directory manager or user
password - specifies the password of the directory manager or user
Throws:
an - MDSexception if unable to connect
MDSException

disconnect

public void disconnect()
                throws MDSException
Deprecated. 
disconnects from the MDS server

Throws:
an - MDSexception if failed to disconnect
MDSException

reconnect

public void reconnect()
               throws MDSException
Deprecated. 
reconnects to the server.

Throws:
an - MDSexception if unable to reconnect
MDSException

search

public Hashtable search(String filter,
                        int searchScope)
                 throws MDSException
Deprecated. 
issues a specified search to the MDS. The search returns all attributes.

Parameters:
filter - a common LDAP filter
searchScope - sets the scope of the search
Returns:
the result is returned in a hashtable of MDSResult
Throws:
an - MDSexception if something goes bad
MDSException

search

public Hashtable search(String filter,
                        String[] attrToReturn,
                        int searchScope)
                 throws MDSException
Deprecated. 
issues a specified search to the MDS starting from the base DN.

Parameters:
filter - a common LDAP filter
attrToReturn -
searchScope - sets the scope of the search
Returns:
the result is returned in a hashtable of MDSResult
Throws:
an - MDSexception if something goes bad
MDSException

search

public Hashtable search(String baseDN,
                        String filter,
                        int searchScope)
                 throws MDSException
Deprecated. 
issues a specified search to the MDS starting from the base DN. The search returns all attributes.

Parameters:
baseDN -
filter - a common LDAP filter
searchScope - sets the scope of the search
Returns:
the result is returned in a hashtable of MDSResult
Throws:
an - MDSexception if something goes bad
MDSException

search

public Hashtable search(String baseDN,
                        String filter,
                        String[] attrToReturn,
                        int searchScope)
                 throws MDSException
Deprecated. 
issues a specified search to the MDS starting from the base DN.

Parameters:
baseDN - the base DN from which the
filter - a common LDAP filter
attrToReturn - an array of attributes to be returned
searchScope - sets the scope of the search
Returns:
the result is returned in a hashtable of MDSResult
Throws:
an - MDSexception if something goes bad
MDSException

searchl

public NamingEnumeration searchl(String baseDN,
                                 String filter,
                                 String[] attrToReturn,
                                 int searchScope)
                          throws NamingException
Deprecated. 
Issues a search starting from the basDN.

Parameters:
baseDN - the base dn from which the search is started
filter - the filter for the search
attrToReturn - an array of attributes to return
searchScope - The search scope
Returns:
returns the result as NamingEnumeration
Throws:
NamingException - when an LDAP error occurs.

list

public Hashtable list(String baseDN)
               throws MDSException
Deprecated. 
Lists the objects bound to the argument.

Parameters:
baseDN -
Returns:
the result is returned in a hashtable of MDSResult
Throws:
an - MDSexception if something goes bad
MDSException

getAttributes

public MDSResult getAttributes(String dn)
                        throws MDSException
Deprecated. 
This methods returns that attributes of the specified distinguished name.

Parameters:
dn -
Returns:
Attributes the set of values that constitute the distinguished name
Throws:
an - MDSexception if something goes bad
MDSException

getAttributes

public MDSResult getAttributes(String dn,
                               String[] attributes)
                        throws MDSException
Deprecated. 
This methods returns that attributes of the specified distinguished name.

Parameters:
dn -
attributes -
Returns:
Attributes the set a values that constitute the distinguished name
Throws:
an - MDSexception if something goes bad
MDSException

createConstraints

protected SearchControls createConstraints(int scope,
                                           String[] attrToReturn)
Deprecated. 

deleteEntry

public void deleteEntry(String dn)
                 throws MDSException
Deprecated. 
deletes a specific object specified by the dn.

Parameters:
dn - the distinguished name of the object to be deleted.
Throws:
an - MDSexception if something goes bad
MDSException

renameEntry

public void renameEntry(String oldDN,
                        String newDN)
                 throws MDSException
Deprecated. 
renames an object in an LDAP database.

Parameters:
oldDN -
newDN -
Throws:
an - MDSexception if something goes bad
MDSException

renameEntry

public void renameEntry(String oldDN,
                        String newDN,
                        boolean deleteOldDN)
                 throws MDSException
Deprecated. 
renames an object in an LDAP database. the attribute occurs multiple times only the first one will be deleted.

Parameters:
oldDN -
newDN -
deleteOldDN - deletes old dn from the entry
Throws:
MDSException

updateEntry

public void updateEntry(String dn,
                        MDSResult at)
                 throws MDSException
Deprecated. 
updates specifed dn with attributes

Parameters:
dn - the distinguished name of the object.
at -
Throws:
an - MDSexception if something goes bad
MDSException

addEntry

public void addEntry(String dn,
                     MDSResult at)
              throws MDSException
Deprecated. 
adds attributes specified in a Attributes to an Object.

Parameters:
dn - the distinguished name of the object.
at -
Throws:
an - MDSexception if something goes bad
MDSException

deleteAttribute

public void deleteAttribute(String dn,
                            String attr)
                     throws MDSException
Deprecated. 
deletes a specific attribute of an entry. It removes the whole attribute with all its values.

Parameters:
dn - the distinguished name of the entry
attr - the attribute name of the attribute to be deleted.
Throws:
an - MDSexception if something goes bad
MDSException

deleteValues

public void deleteValues(String dn,
                         MDSResult at)
                  throws MDSException
Deprecated. 
deletes attributes of an entry.

Parameters:
dn - the distinguished name of the entry.
at - a set of attributes to delete
Throws:
an - MDSexception if something goes bad
MDSException

updateAttribute

public void updateAttribute(String dn,
                            MDSResult at)
                     throws MDSException
Deprecated. 
updates attributes of an entry.

Parameters:
dn - the distinguished name of the entry.
at - a set of attributes to replace or add
Throws:
an - MDSexception if something goes bad
MDSException

addAttribute

public void addAttribute(String dn,
                         MDSResult at)
                  throws MDSException
Deprecated. 
adds attributes to an entry.

Parameters:
dn - the distinguished name of the object.
at -
Throws:
an - MDSexception if something goes bad
MDSException

deleteTree

public void deleteTree(String dn,
                       boolean deleteItSelf)
                throws MDSException
Deprecated. 
deletes a subtree starting from dn

Parameters:
dn - the distinguished name of the object.
deleteItSelf - if set to true, it also deletes the dn
Throws:
an - MDSexception if something goes bad
MDSException