|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.groiss.ldap.LDAPUtils
public class LDAPUtils
Helper class for dealing with LDAP-Servers
Constructor Summary | |
---|---|
LDAPUtils()
|
Method Summary | |
---|---|
static javax.naming.directory.DirContext |
connect(DirectoryServer ds)
Connect to a directory server. |
static Page |
connectAndList(javax.servlet.http.HttpServletRequest req)
Connect to an LDAP Server and list its contents |
static javax.naming.directory.DirContext |
createSubcontext(javax.naming.directory.DirContext baseContext,
ClassMapping cm)
Create a subcontext of a basecontext, as specified by a class mapping. |
static void |
deleteSubtree(javax.naming.directory.DirContext ctx)
Recursivly delete a subtree in the LDAP-Server |
static java.lang.String |
extractRDNVal(java.lang.String dn)
Extract the Value of the RDN from a String which is a DN |
static javax.naming.directory.Attribute |
getAttribute(DirectoryServer ds,
AttributeMapping am,
Persistent o)
Construct an Attribute from a Persistent and an Attribute Mapping |
static java.lang.Object |
getAttValue(DirectoryServer ds,
AttributeMapping am,
Persistent o)
Get an attribute value from an Persistent and an AttributeMapping |
static java.lang.String |
getDN(ClassMapping cm,
Persistent o)
Get the distinguished name of an Persistent relative to the root |
static java.lang.String |
getSearchExpression(javax.naming.directory.Attributes attribs,
java.lang.Class<?> clazz,
ClassMapping cm,
javax.naming.directory.DirContext objectCtx,
Persistent parentObject,
java.lang.String parentField)
Create a SQL search expression for an LDAP object. |
static java.lang.String |
getSearchOid(Persistent o)
Get a LDAP search expression for a Persistent based on Attribute entOid |
static java.util.List<javax.naming.directory.SearchResult> |
getSearchResults(DirectoryServer ds,
javax.naming.directory.DirContext baseContext,
javax.naming.directory.SearchControls searchcons)
|
static java.lang.String |
getSearchString(ClassMapping cm,
javax.naming.directory.DirContext ctx)
Construct a LDAP search string for a dircontext based on the RDN attribute |
static java.lang.String |
getSearchString(DirectoryServer ds,
ClassMapping cm,
Persistent o)
Construct a LDAP search string for a Persistent based on the RDN attribute |
static javax.naming.directory.DirContext |
getSubContext(javax.naming.directory.DirContext baseContext,
ClassMapping cm)
Get a subcontext of a basecontext, as specified ba a class mapping |
static void |
setField(java.lang.reflect.Field ff,
java.lang.Object o,
java.lang.Object val)
Set a field of the given object to a value |
static void |
setNull(java.lang.reflect.Field ff,
java.lang.Object o)
Set the given field of an Object to an appropriate value for null |
static void |
setSQLAttributes(Persistent o,
javax.naming.directory.DirContext objectCtx,
ClassMapping cm)
Set the fields of the Persistent that corresponds to the given DirContext based on the ClassMapping |
static void |
sync(DirectoryServer ds,
boolean throwEx)
Synchronize with a directory server. |
Page |
sync(javax.servlet.http.HttpServletRequest req)
Synchronize with a directory Server |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LDAPUtils()
Method Detail |
---|
public static Page connectAndList(javax.servlet.http.HttpServletRequest req) throws java.lang.Exception
req
-
java.lang.Exception
public static java.util.List<javax.naming.directory.SearchResult> getSearchResults(DirectoryServer ds, javax.naming.directory.DirContext baseContext, javax.naming.directory.SearchControls searchcons) throws javax.naming.NamingException, java.io.IOException
javax.naming.NamingException
java.io.IOException
public Page sync(javax.servlet.http.HttpServletRequest req) throws java.lang.Exception
req
-
java.lang.Exception
public static void sync(DirectoryServer ds, boolean throwEx) throws java.lang.Exception
ds
- the server to synchronize with
java.lang.Exception
public static javax.naming.directory.DirContext connect(DirectoryServer ds) throws javax.naming.NamingException
ds
- the directory server to connect to
javax.naming.NamingException
public static javax.naming.directory.DirContext getSubContext(javax.naming.directory.DirContext baseContext, ClassMapping cm) throws java.lang.Exception
baseContext
- the case contextcm
- the class mapping which specifies the subcontext
java.lang.Exception
public static javax.naming.directory.DirContext createSubcontext(javax.naming.directory.DirContext baseContext, ClassMapping cm) throws java.lang.Exception
baseContext
- the case contextcm
- the class mapping which specifies the subcontext
java.lang.Exception
public static void deleteSubtree(javax.naming.directory.DirContext ctx) throws java.lang.Exception
ctx
- the root of the tree to be deleted
java.lang.Exception
public static java.lang.String getSearchString(ClassMapping cm, javax.naming.directory.DirContext ctx) throws java.lang.Exception
cm
- the appropriate class mapping for the dir contextctx
- the context to construct the search string for
java.lang.Exception
public static java.lang.String getSearchString(DirectoryServer ds, ClassMapping cm, Persistent o) throws java.lang.Exception
ds
- thecm
- o
-
java.lang.Exception
public static java.lang.String getSearchOid(Persistent o) throws java.lang.Exception
o
- the Persistent for which the search expression is to be generated
java.lang.Exception
public static java.lang.String getDN(ClassMapping cm, Persistent o) throws java.lang.Exception
cm
- an appropriate class mapping for the persistento
- the object to generate the DN for
java.lang.Exception
public static javax.naming.directory.Attribute getAttribute(DirectoryServer ds, AttributeMapping am, Persistent o) throws java.lang.Exception
ds
- the directory serveram
- the attribute mappingo
- the Persistent
java.lang.Exception
public static java.lang.Object getAttValue(DirectoryServer ds, AttributeMapping am, Persistent o) throws java.lang.Exception
ds
- the directory serveram
- the attribute mappingo
- the Persistent
java.lang.Exception
public static void setSQLAttributes(Persistent o, javax.naming.directory.DirContext objectCtx, ClassMapping cm) throws java.lang.Exception
o
- the Persistent whose fields are to be filledobjectCtx
- the directory context whose attribute values are to be filled into the Persistentcm
- an appropriate ClassMapping between o and objectCtx
java.lang.Exception
public static java.lang.String getSearchExpression(javax.naming.directory.Attributes attribs, java.lang.Class<?> clazz, ClassMapping cm, javax.naming.directory.DirContext objectCtx, Persistent parentObject, java.lang.String parentField) throws java.lang.Exception
attribs
- the Attributes of the LDAP objectclazz
- the class of the Persistentcm
- an appropriate class mappingobjectCtx
- the LDAP objectparentObject
- the SQL parent object of the LDAP objectparentField
- the SQL field by which the parent object is linked to the Persistent (foreign key)
java.lang.Exception
public static void setNull(java.lang.reflect.Field ff, java.lang.Object o) throws java.lang.Exception
ff
- the Field to seto
- the Object whose field is to be set
java.lang.Exception
public static void setField(java.lang.reflect.Field ff, java.lang.Object o, java.lang.Object val) throws java.lang.Exception
ff
- the field to seto
- the Object whose field is to be setval
- the value to set the field to
java.lang.Exception
public static java.lang.String extractRDNVal(java.lang.String dn)
dn
- the distinguidhed name
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |