Author: ruwan Date: Mon Nov 24 18:09:03 2008 New Revision: 24762 URL: http://wso2.org/svn/browse/wso2?view=rev&revision=24762
Log: Adding the samples main Added: trunk/esb/java/modules/samples/src/main/ (props changed) trunk/esb/java/modules/samples/src/main/conf/ trunk/esb/java/modules/samples/src/main/conf/client/ trunk/esb/java/modules/samples/src/main/conf/server/ trunk/esb/java/modules/samples/src/main/resources/ trunk/esb/java/modules/samples/src/main/scripts/ trunk/esb/java/modules/samples/src/main/scripts/axis2server.bat trunk/esb/java/modules/samples/src/main/scripts/axis2server.sh trunk/esb/java/modules/samples/src/main/scripts/build.xml Added: trunk/esb/java/modules/samples/src/main/scripts/axis2server.bat URL: http://wso2.org/svn/browse/wso2/trunk/esb/java/modules/samples/src/main/scripts/axis2server.bat?pathrev=24762 ============================================================================== --- (empty file) +++ trunk/esb/java/modules/samples/src/main/scripts/axis2server.bat Mon Nov 24 18:09:03 2008 @@ -0,0 +1,142 @@ [EMAIL PROTECTED] off + +REM Copyright 2001,2004-2005 The Apache Software Foundation +REM +REM Licensed under the Apache License, Version 2.0 (the "License"); +REM you may not use this file except in compliance with the License. +REM You may obtain a copy of the License at +REM +REM http://www.apache.org/licenses/LICENSE-2.0 +REM +REM Unless required by applicable law or agreed to in writing, software +REM distributed under the License is distributed on an "AS IS" BASIS, +REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +REM See the License for the specific language governing permissions and +REM limitations under the License. + +rem --------------------------------------------------------------------------- +rem Startup script for the Simple Axis Server (with default parameters) +rem +rem Environment Variable Prequisites +rem +rem AXIS2_HOME Must point at your AXIS2 directory +rem +rem JAVA_HOME Must point at your Java Development Kit installation. +rem +rem JAVA_OPTS (Optional) Java runtime options +rem --------------------------------------------------------------------------- + +if "%OS%"=="Windows_NT" @setlocal +if "%OS%"=="WINNT" @setlocal + +rem %~dp0 is expanded pathname of the current script under NT +if "%AXIS2_HOME%"=="" set AXIS2_HOME=%~dps0 + +rem find AXIS2_HOME if it does not exist due to either an invalid value passed +rem by the user or the %0 problem on Windows 9x + +if exist "%AXIS2_HOME%\repository\conf\axis2.xml" goto checkJava + +:noAxis2Home +echo AXIS2_HOME environment variable is set incorrectly or AXIS2 could not be located. +echo Please set the AXIS2_HOME variable appropriately +goto end + +:checkJava +set _JAVACMD=%JAVACMD% +set _HTTPPORT= +set _HTTPSPORT= +set _SERVERNAME= + +if "%JAVA_HOME%" == "" goto noJavaHome +if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome +if "%_JAVACMD%" == "" set _JAVACMD=%JAVA_HOME%\bin\java.exe + +:setupArgs +if ""%1""=="""" goto runAxis2 +if ""%1""==""-http"" goto httpport +if ""%1""==""-https"" goto httpsport +if ""%1""==""-name"" goto servername +if ""%1""==""-xdebug"" goto xdebug +shift +goto setupArgs + +rem is a custom port specified +:httpport +shift +set _HTTPPORT="-Dhttp_port=%1" +shift +goto setupArgs + +:httpsport +shift +set _HTTPSPORT="-Dhttps_port=%1" +shift +goto setupArgs + +:servername +shift +set _SERVERNAME="-Dserver_name=%1" +shift +goto setupArgs + +rem is there is a -xdebug in the options +:xdebug +set _XDEBUG="wrapper.java.additional.7=-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000" +shift +goto setupArgs + +:noJavaHome +if "%_JAVACMD%" == "" set _JAVACMD=java.exe +echo JAVA_HOME environment variable is set incorrectly or Java runtime could not be located. +echo Please set the JAVA_HOME variable appropriately +goto end + + +:runAxis2 + +cd %AXIS2_HOME% +echo "Starting Sample Axis2 Server ..." +echo Using AXIS2_HOME: %AXIS2_HOME% +echo Using JAVA_HOME: %JAVA_HOME% + +rem Decide on the wrapper binary. +set _WRAPPER_BASE=wrapper +set _WRAPPER_DIR=%AXIS2_HOME%..\..\bin\native\ +set _WRAPPER_EXE=%_WRAPPER_DIR%%_WRAPPER_BASE%-windows-x86-32.exe +if exist "%_WRAPPER_EXE%" goto conf +set _WRAPPER_EXE=%_WRAPPER_DIR%%_WRAPPER_BASE%-windows-x86-64.exe +if exist "%_WRAPPER_EXE%" goto conf +set _WRAPPER_EXE=%_WRAPPER_DIR%%_WRAPPER_BASE%.exe +if exist "%_WRAPPER_EXE%" goto conf +echo Unable to locate a Wrapper executable using any of the following names: +echo %_WRAPPER_DIR%%_WRAPPER_BASE%-windows-x86-32.exe +echo %_WRAPPER_DIR%%_WRAPPER_BASE%-windows-x86-64.exe +echo %_WRAPPER_DIR%%_WRAPPER_BASE%.exe +pause +goto :eof + +rem +rem Find the wrapper.conf +rem +:conf +set _WRAPPER_CONF="%AXIS2_HOME%..\..\webapp\WEB-INF\classes\conf\sample-server-wrapper.conf" + +rem +rem Start the Wrapper +rem +:startup +"%_WRAPPER_EXE%" -c %_WRAPPER_CONF% wrapper.java.additional.1=%_HTTPPORT% wrapper.java.additional.2=%_HTTPSPORT% wrapper.java.additional.3=%_SERVERNAME% %_XDEBUG% + +if not errorlevel 1 goto :eof +pause + +:end +set _JAVACMD= +set AXIS2_CMD_LINE_ARGS= + +if "%OS%"=="Windows_NT" @endlocal +if "%OS%"=="WINNT" @endlocal + +:mainEnd + Added: trunk/esb/java/modules/samples/src/main/scripts/axis2server.sh URL: http://wso2.org/svn/browse/wso2/trunk/esb/java/modules/samples/src/main/scripts/axis2server.sh?pathrev=24762 ============================================================================== --- (empty file) +++ trunk/esb/java/modules/samples/src/main/scripts/axis2server.sh Mon Nov 24 18:09:03 2008 @@ -0,0 +1,167 @@ +#!/bin/sh + +# Copyright 2001,2004-2006 The Apache Software Foundation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# SimpleAxis2Server Script +# +# Environment Variable Prequisites +# +# AXIS2_HOME Home of Axis2 installation. If not set I will try +# to figure it out. +# +# JAVA_HOME Must point at your Java Development Kit installation. +# +# NOTE: Borrowed generously from Apache Tomcat startup scripts. +# ----------------------------------------------------------------------------- + +# if JAVA_HOME is not set we're not happy +if [ -z "$JAVA_HOME" ]; then + echo "You must set the JAVA_HOME variable before running Axis2 Script." + exit 1 +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false +os400=false +case "`uname`" in +CYGWIN*) cygwin=true;; +OS400*) os400=true;; +esac + +# resolve links - $0 may be a softlink +PRG="$0" + +while [ -h "$PRG" ]; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '.*/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`/"$link" + fi +done + +# Get standard environment variables +PRGDIR=`dirname "$PRG"` + +# Only set AXIS2_HOME if not already set +[ -z "$AXIS2_HOME" ] && AXIS2_HOME=`cd "$PRGDIR" ; pwd` + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$AXIS2_HOME" ] && AXIS2_HOME=`cygpath --unix "$AXIS2_HOME"` + [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For OS400 +if $os400; then + # Set job priority to standard for interactive (interactive - 6) by using + # the interactive priority - 6, the helper threads that respond to requests + # will be running at the same priority as interactive jobs. + COMMAND='chgjob job('$JOBNAME') runpty(6)' + system $COMMAND + + # Enable multi threading + export QIBM_MULTI_THREADED=Y +fi + +# update classpath +AXIS2_CLASSPATH="$AXIS2_HOME/../../webapp/WEB-INF/lib" +for f in "$AXIS2_HOME"/../../webapp/WEB-INF/lib/synapse-*.jar +do + AXIS2_CLASSPATH="$AXIS2_CLASSPATH":$f +done +for f in "$AXIS2_HOME"/../../webapp/WEB-INF/lib/*.jar +do + AXIS2_CLASSPATH="$AXIS2_CLASSPATH":$f +done +AXIS2_CLASSPATH="$JAVA_HOME/lib/tools.jar":"$AXIS2_CLASSPATH":"$CLASSPATH" + +# use proper bouncy castle version for the JDK +jdk_15=`$JAVA_HOME/bin/java -version 2>&1 | grep 1.5` +jdk_14=`$JAVA_HOME/bin/java -version 2>&1 | grep 1.4` + +if [ "$jdk_15" ]; then + echo " Using Bouncy castle JAR for Java 1.5" + for f in $AXIS2_HOME/../../webapp/WEB-INF/lib/bcprov-jdk15*.jar + do + AXIS2_CLASSPATH=$f:$AXIS2_CLASSPATH + done +elif [ "$jdk_14" ]; then + echo " Using Bouncy castle JAR for Java 1.4" + for f in $AXIS2_HOME/../../webapp/WEB-INF/lib/bcprov-jdk13*.jar + do + AXIS2_CLASSPATH=$f:$AXIS2_CLASSPATH + done +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + JAVA_HOME=`cygpath --absolute --windows "$JAVA_HOME"` + AXIS2_HOME=`cygpath --absolute --windows "$AXIS2_HOME"` + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"` +fi + +# endorsed dir +AXIS2_ENDORSED=$AXIS2_HOME/../../lib/endorsed + +echo " Using JAVA_HOME: $JAVA_HOME" +echo " Using AXIS2 Repository : $AXIS2_HOME/repository" +echo " Using AXIS2 Configuration : $AXIS2_HOME/repository/conf/axis2.xml" + +HTTP_PORT_SET="FALSE" +HTTPS_PORT_SET="FALSE" + +PROGRAM_PARAMS="" +while [ "$1" != "" ]; do + + if [ "$1" = "-xdebug" ]; then + PROGRAM_PARAMS="$PROGRAM_PARAMS""-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=8000 " + shift + + elif [ "$1" = "-name" ]; then + PROGRAM_PARAMS="$PROGRAM_PARAMS""-Dserver_name=$2 " + shift + shift + + elif [ "$1" = "-http" ]; then + PROGRAM_PARAMS="$PROGRAM_PARAMS""-Dhttp_port=$2 " + HTTP_PORT_SET="TRUE" + shift + shift + + elif [ "$1" = "-https" ]; then + PROGRAM_PARAMS="$PROGRAM_PARAMS""-Dhttps_port=$2 " + HTTPS_PORT_SET="TRUE" + shift + shift + + fi + +done + +if [ "$HTTP_PORT_SET" = "FALSE" ]; then + PROGRAM_PARAMS="$PROGRAM_PARAMS""-Dhttp_port=9000 " +fi + +if [ "$HTTPS_PORT_SET" = "FALSE" ]; then + PROGRAM_PARAMS="$PROGRAM_PARAMS""-Dhttps_port=9002 " +fi + +java $PROGRAM_PARAMS -Djava.io.tmpdir=$AXIS2_HOME/../../work/temp/sampleServer -Djava.endorsed.dirs=$AXIS2_ENDORSED -classpath $AXIS2_CLASSPATH samples.util.SampleAxis2Server \ +-repo $AXIS2_HOME/repository -conf $AXIS2_HOME/repository/conf/axis2.xml \ No newline at end of file Added: trunk/esb/java/modules/samples/src/main/scripts/build.xml URL: http://wso2.org/svn/browse/wso2/trunk/esb/java/modules/samples/src/main/scripts/build.xml?pathrev=24762 ============================================================================== --- (empty file) +++ trunk/esb/java/modules/samples/src/main/scripts/build.xml Mon Nov 24 18:09:03 2008 @@ -0,0 +1,225 @@ +<!-- + ~ Copyright (c) 2005-2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + ~ + ~ WSO2 Inc. licenses this file to you under the Apache License, + ~ Version 2.0 (the "License"); you may not use this file except + ~ in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + ~ + --> + +<project name="samples" default="help" basedir="."> + <target name="help"> + <echo> + ant stockquote + Creates and sends a stock quote request. Could execute in 'smart client', 'proxy' and + 'gateway' modes by specifying WSA, transport and HTTP proxy endpoints/URLs. Optionally + a policy (security) could be applied to the requests. The required stock symbol and + operation could be specified as follows: + + examples: + ant stockquote + + ant stockquote [-Dsymbol=IBM|MSFT|SUN|..] + [-Dmode=quote | customquote | fullquote | placeorder | marketactivity] + [-Daddurl=http://localhost:9000/soap/SimpleStockQuoteService] + [-Dtrpurl=http://localhost:8280] + [-Dprxurl=http://localhost:8280] + [-Drest=true] + [-Dwsrm=true] + [-Dpolicy=../../repository/conf/sample/resources/policy/policy_1.xml] + + Mode : + quote - send a quote request for a single stock + customquote - send a quote request in a custom format + fullquote - get quote reports for a period (i.e. 365 days of the year) + placeorder - place an order for stocks using a one way request + marketactivity - get a market activity report (i.e. quotes for multiple symbols) + + ant jmsclient + A client which could post a raw JMS text or binary message to a given destination. + + examples: + ant jmsclient [-Djms_type=text] [-Djms_dest=dynamicQueues/JMSTextProxy][-Djms_payload="24.34 100 IBM"] + ant jmsclient [-Djms_type=pox] [-Djms_dest=dynamicQueues/JMSPoxProxy] [-Djms_payload=MSFT] + ant jmsclient [-Djms_type=binary] [-Djms_dest=dynamicQueues/JMSFileUploadProxy] + [-Djms_payload=./../../repository/conf/sample/resources/mtom/asf-logo.gif] + + ant optimizeclient + A client that could send binary content using MTOM and SwA optimizations + + examples: + ant optimizeclient [-Dopt_mode=mtom | swa] + [-Dopt_url=http://localhost:8280/soap/MTOMSwASampleService] + [-Dopt_file=./../../repository/conf/sample/resources/mtom/asf-logo.gif] + + ant fixclient + A client which could post a FIX message (of type Order-Single) embedded into a SOAP message. + + example: + ant fixclient -Dsymbol=IBM -Dqty=5 -Dmode=buy -Daddurl=http://localhost:8280/soap/FIXProxy + </echo> + </target> + + <property name="symbol" value=""/> + <property name="mode" value=""/> + <property name="i" value=""/> + <property name="port" value=""/> + <property name="addurl" value=""/> + <property name="trpurl" value=""/> + <property name="prxurl" value=""/> + <property name="repository" value=""/> + <property name="policy" value=""/> + <property name="rest" value=""/> + <property name="wsrm" value=""/> + <property name="itr" value=""/> + <property name="jms_dest" value=""/> + <property name="jms_type" value=""/> + <property name="jms_payload" value=""/> + <property name="opt_mode" value=""/> + <property name="opt_url" value=""/> + <property name="opt_file" value=""/> + <property name="class.dir" value="target/classes"/> + <property name="qty" value=""/> + + <target name="clean"> + <delete dir="target" quiet="true"/> + <delete dir="${class.dir}" quiet="true"/> + </target> + + <target name="stockquote" depends="compile"> + <java classname="samples.userguide.StockQuoteClient" + classpathref="javac.classpath" fork="true"> + <sysproperty key="symbol" value="${symbol}"/> + <sysproperty key="mode" value="${mode}"/> + <sysproperty key="addurl" value="${addurl}"/> + <sysproperty key="trpurl" value="${trpurl}"/> + <sysproperty key="prxurl" value="${prxurl}"/> + <sysproperty key="repository" value="${repository}"/> + <sysproperty key="policy" value="${policy}"/> + <sysproperty key="rest" value="${rest}"/> + <sysproperty key="wsrm" value="${wsrm}"/> + <sysproperty key="itr" value="${itr}"/> + <sysproperty key="javax.net.ssl.trustStore" value="./../../webapp/WEB-INF/classes/conf/trust.jks"/> + <sysproperty key="javax.net.ssl.trustStorePassword" value="password"/> + <sysproperty key="java.io.tmpdir" value="./../../work/temp/sampleClient"/> + <!-- + <jvmarg value="-Xdebug"/> + <jvmarg value="-Xnoagent"/> + <jvmarg value="-Djava.compiler=none"/> + <jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000"/> + --> + </java> + </target> + + <!-- a simple smoke test --> + <target name="smoke" depends="compile"> + <property name="addurl" value="http://localhost:9000/soap/SimpleStockQuoteService"/> + <property name="trpurl" value="http://localhost:8280/"/> + <java classname="samples.userguide.StockQuoteClient" + classpathref="javac.classpath" fork="true"> + <sysproperty key="addurl" value="http://localhost:9000/soap/SimpleStockQuoteService"/> + <sysproperty key="trpurl" value="http://localhost:8280/"/> + <sysproperty key="java.io.tmpdir" value="./../../work/temp/sampleClient"/> + </java> + </target> + + <target name="jmsclient" depends="compile"> + <java classname="samples.userguide.GenericJMSClient" + classpathref="javac.classpath" fork="true"> + <sysproperty key="jms_dest" value="${jms_dest}"/> + <sysproperty key="jms_type" value="${jms_type}"/> + <sysproperty key="jms_payload" value="${jms_payload}"/> + <sysproperty key="java.io.tmpdir" value="./../../work/temp/sampleClient"/> + </java> + </target> + + <target name="fixclient" depends="compile"> + <java classname="samples.userguide.FIXClient" + classpathref="javac.classpath" fork="true"> + + <sysproperty key="symbol" value="${symbol}"/> + <sysproperty key="mode" value="${mode}"/> + <sysproperty key="addurl" value="${addurl}"/> + <sysproperty key="trpurl" value="${trpurl}"/> + <sysproperty key="prxurl" value="${prxurl}"/> + <sysproperty key="qty" value="${qty}"/> + <sysproperty key="repository" value="${repository}"/> + <sysproperty key="java.io.tmpdir" value="./../../work/temp/sampleClient"/> + + </java> + </target> + + <target name="optimizeclient" depends="compile"> + <java classname="samples.userguide.MTOMSwAClient" + classpathref="javac.classpath" fork="true"> + <sysproperty key="opt_mode" value="${opt_mode}"/> + <sysproperty key="opt_url" value="${opt_url}"/> + <sysproperty key="opt_file" value="${opt_file}"/> + <sysproperty key="javax.net.ssl.trustStore" value="./../../webapp/WEB-INF/lib/trust.jks"/> + <sysproperty key="javax.net.ssl.trustStorePassword" value="password"/> + <sysproperty key="java.io.tmpdir" value="./../../work/temp/sampleClient"/> + <!-- + <jvmarg value="-Xdebug"/> + <jvmarg value="-Xnoagent"/> + <jvmarg value="-Djava.compiler=none"/> + <jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000"/> + --> + </java> + </target> + + <target name="loadbalancefailover" depends="compile"> + <java classname="samples.userguide.LoadbalanceFailoverClient" + classpathref="javac.classpath" fork="true"> + <sysproperty key="mode" value="${mode}"/> + <sysproperty key="port" value="${port}"/> + <sysproperty key="i" value="${i}"/> + <sysproperty key="addurl" value="${addurl}"/> + <sysproperty key="trpurl" value="${trpurl}"/> + <sysproperty key="prxurl" value="${prxurl}"/> + <sysproperty key="java.io.tmpdir" value="./../../work/temp/sampleClient"/> + </java> + </target> + + <target name="threadedclient" depends="compile"> + <java classname="samples.userguide.ThreadedClient" + classpathref="javac.classpath" fork="true"> + <sysproperty key="epr" value="${epr}"/> + <sysproperty key="op" value="${op}"/> + <sysproperty key="req" value="${req}"/> + <sysproperty key="load" value="${load}"/> + <sysproperty key="msg" value="${msg}"/> + <sysproperty key="t" value="${t}"/> + <sysproperty key="session" value="${session}"/> + <sysproperty key="java.io.tmpdir" value="./../../work/temp/sampleClient"/> + </java> + </target> + + <target name="init"> + <mkdir dir="${class.dir}"/> + <mkdir dir="./../../work/temp/sampleClient"/> + <path id="javac.classpath"> + <pathelement path="${class.dir}"/> + <pathelement path="../../webapp/WEB-INF/lib"/> + <fileset dir="../../webapp/WEB-INF/lib"> + <include name="**/*.jar"/> + </fileset> + </path> + </target> + + <target name="compile" depends="init" description="Compile all Java"> + <javac srcdir="src" destdir="${class.dir}"> + <classpath refid="javac.classpath"/> + </javac> + </target> + +</project> \ No newline at end of file _______________________________________________ Esb-java-dev mailing list [email protected] https://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev
