public URL getLocalURL(String location) throws IOException { if (isUpToDate(location)) { return local.getURL(location); } Map<String, Object> metadata = new HashMap<String, Object>(); InputStream is = remote.getContents(location, metadata); local.storeData(location, is, metadata); return local.getURL(location); }
public void flushCache() { try { local.flushAll(); } catch (IOException e) { logger.error("Error: ", e); } }
public boolean isUpToDate(String location) throws IOException { if (!hasLocal(location)) { return false; } long localMod = local.getLocalModificationDate(location); long remoteMod = remote.getRemoteModificationDate(location); if (localMod >= remoteMod) { return true; } return false; }
public boolean hasLocal(String location) throws IOException { return local.hasLocal(location); }