Search in sources :

Example 6 with LaserRuntimeException

use of cern.laser.business.LaserRuntimeException in project ACS by ACS-Community.

the class AlarmCacheServerImpl method publish.

public void publish(Collection alarmChanges) {
    try {
        logger.log(AcsLogLevel.DEBUG, "publishing " + alarmChanges.size() + " alarm(s)...");
        alarmPublisher.publish(alarmChanges);
        logger.log(AcsLogLevel.DEBUG, "published");
    } catch (Exception e) {
        throw new LaserRuntimeException("unable to publish alarm(s)", e);
    }
}
Also used : LaserRuntimeException(cern.laser.business.LaserRuntimeException) LaserRuntimeException(cern.laser.business.LaserRuntimeException)

Example 7 with LaserRuntimeException

use of cern.laser.business.LaserRuntimeException in project ACS by ACS-Community.

the class AlarmCacheServerImpl method store.

public void store(Collection updated) {
    try {
        logger.log(AcsLogLevel.DELOUSE, "storing " + updated.size() + " alarm(s)...");
        Iterator iterator = updated.iterator();
        while (iterator.hasNext()) {
            Alarm alarm = (Alarm) iterator.next();
            Status status = alarm.getStatus();
            //        if (status.getStatusId() == null || status.getStatusId().equals("")) {
            //          if (LOGGER.isDebugEnabled()) LOGGER.debug("saving status ...");
            //          status.setStatusId(alarm.getAlarmId());
            //          alarmDAO.saveStatus(status);
            //        } else {
            //          if (LOGGER.isDebugEnabled()) LOGGER.debug("updating status ...");
            alarmDAO.updateStatus(status);
        //        }
        }
        logger.log(AcsLogLevel.DELOUSE, "stored");
    } catch (Exception e) {
        throw new LaserRuntimeException("unable to store alarm(s)", e);
    }
}
Also used : Status(cern.laser.business.data.Status) Alarm(cern.laser.business.data.Alarm) Iterator(java.util.Iterator) LaserRuntimeException(cern.laser.business.LaserRuntimeException) LaserRuntimeException(cern.laser.business.LaserRuntimeException)

Example 8 with LaserRuntimeException

use of cern.laser.business.LaserRuntimeException in project ACS by ACS-Community.

the class AlarmDefinitionServiceImpl method createNodeLinkInternal.

private void createNodeLinkInternal(String userId, ReductionLink link) throws LaserDefinitionException {
    Alarm[] parent_child = validateReductionLink(link);
    AdminUser admin_user = adminUserDAO.findAdminUser(userId);
    try {
        LOGGER.info("user " + admin_user.getName() + " creating node link : " + link);
        //alarmDAO.findAlarm(link.getParent().getAlarmId());
        Alarm parent = parent_child[0];
        //alarmDAO.findAlarm(link.getChild().getAlarmId());
        Alarm child = parent_child[1];
        parent.addNodeChild(child);
        alarmDAO.updateAlarm(parent);
        LOGGER.info("node link created");
    } catch (Exception e) {
        throw new LaserRuntimeException("unable to create the node link " + link + " : " + e.getMessage(), e);
    }
}
Also used : Alarm(cern.laser.business.data.Alarm) AdminUser(cern.laser.business.data.AdminUser) LaserDefinitionNotFoundException(cern.laser.business.definition.LaserDefinitionNotFoundException) LaserDefinitionNotAllowedException(cern.laser.business.definition.LaserDefinitionNotAllowedException) LaserRuntimeException(cern.laser.business.LaserRuntimeException) LaserDefinitionDuplicationException(cern.laser.business.definition.LaserDefinitionDuplicationException) LaserDefinitionException(cern.laser.business.definition.LaserDefinitionException) LaserDefinitionNotValidException(cern.laser.business.definition.LaserDefinitionNotValidException) AlarmCacheException(cern.laser.business.cache.AlarmCacheException) LaserRuntimeException(cern.laser.business.LaserRuntimeException)

Example 9 with LaserRuntimeException

use of cern.laser.business.LaserRuntimeException in project ACS by ACS-Community.

the class AlarmPublisherImpl method sendSearch.

/**
   * @param init_alarms
   * @param destination
   */
public void sendSearch(Collection alarms, String destination) {
    try {
        logger.log(AcsLogLevel.DEBUG, "sending " + alarms.size() + " search alarm(s) to " + destination + "...");
        Topic topic = getTopicSession().createTopic(destination);
        ObjectMessage message = getTopicSession().createObjectMessage();
        Iterator iterator = alarms.iterator();
        while (iterator.hasNext()) {
            AlarmImpl alarm = (AlarmImpl) iterator.next();
            message.setObject(alarm);
            message.clearProperties();
            setMessageProperties(message, alarm);
            getTopicPublisher().publish(topic, message);
        }
        logger.log(AcsLogLevel.DEBUG, "search alarm(s) sent to " + destination);
    } catch (Exception e) {
        close();
        throw new LaserRuntimeException("unable to send search alarms to " + destination + " : " + e.getMessage());
    }
    sendSearchFinished(destination);
}
Also used : ObjectMessage(javax.jms.ObjectMessage) AlarmImpl(cern.laser.business.data.AlarmImpl) Iterator(java.util.Iterator) Topic(javax.jms.Topic) NamingException(javax.naming.NamingException) LaserRuntimeException(cern.laser.business.LaserRuntimeException) LaserCreateException(cern.laser.business.LaserCreateException) JMSException(javax.jms.JMSException) LaserRuntimeException(cern.laser.business.LaserRuntimeException)

Example 10 with LaserRuntimeException

use of cern.laser.business.LaserRuntimeException in project ACS by ACS-Community.

the class AlarmPublisherImpl method sendSearchFinished.

//
// -- PRIVATE METHODS --------------------------------------------
//
private void sendSearchFinished(String destination) {
    try {
        logger.log(AcsLogLevel.DEBUG, "sending search finished message to " + destination + "...");
        Topic topic = getTopicSession().createTopic(destination);
        Message message = getTopicSession().createMessage();
        message.setObjectProperty(LASER_SEARCH_PROPERTY, Boolean.TRUE);
        getTopicPublisher().publish(topic, message);
        logger.log(AcsLogLevel.DEBUG, "search finished message sent to " + destination);
    } catch (Exception e) {
        close();
        throw new LaserRuntimeException("unable to send search finished message to " + destination + " : " + e.getMessage());
    }
}
Also used : ObjectMessage(javax.jms.ObjectMessage) Message(javax.jms.Message) TextMessage(javax.jms.TextMessage) Topic(javax.jms.Topic) NamingException(javax.naming.NamingException) LaserRuntimeException(cern.laser.business.LaserRuntimeException) LaserCreateException(cern.laser.business.LaserCreateException) JMSException(javax.jms.JMSException) LaserRuntimeException(cern.laser.business.LaserRuntimeException)

Aggregations

LaserRuntimeException (cern.laser.business.LaserRuntimeException)15 Alarm (cern.laser.business.data.Alarm)8 Iterator (java.util.Iterator)6 AlarmCacheException (cern.laser.business.cache.AlarmCacheException)5 LaserCreateException (cern.laser.business.LaserCreateException)3 ArrayList (java.util.ArrayList)3 Collection (java.util.Collection)3 JMSException (javax.jms.JMSException)3 Topic (javax.jms.Topic)3 NamingException (javax.naming.NamingException)3 AdminUser (cern.laser.business.data.AdminUser)2 AlarmImpl (cern.laser.business.data.AlarmImpl)2 Source (cern.laser.business.data.Source)2 LaserDefinitionDuplicationException (cern.laser.business.definition.LaserDefinitionDuplicationException)2 LaserDefinitionException (cern.laser.business.definition.LaserDefinitionException)2 LaserDefinitionNotAllowedException (cern.laser.business.definition.LaserDefinitionNotAllowedException)2 LaserDefinitionNotFoundException (cern.laser.business.definition.LaserDefinitionNotFoundException)2 LaserDefinitionNotValidException (cern.laser.business.definition.LaserDefinitionNotValidException)2 ObjectMessage (javax.jms.ObjectMessage)2 TextMessage (javax.jms.TextMessage)2