1 /***
2 * Copyright 2003-2010 Terracotta, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package net.sf.ehcache.loader;
18
19 import net.sf.ehcache.CacheException;
20 import net.sf.ehcache.Ehcache;
21 import net.sf.ehcache.Status;
22
23 import java.util.Collection;
24 import java.util.Map;
25 import java.util.Properties;
26
27
28 /***
29 * Written for Dead-lock poc
30 *
31 * @author <a href="mailto:gluck@gregluck.com">Greg Luck</a>
32 * @version $Id: BaseComponentLoader.html 13146 2011-08-01 17:12:39Z oletizi $
33 */
34 public class BaseComponentLoader extends CacheLoaderFactory implements CacheLoader {
35
36 /***
37 *
38 */
39 protected Properties props;
40
41 /***
42 * Create a cache loader
43 */
44 public CacheLoader createCacheLoader(Map arg0) {
45 Properties p = new Properties();
46 p.putAll(arg0);
47 return createCacheLoader(p);
48 }
49
50 /***
51 * create a ehCache Cache loader
52 */
53 public net.sf.ehcache.loader.CacheLoader createCacheLoader(Ehcache cache, Properties properties) {
54 this.props = properties;
55 return this;
56 }
57
58 /***
59 * @param arg0
60 * @return
61 * @throws CacheException
62 */
63 public Object load(Object arg0) throws CacheException {
64 return load(arg0, null);
65 }
66
67 /***
68 * @param arg0
69 * @param argument
70 * @return
71 * @throws CacheException
72 */
73 public Object load(Object arg0, Object argument) throws CacheException {
74 throw new UnsupportedOperationException("Method not implemented");
75 }
76
77 /***
78 * @param keys
79 * @return
80 * @throws CacheException
81 */
82 public Map loadAll(Collection keys) throws CacheException {
83 return loadAll(keys, null);
84 }
85
86 /***
87 * @param keys
88 * @param argument
89 * @return
90 * @throws CacheException
91 */
92 public Map loadAll(Collection keys, Object argument) throws CacheException {
93 throw new UnsupportedOperationException("Method not implemented");
94 }
95
96 /***
97 * Gets the name of a CacheLoader
98 *
99 * @return the name of this CacheLoader
100 */
101 public String getName() {
102 return null;
103 }
104
105 /***
106 * Creates a clone of this extension. This method will only be called by ehcache before a
107 * cache is initialized.
108 * <p/>
109 * Implementations should throw CloneNotSupportedException if they do not support clone
110 * but that will stop them from being used with defaultCache.
111 *
112 * @return a clone
113 * @throws CloneNotSupportedException if the extension could not be cloned.
114 */
115 public CacheLoader clone(Ehcache cache) throws CloneNotSupportedException {
116 return null;
117 }
118
119 /***
120 * Notifies providers to initialise themselves.
121 * <p/>
122 * This method is called during the Cache's initialise method after it has changed it's
123 * status to alive. Cache operations are legal in this method.
124 *
125 * @throws net.sf.ehcache.CacheException
126 */
127 public void init() {
128
129 }
130
131 /***
132 * Providers may be doing all sorts of exotic things and need to be able to clean up on
133 * dispose.
134 * <p/>
135 * Cache operations are illegal when this method is called. The cache itself is partly
136 * disposed when this method is called.
137 *
138 * @throws net.sf.ehcache.CacheException
139 */
140 public void dispose() throws net.sf.ehcache.CacheException {
141
142 }
143
144 /***
145 * @return the status of the extension
146 */
147 public Status getStatus() {
148 return null;
149 }
150
151 }