private void mirrorRelativeItem( ResourceStoreRequest remoteRequest, ResourceStoreRequest localRequest, Set<String> mirrored) throws StorageException, IllegalOperationException, ItemNotFoundException { AbstractStorageItem item = (AbstractStorageItem) retrieveItem(true, remoteRequest); // cerating update sites may not name there jars as we expect, // if thats the case, download as they request, but store in local storage normalized, this // of course means updating the mirrored list so the file isn't deleted upon completion of // mirror process if (localRequest != null) { if (!mirrored.contains(localRequest.getRequestPath())) { mirrored.remove(remoteRequest.getRequestPath()); mirrored.add(localRequest.getRequestPath()); } // update the uid item.setRepositoryItemUid(createUid(localRequest.getRequestPath())); // update the resource store request item.setResourceStoreRequest(localRequest); // cache locally doCacheItem(item); } }
/** * Mirror an absolute item (plugin or feature) will retrieve from remote request, and store in * local request * * @param absoluteUrl * @param remoteStoreRequest * @param basePath * @param localStoreRequest * @return * @throws RemoteAccessException * @throws StorageException * @throws ItemNotFoundException */ private File mirrorAbsoluteItem( String absoluteUrl, ResourceStoreRequest remoteStoreRequest, String basePath, ResourceStoreRequest localStoreRequest, Set<String> mirrored) throws RemoteAccessException, StorageException, ItemNotFoundException { // chop off the baseDir from the request, as we only care about the file in this case remoteStoreRequest.pushRequestPath( remoteStoreRequest.getRequestPath().substring(basePath.length())); // we need to chop it up here to remove filename from url, as that is in request AbstractStorageItem item = getRemoteStorage().retrieveItem(this, remoteStoreRequest, absoluteUrl); // now put the basePath back on remoteStoreRequest.popRequestPath(); if (localStoreRequest == null) { localStoreRequest = remoteStoreRequest; } else { // update the list of what we have mirrored, since we have changed filename if (!mirrored.contains(localStoreRequest.getRequestPath())) { mirrored.remove(remoteStoreRequest.getRequestPath()); mirrored.add(localStoreRequest.getRequestPath()); } // update the uid item.setRepositoryItemUid(createUid(localStoreRequest.getRequestPath())); // update the resource store request item.setResourceStoreRequest(localStoreRequest); } // cache locally doCacheItem(item); return getLocalStorage().getFileFromBase(this, localStoreRequest); }