|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
org.globus.mds
Class MDS
java.lang.Object | +--org.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
- extends Object
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: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.
- establishing a conection to an MDS Server,
- quering for contents in the MDS,
- printing the result of a query, and
- disconecting from the MDS Server.
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=USA search is invoked in the following way:NamingEnumeration result;The search result is stored in a NamingEnumeration as provided by JNDI.
result = mds.search("o=Globus, c=US", "(objectclass=*)", MDS.ONELEVEL_SCOPE);
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.
ONELEVEL_SCOPE
public static final int ONELEVEL_SCOPE
- Deprecated.
OBJECT_SCOPE
public static final int OBJECT_SCOPE
- Deprecated.
DEFAULT_CTX
protected static final String DEFAULT_CTX
- Deprecated.
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 connectport- is the port on which the conection is established
- initilaizes a connetion to the MDS database to the speified host and port
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 connectport- is the port on which the conection is establishedbaseDN- is the base DN from which searches are rooted
- initilaizes a connetion to the MDS database to the speified host and port
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
- initilaizes a connetion to the MDS database using the specified LDAP URL
| 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-
- sets the baseDN to the specified value
getBaseDN
public String getBaseDN()
- Deprecated.
- returns the baseDN currently used
- Returns:
- DN the baseDN
- returns the baseDN currently used
setPort
public void setPort(String port)
- Deprecated.
- Sets the port to the specified value
- Parameters:
port-
- Sets the port to the specified value
getPort
public String getPort()
- Deprecated.
- gets the port
- Returns:
- port the port
- gets the port
setHostname
public void setHostname(String hostname)
- Deprecated.
- sets the hostname to the specified value
- Parameters:
hostname-
- sets the hostname to the specified value
getHostname
public String getHostname()
- Deprecated.
- gets the hostname
- Returns:
- hostname gets the hostname
- gets the hostname
getURL
public String getURL()
- Deprecated.
- gets the URL
- Returns:
- the url string
- gets the URL
setSearchTimeout
public void setSearchTimeout(int newTimeout)
- Deprecated.
- sets search timeout
- Parameters:
newTimeout-
- sets search timeout
getSearchTimeout
public int getSearchTimeout()
- Deprecated.
- returns search timeout
- Returns:
- int timeout
- returns search timeout
setSearchLimit
public void setSearchLimit(int newLimit)
- Deprecated.
- sets search limit - number of returned entries
- Parameters:
newLimit-
- sets search limit - number of returned entries
getSearchLimit
public int getSearchLimit()
- Deprecated.
- gets search limit
- Returns:
- int search limit
- gets search limit
setLdapVersion
public void setLdapVersion(int newVersion)
- Deprecated.
- sets ldap protocol version
- Parameters:
newVersion-
- sets ldap protocol version
getLdapVersion
public int getLdapVersion()
- Deprecated.
- gets ldap protocol version
- Returns:
- ldap version 2 or 3
- gets ldap protocol version
connect
public void connect()
throws MDSException
- Deprecated.
- connects to the specified server
- Throws:
an- MDSexception if unable to connectMDSException-
- connects to the specified server
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 userpassword- specifies the password of the directory manager or user- Throws:
an- MDSexception if unable to connectMDSException-
- connects and authenticates to the specified server
disconnect
public void disconnect()
throws MDSException
- Deprecated.
- disconnects from the MDS server
- Throws:
an- MDSexception if failed to disconnect
- disconnects from the MDS server
reconnect
public void reconnect()
throws MDSException
- Deprecated.
- reconnects to the server.
- Throws:
an- MDSexception if unable to reconnect
- reconnects to the server.
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 filtersearchScope- sets the scope of the search- Returns:
- the result is returned in a hashtable of MDSResult
- Throws:
an- MDSexception if something goes bad
- issues a specified search to the MDS. The search returns all attributes.
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 filterattrToReturn-searchScope- sets the scope of the search- Returns:
- the result is returned in a hashtable of MDSResult
- Throws:
an- MDSexception if something goes bad
- issues a specified search to the MDS starting from the base DN.
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 filtersearchScope- sets the scope of the search- Returns:
- the result is returned in a hashtable of MDSResult
- Throws:
an- MDSexception if something goes bad
- issues a specified search to the MDS starting from the base DN. The search returns all attributes.
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 thefilter- a common LDAP filterattrToReturn- an array of attributes to be returnedsearchScope- sets the scope of the search- Returns:
- the result is returned in a hashtable of MDSResult
- Throws:
an- MDSexception if something goes badMDSException-
- issues a specified search to the MDS starting from the base DN.
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 startedfilter- the filter for the searchattrToReturn- an array of attributes to returnsearchScope- The search scope- Returns:
- returns the result as NamingEnumeration
- Throws:
NamingException- when an LDAP error occurs.
- Issues a search starting from the basDN.
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
- Lists the objects bound to the argument.
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
- This methods returns that attributes of the specified distinguished name.
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
- This methods returns that attributes of the specified distinguished name.
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
- deletes a specific object specified by the dn.
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
- renames an object in an LDAP database.
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
- renames an object in an LDAP database. the attribute occurs multiple times only the first one will be deleted.
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
- updates specifed dn with attributes
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
- adds attributes specified in a Attributes to an Object.
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 entryattr- the attribute name of the attribute to be deleted.- Throws:
an- MDSexception if something goes bad
- deletes a specific attribute of an entry. It removes the whole attribute with all its values.
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
- deletes attributes of an entry.
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
- updates attributes of an entry.
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
- adds attributes to an entry.
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
- deletes a subtree starting from dn
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||