KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ca > directory > jxplorer > DataSource


1 package com.ca.directory.jxplorer;
2
3 import com.ca.commons.naming.*;
4 import com.ca.commons.jndi.SchemaOps;
5 import com.ca.directory.jxplorer.broker.Broker;
6
7 import javax.naming.directory.DirContext JavaDoc;
8
9 /**
10  This interface defines data sources used by the the
11  browser. Usually this is an ldap data source, but may
12  be any JNDI or program defined data source from which
13  tree data can be read.
14
15  @see com.ca.directory.jxplorer.broker.JNDIBroker
16 */

17
18 public interface DataSource
19 {
20     /**
21      * gets the children of a particular DN as an enumeration
22      * @param nodeDN the DN to retrieve children for
23      *
24      * @return a DataQuery that may be queried using .getEnumeration() to obtain
25      * an enumeration of NameClassPair-s to be the
26      * sub-nodes of the given node.
27      */

28     public DataQuery getChildren(DN nodeDN);
29
30     /**
31      * gets the attribute types and values for a particular DN
32      *
33      * @param nodeDN the DN to retrieve attribute data for
34      * @return a DataQuery that may be queried using .getEntry() to obtain
35      * a DXEntry object containing attribute objects
36      * corresponding to the name/value(s) of the DN.
37      */

38
39     public DataQuery getEntry(DN nodeDN);
40
41    /**
42     * Checks the existence of a particular entry by DN, without (necessarily)
43     * reading any attributes.
44     * @param nodeDN the DN to check the existance of.
45     * @return a DataQuery that may be queried using .getStatus() to obtain
46     * a boolean true if the node exists, or false if it don't.
47     */

48
49     public DataQuery exists(DN nodeDN);
50
51     /**
52      * Gets a list of all known schema object classes.
53      * @return all known object classes, as . This will be
54      * null if this data source does not support
55      * this feature.
56      */

57     //public DataQuery getObjectClasses();
58

59     /**
60      * Gets a list of the object classes most likely
61      * to be used for the next Level of the DN...
62      * @param dn the dn of the parent to determine likely
63      * child object classes for
64      * @return list of recommended object classes...
65      */

66
67     public DataQuery getRecommendedObjectClasses(DN dn);
68
69     /**
70      * Returns a schema context (for getting object classes etc.)
71      */

72
73     public SchemaOps getSchemaOps();
74
75     /**
76      * whether the data source is currently on-line.
77      * @return on-line status
78      */

79
80     public boolean isActive();
81
82
83
84
85     // OLD DATAMODIFIER INTERFACE
86

87     /**
88      * This changes an old entry to a new entry.
89      * If the distinguished name has changed, the object is moved.
90      * If the oldEntry is null, the object is created, or overwritten.
91      * If the newEntry is null, the object is deleted, along with any
92      * subentries.
93      * @param oldEntry the original entry (may be null if adding a new entry).
94      * @param newEntry the new entry (may be null if deleting the entry).
95      * @return the success status of the operation.
96      */

97
98     public DataQuery modifyEntry(DXEntry oldEntry, DXEntry newEntry);
99
100
101     /**
102      * Copies the entry, and any child entries, identified by
103      * DN oldNodeDn to newNodeDN.
104      * @param oldNodeDN the entry or subtree apexto copy from
105      * @param newNodeDN the entry/subtree apex to copy to
106      */

107
108
109     public DataQuery copyTree(DN oldNodeDN, DN newNodeDN); // may be a single node.
110

111
112     /**
113      * Executes a search request.
114      * @param nodeDN the root DN to start searching from
115      * @param filter the ldap string filter for the search
116      * @param searchLevel whether to search the base object, the next level or the whole subtree.
117      * @param returnAttrs an array of attributes that the search should return.
118      * or the entire sub tree.
119      */

120
121     public DataQuery search(DN nodeDN, String JavaDoc filter, int searchLevel, String JavaDoc[] returnAttrs);
122
123
124     /**
125      * Checks whether the current data source is modifiable. (Nb.,
126      * a directory may have different access controls defined on
127      * different parts of the directory: if this is the case, the
128      * directory may return true to isModifiable(), however a
129      * particular modify attempt may still fail.
130      *
131      * @return whether the directory is modifiable
132      */

133
134     public boolean isModifiable();
135
136     /**
137      * As a way to directly access the raw jndi directory context, a DataSource
138      * MAY choose to publish the directory connection.
139      * @return the jndi directory context - may be null.
140      */

141
142     public DirContext JavaDoc getDirContext();
143
144     /**
145      * As a way to directly access the directory broker, a DataSource
146      * MAY choose to publish the directory broker.
147      * @return the Broker - may be null.
148      */

149
150     public Broker getBroker();
151
152     /**
153      * Used by thread-friendly application to register a
154      * listener that will be called whenever a DataQuery request has
155      * been completed (or equivalently, an error thrown).<p>
156      *
157      * if this method is called on a DataQuery that has
158      * already been completed, it will be triggered immediately.
159      * This may cause listener code to be triggered <i>before</i>
160      * any code subsequent to the addDataListener() call.<p>
161      *
162      * @param l the listener to be notified when the data
163      * operation has been completed.
164      */

165
166     public void addDataListener(DataListener l);
167     
168     
169    /**
170     * Removes a data listener from the DataQuery.
171     * @param l the listener to be notified when the data is ready.
172     */

173     
174     public void removeDataListener(DataListener l);
175
176     /**
177      * General Bail out - this allows the passing of a generic
178      * DataQuery object. The DataSource will run that object's
179      * 'extendedRequest' method.
180      * @return returns the same query it was passed (for compatibility
181      * with similar methods)
182      */

183
184     public DataQuery extendedRequest(DataQuery query);
185 }
Popular Tags