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 |
| |
25 |
| import org.xmldb.api.base.Collection; |
26 |
| import org.xmldb.api.base.ResourceSet; |
27 |
| import org.xmldb.api.base.Service; |
28 |
| import org.xmldb.api.base.XMLDBException; |
29 |
| |
30 |
| import java.util.Hashtable; |
31 |
| |
32 |
| |
33 |
| |
34 |
| |
35 |
| |
36 |
| |
37 |
| |
38 |
| |
39 |
| |
40 |
| |
41 |
| |
42 |
| public abstract class QueryService extends CommonConfigurable implements Service { |
43 |
| |
44 |
| |
45 |
| protected String queryLang; |
46 |
| |
47 |
| |
48 |
| Collection collection; |
49 |
| |
50 |
| |
51 |
| Hashtable nsMap = new Hashtable(); |
52 |
| |
53 |
10254
| public String getVersion() {
|
54 |
| |
55 |
10254
| return "1.0";
|
56 |
| } |
57 |
| |
58 |
10254
| public String getName() {
|
59 |
| |
60 |
10254
| return queryLang + "QueryService";
|
61 |
| } |
62 |
| |
63 |
10254
| public void setCollection(Collection collection) {
|
64 |
| |
65 |
10254
| this.collection = collection;
|
66 |
| } |
67 |
| |
68 |
6
| public ResourceSet queryResource(String name, String query)
|
69 |
| throws XMLDBException { |
70 |
| |
71 |
6
| return ((XindiceCollection) collection).query(name, queryLang, query, nsMap);
|
72 |
| } |
73 |
| |
74 |
0
| public void clearNamespaces() {
|
75 |
| |
76 |
0
| nsMap.clear();
|
77 |
| } |
78 |
| |
79 |
0
| public String getNamespace(String prefix) {
|
80 |
| |
81 |
0
| return (String) nsMap.get(prefix);
|
82 |
| } |
83 |
| |
84 |
9
| public void setNamespace(String prefix, String namespaceURI) {
|
85 |
| |
86 |
9
| nsMap.put(prefix, namespaceURI);
|
87 |
| } |
88 |
| |
89 |
351
| public ResourceSet query(String query) throws XMLDBException {
|
90 |
| |
91 |
351
| return ((XindiceCollection) collection).query(queryLang, query, nsMap);
|
92 |
| } |
93 |
| |
94 |
0
| public void removeNamespace(String prefix) throws XMLDBException {
|
95 |
| |
96 |
0
| nsMap.remove(prefix);
|
97 |
| } |
98 |
| |
99 |
| } |