com.sun.enterprise.util.OS.isWindowsForSure()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(10.9k)|赞(0)|评价(0)|浏览(136)

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

OS.isWindowsForSure介绍

暂无

代码示例

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

static boolean apropos() {
  return OS.isWindowsForSure();
}

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

/**
 * If we can determine it -- find out if the process that owns the given
 * process id is running.
 * @param aPid
 * @return true if it's running, false if not and null if we don't know.
 * I.e the return value is a true tri-state Boolean.
 */
public static final Boolean isProcessRunning(int aPid) {
  try {
    if (OS.isWindowsForSure())
      return isProcessRunningWindows(aPid);
    else
      return isProcessRunningUnix(aPid);
  }
  catch (Exception e) {
    return null;
  }
}
//////////////////////////////////////////////////////////////////////////

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

private void validateServiceName() throws CommandException {
  if (!ok(serviceName))
    serviceName = dirs.getServerDir().getName();
  // On Windows we need a legal filename for the service name.
  if(OS.isWindowsForSure() && !FileUtils.isFriendlyFilename(serviceName)) {
    throw new CommandException(strings.get("create.service.badServiceName", serviceName));
  }
  if (logger.isLoggable(Level.FINER))
    logger.finer("service name = " + serviceName);
}

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

/**
 * If we can determine it -- find out if the process that owns the given
 * process id is running.
 *
 * @param aPid
 * @return true if it's running, false if not and null if we don't know. I.e
 * the return value is a true tri-state Boolean.
 */
public static Boolean isProcessRunning(int aPid) {
  try {
    if (OS.isWindowsForSure())
      return isProcessRunningWindows(aPid);
    else
      return isProcessRunningUnix(aPid);
  }
  catch (Exception e) {
    return null;
  }
}
//////////////////////////////////////////////////////////////////////////

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

/**
 * If we can determine it -- find out if the process that owns the given
 * process id is running.
 *
 * @param aPid
 * @return true if it's running, false if not and null if we don't know. I.e
 * the return value is a true tri-state Boolean.
 */
public static Boolean isProcessRunning(int aPid) {
  try {
    if (OS.isWindowsForSure())
      return isProcessRunningWindows(aPid);
    else
      return isProcessRunningUnix(aPid);
  }
  catch (Exception e) {
    return null;
  }
}
//////////////////////////////////////////////////////////////////////////

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

private void validateServiceName() throws CommandException {
  if (!ok(serviceName))
    serviceName = dirs.getServerDir().getName();
  // On Windows we need a legal filename for the service name.
  if(OS.isWindowsForSure() && !FileUtils.isFriendlyFilename(serviceName)) {
    throw new CommandException(strings.get("create.service.badServiceName", serviceName));
  }
  logger.finer("service name = " + serviceName);
}

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

private void validateServiceName() throws CommandException {
  if (!ok(serviceName))
    serviceName = dirs.getServerDir().getName();
  // On Windows we need a legal filename for the service name.
  if(OS.isWindowsForSure() && !FileUtils.isFriendlyFilename(serviceName)) {
    throw new CommandException(strings.get("create.service.badServiceName", serviceName));
  }
  logger.finer("service name = " + serviceName);
}

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

private void validateServiceName() throws CommandException {
  if (!ok(serviceName))
    serviceName = dirs.getServerDir().getName();
  // On Windows we need a legal filename for the service name.
  if(OS.isWindowsForSure() && !FileUtils.isFriendlyFilename(serviceName)) {
    throw new CommandException(strings.get("create.service.badServiceName", serviceName));
  }
  logger.finer("service name = " + serviceName);
}

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

/**
   * @param args the command line arguments
   */
  public static void main(String args[])
  {
    System.out.println("os.version = "                  + System.getProperty("os.version"));
    System.out.println("os.name = "                     + System.getProperty("os.name"));
    System.out.println("os.arch = "                     + System.getProperty("os.arch"));
    System.out.println("isUNIX() returned: "            + isUNIX());
    System.out.println("isWindows() returned: "         + isWindows());
    System.out.println("isWindowsForSure() returned: "  + isWindowsForSure());
    System.out.println("isSun() returned: "             + isSun());
    System.out.println("isLinux() returned: "           + isLinux());
    System.out.println("isDebianLinux() returned: "     + isDebianLinux());
    System.out.println("isFedoraLinux() returned: "     + isFedoraLinux());
    System.out.println("isGentooLinux() returned: "     + isGentooLinux());
    System.out.println("isKnoppixLinux() returned: "    + isKnoppixLinux());
    System.out.println("isMandrakeLinux() returned: "   + isMandrakeLinux());
    System.out.println("isMandrivaLinux() returned: "   + isMandrivaLinux());
    System.out.println("isRedHatLinux() returned: "     + isRedHatLinux());
    System.out.println("isSlackwareLinux() returned: "  + isSlackwareLinux());
    System.out.println("isSuSELinux() returned: "       + isSuSELinux());
    System.out.println("isUbuntuLinux() returned: "     + isUbuntuLinux());
    System.out.println("isSunX86() returned: "          + isSunX86());
    System.out.println("isSunSparc() returned: "        + isSunSparc());
    System.out.println("isDarwin() returned: "          + isDarwin());
    System.out.println("isSolaris10() returned: "       + isSolaris10());
    System.out.println("isAix() returned: "             + isAix());
  }
}

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

/**
   * @param args the command line arguments
   */
  public static void main(String args[])
  {
    System.out.println("os.version = "                  + System.getProperty("os.version"));
    System.out.println("os.name = "                     + System.getProperty("os.name"));
    System.out.println("os.arch = "                     + System.getProperty("os.arch"));
    System.out.println("isUNIX() returned: "            + isUNIX());
    System.out.println("isWindows() returned: "         + isWindows());
    System.out.println("isWindowsForSure() returned: "  + isWindowsForSure());
    System.out.println("isSun() returned: "             + isSun());
    System.out.println("isLinux() returned: "           + isLinux());
    System.out.println("isDebianLinux() returned: "     + isDebianLinux());
    System.out.println("isFedoraLinux() returned: "     + isFedoraLinux());
    System.out.println("isGentooLinux() returned: "     + isGentooLinux());
    System.out.println("isKnoppixLinux() returned: "    + isKnoppixLinux());
    System.out.println("isMandrakeLinux() returned: "   + isMandrakeLinux());
    System.out.println("isMandrivaLinux() returned: "   + isMandrivaLinux());
    System.out.println("isRedHatLinux() returned: "     + isRedHatLinux());
    System.out.println("isSlackwareLinux() returned: "  + isSlackwareLinux());
    System.out.println("isSuSELinux() returned: "       + isSuSELinux());
    System.out.println("isUbuntuLinux() returned: "     + isUbuntuLinux());
    System.out.println("isSunX86() returned: "          + isSunX86());
    System.out.println("isSunSparc() returned: "        + isSunSparc());
    System.out.println("isDarwin() returned: "          + isDarwin());
    System.out.println("isSolaris10() returned: "       + isSolaris10());
    System.out.println("isAix() returned: "             + isAix());
  }
}

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

/**
   * @param args the command line arguments
   */
  public static void main(String args[])
  {
    System.out.println("os.version = "                  + System.getProperty("os.version"));
    System.out.println("os.name = "                     + System.getProperty("os.name"));
    System.out.println("os.arch = "                     + System.getProperty("os.arch"));
    System.out.println("isUNIX() returned: "            + isUNIX());
    System.out.println("isWindows() returned: "         + isWindows());
    System.out.println("isWindowsForSure() returned: "  + isWindowsForSure());
    System.out.println("isSun() returned: "             + isSun());
    System.out.println("isLinux() returned: "           + isLinux());
    System.out.println("isDebianLinux() returned: "     + isDebianLinux());
    System.out.println("isFedoraLinux() returned: "     + isFedoraLinux());
    System.out.println("isGentooLinux() returned: "     + isGentooLinux());
    System.out.println("isKnoppixLinux() returned: "    + isKnoppixLinux());
    System.out.println("isMandrakeLinux() returned: "   + isMandrakeLinux());
    System.out.println("isMandrivaLinux() returned: "   + isMandrivaLinux());
    System.out.println("isRedHatLinux() returned: "     + isRedHatLinux());
    System.out.println("isSlackwareLinux() returned: "  + isSlackwareLinux());
    System.out.println("isSuSELinux() returned: "       + isSuSELinux());
    System.out.println("isUbuntuLinux() returned: "     + isUbuntuLinux());
    System.out.println("isSunX86() returned: "          + isSunX86());
    System.out.println("isSunSparc() returned: "        + isSunSparc());
    System.out.println("isDarwin() returned: "          + isDarwin());
    System.out.println("isSolaris10() returned: "       + isSolaris10());
    System.out.println("isAix() returned: "             + isAix());
  }
}

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

void initialize() {
  final String parentPath = info.serverDirs.getServerParentDir().getPath();
  final String serverName = info.serverDirs.getServerName();
  setAsadminCredentials();
  getTokenMap().put(CFG_LOCATION_TN, parentPath);
  getTokenMap().put(ENTITY_NAME_TN, serverName);
  getTokenMap().put(LOCATION_ARGS_START_TN, getLocationArgsStart());
  getTokenMap().put(LOCATION_ARGS_RESTART_TN, getLocationArgsRestart());
  getTokenMap().put(LOCATION_ARGS_STOP_TN, getLocationArgsStop());
  getTokenMap().put(START_COMMAND_TN, info.type.startCommand());
  getTokenMap().put(RESTART_COMMAND_TN, info.type.restartCommand());
  getTokenMap().put(STOP_COMMAND_TN, info.type.stopCommand());
  getTokenMap().put(FQSN_TN, info.fqsn);
  getTokenMap().put(OS_USER_TN, info.osUser);
  if (OS.isWindowsForSure() && !LINUX_HACK) {
    // Windows doesn't respond well to slashes in the name!!
    getTokenMap().put(SERVICE_NAME_TN, info.serviceName);
    getTokenMap().put(ENTITY_NAME_TN, serverName);
  }
  else
    getTokenMap().put(SERVICE_NAME_TN, info.smfFullServiceName);
  getTokenMap().put(AS_ADMIN_PATH_TN, info.asadminScript.getPath().replace('\\', '/'));
  getTokenMap().put(DATE_CREATED_TN, info.date.toString());
  getTokenMap().put(SERVICE_TYPE_TN, info.type.toString());
  getTokenMap().put(CREDENTIALS_TN, getCredentials());
}

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

String cmdline;
if (OS.isWindowsForSure()) {
  pm = new ProcessManager("taskkill", "/F", "/T", "/pid", pidString);
  cmdline = "taskkill /F /T /pid " + pidString;

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

String cmdline;
if (OS.isWindowsForSure()) {
  pm = new ProcessManager("taskkill", "/F", "/T", "/pid", pidString);
  cmdline = "taskkill /F /T /pid " + pidString;

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

String cmdline;
if (OS.isWindowsForSure()) {
  pm = new ProcessManager("taskkill", "/F", "/T", "/pid", pidString);
  cmdline = "taskkill /F /T /pid " + pidString;

相关文章