import java.io.IOException;
import java.sql.SQLException;
+import java.util.Date;
+import java.util.logging.Level;
+import java.util.logging.Logger;
/**
*
public boolean CommandSelector(String com) throws IOException, SQLException, ClassNotFoundException{
UserTaskModel utaskmodel = new UserTaskModel();
UserTaskView utaskview = new UserTaskView();
- String comlist[] = com.split(" ");
- String head = comlist[0];
- String arg[] = new String[comlist.length-1];
+ VirtualMachineModel vmmodel = new VirtualMachineModel();
+ VirtualMachineView vmview = new VirtualMachineView();
+
+ String comlist[] = com.split(" ");
+
+ // コマンド
+ String head = comlist[0];
+ // 引数
+ String arg[] = new String[comlist.length-1];
// 残りの引数をargに格納
for (int i = 0;i < comlist.length-1; i++) {
} else if(head.equals("lstask")){
utaskview.showTaskList();
+ } else if(head.equals("lsvm")){
+ vmview.showVMList();
} else if(head.equals("vmrun")){
-
- } else if(head.equals("exit")){
+ vmmodel.vmRun(arg);
+ } else if(head.equals("isa")){
+ vmmodel.checkVMP("1");
+ } else if(head.equals("test")){
+ //vmmodel.test();
+ //new TaskViewer();
+ //Thread.sleep(5000);
+
+ new TaskCenterPanel();
+ } else if(head.equals("exit") || head.equals("quit")){
return false;
} else {
System.out.println("command not found.");
*/
public class DataBase {
String TASK_TBL = "task_tbl";
+ String VM_TBL = "vm_tbl";
Connection con;
Statement st;
- public DataBase() throws SQLException{
+ public DataBase(){
try {
Class.forName("org.sqlite.JDBC");
- con = DriverManager.getConnection("jdbc:sqlite:puc.db");
- st = con.createStatement();
- st.setQueryTimeout(1);
- con.setAutoCommit(false);
-
+ try {
+ con = DriverManager.getConnection("jdbc:sqlite:puc.db");
+ st = con.createStatement();
+ st.setQueryTimeout(1);
+ con.setAutoCommit(false);
+ } catch (SQLException ex) {
+ Logger.getLogger(DataBase.class.getName()).log(Level.SEVERE, null, ex);
+ }
} catch (ClassNotFoundException ex) {
Logger.getLogger(DataBase.class.getName()).log(Level.SEVERE, null, ex);
}
}
+
// データベースを初期化
public void initDB() throws SQLException{
"SDATE datatime," +
"EDATE datatime," +
"OUTLINE string)");
-
-
}
+
public void commit() throws SQLException{
con.commit();
}
- public ResultSet executeQuery(String sql) throws SQLException{
- ResultSet rs = st.executeQuery(sql);
+ public ResultSet executeQuery(String sql){
+ ResultSet rs;
+ try {
+ rs = st.executeQuery(sql);
return rs;
+ } catch (SQLException ex) {
+ Logger.getLogger(DataBase.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ return null;
}
- public int executeUpdate(String sql) throws SQLException{
- Connection con = DriverManager.getConnection("jdbc:sqlite:puc.db");
- Statement st = con.createStatement();
+ public int executeUpdate(String sql){
+ try {
return st.executeUpdate(sql);
+ } catch (SQLException ex) {
+ Logger.getLogger(DataBase.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ return -1;
}
- public void close() throws SQLException{
- Connection con = DriverManager.getConnection("jdbc:sqlite:puc.db");
- Statement st = con.createStatement();
+ public void close(){
+ try {
+ con.close();
st.close();
+ } catch (SQLException ex) {
+ Logger.getLogger(DataBase.class.getName()).log(Level.SEVERE, null, ex);
+ }
}
public boolean isDate(String date){