Search in sources :

Example 6 with LaserException

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
    }
}
Also used : UnknownHostException(java.net.UnknownHostException) LaserConnectionException(cern.laser.client.LaserConnectionException) LaserSearchException(cern.laser.client.services.selection.LaserSearchException) LaserException(cern.laser.client.LaserException) UnknownHostException(java.net.UnknownHostException) MOMException(cern.cmw.mom.pubsub.MOMException) LaserTimeOutException(cern.laser.client.LaserTimeOutException) LaserException(cern.laser.client.LaserException)

Example 7 with LaserException

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);
    }
}
Also used : LaserConnectionException(cern.laser.client.LaserConnectionException) LaserException(cern.laser.client.LaserException) LaserTimeOutException(cern.laser.client.LaserTimeOutException) LaserException(cern.laser.client.LaserException)

Example 8 with LaserException

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);
    }
}
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 9 with LaserException

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);
    }
}
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 10 with LaserException

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;
}
Also used : LaserConnectionException(cern.laser.client.LaserConnectionException) LaserSearchException(cern.laser.client.services.selection.LaserSearchException) LaserException(cern.laser.client.LaserException) UnknownHostException(java.net.UnknownHostException) MOMException(cern.cmw.mom.pubsub.MOMException) LaserTimeOutException(cern.laser.client.LaserTimeOutException) LaserException(cern.laser.client.LaserException)

Aggregations

LaserException (cern.laser.client.LaserException)15 LaserConnectionException (cern.laser.client.LaserConnectionException)13 MOMException (cern.cmw.mom.pubsub.MOMException)9 LaserTimeOutException (cern.laser.client.LaserTimeOutException)8 UnknownHostException (java.net.UnknownHostException)7 LaserSelectionException (cern.laser.client.services.selection.LaserSelectionException)6 JMSException (javax.jms.JMSException)4 LaserSearchException (cern.laser.client.services.selection.LaserSearchException)3 AlarmImpl (cern.laser.client.impl.data.AlarmImpl)2 LaserHeartbeatException (cern.laser.client.services.selection.LaserHeartbeatException)2 Collection (java.util.Collection)2 Subscriber (cern.cmw.mom.pubsub.Subscriber)1 Category (cern.laser.client.data.Category)1 LaserDefinitionException (cern.laser.definition.LaserDefinitionException)1 BufferedInputStream (java.io.BufferedInputStream)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1