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>();
}
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);
}
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);
}
});
}
}
Aggregations