public SnapshotVersion(Version version) { super(version.toString()); }
protected Object fromString(String string) { return new Version(string); } }
public boolean equals(Object other) { if (super.equals(other)) { if (other instanceof SnapshotVersion) { SnapshotVersion v = (SnapshotVersion) other; if (buildNumber == null ? v.buildNumber != null : !buildNumber.equals(v.buildNumber)) { return false; } if (timestamp == null ? v.timestamp != null : !timestamp.equals(v.timestamp)) { return false; } return true; } } return false; }
String version = fileName.substring(query.getArtifactId().length() + 1); version = version.substring(0, version.length() - 1 - query.getType().length()); if(query.getVersion() != null && !query.getVersion().toString().equals(version)) { continue; continue; if(targetVersion != null && !targetVersion.equals(candidate.getVersion())) { continue;
public int hashCode() { int hashCode = super.hashCode(); if (buildNumber != null) { hashCode = 37 * hashCode + buildNumber.hashCode(); } if (timestamp != null) { hashCode = 37 * hashCode + timestamp.hashCode(); } return hashCode; } }
public int compareTo(Object o) { Version otherVersion = (Version) o; int result = compareIntegers(majorVersion, otherVersion.majorVersion); if (result == 0) { result = compareIntegers(minorVersion, otherVersion.minorVersion); result = compareIntegers(incrementalVersion, otherVersion.incrementalVersion); result = compareIntegers(buildNumber, otherVersion.buildNumber); } else if (qualifier != null) { if (otherVersion.qualifier != null) {
public int hashCode() { int result; result = (groupId != null ? groupId.hashCode() : 0); result = 29 * result + artifactId.hashCode(); result = 29 * result + (version != null ? version.hashCode() : 0); result = 29 * result + (type != null ? type.hashCode() : 0); return result; }
public Artifact(String groupId, String artifactId, String version, String type) { this(groupId, artifactId, version == null ? null : new Version(version), type); }
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final Artifact artifact = (Artifact) o; if (!artifactId.equals(artifact.artifactId)) { return false; } if (groupId != null ? !groupId.equals(artifact.groupId) : artifact.groupId != null) { return false; } if (type != null ? !type.equals(artifact.type) : artifact.type != null) { return false; } return !(version != null ? !version.equals(artifact.version) : artifact.version != null); }
public File getLocation(Artifact artifact) { if(!artifact.isResolved()) { throw new IllegalArgumentException("Artifact "+artifact+" is not fully resolved"); } File path = new File(rootFile, artifact.getGroupId().replace('.', File.separatorChar)); path = new File(path, artifact.getArtifactId()); path = new File(path, artifact.getVersion().toString()); path = new File(path, artifact.getArtifactId() + "-" + artifact.getVersion() + "." + artifact.getType()); return path; }
public ModuleIDBuilder() { defaultVersion = new Version(Long.toString(System.currentTimeMillis())); defaultGroup = Artifact.DEFAULT_GROUP_ID; }
/** * see if this artifact matches the other artifact (which is more specific than this one) * * @param otherArtifact the more specific artifact we are comparing with * @return whether the other artifact is consistent with everything specified in this artifact. */ public boolean matches(Artifact otherArtifact) { if (groupId != null && !groupId.equals(otherArtifact.groupId)) { return false; } if (artifactId != null && !artifactId.equals(otherArtifact.artifactId)) { return false; } if (version != null && !version.equals(otherArtifact.version)) { return false; } return (type == null || type.equals(otherArtifact.type)); } }
public void installLibrary(File libFile, Artifact artifact) throws IOException { if (artifact == null || !artifact.isResolved()) throw new IllegalArgumentException("Artifact is not valid when install library"); if (identifyOSGiBundle(libFile) != null) { writeableRepo.copyToRepository(libFile, artifact, new RepoFileWriteMonitor()); } else { // convert to osgi bundle jars using wrap url handler URL wrap = new URL("wrap", null, libFile.toURI().toURL().toExternalForm() + "$Bundle-SymbolicName=" + artifact.getArtifactId() + "&Bundle-Version=" + artifact.getVersion().toString().replace("-", ".")+"&DynamicImport-Package=*"); //need improve the version processing InputStream in = null; try { in = wrap.openStream(); writeableRepo.copyToRepository(in, (int) libFile.getTotalSpace(), artifact, new RepoFileWriteMonitor()); } finally { if (in != null) in.close(); } } }
public Artifact generateArtifact(Artifact source, String defaultType) { if(source.isResolved()) { Artifact deAliased = (Artifact) explicitResolution.get(source); if (deAliased != null) { return deAliased; } return source; } String groupId = source.getGroupId() == null ? Artifact.DEFAULT_GROUP_ID : source.getGroupId(); String artifactId = source.getArtifactId(); String type = source.getType() == null ? defaultType : source.getType(); Version version = source.getVersion() == null ? new Version(Long.toString(System.currentTimeMillis())) : source.getVersion(); return new Artifact(groupId, artifactId, version, type); }
if(configID.getGroupId().equals(artifact.getGroupId()) && configID.getArtifactId().equals(artifact.getArtifactId()) && configID.getVersion().equals(artifact.getVersion())) { redeploySameConfiguration(configurationManager, artifact, module.getTarget()); } else {
if (versionDir.canRead() && versionDir.isDirectory()) { String version = versionDir.getName(); if(query.getVersion() != null && !query.getVersion().toString().equals(version)) { continue; return listInternal(query.getArtifactId(), query.getType(), query.getVersion() == null ? null : query.getVersion().toString());
private Artifact resolve(Artifact configID) throws DeploymentException { String group = configID.getGroupId(); if (group == null) { group = Artifact.DEFAULT_GROUP_ID; } String artifactId = configID.getArtifactId(); if (artifactId == null) { throw new DeploymentException("Every configuration to deploy must have a ConfigID with an ArtifactID (not " + configID + ")"); } Version version = configID.getVersion(); if (version == null) { version = new Version(Long.toString(System.currentTimeMillis())); } String type = configID.getType(); if (type == null) { type = "car"; } return new Artifact(group, artifactId, version, type); }
private URL getURL(Artifact configId) throws MalformedURLException { String qualifiedVersion = configId.getVersion().toString(); if (configId.getVersion() instanceof SnapshotVersion) { SnapshotVersion ssVersion = (SnapshotVersion) configId.getVersion(); String timestamp = ssVersion.getTimestamp(); int buildNumber = ssVersion.getBuildNumber(); if (timestamp != null && buildNumber != 0) { qualifiedVersion = qualifiedVersion.replaceAll("SNAPSHOT", timestamp + "-" + buildNumber); } } return base.resolve(configId.getGroupId().replace('.', '/') + "/" + configId.getArtifactId() + "/" + configId.getVersion() + "/" + configId.getArtifactId() + "-" + qualifiedVersion + "." + configId.getType()).toURL(); }