1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.kandula.storage;
18
19 import org.apache.axis2.context.ConfigurationContext;
20 import org.apache.kandula.Constants;
21
22 /***
23 * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
24 */
25 public class StorageFactory {
26 private static StorageFactory instance = new StorageFactory();
27
28 private ConfigurationContext configurationContext = null;
29
30 private Store clientStore = null;
31
32 private StorageFactory() {
33 }
34
35 public static StorageFactory getInstance() {
36 return instance;
37 }
38
39 public Store getStore() {
40 if (configurationContext == null)
41 return null;
42 Store store = (Store) configurationContext
43 .getProperty(Constants.KANDULA_STORE);
44 if (store == null) {
45 store = new SimpleStore();
46 configurationContext.setProperty(Constants.KANDULA_STORE, store);
47 }
48 return store;
49 }
50
51
52
53
54 public Store getInitiatorStore() {
55 if (clientStore == null) {
56 clientStore = new SimpleStore();
57 }
58 return clientStore;
59 }
60
61 public void setConfigurationContext(
62 ConfigurationContext configurationContext) {
63 this.configurationContext = configurationContext;
64 }
65
66
67
68
69 public ConfigurationContext getConfigurationContext() {
70 return configurationContext;
71 }
72 }