|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.groiss.ldap.LDAPUtils
public class LDAPUtils
Helper class for dealing with LDAP-Servers
| Constructor Summary | |
|---|---|
LDAPUtils()
|
|
| Method Summary | |
|---|---|
static DirContext |
connect(DirectoryServer ds)
Connect to a directory server. |
Page |
connectAndList(HttpServletRequest req)
Connect to an LDAP Server and list its contents |
static DirContext |
createSubcontext(DirContext baseContext,
ClassMapping cm)
Create a subcontext of a basecontext, as specified by a class mapping. |
static void |
deleteSubtree(DirContext ctx)
Recursivly delete a subtree in the LDAP-Server |
static String |
extractRDNVal(String dn)
Extract the Value of the RDN from a String which is a DN |
static Attribute |
getAttribute(DirectoryServer ds,
AttributeMapping am,
Persistent o)
Construct an Attribute from a Persistent and an Attribute Mapping |
static Object |
getAttValue(DirectoryServer ds,
AttributeMapping am,
Persistent o)
Get an attribute value from an Persistent and an AttributeMapping |
static String |
getDN(ClassMapping cm,
Persistent o)
Get the distinguished name of an Persistent relative to the root |
static String |
getSearchExpression(Attributes attribs,
Class<?> clazz,
ClassMapping cm,
DirContext objectCtx,
Persistent parentObject,
String parentField)
Create a SQL search expression for an LDAP object. |
static String |
getSearchOid(Persistent o)
Get a LDAP search expression for a Persistent based on Attribute entOid |
static String |
getSearchString(ClassMapping cm,
DirContext ctx)
Construct a LDAP search string for a dircontext based on the RDN attribute |
static String |
getSearchString(DirectoryServer ds,
ClassMapping cm,
Persistent o)
Construct a LDAP search string for a Persistent based on the RDN attribute |
static DirContext |
getSubContext(DirContext baseContext,
ClassMapping cm)
Get a subcontext of a basecontext, as specified ba a class mapping |
static void |
setField(Field ff,
Object o,
Object val)
Set a field of the given object to a value |
static void |
setNull(Field ff,
Object o)
Set the given field of an Object to an appropriate value for null |
static void |
setSQLAttributes(Persistent o,
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(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 Page connectAndList(HttpServletRequest req)
throws Exception
req -
Exception
public Page sync(HttpServletRequest req)
throws Exception
req -
Exception
public static void sync(DirectoryServer ds,
boolean throwEx)
throws Exception
ds - the server to synchronize with
Exception
public static DirContext connect(DirectoryServer ds)
throws NamingException
ds - the directory server to connect to
NamingException
public static DirContext getSubContext(DirContext baseContext,
ClassMapping cm)
throws Exception
baseContext - the case contextcm - the class mapping which specifies the subcontext
Exception
public static DirContext createSubcontext(DirContext baseContext,
ClassMapping cm)
throws Exception
baseContext - the case contextcm - the class mapping which specifies the subcontext
Exception
public static void deleteSubtree(DirContext ctx)
throws Exception
ctx - the root of the tree to be deleted
Exception
public static String getSearchString(ClassMapping cm,
DirContext ctx)
throws Exception
cm - the appropriate class mapping for the dir contextctx - the context to construct the search string for
Exception
public static String getSearchString(DirectoryServer ds,
ClassMapping cm,
Persistent o)
throws Exception
ds - thecm - o -
Exception
public static String getSearchOid(Persistent o)
throws Exception
o - the Persistent for which the search expression is to be generated
Exception
public static String getDN(ClassMapping cm,
Persistent o)
throws Exception
cm - an appropriate class mapping for the persistento - the object to generate the DN for
Exception
public static Attribute getAttribute(DirectoryServer ds,
AttributeMapping am,
Persistent o)
throws Exception
ds - the directory serveram - the attribute mappingo - the Persistent
Exception
public static Object getAttValue(DirectoryServer ds,
AttributeMapping am,
Persistent o)
throws Exception
ds - the directory serveram - the attribute mappingo - the Persistent
Exception
public static void setSQLAttributes(Persistent o,
DirContext objectCtx,
ClassMapping cm)
throws 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
Exception
public static String getSearchExpression(Attributes attribs,
Class<?> clazz,
ClassMapping cm,
DirContext objectCtx,
Persistent parentObject,
String parentField)
throws 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)
Exception
public static void setNull(Field ff,
Object o)
throws Exception
ff - the Field to seto - the Object whose field is to be set
Exception
public static void setField(Field ff,
Object o,
Object val)
throws Exception
ff - the field to seto - the Object whose field is to be setval - the value to set the field to
Exceptionpublic static String extractRDNVal(String dn)
dn - the distinguidhed name
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||