org.isam.exehda.services.cib
Class Ldap

java.lang.Object
  |
  +--org.isam.exehda.services.cib.Ldap

public class Ldap
extends java.lang.Object

Author:
frainer

Field Summary
(package private)  javax.naming.directory.DirContext dir
           
(package private)  java.lang.String password
           
(package private)  java.lang.String serverAddress
           
(package private)  java.lang.String user
           
 
Constructor Summary
Ldap(java.lang.String serverAddress, java.lang.String user, java.lang.String password)
          Creates a new instance of Ldap
 
Method Summary
 void connect()
          sets up the connection to the ldap server, using the server address, user and password defined in the constructor
 void createCell()
           
 void createIfNotExists(java.lang.String node)
          creates a new resource in the ldap server, if it doesn't exist already
 void disconnect()
          disconnects from the ldap server.
 java.util.List findByName(java.lang.String name, java.lang.String nameSpace)
          finds the resources in the ldap server that have a given name and that are inside a given namespace
 java.util.List findByNameIsam(java.lang.String name, java.lang.String nameSpace)
          finds the resources in the ldap server that have a given name and that are inside a given namespace.
 java.util.List findBySearchString(java.lang.String searchString)
          finds resources in the ldap server using the given ldap search string
 java.util.List findBySearchStringAndReturnAllAttributes(java.lang.String searchString)
          finds resources in the ldap server using the given ldap search string
 java.util.List findBySearchStringAndReturnAllAttributes(java.lang.String searchString, java.lang.String where)
          finds resources in the ldap server using the given ldap search string
 java.util.List findByType(java.lang.String type, java.lang.String nameSpace)
          finds the resources in the ldap server that have a given type and that are inside a given namespace
 java.util.List findByTypeIsam(java.lang.String type, java.lang.String nameSpace)
          finds the resources in the ldap server that have a given type and that are inside a given namespace.
 java.lang.String getAttribute(java.lang.String node, java.lang.String attr)
          retrieves from the ldap server the value of a given attribute in a given resource
 java.lang.String getAttributeIsam(java.lang.String node, java.lang.String attr)
          retrieves from the ldap server the value of a given attribute in a given resource, takes into account isamType
 java.lang.String[] getAttributes(java.lang.String node)
          retrieves from the lda server all the names of all the attributes of a given resource
 java.lang.String[] getAttributesIsam(java.lang.String node)
          retrieves from the ldap server all the names of all the attributes of a given resource.
 java.lang.Object getObject(java.lang.String node)
          retrieves from the ldap server the object in the given node
 void remove(java.lang.String node)
          removes a given resource from the ldap server
 void setAttribute(java.lang.String node, java.lang.String attr, java.lang.String value)
          sets the value a given attribute in a given resorce in tha ldap server
 void setObject(java.lang.String node, java.lang.Object o)
          Saves an object in the given ldap resource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serverAddress

java.lang.String serverAddress

user

java.lang.String user

password

java.lang.String password

dir

javax.naming.directory.DirContext dir
Constructor Detail

Ldap

public Ldap(java.lang.String serverAddress,
            java.lang.String user,
            java.lang.String password)
Creates a new instance of Ldap

Method Detail

connect

public void connect()
sets up the connection to the ldap server, using the server address, user and password defined in the constructor

Returns:
void

createCell

public void createCell()

createIfNotExists

public void createIfNotExists(java.lang.String node)
creates a new resource in the ldap server, if it doesn't exist already

Parameters:
node - the string indicating the name and where (in ldap format) the resource is to be created
Returns:
void

getObject

public java.lang.Object getObject(java.lang.String node)
retrieves from the ldap server the object in the given node

Parameters:
node - the name and place (in ldap format) of the resource that contains the object
Returns:
the current object in the given resource

setObject

public void setObject(java.lang.String node,
                      java.lang.Object o)
Saves an object in the given ldap resource

Parameters:
node - the name and place (in ldap format) of the resource that is to contain the object
o - the object to be saved
Returns:
void

getAttribute

public java.lang.String getAttribute(java.lang.String node,
                                     java.lang.String attr)
retrieves from the ldap server the value of a given attribute in a given resource

Parameters:
node - the name and place (in ldap format) of the resource that contains the attribute attr the name of the attribute
Returns:
the current value of the given attribute in the given resource

getAttributeIsam

public java.lang.String getAttributeIsam(java.lang.String node,
                                         java.lang.String attr)
retrieves from the ldap server the value of a given attribute in a given resource, takes into account isamType

Parameters:
node - the name and place (in ldap format) of the resource that contains the attribute attr the name of the attribute
Returns:
the current value of the given attribute in the given resource

getAttributes

public java.lang.String[] getAttributes(java.lang.String node)
retrieves from the lda server all the names of all the attributes of a given resource

Parameters:
node - the name and place (in ldap format) of the resource
Returns:
an array of String with the names of the attributes in the given resource

getAttributesIsam

public java.lang.String[] getAttributesIsam(java.lang.String node)
retrieves from the ldap server all the names of all the attributes of a given resource. Takes into account resources with type isamType

Parameters:
node - the name and place (in ldap format) of the resource
Returns:
an array of String with the names of the attributes in the given resource

remove

public void remove(java.lang.String node)
removes a given resource from the ldap server

Parameters:
node - the name and place (in ldap format) of the resource that is to be removed
Returns:
void

setAttribute

public void setAttribute(java.lang.String node,
                         java.lang.String attr,
                         java.lang.String value)
sets the value a given attribute in a given resorce in tha ldap server

Parameters:
node - the name and place (in ldap format) of the resource that contains the attribute attr the name of the attribute value the value that the attribute is to be set to
Returns:
void

findByName

public java.util.List findByName(java.lang.String name,
                                 java.lang.String nameSpace)
finds the resources in the ldap server that have a given name and that are inside a given namespace

Parameters:
name - the name that the returned resources must have nameSpace the name space inside of which the returned resources must reside. (in ldap format)
Returns:
a list of resources that have the given name and are inside the given name space

findByNameIsam

public java.util.List findByNameIsam(java.lang.String name,
                                     java.lang.String nameSpace)
finds the resources in the ldap server that have a given name and that are inside a given namespace. Takes into account the possibility of resources with type isamType

Parameters:
name - the name that the returned resources must have nameSpace the name space inside of which the returned resources must reside. (in ldap format)
Returns:
a list of resources that have the given name and are inside the given name space

findByType

public java.util.List findByType(java.lang.String type,
                                 java.lang.String nameSpace)
finds the resources in the ldap server that have a given type and that are inside a given namespace

Parameters:
type - the type that the returned resources must have nameSpace the name space inside of which the returned resources must reside. (in ldap format)
Returns:
a list of resources that have the given type and are inside the given name space

findByTypeIsam

public java.util.List findByTypeIsam(java.lang.String type,
                                     java.lang.String nameSpace)
finds the resources in the ldap server that have a given type and that are inside a given namespace. Takes into account the possibility of resources with type isamType

Parameters:
type - the type that the returned resources must have nameSpace the name space inside of which the returned resources must reside. (in ldap format)
Returns:
a list of resources that have the given type and are inside the given name space

findBySearchString

public java.util.List findBySearchString(java.lang.String searchString)
finds resources in the ldap server using the given ldap search string

Parameters:
searchString - a ldap search string
Returns:
a list of resources that were found using the given ldap search string

findBySearchStringAndReturnAllAttributes

public java.util.List findBySearchStringAndReturnAllAttributes(java.lang.String searchString)
finds resources in the ldap server using the given ldap search string

Parameters:
searchString - a ldap search string
Returns:
a list of all the attributes of the resources that were found using the given ldap search string

findBySearchStringAndReturnAllAttributes

public java.util.List findBySearchStringAndReturnAllAttributes(java.lang.String searchString,
                                                               java.lang.String where)
finds resources in the ldap server using the given ldap search string

Parameters:
searchString - a ldap search string where the context under which the search is to be performed
Returns:
a list of all the attributes of the resources that were found using the given ldap search string

disconnect

public void disconnect()
disconnects from the ldap server. A new connect will be necessary before acessing the server again.

Returns:
void