| OSDetector.java |
1 /**
2 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3 *
4 * The contents of this file are subject to the terms of the Liferay Enterprise
5 * Subscription License ("License"). You may not use this file except in
6 * compliance with the License. You can obtain a copy of the License by
7 * contacting Liferay, Inc. See the License for the specific language governing
8 * permissions and limitations under the License, including but not limited to
9 * distribution rights of the Software.
10 *
11 *
12 *
13 */
14
15 package com.liferay.portal.kernel.util;
16
17 import java.io.File;
18
19 /**
20 * <a href="OSDetector.java.html"><b><i>View Source</i></b></a>
21 *
22 * @author Brian Wing Shun Chan
23 */
24 public class OSDetector {
25
26 public static boolean isAIX() {
27 if (_aix == null) {
28 String osName = System.getProperty("os.name");
29
30 if (osName.equalsIgnoreCase("aix")) {
31 _aix = Boolean.TRUE;
32 }
33 else {
34 _aix = Boolean.FALSE;
35 }
36 }
37
38 return _aix.booleanValue();
39 }
40
41 public static boolean isUnix() {
42 if (_unix == null) {
43 if (File.pathSeparator.equals(StringPool.COLON)) {
44 _unix = Boolean.TRUE;
45 }
46 else {
47 _unix = Boolean.FALSE;
48 }
49 }
50
51 return _unix.booleanValue();
52 }
53
54 public static boolean isWindows() {
55 if (_windows == null) {
56 if (File.pathSeparator.equals(StringPool.SEMICOLON)) {
57 _windows = Boolean.TRUE;
58 }
59 else {
60 _windows = Boolean.FALSE;
61 }
62 }
63
64 return _windows.booleanValue();
65 }
66
67 private static Boolean _aix;
68 private static Boolean _unix;
69 private static Boolean _windows;
70
71 }