public boolean isVirtual() { return getRepositoryItemUid() == null; }
public String toString() { if ( isVirtual() ) { return getPath(); } else { return getRepositoryItemUid().toString(); } }
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 boolean isRemoteItemContentValid( final ProxyRepository proxy, final ResourceStoreRequest request, final String baseUrl, final AbstractStorageItem item, final List<RepositoryItemValidationEvent> events ) { if ( !proxy.isFileTypeValidation() ) { // make sure this is enabled before we check. return true; } final boolean result = validatorHub.isExpectedFileType( item ); if ( !result ) { events.add( new RepositoryItemValidationEventFailedFileType( proxy, item, String.format( "Invalid file type.", item.getRepositoryItemUid().toString() ) ) ); } return result; } }
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 );
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); } } }
if (!newUid.equals(item.getRepositoryItemUid())) { item.setRepositoryItemUid(newUid);
throws LocalStorageException RepositoryItemUid uid = item.getRepositoryItemUid();
@Override protected ChecksumPolicy getChecksumPolicy( ProxyRepository proxy, AbstractStorageItem item ) { if ( isChecksum( item.getRepositoryItemUid().getPath() ) ) { // do not validate checksum files return null; } if ( !proxy.getRepositoryKind().isFacetAvailable( MavenProxyRepository.class ) ) { // we work only with maven proxy reposes, all others are neglected return null; } MavenProxyRepository mpr = proxy.adaptToFacet( MavenProxyRepository.class ); ChecksumPolicy checksumPolicy = mpr.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 null; } return checksumPolicy; }
@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; }
"Caching item " + item.getRepositoryItemUid().toString() + " in local storage of repository." ); final RepositoryItemUidLock itemLock = item.getRepositoryItemUid().getLock();
getLogger().debug( "storeItemWithChecksums() :: " + item.getRepositoryItemUid().toString() );