List of usage examples for org.apache.commons.lang SystemUtils IS_OS_WINDOWS
boolean IS_OS_WINDOWS
To view the source code for org.apache.commons.lang SystemUtils IS_OS_WINDOWS.
Click Source Link
Is true
if this is Windows.
The field will return false
if OS_NAME
is null
.
From source file:com.vmware.identity.interop.ldap.LdapControlNative.java
/** * @deprecated replaced by {@link #LdapControlNative(String, BerValNative, char, TypeMapper) LdapControlNative} * This constructor is used to be backward compatible with other components, like inventory, who are depending on this constructor * @param oid/*from w w w. j av a 2 s .c om*/ * @param value * @param isCritical */ @Deprecated public LdapControlNative(String oid, BerValNative value, char isCritical) { this(oid, value, isCritical, (SystemUtils.IS_OS_WINDOWS) ? W32APITypeMapper.UNICODE : null); }
From source file:com.aliyun.fs.oss.utils.ResourceLoader.java
private static List<URL> geClassLoaderURLs(Configuration conf) throws Exception { String dependPath = conf.get("fs.oss.core.dependency.path"); String[] sdkDeps = null;//from ww w.java 2s. com Boolean runLocal = conf.getBoolean("mapreduce.job.run-local", false); if ((dependPath == null || dependPath.isEmpty()) && !runLocal) { throw new RuntimeException( "Job dose not run locally, set " + "\"fs.oss.core.dependency.path\" first please."); } else if (dependPath == null || dependPath.isEmpty()) { LOG.info("\"mapreduce.job.run-local\" set true."); } else { sdkDeps = dependPath.split(","); } ArrayList<URL> urls = new ArrayList<URL>(); if (sdkDeps != null) { for (String dep : sdkDeps) { urls.add(new URL("file://" + dep)); } } String[] cp; if (conf.getBoolean("mapreduce.job.run-local", false)) { if (SystemUtils.IS_OS_WINDOWS) { cp = System.getProperty("java.class.path").split(";"); } else { cp = System.getProperty("java.class.path").split(":"); } for (String entity : cp) { urls.add(new URL("file:" + entity)); } } return urls; }
From source file:de.erdesignerng.dialect.DialectFactory.java
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()); }// ww w . j a v a 2 s . c om } return me; }
From source file:com.vmware.identity.interop.ldap.SecWinntAuthFlags.java
public SecWinntAuthId(String pszUserName, String pszDomain, String password) { super(SystemUtils.IS_OS_WINDOWS ? W32APITypeMapper.UNICODE : null); this._pszUserName = pszUserName; this._userNameLength = pszUserName == null ? 0 : pszUserName.length(); this._pszDomain = pszDomain; this._domainNameLength = pszDomain == null ? 0 : pszDomain.length(); this._password = password; this._passwordLength = password == null ? 0 : password.length(); this._Flags = SecWinntAuthFlags.SEC_WINNT_AUTH_ID_UNICODE.getCode(); write();//from w w w . j a va2s .c o m }
From source file:com.alibaba.otter.node.etl.common.io.download.DataRetrieverFactory.java
private DataRetriever getAria2cRetriever(String cmd, String url, String targetDir) { if (StringUtils.isEmpty(cmd)) { cmd = (SystemUtils.IS_OS_WINDOWS ? cmd + ".exe" : cmd); }//from www . j a v a 2 s . c om return new Aria2cRetriever(cmd, url, targetDir); }
From source file:com.vmware.identity.interop.domainmanager.WinDomainTrustInfoNative.java
public WinDomainTrustInfoNative() { super(SystemUtils.IS_OS_WINDOWS ? W32APITypeMapper.UNICODE : null); }
From source file:com.theoryinpractise.clojure.ClojureNReplMojo.java
public void execute() throws MojoExecutionException { StringBuilder sb = new StringBuilder(); sb.append("(do "); sb.append("(clojure.tools.nrepl.server/start-server"); sb.append(" :bind \"").append(nreplHost).append("\""); sb.append(" :port "); sb.append(Integer.toString(port)); sb.append("))"); String nreplLoader = sb.toString(); if (SystemUtils.IS_OS_WINDOWS) { nreplLoader = windowsEscapeCommandLineArg(nreplLoader); }//from w w w.j av a 2 s.c om List<String> args = new ArrayList<String>(); if (replScript != null && new File(replScript).exists()) { args.add("-i"); args.add(replScript); } args.add("-e"); args.add("(require (quote clojure.tools.nrepl.server))"); args.add("-e"); args.add(nreplLoader); callClojureWith(getSourceDirectories(SourceDirectory.TEST, SourceDirectory.COMPILE), outputDirectory, getRunWithClasspathElements(), "clojure.main", args.toArray(new String[args.size()])); }
From source file:it.serverSystem.DevModeTest.java
/** * SONAR-4843/*from ww w . j a v a 2 s.com*/ */ @Test public void restart_forbidden_if_not_dev_mode() throws Exception { // server classloader locks Jar files on Windows if (!SystemUtils.IS_OS_WINDOWS) { orchestrator = Orchestrator.builderEnv().build(); orchestrator.start(); try { orchestrator.getServer().adminWsClient().systemClient().restart(); fail(); } catch (Exception e) { assertThat(e.getMessage()).contains("403"); } } }
From source file:com.jstar.eclipse.preferences.PreferenceConstants.java
public static String getSmtPath() { final String path = getStore().getString(PreferenceConstants.SMT_PATH_PREFERENCE); if (SystemUtils.IS_OS_WINDOWS) { return StringUtils.replace(path, "\\", "/"); }// w w w . j a v a 2 s .c o m return path; }
From source file:com.vmware.identity.idm.CommonUtil.java
/** * Returns host IP address//from ww w . j av a 2 s . co m * @return * @throws SocketException * @throws IOException */ public static synchronized String getHostIPAddress(String configDirPath) throws SocketException, IOException { ValidateUtil.validateNotEmpty(configDirPath, "configDirPath"); String configFileName = configDirPath; if (configDirPath.endsWith(File.separator) == false) { configFileName += File.separator; } configFileName += HOSTNAME_FILE_NAME; String ipAddress = null; String CONFIG_IDENTITY_ROOT_KEY = ""; if (SystemUtils.IS_OS_LINUX) { CONFIG_IDENTITY_ROOT_KEY = "Software\\VMware\\Identity\\Configuration"; } else if (SystemUtils.IS_OS_WINDOWS) { CONFIG_IDENTITY_ROOT_KEY = "Software\\VMware\\Identity\\Configuration"; } IRegistryKey registryRootKey = null; try { IRegistryAdapter registryAdpater = RegistryAdapterFactory.getInstance().getRegistryAdapter(); registryRootKey = registryAdpater.openRootKey((int) RegKeyAccess.KEY_READ); if (registryRootKey == null) { throw new NullPointerException("Unable to open Root Key"); } ipAddress = registryAdpater.getStringValue(registryRootKey, CONFIG_IDENTITY_ROOT_KEY, "Hostname", true); if (ipAddress == null) { ipAddress = ReadHostNameFile(configFileName); } } catch (Exception ex) { // failed to retrieve ipaddress from hostname.txt, fall back to // original solution ipAddress = null; try { ipAddress = ReadHostNameFile(configFileName); } catch (Exception exp) { _logger.info("Failed to read hostname file"); } if (ipAddress == null) { ipAddress = findInetAddress(new Predicate<InetAddress>() { @Override public boolean matches(InetAddress addr) { return ((addr != null) && (addr.getClass() == Inet4Address.class)); } }); } if (ipAddress == null) { _logger.info("Failed to find local IPV4 Address."); ipAddress = findInetAddress(new Predicate<InetAddress>() { @Override public boolean matches(InetAddress addr) { return ((addr != null) && (addr.getClass() == Inet6Address.class)); } }); if (ipAddress == null) { _logger.info("Failed to find local IPV6 Address."); } } if (ipAddress == null) { logAndThrow("Error : Failed to find local either IPV4 or IPV6 Inet Address."); } } finally { if (registryRootKey != null) registryRootKey.close(); } return ipAddress; }