org.apache.axis2.util.CommandLineOption Java Examples
The following examples show how to use
org.apache.axis2.util.CommandLineOption.
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: POMGenerator.java From carbon-commons with Apache License 2.0 | 6 votes |
/** * For Axis2 * * @param key * @param value * @param configurationMap * @return */ public static String getConfiguratonElement(String key, CommandLineOption value, Map configurationMap, Map defaultValueMap) { String s = (String) configurationMap.get(key); if (s == null) { return ""; } String stringValue = null; if (value.getOptionValue() == null) { if (defaultValueMap.containsKey(key)) { stringValue = (String) defaultValueMap.get(key); } else { stringValue = "true"; } } else { stringValue = value.getOptionValue(); } return "<" + s + ">" + stringValue + "</" + s + ">"; }
Example #2
Source File: SampleAxis2ServerManager.java From micro-integrator with Apache License 2.0 | 4 votes |
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 micro-integrator with Apache License 2.0 | 4 votes |
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 |
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 #5
Source File: SampleAxis2ServerManager.java From product-ei with Apache License 2.0 | 4 votes |
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 } }
Example #6
Source File: POMGenerator.java From carbon-commons with Apache License 2.0 | 4 votes |
public void generateAxis2Client(Map optionsMap, String codegenOutputDirectory, HashMap<String, String> projOptionsList) throws Exception { Map<String, String> configurationMap = new HashMap<String, String>(); Map<String, String> predifinedValues = new HashMap<String, String>(); configurationMap.put("uri", "wsdlFile"); configurationMap.put("o", "outputDirectory"); configurationMap.put("a", "syncMode"); configurationMap.put("s", "syncMode"); configurationMap.put("u", "unpackClasses"); configurationMap.put("sn", "serviceName"); configurationMap.put("uw", "unwrap"); configurationMap.put("ap", "allPorts"); configurationMap.put("pn", "portName"); configurationMap.put("p", "packageName"); configurationMap.put("ns2p", "namespaceToPackages"); configurationMap.put("t", "generateTestcase"); configurationMap.put("p", "packageName"); configurationMap.put("l", "language"); configurationMap.put("d", "databindingName"); predifinedValues.put("a", "async"); predifinedValues.put("s", "sync"); checkPreconditions(optionsMap); String s = IOUtils.toString(Thread.currentThread().getContextClassLoader() .getResourceAsStream("org/wso2/carbon/wsdl2code/axis-pom.xml"), "UTF-8"); s = s.replace("gid", projOptionsList.get("-gid").toString()). replace("aid", projOptionsList.get("-aid").toString()). replace("vn", projOptionsList.get("-vn").toString()); Iterator iterator = optionsMap.keySet().iterator(); String configurations = ""; while (iterator.hasNext()) { Object o = iterator.next(); configurations += getConfiguratonElement((String) o, (CommandLineOption) optionsMap.get(o), configurationMap, predifinedValues); } ArrayList<String> artifactVersions = new ArrayList<String>(); //axis2 dependency URL url = getContainingArtifact(org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator.class); String version = getVersion(url.getFile()); artifactVersions.add(version); //axis2-adb dependency url = getContainingArtifact(RPCMessageReceiver.class); version = getVersion(url.getFile()); artifactVersions.add(version); //axis2 http transport dependency url = getContainingArtifact(org.apache.axis2.transport.http.HTTPWorker.class); version = getVersion(url.getFile()); artifactVersions.add(version); //axis2 local transport dependency url = getContainingArtifact(LocalTransportSender.class); version = getVersion(url.getFile()); artifactVersions.add(version); // url = getContainingArtifact(TestCase.class); // version = getVersion(url.getFile()); // // artifactVersions.add(version); // for (int i = 0; i < artifactVersions.size(); i++) { // s = s.replace("{dependancy-v-" + (i + 1) + "}", artifactVersions.get(i).replace(".wso2", "-wso2")); // // } s = s.replaceAll("axs_ver", artifactVersions.get(0).replace(".wso2", "-wso2")); String toWrite = String.format(s, configurations); createFile(codegenOutputDirectory, toWrite); }