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.portals.applications.transform;
18  
19  import java.util.Comparator;
20  import java.util.Observer;
21  
22  
23  /***
24   * TransformCache
25   * 
26   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
27   * @version $Id: TransformCache.java 516448 2007-03-09 16:25:47Z ate $
28   */
29  public interface TransformCache extends Observer, Comparator
30  {
31      /***
32       * Get the maximum size of the cache 
33       *
34       * @return the current maximum size of the cache
35       */
36      public int getMaxSize();
37  
38      /***
39       * Set the new maximum size of the cache 
40       *
41       * @param maxSize the maximum size of the cache
42       */
43      public void setMaxSize(int maxSize);
44      
45      /***
46       * Get the eviction percentage of the cache 
47       *
48       * @return the eviction percentage of the cache
49       */
50      public int getEvictionPercentage();
51      
52      /***
53       * Find out if TransformCache is enables 
54       *
55       * @return the enable flag of the cache
56       */
57      public boolean isEnabled();
58  
59  
60      /***
61       * Put a value in the TransformCache keyed off with the TransformId and the
62       * DocumentId.
63       * @param key
64       * @param document
65       */
66      public void put(String key, Object document, long timeToLive);
67  
68      /***
69       * Remove a unique value keyed off with the TransformId and DocumentId from the
70       * cache.
71       * @param key
72       * @return Object
73       */
74      public Object remove(String key);
75  
76      /***
77       * Retrieve the unique TransformCacheEntry keyed off with key
78       * @param key
79       * @return TransformCacheEntry
80       */
81      public TransformCacheEntry get(String key);
82  
83      /***
84       * Retrieve the byte[] storing the transformed content for the transfomId
85       * and the documentId combination.
86       * @param transformId
87       * @param documentId
88       * @return Object
89       */
90      public Object getDocument(String key);
91  
92      /***
93       * Construct the key for the TransformDocumentTreeMap cache
94       * @return String
95       */
96      public String constructKey(String url, String stylesheet);
97  
98      
99      /***
100      * Clear the Transform Cache
101      */
102     public void clearCache();
103 
104 }