/** * Creates a request aimed at given path denoted by RepositoryItemUid. * * @param uid the uid * @deprecated use ResourceStoreRequest(String path) */ public ResourceStoreRequest( RepositoryItemUid uid, boolean localOnly ) { this( uid.getPath(), localOnly, false ); }
public Boolean getValueFor( RepositoryItemUid subject ) { // stuff being group-local // /.meta // /.index // /.nexus // we are specific about these for a good reason (see future) if ( subject.getPath() != null ) { return subject.getPath().startsWith( "/.meta" ) || subject.getPath().startsWith( "/.index" ) || subject.getPath().startsWith( "/.nexus" ); } else { return false; } } }
@Override public String extractItemPath( StorageItem item ) { return item.getRepositoryItemUid().getPath(); }
/** * Creates a request for a given item. * * @param item */ public ResourceStoreRequest( StorageItem item ) { this( item.getRepositoryItemUid().getPath(), true, false ); this.requestContext = item.getItemContext(); }
public void removeArtifactUsage(StorageFileItem item) throws IOException { if (getLogger().isDebugEnabled()) { getLogger().debug( "Removing artifact usage data for " + item.getRepositoryItemUid().getPath()); } GAV artifact = getArtifactForStorageItem(item); if (artifact != null) { artifactUsageStore.removeArtifact(artifact); } }
@Override public Boolean getValueFor( RepositoryItemUid subject ) { return subject.getRepository().getRepositoryKind().isFacetAvailable( MavenRepository.class ) && M2ArtifactRecognizer.isChecksum( subject.getPath() ); } }
protected void writeMetadata( RepositoryItemUid uid, Map<String, Object> ctx, Metadata md ) throws IllegalOperationException, UnsupportedStorageOperationException, MetadataException, IOException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); MetadataBuilder.write( md, outputStream ); String mdString = outputStream.toString( "UTF-8" ); outputStream.close(); DefaultStorageFileItem file = new DefaultStorageFileItem( uid.getRepository(), new ResourceStoreRequest( uid.getPath() ), true, true, new StringContentLocator( mdString ) ); ( (MavenRepository) uid.getRepository() ).storeItemWithChecksums( false, file ); }
/** * Creates absolute URL (as String) of the passed link's target. To be used in "Location" header of the redirect * message, for example. */ protected String getLinkTargetUrl(final StorageLinkItem link) { final RepositoryItemUid targetUid = link.getTarget(); // TODO: fix this chum return link.getResourceStoreRequest().getRequestAppRootUrl() + "content/repositories/" + targetUid.getRepository().getId() + targetUid.getPath(); }
@Override public Boolean getValueFor( RepositoryItemUid subject ) { return subject.getRepository().getRepositoryKind().isFacetAvailable( MavenRepository.class ) && pathIsValidGav( subject.getRepository().adaptToFacet( MavenRepository.class ), subject.getPath() ); }
@Override public Boolean getValueFor( RepositoryItemUid subject ) { return subject.getRepository().getRepositoryKind().isFacetAvailable( MavenRepository.class ) && pathIsValidGav( subject.getRepository().adaptToFacet( MavenRepository.class ), subject.getPath() ); }
@Override public Boolean getValueFor( RepositoryItemUid subject ) { return subject.getRepository().getRepositoryKind().isFacetAvailable( MavenRepository.class ) && pathIsValidSnapshotGav( subject.getRepository().adaptToFacet( MavenRepository.class ), subject.getPath() ); }
public StorageItem dereferenceLink( StorageLinkItem link, boolean localOnly, boolean remoteOnly ) throws AccessDeniedException, ItemNotFoundException, IllegalOperationException, StorageException { logger.debug( "Dereferencing link {}", link.getTarget() ); ResourceStoreRequest req = new ResourceStoreRequest( link.getTarget().getPath(), localOnly, remoteOnly ); req.getRequestContext().setParentContext( link.getItemContext() ); return link.getTarget().getRepository().retrieveItem( req ); }
@Override @Deprecated public void touchItemLastRequested( long timestamp, Repository repository, ResourceStoreRequest request ) throws ItemNotFoundException, LocalStorageException, IOException { RepositoryItemUid uid = repository.createUid( request.getRequestPath() ); Attributes item = getAttributeStorage().getAttributes( uid ); if ( item != null ) { item.setRepositoryId( uid.getRepository().getId() ); item.setPath( uid.getPath() ); touchItemLastRequested( timestamp, request, uid, item ); } }
/** * Sets the UID. * * @param repositoryItemUid */ public void setRepositoryItemUid( RepositoryItemUid repositoryItemUid ) { this.repositoryItemUid = repositoryItemUid; this.store = repositoryItemUid.getRepository(); getRepositoryItemAttributes().setRepositoryId( repositoryItemUid.getRepository().getId() ); getRepositoryItemAttributes().setPath( repositoryItemUid.getPath() ); }
@Override @Deprecated public void touchItemRemoteChecked( long timestamp, Repository repository, ResourceStoreRequest request ) throws ItemNotFoundException, LocalStorageException, IOException { RepositoryItemUid uid = repository.createUid( request.getRequestPath() ); Attributes item = getAttributeStorage().getAttributes( uid ); if ( item != null ) { item.setRepositoryId( uid.getRepository().getId() ); item.setPath( uid.getPath() ); item.setCheckedRemotely( timestamp ); item.setExpired( false ); getAttributeStorage().putAttributes( uid, item ); } }
@Override public void touchItemCheckedRemotely( final long timestamp, final StorageItem storageItem ) throws IOException { if ( storageItem instanceof StorageCollectionItem ) { // not storing attributes of directories return; } final RepositoryItemUid uid = storageItem.getRepositoryItemUid(); final Attributes attributes = getAttributeStorage().getAttributes( uid ); if ( attributes != null ) { attributes.setRepositoryId( uid.getRepository().getId() ); attributes.setPath( uid.getPath() ); attributes.setCheckedRemotely( timestamp ); attributes.setExpired( false ); getAttributeStorage().putAttributes( uid, attributes ); } }