org.apache.geronimo.kernel.repository.Version类的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中org.apache.geronimo.kernel.repository.Version类的一些代码示例,展示了Version类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version类的具体详情如下:
包路径:org.apache.geronimo.kernel.repository.Version
类名称:Version

Version介绍

[英]Default implementation of artifact versioning.
[中]工件版本控制的默认实现。

代码示例

代码示例来源:origin: org.apache.geronimo.framework/geronimo-plugin

public SnapshotVersion(Version version) {
  super(version.toString());
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-kernel

protected Object fromString(String string) {
    return new Version(string);
  }
}

代码示例来源:origin: org.apache.geronimo.framework/geronimo-plugin

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;
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-kernel

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;

代码示例来源:origin: org.apache.geronimo.framework/geronimo-plugin

if (version.toString().indexOf("SNAPSHOT") >= 0 && !(version instanceof SnapshotVersion)) {
  Version[] available = new Version[list.getLength()];
  for (int i = 0; i < available.length; i++) {
    available[i] = new Version(getText(list.item(i)));

代码示例来源:origin: org.apache.geronimo.framework/geronimo-plugin

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;
  }
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-kernel

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) {

代码示例来源:origin: org.apache.geronimo.modules/geronimo-kernel

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;
}

代码示例来源:origin: org.apache.geronimo.framework/geronimo-plugin

public int compare(Version o1, Version o2) {
    return o2.toString().compareTo(o1.toString());
  }
});

代码示例来源:origin: org.apache.geronimo.modules/geronimo-kernel

public Artifact(String groupId, String artifactId, String version, String type) {
  this(groupId, artifactId, version == null ? null : new Version(version), type);
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-kernel

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);
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-kernel

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;
}

代码示例来源:origin: org.apache.geronimo.framework/geronimo-deployment

public ModuleIDBuilder() {
  defaultVersion = new Version(Long.toString(System.currentTimeMillis()));
  defaultGroup = Artifact.DEFAULT_GROUP_ID;
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-kernel

/**
   * 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));
  }
}

代码示例来源:origin: org.apache.geronimo.framework/geronimo-plugin

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();
    }
  }
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-kernel

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);
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-deploy-jsr88

if(configID.getGroupId().equals(artifact.getGroupId()) &&
    configID.getArtifactId().equals(artifact.getArtifactId()) &&
    configID.getVersion().equals(artifact.getVersion())) {
  redeploySameConfiguration(configurationManager, artifact, module.getTarget());
} else {

代码示例来源:origin: org.apache.geronimo.modules/geronimo-kernel

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());

代码示例来源:origin: org.apache.geronimo.framework/geronimo-deployment

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);
}

代码示例来源:origin: org.apache.geronimo.framework/geronimo-plugin

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();
}

相关文章