Search in sources :

Example 1 with AlarmImpl

use of cern.laser.client.impl.data.AlarmImpl 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);
    }
}
Also used : AlarmImpl(cern.laser.client.impl.data.AlarmImpl) LaserConnectionException(cern.laser.client.LaserConnectionException) LaserException(cern.laser.client.LaserException) LaserException(cern.laser.client.LaserException)

Example 2 with AlarmImpl

use of cern.laser.client.impl.data.AlarmImpl 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);
    }
}
Also used : AlarmImpl(cern.laser.client.impl.data.AlarmImpl) LaserConnectionException(cern.laser.client.LaserConnectionException) LaserException(cern.laser.client.LaserException) LaserException(cern.laser.client.LaserException)

Example 3 with AlarmImpl

use of cern.laser.client.impl.data.AlarmImpl in project ACS by ACS-Community.

the class AlarmBrowsingHandlerImpl method toBusinessAlarmCollection.

/**
   * Helper method.
   * @param as
   * @return
   */
public static Collection toBusinessAlarmCollection(alma.alarmsystem.Alarm[] as) {
    if (as == null || as.length == 0)
        return new ArrayList(0);
    Collection result = new ArrayList(as.length);
    for (int i = 0; i < as.length; i++) {
        cern.laser.business.data.Alarm alarmBusiness = toBusinessAlarm(as[i]);
        result.add(new AlarmImpl(alarmBusiness));
    }
    return result;
}
Also used : AlarmImpl(cern.laser.client.impl.data.AlarmImpl) ArrayList(java.util.ArrayList) Collection(java.util.Collection)

Example 4 with AlarmImpl

use of cern.laser.client.impl.data.AlarmImpl in project ACS by ACS-Community.

the class AlarmSelectionHelper method onMessage.

//
// -- implements SubscriptionListener ---------------------------------
//
/**
   * DOCUMENT ME!
   * 
   * @param msg DOCUMENT ME!
   */
public void onMessage(Message msg) {
    ACSJMSTextMessage acsMsg = (ACSJMSTextMessage) msg;
    if (selectionListener != null) {
        try {
            cern.laser.business.data.AlarmImpl business_alarm = AlarmMessageConversion.getAlarm(((ACSJMSTextMessage) msg).getText());
            AlarmImpl alarm = new AlarmImpl(business_alarm);
            selectionListener.onAlarm(alarm);
        } catch (Exception e) {
            LOGGER.warn("error on message", e);
        }
    }
}
Also used : AlarmImpl(cern.laser.client.impl.data.AlarmImpl) ACSJMSTextMessage(com.cosylab.acs.jms.ACSJMSTextMessage) LaserConnectionException(cern.laser.client.LaserConnectionException) LaserException(cern.laser.client.LaserException) UnknownHostException(java.net.UnknownHostException) JMSException(javax.jms.JMSException) MOMException(cern.cmw.mom.pubsub.MOMException) LaserSelectionException(cern.laser.client.services.selection.LaserSelectionException) LaserTimeOutException(cern.laser.client.LaserTimeOutException)

Aggregations

AlarmImpl (cern.laser.client.impl.data.AlarmImpl)4 LaserConnectionException (cern.laser.client.LaserConnectionException)3 LaserException (cern.laser.client.LaserException)3 MOMException (cern.cmw.mom.pubsub.MOMException)1 LaserTimeOutException (cern.laser.client.LaserTimeOutException)1 LaserSelectionException (cern.laser.client.services.selection.LaserSelectionException)1 ACSJMSTextMessage (com.cosylab.acs.jms.ACSJMSTextMessage)1 UnknownHostException (java.net.UnknownHostException)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 JMSException (javax.jms.JMSException)1