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
00026
00027
00028
00029 package org.openmobileis.embedded.util;
00030
00031 import java.io.File;
00032
00033 import org.openmobileis.common.util.PersistentPropertiesManager;
00034 import org.openmobileis.common.util.exception.DefaultException;
00035 import org.openmobileis.common.util.exception.OpenMISException;
00036
00045 public class DefaultSystemAPI implements ISystemAPI{
00046
00052 public int execProgramAndWait(String path, String args) throws OpenMISException {
00053 String execCommand[] = new String[2];
00054 execCommand[0] = path;
00055 execCommand[1] = args;
00056 try {
00057 Process process = Runtime.getRuntime().exec(execCommand,null, new File(System.getProperty("user.dir")));
00058 process.waitFor();
00059 } catch (Exception ex) {
00060 throw new DefaultException(ex);
00061 }
00062 return 1;
00063 }
00064
00070 public int execProgram (String path, String args) throws OpenMISException {
00071 String execCommand[] = new String[2];
00072 execCommand[0] = path;
00073 execCommand[1] = args;
00074 try {
00075 Runtime.getRuntime().exec(execCommand,null, new File(System.getProperty("user.dir")));
00076 } catch (Exception ex) {
00077 throw new DefaultException(ex);
00078 }
00079 return 1;
00080 }
00081
00086 public long currentTimeInMillis() {
00087 return System.currentTimeMillis();
00088 }
00089
00094 public String getSystemUniqueID() {
00095 String uniqueid = PersistentPropertiesManager.getManager().getProperty("OWSystemAPI", "uniqueid");
00096 if (uniqueid == null) {
00097 uniqueid = Long.toString(System.currentTimeMillis());
00098 PersistentPropertiesManager.getManager().saveProperty("OWSystemAPI", "uniqueid", uniqueid);
00099 }
00100 return uniqueid;
00101 }
00102
00103 public String readPPCRegistryValue(String register,String regkey,String entity){
00104 return "not for this platform";
00105 }
00106 }