Package org.apache.oodt.commons.option

Examples of org.apache.oodt.commons.option.CmdLineOptionInstance


                .getRequiredOptionsNotSet(optionInstances, reqOptions);
        for (CmdLineOption unsetReqOption : unsetReqOptions) {
            if (unsetReqOption.getRequiredOptions().size() > 0) {
                for (RequiredOption reqOption : unsetReqOption
                        .getRequiredOptions()) {
                    CmdLineOptionInstance optionInst = getOptionInstanceByName(
                            reqOption.getOptionLongName(), optionInstances);
                    if (optionInst != null
                            && ((reqOption.isRequireAllValues() && optionInst
                                    .getValues().containsAll(
                                            reqOption.getOptionValues())) || (!reqOption
                                    .isRequireAllValues() && !Collections
                                    .disjoint(optionInst.getValues(), reqOption
                                            .getOptionValues()))))
                        throw new IOException("Option "
                                + unsetReqOption.getId() + " is required");
                }
            } else
                throw new IOException("Option " + unsetReqOption.getId()
                        + " is required");
        }

        // validate options
        for (CmdLineOptionInstance optionInst : optionInstances) {
            for (CmdLineOptionValidator validator : optionInst.getOption()
                    .getValidators())
                if (!validator.validate(optionInst))
                    throw new IOException("Option "
                            + optionInst.getOption().getId()
                            + " failed validation");
        }

        // if all looks good . . . handle options
        for (CmdLineOptionInstance optionInst : optionInstances)
            optionInst.getOption().getHandler().handleOption(
                    optionInst.getOption(), optionInst.getValues());

        return optionInstances;
    }
View Full Code Here


                  System.exit(0);
                }
               
                // add to list of option instances
                optionInstances
                        .add(new CmdLineOptionInstance(curOption, values));
               
            } else {
                throw new IOException("Argument with no option flag '" + curArg
                        + "'");
            }
View Full Code Here

    String configFile = PathUtils.doDynamicReplacement(System.getProperty("org.apache.oodt.cas.catalog.server.config.file", "classpath:/org/apache/oodt/cas/catalog/config/catserv-server-config.xml"));
    FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext(new String[] { configFile }, false);
    appContext.setClassLoader(new Serializer().getClassLoader());
    appContext.refresh();
        List<CmdLineOptionInstance> optionInstances = CmdLineOptionUtils.loadValidateAndHandleInstances(appContext, args);
        CmdLineOptionInstance instance = CmdLineOptionUtils.getOptionInstanceByName("serverFactoryBeanId", optionInstances);
        CommunicationChannelServerFactory serverFactory = (CommunicationChannelServerFactory) appContext.getBean(instance.getValues().get(0), CommunicationChannelServerFactory.class);
        CommunicationChannelServer communicationChannelServer = serverFactory.createCommunicationChannelServer();
    communicationChannelServer.startup();
    System.out.println("\n---- Launched '" +  communicationChannelServer.getClass().getCanonicalName() + "' on port: " + communicationChannelServer.getPort() + " ----");

//   
View Full Code Here

    String configFile = PathUtils.doDynamicReplacement(System.getProperty("org.apache..oodt.cas.catalog.client.config.file", "classpath:/org/apache/oodt/cas/catalog/config/catserv-client-config.xml"));
    FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext(new String[] { configFile }, false);
//    appContext.setClassLoader(new Serializer().getClassLoader());
    appContext.refresh();
        List<CmdLineOptionInstance> optionInstances = CmdLineOptionUtils.loadValidateAndHandleInstances(appContext, args);
        CmdLineOptionInstance instance = CmdLineOptionUtils.getOptionInstanceByName("clientFactoryBeanId", optionInstances);
    CatalogServiceClientFactory csClientFactory = (CatalogServiceClientFactory) appContext.getBean(instance.getValues().get(0), CatalogServiceClientFactory.class);
    CatalogServiceClient csClient = csClientFactory.createCatalogService();
        instance = CmdLineOptionUtils.getOptionInstanceByName("action", optionInstances);
    ((CatalogServiceServerAction) appContext.getBean(instance.getValues().get(0), CatalogServiceServerAction.class)).performAction(csClient);
  }
View Full Code Here

TOP

Related Classes of org.apache.oodt.commons.option.CmdLineOptionInstance

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.