本文整理匯總了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);
}
示例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;
}
示例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();
}
示例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" });
}
}
示例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;
}
示例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;
}
示例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;
}
示例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());
}
}
示例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;
}
示例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.");
}
}
}
示例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;
}
示例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);
}
示例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" });
}
}
示例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" });
}
}
示例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);
}
}