public class JNDIDir extends Object implements IDir
NameWrapper| Modifier and Type | Class and Description |
|---|---|
protected class |
JNDIDir.SupportingData |
| Constructor and Description |
|---|
JNDIDir(ICS ics)
Initializes ObjectPool of DirContext instances, if pooling is enabled
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAttrs(ICS ics,
IName dn,
Attributes attributes)
Add attributes to an existing entry.
|
Collection |
andSearch(ICS ics,
Attributes matchingAttributes)
Simple search returns all entries with matching attributes
(AND); searches under DirProperties.baseDN
|
Collection |
andSearch(ICS ics,
IName parent,
Attributes matchingAttributes)
Simple search returns all entries with matching attributes
(AND)
|
protected void |
attrsOp(ICS ics,
IName dn,
int op,
Attributes attributes) |
protected static String |
authtMech(ICS ics)
Do *not* use this to set the authentication mechanism.
|
Collection |
children(ICS ics,
IName dn)
Retrieves the immediate child entries of the specified parent.
|
void |
create(ICS ics,
IName entry,
Attributes attributes)
Create an object.
|
void |
delete(ICS ics,
IName dn)
Delete the specified entry.
|
void |
deleteAttrs(ICS ics,
IName dn,
Attributes attributes)
Delete the specified attributes from the specified entry.
|
protected boolean |
DNExists(ICS ics,
IName dn)
Ensure that the Distinguished name exists in the directory.
|
protected static IName |
fullName(ICS ics,
IName name)
Clone the name and prepend the basedn to it
|
Attributes |
getAttrs(ICS ics,
IName dn,
String[] attrIds)
Retrieve the specified attributes from the specified entry.
|
protected static IName |
getBaseDN(ICS ics)
Look up the baseDN in the object pool, if not there, create it
from the string in the property file.
|
Attributes |
getGroupAttributes(ICS ics,
String groupname,
Attributes attributes) |
protected com.openmarket.directory.jndi.JNDIInterface |
getJNDIInterface(ICS ics) |
Attributes |
getUserAttributes(ICS ics,
String name,
Attributes attributes) |
protected static void |
handleNamingException(ICS ics,
NamingException e,
JNDIDir.SupportingData data,
String className,
String methodName)
Added by Yu-Chun to call the modified handleNamingException() with throwException=true
|
protected static void |
handleNamingException(ICS ics,
NamingException e,
JNDIDir.SupportingData data,
String className,
String methodName,
boolean throwException)
The JNDI interface doesn't specify every type of Exception that
might be thrown by a particular method.
|
protected static int |
intPropertyValue(ICS ics,
String propName) |
protected boolean |
isMember(ICS ics,
IName member,
IName group)
Member is a name relative to baseDN
|
protected static Collection |
membersToCollection(ICS ics,
Attribute attr)
Don't use toCollection here because the Enumeration is of
Objects (Strings) not NameClassPair's.
|
protected Attributes |
mimeEncodedPropToAttributes(ICS ics,
String propname) |
protected List |
mimeEncodedPropToNameList(ICS ics,
String propname) |
protected Collection |
opSearch(ICS ics,
IName parent,
Attributes matchingAttributes,
String op) |
Collection |
orSearch(ICS ics,
Attributes matchingAttributes)
Simple search returns all entries with attributes matching any of
those specified (OR); searches under DirProperties.baseDN
|
Collection |
orSearch(ICS ics,
IName parent,
Attributes matchingAttributes)
Simple search returns all entries attributes matching any of
those specified (OR)
|
protected static String |
principal(ICS ics)
Returns the principal being used for JNDI SPI access, whether
it be the current user or something configured in the property
file.
|
protected static IName |
relativeName(ICS ics,
IName fName)
Clone the name and chop the basedn off it.
|
void |
replaceAttrs(ICS ics,
IName dn,
Attributes attributes)
Replace the existing attribute value(s) with the specified
value(s).
|
protected static Collection |
toCollection(ICS ics,
NamingEnumeration nEnum) |
protected static Collection |
toCollection(ICS ics,
NamingEnumeration nEnum,
IName prefix) |
protected Attribute |
uniquememberAttr(ICS ics,
IName group)
returns null if uniquemember attribute is not found.
|
public JNDIDir(ICS ics)
protected static String authtMech(ICS ics) throws DirectoryException
DirectoryExceptionprotected static String principal(ICS ics) throws DirectoryException
DirectoryExceptionprotected com.openmarket.directory.jndi.JNDIInterface getJNDIInterface(ICS ics) throws DirectoryException
DirectoryExceptionprotected static void handleNamingException(ICS ics, NamingException e, JNDIDir.SupportingData data, String className, String methodName) throws DirectoryException
ics - e - data - className - methodName - DirectoryExceptionprotected static void handleNamingException(ICS ics, NamingException e, JNDIDir.SupportingData data, String className, String methodName, boolean throwException) throws DirectoryException
The JNDI interface doesn't specify every type of Exception that might be thrown by a particular method. Catch what you can in the calling method, and catch NamingException last. In that last catch, send the exception to this method for more detailed error interpretation.
Errors are translated to an end-user-friendly message which is logged as an error, and a trace message is logged containing the less user-friendly exception detail. 08/20/2014 Method modified by Yu-Chun to handle the throwException logic
DirectoryExceptionpublic void create(ICS ics, IName entry, Attributes attributes) throws DirectoryException
IDircreate in interface IDirentry - Distinguished name of entry to be created.attributes - Attribute(s) to create for this entry. If
null, creates entry with no attributes.DirectoryExceptionpublic void delete(ICS ics, IName dn) throws DirectoryException
IDirdelete in interface IDirdn - Distinguished name of entry to be deleted.DirectoryExceptionprotected static int intPropertyValue(ICS ics, String propName) throws DirectoryException
DirectoryExceptionprotected static Collection toCollection(ICS ics, NamingEnumeration nEnum)
protected static Collection toCollection(ICS ics, NamingEnumeration nEnum, IName prefix)
protected Collection opSearch(ICS ics, IName parent, Attributes matchingAttributes, String op) throws DirectoryException
DirectoryExceptionpublic Collection andSearch(ICS ics, Attributes matchingAttributes) throws DirectoryException
andSearch in interface IDirmatchingAttributes - The name value pairs to matchDirectoryExceptionpublic Collection andSearch(ICS ics, IName parent, Attributes matchingAttributes) throws DirectoryException
IDirandSearch in interface IDirparent - The entry under which to searchmatchingAttributes - The name value pairs to matchDirectoryExceptionpublic Collection orSearch(ICS ics, Attributes matchingAttributes) throws DirectoryException
orSearch in interface IDirmatchingAttributes - The name value pairs to matchDirectoryExceptionpublic Collection orSearch(ICS ics, IName parent, Attributes matchingAttributes) throws DirectoryException
IDirorSearch in interface IDirparent - The entry under which to searchmatchingAttributes - The name value pairs to matchDirectoryExceptionpublic Collection children(ICS ics, IName dn) throws DirectoryException
IDirchildren in interface IDirdn - The distinguished name of the entry for which
children are to be found.DirectoryExceptionprotected void attrsOp(ICS ics, IName dn, int op, Attributes attributes) throws DirectoryException
DirectoryExceptionpublic void addAttrs(ICS ics, IName dn, Attributes attributes) throws DirectoryException
IDiraddAttrs in interface IDirdn - The distinguished name of the entry to which
attributes are added.attributes - Attributes to be added.DirectoryExceptionpublic void replaceAttrs(ICS ics, IName dn, Attributes attributes) throws DirectoryException
IDirreplaceAttrs in interface IDirdn - The distinguished name of the entry for which
attributes are being replaced.attributes - Attributes to be replaced.DirectoryExceptionpublic void deleteAttrs(ICS ics, IName dn, Attributes attributes) throws DirectoryException
IDirdeleteAttrs in interface IDirattributes - Attributes to be removed.DirectoryExceptionpublic Attributes getAttrs(ICS ics, IName dn, String[] attrIds) throws DirectoryException
IDirgetAttrs in interface IDirdn - The distinguished name of the entry for which
attributes are being retrieved.attrIds - The identifiers of the attributes to
retrieve. null indicates that all attributes should be
retrieved; an empty array indicates that none should be
retrieved.DirectoryExceptionprotected Attribute uniquememberAttr(ICS ics, IName group) throws DirectoryException
DirectoryExceptionprotected static IName getBaseDN(ICS ics) throws DirectoryException
DirectoryExceptionprotected static IName fullName(ICS ics, IName name) throws DirectoryException
DirectoryExceptionprotected static IName relativeName(ICS ics, IName fName) throws DirectoryException
DirectoryExceptionprotected boolean isMember(ICS ics, IName member, IName group) throws DirectoryException
DirectoryExceptionprotected static Collection membersToCollection(ICS ics, Attribute attr) throws DirectoryException
DirectoryExceptionprotected boolean DNExists(ICS ics, IName dn)
public Attributes getUserAttributes(ICS ics, String name, Attributes attributes) throws DirectoryException
DirectoryExceptionpublic Attributes getGroupAttributes(ICS ics, String groupname, Attributes attributes) throws DirectoryException
DirectoryExceptionprotected Attributes mimeEncodedPropToAttributes(ICS ics, String propname) throws DirectoryException
DirectoryException