use of cbit.vcell.message.server.ServiceSpec in project vcell by virtualcell.
the class ServerManageConsole method refresh.
private void refresh() {
int count = getServiceStatusTable().getRowCount();
boolean bAll = false;
if (count == 0) {
bAll = true;
}
int tabIndex = getTabbedPane().getSelectedIndex();
if (tabIndex == 0 || tabIndex == 1) {
final int waitingTimeSec = 5;
Thread t = new Thread(new Runnable() {
public void run() {
getProgressBar().setMaximum(waitingTimeSec);
getProgressBar().setMinimum(0);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
getProgressBar().setIndeterminate(true);
getRefreshButton().setEnabled(false);
}
});
}
});
t.setName("Refresh Thread");
t.start();
try {
serviceConfigList = adminDbTop.getAllServiceStatus(true);
} catch (Exception e) {
e.printStackTrace();
javax.swing.JOptionPane.showMessageDialog(this, e.getMessage(), "Error", javax.swing.JOptionPane.ERROR_MESSAGE);
}
showConfigs(serviceConfigList);
getModifyServiceButton().setEnabled(false);
getDeleteServiceButton().setEnabled(false);
if (!bAll && tabIndex == 0) {
Thread t1 = new Thread(new Runnable() {
public void run() {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
getProgressBar().setIndeterminate(false);
getProgressBar().setValue(waitingTimeSec);
getRefreshButton().setEnabled(true);
}
});
}
});
t1.setName("Refresh Thread");
t1.start();
} else {
((ServiceInstanceStatusTableModel) getServiceStatusTable().getModel()).setData(null);
serviceInstanceStatusList.clear();
for (int i = 0; i < serviceConfigList.size(); i++) {
ServiceSpec ss = serviceConfigList.get(i).getServiceSpec();
serviceInstanceStatusList.add(new ServiceInstanceStatus(ss.getServerID(), ss.getType(), ss.getOrdinal(), null, null, false));
}
showServices(serviceInstanceStatusList);
Thread pingThread = new Thread(new Runnable() {
public void run() {
// pingAll(waitingTimeSec);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
getProgressBar().setIndeterminate(false);
getProgressBar().setValue(waitingTimeSec);
getRefreshButton().setEnabled(true);
}
});
}
});
pingThread.setName("Refresh Thread");
pingThread.start();
}
}
return;
}
use of cbit.vcell.message.server.ServiceSpec in project vcell by virtualcell.
the class ServiceTable method getServiceStatus.
/**
* This method was created in VisualAge.
* @return VCImage
* @param rset ResultSet
* @param log SessionLog
*/
public ServiceStatus getServiceStatus(ResultSet rset) throws SQLException {
// serverID
String parsedServerIDString = rset.getString(serverID.toString());
VCellServerID parsedServerID = VCellServerID.getServerID(parsedServerIDString);
// type
String parsedType = rset.getString(type.toString());
// ordinal
int parsedOrdinal = rset.getInt(ordinal.toString());
// startupType
int parsedStartupType = rset.getInt(startupType.toString());
// memoryMB
int parsedMemoryMB = rset.getInt(memoryMB.toString());
// date
java.util.Date parsedDate = rset.getTimestamp(date.toString());
if (rset.wasNull()) {
parsedDate = null;
}
// status
int parsedStatus = rset.getInt(status.toString());
// statusMsg
String parsedStatusMsg = rset.getString(statusMsg.toString());
if (rset.wasNull()) {
parsedStatusMsg = null;
}
// host
HtcJobID parsedHtcJobId = null;
String parsedHtcJobDatabaseString = rset.getString(pbsjobid.toString());
if (!rset.wasNull() && parsedHtcJobDatabaseString != null && parsedHtcJobDatabaseString.length() > 0) {
parsedHtcJobId = SimulationJobTable.fromDatabase(parsedHtcJobDatabaseString);
}
ServiceStatus serviceStatus = new ServiceStatus(new ServiceSpec(parsedServerID, ServiceType.fromName(parsedType), parsedOrdinal, ServiceStartupType.fromDatabaseNumber(parsedStartupType), parsedMemoryMB), parsedDate, ServiceStatusType.fromDatabaseNumber(parsedStatus), parsedStatusMsg, parsedHtcJobId);
return serviceStatus;
}
use of cbit.vcell.message.server.ServiceSpec in project vcell by virtualcell.
the class AddNewServiceDialog method getServiceSpec.
/**
* Insert the method's description here.
* Creation date: (8/22/2003 4:07:31 PM)
* @return cbit.vcell.messaging.admin.VCellServiceConfig
*/
public ServiceSpec getServiceSpec() {
VCellServerID site = VCellServerID.getServerID(getSiteField().getText());
ServiceType stype = (ServiceType) getTypeCombo().getSelectedItem();
int ordinal = 0;
try {
ordinal = Integer.parseInt("" + getOrdinalCombo().getSelectedItem());
} catch (NumberFormatException ex) {
throw new RuntimeException("Ordinal must be a number!");
}
ServiceStartupType startup = ServiceStartupType.fromDescription((String) getStartupCombo().getSelectedItem());
int memoryMB = Integer.parseInt(getMemoryMBField().getText());
return new ServiceSpec(site, stype, ordinal, startup, memoryMB);
}
use of cbit.vcell.message.server.ServiceSpec in project vcell by virtualcell.
the class ServerManageConsole method newService.
void newService() {
AddNewServiceDialog dialog = new AddNewServiceDialog(this);
dialog.setLocationRelativeTo(this);
dialog.setVisible(true);
if (dialog.isAction()) {
ServiceSpec ss = dialog.getServiceSpec();
ServiceStatus config = new ServiceStatus(ss, null, ServiceStatusType.ServiceNotRunning, "newly created", null);
try {
config = adminDbTop.insertServiceStatus(config, true);
} catch (Exception e) {
e.printStackTrace();
javax.swing.JOptionPane.showMessageDialog(this, e.getMessage(), "Error", javax.swing.JOptionPane.ERROR_MESSAGE);
}
refresh();
}
}
Aggregations