Author: asankha
Date: Mon Dec 18 02:59:43 2006
New Revision: 488223

URL: http://svn.apache.org/viewvc?view=rev&rev=488223
Log:
commit changes sent by Chathura with parallel modifications to the .bat files 
to specify a -port option to the synapse and sample axis2 server start scripts

Modified:
    
incubator/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/SynapseHTTPServer.java
    
incubator/synapse/trunk/java/modules/samples/src/main/scripts/axis2server.bat
    incubator/synapse/trunk/java/modules/samples/src/main/scripts/axis2server.sh
    incubator/synapse/trunk/java/src/main/bin/synapse.bat
    incubator/synapse/trunk/java/src/main/bin/synapse.sh

Modified: 
incubator/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/SynapseHTTPServer.java
URL: 
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/SynapseHTTPServer.java?view=diff&rev=488223&r1=488222&r2=488223
==============================================================================
--- 
incubator/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/SynapseHTTPServer.java
 (original)
+++ 
incubator/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/SynapseHTTPServer.java
 Mon Dec 18 02:59:43 2006
@@ -24,6 +24,8 @@
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.engine.ListenerManager;
 import org.apache.axis2.description.TransportInDescription;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import javax.xml.namespace.QName;
 import java.io.File;
@@ -36,6 +38,8 @@
  */
 public class SynapseHTTPServer {
 
+    private static final Log log = LogFactory.getLog(SynapseHTTPServer.class);
+
     public static void printUsage() {
         System.out.println("Usage: SynapseHTTPServer <repository>");
         System.out.println(" Opts: -? this message");
@@ -93,7 +97,22 @@
 
         if (trsIn != null) {
 
-            int port = 
Integer.parseInt(trsIn.getParameter("port").getValue().toString());
+            int port = 8080;
+
+            String strPort = System.getProperty("port");
+            if(strPort != null) {
+                // port is specified as a VM parameter
+                try {
+                    port = new Integer(strPort).intValue();
+                } catch (NumberFormatException e) {
+                    // user supplied parameter is not a valid integer. so use 
the port in configuration.
+                    log.error("Given port is not a valid integer. Port 
specified in the configuration is used for the server.");
+                    port = 
Integer.parseInt(trsIn.getParameter("port").getValue().toString());
+                }
+
+            } else {
+                port = 
Integer.parseInt(trsIn.getParameter("port").getValue().toString());
+            }
 
             while (true) {
                 ServerSocket sock = null;

Modified: 
incubator/synapse/trunk/java/modules/samples/src/main/scripts/axis2server.bat
URL: 
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/samples/src/main/scripts/axis2server.bat?view=diff&rev=488223&r1=488222&r2=488223
==============================================================================
--- 
incubator/synapse/trunk/java/modules/samples/src/main/scripts/axis2server.bat 
(original)
+++ 
incubator/synapse/trunk/java/modules/samples/src/main/scripts/axis2server.bat 
Mon Dec 18 02:59:43 2006
@@ -47,13 +47,24 @@
 
 :checkJava
 set _JAVACMD=%JAVACMD%
+set _PORT=
 
 if "%JAVA_HOME%" == "" goto noJavaHome
 if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
 if "%_JAVACMD%" == "" set _JAVACMD=%JAVA_HOME%\bin\java.exe
-if  "%AXIS2_CMD_LINE_ARGS%" == "" goto defaultParams
 
-goto runAxis2
+:setupArgs
+if ""%1""=="""" goto defaultParams
+if ""%1""==""-port"" goto port
+shift
+goto setupArgs
+
+rem is a custom port specified
+:port
+shift
+set _PORT="-Dport=%1"
+shift
+goto setupArgs
 
 :defaultParams
 set AXIS2_CMD_LINE_ARGS=-repo "%AXIS2_HOME%\repository" -conf 
"%AXIS2_HOME%\repository\conf\axis2.xml"
@@ -75,7 +86,7 @@
 echo Using AXIS2_HOME   %AXIS2_HOME%
 
 cd %AXIS2_HOME%
-"%_JAVACMD%" %JAVA_OPTS% -cp "%AXIS2_CLASS_PATH%" 
org.apache.axis2.transport.SimpleAxis2Server %AXIS2_CMD_LINE_ARGS%
+"%_JAVACMD%" %_PORT% %JAVA_OPTS% -cp "%AXIS2_CLASS_PATH%" 
samples.util.SampleAxis2Server %AXIS2_CMD_LINE_ARGS%
 goto end
 
 :end

Modified: 
incubator/synapse/trunk/java/modules/samples/src/main/scripts/axis2server.sh
URL: 
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/samples/src/main/scripts/axis2server.sh?view=diff&rev=488223&r1=488222&r2=488223
==============================================================================
--- 
incubator/synapse/trunk/java/modules/samples/src/main/scripts/axis2server.sh 
(original)
+++ 
incubator/synapse/trunk/java/modules/samples/src/main/scripts/axis2server.sh 
Mon Dec 18 02:59:43 2006
@@ -99,5 +99,10 @@
 echo " Using AXIS2 Repository :   $AXIS2_HOME/repository"
 echo " Using AXIS2 Configuration :   $AXIS2_HOME/repository/conf/axis2.xml"
 
-java -classpath $AXIS2_CLASSPATH org.apache.axis2.transport.SimpleAxis2Server \
--repo $AXIS2_HOME/repository -conf $AXIS2_HOME/repository/conf/axis2.xml $*
+PORT="-Dport=9000"
+if [ "$1" == "-port" ]; then
+  PORT="-Dport=$2"
+fi
+
+java $PORT -classpath $AXIS2_CLASSPATH samples.util.SampleAxis2Server \
+-repo $AXIS2_HOME/repository -conf $AXIS2_HOME/repository/conf/axis2.xml

Modified: incubator/synapse/trunk/java/src/main/bin/synapse.bat
URL: 
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/src/main/bin/synapse.bat?view=diff&rev=488223&r1=488222&r2=488223
==============================================================================
--- incubator/synapse/trunk/java/src/main/bin/synapse.bat (original)
+++ incubator/synapse/trunk/java/src/main/bin/synapse.bat Mon Dec 18 02:59:43 
2006
@@ -29,35 +29,45 @@
 set _USE_CLASSPATH=yes
 set _SYNAPSE_XML=
 set _XDEBUG=
+set _PORT=
 
 rem Slurp the command line arguments. This loop allows for an unlimited number
 rem of arguments (up to the command line limit, anyway).
-if ""%1""==""-sample"" goto synapseSample
-
-set SYNAPSE_CMD_LINE_ARGS=%1
-if ""%1""=="""" goto doneStart
-shift
 
 :setupArgs
 if ""%1""=="""" goto doneStart
+if ""%1""==""-sample"" goto synapseSample
 if ""%1""==""-noclasspath"" goto clearclasspath
 if ""%1""==""-xdebug"" goto xdebug
+if ""%1""==""-port"" goto port
 set SYNAPSE_CMD_LINE_ARGS=%SYNAPSE_CMD_LINE_ARGS% %1
 shift
 goto setupArgs
 
+set SYNAPSE_CMD_LINE_ARGS=%1
+if ""%1""=="""" goto doneStart
+shift
+
 rem here is there is a -noclasspath in the options
 :clearclasspath
 set _USE_CLASSPATH=no
 shift
 goto setupArgs
 
-rem here is there is a -xdebug in the options
+rem is there is a -xdebug in the options
 :xdebug
 set _XDEBUG=-Xdebug -Xnoagent 
-Xrunjdwp:transport=dt_socket,server=y,address=8000
 shift
 goto setupArgs
 
+rem is a custom port specified
+:port
+shift
+set _PORT="-Dport=%1"
+shift
+goto setupArgs
+
+
 rem This label provides a place for the argument list loop to break out
 rem and for NT handling to skip to.
 
@@ -105,9 +115,9 @@
 
 set 
SYNAPSE_ENDORSED="%SYNAPSE_HOME%\lib\endorsed";"%JAVA_ENDORSED_DIRS%";"%JAVA_HOME%\lib\endorsed"
 
[EMAIL PROTECTED] on
[EMAIL PROTECTED] @echo on
 cd %SYNAPSE_HOME%
-"%_JAVACMD%" %_SYNAPSE_XML% 
-Daxis2.xml="%SYNAPSE_HOME%\repository\conf\axis2.xml" 
-Djava.endorsed.dirs=%SYNAPSE_ENDORSED% %_XDEBUG% -cp %SYNAPSE_CLASS_PATH% 
org.apache.synapse.SynapseHTTPServer %SYNAPSE_CMD_LINE_ARGS%
+"%_JAVACMD%" %_PORT% %_SYNAPSE_XML% 
-Daxis2.xml="%SYNAPSE_HOME%\repository\conf\axis2.xml" 
-Djava.endorsed.dirs=%SYNAPSE_ENDORSED% %_XDEBUG% -cp %SYNAPSE_CLASS_PATH% 
org.apache.synapse.SynapseHTTPServer %SYNAPSE_CMD_LINE_ARGS%
 goto end
 
 :end

Modified: incubator/synapse/trunk/java/src/main/bin/synapse.sh
URL: 
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/src/main/bin/synapse.sh?view=diff&rev=488223&r1=488222&r2=488223
==============================================================================
--- incubator/synapse/trunk/java/src/main/bin/synapse.sh (original)
+++ incubator/synapse/trunk/java/src/main/bin/synapse.sh Mon Dec 18 02:59:43 
2006
@@ -109,6 +109,15 @@
 
SYNAPSE_XML=-Dsynapse.xml=$SYNAPSE_HOME/repository/conf/sample/synapse_sample_$2.xml
 fi
 
+if [ "$3" == "-sample" ]; then
+SYNAPSE_XML=-Dsynapse.xml=$SYNAPSE_HOME/repository/conf/sample/synapse_sample_$4.xml
+fi
+
+PORT="-Dport=8080"
+if [ "$1" == "-port" ]; then
+  PORT="-Dport=$2"
+fi
+
 # ----- Execute The Requested Command -----------------------------------------
 
 cd $SYNAPSE_HOME
@@ -117,4 +126,4 @@
 echo "Using JAVA_HOME:       $JAVA_HOME"
 echo "Using SYNAPSE_XML:     $SYNAPSE_XML"
 
-$JAVA_HOME/bin/java $SYNAPSE_XML 
-Daxis2.xml=$SYNAPSE_HOME/repository/conf/axis2.xml 
-Djava.endorsed.dirs=$SYNAPSE_ENDORSED -classpath $SYNAPSE_CLASSPATH 
org.apache.synapse.SynapseHTTPServer $SYNAPSE_HOME/repository
+$JAVA_HOME/bin/java $PORT $SYNAPSE_XML 
-Daxis2.xml=$SYNAPSE_HOME/repository/conf/axis2.xml 
-Djava.endorsed.dirs=$SYNAPSE_ENDORSED -classpath $SYNAPSE_CLASSPATH 
org.apache.synapse.SynapseHTTPServer $SYNAPSE_HOME/repository



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to