RmiServer  1.0
 Alle Klassen Namensbereiche Dateien Funktionen Variablen
Controller.java
gehe zur Dokumentation dieser Datei
1 package controller;
2 
3 import java.util.List;
4 import java.util.Scanner;
5 
6 import javax.swing.SwingUtilities;
7 
8 import com.jamonapi.Monitor;
9 
20 public class Controller {
21  public static Monitor performanceMonitor = null;
22 
26  public Controller() {
28 
39  Runtime.getRuntime().addShutdownHook(new Thread() {
40  public void run() {
45  System.out.println(""); //$NON-NLS-1$
46  RmiServer.consolelogger.info(Messages.getString("Controller.1")); //$NON-NLS-1$
48 
52  RmiServer.consolelogger.info(Messages.getString("Controller.2")); //$NON-NLS-1$
53 
55  }
56  });
57 
61  SwingUtilities.invokeLater(new Runnable() {
62  public void run() {
63  System.out.println(""); //$NON-NLS-1$
64  System.out.print(Messages.getString("Controller.4")); //$NON-NLS-1$
65  while (true) {
66  Scanner scanner = new Scanner(System.in);
67  if (scanner.hasNext()) {
68  String input = scanner.nextLine();
69 
70  if (input.equals("q")) { //$NON-NLS-1$
71  System.exit(0);
72  } else {
73  System.out.print(Messages.getString("Controller.6")); //$NON-NLS-1$
74  }
75  }
76  }
77  }
78  });
79  }
80 
87  public void selectData(Class tableName) {
88  ModelController.selectData(tableName);
89  }
90 
97  public List<Object> getData(Class tableName) {
98  return ModelController.getData(tableName);
99  }
100 
107  public List<Object> getDataWithClause(Class tableName, String column,
108  String clause) {
109  return ModelController.getDataWithClause(tableName, column, clause);
110  }
111 
118  public List<Object> getDataWithClause(Class tableName, String column,
119  Integer clause) {
120  return ModelController.getDataWithClause(tableName, column, clause);
121  }
122 
130  public boolean insertData(Object type) {
131  return ModelController.insertData(type);
132  }
133 
141  public boolean changeData(Object entity) {
142  return ModelController.changeData(entity);
143  }
144 
152  public boolean deleteData(Object entity) {
153  return ModelController.deleteData(entity);
154  }
155 }