本文整理匯總了Java中org.apache.commons.lang.SystemUtils.IS_OS_MAC屬性的典型用法代碼示例。如果您正苦於以下問題:Java SystemUtils.IS_OS_MAC屬性的具體用法?Java SystemUtils.IS_OS_MAC怎麽用?Java SystemUtils.IS_OS_MAC使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.apache.commons.lang.SystemUtils
的用法示例。
在下文中一共展示了SystemUtils.IS_OS_MAC屬性的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getDefaultEthDevice
public static String getDefaultEthDevice() {
if (SystemUtils.IS_OS_MAC) {
final String defDev = Script.runSimpleBashScript("/sbin/route -n get default 2> /dev/null | grep interface | awk '{print $2}'");
return defDev;
}
final String defaultRoute = Script.runSimpleBashScript("/sbin/route | grep default");
if (defaultRoute == null) {
return null;
}
final String[] defaultRouteList = defaultRoute.split("\\s+");
if (defaultRouteList.length != 8) {
return null;
}
return defaultRouteList[7];
}
示例2: 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;
}
示例3: 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());
}
}
示例4: getServerIpNoCache
private static String getServerIpNoCache() {
if (SystemUtils.IS_OS_WINDOWS) {
return "127.0.0.1";
}
else if (SystemUtils.IS_OS_MAC) {
return "127.0.0.1";
}
else if (SystemUtils.IS_OS_LINUX) {
try {
NetworkInterface networkInterface = NetworkInterface.getByName("eth0");
if (networkInterface == null) {
networkInterface = NetworkInterface.getByName("eth1");
if (networkInterface == null) {
throw new NullPointerException("網卡eth0和eth1都找不到,沒辦法獲取到IP.");
}
}
return getServerIp(networkInterface);
}
catch (SocketException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
else {
throw new RuntimeException("未知操作係統.");
}
}
示例5: getDir
@Override
public String getDir() {
// TODO ubuntu桌麵環境判斷
if (SystemUtils.IS_OS_MAC) {
return System.getProperty("user.home") + "/log/resin";
}
return "/log/resin";
}
示例6: LibraryLoader
public LibraryLoader() {
tmpdir = System.getProperty("java.io.tmpdir");
fLibsFolder = "OCR";
vSysArch = System.getProperty("sikuli.arch");
if (null == vSysArch) {
vSysArch = System.getProperty("os.arch");
}
if (vSysArch.contains("64")) {
vSysArch = "x86";
} else {
vSysArch = "x86";
}
if (SystemUtils.IS_OS_WINDOWS) {
neededLibs = new String[] {"libtesseract-3.dll", "jnitesseract.dll"};
os = "windows";
} else if (SystemUtils.IS_OS_MAC) {
neededLibs = new String[] {"libtesseract.3.dylib", "libjnitesseract.dylib"};
os = "macosx";
} else if (SystemUtils.IS_OS_LINUX) {
neededLibs = new String[] {"libtesseract.so.3", "libjnitesseract.so"};
os = "linux";
}
this.extractDllFromJar();
}
示例7: getDirInAppData
public static @Nullable String getDirInAppData(String dir) {
if (SystemUtils.IS_OS_WINDOWS) {
return System.getenv("APPDATA") + "/." + dir;
} else if (SystemUtils.IS_OS_MAC) {
return SystemUtils.USER_HOME + "/Library/Application Support/" + dir;
} else if (SystemUtils.IS_OS_UNIX) {
return SystemUtils.USER_HOME + "/." + dir;
}
return null;
}
示例8: createTempDirectory
private File createTempDirectory() {
try {
if (SystemUtils.IS_OS_MAC) {
return Files.createTempDirectory(Paths.get(OS_MAC_TMP_DIR), TESTCONTAINERS_TMP_DIR_PREFIX).toFile();
}
return Files.createTempDirectory(TESTCONTAINERS_TMP_DIR_PREFIX).toFile();
} catch (IOException e) {
return new File(TESTCONTAINERS_TMP_DIR_PREFIX + Base58.randomString(5));
}
}
示例9: createDataSource
protected BeanDefinition createDataSource(String dataSourceId, Element element, ParserContext parserContext) {
final String host = element.getAttribute("host");
final String database = element.getAttribute("database");
final String user = element.getAttribute("user");
final String password = element.getAttribute("password");
final String maxPoolSize = element.getAttribute("maxPoolSize");
final String driverClass = element.getAttribute("driverClass");
final String port = element.getAttribute("port");
int idleConnectionTestPeriod = 0;
if (EnvUtil.isDevEnv() && (SystemUtils.IS_OS_WINDOWS || SystemUtils.IS_OS_MAC)) {
idleConnectionTestPeriod = 60;// 間隔60秒檢查空閑連接
}
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(DataSourceManager.getJdbcDataSource());
builder.addPropertyValue("host", host);
builder.addPropertyValue("database", database);
builder.addPropertyValue("user", user);
builder.addPropertyValue("password", password);
builder.addPropertyValue("driverClass", driverClass);
if (StringUtils.isNotEmpty(port)) {
builder.addPropertyValue("port", port);
}
if (StringUtils.isNotEmpty(maxPoolSize)) {
builder.addPropertyValue("maxPoolSize", maxPoolSize);
}
builder.addPropertyValue("idleConnectionTestPeriod", idleConnectionTestPeriod);
builder.setInitMethodName("init");
builder.setDestroyMethodName("destroy");
builder.setScope(BeanDefinition.SCOPE_SINGLETON);
builder.setLazyInit(true);
// builder.setInitMethodName("init");
// builder.setDestroyMethodName("destroy");
return RegisterComponentUtil.registerComponent(parserContext, builder, dataSourceId);
}
示例10: isEnabled
@Override
public boolean isEnabled() {
return SystemUtils.IS_OS_MAC;
}
示例11: MindMapPanelConfig
public MindMapPanelConfig() {
if (SystemUtils.IS_OS_MAC) {
// key map for MAC
this.mapShortCut.put(KEY_ADD_CHILD_AND_START_EDIT, new KeyShortcut(KEY_ADD_CHILD_AND_START_EDIT, KeyEvent.VK_TAB, 0));
this.mapShortCut.put(KEY_ADD_SIBLING_AND_START_EDIT, new KeyShortcut(KEY_ADD_SIBLING_AND_START_EDIT, KeyEvent.VK_ENTER, 0));
this.mapShortCut.put(KEY_CANCEL_EDIT, new KeyShortcut(KEY_CANCEL_EDIT, KeyEvent.VK_ESCAPE, 0));
this.mapShortCut.put(KEY_TOPIC_FOLD, new KeyShortcut(KEY_TOPIC_FOLD, KeyEvent.VK_MINUS, 0));
this.mapShortCut.put(KEY_TOPIC_UNFOLD, new KeyShortcut(KEY_TOPIC_UNFOLD, KeyEvent.VK_EQUALS, 0));
this.mapShortCut.put(KEY_FOCUS_ROOT_OR_START_EDIT, new KeyShortcut(KEY_FOCUS_ROOT_OR_START_EDIT, KeyEvent.VK_SPACE, KeyEvent.ALT_MASK));
this.mapShortCut.put(KEY_FOCUS_MOVE_DOWN, new KeyShortcut(KEY_FOCUS_MOVE_DOWN, KeyEvent.VK_DOWN, 0));
this.mapShortCut.put(KEY_FOCUS_MOVE_UP, new KeyShortcut(KEY_FOCUS_MOVE_UP, KeyEvent.VK_UP, 0));
this.mapShortCut.put(KEY_FOCUS_MOVE_LEFT, new KeyShortcut(KEY_FOCUS_MOVE_LEFT, KeyEvent.VK_LEFT, 0));
this.mapShortCut.put(KEY_FOCUS_MOVE_RIGHT, new KeyShortcut(KEY_FOCUS_MOVE_RIGHT, KeyEvent.VK_RIGHT, 0));
this.mapShortCut.put(KEY_FOCUS_MOVE_DOWN_ADD_FOCUSED, new KeyShortcut(KEY_FOCUS_MOVE_DOWN_ADD_FOCUSED, KeyEvent.VK_DOWN, KeyEvent.SHIFT_MASK));
this.mapShortCut.put(KEY_FOCUS_MOVE_UP_ADD_FOCUSED, new KeyShortcut(KEY_FOCUS_MOVE_UP_ADD_FOCUSED, KeyEvent.VK_UP, KeyEvent.SHIFT_MASK));
this.mapShortCut.put(KEY_FOCUS_MOVE_LEFT_ADD_FOCUSED, new KeyShortcut(KEY_FOCUS_MOVE_LEFT_ADD_FOCUSED, KeyEvent.VK_LEFT, KeyEvent.SHIFT_MASK));
this.mapShortCut.put(KEY_FOCUS_MOVE_RIGHT_ADD_FOCUSED, new KeyShortcut(KEY_FOCUS_MOVE_RIGHT_ADD_FOCUSED, KeyEvent.VK_RIGHT, KeyEvent.SHIFT_MASK));
this.mapShortCut.put(KEY_DELETE_TOPIC, new KeyShortcut(KEY_DELETE_TOPIC, KeyEvent.VK_DELETE, 0));
this.mapShortCut.put(KEY_TOPIC_TEXT_NEXT_LINE, new KeyShortcut(KEY_TOPIC_TEXT_NEXT_LINE, KeyEvent.VK_ENTER, KeyEvent.SHIFT_MASK));
this.mapShortCut.put(KEY_ZOOM_IN, new KeyShortcut(KEY_ZOOM_IN, KeyEvent.VK_PLUS, KeyEvent.CTRL_MASK));
this.mapShortCut.put(KEY_ZOOM_OUT, new KeyShortcut(KEY_ZOOM_OUT, KeyEvent.VK_MINUS, KeyEvent.CTRL_MASK));
this.mapShortCut.put(KEY_ZOOM_RESET, new KeyShortcut(KEY_ZOOM_RESET, KeyEvent.VK_0, KeyEvent.CTRL_MASK));
this.mapShortCut.put(KEY_SHOW_POPUP, new KeyShortcut(KEY_SHOW_POPUP, KeyEvent.VK_SPACE, KeyEvent.CTRL_MASK | KeyEvent.ALT_MASK));
} else {
// key map for Linux and Windows
this.mapShortCut.put(KEY_ADD_CHILD_AND_START_EDIT, new KeyShortcut(KEY_ADD_CHILD_AND_START_EDIT, KeyEvent.VK_TAB, 0));
this.mapShortCut.put(KEY_ADD_SIBLING_AND_START_EDIT, new KeyShortcut(KEY_ADD_SIBLING_AND_START_EDIT, KeyEvent.VK_ENTER, 0));
this.mapShortCut.put(KEY_CANCEL_EDIT, new KeyShortcut(KEY_CANCEL_EDIT, KeyEvent.VK_ESCAPE, 0));
this.mapShortCut.put(KEY_TOPIC_FOLD, new KeyShortcut(KEY_TOPIC_FOLD, KeyEvent.VK_MINUS, 0));
this.mapShortCut.put(KEY_TOPIC_UNFOLD, new KeyShortcut(KEY_TOPIC_UNFOLD, KeyEvent.VK_EQUALS, 0));
this.mapShortCut.put(KEY_FOCUS_ROOT_OR_START_EDIT, new KeyShortcut(KEY_FOCUS_ROOT_OR_START_EDIT, KeyEvent.VK_SPACE, KeyEvent.CTRL_MASK));
this.mapShortCut.put(KEY_FOCUS_MOVE_DOWN, new KeyShortcut(KEY_FOCUS_MOVE_DOWN, KeyEvent.VK_DOWN, 0));
this.mapShortCut.put(KEY_FOCUS_MOVE_UP, new KeyShortcut(KEY_FOCUS_MOVE_UP, KeyEvent.VK_UP, 0));
this.mapShortCut.put(KEY_FOCUS_MOVE_LEFT, new KeyShortcut(KEY_FOCUS_MOVE_LEFT, KeyEvent.VK_LEFT, 0));
this.mapShortCut.put(KEY_FOCUS_MOVE_RIGHT, new KeyShortcut(KEY_FOCUS_MOVE_RIGHT, KeyEvent.VK_RIGHT, 0));
this.mapShortCut.put(KEY_FOCUS_MOVE_DOWN_ADD_FOCUSED, new KeyShortcut(KEY_FOCUS_MOVE_DOWN_ADD_FOCUSED, KeyEvent.VK_DOWN, KeyEvent.SHIFT_MASK));
this.mapShortCut.put(KEY_FOCUS_MOVE_UP_ADD_FOCUSED, new KeyShortcut(KEY_FOCUS_MOVE_UP_ADD_FOCUSED, KeyEvent.VK_UP, KeyEvent.SHIFT_MASK));
this.mapShortCut.put(KEY_FOCUS_MOVE_LEFT_ADD_FOCUSED, new KeyShortcut(KEY_FOCUS_MOVE_LEFT_ADD_FOCUSED, KeyEvent.VK_LEFT, KeyEvent.SHIFT_MASK));
this.mapShortCut.put(KEY_FOCUS_MOVE_RIGHT_ADD_FOCUSED, new KeyShortcut(KEY_FOCUS_MOVE_RIGHT_ADD_FOCUSED, KeyEvent.VK_RIGHT, KeyEvent.SHIFT_MASK));
this.mapShortCut.put(KEY_DELETE_TOPIC, new KeyShortcut(KEY_DELETE_TOPIC, KeyEvent.VK_DELETE, 0));
this.mapShortCut.put(KEY_TOPIC_TEXT_NEXT_LINE, new KeyShortcut(KEY_TOPIC_TEXT_NEXT_LINE, KeyEvent.VK_ENTER, KeyEvent.SHIFT_MASK));
this.mapShortCut.put(KEY_ZOOM_IN, new KeyShortcut(KEY_ZOOM_IN, KeyEvent.VK_PLUS, KeyEvent.CTRL_MASK));
this.mapShortCut.put(KEY_ZOOM_OUT, new KeyShortcut(KEY_ZOOM_OUT, KeyEvent.VK_MINUS, KeyEvent.CTRL_MASK));
this.mapShortCut.put(KEY_ZOOM_RESET, new KeyShortcut(KEY_ZOOM_RESET, KeyEvent.VK_0, KeyEvent.CTRL_MASK));
this.mapShortCut.put(KEY_SHOW_POPUP, new KeyShortcut(KEY_SHOW_POPUP, KeyEvent.VK_SPACE, KeyEvent.CTRL_MASK | KeyEvent.ALT_MASK));
}
}