public static String toManagementKey( ArtifactReference ref ) { StringBuffer key = new StringBuffer(); key.append( ref.getGroupId() ).append( ":" ); key.append( ref.getArtifactId() ); return key.toString(); }
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(); }
if ( artifact.getGroupId().equals( reference.getGroupId() ) && artifact.getArtifactId().equals( reference.getArtifactId() ) && artifact.getVersion().equals( reference.getVersion() ) )
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() ); }
reference.setGroupId( artifact.getGroupId() ); reference.setArtifactId( artifact.getArtifactId() ); versionRef.setGroupId( artifact.getGroupId() ); versionRef.setArtifactId( artifact.getArtifactId() );
reference.setGroupId( artifact.getGroupId() ); reference.setArtifactId( artifact.getArtifactId() ); reference.setVersion( artifact.getVersion() );
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; } }
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 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; } }
toRef.setGroupId( fromRef.getGroupId() ); toRef.setArtifactId( fromRef.getArtifactId() ); toRef.setVersion( toVersion ); projectRef.setGroupId( toRef.getGroupId() ); projectRef.setArtifactId( toRef.getArtifactId() ); projectRef.setVersion( toRef.getVersion() );
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 ); } }
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 ); } }