@Override protected ArtifactRef cloneTarget( final ArtifactRef target ) { return new SimpleArtifactRef( target ); }
@Override public boolean versionlessEquals( final ProjectVersionRef other ) { if ( !super.versionlessEquals( other ) ) { return false; } if ( !( other instanceof ArtifactRef ) ) { // compare vs. POM reference. return artifactFieldsEqual( new SimpleArtifactRef( other, "pom", null ) ); } return artifactFieldsEqual( (ArtifactRef) other ); }
@Override public String toString() { return String.format( "%s:%s:%s:%s%s", getGroupId(), getArtifactId(), getType(), getVersionString(), ( getClassifier() == null ? "" : ":" + getClassifier() ) ); }
private void addBuiltArtifacts(List<PncArtifact> buildArtifacts, KojiImport.Builder builder, int buildRootId) throws CausewayException { for (BuildArtifacts.PncArtifact artifact : buildArtifacts) { BuildOutput.Builder outputBuilder = builder .withNewOutput(buildRootId, artifact.deployPath) .withArch(StandardArchitecture.noarch) .withChecksum(MD5, artifact.checksum); switch (artifact.type) { case MAVEN: { SimpleArtifactRef ref = SimpleArtifactRef.parse(artifact.identifier); outputBuilder.withFileSize((int) artifact.size); outputBuilder.withMavenInfoAndType(ref); break; } default: { throw new IllegalArgumentException("Unknown artifact type."); } } } }
@Override public boolean equals( final Object obj ) { if ( this == obj ) { return true; } if ( !super.equals( obj ) ) { return false; } if ( !(obj instanceof ArtifactRef) ) { return false; } final ArtifactRef other = (ArtifactRef) obj; return artifactFieldsEqual( other ); }
@Override protected ArtifactRef cloneTarget( final ArtifactRef target ) { return new SimpleArtifactRef( target ); }
@Override public T detach() { return (T) new SimpleArtifactRef( this ); } }
@Override public ArtifactRef asArtifactRef( final String type, final String classifier ) { return new SimpleArtifactRef( this, type, classifier ); }
@Override public ArtifactRef asArtifactRef( final TypeAndClassifier tc ) { return new SimpleArtifactRef( this, tc ); }
public static ArtifactRef artifact( final ProjectVersionRef dep, final String type, final String classifier ) { return new SimpleArtifactRef( dep, type, classifier ); }
public static ArtifactRef artifact( final String groupId, final String artifactId, final String version, final String type, final String classifier ) throws InvalidVersionSpecificationException { return new SimpleArtifactRef( projectVersion( groupId, artifactId, version ), type, classifier ); }
public static ArtifactRef artifact( final String groupId, final String artifactId, final String version ) throws InvalidVersionSpecificationException { return new SimpleArtifactRef( projectVersion( groupId, artifactId, version ), null, null ); }
@Override public ArtifactRef getTargetArtifact() { return new SimpleArtifactRef( getTarget(), null, null ); }
@Override public ArtifactRef getTargetArtifact() { return new SimpleArtifactRef( getTarget(), "maven-plugin", null ); }
@Override public ArtifactRef getTargetArtifact() { return new SimpleArtifactRef( getTarget(), "maven-plugin", null ); }
@Override public ArtifactRef getTargetArtifact() { return new SimpleArtifactRef( getTarget(), "pom", null ); }
public Builder withDependency( final ProjectVersionRef ref, final String type, final String classifier, final DependencyScope scope, final boolean managed, final boolean inherited, final boolean optional ) { withDependencies( new SimpleDependencyRelationship( source, ref, new SimpleArtifactRef( ref, type, classifier ), scope, getNextDependencyIndex( managed ), managed, inherited, optional ) ); return this; }
public static SimpleArtifactRef parse( final String spec ) { final String[] parts = spec.split( ":" ); if ( parts.length < 3 || isEmpty( parts[0] ) || isEmpty( parts[1] ) || isEmpty( parts[2] ) ) { throw new InvalidRefException( "SimpleArtifactRef must contain AT LEAST non-empty groupId, artifactId, AND version. (Given: '" + spec + "')" ); } final String g = parts[0]; final String a = parts[1]; // assume we're actually parsing a GAV into a POM artifact... String v = parts[2]; String t = "pom"; String c = null; if ( parts.length > 3 ) { // oops, it's a type, not a version...see toString() for the specification. t = v; v = parts[3]; if ( parts.length > 4 ) { c = parts[4]; } } // assume non-optional, because it might not matter if you're parsing a string like this...you'd be more careful if you were reading something // that had an optional field, because it's not in the normal GATV[C] spec. return new SimpleArtifactRef( g, a, v, t, c ); }