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
00049
00050
00051
00052
00053
00054
00055
00056 Properties props = System.getProperties();
00057 String osname = props.getProperty("os.name");
00058 if (osname.indexOf("Linux") != -1) {
00059 this.os = Plateform.LINUXOS;
00060 } else if (osname.indexOf("Windows CE")!=-1) {
00061
00062 this.os = Plateform.POCKETPCOS;
00063 } else if (osname.indexOf("Windows")!=-1) {
00064 this.os = Plateform.WINOS;
00065 } else {
00066 this.os = Plateform.UNKNOWNOS;
00067 }
00068
00069
00070 this.osversion = props.getProperty("os.version");
00071
00072
00073 this.jvm = props.getProperty("java.vendor");
00074
00075
00076 this.jvmspec = props.getProperty("java.specification.version");
00077
00078
00079
00080
00081
00082 }
00083
00084
00085
00086
00087 public String getOS() {
00088 return this.os;
00089 }
00090
00091
00092
00093
00094 public String getOSVersion() {
00095 return this.osversion;
00096 }
00097
00098
00099
00100
00101 public String getJVMVendor() {
00102 return this.jvm;
00103 }
00104
00110 public String getJVMSpecificationVersion() {
00111 return this.jvmspec;
00112 }
00113
00114
00115
00116
00117 public String getOpenMobileISMajorVersion() {
00118 return "1";
00119 }
00120
00121
00122
00123
00124 public String getOpenMobileISMinorVersion() {
00125 return "R2";
00126 }
00127
00128 public static void main(String[] args) {
00129 Properties props = System.getProperties();
00130 Enumeration enume = props.keys();
00131 while (enume.hasMoreElements()) {
00132 String key = (String) enume.nextElement();
00133 System.out.println("Property :"+key+" value:"+props.getProperty(key));
00134 }
00135 }
00136
00137 public void setJvm(String jvm) {
00138 this.jvm = jvm;
00139 }
00140
00141 public void setJvmspec(String jvmspec) {
00142 this.jvmspec = jvmspec;
00143 }
00144
00145 public void setOs(String os) {
00146 this.os = os;
00147 }
00148
00149 public void setOsversion(String osversion) {
00150 this.osversion = osversion;
00151 }
00152
00153 }