com.netscape.pm.model
Interface ICorporateDirectory


public interface ICorporateDirectory

Defines an object that will provide a connection to the corporate directory defined for the cluster. This interface serves as a thin-layer between the actual LDAP connection and the Process Manager world, where all corporate directory user entries are encapsulated as IParticipant objects.

There is only one corporate directory defined for the cluster; a handle to the object can be obtained via the getCorporateDirectory method off the IPMCluster interface.

See Also:
IParticipant, IPMCluster

Method Summary
 void addUser(java.lang.String dn, java.util.Hashtable attributes, java.util.Vector objectClasses)
          Adds a user entry with the DN (distinguished name) dn, attributes specified in attributes and compliant with the object classes listed in objectClasses into the corporate directory.
 boolean authenticate(java.lang.String userName, java.lang.String password)
          Returns true if the authentication with the corporate directory is successful.
 void deleteUserByCN(java.lang.String cn)
          Deletes the user entry specified by the CN (common name) cn from the corporate directory.
 void deleteUserByDN(java.lang.String dn)
          Deletes the user entry specified by the DN (distinguished name) dn from the corporate directory.
 void deleteUserById(java.lang.String uid)
          Deletes the user entry specified by the user id uid from the corporate directory.
 IParticipant getUserByCN(java.lang.String cn)
          Returns the user entry corresponding to the CN (common name) cn.
 IParticipant getUserByDN(java.lang.String dn)
          Returns the user entry corresponding to the DN (distinguished name) dn.
 IParticipant getUserById(java.lang.String uid)
          Returns the user entry corresponding to the user id uid.
 boolean isAvailable()
          Returns true if the connection to the corporate directory is available.
 java.lang.String[] listMembers(java.lang.String groupDN)
          Returns the members of any group defined in the corporate directory.
 java.lang.String[] listMembersByQuery(java.lang.String filter)
          Returns the results of an LDAP user query against the corporate directory.
 void modifyUserByCN(java.lang.String cn, java.lang.String attrName, java.lang.String attrValue, java.lang.String operation)
          Modifies the user entry specified by the CN (common name) cn in the corporate directory.
 void modifyUserByDN(java.lang.String dn, java.lang.String attrName, java.lang.String attrValue, java.lang.String operation)
          Modifies the user entry specified by the DN (distinguished name) dn in the corporate directory.
 void modifyUserById(java.lang.String uid, java.lang.String attrName, java.lang.String attrValue, java.lang.String operation)
          Modifies the user entry specified by the user id uid in the corporate directory.
 java.util.Hashtable search(java.lang.String filter, java.lang.String indexedBy)
          Perform a generic search for users in the corporate directory based upon the specified LDAP filter.
 

Method Detail

getUserByDN

public IParticipant getUserByDN(java.lang.String dn)
                         throws PMException
Returns the user entry corresponding to the DN (distinguished name) dn.
Parameters:
dn - the DN of the user entry to fetch
Returns:
an IParticipant object with the user's corporate directory attributes.
Throws:
PMException - if there is a problem retrieving the user's entry from the corporate directory.
Since:
NPM 1.0
See Also:
IParticipant

getUserById

public IParticipant getUserById(java.lang.String uid)
                         throws PMException
Returns the user entry corresponding to the user id uid.
Parameters:
uid - the user id of the user entry to fetch
Returns:
an IParticipant object with the user's corporate directory attributes.
Throws:
PMException - if there is a problem retrieving the user's entry from the corporate directory.
Since:
NPM 1.0
See Also:
IParticipant

getUserByCN

public IParticipant getUserByCN(java.lang.String cn)
                         throws PMException
Returns the user entry corresponding to the CN (common name) cn.
Parameters:
cn - the CN of the user entry to fetch
Returns:
an IParticipant object with the user's corporate directory attributes.
Throws:
PMException - if there is a problem retrieving the user's entry from the corporate directory.
Since:
NPM 1.0
See Also:
IParticipant

deleteUserByDN

public void deleteUserByDN(java.lang.String dn)
                    throws PMException
Deletes the user entry specified by the DN (distinguished name) dn from the corporate directory. In order for the entry to be deleted successfully, the cluster's authentication to the corporate directory must possess the necessary permissions.
Parameters:
dn - the DN of the user entry to delete
Throws:
PMException - if there is a problem deleting the user's entry from the corporate directory.
Since:
NPM 1.0

deleteUserById

public void deleteUserById(java.lang.String uid)
                    throws PMException
Deletes the user entry specified by the user id uid from the corporate directory. In order for the entry to be deleted successfully, the cluster's authentication to the corporate directory must possess the necessary permissions.
Parameters:
uid - the user id of the user entry to delete
Throws:
PMException - if there is a problem deleting the user's entry from the corporate directory.
Since:
NPM 1.0

deleteUserByCN

public void deleteUserByCN(java.lang.String cn)
                    throws PMException
Deletes the user entry specified by the CN (common name) cn from the corporate directory. In order for the entry to be deleted successfully, the cluster's authentication to the corporate directory must possess the necessary permissions.
Parameters:
cn - the CN of the user entry to delete
Throws:
PMException - if there is a problem deleting the user's entry from the corporate directory.
Since:
NPM 1.0

modifyUserByDN

public void modifyUserByDN(java.lang.String dn,
                           java.lang.String attrName,
                           java.lang.String attrValue,
                           java.lang.String operation)
                    throws PMException
Modifies the user entry specified by the DN (distinguished name) dn in the corporate directory. In order for the entry to be modified successfully, the cluster's authentication to the corporate directory must possess the necessary permissions.

The type of modification is specified by the operation, which can have the following values:

ADD
adds the attribute attrName with value attrValue to the user entry. Note that if the attribute attrName is multivalued, this operation could result in multiple attributes with name attrName being present in the user entry. The attribute attrName should be a valid attribute of one of the objectclasses the user entry is compliant with.
REPLACE
replaces the value currently associated with attribute attrName with the new value attrValue.
DELETE
deletes the attribute attrName from the user entry.
Parameters:
dn - the DN of the user entry to modify
attrName - the attribute name to modify
attrValue - the value to apply to the attribute
operation - the modification operation to perform to the entry
Throws:
PMException - if there is a problem modifying the user's entry in the corporate directory.
Since:
NPM 1.0

modifyUserById

public void modifyUserById(java.lang.String uid,
                           java.lang.String attrName,
                           java.lang.String attrValue,
                           java.lang.String operation)
                    throws PMException
Modifies the user entry specified by the user id uid in the corporate directory. In order for the entry to be modified successfully, the cluster's authentication to the corporate directory must possess the necessary permissions.

For the type of modifications supported, see the comments for the method modifyUserByDN.

Parameters:
uid - the user id of the user entry to modify
attrName - the attribute name to modify
attrValue - the value to apply to the attribute
operation - the modification operation to perform to the entry
Throws:
PMException - if there is a problem modifying the user's entry in the corporate directory.
Since:
NPM 1.0

modifyUserByCN

public void modifyUserByCN(java.lang.String cn,
                           java.lang.String attrName,
                           java.lang.String attrValue,
                           java.lang.String operation)
                    throws PMException
Modifies the user entry specified by the CN (common name) cn in the corporate directory. In order for the entry to be modified successfully, the cluster's authentication to the corporate directory must possess the necessary permissions.

For the type of modifications supported, see the comments for the method modifyUserByDN.

Parameters:
cn - the CN of the user entry to modify
attrName - the attribute name to modify
attrValue - the value to apply to the attribute
operation - the modification operation to perform to the entry
Throws:
PMException - if there is a problem modifying the user's entry in the corporate directory.
Since:
NPM 1.0

addUser

public void addUser(java.lang.String dn,
                    java.util.Hashtable attributes,
                    java.util.Vector objectClasses)
             throws PMException
Adds a user entry with the DN (distinguished name) dn, attributes specified in attributes and compliant with the object classes listed in objectClasses into the corporate directory.

The attributes are expected to be specified as a java.util.Hashtable indexed by the attribute name. For the addition operation to be successful, it is important that all the necessary attributes required by the listed object classes are provided.

The object classes parameter objectClasses specifies any additional objectclasses over and above the standard Netscape user objectclasses the user entry will be compliant with. The default object classes assumed for all user entries are:

  • top
  • person
  • organizationalPerson
  • inetOrgPerson

If the objectClasses parameter is omitted, the default objectclasses are presumed. If your user entry is expected to be compliant with additional object classes, they should be specified in objectClasses.

 
 try
 {
     ICorporateDirectory cd = cluster.getCorporateDirectory();

     // Build up the attributes for the user 
     // 
     Hashtable attrs = new Hashtable();
     attrs.put( "uid", "joe" );
     attrs.put( "cn", "Joe Cool" );
     attrs.put( "sn", "Cool" );
     attrs.put( "mail", "joe@acme.com" );
     attrs.put( "favoriteColor", "green" );

     // Specify additional objectclasses
     // 
     Vector OCs = new Vector();
     OCs.addElement( "favoriteColorOC" );

     cd.addUser( "uid=joe, ou=People, o=acme.com", attrs, OCs );
 }
 catch( Exception e )
 {
     System.out.println( "Problems adding user entry joe" );
 }
 
Parameters:
dn - the DN of the user entry to add
attributes - a set of key/values pairs specifying the user's attributes
objectClasses - a list of objectclasses the user entry will be compliant with
Throws:
PMException - if there is a problem adding the user's entry in the corporate directory.
Since:
NPM 1.0

listMembers

public java.lang.String[] listMembers(java.lang.String groupDN)
                               throws PMException
Returns the members of any group defined in the corporate directory. The members are returned as DNs (distinguished names). This method is used internally by the Process Manager engine to resolve corporate groups (that is, application groups that derive their members from existing corporate groups).
Parameters:
groupDN - the DN of a corporate directory group
Returns:
a java.lang.String array of user DNs that belong to the group.
Throws:
PMException - if there is a problem connecting to the corporate directory.
Since:
PAE 4.0
See Also:
IRole.members()

listMembersByQuery

public java.lang.String[] listMembersByQuery(java.lang.String filter)
                                      throws PMException
Returns the results of an LDAP user query against the corporate directory. The members are returned as DNs (distinguished names). This method is used internally by the Process Manager engine to resolve filtered groups (that is, groups that derive their membership from a dynamic ldap query).
Parameters:
filter - an LDAP filter
Returns:
a java.lang.String array of user DNs returned by the query.
Throws:
PMException - if there is a problem connecting to the corporate directory.
Since:
PAE 4.0
See Also:
IRole.members()

search

public java.util.Hashtable search(java.lang.String filter,
                                  java.lang.String indexedBy)
                           throws PMException
Perform a generic search for users in the corporate directory based upon the specified LDAP filter. The method returns a hashtable of IParticipant objects indexed by the specified attribute. If multiple users have the same indexedBy attribute, they are kept in a java.util.Vector of IParticipant objects.
Parameters:
filter - an LDAP filter
indexedBy - attribute to index returned hashtable by
Returns:
java.util.Hashtable of IParticipant objects.
Since:
PAE 4.0
See Also:
IParticipant

isAvailable

public boolean isAvailable()
Returns true if the connection to the corporate directory is available.
Returns:
true if the connection to the corporate directory is available; false otherwise.
Since:
PAE 4.0

authenticate

public boolean authenticate(java.lang.String userName,
                            java.lang.String password)
Returns true if the authentication with the corporate directory is successful.
Returns:
true if the authentication to the corporate directory is successful; false otherwise.
Since:
iPM 6.5