com.ca.directory.jxplorer
Interface DataSource

All Known Implementing Classes:
Broker

public interface DataSource

This interface defines data sources used by the the browser. Usually this is an ldap data source, but may be any JNDI or program defined data source from which tree data can be read.

See Also:
JNDIBroker.com.ca.directory.jxplorer

Method Summary
 void addDataListener(DataListener l)
          Used by thread-friendly application to register a listener that will be called whenever a DataQuery request has been completed (or equivalently, an error thrown).
 DataQuery copyTree(DN oldNodeDN, DN newNodeDN)
          Copies the entry, and any child entries, identified by DN oldNodeDn to newNodeDN.
 DataQuery exists(DN nodeDN)
          Checks the existence of a particular entry by DN, without (necessarily) reading any attributes.
 DataQuery extendedRequest(DataQuery query)
          General Bail out - this allows the passing of a generic DataQuery object.
 Broker getBroker()
          As a way to directly access the directory broker, a DataSource MAY choose to publish the directory broker.
 DataQuery getChildren(DN nodeDN)
          gets the children of a particular DN as an enumeration
 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.
 DataQuery getEntry(DN nodeDN)
          gets the attribute types and values for a particular DN
 DataQuery getObjectClasses()
          Gets a list of all known schema object classes.
 DataQuery getRecommendedObjectClasses(DN dn)
          Gets a list of the object classes most likely to be used for the next Level of the DN...
 javax.naming.directory.DirContext getSchema()
          Returns a schema context (for getting object classes etc.)
 boolean isActive()
          whether the data source is currently on-line.
 boolean isModifiable()
          Checks whether the current data source is modifiable.
 DataQuery modifyEntry(DXEntry oldEntry, DXEntry newEntry)
          This changes an old entry to a new entry.
 void removeDataListener(DataListener l)
          Removes a data listener from the DataQuery.
 DataQuery search(DN nodeDN, java.lang.String filter, int searchLevel, java.lang.String[] returnAttrs)
          Executes a search request.
 

Method Detail

getChildren

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

Parameters:
nodeDN - the DN to retrieve children for
Returns:
a DataQuery that may be queried using .getEnumeration() to obtain an enumeration of NameClassPair-s to be the sub-nodes of the given node.

getEntry

public DataQuery getEntry(DN nodeDN)
gets the attribute types and values for a particular DN

Parameters:
nodeDN - the DN to retrieve attribute data for
Returns:
a DataQuery that may be queried using .getEntry() to obtain a DXEntry object containing attribute objects corresponding to the name/value(s) of the DN.

exists

public DataQuery exists(DN nodeDN)
Checks the existence of a particular entry by DN, without (necessarily) reading any attributes.

Returns:
a DataQuery that may be queried using .getStatus() to obtain a boolean true if the node exists, or false if it don't.

getObjectClasses

public DataQuery getObjectClasses()
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.

getRecommendedObjectClasses

public DataQuery getRecommendedObjectClasses(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 a schema context (for getting object classes etc.)


isActive

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

Returns:
on-line status

modifyEntry

public DataQuery modifyEntry(DXEntry oldEntry,
                             DXEntry newEntry)
This changes an old entry to a new entry. If the distinguished name has changed, the object is moved. If the oldEntry is null, the object is created, or overwritten. If the newEntry is null, the object is deleted, along with any subentries.

Parameters:
oldEntry - the original entry (may be null if adding a new entry).
newEntry - the new entry (may be null if deleting the entry).

copyTree

public DataQuery copyTree(DN oldNodeDN,
                          DN newNodeDN)
Copies the entry, and any child entries, identified by DN oldNodeDn to newNodeDN.

Parameters:
oldNodeDN - the entry or subtree apexto copy from
newNodeDN - the entry/subtree apex to copy to

search

public DataQuery search(DN nodeDN,
                        java.lang.String filter,
                        int searchLevel,
                        java.lang.String[] returnAttrs)
Executes a search request.

Parameters:
nodeDN - the root DN to start searching from
filter - the ldap string filter for the search
returnAttrs - an array of attributes that the search should return. or the entire sub tree.

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.

Returns:
whether the directory is modifiable

getDirContext

public 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.

Returns:
the jndi directory context - may be null.

getBroker

public Broker getBroker()
As a way to directly access the directory broker, a DataSource MAY choose to publish the directory broker.

Returns:
the Broker - may be null.

addDataListener

public void addDataListener(DataListener l)
Used by thread-friendly application to register a listener that will be called whenever a DataQuery request has been completed (or equivalently, an error thrown).

if this method is called on a DataQuery that has already been completed, it will be triggered immediately. This may cause listener code to be triggered before any code subsequent to the addDataListener() call.

Parameters:
l - the listener to be notified when the data operation has been completed.

removeDataListener

public void removeDataListener(DataListener l)
Removes a data listener from the DataQuery.

Parameters:
l - the listener to be notified when the data is ready.

extendedRequest

public DataQuery extendedRequest(DataQuery query)
General Bail out - this allows the passing of a generic DataQuery object. The DataSource will run that object's 'extendedRequest' method.

Returns:
returns the same query it was passed (for compatibility with similar methods)