Java Globus API: Class GRCContext

org.globus.replica.catalog
Class GRCContext

java.lang.Object
  |
  +--org.globus.replica.catalog.GRCContext

public class GRCContext
extends Object

The replica catalog connection context, containing methods to set authentication modes and connect to a replica catalog.

Version:
1.3
Author:
Chi Chen, Darcy Quesnel

Inner Class Summary
static class GRCContext.Authentication
          Context authentication mode.
 
Constructor Summary
GRCContext(String url)
          Construct a context for a connection to the given directory service URL.
 
Method Summary
 void addAttributes(String rdn, Attributes attrs)
          Add attributes to the rdn entry.
 void close()
          Close the connection.
 void createObject(String name, Attributes attrs)
          Add an new object to the replica catalog.
 void deleteAttributes(String rdn, Attributes attrs)
          Delete attributes in the rdn entry
 void destroyObject(String name)
          Delete an object to the replica catalog.
 String getAuthenticationCredentials()
          Get the authenticating credentials.
 GRCContext.Authentication getAuthenticationMode()
          Get the authentication mode.
 String getAuthenticationPrincipal()
          Get the authenticating principal.
 String getURL()
          Get the name of the replica catalog.
 Attributes listAttributes(String rdn)
          List attributes of the rdn entry.
 Attributes listAttributes(String rdn, String[] attrs)
           
 void open()
          Open the connection
 void replaceAttributes(String rdn, Attributes attrs)
          Replace attributes in the rdn entry
 NamingEnumeration search(String name, Attributes attrs)
          Search for objects that contain a specified set of attributes in the context to which the GRCContext conforms
 NamingEnumeration search(String name, Attributes attrs, String[] attrsToReturn)
          Search for objects that contain a specified set of attributes in the context to which the GRCContext conforms
 NamingEnumeration search(String name, String filter, SearchControls cons)
           
 void setAuthentication(GRCContext.Authentication mode, String principal, String credentials)
          Set the authentication mode for a subsequent connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GRCContext

public GRCContext(String url)
Construct a context for a connection to the given directory service URL.
Parameters:
url - LDAP url of the form ldap://host:port/dn, where dn is the distinguished name of a collection in the replica catalog
Method Detail

setAuthentication

public void setAuthentication(GRCContext.Authentication mode,
                              String principal,
                              String credentials)
Set the authentication mode for a subsequent connection. As an example, when the authentication is set to the cleartext mode and the underlying implementation uses LDAP, then the principal is the manager's distinguished name and the credentials are the associated password.
Parameters:
mode - authentication mode to be set
principal - username, user or subject distinguished name depending on the authentication mode. May be null if none is need.
credentials - password or certificate depending on the authentication mode. May be null if none are needed.
See Also:
GRCContext.Authentication

getAuthenticationMode

public GRCContext.Authentication getAuthenticationMode()
Get the authentication mode.
Returns:
authentication mode
See Also:
setAuthentication(org.globus.replica.catalog.GRCContext.Authentication, java.lang.String, java.lang.String)

getAuthenticationPrincipal

public String getAuthenticationPrincipal()
Get the authenticating principal.
Returns:
authenticating principal
See Also:
setAuthentication(org.globus.replica.catalog.GRCContext.Authentication, java.lang.String, java.lang.String)

getAuthenticationCredentials

public String getAuthenticationCredentials()
Get the authenticating credentials.
Returns:
authenticating credentials

getURL

public String getURL()
Get the name of the replica catalog.
Returns:
a String representation of the URL of the replica catalog.

open

public void open()
          throws NamingException
Open the connection

close

public void close()
           throws NamingException
Close the connection.

createObject

public void createObject(String name,
                         Attributes attrs)
                  throws NamingException
Add an new object to the replica catalog. Creates and binds a new object, along with associated attributes to the replica catalog
Parameters:
name - name of the object to create
attrs - attributes associated with the object
See Also:
Attributes

destroyObject

public void destroyObject(String name)
                   throws NamingException
Delete an object to the replica catalog. Destroys an object in the replica catalog
Parameters:
name - name of the object to destroy

listAttributes

public Attributes listAttributes(String rdn)
                          throws NamingException
List attributes of the rdn entry. Retrieves selected attributes associated with a named object. See the class description regarding attribute models, attribute type names, and operational attributes.
Parameters:
rdn - name of the object from which to retrieve attributes
rdn - the name of the object from which to retrieve attributes
attrs - the identifiers of the attributes to retrieve. null indicates that all attributes should be retrieved; an empty array indicates that none should be retrieved

listAttributes

public Attributes listAttributes(String rdn,
                                 String[] attrs)
                          throws NamingException

addAttributes

public void addAttributes(String rdn,
                          Attributes attrs)
                   throws NamingException
Add attributes to the rdn entry.
Parameters:
rdn - the name of the object to which the attributes to be added.
attrs - the attributes to be added

replaceAttributes

public void replaceAttributes(String rdn,
                              Attributes attrs)
                       throws NamingException
Replace attributes in the rdn entry
Parameters:
rdn - the name of the object from which the attributes to be deleted.
attrs - the new attributes

deleteAttributes

public void deleteAttributes(String rdn,
                             Attributes attrs)
                      throws NamingException
Delete attributes in the rdn entry
Parameters:
rdn - the name of the object from which the attributes to be deleted.
attrs - the attributes to be deleted

search

public NamingEnumeration search(String name,
                                Attributes attrs)
                         throws NamingException
Search for objects that contain a specified set of attributes in the context to which the GRCContext conforms
Parameters:
name - the name of the object to search.
attrs - the attributes to search for.

search

public NamingEnumeration search(String name,
                                Attributes attrs,
                                String[] attrsToReturn)
                         throws NamingException
Search for objects that contain a specified set of attributes in the context to which the GRCContext conforms
Parameters:
name - the name of the object to search.
attrs - the attributes to search for.
attrsToReturn - the attributes to return.

search

public NamingEnumeration search(String name,
                                String filter,
                                SearchControls cons)
                         throws NamingException