|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| |
|
19 |
| |
|
20 |
| package org.apache.xindice.core; |
|
21 |
| |
|
22 |
| import org.apache.xindice.core.data.Key; |
|
23 |
| import org.apache.xindice.core.data.Record; |
|
24 |
| import org.apache.xindice.util.Configuration; |
|
25 |
| |
|
26 |
| import org.w3c.dom.Document; |
|
27 |
| |
|
28 |
| import java.util.Map; |
|
29 |
| |
|
30 |
| |
|
31 |
| |
|
32 |
| |
|
33 |
| |
|
34 |
| |
|
35 |
| public abstract class DBObserver { |
|
36 |
| |
|
37 |
| private static final DBObserver NOOP = new DBObserver() { |
|
38 |
0
| public void setDatabaseConfig(Database db, Map collections, Configuration cfg) {
|
|
39 |
| } |
|
40 |
| |
|
41 |
0
| public void setCollectionConfig(Collection col, Configuration cfg) {
|
|
42 |
| } |
|
43 |
| |
|
44 |
0
| public void flushDatabaseConfig(Database db, Configuration cfg) {
|
|
45 |
| } |
|
46 |
| |
|
47 |
0
| public void dropCollection(Collection col) {
|
|
48 |
| } |
|
49 |
| |
|
50 |
0
| public void createCollection(Collection col) {
|
|
51 |
| } |
|
52 |
| |
|
53 |
0
| public void putDocument(Collection col, Key key, Document document, boolean create) {
|
|
54 |
| } |
|
55 |
| |
|
56 |
0
| public void loadDocument(Collection col, Record record, Document document) {
|
|
57 |
| } |
|
58 |
| |
|
59 |
0
| public void dropDocument(Collection col, Key key) {
|
|
60 |
| } |
|
61 |
| }; |
|
62 |
| |
|
63 |
| private static DBObserver instance = NOOP; |
|
64 |
| |
|
65 |
| |
|
66 |
| |
|
67 |
| |
|
68 |
19
| public static void setInstance(DBObserver obs) {
|
|
69 |
19
| instance = (null == obs) ? NOOP : obs;
|
|
70 |
| } |
|
71 |
| |
|
72 |
| |
|
73 |
| |
|
74 |
| |
|
75 |
52561
| public static DBObserver getInstance() {
|
|
76 |
52561
| return instance;
|
|
77 |
| } |
|
78 |
| |
|
79 |
| |
|
80 |
| |
|
81 |
| |
|
82 |
| public abstract void setDatabaseConfig(Database db, Map collections, Configuration cfg); |
|
83 |
| |
|
84 |
| |
|
85 |
| |
|
86 |
| |
|
87 |
| public abstract void setCollectionConfig(Collection col, Configuration cfg); |
|
88 |
| |
|
89 |
| |
|
90 |
| |
|
91 |
| |
|
92 |
| public abstract void flushDatabaseConfig(Database db, Configuration cfg); |
|
93 |
| |
|
94 |
| |
|
95 |
| |
|
96 |
| |
|
97 |
| public abstract void dropCollection(Collection col) throws DBException; |
|
98 |
| |
|
99 |
| |
|
100 |
| |
|
101 |
| |
|
102 |
| public abstract void createCollection(Collection col) throws DBException; |
|
103 |
| |
|
104 |
| |
|
105 |
| |
|
106 |
| |
|
107 |
| public abstract void putDocument(Collection col, Key key, Document document, boolean create) throws DBException; |
|
108 |
| |
|
109 |
| |
|
110 |
| |
|
111 |
| |
|
112 |
| public abstract void loadDocument(Collection col, Record record, Document document) throws DBException; |
|
113 |
| |
|
114 |
| |
|
115 |
| |
|
116 |
| |
|
117 |
| public abstract void dropDocument(Collection col, Key key) throws DBException; |
|
118 |
| } |