use of cern.laser.client.LaserException in project ACS by ACS-Community.
the class AlarmSearchHelper method search.
//
// -- PUBLIC METHODS ----------------------------------------------
//
public void search(Selection selection, int nbOfRows) throws LaserConnectionException, LaserException, LaserTimeOutException {
searchFinished(false);
String console_id = "";
String host_name = "";
try {
console_id = UUIDGenerator.getInstance().getUUID().toString();
host_name = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
throw new LaserException("unable to get a unique id for the console : " + e.getMessage());
}
String init_topic = getSearchRootTopic() + "." + console_id;
long init_subscription;
try {
init_subscription = getSubscriber().subscribe(init_topic, getSearchListener(), null);
} catch (Exception e) {
throw new LaserException("unable to subscribe to topic " + init_topic + " : " + e.getMessage());
}
// activate the selection on the BT
Integer[] category_ids = getCategoryIds(selection);
String sql = buildSQLFilter(selection, nbOfRows);
try {
if (m_laser != null) {
int[] cis = new int[category_ids.length];
for (int i = 0; i < category_ids.length; i++) cis[i] = category_ids[i].intValue();
m_laser.search(cis, sql, console_id);
} else {
throw new NullPointerException("AlarmSystem component is null");
}
} catch (Exception e) {
throw new LaserException("unable to perform initial selection at host " + host_name + " : " + e.getMessage());
}
resetInitWaitTime();
waitForInit();
try {
// stop init subscription
getSubscriber().unSubscribe(init_subscription);
} catch (Exception e) {
// Intentionally left blank
}
}
use of cern.laser.client.LaserException in project ACS by ACS-Community.
the class AlarmSelectionHandlerImpl method resetSelection.
/**
* DOCUMENT ME!
*
* @throws LaserException DOCUMENT ME!
*/
public void resetSelection() throws LaserException {
try {
if (heartbeatHelper != null) {
heartbeatHelper.stopHeartbeatCheck();
heartbeatHelper = null;
} else {
}
if (alarmSelectionHelper != null) {
alarmSelectionHelper.resetSelection();
} else {
}
} catch (Exception e) {
System.err.println("### Exception: " + e.getMessage());
e.printStackTrace();
throw new LaserException("unable to reset the selection", e);
}
}
use of cern.laser.client.LaserException in project ACS by ACS-Community.
the class AlarmBrowsingHandlerImpl method getAlarmById.
//
// -- PUBLIC METHODS ----------------------------------------------
//
//
// -- extends AlarmBrowsingHandler --------------------------------
//
public Alarm getAlarmById(String alarmId) throws LaserException {
try {
if (m_laser != null) {
alma.alarmsystem.Alarm a = m_laser.getAlarmById(alarmId);
cern.laser.business.data.Alarm alarmBusiness = toBusinessAlarm(a);
return new AlarmImpl(alarmBusiness);
} else {
throw new NullPointerException("AlarmSystem component is null");
}
} catch (Exception e) {
throw new LaserException("unable to get alarm by id " + alarmId, e);
}
}
use of cern.laser.client.LaserException in project ACS by ACS-Community.
the class AlarmBrowsingHandlerImpl method getAlarmByTriplet.
public Alarm getAlarmByTriplet(String faultFamily, String faultMember, Integer faultCode) throws LaserException {
if ((faultFamily == null) || (faultMember == null) || (faultCode == null)) {
throw new IllegalArgumentException("parameter cannot be null");
}
try {
if (m_laser != null) {
alma.alarmsystem.Alarm a = m_laser.getAlarmByTriplet(faultFamily, faultMember, faultCode.intValue());
cern.laser.business.data.Alarm alarmBusiness = toBusinessAlarm(a);
return new AlarmImpl(alarmBusiness);
} else {
throw new NullPointerException("AlarmSystem component is null");
}
} catch (Exception e) {
throw new LaserException("unable to get alarm by triplet " + faultFamily + ":" + faultMember + ":" + faultCode, e);
}
}
use of cern.laser.client.LaserException in project ACS by ACS-Community.
the class AlarmSearchHelper method getSubscriber.
private Subscriber getSubscriber() throws LaserException {
try {
if (cmwSubscriber == null) {
cmwSubscriber = PubSubFactory.subscriber();
cmwSubscriber.setExceptionListener(this);
}
} catch (Exception e) {
throw new LaserException("unable to create the CMW subscriber", e);
}
return cmwSubscriber;
}
Aggregations