当前位置: 首页>>代码示例>>Java>>正文


Java SystemUtils.IS_OS_WINDOWS属性代码示例

本文整理汇总了Java中org.apache.commons.lang.SystemUtils.IS_OS_WINDOWS属性的典型用法代码示例。如果您正苦于以下问题:Java SystemUtils.IS_OS_WINDOWS属性的具体用法?Java SystemUtils.IS_OS_WINDOWS怎么用?Java SystemUtils.IS_OS_WINDOWS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.commons.lang.SystemUtils的用法示例。


在下文中一共展示了SystemUtils.IS_OS_WINDOWS属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initSharedGlobalPrefs

/**
 * Initialize visible Global Preferences that are shared between the
 * Module Manager and the Editor/Player.
 *
 */
public static void initSharedGlobalPrefs() {
  getGlobalPrefs();

  // Option to disable D3D pipeline
  if (SystemUtils.IS_OS_WINDOWS) {
    final BooleanConfigurer d3dConf = new BooleanConfigurer(
      DISABLE_D3D,
      Resources.getString("Prefs.disable_d3d"),
      Boolean.FALSE
    );
    globalPrefs.addOption(d3dConf);
  }

  final BooleanConfigurer wizardConf = new BooleanConfigurer(
    WizardSupport.WELCOME_WIZARD_KEY,
    Resources.getString("WizardSupport.ShowWizard"),
    Boolean.TRUE
  );

  globalPrefs.addOption(wizardConf);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:26,代码来源:Prefs.java

示例2: createFileChooser

/**
 * Creates a FileChooser appropriate for the user's OS.
 *
 * @param parent
 *          The Component over which the FileChooser should appear.
 * @param prefs
 *          A FileConfigure that stores the preferred starting directory of the FileChooser in preferences
 */
public static FileChooser createFileChooser(Component parent, DirectoryConfigurer prefs, int mode) {
  FileChooser fc;
  if (SystemUtils.IS_OS_MAC_OSX) {
    // Mac has a good native file dialog
    fc = new NativeFileChooser(parent, prefs, mode);
  }
  else if (mode == FILES_ONLY && SystemUtils.IS_OS_WINDOWS) {
    // Window has a good native file dialog, but it doesn't support selecting directories
    fc = new NativeFileChooser(parent, prefs, mode);
  }
  else {
    // Linux's native dialog is inferior to Swing's
    fc = new SwingFileChooser(parent, prefs, mode);
  }
  return fc;
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:24,代码来源:FileChooser.java

示例3: getDockerClient

private DockerClient getDockerClient() {
    /*
    TLS connection: ...

    DefaultDockerClientConfig config = DefaultDockerClientConfig.createDefaultConfigBuilder()
            .withDockerHost("tcp://192.168.99.100:2376")
            .withDockerTlsVerify(true)
            .withDockerCertPath("/Users/jon/.docker/machine/machines/default")
            .build();
    */

    final String localDockerHost = SystemUtils.IS_OS_WINDOWS ? "tcp://localhost:2375" : "unix:///var/run/docker.sock";

    final DefaultDockerClientConfig config = DefaultDockerClientConfig
            .createDefaultConfigBuilder()
            .withDockerHost(localDockerHost)
            .build();

    return DockerClientBuilder
            .getInstance(config)
            .build();
}
 
开发者ID:jonfryd,项目名称:tifoon,代码行数:22,代码来源:DockerExecutorPlugin.java

示例4: testShellCommandScript

@Test
public void testShellCommandScript() throws InterruptedException, LifecycleException,
                                            EventDeliveryException, IOException {
  // mini script
  if (SystemUtils.IS_OS_WINDOWS) {
    runTestShellCmdHelper("powershell -ExecutionPolicy Unrestricted -command",
                          "foreach ($i in 1..5) { $i }",
                          new String[] { "1", "2", "3", "4", "5" });
    // shell arithmetic
    runTestShellCmdHelper("powershell -ExecutionPolicy Unrestricted -command",
                          "if(2+2 -gt 3) { 'good' } else { 'not good' } ",
                          new String[] { "good" });
  } else {
    runTestShellCmdHelper("/bin/bash -c", "for i in {1..5}; do echo $i;done",
                          new String[] { "1", "2", "3", "4", "5" });
    // shell arithmetic
    runTestShellCmdHelper("/bin/bash -c",
                          "if ((2+2>3)); " + "then  echo good; else echo not good; fi",
                          new String[] { "good" });
  }
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:21,代码来源:TestExecSource.java

示例5: findAtoumBinPath

public static String findAtoumBinPath(VirtualFile dir)
{
    String defaultBinPath = dir.getPath() + "/vendor/bin/atoum";
    String atoumBinPath = defaultBinPath;

    String binDir = getComposerBinDir(dir.getPath() + "/composer.json");
    String binPath = dir.getPath() + "/" + binDir + "/atoum";
    if (null != binDir && new File(binPath).exists()) {
        atoumBinPath = binPath;
    }

    if (SystemUtils.IS_OS_WINDOWS) {
        atoumBinPath += ".bat";
    }

    return atoumBinPath;
}
 
开发者ID:atoum,项目名称:phpstorm-plugin,代码行数:17,代码来源:AtoumUtils.java

示例6: save

@Override
public String save(final long uid, final String folder, final byte[] data, final String sizeList) throws IOException {
	if (SystemUtils.IS_OS_WINDOWS) {
		if (!this.isWeb()) {
			return super.save(uid, folder, data, sizeList);
		}
	}
	final String uri = folder + uuid() + ".jpg";
	logger.info("async save:" + uri);
	new Thread() {
		@Override
		public void run() {
			try {
				saveByUri(uid, uri, data, sizeList);
				logger.info("save:" + uri);
			}
			catch (IOException e) {
				logger.error(e.getMessage(), e);
			}
		};
	}.start();
	// saveByUri(uid, uri, data, sizeList);
	return uri;
}
 
开发者ID:tanhaichao,项目名称:leopard,代码行数:24,代码来源:ImageDfsServiceImpl.java

示例7: getPhantomLocation

/**
 * The location of the phantom js is different for different os types. The
 * method returns the appropriate binary corresponding to the os. Currently
 * only Windows, Mac OS and Linux are supported.
 *
 * @return The location of the phantom js
 */
private static String getPhantomLocation() {
    String phantomLocation;
    String reportDirectory = ExportUtils.getReportDirectory() + File.separator;
    if (SystemUtils.IS_OS_WINDOWS) {
        phantomLocation = reportDirectory + "windows_phantomjs.exe";
    } else if (SystemUtils.IS_OS_MAC) {
        phantomLocation = reportDirectory + "macosx_phantomjs";
    } else if (SystemUtils.IS_OS_LINUX) {
        phantomLocation = reportDirectory + "linux_phantomjs";
    } else {
        logger.error("phantomLocation is null. Check phantomjs binary is present or not");
        throw new EfwException("PhantomJs Location is null. Can't process request.");
    }

    File file = new File(phantomLocation);
    phantomLocation = file.getAbsolutePath();
    return phantomLocation;
}
 
开发者ID:helicalinsight,项目名称:helicalinsight,代码行数:25,代码来源:ReportsProcessor.java

示例8: initializeLibraryPath

public static void initializeLibraryPath() throws Exception {
    File theJava3DFile = new File("java3d");
    File theJava3DLibraryFile = null;
    if (SystemUtils.IS_OS_WINDOWS) {
        if (VM_32_BIT) {
            theJava3DLibraryFile =  new File(theJava3DFile, "win32");
        } else {
            theJava3DLibraryFile =  new File(theJava3DFile, "win64");
        }
    }
    if (SystemUtils.IS_OS_LINUX) {
        if (VM_32_BIT) {
            theJava3DLibraryFile =  new File(theJava3DFile, "linux32");
        } else {
            theJava3DLibraryFile =  new File(theJava3DFile, "linux64");
        }
    }
    if (SystemUtils.IS_OS_MAC) {
        theJava3DLibraryFile =  new File(theJava3DFile, "macos-universal");
    }
    if (theJava3DLibraryFile != null) {
        addLibraryPath(theJava3DLibraryFile.getAbsolutePath());
    }
}
 
开发者ID:mirkosertic,项目名称:ERDesignerNG,代码行数:24,代码来源:Java3DUtils.java

示例9: getInstance

public static synchronized DialectFactory getInstance() {
    if (me == null) {
        me = new DialectFactory();
        me.registerDialect(new DB2Dialect());
        me.registerDialect(new MSSQLDialect());
        me.registerDialect(new MySQLDialect());
        me.registerDialect(new MySQLInnoDBDialect());
        me.registerDialect(new OracleDialect());
        me.registerDialect(new PostgresDialect());
        me.registerDialect(new H2Dialect());
        me.registerDialect(new HSQLDBDialect());

        // provide MSAccessDialect only on Windows-Systems due to the
        // requirement of the JET/ACE-Engine
        if (SystemUtils.IS_OS_WINDOWS) {
            me.registerDialect(new MSAccessDialect());
        }
    }

    return me;
}
 
开发者ID:mirkosertic,项目名称:ERDesignerNG,代码行数:21,代码来源:DialectFactory.java

示例10: copyHadoopHomeToTemp

/**
 * Copies the HADOOP_HOME bin directory to the {@link MiniAccumuloCluster} temp directory.
 * {@link MiniAccumuloCluster} expects to find bin/winutils.exe in the MAC temp
 * directory instead of HADOOP_HOME for some reason.
 * @throws IOException
 */
private void copyHadoopHomeToTemp() throws IOException {
    if (IS_COPY_HADOOP_HOME_ENABLED && SystemUtils.IS_OS_WINDOWS) {
        final String hadoopHomeEnv = PathUtils.clean(System.getenv("HADOOP_HOME"));
        if (hadoopHomeEnv != null) {
            final File hadoopHomeDir = new File(hadoopHomeEnv);
            if (hadoopHomeDir.exists()) {
                final File binDir = Paths.get(hadoopHomeDir.getAbsolutePath(), "/bin").toFile();
                if (binDir.exists()) {
                    FileUtils.copyDirectoryToDirectory(binDir, tempDir);
                } else {
                    log.warn("The specified path for the Hadoop bin directory does not exist: " + binDir.getAbsolutePath());
                }
            } else {
                log.warn("The specified path for HADOOP_HOME does not exist: " + hadoopHomeDir.getAbsolutePath());
            }
        } else {
            log.warn("The HADOOP_HOME environment variable was not found.");
        }
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:26,代码来源:AccumuloInstanceDriver.java

示例11: imageSettings

/**
 * Image settings.
 *
 * @return the files settings
 */
@Bean
public FilesSettings imageSettings() {
	FilesSettings filesSettings = new FilesSettings();
	if (SystemUtils.IS_OS_WINDOWS) {
		filesSettings.setImageDefaultPath(env.getProperty("image.default.windows.path"));
		filesSettings.setDocumentsDefaultPath(env.getProperty("documents.default.windows.path"));
	}
	else {
		filesSettings.setImageDefaultPath(env.getProperty("image.default.linux.path"));
		filesSettings.setDocumentsDefaultPath(env.getProperty("documents.default.linux.path"));
		
	}
	
	return filesSettings;
}
 
开发者ID:gleb619,项目名称:hotel_shop,代码行数:20,代码来源:TestConfig.java

示例12: testConsumeFileRandomlyNewFile

@Test
public void testConsumeFileRandomlyNewFile() throws Exception {
  // Atomic moves are not supported in Windows.
  if (SystemUtils.IS_OS_WINDOWS) {
    return;
  }
  final ReliableEventReader reader =
      new ReliableSpoolingFileEventReader.Builder().spoolDirectory(WORK_DIR)
                                                   .consumeOrder(ConsumeOrder.RANDOM)
                                                   .build();
  File fileName = new File(WORK_DIR, "new-file");
  FileUtils.write(fileName, "New file created in the end. Shoud be read randomly.\n");
  Set<String> expected = Sets.newHashSet();
  int totalFiles = WORK_DIR.listFiles().length;
  final Set<String> actual = Sets.newHashSet();
  ExecutorService executor = Executors.newSingleThreadExecutor();
  final Semaphore semaphore1 = new Semaphore(0);
  final Semaphore semaphore2 = new Semaphore(0);
  Future<Void> wait = executor.submit(new Callable<Void>() {
    @Override
    public Void call() throws Exception {
      readEventsForFilesInDir(WORK_DIR, reader, actual, semaphore1, semaphore2);
      return null;
    }
  });
  semaphore1.acquire();
  File finalFile = new File(WORK_DIR, "t-file");
  FileUtils.write(finalFile, "Last file");
  semaphore2.release();
  wait.get();
  int listFilesCount = ((ReliableSpoolingFileEventReader)reader).getListFilesCount();
  finalFile.delete();
  createExpectedFromFilesInSetup(expected);
  expected.add("");
  expected.add("New file created in the end. Shoud be read randomly.");
  expected.add("Last file");
  Assert.assertTrue(listFilesCount < (totalFiles + 2));
  Assert.assertEquals(expected, actual);
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:39,代码来源:TestReliableSpoolingFileEventReader.java

示例13: testShellCommandSimple

@Test
public void testShellCommandSimple() throws InterruptedException, LifecycleException,
                                            EventDeliveryException, IOException {
  if (SystemUtils.IS_OS_WINDOWS) {
    runTestShellCmdHelper("powershell -ExecutionPolicy Unrestricted -command",
                          "1..5", new String[] { "1", "2", "3", "4", "5" });
  } else {
    runTestShellCmdHelper("/bin/bash -c", "seq 5",
                          new String[] { "1", "2", "3", "4", "5" });
  }
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:11,代码来源:TestExecSource.java

示例14: testShellCommandBackTicks

@Test
public void testShellCommandBackTicks() throws InterruptedException, LifecycleException,
                                               EventDeliveryException, IOException {
  // command with backticks
  if (SystemUtils.IS_OS_WINDOWS) {
    runTestShellCmdHelper("powershell -ExecutionPolicy Unrestricted -command", "$(1..5)",
                          new String[] { "1", "2", "3", "4", "5" });
  } else {
    runTestShellCmdHelper("/bin/bash -c", "echo `seq 5`",
                          new String[] { "1 2 3 4 5" });
    runTestShellCmdHelper("/bin/bash -c", "echo $(seq 5)",
                          new String[] { "1 2 3 4 5" });
  }
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:14,代码来源:TestExecSource.java

示例15: testShellCommandComplex

@Test
public void testShellCommandComplex()
    throws InterruptedException, LifecycleException, EventDeliveryException, IOException {
  // command with wildcards & pipes
  String[] expected = {"1234", "abcd", "ijk", "xyz", "zzz"};
  // pipes
  if (SystemUtils.IS_OS_WINDOWS) {
    runTestShellCmdHelper("powershell -ExecutionPolicy Unrestricted -command",
                          "'zzz','1234','xyz','abcd','ijk' | sort", expected);
  } else {
    runTestShellCmdHelper("/bin/bash -c",
                          "echo zzz 1234 xyz abcd ijk | xargs -n1 echo | sort -f", expected);
  }
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:14,代码来源:TestExecSource.java


注:本文中的org.apache.commons.lang.SystemUtils.IS_OS_WINDOWS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。