KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > velocity > runtime > resource > ResourceCache


1 package org.apache.velocity.runtime.resource;
2
3 /*
4  * Copyright 2000-2001,2004 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18
19 import java.util.Iterator JavaDoc;
20 import org.apache.velocity.runtime.RuntimeServices;
21
22 /**
23  * Interface that defines the shape of a pluggable resource cache
24  * for the included ResourceManager
25  *
26  * @author <a HREF="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
27  * @version $Id: ResourceCache.java,v 1.1.8.1 2004/03/03 23:23:01 geirm Exp $
28  */

29 public interface ResourceCache
30 {
31     /**
32      * initializes the ResourceCache. Will be
33      * called before any utilization
34      *
35      * @param rs RuntimeServices to use for logging, etc
36      */

37     public void initialize( RuntimeServices rs );
38     
39     /**
40      * retrieves a Resource from the
41      * cache
42      *
43      * @param resourceKey key for Resource to be retrieved
44      * @return Resource specified or null if not found
45      */

46     public Resource get( Object JavaDoc resourceKey );
47     
48     /**
49      * stores a Resource in the cache
50      *
51      * @param resourceKey key to associate with the Resource
52      * @param resource Resource to be stored
53      * @return existing Resource stored under this key, or null if none
54      */

55     public Resource put( Object JavaDoc resourceKey, Resource resource );
56  
57     /**
58      * removes a Resource from the cache
59      *
60      * @param resourceKey resource to be removed
61      * @param Resource stored under key
62      */

63     public Resource remove( Object JavaDoc resourceKey );
64     
65     /**
66      * returns an Iterator of Keys in the cache
67      */

68      public Iterator JavaDoc enumerateKeys();
69 }
70
Popular Tags