Search in sources :

Example 1 with LaserProcessingException

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

the class CoreServiceImpl method select.

//
// -- PRIVATE METHODS ---------------------------------------------
//
/*
   * (non-Javadoc)
   * 
   * @see cern.laser.business.ejb.CoreServiceSessionEJB#select(java.lang.Integer, java.lang.String)
   */
private void select(Integer categoryId, String clientId) throws LaserProcessingException {
    System.out.println("*** CoreServiceImpl::select: selecting category " + categoryId.toString() + " for client " + clientId);
    ProcessingController processingController = ProcessingController.getInstance();
    if (!processingController.isProcessing()) {
        throw new LaserProcessingException("server not initialized");
    }
    try {
        if (LOGGER.isInfoEnabled()) {
            Category category = categoryDAO.findCategory(categoryId);
            String category_path = category.getPath();
            LOGGER.info("requested category : " + category_path);
        }
        String destination = getClientRootTopic() + "." + clientId;
        CategoryActiveList active_list = alarmCache.getActiveListReference(categoryId);
        String[] active_alarms = active_list.getActiveAlarms();
        if (active_alarms.length > 0) {
            Collection init_alarms = new HashSet(active_alarms.length);
            for (int i = 0; i < active_alarms.length; i++) {
                Alarm alarm = alarmCache.getReference(active_alarms[i]);
                init_alarms.add(alarm);
            }
            LOGGER.info("found " + init_alarms.size() + " matching alarm(s)");
            alarmPublisher.sendInit(init_alarms, destination);
        }
    } catch (AlarmCacheException e) {
        System.err.println("*** Got an exception! " + e.getMessage());
        e.printStackTrace(System.out);
        System.err.println("*** Exception masked");
    //throw new EJBException("unable to select alarms", e);
    }
}
Also used : LaserProcessingException(cern.laser.business.LaserProcessingException) Category(cern.laser.business.data.Category) ProcessingController(cern.laser.business.ProcessingController) CategoryActiveList(cern.laser.business.data.CategoryActiveList) Alarm(cern.laser.business.data.Alarm) Collection(java.util.Collection) AlarmCacheException(cern.laser.business.cache.AlarmCacheException) HashSet(java.util.HashSet)

Aggregations

LaserProcessingException (cern.laser.business.LaserProcessingException)1 ProcessingController (cern.laser.business.ProcessingController)1 AlarmCacheException (cern.laser.business.cache.AlarmCacheException)1 Alarm (cern.laser.business.data.Alarm)1 Category (cern.laser.business.data.Category)1 CategoryActiveList (cern.laser.business.data.CategoryActiveList)1 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1