View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.jetspeed.decoration;
18  
19  /***
20   * Simple caching mechanism for storing pathed that were previously located
21   * by a <code>ResourceValidator</code>.  This allows a Decoration to bypass
22   * hitting the ResourceValidator repeatedly after a path is already known
23   * to exist. 
24   * 
25   * @author <href a="mailto:weaver@apache.org">Scott T. Weaver</a>
26   * 
27   * @see org.apache.jetspeed.decoration.ResourceValidator
28   *
29   */
30  public interface PathResolverCache
31  {
32      /***
33       * Adds a recolved <code>path</code> to the the cache using
34       * its relative path as the <code>key</code>
35       * @param key key relative path of the resource.
36       * @param path full path to resource
37       */
38      void addPath(String key, String path);
39      
40      /***
41       * Returns a previously located path using its retlative path
42       * as the <code>code</code>.
43       *  
44       * @param key relative path of the resource.
45       * @return full path to resource or <code>null</code> if no resource
46       * for the key exists.
47       */
48      String getPath(String key);
49      
50      /***
51       * Removes a full path to a resource from the cache using its
52       * relative path as the <code>key</code>.
53       * 
54       * @param key
55       * @return The full path to the resource or <code>null</code>
56       * if the resource path was not cached.
57       */
58      String removePath(String key);
59      
60      
61      /***
62       * Clears the entire contents of this cache object.
63       *
64       */
65      void clear();
66      
67  }