bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch//The MIT License
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch// Copyright (c) 2004 Evren Sirin
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch// Permission is hereby granted, free of charge, to any person obtaining a copy
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch// of this software and associated documentation files (the "Software"), to
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch// deal in the Software without restriction, including without limitation the
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch// sell copies of the Software, and to permit persons to whom the Software is
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch// furnished to do so, subject to the following conditions:
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch// The above copyright notice and this permission notice shall be included in
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch// all copies or substantial portions of the Software.
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
7b032348d7bbb93ff96188289d3dfc1899b9abb3Josef 'Jeff' Sipek// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch// IN THE SOFTWARE.
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch * Created on Dec 30, 2003
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch * @author Evren Sirin
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Boschpublic class OWLCacheImpl implements OWLCache {
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch protected Properties cache = new Properties();
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch * Forces the readers to use the cached copies of the files even if the remote
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch * file may be available. When the forcing of cache is enabled the reader will
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch * first check if the cached copy exists and then only try to use the remote file
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch * when there is no cached copy.
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch * Returns if the using of cache is forced.
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch * Sets the cache dir for the inference engine to find the cached files when a
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch * file cannot be downparseed from its original URL. The cache dir should include
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch * a file named service.idx. This index file is a text file where each line is in
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch * [service description url]=[local filename]
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch * The ':' characters in the url's should be escaped as "\:"
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch * @param dir sets the local cache directory. if null it forces not to use the cache.
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch * if the given dir or index file inthat dir does not exist then nothing is
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch public void setLocalCacheDirectory( String dir ) {
ea623e25e8d03cb1c28677f418d3dcd5729d09e1Stephan Bosch System.out.println("INFO: Local cache directory is disabled");
} catch(FileNotFoundException e) {
} catch(IOException e) {
return localCacheDirectory;
if (!silent)
catch(Exception e) {
return in;
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();