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.embed; |
21 |
| |
22 |
| import org.apache.xindice.client.xmldb.ResourceSetImpl; |
23 |
| import org.apache.xindice.client.xmldb.XindiceCollection; |
24 |
| import org.apache.xindice.client.xmldb.resources.BinaryResourceImpl; |
25 |
| import org.apache.xindice.client.xmldb.resources.XMLResourceImpl; |
26 |
| import org.apache.xindice.core.Collection; |
27 |
| import org.apache.xindice.core.DBException; |
28 |
| import org.apache.xindice.core.Database; |
29 |
| import org.apache.xindice.core.FaultCodes; |
30 |
| import org.apache.xindice.core.data.Entry; |
31 |
| import org.apache.xindice.core.data.NodeSet; |
32 |
| import org.apache.xindice.core.meta.MetaData; |
33 |
| import org.apache.xindice.core.query.QueryUtil; |
34 |
| import org.apache.xindice.util.Configuration; |
35 |
| import org.apache.xindice.xml.TextWriter; |
36 |
| import org.apache.xindice.xml.dom.DocumentImpl; |
37 |
| import org.w3c.dom.Document; |
38 |
| import org.w3c.dom.Element; |
39 |
| import org.w3c.dom.Node; |
40 |
| import org.xmldb.api.base.ErrorCodes; |
41 |
| import org.xmldb.api.base.Resource; |
42 |
| import org.xmldb.api.base.ResourceSet; |
43 |
| import org.xmldb.api.base.XMLDBException; |
44 |
| import org.xmldb.api.modules.BinaryResource; |
45 |
| import org.xmldb.api.modules.XMLResource; |
46 |
| |
47 |
| import java.util.Hashtable; |
48 |
| import java.util.StringTokenizer; |
49 |
| |
50 |
| |
51 |
| |
52 |
| |
53 |
| |
54 |
| |
55 |
| |
56 |
| |
57 |
| |
58 |
| public class CollectionImpl extends XindiceCollection { |
59 |
| |
60 |
| private Database db; |
61 |
| private Collection col; |
62 |
| |
63 |
| |
64 |
| |
65 |
| |
66 |
| |
67 |
| |
68 |
| |
69 |
| |
70 |
| |
71 |
| |
72 |
| |
73 |
2278
| public CollectionImpl(Database db, String collPath) throws XMLDBException {
|
74 |
2278
| super(collPath);
|
75 |
2278
| this.db = db;
|
76 |
| |
77 |
| |
78 |
2278
| String collName = "/";
|
79 |
2278
| int colIndex = collPath.indexOf('/', 1);
|
80 |
2278
| if (colIndex != -1) {
|
81 |
2268
| collName = collPath.substring(colIndex);
|
82 |
2268
| if (collName.equals("")) {
|
83 |
0
| collName = "/";
|
84 |
| } |
85 |
| } |
86 |
| |
87 |
2278
| try {
|
88 |
2278
| this.col = db.getCollection(collName);
|
89 |
| } catch (Exception e) { |
90 |
0
| throw FaultCodes.createXMLDBException(ErrorCodes.INVALID_COLLECTION,
|
91 |
| "Collection not available: " + collPath, e); |
92 |
| } |
93 |
| |
94 |
2278
| if (this.col == null) {
|
95 |
2
| throw new XMLDBException(ErrorCodes.NO_SUCH_COLLECTION,
|
96 |
| "Collection not found: " + collPath); |
97 |
| } |
98 |
| } |
99 |
| |
100 |
| |
101 |
| |
102 |
| |
103 |
| |
104 |
| |
105 |
| |
106 |
| |
107 |
| |
108 |
| |
109 |
| |
110 |
| |
111 |
| |
112 |
| |
113 |
356
| public Resource getResource(String id) throws XMLDBException {
|
114 |
| |
115 |
356
| checkOpen();
|
116 |
356
| try {
|
117 |
356
| Entry entry = col.getEntry(id);
|
118 |
356
| if (entry == null) {
|
119 |
14
| return null;
|
120 |
| } |
121 |
| |
122 |
342
| switch (entry.getEntryType()) {
|
123 |
338
| case Entry.DOCUMENT:
|
124 |
338
| DocumentImpl doc = (DocumentImpl) entry.getValue();
|
125 |
| |
126 |
| |
127 |
338
| if (doc.getDataBytes() == null) {
|
128 |
169
| return new XMLResourceImpl(id, id, this, TextWriter.toString(doc));
|
129 |
| } else { |
130 |
169
| return new XMLResourceImpl(id, id, this, doc.getSymbols(), doc.getDataBytes());
|
131 |
| } |
132 |
| |
133 |
4
| case Entry.BINARY:
|
134 |
4
| return new BinaryResourceImpl(id, this, (byte[]) entry.getValue());
|
135 |
| |
136 |
0
| default:
|
137 |
0
| throw new XMLDBException(ErrorCodes.UNKNOWN_RESOURCE_TYPE,
|
138 |
| "Internal error: Unexpected resource type " + entry.getEntryType()); |
139 |
| } |
140 |
| |
141 |
| } catch (Exception e) { |
142 |
0
| throw FaultCodes.createXMLDBException("Resource not available: " + id, e);
|
143 |
| } |
144 |
| } |
145 |
| |
146 |
| |
147 |
| |
148 |
| |
149 |
| |
150 |
| |
151 |
| |
152 |
| |
153 |
| |
154 |
| |
155 |
| |
156 |
| |
157 |
42
| public int getResourceCount() throws XMLDBException {
|
158 |
| |
159 |
42
| checkOpen();
|
160 |
42
| try {
|
161 |
42
| return (int) col.getDocumentCount();
|
162 |
| } catch (Exception e) { |
163 |
0
| throw FaultCodes.createXMLDBException(e);
|
164 |
| } |
165 |
| } |
166 |
| |
167 |
| |
168 |
| |
169 |
| |
170 |
| |
171 |
| |
172 |
| |
173 |
| |
174 |
| |
175 |
| |
176 |
| |
177 |
| |
178 |
| |
179 |
| |
180 |
| |
181 |
822
| public void storeResource(Resource res) throws XMLDBException {
|
182 |
822
| if (res.getContent() == null) {
|
183 |
0
| throw new XMLDBException(ErrorCodes.INVALID_RESOURCE, "No resource data");
|
184 |
| } |
185 |
| |
186 |
822
| checkOpen();
|
187 |
| |
188 |
822
| try {
|
189 |
822
| if (res instanceof XMLResource) {
|
190 |
814
| Node content = getXMLContent(res);
|
191 |
814
| if (res.getId() != null) {
|
192 |
814
| col.setDocument(res.getId(), (Document) content);
|
193 |
| } else { |
194 |
0
| String name = col.insertDocument((Document) content).toString();
|
195 |
0
| ((XMLResourceImpl) res).setId(name);
|
196 |
| } |
197 |
| |
198 |
8
| } else if (res instanceof BinaryResource) {
|
199 |
8
| byte[] bytes = getBinaryContent(res);
|
200 |
8
| if (res.getId() != null) {
|
201 |
8
| col.setBinary(res.getId(), bytes);
|
202 |
| } else { |
203 |
0
| String name = col.insertBinary(bytes).toString();
|
204 |
0
| ((BinaryResourceImpl) res).setId(name);
|
205 |
| } |
206 |
| |
207 |
| } else { |
208 |
0
| throw new XMLDBException(ErrorCodes.INVALID_RESOURCE,
|
209 |
| "Only XMLResource and BinaryResource supported"); |
210 |
| } |
211 |
| } catch (DBException e) { |
212 |
0
| throw FaultCodes.createXMLDBException(e.faultCode, e.getMessage(), e);
|
213 |
| } catch (XMLDBException e) { |
214 |
0
| throw e;
|
215 |
| } catch (Exception e) { |
216 |
0
| throw FaultCodes.createXMLDBException(ErrorCodes.INVALID_RESOURCE,
|
217 |
| "Invalid resource: " + res.getId(), e); |
218 |
| } |
219 |
| } |
220 |
| |
221 |
| |
222 |
| |
223 |
| |
224 |
| |
225 |
| |
226 |
| |
227 |
| |
228 |
| |
229 |
| |
230 |
| |
231 |
| |
232 |
| |
233 |
4
| public void insertResource(Resource res) throws XMLDBException {
|
234 |
4
| if (res.getContent() == null) {
|
235 |
0
| throw new XMLDBException(ErrorCodes.INVALID_RESOURCE, "No resource data");
|
236 |
| } |
237 |
| |
238 |
4
| checkOpen();
|
239 |
| |
240 |
4
| try {
|
241 |
4
| if (res instanceof BinaryResource) {
|
242 |
0
| byte[] bytes = getBinaryContent(res);
|
243 |
0
| if (res.getId() != null) {
|
244 |
0
| col.insertBinary(res.getId(), bytes);
|
245 |
| } else { |
246 |
0
| String name = col.insertBinary(bytes).toString();
|
247 |
0
| ((BinaryResourceImpl) res).setId(name);
|
248 |
| } |
249 |
4
| } else if (res instanceof XMLResource) {
|
250 |
4
| Node content = getXMLContent(res);
|
251 |
4
| if (res.getId() != null) {
|
252 |
4
| col.insertDocument(res.getId(), (Document) content);
|
253 |
| } else { |
254 |
0
| String name = col.insertDocument((Document) content).toString();
|
255 |
0
| ((XMLResourceImpl) res).setId(name);
|
256 |
| } |
257 |
| |
258 |
| } else { |
259 |
0
| throw new XMLDBException(ErrorCodes.INVALID_RESOURCE,
|
260 |
| "Only XMLResource and BinaryResource supported"); |
261 |
| } |
262 |
| } catch (DBException e) { |
263 |
2
| throw FaultCodes.createXMLDBException(e.faultCode, e.getMessage(), e);
|
264 |
| } catch (XMLDBException e) { |
265 |
0
| throw e;
|
266 |
| } catch (Exception e) { |
267 |
0
| throw FaultCodes.createXMLDBException(ErrorCodes.INVALID_RESOURCE,
|
268 |
| "Invalid resource: " + res.getId(), e); |
269 |
| } |
270 |
| } |
271 |
| |
272 |
| |
273 |
| |
274 |
| |
275 |
| |
276 |
| |
277 |
| |
278 |
| |
279 |
| |
280 |
| |
281 |
| |
282 |
| |
283 |
| |
284 |
4
| public void updateResource(Resource res) throws XMLDBException {
|
285 |
4
| if (res.getContent() == null) {
|
286 |
0
| throw new XMLDBException(ErrorCodes.INVALID_RESOURCE, "No resource data");
|
287 |
| } |
288 |
| |
289 |
4
| if (res.getId() == null) {
|
290 |
0
| throw new XMLDBException(ErrorCodes.INVALID_RESOURCE, "Resource must have valid ID.");
|
291 |
| } |
292 |
| |
293 |
4
| checkOpen();
|
294 |
| |
295 |
4
| try {
|
296 |
4
| if (res instanceof BinaryResource) {
|
297 |
0
| byte[] bytes = getBinaryContent(res);
|
298 |
0
| col.updateBinary(res.getId(), bytes);
|
299 |
| |
300 |
4
| } else if (res instanceof XMLResource) {
|
301 |
4
| Node content = getXMLContent(res);
|
302 |
4
| col.updateDocument(res.getId(), (Document) content);
|
303 |
| |
304 |
| } else { |
305 |
0
| throw new XMLDBException(ErrorCodes.INVALID_RESOURCE,
|
306 |
| "Only XMLResource and BinaryResource supported"); |
307 |
| } |
308 |
| } catch (DBException e) { |
309 |
2
| throw FaultCodes.createXMLDBException(e.faultCode, e.getMessage(), e);
|
310 |
| } catch (XMLDBException e) { |
311 |
0
| throw e;
|
312 |
| } catch (Exception e) { |
313 |
0
| throw FaultCodes.createXMLDBException(ErrorCodes.INVALID_RESOURCE,
|
314 |
| "Invalid resource: " + res.getId(), e); |
315 |
| } |
316 |
| } |
317 |
| |
318 |
8
| private byte[] getBinaryContent(Resource res) throws XMLDBException {
|
319 |
8
| Object content = res.getContent();
|
320 |
8
| byte[] bytes;
|
321 |
8
| if (content instanceof byte[]) {
|
322 |
8
| bytes = (byte[]) content;
|
323 |
| } else { |
324 |
0
| throw new XMLDBException(ErrorCodes.INVALID_RESOURCE,
|
325 |
| "The contents of a binary resource must have type byte[]."); |
326 |
| } |
327 |
8
| return bytes;
|
328 |
| } |
329 |
| |
330 |
822
| private Node getXMLContent(Resource res) throws XMLDBException {
|
331 |
822
| Node content = ((XMLResourceImpl) res).getContentAsDOM();
|
332 |
822
| if (content == null || !(content instanceof Document)) {
|
333 |
0
| throw new XMLDBException(ErrorCodes.INVALID_RESOURCE,
|
334 |
| "A resource must be a document in order to be stored."); |
335 |
| } |
336 |
822
| return content;
|
337 |
| } |
338 |
| |
339 |
| |
340 |
3228
| public boolean isOpen() {
|
341 |
3228
| return (col != null);
|
342 |
| } |
343 |
| |
344 |
| |
345 |
0
| public String getURI() {
|
346 |
0
| return "xmldb:" + DatabaseImpl.DRIVER_NAME + "://" + getCanonicalName();
|
347 |
| } |
348 |
| |
349 |
| |
350 |
| |
351 |
| |
352 |
| |
353 |
| |
354 |
| |
355 |
| |
356 |
| |
357 |
| |
358 |
| |
359 |
| |
360 |
| |
361 |
256
| public org.xmldb.api.base.Collection getChildCollection(String name) throws XMLDBException {
|
362 |
| |
363 |
256
| if (name.indexOf('/') != -1) {
|
364 |
2
| throw new XMLDBException(ErrorCodes.INVALID_COLLECTION,
|
365 |
| "Invalid collection: " + name); |
366 |
| } |
367 |
| |
368 |
254
| try {
|
369 |
254
| return new CollectionImpl(db, getCanonicalName() + "/" + name);
|
370 |
| } catch (XMLDBException e) { |
371 |
0
| if (e.errorCode == ErrorCodes.NO_SUCH_COLLECTION) {
|
372 |
| |
373 |
0
| return null;
|
374 |
| } |
375 |
0
| throw e;
|
376 |
| } catch (Exception e) { |
377 |
0
| throw FaultCodes.createXMLDBException(ErrorCodes.INVALID_COLLECTION,
|
378 |
| "Invalid collection: " + name, e); |
379 |
| } |
380 |
| } |
381 |
| |
382 |
| |
383 |
| |
384 |
| |
385 |
| |
386 |
| |
387 |
| |
388 |
| |
389 |
| |
390 |
| |
391 |
| |
392 |
8
| public String createId() throws XMLDBException {
|
393 |
| |
394 |
8
| checkOpen();
|
395 |
8
| return col.createNewOID().toString();
|
396 |
| } |
397 |
| |
398 |
| |
399 |
| |
400 |
| |
401 |
| |
402 |
| |
403 |
| |
404 |
| |
405 |
| |
406 |
| |
407 |
| |
408 |
| |
409 |
2
| public void close() throws XMLDBException {
|
410 |
2
| col = null;
|
411 |
| |
412 |
2
| db.flushConfig();
|
413 |
| } |
414 |
| |
415 |
| |
416 |
| |
417 |
| |
418 |
| |
419 |
| |
420 |
| |
421 |
| |
422 |
| |
423 |
| |
424 |
| |
425 |
| |
426 |
8
| public org.xmldb.api.base.Collection getParentCollection() throws XMLDBException {
|
427 |
| |
428 |
| |
429 |
8
| if (collPath.lastIndexOf("/") == 0) {
|
430 |
2
| return null;
|
431 |
| } |
432 |
| |
433 |
6
| try {
|
434 |
6
| return new CollectionImpl(db, collPath.substring(0, collPath.lastIndexOf('/')));
|
435 |
| } catch (XMLDBException e) { |
436 |
0
| if (e.errorCode == ErrorCodes.NO_SUCH_COLLECTION) {
|
437 |
| |
438 |
0
| return null;
|
439 |
| } |
440 |
0
| throw e;
|
441 |
| } |
442 |
| } |
443 |
| |
444 |
| |
445 |
| |
446 |
| |
447 |
| |
448 |
| |
449 |
| |
450 |
| |
451 |
| |
452 |
| |
453 |
| |
454 |
| |
455 |
| |
456 |
| |
457 |
| |
458 |
310
| public void removeResource(Resource res) throws XMLDBException {
|
459 |
| |
460 |
310
| if (res == null || res.getId() == null || res.getId().length() == 0) {
|
461 |
| |
462 |
6
| throw new XMLDBException(ErrorCodes.INVALID_RESOURCE,
|
463 |
| "Resource passed is null or its ID is empty."); |
464 |
| } |
465 |
| |
466 |
304
| checkOpen();
|
467 |
304
| try {
|
468 |
304
| col.remove(res.getId());
|
469 |
| } catch (Exception e) { |
470 |
0
| throw FaultCodes.createXMLDBException(e);
|
471 |
| } |
472 |
| } |
473 |
| |
474 |
| |
475 |
| |
476 |
| |
477 |
| |
478 |
| |
479 |
| |
480 |
| |
481 |
| |
482 |
| |
483 |
| |
484 |
| |
485 |
| |
486 |
| |
487 |
10
| public String[] listChildCollections() throws XMLDBException {
|
488 |
| |
489 |
10
| checkOpen();
|
490 |
10
| try {
|
491 |
10
| return col.listCollections();
|
492 |
| } catch (Exception e) { |
493 |
0
| throw FaultCodes.createXMLDBException(e);
|
494 |
| } |
495 |
| } |
496 |
| |
497 |
| |
498 |
| |
499 |
| |
500 |
| |
501 |
| |
502 |
| |
503 |
| |
504 |
| |
505 |
| |
506 |
| |
507 |
| |
508 |
12
| public int getChildCollectionCount() throws XMLDBException {
|
509 |
| |
510 |
12
| checkOpen();
|
511 |
12
| try {
|
512 |
12
| return (int) col.countCollections();
|
513 |
| } catch (Exception e) { |
514 |
0
| throw FaultCodes.createXMLDBException(e);
|
515 |
| } |
516 |
| } |
517 |
| |
518 |
| |
519 |
| |
520 |
| |
521 |
| |
522 |
| |
523 |
| |
524 |
| |
525 |
| |
526 |
| |
527 |
| |
528 |
| |
529 |
14
| public String[] listResources() throws XMLDBException {
|
530 |
| |
531 |
14
| checkOpen();
|
532 |
14
| try {
|
533 |
14
| return col.listDocuments();
|
534 |
| } catch (Exception e) { |
535 |
0
| throw FaultCodes.createXMLDBException(e);
|
536 |
| } |
537 |
| } |
538 |
| |
539 |
| |
540 |
238
| public ResourceSet query(String name, String queryLang, String query, Hashtable nsMap) throws XMLDBException {
|
541 |
| |
542 |
238
| checkOpen();
|
543 |
238
| try {
|
544 |
238
| NodeSet nodeSet;
|
545 |
238
| if (name != null) {
|
546 |
4
| nodeSet = col.queryDocument(queryLang, query, QueryUtil.mapNamespaces(nsMap), name);
|
547 |
| } else { |
548 |
234
| nodeSet = col.queryCollection(queryLang, query, QueryUtil.mapNamespaces(nsMap));
|
549 |
| } |
550 |
| |
551 |
238
| return new ResourceSetImpl(this, QueryUtil.queryResultsToDOM(nodeSet));
|
552 |
| } catch (Exception e) { |
553 |
0
| throw FaultCodes.createXMLDBException(FaultCodes.QRY_PROCESSING_ERROR,
|
554 |
| "Query error: " + e.getMessage(), e); |
555 |
| } |
556 |
| } |
557 |
| |
558 |
| |
559 |
0
| public org.xmldb.api.base.Collection createCollection(String name) throws XMLDBException {
|
560 |
| |
561 |
0
| checkOpen();
|
562 |
0
| try {
|
563 |
0
| Document doc = new DocumentImpl();
|
564 |
| |
565 |
0
| Element colEle = doc.createElement("collection");
|
566 |
0
| colEle.setAttribute("compressed", "true");
|
567 |
0
| colEle.setAttribute("name", name);
|
568 |
0
| doc.appendChild(colEle);
|
569 |
| |
570 |
0
| Element filEle = doc.createElement("filer");
|
571 |
0
| filEle.setAttribute("class", "org.apache.xindice.core.filer.BTreeFiler");
|
572 |
0
| colEle.appendChild(filEle);
|
573 |
| |
574 |
0
| return createCollection(name, doc);
|
575 |
| } catch (Exception e) { |
576 |
0
| throw FaultCodes.createXMLDBException(ErrorCodes.INVALID_COLLECTION,
|
577 |
| FaultCodes.GEN_UNKNOWN, |
578 |
| "Cannot create child collection", e); |
579 |
| } |
580 |
| } |
581 |
| |
582 |
| |
583 |
260
| public org.xmldb.api.base.Collection createCollection(String path, Document configuration) throws XMLDBException {
|
584 |
260
| checkOpen();
|
585 |
260
| try {
|
586 |
260
| Configuration config = new Configuration(configuration.getDocumentElement(), false);
|
587 |
260
| col.createCollection(path, config);
|
588 |
| |
589 |
| |
590 |
252
| org.xmldb.api.base.Collection col = this;
|
591 |
252
| if (path.indexOf("/") != -1) {
|
592 |
2
| StringTokenizer st = new StringTokenizer(path, "/");
|
593 |
4
| while (col != null && st.hasMoreTokens()) {
|
594 |
4
| path = st.nextToken().trim();
|
595 |
4
| if (path.length() == 0) {
|
596 |
0
| continue;
|
597 |
| } |
598 |
| |
599 |
4
| if (st.hasMoreTokens()) {
|
600 |
2
| col = col.getChildCollection(path);
|
601 |
| } else { |
602 |
2
| break;
|
603 |
| } |
604 |
| } |
605 |
| } |
606 |
| |
607 |
252
| return col.getChildCollection(path);
|
608 |
| } catch (Exception e) { |
609 |
8
| throw FaultCodes.createXMLDBException(ErrorCodes.INVALID_COLLECTION,
|
610 |
| FaultCodes.GEN_UNKNOWN, |
611 |
| "Cannot create child collection", e); |
612 |
| } |
613 |
| } |
614 |
| |
615 |
| |
616 |
258
| public void removeCollection(String childName) throws XMLDBException {
|
617 |
| |
618 |
258
| if (null == childName || childName.length() == 0) {
|
619 |
4
| throw new XMLDBException(ErrorCodes.NO_SUCH_COLLECTION,
|
620 |
| FaultCodes.COL_COLLECTION_NOT_FOUND, |
621 |
| "Cannot remove child collection '" + childName + "': Name is empty"); |
622 |
| } |
623 |
| |
624 |
254
| checkOpen();
|
625 |
254
| try {
|
626 |
254
| col.dropCollection(col.getCollection(childName));
|
627 |
| } catch (Exception e) { |
628 |
4
| throw FaultCodes.createXMLDBException(ErrorCodes.INVALID_COLLECTION,
|
629 |
| FaultCodes.GEN_UNKNOWN, |
630 |
| "Cannot remove child collection '" + childName + "'", e); |
631 |
| } |
632 |
| } |
633 |
| |
634 |
| |
635 |
10
| public String[] listIndexers() throws XMLDBException {
|
636 |
10
| checkOpen();
|
637 |
10
| try {
|
638 |
10
| return col.listIndexers();
|
639 |
| } catch (Exception e) { |
640 |
0
| throw FaultCodes.createXMLDBException(e);
|
641 |
| } |
642 |
| } |
643 |
| |
644 |
| |
645 |
60
| public void createIndexer(Document configuration) throws XMLDBException {
|
646 |
60
| checkOpen();
|
647 |
60
| try {
|
648 |
60
| col.createIndexer(new Configuration(configuration, false));
|
649 |
| } catch (Exception e) { |
650 |
8
| throw FaultCodes.createXMLDBException(e);
|
651 |
| } |
652 |
| } |
653 |
| |
654 |
| |
655 |
44
| public void dropIndexer(String name) throws XMLDBException {
|
656 |
44
| checkOpen();
|
657 |
44
| try {
|
658 |
44
| col.dropIndexer(col.getIndexer(name));
|
659 |
| } catch (Exception e) { |
660 |
6
| throw FaultCodes.createXMLDBException(e);
|
661 |
| } |
662 |
| } |
663 |
| |
664 |
| |
665 |
0
| public void shutdown() throws XMLDBException {
|
666 |
0
| try {
|
667 |
0
| db.close();
|
668 |
| } catch (Exception e) { |
669 |
0
| throw FaultCodes.createXMLDBException(e);
|
670 |
| } |
671 |
| } |
672 |
| |
673 |
36
| public MetaData getMetaData(String id) throws XMLDBException {
|
674 |
36
| try {
|
675 |
36
| if (id == null) {
|
676 |
14
| return col.getCollectionMeta();
|
677 |
| } else { |
678 |
22
| return col.getDocumentMeta(id);
|
679 |
| } |
680 |
| } catch (Exception e) { |
681 |
0
| throw FaultCodes.createXMLDBException(e);
|
682 |
| } |
683 |
| } |
684 |
| |
685 |
12
| public void setMetaData(String id, MetaData meta) throws XMLDBException {
|
686 |
12
| try {
|
687 |
12
| if (id == null) {
|
688 |
4
| col.setCollectionMeta(meta);
|
689 |
| } else { |
690 |
8
| col.setDocumentMeta(id, meta);
|
691 |
| } |
692 |
| } catch (Exception e) { |
693 |
0
| throw FaultCodes.createXMLDBException(e);
|
694 |
| } |
695 |
| } |
696 |
| } |