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 at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * 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 and14 * limitations under the License.15 */1617packageorg.apache.jetspeed.cache.disk;
1819import java.io.*;
2021/***22<p>23A way to store remote documents locally. This can increase performance by 24eliminating TCP connection latency.25</p>2627<p>28All implementations of a DiskCache should implement this interface.29</p>3031@author <A HREF="mailto:burton@apache.org">Kevin A. Burton</A>32@author <a href="mailto:sgala@hisitech.com">Santiago Gala</a>33@version $Id: DiskCache.java,v 1.15 2004/02/23 02:45:29 jford Exp $34*/35publicinterfaceDiskCache {
3637/***38 <p>39 Take the given remove URL and place it in the disk cache. Additionaly 40 operations include building a DiskCacheEntry and then returning it.41 </p>4243 <p>getEntry may attempt to pull down the URL if it is not in the disk cache.44 Most implementations may provide support for changing this behavior so that45 you have to explicitly call add. This is done for performance reasons46 so that HTTP clients don't end up triggering a URL connection to fetch 47 the given URL.</p>4849 */50publicDiskCacheEntry getEntry( String url ) throws IOException;
5152/***53 <p>Get an Entry from the from the cache but force this URL to be fetched and54 then cached no matter what configuration options Jetspeed provides.5556 @see #getEntry( String url )57 */58publicDiskCacheEntry getEntry( String url,
59boolean force ) throws IOException;
6061/***62 Get a entry based on a URL but you should already have the content. This is63 usually used to specify an alternative Reader (maybe StringReader).6465 <p>getEntry may attempt to pull down the URL if it is not in the disk cache.66 Most implementations may provide support for changing this behavior so that67 you have to explicitly call add. This is done for performance reasons68 so that HTTP clients don't end up triggering a URL connection to fetch 69 the given URL.</p>7071 */72publicDiskCacheEntry getEntry( String url, Reader is ) throws IOException;
7374/***75 Get a list of all the documents within the cache...7677 */78publicDiskCacheEntry[] getEntries();
7980/***81 Add this URL to the disk cache8283 */84publicvoid add( String url ) throws IOException;
8586/***87 Remove this URL from the disk cache.8889 */90publicvoid remove( String url ) throws IOException;
919293/***94 Get the URL from the Internet and then place it in the File dest.9596 */97public String fetch( String url, String destination ) throws IOException ;
9899/***100 Return the root of this DiskCache.101102 */103public String getRoot();
104105/***106 Tell the DiskCache that this URL should be refreshed. This will do this in 107 a threaded and asynchronous manner.108109 */110publicvoid refresh( String url );
111112/***113 Ask if a url is in the DiskCache 114115 */116publicboolean isCached( String url );
117118 }