/** * Instantiates a new abstract storage item. */ public AbstractStorageItem( final ResourceStoreRequest request, final boolean readable, final boolean writable ) { this(); this.request = request; this.context.setParentContext( request.getRequestContext() ); setPath( request.getRequestPath() ); setReadable( readable ); setWritable( writable ); setCreated( System.currentTimeMillis() ); setModified( getCreated() ); }
public String toString() { if ( isVirtual() ) { return getPath(); } else { return getRepositoryItemUid().toString(); } }
/** * Sets the readable. * * @param readable the new readable */ public void setReadable( boolean readable ) { getRepositoryItemAttributes().setReadable( readable ); }
/** * Instantiates a new abstract storage item. */ public AbstractStorageItem( Repository repository, ResourceStoreRequest request, boolean readable, boolean writable ) { this( request, readable, writable ); this.store = repository; this.repositoryItemUid = repository.createUid( getPath() ); setRepositoryId( repository.getId() ); }
result.upgrade(); result.setRepositoryItemUid( uid ); if ( result.getRemoteChecked() == 0 || result.getRemoteChecked() == 1 ) result.setRemoteChecked( System.currentTimeMillis() ); result.setExpired( true ); if ( result.getLastRequested() == 0 ) result.setLastRequested( System.currentTimeMillis() );
private void mirrorRelativeItem(final ResourceStoreRequest remoteRequest, final ResourceStoreRequest localRequest, final Set<String> mirrored) throws StorageException, IllegalOperationException, ItemNotFoundException { final 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 final RepositoryItemUid newUid = createUid(localRequest.getRequestPath()); if (!newUid.equals(item.getRepositoryItemUid())) { item.setRepositoryItemUid(newUid); // update the resource store request item.setResourceStoreRequest(localRequest); // cache locally doCacheItem(item); } } }
@Override public void storeItem(boolean fromTask, StorageItem item) throws UnsupportedStorageOperationException, IllegalOperationException, StorageException { // collapse any '.' or '..' segments from the path if (AbstractStorageItem.class.isAssignableFrom(item.getClass())) { String normalizedPath = normalize(item.getPath()); AbstractStorageItem fileItem = (AbstractStorageItem) item; fileItem.setPath(normalizedPath); } super.storeItem(fromTask, item); }
public boolean isVirtual() { return getRepositoryItemUid() == null; }
public String getName() { return new File( getPath() ).getName(); }
"Caching item " + item.getRepositoryItemUid().toString() + " in local storage of repository." ); final RepositoryItemUidLock itemLock = item.getRepositoryItemUid().getLock(); final Action action = getResultingActionOnWrite( item.getResourceStoreRequest() ); removeFromNotFoundCache( item.getResourceStoreRequest() ); result.getItemContext().putAll( item.getItemContext() );
getLogger().debug( "storeItemWithChecksums() :: " + item.getRepositoryItemUid().toString() ); req.setRequestPath( item.getPath() + ".sha1" ); req.setRequestPath( item.getPath() + ".md5" );
String.format( "Proxied item %s evaluated as INVALID during content validation (validator=%s, sourceUrl=%s)", item.getRepositoryItemUid().toString(), icventry.getKey(), item.getRemoteUrl() ) ); String.format( "Proxied item %s evaluated as INVALID during content validation (validator=%s, sourceUrl=%s)", item.getRepositoryItemUid().toString(), icventry.getKey(), item.getRemoteUrl() ), e );
"The artifact " + item.getPath() + " has no remote checksum in repository " + item.getRepositoryId() + "! The checksumPolicy of repository forbids downloading of it."; "Warning, the artifact " + item.getPath() + " has no remote checksum in repository " + item.getRepositoryId() + "!"; "Warning, the artifact " + item.getPath() + " and it's remote checksums does not match in repository " + item.getRepositoryId() + "!"; "The artifact " + item.getPath() + " and it's remote checksums does not match in repository " + item.getRepositoryId() + "! The checksumPolicy of repository forbids downloading of it.";
@Override protected boolean isArtifactsOld(final AbstractStorageItem artifactsItem, final P2GroupRepository repository) { return isOld(artifactsItem, P2Constants.ARTIFACTS_XML, artifactsItem.getItemContext(), repository); }
/** * Sets the store. * * @param store */ public void setStore( ResourceStore store ) { // only allow this when we are virtual! if ( isVirtual() ) { this.store = store; } }
@Override public void upgrade() { super.upgrade(); getRepositoryItemAttributes().setLength( length ); }
if (!newUid.equals(item.getRepositoryItemUid())) { item.setRepositoryItemUid(newUid); item.setResourceStoreRequest(localStoreRequest);
/** * This method "normalizes" the paths back to the "level" from where the original item was requested. * * @param list */ protected void correctPaths( Collection<StorageItem> list ) { for ( StorageItem item : list ) { if ( getPath().endsWith( RepositoryItemUid.PATH_SEPARATOR ) ) { ( (AbstractStorageItem) item ).setPath( getPath() + item.getName() ); } else { ( (AbstractStorageItem) item ).setPath( getPath() + RepositoryItemUid.PATH_SEPARATOR + item.getName() ); } } }
public void storeItemWithChecksums( boolean fromTask, AbstractStorageItem item ) throws UnsupportedStorageOperationException, IllegalOperationException, StorageException { if ( getLogger().isDebugEnabled() ) { getLogger().debug( "storeItemWithChecksums() :: " + item.getRepositoryItemUid().toString() ); } getArtifactStoreHelper().storeItemWithChecksums( fromTask, item ); }
public String getParentPath() { return ItemPathUtils.getParentPath( getPath() ); }