private ManagedRepositoryConfiguration findRepository( ArchivaArtifact artifact ) { return (ManagedRepositoryConfiguration) this.repositoryMap.get( artifact.getModel().getRepositoryId() ); }
public String getPrimaryKey() { StringBuffer id = new StringBuffer(); id.append( artifact.getGroupId() ).append( ":" ); id.append( artifact.getArtifactId() ).append( ":" ); id.append( artifact.getVersion() ); if ( artifact.getClassifier() != null ) { id.append( ":" ).append( artifact.getClassifier() ); } id.append( ":" ).append( artifact.getType() ); return id.toString(); }
public LuceneRepositoryContentRecord convert( Document document ) throws ParseException { HashcodesRecord record = new HashcodesRecord(); record.setRepositoryId( document.get( LuceneDocumentMaker.REPOSITORY_ID ) ); // Artifact Reference String groupId = document.get( ArtifactKeys.GROUPID ); String artifactId = document.get( ArtifactKeys.ARTIFACTID ); String version = document.get( ArtifactKeys.VERSION ); String classifier = document.get( ArtifactKeys.CLASSIFIER ); String type = document.get( ArtifactKeys.TYPE ); ArchivaArtifact artifact = new ArchivaArtifact( groupId, artifactId, version, classifier, type ); record.setArtifact( artifact ); // Hashcode Specifics record.getArtifact().getModel().setChecksumMD5( document.get( HashcodesKeys.MD5 ) ); record.getArtifact().getModel().setChecksumSHA1( document.get( HashcodesKeys.SHA1 ) ); return record; } }
private String toKey( ArchivaArtifact artifact ) { StringBuffer key = new StringBuffer(); key.append( StringUtils.defaultString( artifact.getGroupId() ) ).append( ":" ); key.append( StringUtils.defaultString( artifact.getArtifactId() ) ); return key.toString(); }
private void appendArtifactTypeClassifierString( StringBuffer sb ) { sb.append( model.getArtifactId() ); sb.append( ":" ); sb.append( getType() ); if ( hasClassifier() ) { sb.append( ":" ); sb.append( getClassifier() ); } }
public void addArtifact( ArchivaArtifact artifact ) { this.artifacts.add( artifact ); String ver = artifact.getVersion(); if ( !this.versions.contains( ver ) ) { this.versions.add( ver ); } if ( StringUtils.isBlank( this.groupId ) ) { this.groupId = artifact.getGroupId(); } if ( StringUtils.isBlank( this.artifactId ) ) { this.artifactId = artifact.getArtifactId(); } if ( StringUtils.isBlank( this.version ) ) { this.version = ver; } }
if ( !artifact.getArtifactId().equalsIgnoreCase( model.getArtifactId() ) ) appendModel( emsg, model ); emsg.append( "]: The model artifactId [" ).append( model.getArtifactId() ); emsg.append( "] does not match the artifactId portion of the filename: " ).append( artifact.getArtifactId() ); if ( !artifact.getVersion().equalsIgnoreCase( model.getVersion() ) && !VersionUtil.getBaseVersion( artifact.getVersion() ).equalsIgnoreCase( model.getVersion() ) ) appendModel( emsg, model ); emsg.append( "]; The model version [" ).append( model.getVersion() ); emsg.append( "] does not match the version portion of the filename: " ).append( artifact.getVersion() );
public LuceneRepositoryContentRecord convert( Document document ) throws ParseException { FileContentRecord record = new FileContentRecord(); record.setRepositoryId( document.get( LuceneDocumentMaker.REPOSITORY_ID ) ); // Artifact Reference String groupId = document.get( ArtifactKeys.GROUPID ); String artifactId = document.get( ArtifactKeys.ARTIFACTID ); String version = document.get( ArtifactKeys.VERSION ); String classifier = document.get( ArtifactKeys.CLASSIFIER ); String type = document.get( ArtifactKeys.TYPE ); if( StringUtils.isNotBlank( groupId ) && StringUtils.isNotBlank( artifactId ) ) { ArchivaArtifact artifact = new ArchivaArtifact( groupId, artifactId, version, classifier, type ); record.setArtifact( artifact ); } // Filecontent Specifics record.setFilename( document.get( FileContentKeys.FILENAME ) ); record.setContents( document.get( FileContentKeys.CONTENT ) ); return record; }
public boolean equals( Object obj ) { if ( this == obj ) { return true; } if ( obj == null ) { return false; } if ( getClass() != obj.getClass() ) { return false; } final BytecodeRecord other = (BytecodeRecord) obj; if ( artifact == null ) { if ( other.artifact != null ) { return false; } } else if ( !artifact.equals( other.artifact ) ) { return false; } return true; }
private void validateAppropriateModel( String location, ArchivaArtifact artifact, ArchivaProjectModel model ) throws ConsumerException { if ( model != null ) { if ( !StringUtils.equals( model.getGroupId(), artifact.getGroupId() ) ) { addProblem( artifact, "The groupId of the " + location + " project model doesn't match with the artifact, expected <" + artifact.getGroupId() + ">, but was actually <" + model.getGroupId() + ">" ); } if ( !StringUtils.equals( model.getArtifactId(), artifact.getArtifactId() ) ) { addProblem( artifact, "The artifactId of the " + location + " project model doesn't match with the artifact, expected <" + artifact.getArtifactId() + ">, but was actually <" + model.getArtifactId() + ">" ); } if ( !StringUtils.equals( model.getVersion(), artifact.getVersion() ) ) { addProblem( artifact, "The version of the " + location + " project model doesn't match with the artifact, expected <" + artifact.getVersion() + ">, but was actually <" + model.getVersion() + ">" ); } } }
"META-INF/maven/" + artifact.getGroupId() + "/" + artifact.getArtifactId() + "/pom.xml" );
if ( !artifact.getArtifactId().equalsIgnoreCase( model.getArtifactId() ) ) appendModel( emsg, model ); emsg.append( "]: The model artifactId [" ).append( model.getArtifactId() ); emsg.append( "] does not match the artifactId portion of the filename: " ).append( artifact.getArtifactId() ); if ( !artifact.getVersion().equalsIgnoreCase( model.getVersion() ) && !VersionUtil.getBaseVersion( artifact.getVersion() ).equalsIgnoreCase( model.getVersion() ) ) appendModel( emsg, model ); emsg.append( "]; The model version [" ).append( model.getVersion() ); emsg.append( "] does not match the version portion of the filename: " ).append( artifact.getVersion() );
public LuceneRepositoryContentRecord convert( Document document ) throws ParseException { BytecodeRecord record = new BytecodeRecord(); record.setRepositoryId( document.get( LuceneDocumentMaker.REPOSITORY_ID ) ); // Artifact Reference String groupId = document.get( ArtifactKeys.GROUPID ); String artifactId = document.get( ArtifactKeys.ARTIFACTID ); String version = document.get( ArtifactKeys.VERSION ); String classifier = document.get( ArtifactKeys.CLASSIFIER ); String type = document.get( ArtifactKeys.TYPE ); ArchivaArtifact artifact = new ArchivaArtifact( groupId, artifactId, version, classifier, type ); record.setArtifact( artifact ); // Bytecode Specifics JavaArtifactHelper.getJavaDetails( record.getArtifact() ).setJdk( document.get( BytecodeKeys.JDK ) ); record.setClasses( getList( document, BytecodeKeys.CLASSES ) ); record.setMethods( getList( document, BytecodeKeys.METHODS ) ); record.setFiles( getList( document, BytecodeKeys.FILES ) ); return record; }
public boolean equals( Object obj ) { if ( this == obj ) { return true; } if ( obj == null ) { return false; } if ( getClass() != obj.getClass() ) { return false; } final HashcodesRecord other = (HashcodesRecord) obj; if ( artifact == null ) { if ( other.artifact != null ) { return false; } } else if ( !artifact.equals( other.artifact ) ) { return false; } return true; }
public String getPrimaryKey() { StringBuffer id = new StringBuffer(); id.append( artifact.getGroupId() ).append( ":" ); id.append( artifact.getArtifactId() ).append( ":" ); id.append( artifact.getVersion() ); if ( artifact.getClassifier() != null ) { id.append( ":" ).append( artifact.getClassifier() ); } id.append( ":" ).append( artifact.getType() ); return id.toString(); }
private IndexedRepositoryDetails getIndexedRepositoryDetails( ArchivaArtifact artifact ) { String repoId = artifact.getModel().getRepositoryId(); if ( StringUtils.isBlank( repoId ) ) { throw new IllegalStateException( "Unable to process artifact [" + artifact + "] as it has no repository id associated with it." ); } return getIndexedRepositoryDetails( repoId ); }
ArchivaArtifact artifact = new ArchivaArtifact( ref ); record.setArtifact( artifact );
public Document convert( LuceneRepositoryContentRecord record ) { if ( !( record instanceof HashcodesRecord ) ) { throw new ClassCastException( "Unable to convert type " + record.getClass().getName() + " to " + HashcodesRecord.class.getName() + "." ); } HashcodesRecord hashcodes = (HashcodesRecord) record; LuceneDocumentMaker doc = new LuceneDocumentMaker( hashcodes ); // Artifact Reference doc.addFieldTokenized( ArtifactKeys.GROUPID, hashcodes.getArtifact().getGroupId() ); doc.addFieldExact( ArtifactKeys.GROUPID_EXACT, hashcodes.getArtifact().getGroupId() ); doc.addFieldTokenized( ArtifactKeys.ARTIFACTID, hashcodes.getArtifact().getArtifactId() ); doc.addFieldExact( ArtifactKeys.ARTIFACTID_EXACT, hashcodes.getArtifact().getArtifactId() ); doc.addFieldTokenized( ArtifactKeys.VERSION, hashcodes.getArtifact().getVersion() ); doc.addFieldExact( ArtifactKeys.VERSION_EXACT, hashcodes.getArtifact().getVersion() ); doc.addFieldTokenized( ArtifactKeys.TYPE, hashcodes.getArtifact().getType() ); doc.addFieldUntokenized( ArtifactKeys.CLASSIFIER, hashcodes.getArtifact().getClassifier() ); // Hashcode Specifics doc.addFieldUntokenized( HashcodesKeys.MD5, hashcodes.getArtifact().getModel().getChecksumMD5() ); doc.addFieldUntokenized( HashcodesKeys.SHA1, hashcodes.getArtifact().getModel().getChecksumSHA1() ); return doc.getDocument(); }
public boolean evaluate( Object object ) { boolean satisfies = false; if ( object instanceof ArchivaArtifact ) { ArchivaArtifact artifact = (ArchivaArtifact) object; satisfies = !artifact.getModel().isProcessed(); } else if ( object instanceof ArchivaArtifactModel ) { ArchivaArtifactModel model = (ArchivaArtifactModel) object; satisfies = !model.isProcessed(); } return satisfies; } }
public void processArchivaArtifact( ArchivaArtifact artifact ) throws ConsumerException if ( !StringUtils.equals( "pom", artifact.getType() ) ) repositoryFactory.getManagedRepositoryContent( artifact.getModel().getRepositoryId() ); artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion() );