com.sun.appserv.server.util.Version类的使用及代码示例

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

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

Version介绍

[英]This class provides static methods to make accessible the version as well as the individual parts that make up the version
[中]此类提供了静态方法,可以访问版本以及组成版本的各个部分

代码示例

代码示例来源:origin: stackoverflow.com

String userAgent = req.getHeader("user-agent");
UserAgent ua = UserAgent.parseUserAgentString(userAgent);
Version browserVersion = ua.getBrowserVersion();
String browserName = ua.getBrowser().toString();
int majVersion = Integer.parseInt(browserVersion.getMajorVersion());

代码示例来源:origin: org.glassfish.main.core/kernel

@Override
  public void execute(AdminCommandContext context) {
    String vers;
    if (verbose) {
      vers = strings.getLocalString("version.verbose",
        "{0}, JRE version {1}",
        Version.getFullVersion(), System.getProperty("java.version"));
    } else {
      vers = strings.getLocalString("version",
        "{0}", Version.getFullVersion());
    }
    ActionReport report = context.getActionReport();
    Properties ep = new Properties();
    ep.setProperty("version", Version.getVersion());
    ep.setProperty("full-version", Version.getFullVersion());
    ep.setProperty("version-number", Version.getVersionNumber());     
    report.setExtraProperties(ep);
    report.setActionExitCode(ExitCode.SUCCESS);
    report.setMessage(vers);
  }
}

代码示例来源:origin: org.glassfish.main.common/amx-core

public String getApplicationServerFullVersion() {
  return Version.getFullVersion();
}

代码示例来源:origin: org.glassfish.main.common/common-util

/**
 * Returns full version including build id
 */
public static String getFullVersion() {
  return (getVersion() + " (build " + getBuildVersion() + ")");
}

代码示例来源:origin: org.glassfish.admin/admin-cli

private void invokeLocal() {
  GlassFishBranding br = new GlassFishBranding();
  br.postConstruct();
  Version version = new Version();
  version.setBranding(br);
  version.postConstruct();
  String fv = Version.getFullVersion();
  logger.info(terse ? fv : strings.get("version.local", fv));
  if (verbose)
    logger.info(strings.get("version.local.java",
        System.getProperty("java.version")));
}

代码示例来源:origin: org.glassfish.common/common-util

/**
* Returns full version including build id
*/
public static String getFullVersion() {
  if (br != null) {
    return br.getFullVersion();
  }
  return (getVersion() + " (build " + build_id + ")");
}

代码示例来源:origin: org.glassfish.main.common/common-util

/**
 * Returns version
 */
public static String getVersion() {
  StringBuilder sb = new StringBuilder(getProductName());
  sb.append(" ").append(getVersionPrefix());
  sb.append(" ").append(getVersionNumber());
  sb.append(" ").append(getVersionSuffix());
  return sb.toString();
}

代码示例来源:origin: org.glassfish.admin/config-api

public void transactionCommited(List<PropertyChangeEvent> changes) {
  for (ConfigurationPersistence pers : habitat.getAllByContract(ConfigurationPersistence.class)) {
    try {
      if (doc.getRoot().getProxyType().equals(Domain.class)) {
        Dom domainRoot = doc.getRoot();
        domainRoot.attribute("version", Version.getBuildVersion());
      }
      pers.save(doc);
    } catch (IOException e) {
      logger.log(Level.SEVERE, "GlassFishDocument.IOException",
          new String[] { e.getMessage() });
      logger.log(Level.FINE, e.getMessage(), e);
    } catch (XMLStreamException e) {
      logger.log(Level.SEVERE, "GlassFishDocument.XMLException",
          new String[] { e.getMessage() });
      logger.log(Level.SEVERE, e.getMessage(), e);
    }
  }
}

代码示例来源:origin: org.glassfish.main.common/common-util

/**
 * Return major_version [. minor_version [. update_version]]
 */
public static String getVersionNumber() {
  // construct version number
  String maj = getMajorVersion();
  String min = getMinorVersion();
  String upd = getUpdateVersion();
  String v;
  try {
    if (min != null && min.length() > 0 && Integer.parseInt(min) >= 0) {
      if (upd != null && upd.length() > 0 && Integer.parseInt(upd) >= 0) {
        v = maj + "." + min + "." + upd;
      } else {
        v = maj + "." + min;
      }
    } else {
      if (upd != null && upd.length() > 0 && Integer.parseInt(upd) >= 0) {
        v = maj + ".0." + upd;
      } else {
        v = maj;
      }
    }
  } catch (NumberFormatException nfe) {
    v = maj;
  }
  return v;
}

代码示例来源:origin: org.glassfish.main.admin/config-api

String templatefilename = Version.getDefaultDomainTemplate();
File templatefile = new File(new File(new File(
    new File(installRoot, "common"), "templates"), "gf"), templatefilename);

代码示例来源:origin: org.glassfish.main.core/kernel

private void setVersion() {
  System.setProperty("glassfish.version", Version.getFullVersion());
}

代码示例来源:origin: eclipse-ee4j/glassfish

/**
 * Returns full version including build id
 */
public static String getFullVersion() {
  return (getVersion() + " (build " + getBuildVersion() + ")");
}

代码示例来源:origin: org.glassfish.main.core/kernel

@Override
  public String generate(final Request request, final int status,
      final String reasonPhrase, final String description,
      final Throwable exception) {
    

    if (status == 404) {
      return HttpUtils.getErrorPage(Version.getVersion(),
          "The requested resource is not available.", "404");
    } else {
      return HttpUtils.getErrorPage(Version.getVersion(),
          "The server encountered an internal error that prevented it from fulfilling this request.", "500");
    }
  }
}

代码示例来源:origin: eclipse-ee4j/glassfish

/**
 * Returns version
 */
public static String getVersion() {
  StringBuilder sb = new StringBuilder(getProductName());
  sb.append(" ").append(getVersionPrefix());
  sb.append(" ").append(getVersionNumber());
  sb.append(" ").append(getVersionSuffix());
  return sb.toString();
}

代码示例来源:origin: org.glassfish.main.admin/config-api

public void transactionCommited(List<PropertyChangeEvent> changes) {
  if (!isGlassFishDocumentChanged(changes)) {
    return;
  }
  
  for (ConfigurationPersistence pers : habitat.<ConfigurationPersistence>getAllServices(ConfigurationPersistence.class)) {
    try {
      if (doc.getRoot().getProxyType().equals(Domain.class)) {
        Dom domainRoot = doc.getRoot();
        domainRoot.attribute("version", Version.getBuildVersion());
      }
      pers.save(doc);
    } catch (IOException e) {
      logger.log(Level.SEVERE, 
        ConfigApiLoggerInfo.glassFishDocumentIOException,e);
    } catch (XMLStreamException e) {
      logger.log(Level.SEVERE, 
        ConfigApiLoggerInfo.glassFishDocumentXmlException,e);
    }
  }
}

代码示例来源:origin: eclipse-ee4j/glassfish

/**
 * Return major_version [. minor_version [. update_version]]
 */
public static String getVersionNumber() {
  // construct version number
  String maj = getMajorVersion();
  String min = getMinorVersion();
  String upd = getUpdateVersion();
  String v;
  try {
    if (min != null && min.length() > 0 && Integer.parseInt(min) >= 0) {
      if (upd != null && upd.length() > 0 && Integer.parseInt(upd) >= 0) {
        v = maj + "." + min + "." + upd;
      } else {
        v = maj + "." + min;
      }
    } else {
      if (upd != null && upd.length() > 0 && Integer.parseInt(upd) >= 0) {
        v = maj + ".0." + upd;
      } else {
        v = maj;
      }
    }
  } catch (NumberFormatException nfe) {
    v = maj;
  }
  return v;
}

代码示例来源:origin: org.glassfish.main.admin/server-mgmt

String templateJarPath = (String)_domainConfig.get(DomainConfig.K_TEMPLATE_NAME);
if (templateJarPath == null || templateJarPath.isEmpty()) {
  String defaultTemplateName = Version.getDefaultDomainTemplate();
  if (defaultTemplateName == null || defaultTemplateName.isEmpty()) {
    throw new DomainException(_strings.get("missingDefaultTemplateName"));

代码示例来源:origin: org.glassfish.main.admin/admin-cli

private void invokeLocal() {
  String fv = Version.getFullVersion();
  logger.info(terse ? fv : strings.get("version.local", fv));
  if (verbose)
    logger.info(strings.get("version.local.java",
        System.getProperty("java.version")));
}

代码示例来源:origin: org.glassfish.main.core/kernel

new Object[] { Version.getVersion(), Version.getBuildVersion(), platform,
(platformInitTime - context.getCreationTime()),
(nowTime - platformInitTime),

代码示例来源:origin: org.glassfish.main.core/kernel

serverVersion = serverInfo != null ? serverInfo : Version.getVersion();
      + "(" + ((serverInfo != null && !serverInfo.isEmpty()) ? serverInfo : Version.getVersion())
      + " Java/"
      + System.getProperty("java.vm.vendor") + "/"

相关文章