1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| |
16 |
| |
17 |
| |
18 |
| |
19 |
| |
20 |
| package org.apache.xindice.client.xmldb.services; |
21 |
| |
22 |
| import org.apache.xindice.client.xmldb.CommonConfigurable; |
23 |
| import org.apache.xindice.client.xmldb.XindiceCollection; |
24 |
| import org.apache.xindice.core.FaultCodes; |
25 |
| |
26 |
| import org.w3c.dom.Document; |
27 |
| import org.xmldb.api.base.Collection; |
28 |
| import org.xmldb.api.base.ErrorCodes; |
29 |
| import org.xmldb.api.base.XMLDBException; |
30 |
| import org.xmldb.api.modules.CollectionManagementService; |
31 |
| |
32 |
| |
33 |
| |
34 |
| |
35 |
| |
36 |
| |
37 |
| |
38 |
| |
39 |
| |
40 |
| public class CollectionManagementServiceImpl extends CommonConfigurable |
41 |
| implements CollectionManagementService, CollectionManager, DatabaseInstanceManager { |
42 |
| |
43 |
| |
44 |
| private Collection coll = null; |
45 |
| |
46 |
| |
47 |
| private final static String SERVICE_VERSION = "1.0"; |
48 |
| |
49 |
| |
50 |
| private final static String SERVICE_NAME = "CollectionManagementService"; |
51 |
| |
52 |
| |
53 |
| |
54 |
| |
55 |
| |
56 |
| |
57 |
10254
| public String getVersion() throws XMLDBException {
|
58 |
| |
59 |
10254
| return SERVICE_VERSION;
|
60 |
| } |
61 |
| |
62 |
| |
63 |
| |
64 |
| |
65 |
| |
66 |
| |
67 |
| |
68 |
0
| public Collection createCollection(String childCollName)
|
69 |
| throws XMLDBException { |
70 |
| |
71 |
0
| if (coll == null) {
|
72 |
| |
73 |
0
| throw new XMLDBException(ErrorCodes.INVALID_COLLECTION,
|
74 |
| "Must set collection for this service"); |
75 |
| } |
76 |
| |
77 |
0
| return ((XindiceCollection) coll).createCollection(childCollName);
|
78 |
| } |
79 |
| |
80 |
| |
81 |
| |
82 |
| |
83 |
| |
84 |
| |
85 |
387
| public void removeCollection(String childCollName) throws XMLDBException {
|
86 |
387
| if (coll == null) {
|
87 |
| |
88 |
0
| throw new XMLDBException(ErrorCodes.INVALID_COLLECTION,
|
89 |
| "Must set collection for this service"); |
90 |
| } |
91 |
| |
92 |
387
| ((XindiceCollection) coll).removeCollection(childCollName);
|
93 |
| } |
94 |
| |
95 |
| |
96 |
| |
97 |
| |
98 |
| |
99 |
| |
100 |
3418
| public String getName() {
|
101 |
| |
102 |
3418
| return SERVICE_NAME;
|
103 |
| } |
104 |
| |
105 |
| |
106 |
| |
107 |
| |
108 |
| |
109 |
| |
110 |
3418
| public void setCollection(Collection collection) {
|
111 |
| |
112 |
3418
| this.coll = collection;
|
113 |
| } |
114 |
| |
115 |
| |
116 |
| |
117 |
| |
118 |
| |
119 |
| |
120 |
| |
121 |
0
| public String getCollectionName() throws XMLDBException {
|
122 |
0
| try {
|
123 |
0
| return coll.getName();
|
124 |
| } catch (Exception e) { |
125 |
0
| throw FaultCodes.createXMLDBException(e);
|
126 |
| } |
127 |
| } |
128 |
| |
129 |
| |
130 |
| |
131 |
| |
132 |
| |
133 |
| |
134 |
| |
135 |
| |
136 |
0
| public String getCanonicalName() throws XMLDBException {
|
137 |
0
| try {
|
138 |
0
| return ((XindiceCollection) coll).getCanonicalName();
|
139 |
| } catch (Exception e) { |
140 |
0
| throw FaultCodes.createXMLDBException(e);
|
141 |
| } |
142 |
| } |
143 |
| |
144 |
| |
145 |
| |
146 |
| |
147 |
| |
148 |
| |
149 |
| |
150 |
| |
151 |
| |
152 |
| |
153 |
| |
154 |
390
| public Collection createCollection(String path, Document configuration)
|
155 |
| throws XMLDBException { |
156 |
390
| if (coll == null) {
|
157 |
0
| throw new XMLDBException(ErrorCodes.INVALID_COLLECTION,
|
158 |
| "Must set collection for this service"); |
159 |
| } |
160 |
| |
161 |
390
| return ((XindiceCollection) coll).createCollection(path, configuration);
|
162 |
| } |
163 |
| |
164 |
| |
165 |
| |
166 |
| |
167 |
| |
168 |
| |
169 |
| |
170 |
387
| public void dropCollection(String name) throws XMLDBException {
|
171 |
387
| this.removeCollection(name);
|
172 |
| } |
173 |
| |
174 |
| |
175 |
| |
176 |
| |
177 |
| |
178 |
| |
179 |
| |
180 |
15
| public String[] listIndexers() throws XMLDBException {
|
181 |
15
| try {
|
182 |
15
| return ((XindiceCollection) coll).listIndexers();
|
183 |
| } catch (Exception e) { |
184 |
0
| throw FaultCodes.createXMLDBException(e);
|
185 |
| } |
186 |
| } |
187 |
| |
188 |
| |
189 |
| |
190 |
| |
191 |
| |
192 |
| |
193 |
| |
194 |
90
| public void createIndexer(Document configuration) throws XMLDBException {
|
195 |
90
| try {
|
196 |
90
| ((XindiceCollection) coll).createIndexer(configuration);
|
197 |
| } catch (Exception e) { |
198 |
12
| throw FaultCodes.createXMLDBException(e);
|
199 |
| } |
200 |
| } |
201 |
| |
202 |
| |
203 |
66
| public void dropIndexer(String name) throws XMLDBException {
|
204 |
66
| try {
|
205 |
66
| ((XindiceCollection) coll).dropIndexer(name);
|
206 |
| } catch (Exception e) { |
207 |
9
| throw FaultCodes.createXMLDBException(e);
|
208 |
| } |
209 |
| } |
210 |
| |
211 |
| |
212 |
| |
213 |
| |
214 |
| |
215 |
| |
216 |
0
| public void shutdown() throws XMLDBException {
|
217 |
0
| ((XindiceCollection) coll).shutdown();
|
218 |
| |
219 |
| } |
220 |
| |
221 |
| |
222 |
| |
223 |
| |
224 |
| |
225 |
| |
226 |
| |
227 |
| |
228 |
0
| public String[] listXMLObjects() throws XMLDBException {
|
229 |
0
| return null;
|
230 |
| } |
231 |
| |
232 |
| |
233 |
| |
234 |
| |
235 |
| |
236 |
| |
237 |
| |
238 |
| |
239 |
| |
240 |
0
| public void createXMLObject(Document configuration) throws XMLDBException {
|
241 |
| |
242 |
| } |
243 |
| |
244 |
| |
245 |
| |
246 |
| |
247 |
| |
248 |
| |
249 |
| |
250 |
0
| public void dropXMLObject(String name)
|
251 |
| throws XMLDBException { |
252 |
| |
253 |
| } |
254 |
| } |