org.isam.exehda.services.cib
Class LdapBackEnd

java.lang.Object
  |
  +--org.isam.exehda.services.cib.LdapBackEnd
All Implemented Interfaces:
CibBackEnd

public class LdapBackEnd
extends java.lang.Object
implements CibBackEnd

Ldab Install and Configuration Instructions:

  1. Install (depends on which OS is being used, in the case of Debian an apt-get install slapd will probably work).
  2. edit slapd.conf (/etc/ldap/slapd.conf, generally)
  3. Edit the file core.schema (/etc/ldap/schema/core.schema, generally), adding the following :
        attributetype ( 2.5.4.70 NAME 'dn'
        DESC 'DN'
        SUP name )
    
        attributetype ( 2.5.4.71 NAME 'fullDn'
        DESC 'DN full'
        SUP name )
    
        attributetype ( 2.5.4.72 NAME 'a'
        DESC 'for tests'
        SUP name )
    
        attributetype ( 2.5.4.75 NAME 'isamType'
        DESC 'for isam'
        SUP name )
    
        attributetype ( 2.5.4.79 NAME 'isamResource'
        DESC 'for isam'
        SUP name )
        

    After the following entry:

        attributetype ( 2.5.4.41 NAME 'name' 
        EQUALITY caseIgnoreMatch
        SUBSTR caseIgnoreSubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32768} )
        

    If the above entry does not exist, the new lines can be placed at the beginning of the file.

  4. Restart ldap (/etc/init.d/slapd restart, probably)
  5. execute org.isam.exehda.services.cib.CibInstaller
  6. Done


Field Summary
(package private)  java.util.Hashtable attributeBackConversion
           
(package private)  java.util.Hashtable attributeConversion
           
(package private)  java.lang.String cellName
           
(package private)  Ldap ldap
           
(package private)  java.util.Hashtable typeBackConversion
           
(package private)  java.util.Hashtable typeConversion
           
 
Constructor Summary
LdapBackEnd()
          Creates a new instance of LdapBackEnd
LdapBackEnd(java.lang.String password)
          Creates a new instance of LdapBackEnd
LdapBackEnd(java.lang.String password, java.lang.String cellName)
          Creates a new instance of LdapBackEnd
 
Method Summary
 void addResource(CellInformationBase.ResourceName r)
          adds a new resource to the cib, if it doesn't exist already.
 java.lang.String convertToLdap(CellInformationBase.NameSpace ns)
          converts a given NameSpace into a string representation that can be understood by a ldap server
 java.lang.String getAttribute(CellInformationBase.ResourceName r, java.lang.String a)
          Returns the value of the especified attribute in the especified resource
 java.lang.String[] getAttributes(CellInformationBase.ResourceName r)
          returns all the names of the attribues of a given resource
 void prepareMapping(java.util.Properties resourceProperties, java.util.Properties attributeProperties)
          prepares the conversion maps that are to be used when writing resources to Ldap and when reading resources from ldap.
 void removeResource(CellInformationBase.ResourceName r)
          removes a resource from the cib
 CellInformationBase.ResourceName[] select(CellInformationBase.SelectionConstraint sc, CellInformationBase.NameSpace[] ns, int maxResults)
           
 CellInformationBase.ResourceName[] select(CellInformationBase.SelectionConstraint filter, CellInformationBase.NameSpace ns, int maxResults)
          Searches the cib for resources that match a certain SelectionConstraint
 CellInformationBase.ResourceName[] select(CellInformationBase.SelectionConstraint filter, int maxResults)
          Searches the cib for resources that match a certain SelectionConstraint
 CellInformationBase.ResourceName[] selectByName(java.lang.String n, CellInformationBase.NameSpace ns, int maxResults)
          Searches the cib for resources that hava a certain name and that are inside a given namespace
 CellInformationBase.ResourceName[] selectByType(java.lang.String t, CellInformationBase.NameSpace ns, int maxResults)
          Searches the cib for resources that hava a certain type and that are inside a given namespace
 java.lang.String setAttribute(CellInformationBase.ResourceName r, java.lang.String a, java.lang.String v)
          Sets the value of a given attribute in a given resource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ldap

Ldap ldap

typeConversion

java.util.Hashtable typeConversion

typeBackConversion

java.util.Hashtable typeBackConversion

attributeConversion

java.util.Hashtable attributeConversion

attributeBackConversion

java.util.Hashtable attributeBackConversion

cellName

java.lang.String cellName
Constructor Detail

LdapBackEnd

public LdapBackEnd()
Creates a new instance of LdapBackEnd


LdapBackEnd

public LdapBackEnd(java.lang.String password)
Creates a new instance of LdapBackEnd


LdapBackEnd

public LdapBackEnd(java.lang.String password,
                   java.lang.String cellName)
Creates a new instance of LdapBackEnd

Method Detail

prepareMapping

public void prepareMapping(java.util.Properties resourceProperties,
                           java.util.Properties attributeProperties)
prepares the conversion maps that are to be used when writing resources to Ldap and when reading resources from ldap.

Parameters:
resourceProperties - the mapping for resource names
attributeProperties - the mapping for attribute types
Returns:
void

addResource

public void addResource(CellInformationBase.ResourceName r)
adds a new resource to the cib, if it doesn't exist already.

Specified by:
addResource in interface CibBackEnd
Parameters:
r - The ResourceName that is to be added
Returns:
void

getAttribute

public java.lang.String getAttribute(CellInformationBase.ResourceName r,
                                     java.lang.String a)
Returns the value of the especified attribute in the especified resource

Specified by:
getAttribute in interface CibBackEnd
Parameters:
r - The resource a The name of the attribute
Returns:
the value of the attribute

getAttributes

public java.lang.String[] getAttributes(CellInformationBase.ResourceName r)
returns all the names of the attribues of a given resource

Specified by:
getAttributes in interface CibBackEnd
Parameters:
r - The name of the resource
Returns:
an array of string cointaining all the names of the attributes of the resource

removeResource

public void removeResource(CellInformationBase.ResourceName r)
removes a resource from the cib

Specified by:
removeResource in interface CibBackEnd
Parameters:
r - The name of the resource that will be removed
Returns:
void

select

public CellInformationBase.ResourceName[] select(CellInformationBase.SelectionConstraint sc,
                                                 CellInformationBase.NameSpace[] ns,
                                                 int maxResults)

select

public CellInformationBase.ResourceName[] select(CellInformationBase.SelectionConstraint filter,
                                                 int maxResults)
Searches the cib for resources that match a certain SelectionConstraint

Parameters:
filter - The SelectionConstraint that the resources to be returned must match maxResults The maximum number of results that are to be returned
Returns:
An array containing the ResourceNames of the cib entries that matched the SelectionConstraint

select

public CellInformationBase.ResourceName[] select(CellInformationBase.SelectionConstraint filter,
                                                 CellInformationBase.NameSpace ns,
                                                 int maxResults)
Searches the cib for resources that match a certain SelectionConstraint

Specified by:
select in interface CibBackEnd
Parameters:
filter - The SelectionConstraint that the resources to be returned must match maxResults The maximum number of results that are to be returned
Returns:
An array containing the ResourceNames of the cib entries that matched the SelectionConstraint

selectByName

public CellInformationBase.ResourceName[] selectByName(java.lang.String n,
                                                       CellInformationBase.NameSpace ns,
                                                       int maxResults)
Searches the cib for resources that hava a certain name and that are inside a given namespace

Specified by:
selectByName in interface CibBackEnd
Parameters:
n - a string representing the name that the returned resources must have ns Tha NameSpace to which the resource must belong in order to be returned maxResults The maximum number of results that are to be returned
Returns:
An array containing the ResourceNames of the cib entries that had the given name

selectByType

public CellInformationBase.ResourceName[] selectByType(java.lang.String t,
                                                       CellInformationBase.NameSpace ns,
                                                       int maxResults)
Searches the cib for resources that hava a certain type and that are inside a given namespace

Specified by:
selectByType in interface CibBackEnd
Parameters:
t - a string representing the name of the type that the returned resources must have ns Tha NameSpace to which the resource must belong in order to be returned maxResults The maximum number of results that are to be returned
Returns:
An array containing the ResourceNames of the cib entries that had the given type

setAttribute

public java.lang.String setAttribute(CellInformationBase.ResourceName r,
                                     java.lang.String a,
                                     java.lang.String v)
Sets the value of a given attribute in a given resource

Specified by:
setAttribute in interface CibBackEnd
Parameters:
r - the resource which "owns" the attribute that is to be set a the name of the attribute that is to be set v the value to which the attribute is to set
Returns:
a string containing tha value to which the attribute was set

convertToLdap

public java.lang.String convertToLdap(CellInformationBase.NameSpace ns)
converts a given NameSpace into a string representation that can be understood by a ldap server

Parameters:
ns - the NameSpace that is to be converted
Returns:
a string representation of the given NameSpace that can be understood by a ldap server