Search in sources :

Example 1 with ServiceSpec

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;
}
Also used : ServiceSpec(cbit.vcell.message.server.ServiceSpec) ServiceInstanceStatus(cbit.vcell.message.server.ServiceInstanceStatus) UserCancelException(org.vcell.util.UserCancelException)

Example 2 with ServiceSpec

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;
}
Also used : VCellServerID(org.vcell.util.document.VCellServerID) ServiceStatus(cbit.vcell.message.server.ServiceStatus) ServiceSpec(cbit.vcell.message.server.ServiceSpec) HtcJobID(cbit.vcell.server.HtcJobID)

Example 3 with ServiceSpec

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);
}
Also used : VCellServerID(org.vcell.util.document.VCellServerID) ServiceType(cbit.vcell.message.server.bootstrap.ServiceType) ServiceSpec(cbit.vcell.message.server.ServiceSpec) ServiceStartupType(cbit.vcell.message.server.ServiceSpec.ServiceStartupType)

Example 4 with ServiceSpec

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();
    }
}
Also used : ServiceStatus(cbit.vcell.message.server.ServiceStatus) ServiceSpec(cbit.vcell.message.server.ServiceSpec) UserCancelException(org.vcell.util.UserCancelException)

Aggregations

ServiceSpec (cbit.vcell.message.server.ServiceSpec)4 ServiceStatus (cbit.vcell.message.server.ServiceStatus)2 UserCancelException (org.vcell.util.UserCancelException)2 VCellServerID (org.vcell.util.document.VCellServerID)2 ServiceInstanceStatus (cbit.vcell.message.server.ServiceInstanceStatus)1 ServiceStartupType (cbit.vcell.message.server.ServiceSpec.ServiceStartupType)1 ServiceType (cbit.vcell.message.server.bootstrap.ServiceType)1 HtcJobID (cbit.vcell.server.HtcJobID)1