Search in sources :

Example 1 with CernAlarmServiceUtils

use of alma.alarmsystem.corbaservice.CernAlarmServiceUtils in project ACS by ACS-Community.

the class AlarmServiceSingleton method getInstance.

public static synchronized CERNAlarmService getInstance(ORB orb, AcsLogger logger) throws Exception {
    if (orb == null) {
        throw new IllegalArgumentException("ORB can't be null");
    }
    if (logger == null) {
        throw new IllegalArgumentException("The Logger can't be null");
    }
    if (instance == null) {
        CernAlarmServiceUtils alarmUtils = new CernAlarmServiceUtils(orb, logger);
        instance = alarmUtils.getCernAlarmService();
    }
    return instance;
}
Also used : CernAlarmServiceUtils(alma.alarmsystem.corbaservice.CernAlarmServiceUtils)

Example 2 with CernAlarmServiceUtils

use of alma.alarmsystem.corbaservice.CernAlarmServiceUtils in project ACS by ACS-Community.

the class CategoryClient method getAlarmService.

/**
	 * Connect the AlarmSrevice component
	 */
private void getAlarmService() throws Exception {
    CernAlarmServiceUtils alarmtUtils = new CernAlarmServiceUtils(contSvc);
    alarm = alarmtUtils.getCernAlarmService();
}
Also used : CernAlarmServiceUtils(alma.alarmsystem.corbaservice.CernAlarmServiceUtils)

Example 3 with CernAlarmServiceUtils

use of alma.alarmsystem.corbaservice.CernAlarmServiceUtils in project ACS by ACS-Community.

the class CategoryClient method connect.

/**
	 * Connects to the passed categories of the alarm system
	 * 
	 * @param listener The lister to notify of the alarms received from the categories
	 * @param categories The categories to connect to
	 * @throws AcsJCannotGetComponentEx In case the AlarmService is not available
	 * @throws AlarmClientException In case of failure connecting the client
	 */
public void connect(AlarmSelectionListener listener, Category[] categories) throws AlarmClientException, AcsJCannotGetComponentEx {
    if (listener == null) {
        throw new IllegalArgumentException("The listener can't be null");
    }
    if (closed) {
        throw new IllegalStateException("SourceClient is closed!");
    }
    try {
        CernAlarmServiceUtils alarmUtils = new CernAlarmServiceUtils(orb, logger);
        alarm = alarmUtils.getCernAlarmService();
    } catch (Throwable t) {
        AcsJCannotGetComponentEx ex = new AcsJCannotGetComponentEx(t);
        ex.setReason("Alarm service unavailable");
        throw ex;
    }
    try {
        userHandler = new UserHandlerImpl(orb, logger);
        logger.log(AcsLogLevel.DEBUG, "UserHandler succesfully built");
        testUser = userHandler.getUser("test", orb, logger);
        logger.log(AcsLogLevel.DEBUG, "User generated");
        defaultConf = testUser.getDefaultConfiguration();
        logger.log(AcsLogLevel.DEBUG, "Getting the selection handler");
        jms_selectionHandler = AlarmSelectionHandler.get(orb, logger);
        addCategories(defaultConf, categories);
        // Get the active alarms (they are received by the listener)
        java.util.Map<String, Alarm> alreadyActive = jms_selectionHandler.select(defaultConf.getSelection(), listener);
        if (alreadyActive != null && alreadyActive.size() > 0) {
            Set<String> keys = alreadyActive.keySet();
            for (String key : keys) {
                listener.onAlarm(alreadyActive.get(key));
            }
        }
    } catch (Throwable t) {
        throw new AlarmClientException("Exception connecting the category client", t);
    }
}
Also used : Alarm(cern.laser.client.data.Alarm) AlarmClientException(alma.alarmsystem.clients.alarm.AlarmClientException) AcsJCannotGetComponentEx(alma.maciErrType.wrappers.AcsJCannotGetComponentEx) CernAlarmServiceUtils(alma.alarmsystem.corbaservice.CernAlarmServiceUtils) UserHandlerImpl(cern.laser.console.impl.UserHandlerImpl)

Example 4 with CernAlarmServiceUtils

use of alma.alarmsystem.corbaservice.CernAlarmServiceUtils in project ACS by ACS-Community.

the class IDLSendAlarmTest method setUp.

/**
	 * @see alma.acs.component.client.ComponentClientTestCase#setUp()
	 */
@Override
protected void setUp() throws Exception {
    super.setUp();
    contSvcs = getContainerServices();
    assertNotNull(contSvcs);
    logger = contSvcs.getLogger();
    assertNotNull(logger);
    // Get the alarm service
    CernAlarmServiceUtils utils = new CernAlarmServiceUtils(contSvcs);
    assertNotNull(utils);
    alarmService = CERNAlarmServiceHelper.narrow(utils.getAlarmService());
    assertNotNull(alarmService);
    assertFalse(alarmService.isACSAlarmService());
    alarms.clear();
    // Connect the categories
    categoryClient = new CategoryClient(contSvcs);
    assertNotNull(categoryClient);
    categoryClient.addAlarmListener(this);
    categoryClient.connect();
}
Also used : CategoryClient(alma.acs.lasercore.test.stress.CategoryClient) CernAlarmServiceUtils(alma.alarmsystem.corbaservice.CernAlarmServiceUtils)

Example 5 with CernAlarmServiceUtils

use of alma.alarmsystem.corbaservice.CernAlarmServiceUtils in project ACS by ACS-Community.

the class TestAlarmService method setUp.

/**
	 * @see TestCase
	 */
public void setUp() throws Exception {
    super.setUp();
    contSvcs = getContainerServices();
    assertNotNull(contSvcs);
    utils = new CernAlarmServiceUtils(contSvcs);
    assertNotNull(utils);
    // Get the AS 
    alarmService = utils.getCernAlarmService();
    assertNotNull(alarmService);
}
Also used : CernAlarmServiceUtils(alma.alarmsystem.corbaservice.CernAlarmServiceUtils)

Aggregations

CernAlarmServiceUtils (alma.alarmsystem.corbaservice.CernAlarmServiceUtils)5 CategoryClient (alma.acs.lasercore.test.stress.CategoryClient)1 AlarmClientException (alma.alarmsystem.clients.alarm.AlarmClientException)1 AcsJCannotGetComponentEx (alma.maciErrType.wrappers.AcsJCannotGetComponentEx)1 Alarm (cern.laser.client.data.Alarm)1 UserHandlerImpl (cern.laser.console.impl.UserHandlerImpl)1