/*
 * 
 * 
 * Copyright (C) 2007 SIPfoundry Inc.
 * Licensed by SIPfoundry under the LGPL license.
 * 
 * Copyright (C) 2007 Pingtel Corp.
 * Licensed to SIPfoundry under a Contributor Agreement.
 * 
 * $
 */
package org.sipfoundry.sipxconfig.common;

import org.springframework.beans.factory.access.BeanFactoryLocator;
import org.springframework.beans.factory.access.BeanFactoryReference;
import org.springframework.context.ApplicationContext;
import org.springframework.context.access.ContextSingletonBeanFactoryLocator;

/**
 * Triggers system to start up, then find a requested bean, then runs it.
 */
public class SystemTaskRunner {

    @SuppressWarnings("unused")
    public static void main(String[] args) {
        if (args == null || args.length == 0) {
            System.err.println("bean to run is required as first argument");
            System.exit(1);
        }

        new SystemTaskRunner().runMain(args);
    }
    
    void runMain(String[] args) {
        BeanFactoryLocator bfl = ContextSingletonBeanFactoryLocator.getInstance();
        BeanFactoryReference bfr = bfl.useBeanFactory("servicelayer-context");
        ApplicationContext app = (ApplicationContext) bfr.getFactory();
        SystemTaskEntryPoint task = (SystemTaskEntryPoint) app.getBean(args[0]);
        task.runSystemTask(args);
    }
}

@@ -636,40 +636,8 @@
  %7B%0A%0A
-    @SuppressWarnings(%22unused%22)%0A
     
@@ -741,25 +741,41 @@
     
-System.err.printl
+throw new IllegalArgumentExceptio
 n(%22b
@@ -822,36 +822,8 @@
 %22);%0A
-            System.exit(1);%0A
     

Remove checkstyle warning about System.err