org.apache.axis2.util.CommandLineOptionParser Java Examples

The following examples show how to use org.apache.axis2.util.CommandLineOptionParser. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SampleAxis2ServerManager.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
public void start(String[] args) throws Exception {
    String repoLocation = null;
    String confLocation = null;

    CommandLineOptionParser optionsParser = new CommandLineOptionParser(args);
    List invalidOptionsList = optionsParser.getInvalidOptions(new OptionsValidator() {
        public boolean isInvalid(CommandLineOption option) {
            String optionType = option.getOptionType();
            return !("repo".equalsIgnoreCase(optionType) || "conf"
                .equalsIgnoreCase(optionType));
        }
    });

    if ((invalidOptionsList.size() > 0) || (args.length > 4)) {
        printUsage();
    }

    Map optionsMap = optionsParser.getAllOptions();

    CommandLineOption repoOption = (CommandLineOption) optionsMap
        .get("repo");
    CommandLineOption confOption = (CommandLineOption) optionsMap
        .get("conf");

    log.info("[SimpleAxisServer] Starting");
    if (repoOption != null) {
        repoLocation = repoOption.getOptionValue();
        System.out.println("[SimpleAxisServer] Using the Axis2 Repository : "
            + new File(repoLocation).getAbsolutePath());
    }
    if (confOption != null) {
        confLocation = confOption.getOptionValue();
        System.out
            .println("[SimpleAxisServer] Using the Axis2 Configuration File : "
                + new File(confLocation).getAbsolutePath());
    }
    try {
        configctx = ConfigurationContextFactory
            .createConfigurationContextFromFileSystem(repoLocation,
                confLocation);

        configurePort(configctx);

        // Need to initialize the cluster manager at last since we are changing the servers
        // HTTP/S ports above. In the axis2.xml file, we need to set the "AvoidInitiation" param
        // to "true"
        ClusteringAgent clusteringAgent =
                configctx.getAxisConfiguration().getClusteringAgent();
        if(clusteringAgent != null) {
            clusteringAgent.setConfigurationContext(configctx);
            clusteringAgent.init();
        }

        // Finally start the transport listeners
        listenerManager = new ListenerManager();
        listenerManager.init(configctx);
        listenerManager.start();
        log.info("[SimpleAxisServer] Started");
    } catch (Throwable t) {
        log.fatal("[SimpleAxisServer] Shutting down. Error starting SimpleAxisServer", t);
        System.exit(1); // must stop application
    }
}
 
Example #2
Source File: SampleAxis2ServerManager.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
public void start(String[] args) throws Exception {
    String repoLocation = null;
    String confLocation = null;

    CommandLineOptionParser optionsParser = new CommandLineOptionParser(args);
    List invalidOptionsList = optionsParser.getInvalidOptions(new OptionsValidator() {
        public boolean isInvalid(CommandLineOption option) {
            String optionType = option.getOptionType();
            return !("repo".equalsIgnoreCase(optionType) || "conf"
                .equalsIgnoreCase(optionType));
        }
    });

    if ((invalidOptionsList.size() > 0) || (args.length > 4)) {
        printUsage();
    }

    Map optionsMap = optionsParser.getAllOptions();

    CommandLineOption repoOption = (CommandLineOption) optionsMap
        .get("repo");
    CommandLineOption confOption = (CommandLineOption) optionsMap
        .get("conf");

    log.info("[SimpleAxisServer] Starting");
    if (repoOption != null) {
        repoLocation = repoOption.getOptionValue();
        System.out.println("[SimpleAxisServer] Using the Axis2 Repository : "
            + new File(repoLocation).getAbsolutePath());
    }
    if (confOption != null) {
        confLocation = confOption.getOptionValue();
        System.out
            .println("[SimpleAxisServer] Using the Axis2 Configuration File : "
                + new File(confLocation).getAbsolutePath());
    }
    try {
        configctx = ConfigurationContextFactory
            .createConfigurationContextFromFileSystem(repoLocation,
                confLocation);

        configurePort(configctx);

        // Need to initialize the cluster manager at last since we are changing the servers
        // HTTP/S ports above. In the axis2.xml file, we need to set the "AvoidInitiation" param
        // to "true"
        ClusteringAgent clusteringAgent =
                configctx.getAxisConfiguration().getClusteringAgent();
        if(clusteringAgent != null) {
            clusteringAgent.setConfigurationContext(configctx);
            clusteringAgent.init();
        }

        // Finally start the transport listeners
        listenerManager = new ListenerManager();
        listenerManager.init(configctx);
        listenerManager.start();
        log.info("[SimpleAxisServer] Started");
    } catch (Throwable t) {
        log.fatal("[SimpleAxisServer] Shutting down. Error starting SimpleAxisServer", t);
        System.exit(1); // must stop application
    }
}
 
Example #3
Source File: SampleAxis2ServerManager.java    From product-ei with Apache License 2.0 4 votes vote down vote up
public void start(String[] args) throws Exception {
    String repoLocation = null;
    String confLocation = null;

    CommandLineOptionParser optionsParser = new CommandLineOptionParser(args);
    List invalidOptionsList = optionsParser.getInvalidOptions(new OptionsValidator() {
        public boolean isInvalid(CommandLineOption option) {
            String optionType = option.getOptionType();
            return !("repo".equalsIgnoreCase(optionType) || "conf"
                .equalsIgnoreCase(optionType));
        }
    });

    if ((invalidOptionsList.size() > 0) || (args.length > 4)) {
        printUsage();
    }

    Map optionsMap = optionsParser.getAllOptions();

    CommandLineOption repoOption = (CommandLineOption) optionsMap
        .get("repo");
    CommandLineOption confOption = (CommandLineOption) optionsMap
        .get("conf");

    log.info("[SimpleAxisServer] Starting");
    if (repoOption != null) {
        repoLocation = repoOption.getOptionValue();
        System.out.println("[SimpleAxisServer] Using the Axis2 Repository : "
            + new File(repoLocation).getAbsolutePath());
    }
    if (confOption != null) {
        confLocation = confOption.getOptionValue();
        System.out
            .println("[SimpleAxisServer] Using the Axis2 Configuration File : "
                + new File(confLocation).getAbsolutePath());
    }
    try {
        configctx = ConfigurationContextFactory
            .createConfigurationContextFromFileSystem(repoLocation,
                confLocation);

        configurePort(configctx);

        // Need to initialize the cluster manager at last since we are changing the servers
        // HTTP/S ports above. In the axis2.xml file, we need to set the "AvoidInitiation" param
        // to "true"
        ClusteringAgent clusteringAgent =
                configctx.getAxisConfiguration().getClusteringAgent();
        if(clusteringAgent != null) {
            clusteringAgent.setConfigurationContext(configctx);
            clusteringAgent.init();
        }

        // Finally start the transport listeners
        listenerManager = new ListenerManager();
        listenerManager.init(configctx);
        listenerManager.start();
        log.info("[SimpleAxisServer] Started");
    } catch (Throwable t) {
        log.fatal("[SimpleAxisServer] Shutting down. Error starting SimpleAxisServer", t);
        System.exit(1); // must stop application
    }
}
 
Example #4
Source File: SampleAxis2ServerManager.java    From product-ei with Apache License 2.0 4 votes vote down vote up
public void start(String[] args) throws Exception {
    String repoLocation = null;
    String confLocation = null;

    CommandLineOptionParser optionsParser = new CommandLineOptionParser(args);
    List invalidOptionsList = optionsParser.getInvalidOptions(new OptionsValidator() {
        public boolean isInvalid(CommandLineOption option) {
            String optionType = option.getOptionType();
            return !("repo".equalsIgnoreCase(optionType) || "conf"
                .equalsIgnoreCase(optionType));
        }
    });

    if ((invalidOptionsList.size() > 0) || (args.length > 4)) {
        printUsage();
    }

    Map optionsMap = optionsParser.getAllOptions();

    CommandLineOption repoOption = (CommandLineOption) optionsMap
        .get("repo");
    CommandLineOption confOption = (CommandLineOption) optionsMap
        .get("conf");

    log.info("[SimpleAxisServer] Starting");
    if (repoOption != null) {
        repoLocation = repoOption.getOptionValue();
        System.out.println("[SimpleAxisServer] Using the Axis2 Repository : "
            + new File(repoLocation).getAbsolutePath());
    }
    if (confOption != null) {
        confLocation = confOption.getOptionValue();
        System.out
            .println("[SimpleAxisServer] Using the Axis2 Configuration File : "
                + new File(confLocation).getAbsolutePath());
    }
    try {
        configctx = ConfigurationContextFactory
            .createConfigurationContextFromFileSystem(repoLocation,
                confLocation);

        configurePort(configctx);

        // Finally start the transport listeners
        listenerManager = new ListenerManager();
        listenerManager.init(configctx);
        listenerManager.start();
        log.info("[SimpleAxisServer] Started");
    } catch (Throwable t) {
        log.fatal("[SimpleAxisServer] Shutting down. Error starting SimpleAxisServer", t);
        System.exit(1); // must stop application
    }
}