public RepositoryItemEvent( final Repository repository, final StorageItem item ) { super( repository ); this.item = item; this.itemContext = item.getItemContext().flatten(); }
public RepositoryItemValidationEvent( final Repository repository, final StorageItem item ) { super( repository ); this.item = item; this.itemContext = item.getItemContext().flatten(); }
/** * Creates a request for a given item. * * @param item */ public ResourceStoreRequest( StorageItem item ) { this( item.getRepositoryItemUid().getPath(), true, false ); this.requestContext = item.getItemContext(); }
public boolean isHandled( StorageItem item ) { if ( item instanceof StorageFileItem ) { if ( item.getItemContext().containsKey( StorageFileItem.DIGEST_SHA1_KEY ) ) { item.getRepositoryItemAttributes().put( DIGEST_SHA1_KEY, String.valueOf( item.getItemContext().get( StorageFileItem.DIGEST_SHA1_KEY ) ) ); // do this one "blindly" item.getRepositoryItemAttributes().put( DIGEST_MD5_KEY, String.valueOf( item.getItemContext().get( StorageFileItem.DIGEST_MD5_KEY ) ) ); // we did our job, we "lifted" the digest from context return false; } } // handling all files otherwise return true; }
@Override public void renderRequestDescription(final HttpServletRequest request, final HttpServletResponse response, final ResourceStoreRequest resourceStoreRequest, final StorageItem item, final Exception exception) throws IOException { final Map<String, Object> dataModel = createBaseModel(resourceStoreRequest); dataModel.put("req", resourceStoreRequest); dataModel.put("item", item); if (item != null) { dataModel.put("itemContext", filterItemContext(item.getItemContext()).flatten()); dataModel.put("itemAttributes", filterItemAttributes(item.getRepositoryItemAttributes()).asMap()); } dataModel.put("exception", exception); final Reasoning reasoning = buildReasoning(exception); if (reasoning != null) { dataModel.put("reasoning", reasoning); } render(getTemplate("requestDescriptionHtml.vm"), dataModel, response); }
@Override public final void processItem( final WalkerContext context, final StorageItem item ) throws Exception { if ( !( item instanceof StorageCollectionItem ) ) { // cstamas: this should be not needed, as Walker should handle this! item.getItemContext().setParentContext( request.getRequestContext() ); // just fire it, and someone will eventually catch it eventBus.post( new RepositoryItemEventDeleteItem( context.getRepository(), item ) ); } } }
&& releaseExistsForSnapshot( gav, item.getItemContext() ) ) item.getItemContext().put( Gav.class.getName(), gav );
static void createLink(final Repository repository, final StorageItem item, final String path) throws Exception { final ResourceStoreRequest req = new ResourceStoreRequest(path); req.getRequestContext().setParentContext(item.getItemContext()); final DefaultStorageLinkItem link = new DefaultStorageLinkItem(repository, req, true, true, item.getRepositoryItemUid()); repository.storeItem(false, link); }
public Collection<StorageItem> list( boolean fromTask, StorageCollectionItem coll ) throws IllegalOperationException, ItemNotFoundException, StorageException { if ( getLogger().isDebugEnabled() ) { getLogger().debug( getId() + ".list() :: " + coll.getRepositoryItemUid().toString() ); } if ( !getLocalStatus().shouldServiceRequest() ) { throw new RepositoryNotAvailableException( this ); } maintainNotFoundCache( coll.getResourceStoreRequest() ); Collection<StorageItem> items = doListItems( new ResourceStoreRequest( coll ) ); for ( StorageItem item : items ) { item.getItemContext().putAll( coll.getItemContext() ); } return items; }
@Override protected StorageLinkItem createLink( final StorageItem item ) throws UnsupportedStorageOperationException, IllegalOperationException, StorageException { String shadowPath = null; shadowPath = transformMaster2Shadow( item.getPath() ); if ( shadowPath != null ) { ResourceStoreRequest req = new ResourceStoreRequest( shadowPath ); req.getRequestContext().putAll( item.getItemContext() ); DefaultStorageLinkItem link = new DefaultStorageLinkItem( this, req, true, true, item.getRepositoryItemUid() ); storeItem( false, link ); return link; } else { return null; } }
request.getRequestContext().putAll( item.getItemContext() );
if (!item.getItemContext().containsKey(SnapshotRemover.MORE_TS_SNAPSHOTS_EXISTS_FOR_GAV)) { final RepositoryItemUidLock uidLock = item.getRepositoryItemUid().getLock();
( (StorageFileItem) item ).getInputStream(), ( (StorageFileItem) item ).getMimeType() ) ); target.getItemContext().putAll( item.getItemContext() );
if ( !item.getItemContext().containsKey( SnapshotRemover.MORE_TS_SNAPSHOTS_EXISTS_FOR_GAV ) )