Author: saminda
Date: Thu Jan  3 07:00:24 2008
New Revision: 11817

Log:

1. Added support for JIBX
2. Added sample for jibx. but this test is not complete yet due to problems 
encounted from JIbx. Thus, I've notified 
axis2-dev list asking the stability of the Jibx. 


Added:
   trunk/wsas/java/modules/samples/Jibx/
   trunk/wsas/java/modules/samples/Jibx/build.xml
   trunk/wsas/java/modules/samples/Jibx/conf/
   trunk/wsas/java/modules/samples/Jibx/conf/codegen.xml
   trunk/wsas/java/modules/samples/Jibx/conf/jibx_unwrapped.xml
   trunk/wsas/java/modules/samples/Jibx/conf/services.xml
   trunk/wsas/java/modules/samples/Jibx/pom.xml
   trunk/wsas/java/modules/samples/Jibx/run-client.sh
   trunk/wsas/java/modules/samples/Jibx/src/
   trunk/wsas/java/modules/samples/Jibx/src/org/
   trunk/wsas/java/modules/samples/Jibx/src/org/wso2/
   trunk/wsas/java/modules/samples/Jibx/src/org/wso2/wsas/
   trunk/wsas/java/modules/samples/Jibx/src/org/wso2/wsas/jibx/
   trunk/wsas/java/modules/samples/Jibx/src/org/wso2/wsas/jibx/Client.java
   trunk/wsas/java/modules/samples/Jibx/src/org/wso2/wsas/jibx/library/
   trunk/wsas/java/modules/samples/Jibx/src/org/wso2/wsas/jibx/library/beans/
   
trunk/wsas/java/modules/samples/Jibx/src/org/wso2/wsas/jibx/library/beans/Book.java
   trunk/wsas/java/modules/samples/Jibx/src/org/wso2/wsas/jibx/services/
   
trunk/wsas/java/modules/samples/Jibx/src/org/wso2/wsas/jibx/services/LibraryService.java
   trunk/wsas/java/modules/samples/Jibx/wsdl/
   trunk/wsas/java/modules/samples/Jibx/wsdl/jibx_wsdl.wsdl
Modified:
   trunk/wsas/java/modules/samples/pom.xml
   trunk/wsas/java/pom.xml

Added: trunk/wsas/java/modules/samples/Jibx/build.xml
==============================================================================
--- (empty file)
+++ trunk/wsas/java/modules/samples/Jibx/build.xml      Thu Jan  3 07:00:24 2008
@@ -0,0 +1,101 @@
+<!--
+  ~ Copyright 2005-2007 WSO2, Inc. (http://wso2.com)
+  ~
+  ~ 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.
+  -->
+
+<project default="build-all">
+
+    <property name="wso2wsas.home" value="../../"/>
+    <property name="lib" value="${wso2wsas.home}/lib"/>
+    <property name="repo.location" value="${wso2wsas.home}/repository"/>
+    <property name="temp.dir" value="temp"/>
+    <property name="classes" value="${temp.dir}/classes"/>
+    <property name="src" value="src"/>
+    <property name="gen.src" value="target/generated/src"/>
+    <property name="services" value="services"/>
+
+    <path id="axis2.class.path">
+        <pathelement path="${java.class.path}"/>
+        <fileset dir="${wso2wsas.home}">
+            <include name="lib/*.jar"/>
+        </fileset>
+    </path>
+
+    <target name="init" depends="clean">
+
+        <mkdir dir="${temp.dir}"/>
+        <mkdir dir="${classes}"/>
+        <mkdir dir="${services}"/>
+        <mkdir dir="${gen.src}"/>
+    </target>
+
+    <target name="clean">
+        <delete dir="${temp.dir}"/>
+        <delete dir="${gen.src}"/>
+    </target>
+
+    <target name="generate-source" depends="init">
+        <java classname="org.wso2.utils.codegen.CodegenHelper" fork="true">
+            <arg value="./conf/codegen.xml"/>
+            <classpath refid="axis2.class.path"/>
+        </java>
+    </target>
+
+    <target name="compile-all" depends="generate-source">
+        <javac debug="on" destdir="${classes}">
+            <src path="${src}"/>
+            <src path="${gen.src}"/>
+            <classpath refid="axis2.class.path"/>
+        </javac>
+    </target>
+
+    <target name="build-service" depends="compile-all">
+        <property name="Jibx.dir" value="${temp.dir}/Jibx"/>
+        <mkdir dir="${Jibx.dir}"/>
+
+        <mkdir dir="${Jibx.dir}/META-INF"/>
+        <copy file="conf/services.xml" 
tofile="${Jibx.dir}/META-INF/services.xml"/>
+        <copy file="wsdl/jibx_wsdl.wsdl" 
tofile="${Jibx.dir}/META-INF/service.wsdl"/>
+        <copy toDir="${Jibx.dir}">
+            <fileset dir="${classes}">
+                <include name="**/jibx/**/*.class"/>
+            </fileset>
+        </copy>
+
+        <jar destfile="${services}/LibraryService.aar">
+            <fileset dir="${Jibx.dir}"/>
+        </jar>
+    </target>
+
+
+    <target name="build-all" depends="build-service">
+        <echo message="Copying the created aar files in to the repository"/>
+        <copy toDir="${repo.location}/services">
+            <fileset dir="${services}">
+                <include name="**/*.aar"/>
+            </fileset>
+        </copy>
+
+        <!-- Create a local repository containing only the necessary modules 
-->
+        <mkdir dir="repository/modules"/>
+        <copy todir="repository/modules">
+            <fileset dir="${repo.location}/modules">
+                <include name="addressing*.mar"/>
+                <include name="*sandesha2*.mar"/>
+                <include name="rampart*.mar"/>
+                <include name="rahas*.mar"/>
+            </fileset>
+        </copy>
+    </target>
+</project>
\ No newline at end of file

Added: trunk/wsas/java/modules/samples/Jibx/conf/codegen.xml
==============================================================================
--- (empty file)
+++ trunk/wsas/java/modules/samples/Jibx/conf/codegen.xml       Thu Jan  3 
07:00:24 2008
@@ -0,0 +1,45 @@
+<!--
+  ~ Copyright 2005-2007 WSO2, Inc. (http://wso2.com)
+  ~
+  ~ 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.
+  -->
+
+<config>
+    <!-- CommodityQuote Sample-->
+    <set>
+        <uri>./wsdl/jibx_wsdl.wsdl</uri>
+        <o>./target/generated</o>
+        <p>org.wso2.wsas.jibx.client</p>
+        <d>jibx</d>
+        <u/>
+        <uw/>
+        
<ns2p>http://jibx.wsas.wso2.org/library/types=org.wso2.wsas.jibx.library.types.client</ns2p>
+        <Emp>org.wso2.wsas.jibx.mapper.client</Emp>
+        <Ebindingfile>./conf/jibx_unwrapped.xml</Ebindingfile>
+    </set>
+
+    <set>
+        <uri>wsdl/jibx_wsdl.wsdl</uri>
+        <o>./target/generated</o>
+        <p>org.wso2.wsas.jibx.services</p>
+        <d>jibx</d>
+        <ss/>
+        <ssi/>
+        <u/>
+        <uw/>
+        <sd/>
+        
<ns2p>http://jibx.wsas.wso2.org/library/types=org.wso2.wsas.jibx.library.types.services</ns2p>
+        <Emp>org.wso2.wsas.jibx.mapper.services</Emp>
+        <Ebindingfile>./conf/jibx_unwrapped.xml</Ebindingfile>
+    </set>
+</config>
\ No newline at end of file

Added: trunk/wsas/java/modules/samples/Jibx/conf/jibx_unwrapped.xml
==============================================================================
--- (empty file)
+++ trunk/wsas/java/modules/samples/Jibx/conf/jibx_unwrapped.xml        Thu Jan 
 3 07:00:24 2008
@@ -0,0 +1,15 @@
+<binding force-classes="true" 
xmlns:tns="http://jibx.wsas.wso2.org/library/types";>
+
+    <namespace uri="http://jibx.wsas.wso2.org/library/types"; 
default="elements"/>
+
+    <mapping abstract="true" class="org.wso2.wsas.jibx.library.beans.Book"
+             type-name="tns:BookInformation">
+        <value name="type" style="attribute" field="m_type"/>
+        <value name="isbn" style="attribute" field="m_isbn"/>
+        <collection field="m_authors">
+            <value name="author"/>
+        </collection>
+        <value name="title" field="m_title"/>
+    </mapping>
+
+</binding>
\ No newline at end of file

Added: trunk/wsas/java/modules/samples/Jibx/conf/services.xml
==============================================================================
--- (empty file)
+++ trunk/wsas/java/modules/samples/Jibx/conf/services.xml      Thu Jan  3 
07:00:24 2008
@@ -0,0 +1,11 @@
+<serviceGroup>
+    <service name="LibraryService">
+        <parameter name="useOriginalwsdl">true</parameter>
+        <messageReceivers>
+            <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out";
+                             
class="org.wso2.wsas.jibx.services.LibraryServiceMessageReceiverInOut"/>
+        </messageReceivers>
+        <parameter locked="false" 
name="ServiceClass">org.wso2.wsas.jibx.services.LibraryService</parameter>
+        <!--All public methods of the service class are exposed by default-->
+    </service>
+</serviceGroup>
\ No newline at end of file

Added: trunk/wsas/java/modules/samples/Jibx/pom.xml
==============================================================================
--- (empty file)
+++ trunk/wsas/java/modules/samples/Jibx/pom.xml        Thu Jan  3 07:00:24 2008
@@ -0,0 +1,230 @@
+<!--
+  ~ Copyright 2005-2007 WSO2, Inc. (http://wso2.com)
+  ~
+  ~ 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+
+    <parent>
+        <groupId>org.wso2.wsas</groupId>
+        <artifactId>wso2wsas-samples</artifactId>
+        <version>SNAPSHOT</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>wso2wsas-samples-jibx</artifactId>
+    <packaging>jar</packaging>
+    <name>Sample/JIBX</name>
+    <description>This is the JIBX sample</description>
+
+    <build>
+        <sourceDirectory>src</sourceDirectory>
+        <testSourceDirectory>test</testSourceDirectory>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.5</source>
+                    <target>1.5</target>
+                </configuration>
+            </plugin>
+
+            <plugin>
+                <inherited>false</inherited>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>generate-code</id>
+                        <phase>generate-sources</phase>
+                        <configuration>
+                            <tasks>
+                                <!--<property name="keys.dir" 
value="${basedir}/target/keys"/>-->
+                                <!--<delete dir="${keys.dir}"/>-->
+                                <java 
classname="org.wso2.utils.codegen.CodegenHelper"
+                                      fork="true">
+                                    <arg value="./conf/codegen.xml"/>
+                                    <classpath 
refid="maven.dependency.classpath"/>
+                                    <classpath 
refid="maven.compile.classpath"/>
+                                    <classpath 
refid="maven.runtime.classpath"/>
+                                </java>
+                                <!-- Generate keys for the samples -->
+                                <!--<mkdir dir="${keys.dir}"/>
+                                <genkey alias="client" storepass="testing" 
keyalg="RSA"
+                                        keystore="${keys.dir}/client.jks"
+                                        validity="99999">
+                                    <dname>
+                                        <param name="CN" value="WSO2WSAS"/>
+                                        <param name="OU" value="SAMPLE"/>
+                                        <param name="O" value="WSO2"/>
+                                        <param name="C" value="LK"/>
+                                    </dname>
+                                </genkey>
+                                <genkey alias="service" storepass="testing" 
keyalg="RSA"
+                                        keystore="${keys.dir}/service.jks"
+                                        validity="99999">
+                                    <dname>
+                                        <param name="CN" value="WSO2WSAS"/>
+                                        <param name="OU" value="SAMPLE"/>
+                                        <param name="O" value="WSO2"/>
+                                        <param name="C" value="LK"/>
+                                    </dname>
+                                </genkey>
+                                <echo message="############## Importing 
Certificates ###################"/>
+                                <java 
classname="org.wso2.utils.security.KeyImporter">
+                                    <arg value="${keys.dir}/service.jks"/>
+                                    <arg value="testing"/>
+                                    <arg value="service"/>
+                                    <arg value="${keys.dir}/client.jks"/>
+                                    <arg value="testing"/>
+                                    <classpath 
refid="maven.dependency.classpath"/>
+                                    <classpath 
refid="maven.compile.classpath"/>
+                                    <classpath 
refid="maven.runtime.classpath"/>
+                                </java>
+                                <java 
classname="org.wso2.utils.security.KeyImporter">
+                                    <arg value="${keys.dir}/client.jks"/>
+                                    <arg value="testing"/>
+                                    <arg value="client"/>
+                                    <arg value="${keys.dir}/service.jks"/>
+                                    <arg value="testing"/>
+                                    <classpath 
refid="maven.dependency.classpath"/>
+                                    <classpath 
refid="maven.compile.classpath"/>
+                                    <classpath 
refid="maven.runtime.classpath"/>
+                                </java>-->
+                            </tasks>
+                        </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <version>1.0</version>
+                <executions>
+                    <execution>
+                        <id>copy-code</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                
<source>${basedir}/target/generated/src</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <configuration>
+                    <enableRulesSummary>false</enableRulesSummary>
+                </configuration>
+            </plugin>
+            <!--<plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-clover-plugin</artifactId>
+                <configuration>
+                    <licenseLocation>${clover.license.file}</licenseLocation>
+                    <targetPercentage>60%</targetPercentage>
+                    <generateHtml>true</generateHtml>
+                    <generatePdf>false</generatePdf>
+                    <generateXml>false</generateXml>
+                    <excludes>
+                        <exclude>**/*TestSuite.java</exclude>
+                        <exclude>**/*Test.java</exclude>
+                    </excludes>
+                </configuration>
+                <executions>
+                    <execution>
+                        <phase>verify</phase>
+                        <goals>
+                            <goal>aggregate</goal>
+                            <goal>instrument</goal>
+                            <goal>clover</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>-->
+        </plugins>
+    </build>
+
+    <reporting>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-report-plugin</artifactId>
+                <configuration>
+                    
<outputDirectory>../../../target/site/wso2wsas-samples/${artifactId}
+                    </outputDirectory>
+                    
<reportsDirectory>target/surefire-reports</reportsDirectory>
+                    <outputName>${artifactId}-test-report</outputName>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jxr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-site-plugin</artifactId>
+                <configuration>
+                    
<outputDirectory>../../../target/site/wso2wsas-samples/${artifactId}
+                    </outputDirectory>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>findbugs-maven-plugin</artifactId>
+                <version>1.1.1</version>
+                <configuration>
+                    <!--<xmlOutput>true|false</xmlOutput>
+                    <xmlOutputDirectory>
+                    directory location of xml findbugs report
+                    </xmlOutputDirectory>
+                    <threshold>Normal</threshold>
+                    <effort>Default</effort>
+                    <excludeFilterFile>findbugs-exclude.xml</excludeFilterFile>
+                    <includeFilterFile>findbugs-include.xml</includeFilterFile>
+                    <visitors>FindDeadLocalStores,UnreadFields</visitors>
+                    
<omitVisitors>FindDeadLocalStores,UnreadFields</omitVisitors>
+                    <onlyAnalyze>org.codehaus.mojo.findbugs.*</onlyAnalyze>
+                    
<pluginList>/libs/fb-contrib/fb-contrib-2.8.0.jar</pluginList>
+                    <debug>true|false</debug>
+                    <relaxed>true|false</relaxed>-->
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+            </plugin>
+            <!--<plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-clover-plugin</artifactId>
+            </plugin>-->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-pmd-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </reporting>
+</project>

Added: trunk/wsas/java/modules/samples/Jibx/run-client.sh
==============================================================================
--- (empty file)
+++ trunk/wsas/java/modules/samples/Jibx/run-client.sh  Thu Jan  3 07:00:24 2008
@@ -0,0 +1,90 @@
+#!/bin/sh
+# -----------------------------------------------------------------------------
+#
+# Environment Variable Prequisites
+#
+#   WSO2WSAS_HOME   Home of WSO2 WSAS 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 WSO2 WSAS."
+  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 WSO2WSAS_HOME if not already set
+[ -z "$WSO2WSAS_HOME" ] && WSO2WSAS_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 "$WSO2WSAS_HOME" ] && WSO2WSAS_HOME=`cygpath --unix "$WSO2WSAS_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
+  QIBM_MULTI_THREADED=Y
+  export QIBM_MULTI_THREADED
+fi
+
+# update classpath
+CLIENT_CLASSPATH=""
+for f in "$WSO2WSAS_HOME"/lib/*.jar
+do
+  CLIENT_CLASSPATH=$CLIENT_CLASSPATH:$f
+done
+CLIENT_CLASSPATH=$CLIENT_CLASSPATH:$CLASSPATH
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+  JAVA_HOME=`cygpath --absolute --windows "$JAVA_HOME"`
+  WSO2WSAS_HOME=`cygpath --absolute --windows "$WSO2WSAS_HOME"`
+  CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+  JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"`
+fi
+
+echo Using WSO2WSAS_HOME: $WSO2WSAS_HOME
+echo Using JAVA_HOME    : $JAVA_HOME
+
+CLIENT_CLASSPATH="$WSO2WSAS_HOME/samples/Jibx/temp/classes":\
+"$WSO2WSAS_HOME/samples/Jibx/conf":$CLIENT_CLASSPATH
+
+$JAVA_HOME/bin/java -Dwso2wsas.home="$WSO2WSAS_HOME" -classpath 
"$CLIENT_CLASSPATH" \
+-Djava.endorsed.dirs="$WSO2WSAS_HOME/lib/endorsed":"$JAVA_HOME/jre/lib/endorsed":"$JAVA_HOME/lib/endorsed"
 \
+org.wso2.wsas.jibx.Client $*

Added: trunk/wsas/java/modules/samples/Jibx/src/org/wso2/wsas/jibx/Client.java
==============================================================================
--- (empty file)
+++ trunk/wsas/java/modules/samples/Jibx/src/org/wso2/wsas/jibx/Client.java     
Thu Jan  3 07:00:24 2008
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2004,2005 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.
+ */
+package org.wso2.wsas.jibx;
+
+import org.apache.axis2.AxisFault;
+import org.wso2.utils.NetworkUtils;
+import org.wso2.wsas.jibx.client.LibraryServiceStub;
+import org.wso2.wsas.jibx.library.beans.Book;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.SocketException;
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Client for Jibx unwrapped sample
+ */
+public class Client {
+
+    BufferedReader console = new BufferedReader(new 
InputStreamReader(System.in));
+
+    public static void main(String[] args) {
+        try {
+            LibraryServiceStub stub = new LibraryServiceStub(
+                    "http://"; + NetworkUtils.getLocalHostname() + 
":9762/services/LibraryService");
+            Client client = new Client();
+            client.execute(args, stub);
+        } catch (AxisFault axisFault) {
+            axisFault.printStackTrace();
+        } catch (SocketException e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    private void addBook(LibraryServiceStub stub, String type, String isbn, 
String[] author,
+                         String title)
+            throws RemoteException {
+        boolean b = stub.addBook(type, isbn, author, title);
+        if (b) {
+            System.out.println("Book added successfully with isbn : " + isbn);
+        } else {
+            System.out.println("Book cannot be added as it already exist in 
the library : " + isbn);
+        }
+    }
+
+    private void getBook(LibraryServiceStub stub, String isbn) throws 
RemoteException {
+        Book book = stub.getBook(isbn);
+        System.out.println("======= Report ===========");
+        System.out.println("Type : " + book.getType());
+        System.out.println("ISBN : " + book.getIsbn());
+        System.out.println("Title : " + book.getTitle());
+        System.out.println("Authors : ");
+        for (int i = 0; i < book.getAuthors().length; i++) {
+            System.out.println("Author : " + book.getAuthors()[i]);
+        }
+    }
+
+    private void execute(String[] args, LibraryServiceStub stub) {
+        System.out.println("=== Welcome to WSO2 JIBX Library ====");
+        while (true) {
+            System.out.println("1. Add Book");
+            System.out.println("2. Get Book");
+            System.out.println("3. Exit");
+            int opt = readIntOption();
+            switch (opt) {
+                case 1:
+                    System.out.println("Type : ");
+                    String type = readOption();
+                    System.out.println("ISBN : ");
+                    String isbn = readOption();
+                    System.out.println("Title : ");
+                    String title = readOption();
+                    System.out.println("Authors: ");
+                    String authors = readOption();
+                    String[] strings = authors.split(":");
+                    List<String> authorList = new ArrayList<String>();
+                    for (int k = 0; k < strings.length; k++) {
+                        authorList.add(strings[k]);
+                    }
+                    strings = authorList.toArray(new 
String[authorList.size()]);
+                    try {
+                        addBook(stub, type, isbn, strings, title);
+                    } catch (RemoteException e) {
+                        e.printStackTrace();
+                        System.exit(1);
+                    }
+                    break;
+                case 2:
+                    isbn = readOption();
+                    try {
+                        getBook(stub, isbn);
+                    } catch (RemoteException e) {
+                        e.printStackTrace();
+                        System.exit(1);
+                    }
+                    break;
+                case 3:
+                    System.exit(0);
+                    break;
+            }
+
+
+        }
+    }
+
+
+    private int readIntOption() {
+        int option;
+
+        while (true) {
+            String s = readOption();
+
+            try {
+                option = Integer.parseInt(s);
+
+                return option;
+            } catch (NumberFormatException e) {
+                System.out.println("Please enter an integer value.");
+            }
+        }
+    }
+
+    private String readOption() {
+        try {
+            String str;
+            while ((str = console.readLine()).equals("")) {
+            }
+            return str;
+        } catch (Exception e) {
+            return null;
+        }
+    }
+}

Added: 
trunk/wsas/java/modules/samples/Jibx/src/org/wso2/wsas/jibx/library/beans/Book.java
==============================================================================
--- (empty file)
+++ 
trunk/wsas/java/modules/samples/Jibx/src/org/wso2/wsas/jibx/library/beans/Book.java
 Thu Jan  3 07:00:24 2008
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2004,2005 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.
+ */
+package org.wso2.wsas.jibx.library.beans;
+
+/**
+ * Jbix related heler class
+ */
+public class Book {
+    private String m_type;
+    private String m_isbn;
+    private String m_title;
+    private String[] m_authors;
+
+    public Book(String m_type, String m_isbn, String m_title, String[] 
m_authors) {
+        if (m_isbn == null || m_isbn.length() == 0) {
+            throw new RuntimeException("books isbn cannot be empty or null");
+        }
+        this.m_type = m_type;
+        this.m_isbn = m_isbn;
+        this.m_title = m_title;
+        this.m_authors = m_authors;
+    }
+
+    public Book() {
+    }
+
+    public String getType() {
+        return m_type;
+    }
+
+    public String getIsbn() {
+        return m_isbn;
+    }
+
+    public String getTitle() {
+        return m_title;
+    }
+
+    public String[] getAuthors() {
+        return m_authors;
+    }
+}

Added: 
trunk/wsas/java/modules/samples/Jibx/src/org/wso2/wsas/jibx/services/LibraryService.java
==============================================================================
--- (empty file)
+++ 
trunk/wsas/java/modules/samples/Jibx/src/org/wso2/wsas/jibx/services/LibraryService.java
    Thu Jan  3 07:00:24 2008
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2004,2005 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.
+ */
+package org.wso2.wsas.jibx.services;
+
+import org.wso2.wsas.jibx.library.beans.Book;
+
+import java.util.Hashtable;
+
+/**
+ * Jibx service implementation
+ */
+public class LibraryService implements LibraryServiceSkeletonInterface {
+
+    /**
+     * library will act as an simple real life library. This will hold Book 
objects. key will be the
+     * isbn
+     */
+    private static Hashtable<String, Book> library = new Hashtable<String, 
Book>();
+
+
+    public Book getBook(String isbn) {
+        Book book = library.get(isbn);
+        if (book == null) {
+            book = new Book("Empty_Type", "Empty_ISBN", "Empty_Title",
+                            new String[]{"Empty_Authors"});
+        }
+        return book;
+    }
+
+
+    public boolean addBook(String type, String isbn, String[] authors, String 
title) {
+        if (library.containsKey(isbn)) {
+            return false;
+        }
+        library.put(isbn, new Book(type, isbn, title, authors));
+        return true;
+    }
+}

Added: trunk/wsas/java/modules/samples/Jibx/wsdl/jibx_wsdl.wsdl
==============================================================================
--- (empty file)
+++ trunk/wsas/java/modules/samples/Jibx/wsdl/jibx_wsdl.wsdl    Thu Jan  3 
07:00:24 2008
@@ -0,0 +1,124 @@
+<wsdl:definitions targetNamespace="http://jibx.wsas.wso2.org/library/";
+                  xmlns:wns="http://jibx.wsas.wso2.org/library/";
+                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
+                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
+                  xmlns:http="http://schemas.xmlsoap.org/wsdl/http/";
+                  xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/";
+                  xmlns:tns="http://jibx.wsas.wso2.org/library/types";>
+
+    <wsdl:types>
+
+        <schema elementFormDefault="qualified"
+                targetNamespace="http://jibx.wsas.wso2.org/library/types";
+                xmlns="http://www.w3.org/2001/XMLSchema";
+                xmlns:tns="http://jibx.wsas.wso2.org/library/types";>
+
+            <element name="getBook">
+                <complexType>
+                    <sequence>
+                        <element name="isbn" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+
+            <element name="getBookResponse">
+                <complexType>
+                    <sequence>
+                        <element name="book" minOccurs="0" 
type="tns:BookInformation"/>
+                    </sequence>
+                </complexType>
+            </element>
+
+            <element name="addBook">
+                <complexType>
+                    <sequence>
+                        <element name="type" type="string"/>
+                        <element name="isbn" type="string"/>
+                        <element name="author" minOccurs="0" 
maxOccurs="unbounded" type="string"/>
+                        <element name="title" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+
+            <element name="addBookResponse">
+                <complexType>
+                    <sequence>
+                        <element name="success" type="boolean"/>
+                    </sequence>
+                </complexType>
+            </element>
+
+            <complexType name="BookInformation">
+                <sequence>
+                    <element name="author" minOccurs="0" maxOccurs="unbounded" 
type="string"/>
+                    <element name="title" type="string"/>
+                </sequence>
+                <attribute name="type" use="required" type="string"/>
+                <attribute name="isbn" use="required" type="string"/>
+            </complexType>
+
+        </schema>
+
+    </wsdl:types>
+
+    <wsdl:message name="getBookRequest">
+        <wsdl:part element="tns:getBook" name="parameters"/>
+    </wsdl:message>
+
+    <wsdl:message name="getBookResponse">
+        <wsdl:part element="tns:getBookResponse" name="parameters"/>
+    </wsdl:message>
+
+    <wsdl:message name="addBookRequest">
+        <wsdl:part element="tns:addBook" name="parameters"/>
+    </wsdl:message>
+
+    <wsdl:message name="addBookResponse">
+        <wsdl:part element="tns:addBookResponse" name="parameters"/>
+    </wsdl:message>
+
+    <wsdl:portType name="Library">
+
+        <wsdl:operation name="getBook">
+            <wsdl:input message="wns:getBookRequest" name="getBookRequest"/>
+            <wsdl:output message="wns:getBookResponse" name="getBookResponse"/>
+        </wsdl:operation>
+
+        <wsdl:operation name="addBook">
+            <wsdl:input message="wns:addBookRequest" name="addBookRequest"/>
+            <wsdl:output message="wns:addBookResponse" name="addBookResponse"/>
+        </wsdl:operation>
+
+    </wsdl:portType>
+
+    <wsdl:binding name="LibraryBinding" type="wns:Library">
+        <soap:binding transport="http://schemas.xmlsoap.org/soap/http"; 
style="document"/>
+
+        <wsdl:operation name="getBook">
+            <soap:operation soapAction="urn:getBook" style="document"/>
+            <wsdl:input>
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body use="literal"/>
+
+            </wsdl:output>
+        </wsdl:operation>
+        <wsdl:operation name="addBook">
+            <soap:operation soapAction="urn:addBook" style="document"/>
+            <wsdl:input>
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body use="literal"/>
+
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+
+    <wsdl:service name="LibraryService">
+        <wsdl:port name="LibraryPort" binding="wns:LibraryBinding">
+            <soap:address 
location="http://127.0.0.1:9762/services/LibraryService"/>
+        </wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file

Modified: trunk/wsas/java/modules/samples/pom.xml
==============================================================================
--- trunk/wsas/java/modules/samples/pom.xml     (original)
+++ trunk/wsas/java/modules/samples/pom.xml     Thu Jan  3 07:00:24 2008
@@ -80,5 +80,6 @@
         <module>sts-sample</module>
         <module>EJBService</module>
         <module>JAXWS</module>
+        <module>Jibx</module>
     </modules>
 </project>

Modified: trunk/wsas/java/pom.xml
==============================================================================
--- trunk/wsas/java/pom.xml     (original)
+++ trunk/wsas/java/pom.xml     Thu Jan  3 07:00:24 2008
@@ -398,6 +398,12 @@
             <id>ws-zones-repository</id>
             <url>http://ws.zones.apache.org/repository2</url>
         </repository>
+        <repository>
+            <id>jibx</id>
+            <name>Jibx Repository</name>
+            <url>http://jibx.sourceforge.net/maven</url>
+            <layout>legacy</layout>
+        </repository>
         <!-- Others are available from http://repo1.maven.org/maven2 -->
     </repositories>
 
@@ -1870,6 +1876,22 @@
         </dependency>
 
         <dependency>
+            <groupId>jibx</groupId>
+            <artifactId>jibx-bind</artifactId>
+            <version>${jibx.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>jibx</groupId>
+            <artifactId>jibx-run</artifactId>
+            <version>${jibx.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.bcel</groupId>
+            <artifactId>bcel</artifactId>
+            <version>${bcel.version}</version>
+        </dependency>
+
+        <dependency>
             <groupId>org.wso2.dataservice</groupId>
             <artifactId>wso2data-service</artifactId>
         </dependency>
@@ -2101,6 +2123,8 @@
         <wsdlconverter.version>SNAPSHOT</wsdlconverter.version>
         <archive.validator.version>SNAPSHOT</archive.validator.version>
         <mx4j.version>2.1.1</mx4j.version>
+        <jibx.version>1.1.5</jibx.version>
+        <bcel.version>5.2</bcel.version>
     </properties>
 
     <mailingLists>

_______________________________________________
Wsas-java-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/wsas-java-dev

Reply via email to