private VersionedReference toVersionedReference( DependencyGraphNode node ) { VersionedReference ref = new VersionedReference(); ref.setGroupId( node.getArtifact().getGroupId() ); ref.setArtifactId( node.getArtifact().getArtifactId() ); ref.setVersion( node.getArtifact().getVersion() ); return ref; }
public static VersionedReference clone( VersionedReference versionedReference ) { if ( versionedReference == null ) { return null; } VersionedReference cloned = new VersionedReference(); cloned.setGroupId( versionedReference.getGroupId() ); cloned.setArtifactId( versionedReference.getArtifactId() ); cloned.setVersion( versionedReference.getVersion() ); return cloned; }
public static String toKey( VersionedReference reference ) { StringBuffer key = new StringBuffer(); key.append( defaultString( reference.getGroupId() ) ).append( ":" ); key.append( defaultString( reference.getArtifactId() ) ).append( ":" ); key.append( defaultString( reference.getVersion() ) ).append( ":" ); return key.toString(); }
public DependencyGraph createGraph( VersionedReference versionedProjectReference ) { String groupId = versionedProjectReference.getGroupId(); String artifactId = versionedProjectReference.getArtifactId(); String version = versionedProjectReference.getVersion(); DependencyGraph graph = new DependencyGraph( groupId, artifactId, version ); return graph; }
private void deleteVersions( File typeDir, VersionedReference reference ) { File repoFiles[] = typeDir.listFiles(); for ( File repoFile : repoFiles ) { if ( repoFile.isDirectory() ) { // Skip it. it's a directory. continue; } String relativePath = PathUtil.getRelative( repository.getLocation(), repoFile ); if ( filetypes.matchesArtifactPattern( relativePath ) ) { try { ArtifactReference artifact = toArtifactReference( relativePath ); if ( StringUtils.equals( artifact.getArtifactId(), reference.getArtifactId() ) && StringUtils.equals( artifact.getVersion(), reference.getVersion() ) ) { repoFile.delete(); deleteSupportFiles( repoFile ); } } catch ( LayoutException e ) { /* don't fail the process if there is a bad artifact within the directory. */ } } } }
public void deleteVersion( VersionedReference reference ) throws ContentNotFoundException { File groupDir = new File( repository.getLocation(), reference.getGroupId() ); if ( !groupDir.exists() ) { throw new ContentNotFoundException( "Unable to get versions using a non-existant groupId directory: " + groupDir.getAbsolutePath() ); } if ( !groupDir.isDirectory() ) { throw new ContentNotFoundException( "Unable to get versions using a non-directory: " + groupDir.getAbsolutePath() ); } // First gather up the versions found as artifacts in the managed repository. File typeDirs[] = groupDir.listFiles(); for ( File typeDir : typeDirs ) { if ( !typeDir.isDirectory() ) { // Skip it, we only care about directories. continue; } if ( !typeDir.getName().endsWith( "s" ) ) { // Skip it, we only care about directories that end in "s". } deleteVersions( typeDir, reference ); } }
public static String toKey( VersionedReference ref ) { return toKey( ref.getGroupId(), ref.getArtifactId(), ref.getVersion() ); } }
private void getVersionedVersions( File typeDir, VersionedReference reference, Set<String> foundVersions ) { for ( File repoFile : typeDir.listFiles() ) { if ( repoFile.isDirectory() ) { // Skip it. it's a directory. continue; } String relativePath = PathUtil.getRelative( repository.getLocation(), repoFile ); if ( filetypes.matchesArtifactPattern( relativePath ) ) { try { ArtifactReference artifact = toArtifactReference( relativePath ); if ( StringUtils.equals( artifact.getArtifactId(), reference.getArtifactId() ) && artifact.getVersion().startsWith( reference.getVersion() ) ) { foundVersions.add( artifact.getVersion() ); } } catch ( LayoutException e ) { /* don't fail the process if there is a bad artifact within the directory. */ } } } }
public Set<String> getVersions( VersionedReference reference ) throws ContentNotFoundException File groupDir = new File( repository.getLocation(), reference.getGroupId() );
VersionedReference versionRef = new VersionedReference(); versionRef.setGroupId( reference.getGroupId() ); versionRef.setArtifactId( reference.getArtifactId() ); versionRef.setVersion( version );
public String toMetadataPath( VersionedReference reference ) { StringBuffer path = new StringBuffer(); path.append( formatAsDirectory( reference.getGroupId() ) ).append( PATH_SEPARATOR ); path.append( reference.getArtifactId() ).append( PATH_SEPARATOR ); if ( reference.getVersion() != null ) { // add the version only if it is present path.append( VersionUtil.getBaseVersion( reference.getVersion() ) ).append( PATH_SEPARATOR ); } path.append( MAVEN_METADATA ); return path.toString(); }
private ArchivaProjectModel resolveModel( ArtifactReference reference ) { VersionedReference projectRef = new VersionedReference(); projectRef.setGroupId( reference.getGroupId() ); projectRef.setArtifactId( reference.getArtifactId() ); projectRef.setVersion( reference.getVersion() ); ArchivaProjectModel model = resolverFactory.getCurrentResolverStack().findProject( projectRef ); if ( model == null ) { return createDefaultModel( reference ); } try { ArchivaProjectModel processedModel = effectiveFilter.filter( model ); return processedModel; } catch ( ProjectModelException e ) { e.printStackTrace( System.err ); return createDefaultModel( reference ); } }
if ( StringUtils.isNotBlank( relocation.getGroupId() ) ) refTO.setGroupId( relocation.getGroupId() ); if ( StringUtils.isNotBlank( relocation.getArtifactId() ) ) refTO.setArtifactId( relocation.getArtifactId() ); if ( StringUtils.isNotBlank( relocation.getVersion() ) ) refTO.setVersion( relocation.getVersion() );
VersionedReference reference = new VersionedReference(); reference.setGroupId( artifact.getGroupId() ); reference.setArtifactId( artifact.getArtifactId() ); reference.setVersion( artifact.getVersion() );
Collections.sort( snapshotVersions, VersionComparator.getInstance() ); VersionedReference versionRef = new VersionedReference(); versionRef.setGroupId( artifact.getGroupId() ); versionRef.setArtifactId( artifact.getArtifactId() ); versionRef.setVersion( version ); repository.deleteVersion( versionRef ); log.info( ContinuumPurgeConstants.PURGE_PROJECT + " - " + VersionedReference.toKey( versionRef ) );
VersionedReference reference = new VersionedReference(); reference.setGroupId( artifact.getGroupId() ); reference.setArtifactId( artifact.getArtifactId() ); reference.setVersion( artifact.getVersion() );
VersionedReference projectRef = new VersionedReference(); projectRef.setGroupId( toRef.getGroupId() ); projectRef.setArtifactId( toRef.getArtifactId() ); projectRef.setVersion( toRef.getVersion() );