KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > cache > loader > AbstractDelegatingCacheLoader


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.cache.loader;
8
9 import org.jboss.cache.CacheSPI;
10 import org.jboss.cache.Fqn;
11 import org.jboss.cache.Modification;
12 import org.jboss.cache.RegionManager;
13 import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
14
15 import java.io.ObjectInputStream JavaDoc;
16 import java.io.ObjectOutputStream JavaDoc;
17 import java.util.List JavaDoc;
18 import java.util.Map JavaDoc;
19 import java.util.Set JavaDoc;
20
21 /**
22  * AbstractDelegatingCacheLoader provides standard functionality for a cache loader that simply delegates each
23  * operation defined in the cache loader interface to the underlying cache loader, basically acting as a proxy to the
24  * real cache loader.
25  * <p/>
26  * Any cache loader implementation that extends this class would be required to override any of the methods in
27  * order to provide a different or added behaviour.
28  *
29  * @author <a HREF="mailto:galder.zamarreno@jboss.com">Galder Zamarreno</a>
30  */

31 public abstract class AbstractDelegatingCacheLoader extends AbstractCacheLoader
32 {
33    private CacheLoader cacheLoader;
34
35    public AbstractDelegatingCacheLoader(CacheLoader cl)
36    {
37       cacheLoader = cl;
38    }
39
40    public CacheLoader getCacheLoader()
41    {
42       return cacheLoader;
43    }
44
45    public void setCacheLoader(CacheLoader cacheLoader)
46    {
47       this.cacheLoader = cacheLoader;
48    }
49
50    public void setConfig(IndividualCacheLoaderConfig config)
51    {
52       cacheLoader.setConfig(config);
53    }
54
55    public IndividualCacheLoaderConfig getConfig()
56    {
57       return cacheLoader.getConfig();
58    }
59
60    public void setCache(CacheSPI c)
61    {
62       super.setCache(c);
63       cacheLoader.setCache(c);
64    }
65
66    public Set JavaDoc getChildrenNames(Fqn fqn) throws Exception JavaDoc
67    {
68       return cacheLoader.getChildrenNames(fqn);
69    }
70
71    public Map JavaDoc get(Fqn name) throws Exception JavaDoc
72    {
73       return cacheLoader.get(name);
74    }
75
76    public boolean exists(Fqn name) throws Exception JavaDoc
77    {
78       return cacheLoader.exists(name);
79    }
80
81    public Object JavaDoc put(Fqn name, Object JavaDoc key, Object JavaDoc value) throws Exception JavaDoc
82    {
83       return cacheLoader.put(name, key, value);
84    }
85
86    public void put(Fqn name, Map JavaDoc attributes) throws Exception JavaDoc
87    {
88       cacheLoader.put(name, attributes);
89    }
90
91    public void put(List JavaDoc<Modification> modifications) throws Exception JavaDoc
92    {
93       cacheLoader.put(modifications);
94    }
95
96    public Object JavaDoc remove(Fqn fqn, Object JavaDoc key) throws Exception JavaDoc
97    {
98       return cacheLoader.remove(fqn, key);
99    }
100
101    public void remove(Fqn fqn) throws Exception JavaDoc
102    {
103       cacheLoader.remove(fqn);
104    }
105
106    public void removeData(Fqn fqn) throws Exception JavaDoc
107    {
108       cacheLoader.removeData(fqn);
109    }
110
111    public void prepare(Object JavaDoc tx, List JavaDoc<Modification> modifications, boolean one_phase) throws Exception JavaDoc
112    {
113       cacheLoader.prepare(tx, modifications, one_phase);
114    }
115
116    public void commit(Object JavaDoc tx) throws Exception JavaDoc
117    {
118       cacheLoader.commit(tx);
119    }
120
121    public void rollback(Object JavaDoc tx)
122    {
123       cacheLoader.rollback(tx);
124    }
125
126    public void loadEntireState(ObjectOutputStream JavaDoc os) throws Exception JavaDoc
127    {
128       cacheLoader.loadEntireState(os);
129    }
130
131    public void storeEntireState(ObjectInputStream JavaDoc is) throws Exception JavaDoc
132    {
133       cacheLoader.storeEntireState(is);
134    }
135
136    public void loadState(Fqn subtree, ObjectOutputStream JavaDoc os) throws Exception JavaDoc
137    {
138       cacheLoader.loadState(subtree, os);
139    }
140
141    public void storeState(Fqn subtree, ObjectInputStream JavaDoc is) throws Exception JavaDoc
142    {
143       cacheLoader.storeState(subtree, is);
144    }
145
146    public void setRegionManager(RegionManager manager)
147    {
148       cacheLoader.setRegionManager(manager);
149    }
150
151    public void create() throws Exception JavaDoc
152    {
153       cacheLoader.create();
154    }
155
156    public void start() throws Exception JavaDoc
157    {
158       cacheLoader.start();
159    }
160
161    public void stop()
162    {
163       cacheLoader.stop();
164    }
165
166    public void destroy()
167    {
168       cacheLoader.destroy();
169    }
170 }
171
Popular Tags