com.ca.directory.jxplorer.broker
Class OfflineBroker

java.lang.Object
  |
  +--com.ca.directory.jxplorer.broker.Broker
        |
        +--com.ca.directory.jxplorer.broker.OfflineBroker
All Implemented Interfaces:
DataSource, java.lang.Runnable

public class OfflineBroker
extends Broker

This sets up a 'virtual broker' that reads info in, and allows the user to operate on it, without any server being involved. The data is usually (always?) read from an ldif file.


Field Summary
 
Fields inherited from class com.ca.directory.jxplorer.broker.Broker
current, id, listeners, requestQueue
 
Constructor Summary
OfflineBroker(java.awt.Component graphicsDisplay)
          Constructor for Offline Broker does nothing except initialise the big hashtable that is at the core of the class.
 
Method Summary
protected  boolean addNode(DXEntry entry)
          Make a new entry with the provided DN.
 DXNamingEnumeration children(DN nodeDN)
          gets the children of a particular DN as an enumeration
 void clear()
          Empties the core Hashtable in preparation for a new ldif file to be read in.
 boolean deleteTree(DN nodeDN)
          deletes an entry with the given DN.
 DataQuery doGetAllOCsQuery(DataQuery request)
          Method for the Broker interface - chains to getObjectClasses().
 DataQuery doGetRecOCsQuery(DataQuery request)
          Method for the Broker interface - chains to getRecommendedObjectClasses.
 DataQuery doListQuery(DataQuery request)
          Method for the Broker interface - chains to children().
 DataQuery doSearchQuery(DataQuery request)
          Method for the Broker interface - chains to search().
 javax.naming.directory.DirContext getDirContext()
          We don't actually have an underlying DirContext, so return null...
 javax.naming.directory.DirContext getSchema()
          Returns the context for the schema.
 boolean isActive()
          whether the data source is currently on-line.
 boolean isModifiable()
          Checks whether the current data source is modifiable.
 boolean move(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.
 java.util.Vector recommendedObjectClasses(DN dn)
          Gets a list of the object classes most likely to be used for the next Level of the DN...
 boolean unthreadedCopy(DN oldNodeDN, DN newNodeDN)
          Copies a DN representing a subtree to a new subtree, including copying all subordinate entries.
 boolean unthreadedExists(DN nodeDN)
          Checks the existence of a particular DN, without (necessarily) reading any attributes.
 java.util.Vector unthreadedGetAllOCs()
          Not implemented.
 java.util.Vector unthreadedGetRecOCs(DN dn)
          Not implemented.
 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)
          Not Implemented.
 boolean updateNode(DXEntry oldSet, DXEntry newSet)
          Update an entry with the designated DN.
 
Methods inherited from class com.ca.directory.jxplorer.broker.Broker
addDataListener, clearException, copyTree, doCopyQuery, doEntryQuery, doExistsQuery, doExtendedQuery, doModifyQuery, exists, extendedRequest, finish, getBroker, getChildren, getCurrent, getEntry, getException, getObjectClasses, getRecommendedObjectClasses, getRequestQueue, hasRequests, modifyEntry, pop, processQueue, processRequest, push, registerStopMonitor, removeDataListener, removeQuery, run, search
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OfflineBroker

public OfflineBroker(java.awt.Component graphicsDisplay)
Constructor for Offline Broker does nothing except initialise the big hashtable that is at the core of the class.

Method Detail

clear

public void clear()
Empties the core Hashtable in preparation for a new ldif file to be read in.


children

public DXNamingEnumeration children(DN nodeDN)
gets the children of a particular DN as an enumeration

Parameters:
nodeDN - the DN to retrieve children for

isActive

public boolean isActive()
whether the data source is currently on-line.

Specified by:
isActive in interface DataSource
Specified by:
isActive in class Broker
Returns:
on-line status

objectClasses

public java.util.Vector objectClasses()
Gets a list of all known schema object classes.

Returns:
all known object classes, as . This will be null if this data source does not support this feature.

recommendedObjectClasses

public java.util.Vector recommendedObjectClasses(DN dn)
Gets a list of the object classes most likely to be used for the next Level of the DN...

Parameters:
dn - the dn of the parent to determine likely child object classes for
Returns:
list of recommended object classes...

getSchema

public javax.naming.directory.DirContext getSchema()
Returns the context for the schema. This may be null if the directory does not support schema.

Specified by:
getSchema in interface DataSource
Specified by:
getSchema in class Broker
Returns:
schema root context.

addNode

protected boolean addNode(DXEntry entry)
Make a new entry with the provided DN.

Returns:
the operation's success status

updateNode

public boolean updateNode(DXEntry oldSet,
                          DXEntry newSet)
Update an entry with the designated DN.

Returns:
the operation's success status

deleteTree

public boolean deleteTree(DN nodeDN)
deletes an entry with the given DN. If the entry has subordinates, they are also deleted.

Parameters:
nodeDN - the DN of the tree root to delete (may be a single entry).
Returns:
the operation's success status

move

public boolean move(DN oldNodeDN,
                    DN newNodeDN)
Moves a DN to a new DN, including all subordinate entries. (nb it is up to the implementer how this is done; e.g. if it is an ldap broker, it may choose rename, or copy-and-delete, as appropriate)

Parameters:
oldNodeDN - the original DN of the sub tree root (may be a single entry).
newNodeDN - the target DN for the tree to be moved to.
Returns:
the operation's success status

isModifiable

public boolean isModifiable()
Checks whether the current data source is modifiable. (Nb., a directory may have different access controls defined on different parts of the directory: if this is the case, the directory may return true to isModifiable(), however a particular modify attempt may still fail.

Specified by:
isModifiable in interface DataSource
Specified by:
isModifiable in class Broker
Returns:
whether the directory is modifiable

getDirContext

public javax.naming.directory.DirContext getDirContext()
We don't actually have an underlying DirContext, so return null...

Specified by:
getDirContext in interface DataSource
Specified by:
getDirContext in class Broker
Returns:
the jndi directory context - may be null.

doListQuery

public DataQuery doListQuery(DataQuery request)
Method for the Broker interface - chains to children().

Overrides:
doListQuery in class Broker

doSearchQuery

public DataQuery doSearchQuery(DataQuery request)
Method for the Broker interface - chains to search().

Overrides:
doSearchQuery in class Broker

doGetAllOCsQuery

public DataQuery doGetAllOCsQuery(DataQuery request)
Method for the Broker interface - chains to getObjectClasses().

Overrides:
doGetAllOCsQuery in class Broker

doGetRecOCsQuery

public DataQuery doGetRecOCsQuery(DataQuery request)
Method for the Broker interface - chains to getRecommendedObjectClasses.

Overrides:
doGetRecOCsQuery in class Broker

unthreadedList

public DXNamingEnumeration unthreadedList(DN searchbase)
returns the next level of a directory tree, returning a Enumeration of the results

Specified by:
unthreadedList in class Broker
Returns:
list of results (NameClassPair); the next layer of the tree...

unthreadedSearch

public DXNamingEnumeration unthreadedSearch(DN dn,
                                            java.lang.String filter,
                                            int search_level,
                                            java.lang.String[] returnAttributes)
Not Implemented.

Specified by:
unthreadedSearch in class Broker
Parameters:
filter - the non-null filter to use for the search
search_level - whether to search the base object, the next level or the whole subtree.
returnAttributes - a vector of string names of attributes to return in the search. (Currently inoperative)
Returns:
list of results ('SearchResult's); the next layer of the tree...

unthreadedCopy

public boolean unthreadedCopy(DN oldNodeDN,
                              DN newNodeDN)
Copies a DN representing a subtree to a new subtree, including copying all subordinate entries.

Specified by:
unthreadedCopy in class Broker
Parameters:
oldNodeDN - 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.
Returns:
the operation's success status

unthreadedExists

public boolean unthreadedExists(DN nodeDN)
Checks the existence of a particular DN, without (necessarily) reading any attributes.

Specified by:
unthreadedExists in class Broker
Parameters:
nodeDN - the DN to check.
Returns:
the existence of the nodeDN (or false if an error occurs).

unthreadedGetAllOCs

public java.util.Vector unthreadedGetAllOCs()
Not implemented.

Specified by:
unthreadedGetAllOCs in class Broker

unthreadedReadEntry

public DXEntry unthreadedReadEntry(DN entryDN,
                                   java.lang.String[] returnAttributes)
Reads an entry with all its attributes from the directory.

Specified by:
unthreadedReadEntry in class Broker
Parameters:
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'.)

unthreadedModify

public boolean unthreadedModify(DXEntry oldEntry,
                                DXEntry newEntry)
Update an entry with the designated DN.

Specified by:
unthreadedModify in class Broker
Returns:
the operation's success status

unthreadedGetRecOCs

public java.util.Vector unthreadedGetRecOCs(DN dn)
Not implemented.

Specified by:
unthreadedGetRecOCs in class Broker
Parameters:
dn - the dn of the parent to determine likely child object classes for
Returns:
list of recommended object classes...