result.setRequestLocalOnly(isLocal(request, resourceStorePath)); result.setRequestRemoteOnly(parameterMap.containsKey(Constants.REQ_QP_IS_REMOTE_PARAMETER)); result.setRequestAsExpired(parameterMap.containsKey(Constants.REQ_QP_AS_EXPIRED_PARAMETER));
protected Collection<String> doEvictUnusedItems( ResourceStoreRequest request, final long timestamp, EvictUnusedItemsWalkerProcessor processor, WalkerFilter filter ) { getLogger().info( String.format( "Evicting unused items from proxy repository %s from path=\"%s\"", RepositoryStringUtils.getHumanizedNameString( this ), request.getRequestPath() ) ); request.setRequestLocalOnly( true ); DefaultWalkerContext ctx = new DefaultWalkerContext( this, request, filter ); ctx.getProcessors().add( processor ); // and let it loose try { getWalker().walk( ctx ); } catch ( WalkerException e ) { if ( !( e.getWalkerContext().getStopCause() instanceof ItemNotFoundException ) ) { // everything that is not ItemNotFound should be reported, // otherwise just neglect it throw e; } } return processor.getFiles(); }
private void copyIndexPropertiesToTempDir( Repository repository, File tempDir ) { InputStream is = null; try { // Need to use RepositoryUID to get around security ResourceStoreRequest req = new ResourceStoreRequest( "/.index/" + IndexingContext.INDEX_FILE + ".properties" ); req.setRequestLocalOnly( true ); StorageFileItem item = (StorageFileItem) repository.retrieveItem( true, req ); // Hack to make sure that group properties isn't retrieved from child repo if ( repository.getId().equals( item.getRepositoryId() ) ) { is = item.getInputStream(); // FileUtils.copyStreamToFile closes the stream! FileUtils.copyStreamToFile( new RawInputStreamFacade( is ), new File( tempDir, IndexingContext.INDEX_FILE + ".properties" ) ); } } catch ( Exception e ) { getLogger().debug( "Unable to copy index properties file, continuing without it", e ); } }
req.setRequestLocalOnly(true); try { artifactMappingsItem = (StorageFileItem) retrieveItem(true, req);
public void purge( final Repository repository, final long age ) throws IOException { ResourceStoreRequest req = new ResourceStoreRequest( getTrashPath( repository, RepositoryItemUid.PATH_ROOT ) ); // NEXUS-4642 shall not delete the directory, since causes a problem if this has been symlinked to another // directory. // walker and walk and changes for age if ( repository.getLocalStorage().containsItem( repository, req ) ) { req.setRequestGroupLocalOnly( true ); req.setRequestLocalOnly( true ); DefaultWalkerContext ctx = new DefaultWalkerContext( repository, req, new AffirmativeStoreWalkerFilter() ); ctx.getProcessors().add( new WastebasketWalker( age ) ); getWalker().walk( ctx ); } }
@Override protected ChecksumPolicy getChecksumPolicy(final ProxyRepository proxy, final AbstractStorageItem item) throws LocalStorageException { if (P2ProxyMetadataSource.isP2MetadataItem(item.getRepositoryItemUid().getPath())) { // the checksum is on metadata files return ChecksumPolicy.IGNORE; } if (!proxy.getRepositoryKind().isFacetAvailable(P2ProxyRepository.class)) { return ChecksumPolicy.IGNORE; } final P2ProxyRepository p2repo = proxy.adaptToFacet(P2ProxyRepository.class); final ChecksumPolicy checksumPolicy = p2repo.getChecksumPolicy(); if (checksumPolicy == null || !checksumPolicy.shouldCheckChecksum() || !(item instanceof DefaultStorageFileItem)) { // there is either no need to validate or we can't validate the item content return ChecksumPolicy.IGNORE; } final ResourceStoreRequest req = new ResourceStoreRequest(P2Constants.ARTIFACT_MAPPINGS_XML); req.setRequestLocalOnly(true); try { p2repo.retrieveItem(true, req); } catch (final Exception e) { // no way to calculate log.debug("Unable to find artifact-mapping.xml", e); return ChecksumPolicy.IGNORE; } return checksumPolicy; }
request.setRequestLocalOnly( true );
@Override public StorageItem call() throws IllegalOperationException, ItemNotFoundException, IOException { final ResourceStoreRequest newreq = new ResourceStoreRequest( getRequest() ); newreq.setRequestLocalOnly( getRequest().isRequestLocalOnly() ); newreq.setRequestRemoteOnly( getRequest().isRequestRemoteOnly() ); try { return getRepository().retrieveItem( false, newreq ); } finally { getRequest().addProcessedRepository( getRepository() ); } }
@Override public StorageItem call() throws ItemNotFoundException, IllegalOperationException, IOException, AccessDeniedException { final ResourceStoreRequest newreq = new ResourceStoreRequest( getRequest() ); newreq.setRequestLocalOnly( getRequest().isRequestLocalOnly() ); newreq.setRequestRemoteOnly( getRequest().isRequestRemoteOnly() ); StorageItem item = getRepository().retrieveItem( newreq ); getRequest().addProcessedRepository( getRepository() ); if ( item instanceof StorageCollectionItem ) { item = new DefaultStorageCollectionItem( groupRepository, newreq, true, false ); } return item; }
result.setRequestLocalOnly(isLocal(request, resourceStorePath)); result.setRequestRemoteOnly(isRemote(request, resourceStorePath)); result.setRequestAsExpired(asExpired(request, resourceStorePath));
result.setRequestLocalOnly( isLocal( request, resourceStorePath ) ); result.setRequestRemoteOnly( isRemote( request, resourceStorePath ) );