You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by th...@apache.org on 2006/10/19 05:51:14 UTC

svn commit: r465461 - /webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/SimpleAxisServer.java

Author: thilina
Date: Wed Oct 18 20:51:13 2006
New Revision: 465461

URL: http://svn.apache.org/viewvc?view=rev&rev=465461
Log:
New SimpleAxisServer which can setup the listeners given in axis2.xml

Added:
    webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/SimpleAxisServer.java   (with props)

Added: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/SimpleAxisServer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/SimpleAxisServer.java?view=auto&rev=465461
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/SimpleAxisServer.java (added)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/SimpleAxisServer.java Wed Oct 18 20:51:13 2006
@@ -0,0 +1,96 @@
+package org.apache.axis2.transport;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.Constants;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.engine.ListenerManager;
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+import org.apache.axis2.util.OptionsParser;
+import org.apache.axis2.wsdl.util.CommandLineOption;
+import org.apache.axis2.wsdl.util.CommandLineOptionParser;
+import org.apache.axis2.wsdl.util.OptionsValidator;
+import org.apache.axis2.wsdl.util.CommandLineOptionConstants.Java2WSDLConstants;
+import org.apache.axis2.wsdl.util.CommandLineOptionConstants.WSDL2JavaConstants;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class SimpleAxisServer {
+
+    private static final Log log = LogFactory.getLog(SimpleHTTPServer.class);
+
+    int port = -1;
+
+    public static int DEFAULT_PORT = 8080;
+    
+
+    /**
+     * @param args
+     * @throws Exception
+     */
+    public static void main(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();
+			return;
+		}
+		
+		Map optionsMap = optionsParser.getAllOptions();
+
+		CommandLineOption repoOption = (CommandLineOption) optionsMap
+				.get("repo");
+		CommandLineOption confOption = (CommandLineOption) optionsMap
+				.get("conf");
+
+		System.out.println("[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 {
+			ConfigurationContext configctx = ConfigurationContextFactory
+					.createConfigurationContextFromFileSystem(repoLocation,
+							confLocation);
+			ListenerManager listenerManager =  new ListenerManager();
+				listenerManager.init(configctx);
+			listenerManager.start();
+			System.out.println("[SimpleAxisServer] Started");
+		} catch (Throwable t) {
+            log.fatal("Error starting SimpleAxisServer", t);
+            System.out.println("[SimpleAxisServer] Shutting down");
+        }
+    }
+    
+    public static void printUsage() {
+        System.out.println("Usage: SimpleAxisServer -repo <repository>  -conf <axis2 configuration file>");
+        System.out.println();
+        System.exit(1);
+    }
+}

Propchange: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/transport/SimpleAxisServer.java
------------------------------------------------------------------------------
    svn:executable = *



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org