01: package org.apache.velocity.runtime.resource;
02:
03: /*
04: * Licensed to the Apache Software Foundation (ASF) under one
05: * or more contributor license agreements. See the NOTICE file
06: * distributed with this work for additional information
07: * regarding copyright ownership. The ASF licenses this file
08: * to you under the Apache License, Version 2.0 (the
09: * "License"); you may not use this file except in compliance
10: * with the License. You may obtain a copy of the License at
11: *
12: * http://www.apache.org/licenses/LICENSE-2.0
13: *
14: * Unless required by applicable law or agreed to in writing,
15: * software distributed under the License is distributed on an
16: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17: * KIND, either express or implied. See the License for the
18: * specific language governing permissions and limitations
19: * under the License.
20: */
21:
22: import java.util.Iterator;
23: import org.apache.velocity.runtime.RuntimeServices;
24:
25: /**
26: * Interface that defines the shape of a pluggable resource cache
27: * for the included ResourceManager
28: *
29: * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
30: * @version $Id: ResourceCache.java 463298 2006-10-12 16:10:32Z henning $
31: */
32: public interface ResourceCache {
33: /**
34: * initializes the ResourceCache. Will be
35: * called before any utilization
36: *
37: * @param rs RuntimeServices to use for logging, etc
38: */
39: public void initialize(RuntimeServices rs);
40:
41: /**
42: * retrieves a Resource from the
43: * cache
44: *
45: * @param resourceKey key for Resource to be retrieved
46: * @return Resource specified or null if not found
47: */
48: public Resource get(Object resourceKey);
49:
50: /**
51: * stores a Resource in the cache
52: *
53: * @param resourceKey key to associate with the Resource
54: * @param resource Resource to be stored
55: * @return existing Resource stored under this key, or null if none
56: */
57: public Resource put(Object resourceKey, Resource resource);
58:
59: /**
60: * removes a Resource from the cache
61: *
62: * @param resourceKey resource to be removed
63: * @return stored under key
64: */
65: public Resource remove(Object resourceKey);
66:
67: /**
68: * returns an Iterator of Keys in the cache.
69: * @return An Iterator of Keys in the cache.
70: */
71: public Iterator enumerateKeys();
72: }
|