Search in sources :

Example 1 with AlarmService

use of alma.alarmsystem.AlarmService in project ACS by ACS-Community.

the class AlarmServiceUtils method main.

/**
	 * The main method
	 * 
	 * @param args
	 */
public static void main(String[] args) {
    System.out.println("HERE");
    AcsLogger log = ClientLogManager.getAcsLogManager().getLoggerForApplication("AlarmServiceUtils", true);
    log.log(AcsLogLevel.DEBUG, "Started");
    for (String opt : args) {
        if (opt.compareToIgnoreCase("-h") == 0 || opt.compareToIgnoreCase("--help") == 0) {
            printUsage();
            System.exit(0);
        }
        if (opt.compareToIgnoreCase("-s") == 0 || opt.compareToIgnoreCase("--shutdown") == 0) {
            AlarmServiceUtils utils = new AlarmServiceUtils(log);
            AlarmService alarmService = null;
            try {
                alarmService = utils.getAlarmService();
            } catch (Throwable t) {
                log.log(AcsLogLevel.ERROR, "Error getting the alarm service", t);
                t.printStackTrace(System.err);
                utils.shutdownORB();
                System.exit(-1);
            }
            log.log(AcsLogLevel.DEBUG, "Got a reference to the alarm service");
            try {
                log.log(AcsLogLevel.DEBUG, "Stopping the alarm service");
                alarmService.shutdown();
                log.log(AcsLogLevel.DEBUG, "Alarm service stopped");
            } catch (Throwable t) {
                log.log(AcsLogLevel.ERROR, "Error shutting down the alarm service", t);
                t.printStackTrace(System.err);
                utils.shutdownORB();
                System.exit(-1);
            }
            utils.shutdownORB();
            log.log(AcsLogLevel.DEBUG, "Done");
        }
    }
}
Also used : AlarmService(alma.alarmsystem.AlarmService) AcsLogger(alma.acs.logging.AcsLogger)

Aggregations

AcsLogger (alma.acs.logging.AcsLogger)1 AlarmService (alma.alarmsystem.AlarmService)1