use of cern.laser.business.LaserRuntimeException in project ACS by ACS-Community.
the class AlarmPublisherImpl method sendInit.
public void sendInit(Collection alarms, String destination) {
try {
logger.log(AcsLogLevel.DEBUG, "sending " + alarms.size() + " initial alarm(s) to " + destination + "...");
Topic topic = getTopicSession().createTopic(destination);
TextMessage message = getTopicSession().createTextMessage();
Iterator iterator = alarms.iterator();
while (iterator.hasNext()) {
AlarmImpl alarm = (AlarmImpl) iterator.next();
message.setText(AlarmMessageConversion.getXML(alarm));
message.clearProperties();
setMessageProperties(message, alarm);
message.setObjectProperty("NOT_REDUCED_MASKED_SET", Boolean.TRUE);
if (!(alarm.getStatus().getMasked().booleanValue() || alarm.getStatus().getReduced().booleanValue())) {
message.setObjectProperty("REDUCED_MASKED_SET", Boolean.TRUE);
} else {
message.setObjectProperty("REDUCED_MASKED_SET", Boolean.FALSE);
}
getTopicPublisher().publish(topic, message);
}
logger.log(AcsLogLevel.DEBUG, "initial alarm(s) sent to " + destination);
} catch (Exception e) {
close();
throw new LaserRuntimeException("unable to send alarms to " + destination + " : " + e.getMessage());
}
}
use of cern.laser.business.LaserRuntimeException in project ACS by ACS-Community.
the class AlarmCacheServerImpl method notify.
public void notify(Collection alarmChanges) {
try {
Iterator iterator = alarmChanges.iterator();
while (iterator.hasNext()) {
AlarmChange alarm_change = (AlarmChange) iterator.next();
Alarm current_alarm = alarm_change.getCurrent();
if (!current_alarm.getStatus().getActive().equals(alarm_change.getPrevious().getStatus().getActive())) {
if (current_alarm.getPiquetGSM() != null) {
sendSMS(current_alarm);
}
if (current_alarm.getPiquetEmail() != null) {
sendEmail(current_alarm);
}
}
}
} catch (Exception e) {
throw new LaserRuntimeException("unable to notify alarm(s)", e);
}
}
use of cern.laser.business.LaserRuntimeException in project ACS by ACS-Community.
the class AlarmSourceMonitorImpl method start.
public void start() {
try {
if (timer == null) {
delay = DEFAULT_DELAY;
LOGGER.info("AlarmImpl Source Monitor check delay : " + delay + " milliseconds");
LOGGER.info("starting source monitoring...");
timer = new Timer();
timer.schedule(createTimerTask(), delay, delay);
LOGGER.info("source monitoring started");
}
} catch (Exception e) {
throw new LaserRuntimeException("unable to start the source monitoring", e);
}
}
use of cern.laser.business.LaserRuntimeException in project ACS by ACS-Community.
the class AlarmSourceMonitorImpl method isUpToDate.
public boolean isUpToDate() {
try {
Source[] sources = sourceDAO.findAllSources();
Source laser_source = sourceDAO.findByLaserSource();
for (int i = 0; i < sources.length; i++) {
Source source = sources[i];
if (!source.equals(laser_source)) {
if (!source.getStatus().getConnected().booleanValue()) {
return false;
}
}
}
return true;
} catch (Exception e) {
throw new LaserRuntimeException("unable to check if sources are up to date", e);
}
}
use of cern.laser.business.LaserRuntimeException in project ACS by ACS-Community.
the class AlarmSourceMonitorImpl method stop.
public void stop() {
try {
if (timer != null) {
LOGGER.info("stopping source monitoring...");
timer.cancel();
timer = null;
LOGGER.info("source monitoring stopped");
}
} catch (Exception e) {
throw new LaserRuntimeException("unable to stop the source monitoring", e);
}
}
Aggregations