Methods Summary |
---|
public java.util.Vector | assignmentsFor(int rid)
Vector ras = new Vector();
try {
Statement s = DatabaseItemImpl.dbConn.createStatement();
ResultSet r = s.executeQuery("SELECT task, time FROM "
+ "res_assignment where resource = "
+ rid);
while (r.next()) {
int tid = r.getInt("task");
Date time = r.getDate("time");
ResAssignmentImpl ra = new ResAssignmentImpl(rid, tid, time);
ras.addElement(ra);
}
}
catch (Exception e) {}
return ras;
|
public java.util.Vector | constraintsFor(int tid)
Vector constraints = new Vector();
try {
Statement s = DatabaseItemImpl.dbConn.createStatement();
ResultSet r = s.executeQuery("SELECT task1, task2, type FROM "
+ "time_constraint where task1 = "
+ tid + " or task2 = " + tid);
while (r.next()) {
int tid1 = r.getInt("task1");
int tid2 = r.getInt("task2");
int type = r.getInt("type");
TimeConstraintImpl c = new TimeConstraintImpl(type, tid1, tid2);
constraints.addElement(c);
}
}
catch (Exception e) {}
return constraints;
|
public java.util.Vector | getAllResources()
Vector resList = new Vector();
try {
Statement s = DatabaseItemImpl.dbConn.createStatement();
ResultSet r = s.executeQuery("SELECT distinct(rid) FROM resource");
while (r.next()) {
int id = r.getInt("rid");
SchedResourceImpl res = new SchedResourceImpl(id);
if (res.isValid()) {
resList.addElement(res);
}
}
}
catch (Exception e) {}
return resList;
|
public java.util.Vector | getAllTasks()
Vector taskList = new Vector();
try {
Statement s = DatabaseItemImpl.dbConn.createStatement();
ResultSet r = s.executeQuery("SELECT distinct(tid) FROM task");
while (r.next()) {
int id = r.getInt("tid");
SchedTaskImpl task = new SchedTaskImpl(id);
if (task.isValid()) {
taskList.addElement(task);
}
}
}
catch (Exception e) {}
return taskList;
|
public RMISchedResource | getResource(int rid)
SchedResourceImpl res = new SchedResourceImpl(rid);
return res;
|
public RMISchedTask | getTask(int id)
SchedTaskImpl task = new SchedTaskImpl(id);
return task;
|
public static void | main(java.lang.String[] argv)
System.setSecurityManager(new RMISecurityManager());
try {
String name = argv[0];
System.out.println("Registering SchedDbaseImpl with "
+ "naming service as " + name);
SchedDbaseImpl server = new SchedDbaseImpl();
Class.forName("oracle.jdbc.driver.OracleDriver");
DatabaseItemImpl.dbConn =
DriverManager.getConnection("jdbc:oracle:thin:@dbaseserver:1521:mydb",
"user", "passwd");
Registry r = LocateRegistry.getRegistry(1234);
r.rebind(name, server);
System.out.println(name + " ready.");
}
catch (Exception e) {
System.out.println("Exception while registering "
+ "SchedDbaseImpl: \n");
e.printStackTrace();
System.exit(2);
}
|
public RMITimeConstraint | newConstraint(int type, int t1, int t2)
TimeConstraintImpl c = new TimeConstraintImpl(type, t1, t2);
// Create a new record in the database.
try {
Statement s = DatabaseItemImpl.dbConn.createStatement();
int numr = s.executeUpdate("INSERT time_constraint SET type = "
+ type + " task1 = " + t1
+ " task2 = " + t2);
if (numr != 1)
c.valid = false;
else
c.valid = true;
}
catch (SQLException e) {
c.valid = false;
}
return c;
|
public RMIResAssignment | newResAssignment(int rid, int tid, java.util.Date time)
ResAssignmentImpl r = new ResAssignmentImpl(rid, tid, time);
// Create a new record in the database.
try {
Statement s = DatabaseItemImpl.dbConn.createStatement();
int numr = s.executeUpdate("INSERT res_assignment SET resource = "
+ rid + " task = " + tid
+ " time = " + time);
if (numr != 1)
r.valid = false;
else
r.valid = true;
}
catch (SQLException e) {
r.valid = false;
}
return r;
|
public RMISchedResource | newResource(java.lang.String n, int t, float s)
SchedResourceImpl res = new SchedResourceImpl(n, t, s);
return res;
|
public RMISchedTask | newTask(int t, float sz)
SchedTaskImpl task = new SchedTaskImpl(t, sz);
return task;
|