public static ArtifactReference clone( ArtifactReference artifactReference ) { if ( artifactReference == null ) { return null; } ArtifactReference cloned = new ArtifactReference(); cloned.setGroupId( artifactReference.getGroupId() ); cloned.setArtifactId( artifactReference.getArtifactId() ); cloned.setVersion( artifactReference.getVersion() ); cloned.setClassifier( artifactReference.getClassifier() ); cloned.setType( artifactReference.getType() ); return cloned; }
public ArchivaArtifact( ArtifactReference ref ) { this( ref.getGroupId(), ref.getArtifactId(), ref.getVersion(), ref.getClassifier(), ref.getType() ); }
public DependencyGraph( String groupId, String artifactId, String version ) { ArtifactReference rootRef = new ArtifactReference(); rootRef.setGroupId( groupId ); rootRef.setArtifactId( artifactId ); rootRef.setVersion( version ); rootRef.setClassifier( "" ); rootRef.setType( "pom" ); this.rootNode = new DependencyGraphNode( rootRef ); }
if ( artifact.getGroupId().equals( reference.getGroupId() ) && artifact.getArtifactId().equals( reference.getArtifactId() ) && artifact.getVersion().equals( reference.getVersion() ) )
private void getRelatedArtifacts( File typeDir, ArtifactReference reference, Set<ArtifactReference> foundArtifacts ) { 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() ) ) { foundArtifacts.add( artifact ); } } catch ( LayoutException e ) { /* don't fail the process if there is a bad artifact within the directory. */ } } } }
reference.setGroupId( artifact.getGroupId() ); reference.setArtifactId( artifact.getArtifactId() ); reference.setVersion( artifact.getVersion() ); newArtifactReference.setVersion( version ); if ( VersionUtil.isGenericSnapshot( newArtifactReference.getVersion() ) ) else if ( VersionUtil.isUniqueSnapshot( newArtifactReference.getVersion() ) ) Calendar timestampCal = uniqueSnapshotToCalendar( newArtifactReference.getVersion() );
public static String toManagementKey( ArtifactReference ref ) { StringBuffer key = new StringBuffer(); key.append( ref.getGroupId() ).append( ":" ); key.append( ref.getArtifactId() ); return key.toString(); }
public void finishGraph( DependencyGraph graph ) { super.finishGraph( graph ); for ( ArtifactReference ref : this.nodeVersionChanges.keySet() ) { String toVersion = this.nodeVersionChanges.get( ref ); collapseVersions( graph, ref, ref.getVersion(), toVersion ); } }
public static String toKey( ArtifactReference ref ) { return toKey( ref.getGroupId(), ref.getArtifactId(), ref.getVersion(), ref.getClassifier(), ref.getType() ); }
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; }
private void addDependencies( List<Dependency> dependencies ) { for ( Dependency dep : dependencies ) { String key = DependencyGraphKeys.toManagementKey( dep ); Rules merged = (Rules) depMap.get( key ); if ( merged == null ) { // New map entry. merged = new Rules(); merged.artifact = new ArtifactReference(); merged.artifact.setGroupId( dep.getGroupId() ); merged.artifact.setArtifactId( dep.getArtifactId() ); merged.artifact.setClassifier( dep.getClassifier() ); merged.artifact.setType( dep.getType() ); } merged.artifact.setVersion( dep.getVersion() ); if ( StringUtils.isNotBlank( dep.getScope() ) ) { merged.scope = dep.getScope(); } merged.addAllExclusions( dep.getExclusions() ); depMap.put( key, merged ); } }
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. */ } } } }
foundVersions.add( artifact.getVersion() );
private void doPurgeAllRelated( ArtifactReference reference, String version ) throws LayoutException { ArtifactReference artifact = new ArtifactReference(); artifact.setGroupId( reference.getGroupId() ); artifact.setArtifactId( reference.getArtifactId() ); artifact.setVersion( version ); artifact.setClassifier( reference.getClassifier() ); artifact.setType( reference.getType() ); try { Set<ArtifactReference> related = repository.getRelatedArtifacts( artifact ); purge( related, repository ); } catch ( ContentNotFoundException e ) { // Nothing to do here. // TODO: Log this? } } }
public String toPath( ArtifactReference reference ) { if ( reference == null ) { throw new IllegalArgumentException( "Artifact reference cannot be null" ); } return toPath( reference.getGroupId(), reference.getArtifactId(), reference.getVersion(), reference.getClassifier(), reference.getType() ); }
if ( VersionUtil.isSnapshot( artifact.getVersion() ) ) reference.setGroupId( artifact.getGroupId() ); reference.setArtifactId( artifact.getArtifactId() ); reference.setVersion( artifact.getVersion() );
private void getProjectVersions( File typeDir, ProjectReference reference, Set<String> foundVersions ) { 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() ) ) { foundVersions.add( artifact.getVersion() ); } } catch ( LayoutException e ) { /* don't fail the process if there is a bad artifact within the directory. */ } } } }
String specifiedVersion = rules.artifact.getVersion(); String nodeVersion = subnode.getArtifact().getVersion();
ArtifactReference toRef = new ArtifactReference(); toRef.setGroupId( fromRef.getGroupId() ); toRef.setArtifactId( fromRef.getArtifactId() ); toRef.setVersion( toVersion ); toRef.setClassifier( fromRef.getClassifier() ); toRef.setType( fromRef.getType() ); projectRef.setGroupId( toRef.getGroupId() ); projectRef.setArtifactId( toRef.getArtifactId() ); projectRef.setVersion( toRef.getVersion() );
public static String toVersionlessKey( ArtifactReference artifactReference ) { StringBuffer key = new StringBuffer(); key.append( defaultString( artifactReference.getGroupId() ) ).append( ":" ); key.append( defaultString( artifactReference.getArtifactId() ) ).append( ":" ); key.append( defaultString( artifactReference.getClassifier() ) ).append( ":" ); key.append( defaultString( artifactReference.getType() ) ); return key.toString(); }