public boolean isMavenArtifactPath( String path ) { return getGavCalculator().pathToGav( path ) != null; }
public ArtifactStoreRequest( MavenRepository repository, String path, boolean localOnly ) { super( path, localOnly ); this.mavenRepository = repository; this.gav = mavenRepository.getGavCalculator().pathToGav( path ); if ( gav == null ) { throw new IllegalArgumentException( "The path does not represent an artifact!" ); } }
@Override public boolean isMavenArtifactPath( String path ) { return getGavCalculator().pathToGav( path ) != null; }
public boolean isMavenArtifactPath( String path ) { return getGavCalculator().pathToGav( path ) != null; }
/** * Transforms a full artifact path from M1 layout to M2 layout. * * @param path * @return */ protected String transformM1toM2( final String path ) { final Gav gav = getM1GavCalculator().pathToGav( path ); // Unsupported path if ( gav == null ) { return null; } // m2 repo is layouted as: // g/i/d // aid // version // files StringBuilder sb = new StringBuilder( RepositoryItemUid.PATH_ROOT ); sb.append( gav.getGroupId().replaceAll( "\\.", "/" ) ); sb.append( RepositoryItemUid.PATH_SEPARATOR ); sb.append( gav.getArtifactId() ); sb.append( RepositoryItemUid.PATH_SEPARATOR ); sb.append( gav.getVersion() ); sb.append( RepositoryItemUid.PATH_SEPARATOR ); sb.append( gav.getName() ); return sb.toString(); }
/** * Transforms a full artifact path from M2 layout to M1 layout. * * @param path * @return */ protected String transformM2toM1( final String path ) { final Gav gav = getM2GavCalculator().pathToGav( path ); // Unsupported path if ( gav == null ) { return null; } // m1 repo is layouted as: // g.i.d // poms/jars/java-sources/licenses // files StringBuilder sb = new StringBuilder( RepositoryItemUid.PATH_ROOT ); sb.append( gav.getGroupId() ); sb.append( RepositoryItemUid.PATH_SEPARATOR ); sb.append( gav.getExtension() + "s" ); sb.append( RepositoryItemUid.PATH_SEPARATOR ); sb.append( gav.getName() ); return sb.toString(); }
protected boolean pathIsValidGav( MavenRepository repository, String path ) { final Gav gav = repository.getGavCalculator().pathToGav( path ); return gav != null && !gav.isHash() && !gav.isSignature(); } }
protected boolean pathIsValidGav( MavenRepository repository, String path ) { final Gav gav = repository.getGavCalculator().pathToGav( path ); return gav != null && !gav.isHash() && gav.isSignature(); } }
protected boolean pathIsValidSnapshotGav( MavenRepository repository, String path ) { final Gav gav = repository.getGavCalculator().pathToGav( path ); return gav != null && gav.isSnapshot() && !gav.isHash() && !gav.isSignature(); } }
protected Gav buildGAV(final NexusArtifactEvent event) { if (event.getNexusItemInfo() == null) { return null; } try { final Repository repo = getRepositoryRegistry().getRepository(event.getNexusItemInfo().getRepositoryId()); if (MavenRepository.class.isAssignableFrom(repo.getClass())) { return ((MavenRepository) repo).getGavCalculator().pathToGav(event.getNexusItemInfo().getPath()); } return null; } catch (NoSuchRepositoryException e) { log.debug( "Feed entry contained invalid repository id " + event.getNexusItemInfo().getRepositoryId(), e); return null; } }
@Override public void processItem(WalkerContext context, StorageItem item) throws Exception { // just process the POM files if (item instanceof StorageFileItem && !item.getRepositoryItemUid().getPath().endsWith(".pom")) { return; } try { Gav gav = this.gavCalculator.pathToGav(item.getPath()); // make sure we've really got a POM file if (gav != null && !gav.isHash() && !gav.isSignature() && gav.getExtension().equals("pom")) { // and then calculate the artifact usage calculateArtifactUsage((StorageFileItem) item); } } catch (Exception e) { getLogger().warn( "Error processing POM file for artifact usage data: " + item.getPath(), ExceptionUtils.getRootCause(e)); } } }
Gav gav = repository.getGavCalculator().pathToGav( item.getPath() );
gav = ((MavenRepository) repository).getGavCalculator().pathToGav(item.getRepositoryItemUid().getPath());
@Override protected boolean isOld( StorageItem item ) { if ( M1ArtifactRecognizer.isMetadata( item.getPath() ) ) { return isOld( getMetadataMaxAge(), item ); } if ( M1ArtifactRecognizer.isSnapshot( item.getPath() ) ) { return isOld( getArtifactMaxAge(), item ); } // we are using Gav to test the path final Gav gav = gavCalculator.pathToGav( item.getPath() ); if ( gav == null ) { // this is not an artifact, it is just any "file" return super.isOld( item ); } // it is a release return isOld( getArtifactMaxAge(), item ); }
@Override protected boolean isOld( StorageItem item ) { if ( M2ArtifactRecognizer.isMetadata( item.getPath() ) ) { return isOld( getMetadataMaxAge(), item ); } if ( M2ArtifactRecognizer.isSnapshot( item.getPath() ) ) { return isOld( getArtifactMaxAge(), item ); } // we are using Gav to test the path final Gav gav = getGavCalculator().pathToGav( item.getPath() ); if ( gav == null ) { // this is not an artifact, it is just any "file" return super.isOld( item ); } // it is a release return isOld( getArtifactMaxAge(), item ); }
Gav gav = ((MavenRepository) repository).getGavCalculator().pathToGav(item.getRepositoryItemUid().getPath()); if (gav == null || gav.isSignature() || gav.isHash()) { return;
final Gav gav = getGavCalculator().pathToGav( request.getRequestPath() );
final Gav gav = getGavCalculator().pathToGav( request.getRequestPath() );
Gav gav = mavenRepository.getGavCalculator().pathToGav(itemPath);
Gav gav = mavenRepository.getGavCalculator().pathToGav( itemPath );