Search in sources :

Example 1 with AlarmCategoryClient

use of alma.alarmsystem.clients.AlarmCategoryClient in project ACS by ACS-Community.

the class AlarmCategoryClientTest method setUp.

/**
	 * @see extends ComponentClientTestCase
	 */
public void setUp() throws Exception {
    super.setUp();
    categoryClient = new AlarmCategoryClient(getContainerServices());
    assertNotNull(categoryClient);
    AlarmFilter filter = new AlarmFilter(null, null, 2, 2);
    filteredLister = new AlarmListenerForTesting("Filtered_listener");
    assertNotNull(filteredLister);
    categoryClient.addAlarmListener(this);
    categoryClient.addAlarmListener(filteredLister, filter);
    statListener = new AlrmStatListenerForTesting();
    assertNotNull(statListener);
    categoryClient.addStatsListener(statListener);
    alarmsReceived = new Vector<Alarm>();
}
Also used : AlarmCategoryClient(alma.alarmsystem.clients.AlarmCategoryClient) Alarm(cern.laser.client.data.Alarm) AlarmListenerForTesting(alma.alarmsystem.clients.test.utils.AlarmListenerForTesting) AlrmStatListenerForTesting(alma.alarmsystem.clients.test.utils.AlrmStatListenerForTesting) AlarmFilter(alma.alarmsystem.clients.alarm.AlarmFilter)

Example 2 with AlarmCategoryClient

use of alma.alarmsystem.clients.AlarmCategoryClient in project ACS by ACS-Community.

the class CernSysPanel method connect.

/**
	 * Connect
	 */
public void connect() {
    if (connecting || closed) {
        return;
    }
    connecting = true;
    connectionListener.connecting();
    notAvaiPnl.addMessage("Connecting to the alarm service");
    notAvaiPnl.addMessage("Instantiating the category client");
    try {
        categoryClient = new AlarmCategoryClient(orb, logger);
    } catch (Throwable t) {
        System.err.println("Error instantiating the CategoryClient: " + t.getMessage());
        notAvaiPnl.addMessage("Error instantiating the CategoryClient: " + t.getMessage());
        t.printStackTrace(System.err);
        connectionListener.disconnected();
        categoryClient = null;
        connecting = false;
        return;
    }
    /**
		 * Try to connect to the alarm service until it becomes available
		 */
    categoryClient.addAlarmListener((AlarmSelectionListener) model);
    while (true && !closed) {
        notAvaiPnl.addMessage("Connecting to the categories");
        try {
            categoryClient.connect();
            notAvaiPnl.addMessage("CategoryClient connected");
            // If the connection succeeded then exit the loop
            break;
        } catch (AcsJCannotGetComponentEx cgc) {
            // Wait 30 secs before retrying
            // but checks if it is closed every second.
            int t = 0;
            while (t < 30) {
                if (closed) {
                    return;
                }
                try {
                    Thread.sleep(1000);
                } catch (Exception e) {
                }
                t++;
            }
            cgc.printStackTrace();
            // Try again
            continue;
        } catch (Throwable t) {
            System.err.println("Error connecting CategoryClient: " + t.getMessage() + ", " + t.getClass().getName());
            notAvaiPnl.addMessage("Error connecting CategoryClient: " + t.getMessage() + ", " + t.getClass().getName());
            t.printStackTrace(System.err);
            connectionListener.disconnected();
            connecting = false;
            return;
        }
    }
    if (closed) {
        model.setCategoryClient(null);
        return;
    }
    notAvaiPnl.addMessage("Connected to the alarm service");
    connecting = false;
    connectionListener.connected();
    statusLine.start();
    model.setCategoryClient(categoryClient);
    alarmPanel.showPanel(AlarmPanel.cernSysName);
}
Also used : AlarmCategoryClient(alma.alarmsystem.clients.AlarmCategoryClient) AcsJCannotGetComponentEx(alma.maciErrType.wrappers.AcsJCannotGetComponentEx) AlarmClientException(alma.alarmsystem.clients.alarm.AlarmClientException)

Example 3 with AlarmCategoryClient

use of alma.alarmsystem.clients.AlarmCategoryClient in project ACS by ACS-Community.

the class AlarmTable method showReductionChain.

/**
	 * Show the dialog with all the nodes reduced by the passed alarm
	 * 
	 * @param alarm The alarm whose children must be shown in a dialog
	 */
private void showReductionChain(AlarmTableEntry alarm) {
    if (alarm == null) {
        throw new IllegalArgumentException("The alarm can't be null");
    }
    AlarmCategoryClient client = model.getCategoryClient();
    if (reducedDlg == null) {
        reducedDlg = new ReducedChainDlg(client, alarm, panel, undocModel);
    } else {
        reducedDlg.setRootAlarm(alarm);
        EDTExecutor.instance().execute(new Runnable() {

            public void run() {
                reducedDlg.setVisible(true);
            }
        });
    }
}
Also used : AlarmCategoryClient(alma.alarmsystem.clients.AlarmCategoryClient) ReducedChainDlg(alma.acsplugins.alarmsystem.gui.reduced.ReducedChainDlg)

Aggregations

AlarmCategoryClient (alma.alarmsystem.clients.AlarmCategoryClient)3 ReducedChainDlg (alma.acsplugins.alarmsystem.gui.reduced.ReducedChainDlg)1 AlarmClientException (alma.alarmsystem.clients.alarm.AlarmClientException)1 AlarmFilter (alma.alarmsystem.clients.alarm.AlarmFilter)1 AlarmListenerForTesting (alma.alarmsystem.clients.test.utils.AlarmListenerForTesting)1 AlrmStatListenerForTesting (alma.alarmsystem.clients.test.utils.AlrmStatListenerForTesting)1 AcsJCannotGetComponentEx (alma.maciErrType.wrappers.AcsJCannotGetComponentEx)1 Alarm (cern.laser.client.data.Alarm)1