00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 package org.openmobileis.common.context;
00026
00027 import java.util.Enumeration;
00028 import java.util.Properties;
00029
00037 public class DefaultPlateform implements Plateform {
00038 public String os;
00039 public String osversion;
00040 public String jvm;
00041 public String jvmspec;
00045 public DefaultPlateform() {
00046 super();
00047
00048 Properties props = System.getProperties();
00049 String osname = props.getProperty("os.name");
00050 if (osname.indexOf("Linux") != -1) {
00051 this.os = Plateform.LINUXOS;
00052 } else if (osname.indexOf("Windows CE")!=-1) {
00053
00054 this.os = Plateform.POCKETPCOS;
00055 } else if (osname.indexOf("Windows")!=-1) {
00056 this.os = Plateform.WINOS;
00057 } else {
00058 this.os = Plateform.UNKNOWNOS;
00059 }
00060
00061
00062 this.osversion = props.getProperty("os.version");
00063
00064
00065 this.jvm = props.getProperty("java.vendor");
00066
00067
00068 this.jvmspec = props.getProperty("java.specification.version");
00069
00070
00071
00072
00073
00074 }
00075
00076
00077
00078
00079 public String getOS() {
00080 return this.os;
00081 }
00082
00083
00084
00085
00086 public String getOSVersion() {
00087 return this.osversion;
00088 }
00089
00090
00091
00092
00093 public String getJVMVendor() {
00094 return this.jvm;
00095 }
00096
00102 public String getJVMSpecificationVersion() {
00103 return this.jvmspec;
00104 }
00105
00106
00107
00108
00109 public String getOpenMobileISMajorVersion() {
00110 return "1";
00111 }
00112
00113
00114
00115
00116 public String getOpenMobileISMinorVersion() {
00117 return "R2";
00118 }
00119
00120 public static void main(String[] args) {
00121 Properties props = System.getProperties();
00122 Enumeration enume = props.keys();
00123 while (enume.hasMoreElements()) {
00124 String key = (String) enume.nextElement();
00125 System.out.println("Property :"+key+" value:"+props.getProperty(key));
00126 }
00127 }
00128
00129 }