public static String toKey( ArtifactReference ref ) { StringBuffer key = new StringBuffer(); key.append( ref.getGroupId() ).append( ":" ); key.append( ref.getArtifactId() ).append( ":" ); key.append( ref.getVersion() ).append( ":" ); key.append( StringUtils.defaultString( ref.getClassifier() ) ).append( ":" ); key.append( ref.getType() ); return key.toString(); } }
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(); }
public static String toKey( ArtifactReference artifactReference ) { StringBuffer key = new StringBuffer(); key.append( defaultString( artifactReference.getGroupId() ) ).append( ":" ); key.append( defaultString( artifactReference.getArtifactId() ) ).append( ":" ); key.append( defaultString( artifactReference.getVersion() ) ).append( ":" ); key.append( defaultString( artifactReference.getClassifier() ) ).append( ":" ); key.append( defaultString( artifactReference.getType() ) ); return key.toString(); }
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() ); }
public ArchivaArtifact( ArtifactReference ref ) { this( ref.getGroupId(), ref.getArtifactId(), ref.getVersion(), ref.getClassifier(), ref.getType() ); }
public String toPath( ArtifactReference reference ) { if ( reference == null ) { throw new IllegalArgumentException( "Artifact reference cannot be null" ); } String baseVersion = VersionUtil.getBaseVersion( reference.getVersion() ); return toPath( reference.getGroupId(), reference.getArtifactId(), baseVersion, reference.getVersion(), reference.getClassifier(), reference.getType() ); }
public static String toKey( ArtifactReference ref ) { return toKey( ref.getGroupId(), ref.getArtifactId(), ref.getVersion(), ref.getClassifier(), ref.getType() ); }
private ArchivaProjectModel createDefaultModel( ArtifactReference reference ) { ArchivaProjectModel model = new ArchivaProjectModel(); // Create default (dummy) model model = new ArchivaProjectModel(); model.setGroupId( reference.getGroupId() ); model.setArtifactId( reference.getArtifactId() ); model.setVersion( reference.getVersion() ); model.setPackaging( reference.getType() ); return model; } }
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; }
/** * Get a Live Artifact from a Path. * <p/> * Will resolve the artifact details from the path, and then return a database live version * of that artifact. Suitable for modification and saving (without the need to check for * existance in database prior to save.) * * @param path the path to work from. * @return the artifact that is suitable for database saving. */ public ArchivaArtifact getLiveArtifact( String path ) { try { ArtifactReference artifact = repository.toArtifactReference( path ); ArchivaArtifact liveArtifact = dao.getArtifactDAO().createArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getClassifier(), artifact.getType() ); return liveArtifact; } catch ( LayoutException e ) { triggerConsumerError( TYPE_NOT_ARTIFACT, "Path " + path + " cannot be converted to artifact: " + e.getMessage() ); return null; } }
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? } } }
/** * Get a Live Artifact from a Path. * <p/> * Will resolve the artifact details from the path, and then return a database live version * of that artifact. Suitable for modification and saving (without the need to check for * existance in database prior to save.) * * @param path the path to work from. * @return the artifact that is suitable for database saving. */ public ArchivaArtifact getLiveArtifact( String path ) { try { ArtifactReference artifact = repository.toArtifactReference( path ); ArchivaArtifact liveArtifact = dao.getArtifactDAO().createArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getClassifier(), artifact.getType(), repository.getId()); return liveArtifact; } catch ( LayoutException e ) { triggerConsumerError( TYPE_NOT_ARTIFACT, "Path " + path + " cannot be converted to artifact: " + e.getMessage() ); return null; } }
public void processFile( String path ) throws ConsumerException { try { ArtifactReference reference = managedRepository.toArtifactReference( path ); Artifact artifact = artifactFactory.createArtifact( reference.getGroupId(), reference.getArtifactId(), reference.getVersion(), reference.getClassifier(), reference.getType() ); artifactConverter.convert( artifact, destinationRepository ); } catch ( LayoutException e ) { getLogger().warn( "Unable to convert artifact: " + path + " : " + e.getMessage(), e ); } catch ( ArtifactConversionException e ) { getLogger().warn( "Unable to convert artifact: " + path + " : " + e.getMessage(), e ); } }
toRef.setVersion( toVersion ); toRef.setClassifier( fromRef.getClassifier() ); toRef.setType( fromRef.getType() );
refTO.setVersion( fromNode.getArtifact().getVersion() ); refTO.setClassifier( fromNode.getArtifact().getClassifier() ); refTO.setType( fromNode.getArtifact().getType() );