|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--com.ca.directory.jxplorer.broker.Broker
|
+--com.ca.directory.jxplorer.broker.JNDIBroker
This utility class handles all the JNDIBroker LDAP calls, returning objects to calling classes and managing the connection.
Before examining this class make sure to examing the base Broker class thoroughly. The base Broker class takes user requests, and creates DataQuery objects. A separate thread takes these DataQuery objects and uses the methods of derived classes (such as this one) to do the actual grunt work.
| Nested Class Summary | |
class |
JNDIBroker.DataConnectionQuery
Helper class for Broker, this encapsulates an ldap-like connection request that is placed on the Broker queue for eventual resolution. |
| Field Summary | |
static int |
SEARCH_BASE_OBJECT
Used as a parameter to unthreadedSearch, this specifies to only search the base object. |
static int |
SEARCH_ONE_LEVEL
Used as a parameter to unthreadedSearch, this specifies to only search the next level from the current DN. |
static int |
SEARCH_SUB_TREE
Used as a parameter to unthreadedSearch, this specifies to search the entire subtree from the current DN. |
| Fields inherited from class com.ca.directory.jxplorer.broker.Broker |
current, id, listeners, requestQueue |
| Constructor Summary | |
JNDIBroker()
Constructor does nothing except create an env object ( 'connect()' is used to open a connection) |
|
JNDIBroker(JNDIBroker cloneMe)
Clones a JNDIBroker, using the same underlying directory connection, but clearing the data listener list, and having its own debug flags. |
|
| Method Summary | |
boolean |
addEntry(DXEntry newEntry)
Add the new entry to the directory. |
void |
clearException()
Utility method for extended queries - allows a 'masked' exception to be cleared. |
DataQuery |
connect(ConnectionData cData)
Queues a request to open a connection to an LDAP (only) server. |
DataQuery |
connect(java.lang.String baseDN,
int version,
java.lang.String host,
int port,
java.lang.String userDN,
char[] pwd,
java.lang.String referralType,
java.lang.String aliasType,
boolean useSSL,
java.lang.String cacerts,
java.lang.String clientcerts,
char[] caKeystorePwd,
char[] clientKeystorePwd)
Deprecated. use connect(ConnectionData) instead. |
boolean |
deleteTree(DN nodeDN)
Deletes a subtree by recursively deleting sub-sub trees from the given DN. |
void |
disconnect()
Disconnects from the current context, freeing both context and context environment parameters list. |
void |
error(java.lang.String msg,
java.lang.Exception e)
Usually shells to CBUtility.error, but will log instead if quiet mode is set. |
protected DataQuery |
finish(DataQuery request)
Sets the finish flag of a request and returns the query. |
java.lang.String |
getActualDN(java.lang.String dn)
This is a bit of a hack to verify the base DN. |
java.lang.String |
getAttributeDescription(java.lang.String attributeoid)
|
java.lang.String |
getAttributeSyntax(java.lang.String attID)
Returns the syntax of the attribute value that is supplied |
javax.naming.directory.DirContext |
getDirContext()
As a way to directly access the raw jndi directory context, a DataSource MAY choose to publish the directory connection. |
CBGraphicsOps |
getDirOp()
|
java.lang.Exception |
getException()
Utility method for extended queries - returns whether a 'masked' exception has occured. |
java.lang.String |
getNewBinaryAttributes()
Acquires a list of binary attributes, and adds them to the context environment so that they get returned as byte[] arrays. |
boolean |
getQuietError()
This returns whether one or more errors occured while the program was in 'quiet gui' (i.e. no error dialogs) mode. |
protected javax.naming.NamingEnumeration |
getRawSchemaChildren(DN nodeDN)
Does the raw directory call to get a schema list |
javax.naming.directory.DirContext |
getSchema()
Displays whether schema access is enabled. |
DXNamingEnumeration |
getSchemaChildren(DN nodeDN)
JNDI represents schema as a dit tree. |
javax.naming.directory.DirContext |
getSchemaContext()
|
javax.naming.directory.Attributes |
getSchemaData(DN nodeDN,
java.lang.String[] returnAttributes)
JNDI represents schema as a dit tree. |
java.lang.String |
getSchemaRoot()
returns the root DN of the schema subentry as a string. |
int |
getVersion()
This returns the version of ldap currently in use. |
boolean |
hasConnectionError()
whether the data source is currently on-line. |
protected boolean |
hasVerboseObjectClass(javax.naming.directory.Attributes atts)
Checks if any of the objectClasses of this object are on the list of special objects that require all attributes to be sent in a 'replace' list, whether or not they have been modified by the user. |
protected void |
initAttributeNamesHash()
The attributeNames hash provides a quick look up mapping between numericoids and attribute names. |
protected void |
initSpecialObjectClasses()
Mitch/OS390 hack |
boolean |
isActive()
whether the data source is currently on-line. |
boolean |
isModifiable()
Checks whether the current data source is modifiable. |
protected int |
loadMods(javax.naming.directory.ModificationItem[] mods,
javax.naming.NamingEnumeration atts,
int TYPE,
int index)
Utility ftn for updateNode - takes a list of attributes to modify, and the type of modification, and adds them to an array of modifications (starting at a particular index). |
void |
modifyAttributes(DN dn,
javax.naming.directory.ModificationItem[] mods)
Modifies the attributes associated with a named object using an an ordered list of modifications. |
boolean |
moveTree(DN oldNodeDN,
DN newNodeDN)
Moves a DN to a new DN, including all subordinate entries. |
java.util.Vector |
objectClasses()
Gets a list of all known schema object classes. |
protected DataQuery |
openConnection(JNDIBroker.DataConnectionQuery request)
Does the actual grunt work of opening a new connection. |
void |
printContextList(javax.naming.Context C,
DN dn,
java.lang.String message)
Used for debugging; prints out the first level of a dn from a particular context, headlined with with the supplied message. |
boolean |
processQueue()
process all queue requests |
protected void |
processRequest(DataQuery request)
Extends the base class processRequest method to handle DataConnectionRequest objects. |
javax.naming.directory.Attributes |
read(DN dn)
Reads all the attribute type and values for the given entry. |
DN[] |
readFallbackRoot()
If the rootDN doesn't exist, we try to read the the root DN from the server. |
void |
registerDirectoryConnection(JNDIBroker cloneMe)
Resets a JNDIBroker, using the same underlying directory connection as the passed broker, but clearing the data listener list, and resetting debug flags. |
void |
SetContextToBrowsingAliases()
This sets the context to use either jndi 'browsing' or 'never' alias resolution, depending on the value of the jxplorer property option.ldap.browseAliasBehaviour. |
void |
SetContextToSearchingAliases()
This sets the context to use either jndi 'searching' or 'never' alias resolution, depending on the value of the jxplorer property option.ldap.searchAliasBehaviour. |
void |
setGUIQuiet(boolean status)
Suppresses user notification of errors via GUI dialogs, and logs them instead. |
void |
setLimit(int maxResponses)
Sets the maximum number of objects returned by a search |
void |
setQuietError(boolean status)
Sets the quiet error flag status. |
void |
setTimeout(int maxTime)
Sets the timeout period before the connection gives up trying to fetch a given data request. |
void |
setTracing(boolean traceStatus)
Sets ber tracing status. |
boolean |
unthreadedCopy(DN oldNodeDN,
DN newNodeDN)
Copies a DN representing a subtree to a new subtree, including copying all subordinate entries. |
boolean |
unthreadedExists(DN checkMe)
Checks the existance of a given entry. |
java.util.Vector |
unthreadedGetAllOCs()
Returns a complete list of all known object classes. |
java.util.Vector |
unthreadedGetRecOCs(DN dn)
Gets a list of the object classes most likely to be used for the next Level of the DN... |
DXNamingEnumeration |
unthreadedList(DN searchbase)
returns the next level of a directory tree, returning a Enumeration of the results |
boolean |
unthreadedModify(DXEntry oldEntry,
DXEntry newEntry)
Update an entry with the designated DN. |
DXEntry |
unthreadedReadEntry(DN entryDN,
java.lang.String[] returnAttributes)
Reads an entry with all its attributes from the directory. |
DXNamingEnumeration |
unthreadedSearch(DN dn,
java.lang.String filter,
int search_level,
java.lang.String[] returnAttributes)
Performs a directory search. |
protected boolean |
useSpecialWriteAllAttsMode()
Optional debug code. |
| Methods inherited from class com.ca.directory.jxplorer.broker.Broker |
addDataListener, copyTree, doCopyQuery, doEntryQuery, doExistsQuery, doExtendedQuery, doGetAllOCsQuery, doGetRecOCsQuery, doListQuery, doModifyQuery, doSearchQuery, exists, extendedRequest, getBroker, getChildren, getCurrent, getEntry, getObjectClasses, getRecommendedObjectClasses, getRequestQueue, hasRequests, modifyEntry, pop, push, registerStopMonitor, removeDataListener, removeQuery, run, search |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int SEARCH_BASE_OBJECT
public static final int SEARCH_ONE_LEVEL
public static final int SEARCH_SUB_TREE
| Constructor Detail |
public JNDIBroker()
public JNDIBroker(JNDIBroker cloneMe)
cloneMe - | Method Detail |
public void registerDirectoryConnection(JNDIBroker cloneMe)
cloneMe - protected void initSpecialObjectClasses()
public void setGUIQuiet(boolean status)
status - public void setQuietError(boolean status)
status - public boolean getQuietError()
public javax.naming.directory.DirContext getSchema()
getSchema in interface DataSourcegetSchema in class Brokerpublic void setTracing(boolean traceStatus)
traceStatus -
public DataQuery connect(java.lang.String baseDN,
int version,
java.lang.String host,
int port,
java.lang.String userDN,
char[] pwd,
java.lang.String referralType,
java.lang.String aliasType,
boolean useSSL,
java.lang.String cacerts,
java.lang.String clientcerts,
char[] caKeystorePwd,
char[] clientKeystorePwd)
Queues a request to open a connection to an LDAP (only) server.
Note that some rarely modified connection status variables are set externally - e.g. BER tracing status (derived from the log level, set by setTracing() ), and the security keystore type and external security provider (if any) which are set in the config file).
baseDN - the base DN from which to browse.version - the LDAP Version (2 or 3) being used.host - the LDAP server url.port - the LDAP server port (default 389) being used.userDN - the Manager User's DN - (is null if user is not manager)pwd - the Manager User's password - (is null if user is not manager)referralType - the jndi ldap referral type: [follow:ignore:throw]aliasType - how aliases are handled: 'always'|'never'|'finding'|'searching'useSSL - whether to use SSL for encryption and/or authentication (dependant on other parameters)cacerts - path to a store of trusted server certificates or CA certificates - required for Server-auth sslclientcerts - path to client certificates - if available, will use for client authenticationcaKeystorePwd - the password to the client's keystore (may be null for non-client authenticated ssl).clientKeystorePwd - the password to the client certificates - required to use client certs for authentication
public DataQuery connect(ConnectionData cData)
Queues a request to open a connection to an LDAP (only) server.
Note that some rarely modified connection status variables are set externally - e.g. BER tracing status (derived from the log level, set by setTracing() ), and the security keystore type and external security provider (if any) which are set in the config file).
cData - data object containing all the connection information.
protected void processRequest(DataQuery request)
processRequest in class Brokerrequest - the connection data query.protected DataQuery openConnection(JNDIBroker.DataConnectionQuery request)
request - a DataQuery object that contains the connection details.
public java.lang.String getActualDN(java.lang.String dn)
dn - the DN to verify (or do the base object search on).
protected void initAttributeNamesHash()
public java.lang.String getAttributeDescription(java.lang.String attributeoid)
attributeoid - the attributes OID.
public java.lang.String getNewBinaryAttributes()
public int getVersion()
public void printContextList(javax.naming.Context C,
DN dn,
java.lang.String message)
C - the context to print out info for.dn - the DN to print the children of.message - text to print out along with the context data.public void disconnect()
public void setLimit(int maxResponses)
maxResponses - the maximum returned objectspublic void setTimeout(int maxTime)
maxTime - the maximum time allowed for a query.public DXNamingEnumeration unthreadedList(DN searchbase)
unthreadedList in class Broker
public DXNamingEnumeration unthreadedSearch(DN dn,
java.lang.String filter,
int search_level,
java.lang.String[] returnAttributes)
unthreadedSearch in class Brokerdn - the DN (relative to initial context in ldap) to seach from.filter - the non-null filter to use for the searchsearch_level - whether to search the base object, the next level or the whole subtree.returnAttributes - - a list of attributes to return. If set to null,
only the objectClass is returned.
public javax.naming.directory.Attributes read(DN dn)
dn - the ldap string distinguished name of entry to be read
public boolean deleteTree(DN nodeDN)
nodeDN - the DN of the node where to do the recursive delete.
public boolean moveTree(DN oldNodeDN,
DN newNodeDN)
newNodeDN - the target DN for the tree to be moved to.
public boolean unthreadedCopy(DN oldNodeDN,
DN newNodeDN)
unthreadedCopy in class BrokeroldNodeDN - the original DN of the sub tree root
to be copied (may be a single entry).newNodeDN - the target DN for the tree to be moved to.
public boolean unthreadedExists(DN checkMe)
unthreadedExists in class BrokercheckMe - the DN of the entry to check for existance.
public boolean processQueue()
Broker
processQueue in class Brokerpublic java.lang.Exception getException()
getException in class Brokerpublic void clearException()
clearException in class Brokerprotected DataQuery finish(DataQuery request)
Broker
finish in class Brokerrequest -
public java.util.Vector unthreadedGetAllOCs()
unthreadedGetAllOCs in class Brokerpublic boolean isActive()
isActive in interface DataSourceisActive in class Brokerpublic boolean hasConnectionError()
public DXEntry unthreadedReadEntry(DN entryDN,
java.lang.String[] returnAttributes)
unthreadedReadEntry in class BrokerentryDN - the DN of the entry.returnAttributes - a list of string names of attributes to return in the search.
(null means 'return all entries', a zero length array means 'return no attributes'.)
public boolean addEntry(DXEntry newEntry)
newEntry - the new entry containing the replacement set of attributes.
protected int loadMods(javax.naming.directory.ModificationItem[] mods,
javax.naming.NamingEnumeration atts,
int TYPE,
int index)
throws javax.naming.NamingException
mods - the array of modification itemsatts - an enumeration of attributes to add to the mod arrayTYPE - the type of modification (DELETE,REPLACE,ADD)index - the position in the modification array to start filling entries in
javax.naming.NamingException
public boolean unthreadedModify(DXEntry oldEntry,
DXEntry newEntry)
unthreadedModify in class BrokeroldEntry - the old entry containing teh old set of attributes.newEntry - the new entry containing the replacement set of attributes.
protected boolean useSpecialWriteAllAttsMode()
protected boolean hasVerboseObjectClass(javax.naming.directory.Attributes atts)
atts - the list of attributes.public boolean isModifiable()
isModifiable in interface DataSourceisModifiable in class Brokerpublic java.lang.String getSchemaRoot()
public java.lang.String getAttributeSyntax(java.lang.String attID)
attID - the attribute value for example 'Fred' from 'cn=Fred'.
public DXNamingEnumeration getSchemaChildren(DN nodeDN)
nodeDN - the DN from where to do the list.
Broker.getChildren(com.ca.commons.naming.DN)protected javax.naming.NamingEnumeration getRawSchemaChildren(DN nodeDN)
nodeDN - the DN from where to do the list.
public javax.naming.directory.DirContext getSchemaContext()
public javax.naming.directory.Attributes getSchemaData(DN nodeDN,
java.lang.String[] returnAttributes)
nodeDN - the DN to read from.returnAttributes - a vector of string names of attributes to return in the search.
(null means 'return all entries', a zero length array means 'return no attributes'.)
com.ca.directory.jxplorer.broker.JNDIBroker#unthreadedGetEntry.public java.util.Vector objectClasses()
public java.util.Vector unthreadedGetRecOCs(DN dn)
unthreadedGetRecOCs in class Brokerdn - the dn of the parent to determine likely
child object classes for
public void modifyAttributes(DN dn,
javax.naming.directory.ModificationItem[] mods)
throws javax.naming.directory.AttributeModificationException,
javax.naming.NamingException
dn - distinguished name of object to modifymods - an ordered sequence of modifications to be performed; may not be null
javax.naming.directory.AttributeModificationException
javax.naming.NamingException
public void error(java.lang.String msg,
java.lang.Exception e)
msg - the error message to display.e - the exception caused.public CBGraphicsOps getDirOp()
public javax.naming.directory.DirContext getDirContext()
DataSource
getDirContext in interface DataSourcegetDirContext in class Brokerpublic DN[] readFallbackRoot()
public void SetContextToSearchingAliases()
public void SetContextToBrowsingAliases()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||