View Javadoc

1   /*
2    * Copyright 2000-2001,2004 The Apache Software Foundation.
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 org.apache.jetspeed.cache.disk;
18   
19  import java.io.*;
20  
21  /***
22  Interface for a DiskCacheEntry.
23  
24  @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
25  @version $Id: DiskCacheEntry.java,v 1.9 2004/02/23 02:45:29 jford Exp $
26  */
27  public interface DiskCacheEntry {
28  
29      /***
30      Get the URL that was cached.
31      
32      @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
33      @version $Id: DiskCacheEntry.java,v 1.9 2004/02/23 02:45:29 jford Exp $
34      */
35      public String getURL();
36      
37      /***
38      Get the original URL this came from
39      
40      @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
41      @version $Id: DiskCacheEntry.java,v 1.9 2004/02/23 02:45:29 jford Exp $
42      */
43      public String getSourceURL();
44  
45      /***
46      Get a File which is representative of this item in the cache
47      @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
48      @version $Id: DiskCacheEntry.java,v 1.9 2004/02/23 02:45:29 jford Exp $
49      @deprecated 
50      @use We should use getInputStream (preferred) or getData instead
51      */
52      public File getFile();
53  
54      /***
55      Get the contents/data of this URL
56      
57      @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
58      @version $Id: DiskCacheEntry.java,v 1.9 2004/02/23 02:45:29 jford Exp $
59      */
60      public String getData() throws IOException;
61  
62      /***
63      Get an InputStream for this Entry.
64  
65      @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
66      @version $Id: DiskCacheEntry.java,v 1.9 2004/02/23 02:45:29 jford Exp $
67      */
68      public InputStream getInputStream() throws IOException;
69  
70      /***
71      Get a Reader for this Entry.
72      It should take into account the character encoding.
73  
74      @author <a href="mailto:sgala@hisitech.com">Santiago Gala</a>
75      @version $Id: DiskCacheEntry.java,v 1.9 2004/02/23 02:45:29 jford Exp $
76      */
77      public Reader getReader() throws IOException;
78      
79      /***
80      Get a Writer to update  this Entry.
81      It should take into account the character encoding.
82  	It will throw an exception if the entry is not writable
83  
84      @author <a href="mailto:sgala@hisitech.com">Santiago Gala</a>
85      @version $Id: DiskCacheEntry.java,v 1.9 2004/02/23 02:45:29 jford Exp $
86      */
87      public Writer getWriter() throws IOException;
88      
89      /***
90      Get  the lastModified date of this  DiskCacheEntry
91      @author <a href="mailto:sgala@hisitech.com">Santiago Gala</a>
92      @version $Id: DiskCacheEntry.java,v 1.9 2004/02/23 02:45:29 jford Exp $
93      */
94      public long getLastModified();
95  
96      /***
97      Set  the lastModified date of this  DiskCacheEntry
98      @author <a href="mailto:sgala@hisitech.com">Santiago Gala</a>
99      @version $Id: DiskCacheEntry.java,v 1.9 2004/02/23 02:45:29 jford Exp $
100     */
101     public void setLastModified(long time);
102 
103     /***
104     Get the expiration time of this  DiskCacheEntry
105     @author <a href="mailto:sgala@hisitech.com">Santiago Gala</a>
106     @version $Id: DiskCacheEntry.java,v 1.9 2004/02/23 02:45:29 jford Exp $
107     */
108     public long getExpirationTime();
109 
110     /***
111     Set the expiration time of this  DiskCacheEntry
112     @author <a href="mailto:sgala@hisitech.com">Santiago Gala</a>
113     @version $Id: DiskCacheEntry.java,v 1.9 2004/02/23 02:45:29 jford Exp $
114     */
115     public void setExpirationTime(long time);
116 
117     /***
118     Test if the entry is expired
119     @author <a href="mailto:sgala@hisitech.com">Santiago Gala</a>
120     @version $Id: DiskCacheEntry.java,v 1.9 2004/02/23 02:45:29 jford Exp $
121     */
122     public boolean hasExpired();
123 
124     /***
125     Test if the entry is a Local (fake) disk cache entry
126     @author <a href="mailto:sgala@hisitech.com">Santiago Gala</a>
127     @version $Id: DiskCacheEntry.java,v 1.9 2004/02/23 02:45:29 jford Exp $
128     */
129     public boolean isLocal();
130 
131 }
132