1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 package helper;
25 
26 /**
27  * Helper object, to identify the current Operation System.
28  * @author ll93751
29  */
30 public class OSHelper
31 {
isWindows()32     public static boolean isWindows()
33         {
34             String sOSName = System.getProperty("os.name");
35             if (sOSName.toLowerCase().startsWith("windows"))
36             {
37                 return true;
38             }
39             return false;
40         }
41     // not need
42     // public static boolean isUnix()
isSolarisIntel()43     public static boolean isSolarisIntel()
44         {
45             if ( ( System.getProperty("os.name").toLowerCase().startsWith("solaris") ||
46                    System.getProperty("os.name").toLowerCase().startsWith("sunos") ) &&
47                  System.getProperty("os.arch").equals("x86"))
48             {
49                 return true;
50             }
51             return false;
52         }
isSolarisSparc()53     public static boolean isSolarisSparc()
54         {
55             if ( ( System.getProperty("os.name").toLowerCase().startsWith("solaris") ||
56                    System.getProperty("os.name").toLowerCase().startsWith("sunos") ) &&
57                  System.getProperty("os.arch").equals("sparc"))
58             {
59                 return true;
60             }
61             return false;
62         }
isLinuxIntel()63     public static boolean isLinuxIntel()
64         {
65             if (System.getProperty("os.name").toLowerCase().startsWith("linux") &&
66                 System.getProperty("os.arch").equals("i386"))
67             {
68                 return true;
69             }
70             return false;
71         }
72 
isUnix()73     public static boolean isUnix()
74         {
75             if (isLinuxIntel() ||
76                 isSolarisIntel() ||
77                 isSolarisSparc())
78             {
79                 return true;
80             }
81             return false;
82         }
83 
84 }
85