/** * Method toString. * * @return String */ public java.lang.String toString() { StringBuilder buf = new StringBuilder( 128 ); buf.append( "groupId = '" ); buf.append( getGroupId() ); buf.append( "'" ); buf.append( "\n" ); buf.append( "artifactId = '" ); buf.append( getArtifactId() ); buf.append( "'" ); buf.append( "\n" ); buf.append( "version = '" ); buf.append( getVersion() ); buf.append( "'" ); return buf.toString(); } //-- java.lang.String toString()
/** * Method toString. * * @return String */ public java.lang.String toString() { StringBuilder buf = new StringBuilder( 128 ); buf.append( "groupId = '" ); buf.append( getGroupId() ); buf.append( "'" ); buf.append( "\n" ); buf.append( "artifactId = '" ); buf.append( getArtifactId() ); buf.append( "'" ); buf.append( "\n" ); buf.append( "version = '" ); buf.append( getVersion() ); buf.append( "'" ); return buf.toString(); } //-- java.lang.String toString()
/** * Method equals. * * @param other * @return boolean */ public boolean equals( Object other ) { if ( this == other ) { return true; } if ( !( other instanceof ArchivaRepositoryMetadata ) ) { return false; } ArchivaRepositoryMetadata that = (ArchivaRepositoryMetadata) other; boolean result = true; result = result && ( getGroupId() == null ? that.getGroupId() == null : getGroupId().equals( that.getGroupId() ) ); result = result && ( getArtifactId() == null ? that.getArtifactId() == null : getArtifactId().equals( that.getArtifactId() ) ); result = result && ( getVersion() == null ? that.getVersion() == null : getVersion().equals( that.getVersion() ) ); return result; } //-- boolean equals( Object )
/** * Method equals. * * @param other * @return boolean */ public boolean equals( Object other ) { if ( this == other ) { return true; } if ( !( other instanceof ArchivaRepositoryMetadata ) ) { return false; } ArchivaRepositoryMetadata that = (ArchivaRepositoryMetadata) other; boolean result = true; result = result && ( getGroupId() == null ? that.getGroupId() == null : getGroupId().equals( that.getGroupId() ) ); result = result && ( getArtifactId() == null ? that.getArtifactId() == null : getArtifactId().equals( that.getArtifactId() ) ); result = result && ( getVersion() == null ? that.getVersion() == null : getVersion().equals( that.getVersion() ) ); return result; } //-- boolean equals( Object )
private boolean isProjectVersion( Path dir ) { final String artifactId = dir.getParent().getFileName().toString(); final String projectVersion = dir.getFileName().toString(); // check if there is a POM artifact file to ensure it is a version directory Predicate<Path> filter; if ( VersionUtil.isSnapshot( projectVersion ) ) { filter = new PomFilenameFilter(artifactId, projectVersion); } else { final String pomFile = artifactId + "-" + projectVersion + ".pom"; filter = new PomFileFilter(pomFile); } try(Stream<Path> stream = Files.list(dir)) { if (stream.filter(Files::isRegularFile).anyMatch(filter)){ return true; } } catch (IOException e) { LOGGER.error("Could not list directory {}: {}", dir, e.getMessage(), e); } // if a metadata file is present, check if this is the "version" directory, marking it as a project version ArchivaRepositoryMetadata metadata = readMetadata( dir ); if ( metadata != null && projectVersion.equals( metadata.getVersion() ) ) { return true; } return false; }
private boolean isProjectVersion( File dir ) { final String artifactId = dir.getParentFile().getName(); final String projectVersion = dir.getName(); // check if there is a POM artifact file to ensure it is a version directory File[] files; if ( VersionUtil.isSnapshot( projectVersion ) ) { files = dir.listFiles( new PomFilenameFilter( artifactId, projectVersion ) ); } else { final String pomFile = artifactId + "-" + projectVersion + ".pom"; files = dir.listFiles( new PomFileFilter( pomFile ) ); } if ( files != null && files.length > 0 ) { return true; } // if a metadata file is present, check if this is the "version" directory, marking it as a project version ArchivaRepositoryMetadata metadata = readMetadata( dir ); if ( metadata != null && projectVersion.equals( metadata.getVersion() ) ) { return true; } return false; }
addOptionalElementText( root, "version", metadata.getVersion() );
public static ArchivaRepositoryMetadata merge( final ArchivaRepositoryMetadata mainMetadata, final ArchivaRepositoryMetadata sourceMetadata ) throws RepositoryMetadataException { if ( mainMetadata == null ) { throw new RepositoryMetadataException( "Cannot merge a null main project." ); } if ( sourceMetadata == null ) { throw new RepositoryMetadataException( "Cannot copy to a null parent project." ); } ArchivaRepositoryMetadata merged = new ArchivaRepositoryMetadata(); merged.setGroupId( merge( mainMetadata.getGroupId(), sourceMetadata.getGroupId() ) ); merged.setArtifactId( merge(mainMetadata.getArtifactId(), sourceMetadata.getArtifactId())); merged.setVersion( merge(mainMetadata.getVersion(), sourceMetadata.getVersion()) ); merged.setReleasedVersion( merge( mainMetadata.getReleasedVersion(), sourceMetadata.getReleasedVersion() ) ); merged.setSnapshotVersion( merge( mainMetadata.getSnapshotVersion(), sourceMetadata.getSnapshotVersion() ) ); merged.setAvailableVersions( mergeAvailableVersions( mainMetadata.getAvailableVersions(), sourceMetadata.getAvailableVersions() ) ); merged.setPlugins( mergePlugins( mainMetadata.getPlugins(), sourceMetadata.getPlugins() ) ); //Don't set if merge was not possible long lastUpdated = mergeTimestamp( mainMetadata.getLastUpdated(), sourceMetadata.getLastUpdated()); if (lastUpdated > -1) { merged.setLastUpdated( Long.toString(lastUpdated) ); } return merged; }