You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yoko-commits@incubator.apache.org by dm...@apache.org on 2007/03/05 19:48:27 UTC
svn commit: r514835 - in
/incubator/yoko/trunk/distribution/src/main/samples/ws: bank_ws_addressing/
bank_ws_addressing/src/ bank_ws_addressing/src/corba/
bank_ws_addressing/src/corba/client/ bank_ws_addressing/src/corba/server/
bank_ws_addressing/src/...
Author: dmiddlem
Date: Mon Mar 5 11:48:26 2007
New Revision: 514835
URL: http://svn.apache.org/viewvc?view=rev&rev=514835
Log:
Preliminary implementation of a demo to show object reference use between CORBA and
Yoko (YOKO-268)
Added:
incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/
incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/README.txt (with props)
incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/build.xml (with props)
incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/
incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/
incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/client/
incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/client/Client.java (with props)
incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/server/
incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/server/Account_impl.java (with props)
incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/server/Bank_impl.java (with props)
incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/server/Server.java (with props)
incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/
incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/client/
incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/client/Client.java (with props)
incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/server/
incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/server/AccountImpl.java (with props)
incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/server/BankImpl.java (with props)
incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/server/Server.java (with props)
incubator/yoko/trunk/distribution/src/main/samples/ws/resources/BankWS.wsdl (with props)
Added: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/README.txt
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/README.txt?view=auto&rev=514835
==============================================================================
--- incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/README.txt (added)
+++ incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/README.txt Mon Mar 5 11:48:26 2007
@@ -0,0 +1,209 @@
+Bank Object Reference Demo
+==========================
+
+Prerequisites
+=============
+
+If your environment already includes yoko-${current-yoko-version}.jar on the
+CLASSPATH, and the JDK and ant bin directories on the PATH
+it is not necessary to run the environment script described in
+the samples directory README. If your environment is not
+properly configured, or if you are planning on using wsdl2idl/idl2wsdl,
+javac, and java to build and run the demos, you must include the
+yoko-${current-yoko-version}.jar in the CLASSPATH. Also set
+YOKO_HOME to the installation directory.
+
+Demo Use Cases
+==============
+
+This demo allows the user to run three use cases.
+
+- Case 1: Web services client & Web services server.
+
+ In this use case, a Web services client talks to a Web services server
+through the IIOP protocol. Both the client and the server are implemented using
+the CXF Web services framework and the IIOP protocol is enabled by installing
+the Yoko CORBA binding into CXF.
+
+ Note: CXF is _not_ part of the Yoko product, but a CXF kit is bundled
+with Yoko for convenience of testing and running the Web services demos.
+
+- Case 2: Web services client & CORBA server.
+
+ In this use case, a Web services client talks to a CORBA server through the
+IIOP protocol. The client, which is implemented using CXF, loads the
+Yoko CORBA binding to enable the IIOP protocol. The server is implemented using
+the Yoko ORB.
+
+This use case illustrates how a Web services client can be configured to access
+a CORBA server, by converting the server's OMG IDL interface into a WSDL interface
+with a CORBA binding.
+
+- Case 3: CORBA client & Web services server.
+
+ In this use case, a CORBA client talks to a Web services server through the
+IIOP protocol. The client is implemented using the Yoko ORB. The server, which is
+implemented using CXF, loads the Yoko CORBA binding to enable the IIOP protocol.
+
+This use case illustrates how a Web service can be made accessible to CORBA clients,
+by exposing the service through an OMG IDL interface that can be accessed
+using the IIOP protocol.
+
+
+Building the Demo
+=================
+
+To build the demo code, perform the following steps:
+
+1. Open a command prompt and move into the directory <YOKO_HOME>/samples/ws/bank_ws_addressing
+
+2. Enter the following command (UNIX or Windows):
+
+ ant generate.corba.wsdl
+
+ This command adds a CORBA binding to the samples/ws/resources/BankWS.wsdl file,
+ generating an output file, samples/ws/resources/BankWS-corba.wsdl.
+
+3. Open the BankWS-corba.wsdl file using your favorite text editor and change the
+ corba address location in the BankCORBAService definition:
+
+ <wsdl:service name="BankCORBAService">
+ <wsdl:port name="BankCORBAPort" binding="tns:BankCORBABinding">
+ <corba:address location="corbaloc::localhost:40000/Bank" />
+ </wsdl:port>
+ </wsdl:service>
+
+ The address specified here, localhost:40000, assumes that the client and server
+ both run on the same host. If you change this address, you should make sure it is
+ consistent with the address coded in the
+ bank_ws_addressing/src/yoko/server/Server.java, bank_ws_addressing/src/corba/server/Server.java
+ and bank_ws_addressing/src/corba/client/Client.java files.
+
+4. From the samples/ws/bank_ws_addressing directory, enter the following command (UNIX or Windows):
+
+ ant build
+
+ This command uses the CXF wsdl2java utility to generate the server & client code.
+
+
+Running the Demo - Use Case 1
+=============================
+
+To run the demo for the first use case, perform the following steps:
+
+1. Open a command prompt and move into the directory <YOKO_HOME>/samples/ws/bank_ws_addressing.
+
+2. Enter the following command to start the server (on a single command line):
+
+ UNIX (must use forward slashes):
+
+ java -Xbootclasspath/p:$YOKO_HOME/lib/yoko-spec-corba-1.0-incubating-M2-SNAPSHOT.jar:$YOKO_HOME/lib/yoko-core-1.0-incubating-M2-SNAPSHOT.jar
+ -classpath $CLASSPATH:build/classes yoko.server.Server &
+
+ Windows (may use either forward or back slashes):
+
+ start java -Xbootclasspath/p:%YOKO_HOME%\lib\yoko-spec-corba-1.0-incubating-M2-SNAPSHOT.jar;%YOKO_HOME%\lib\yoko-core-1.0-incubating-M2-SNAPSHOT.jar
+ -classpath %CLASSPATH%;build\classes yoko.server.Server
+
+ The server process starts in the background. We have to set the Xbootclasspath,
+ because the ORB classes in Yoko conflict with the JDK ORB classes.
+
+3. Enter the following command to start the client:
+
+ UNIX:
+
+ java -Xbootclasspath/p:$YOKO_HOME/lib/yoko-spec-corba-1.0-incubating-M2-SNAPSHOT.jar:$YOKO_HOME/lib/yoko-core-1.0-incubating-M2-SNAPSHOT.jar
+ -classpath $CLASSPATH:build/classes yoko.client.Client
+
+ Windows:
+
+ java -Xbootclasspath/p:%YOKO_HOME%\lib\yoko-spec-corba-1.0-incubating-M2-SNAPSHOT.jar;%YOKO_HOME%\lib\yoko-core-1.0-incubating-M2-SNAPSHOT.jar
+ -classpath %CLASSPATH%;build\classes yoko.client.Client
+
+4. After running the client, use the kill command to terminate the server process (UNIX) or
+ type Ctrl-C in the server's command window (Windows).
+
+
+Running the Demo - Use Case 2
+=============================
+
+To run the demo for the second use case, perform the following steps:
+
+1. Open a command prompt and move into the directory <YOKO_HOME>/samples/ws/bank_ws_addressing
+
+2. Enter the following command to start the CORBA server (on a single command line):
+
+ UNIX (must use forward slashes):
+
+ java -Xbootclasspath/p:$YOKO_HOME/lib/yoko-spec-corba-1.0-incubating-M2-SNAPSHOT.jar:$YOKO_HOME/lib/yoko-core-1.0-incubating-M2-SNAPSHOT.jar
+ -classpath $CLASSPATH:build/classes corba.server.Server &
+
+ Windows (may use either forward or back slashes):
+
+ start java -Xbootclasspath/p:%YOKO_HOME%\lib\yoko-spec-corba-1.0-incubating-M2-SNAPSHOT.jar;%YOKO_HOME%\lib\yoko-core-1.0-incubating-M2-SNAPSHOT.jar
+ -classpath %CLASSPATH%;build\classes corba.server.Server
+
+ The server process starts in the background. We have to set the Xbootclasspath,
+ because the ORB classes in Yoko conflict with the JDK ORB classes.
+
+3. Enter the following command to start the Web services client:
+
+ UNIX:
+
+ java -Xbootclasspath/p:$YOKO_HOME/lib/yoko-spec-corba-1.0-incubating-M2-SNAPSHOT.jar:$YOKO_HOME/lib/yoko-core-1.0-incubating-M2-SNAPSHOT.jar
+ -classpath $CLASSPATH:build/classes yoko.client.Client
+
+ Windows:
+
+ java -Xbootclasspath/p:%YOKO_HOME%\lib\yoko-spec-corba-1.0-incubating-M2-SNAPSHOT.jar;%YOKO_HOME%\lib\yoko-core-1.0-incubating-M2-SNAPSHOT.jar
+ -classpath %CLASSPATH%;build\classes yoko.client.Client
+
+4. After running the client, use the kill command to terminate the server process (UNIX) or
+ type Ctrl-C in the server's command window (Windows).
+
+
+Running the Demo - Use Case 3
+=============================
+
+To run the demo for the third use case, perform the following steps:
+
+1. Open a command prompt and move into the directory <YOKO_HOME>/samples/ws/bank_ws_addressing
+
+2. Enter the following command to start the Web services server (on a single command line):
+
+ UNIX (must use forward slashes):
+
+ java -Xbootclasspath/p:$YOKO_HOME/lib/yoko-spec-corba-1.0-incubating-M2-SNAPSHOT.jar:$YOKO_HOME/lib/yoko-core-1.0-incubating-M2-SNAPSHOT.jar
+ -classpath $CLASSPATH:build/classes yoko.server.Server &
+
+ Windows (may use either forward or back slashes):
+
+ start java -Xbootclasspath/p:%YOKO_HOME%\lib\yoko-spec-corba-1.0-incubating-M2-SNAPSHOT.jar;%YOKO_HOME%\lib\yoko-core-1.0-incubating-M2-SNAPSHOT.jar
+ -classpath %CLASSPATH%;build\classes yoko.server.Server
+
+ The server process starts in the background. We have to set the Xbootclasspath,
+ because the ORB classes in Yoko conflict with the JDK ORB classes.
+
+3. Enter the following command to start the CORBA client:
+
+ UNIX:
+
+ java -Xbootclasspath/p:$YOKO_HOME/lib/yoko-spec-corba-1.0-incubating-M2-SNAPSHOT.jar:$YOKO_HOME/lib/yoko-core-1.0-incubating-M2-SNAPSHOT.jar
+ -classpath $CLASSPATH:build/classes corba.client.Client
+
+ Windows:
+
+ java -Xbootclasspath/p:%YOKO_HOME%\lib\yoko-spec-corba-1.0-incubating-M2-SNAPSHOT.jar;%YOKO_HOME%\lib\yoko-core-1.0-incubating-M2-SNAPSHOT.jar
+ -classpath %CLASSPATH%;build\classes corba.client.Client
+
+4. After running the client, use the kill command to terminate the server process (UNIX) or
+ type Ctrl-C in the server's command window (Windows).
+
+
+Cleanup
+=======
+
+To remove the code generated from the WSDL file and the .class
+files, either delete the build directory and its contents or run:
+
+ ant clean
Propchange: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/README.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/README.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/build.xml
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/build.xml?view=auto&rev=514835
==============================================================================
--- incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/build.xml (added)
+++ incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/build.xml Mon Mar 5 11:48:26 2007
@@ -0,0 +1,148 @@
+<?xml version="1.0"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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="Bank Object Reference Demo" default="build" basedir=".">
+
+ <property environment="env"/>
+ <property name="build.dir" location="${basedir}/build"/>
+ <property name="build.src.dir" location="${basedir}/build/src"/>
+ <property name="build.classes.dir" location="${build.dir}/classes"/>
+
+ <!-- Determine yoko.home, either from the environment varialble YOKO_HOME
+ - or using ../../..
+ -->
+ <condition property="yoko.home" value="${env.YOKO_HOME}">
+ <isset property="env.YOKO_HOME"/>
+ </condition>
+ <property name="yoko.home" location="../../.."/>
+
+ <path id="yoko.classpath">
+ <pathelement location="${build.classes.dir}"/>
+ <pathelement location="${yoko.home}/lib/yoko-1.0-incubating-M2-SNAPSHOT.jar"/>
+ </path>
+
+ <target name="build">
+ <!--<antcall target="generate.corba.wsdl"/>-->
+ <antcall target="generate.yoko.server.code"/>
+ <antcall target="generate.yoko.client.code"/>
+ <antcall target="generate.corba.server.code"/>
+ <antcall target="generate.corba.client.code"/>
+ <javac destdir="${build.classes.dir}" debug="true">
+ <src path="${basedir}/src"/>
+ <src path="${build.src.dir}"/>
+ <classpath>
+ <path refid="yoko.classpath"/>
+ <pathelement path="${thirdparty.classpath}"/>
+ </classpath>
+ </javac>
+ </target>
+
+ <target name="generate.corba.wsdl">
+ <echo level="info" message="Generating CORBA IDL and WSDL using wsdltoidl..."/>
+ <wsdl2corba file="../resources/BankWS.wsdl" dest="BankWS-account.wsdl" binding="Account"/>
+ <wsdl2corba file="BankWS-account.wsdl" dest="BankWS-corba.wsdl" binding="Bank"/>
+ <wsdl2idl file="BankWS-corba.wsdl" dest="BankWS-corba.idl" binding="Bank"/>
+ <echo level="info" message="Deleting intermediate BankWS-account.wsdl file..."/>
+ <delete file="BankWS-account.wsdl"/>
+ </target>
+
+ <target name="generate.yoko.server.code">
+ <echo level="info" message="Generating server code using wsdl2java..."/>
+ <wsdl2java file="BankWS-corba.wsdl" package="yoko.server"/>
+ </target>
+
+ <target name="generate.corba.server.code">
+ <echo level="info" message="Generating server code using idlj..."/>
+ <idl2java file="BankWS-corba.idl" package="corba.server"/>
+ </target>
+
+ <target name="generate.yoko.client.code">
+ <echo level="info" message="Generating client code using wsdl2java..."/>
+ <wsdl2java file="BankWS-corba.wsdl" package="yoko.client"/>
+ </target>
+
+ <target name="generate.corba.client.code">
+ <echo level="info" message="Generating client code using idlj..."/>
+ <idl2java file="BankWS-corba.idl" package="corba.client"/>
+ </target>
+
+ <target name="clean">
+ <delete dir="${build.classes.dir}"/>
+ <delete dir="${build.src.dir}"/>
+ <delete dir="${build.dir}"/>
+ <delete file="endpoint.ior"/>
+ </target>
+
+ <macrodef name="wsdl2corba">
+ <attribute name="file"/>
+ <attribute name="dest"/>
+ <attribute name="binding"/>
+ <sequential>
+ <java failonerror="true" classname="org.apache.yoko.tools.WSDLToIDL" fork="yes">
+ <classpath>
+ <path refid="yoko.classpath"/>
+ </classpath>
+ <arg line="-d ${basedir} -corba -i @{binding} -o @{dest} @{file}"/>
+ </java>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="wsdl2idl">
+ <attribute name="file"/>
+ <attribute name="dest"/>
+ <attribute name="binding"/>
+ <sequential>
+ <java failonerror="true" classname="org.apache.yoko.tools.WSDLToIDL" fork="yes">
+ <classpath>
+ <path refid="yoko.classpath"/>
+ </classpath>
+ <arg line="-d ${basedir} -idl -i @{binding} -o @{dest} @{file}"/>
+ </java>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="wsdl2java">
+ <attribute name="srcdestdir" default="${build.src.dir}"/>
+ <attribute name="destdir" default="${build.classes.dir}"/>
+ <attribute name="file"/>
+ <attribute name="package"/>
+ <sequential>
+ <mkdir dir="@{srcdestdir}"/>
+ <mkdir dir="@{destdir}"/>
+ <java failonerror="true"
+ classname="org.apache.cxf.tools.wsdl2java.WSDLToJava">
+ <arg line="-p @{package} -d @{srcdestdir} @{file}"/>
+ </java>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="idl2java">
+ <attribute name="srcdestdir" default="${build.src.dir}"/>
+ <attribute name="destdir" default="${build.classes.dir}"/>
+ <attribute name="file"/>
+ <attribute name="package"/>
+ <sequential>
+ <mkdir dir="@{srcdestdir}"/>
+ <mkdir dir="@{destdir}"/>
+ <exec executable="idlj" dir=".">
+ <arg line="-fall -td @{srcdestdir} -pkgPrefix Bank @{package} -pkgPrefix Account @{package} @{file}"/>
+ </exec>
+ </sequential>
+ </macrodef>
+</project>
Propchange: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/build.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/build.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/client/Client.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/client/Client.java?view=auto&rev=514835
==============================================================================
--- incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/client/Client.java (added)
+++ incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/client/Client.java Mon Mar 5 11:48:26 2007
@@ -0,0 +1,117 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+
+package corba.client;
+
+import java.util.Properties;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.UserException;
+
+public class Client {
+ static int run(ORB orb, String[] args) throws UserException {
+
+ // Get the Bank object
+ org.omg.CORBA.Object obj =
+ orb.string_to_object("corbaloc::localhost:40000/Bank");
+ if (obj == null) {
+ System.err.println("bank.Client: cannot read IOR from Bank.ref");
+ return 1;
+ }
+ Bank bank = BankHelper.narrow(obj);
+
+ // Call each of the bank methods once to test the functionality.
+ //bank.addAccount(account);
+
+ // Test the method Bank.create_account()
+ System.out.println("Creating account called \"Account1\"");
+ Account account1 = bank.create_account("Account1");
+ System.out.println("Depositing 100.00 into account \"Account1\"");
+ account1.deposit(100.00f);
+ System.out.println("Current balance of \"Account1\" is " + account1.get_balance());
+ System.out.println();
+
+ // Test the method Bank.create_epr_account()
+ System.out.println("Creating account called \"Account2\"");
+ org.omg.CORBA.Object account2Obj = bank.create_epr_account("Account2");
+ Account account2 = AccountHelper.narrow(account2Obj);
+ System.out.println("Depositing 5.00 into account \"Account2\"");
+ account2.deposit(5.00f);
+ System.out.println("Current balance of \"Account2\" is " + account2.get_balance());
+ System.out.println();
+
+ // Create two more accounts to use with the getAccount calls
+ Account acc3 = bank.create_account("Account3");
+ acc3.deposit(200.00f);
+ Account acc4 = bank.create_account("Account4");
+ acc4.deposit(400.00f);
+
+ // Test the method Bank.get_account()
+ System.out.println("Retrieving account called \"Account3\"");
+ Account account3 = bank.get_account("Account3");
+ System.out.println("Current balance for \"Account3\" is " + account3.get_balance());
+ System.out.println("Depositing 10.00 into account \"Account3\"");
+ account3.deposit(10.00f);
+ System.out.println("New balance for account \"Account3\" is " + account3.get_balance());
+ System.out.println();
+
+ // Test the method Bank.get_epr_account()
+ System.out.println("Retrieving account called \"Account4\"");
+ Account account4 = bank.get_account("Account4");
+ System.out.println("Current balance for \"Account4\" is " + account4.get_balance());
+ System.out.println("Withdrawing 150.00 into account \"Account4\"");
+ account4.deposit(-150.00f);
+ System.out.println("New balance for account \"Account4\" is " + account4.get_balance());
+ System.out.println();
+
+ return 0;
+ }
+
+ public static void main(String args[]) {
+ int status = 0;
+ ORB orb = null;
+
+ Properties props = System.getProperties();
+ props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB");
+ props.put("org.omg.CORBA.ORBSingletonClass",
+ "org.apache.yoko.orb.CORBA.ORBSingleton");
+ props.put("ooc.orb.id", "Bank-Client");
+
+ try {
+ orb = ORB.init(args, props);
+ status = run(orb, args);
+ }
+ catch(Exception ex) {
+ ex.printStackTrace();
+ status = 1;
+ }
+
+ if(orb != null) {
+ try {
+ orb.destroy();
+ }
+ catch(Exception ex) {
+ ex.printStackTrace();
+ status = 1;
+ }
+ }
+
+ System.exit(status);
+ }
+}
Propchange: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/client/Client.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/client/Client.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/server/Account_impl.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/server/Account_impl.java?view=auto&rev=514835
==============================================================================
--- incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/server/Account_impl.java (added)
+++ incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/server/Account_impl.java Mon Mar 5 11:48:26 2007
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+
+package corba.server;
+
+import org.omg.PortableServer.POA;
+
+public class Account_impl extends AccountPOA {
+
+ // The servants default POA
+ private POA poa_;
+
+ private float balance;
+
+ public Account_impl(POA poa) {
+ poa_ = poa;
+
+ balance = 0.0f;
+ }
+
+ public float get_balance() {
+ System.out.println("[Server] Called get_balance()...");
+ System.out.println();
+ return balance;
+ }
+
+ public void deposit(float addition) {
+ System.out.println("[Server] Called deposit(" + addition + ")...");
+ System.out.println();
+ balance += addition;
+ }
+
+ public POA _default_POA() {
+ return poa_;
+ }
+}
Propchange: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/server/Account_impl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/server/Account_impl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/server/Bank_impl.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/server/Bank_impl.java?view=auto&rev=514835
==============================================================================
--- incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/server/Bank_impl.java (added)
+++ incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/server/Bank_impl.java Mon Mar 5 11:48:26 2007
@@ -0,0 +1,88 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+
+package corba.server;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.omg.CORBA.ORB;
+import org.omg.PortableServer.POA;
+
+public class Bank_impl extends BankPOA {
+
+ private ORB orb_;
+ private POA poa_;
+
+ private Map<String, Account> accountList;
+
+ Bank_impl(ORB orb, POA poa) {
+ orb_ = orb;
+ poa_ = poa;
+
+ accountList = new HashMap<String, Account>();
+ }
+
+ public Account create_account(String account_name) {
+ System.out.println("[Bank] Called create_account( " + account_name + " )...");
+ System.out.println();
+ Account_impl accountImpl = new Account_impl(poa_);
+ Account account = accountImpl._this(orb_);
+ accountList.put(account_name, account);
+ return account;
+ }
+
+ public org.omg.CORBA.Object create_epr_account(String account_name) {
+ System.out.println("[Bank] Called create_epr_account( " + account_name + ")...");
+ System.out.println();
+ Account_impl accountImpl = new Account_impl(poa_);
+ Account account = accountImpl._this(orb_);
+ accountList.put(account_name, account);
+ return account;
+ }
+
+ public Account get_account(String account_name) {
+ System.out.println("[Bank] Called get_account( " + account_name + ")...");
+ System.out.println();
+ return accountList.get(account_name);
+ }
+
+ public org.omg.CORBA.Object get_epr_account(String account_name) {
+ System.out.println("[Bank] Called get_epr_account( " + account_name + ")...");
+ System.out.println();
+ return accountList.get(account_name);
+ }
+
+ // TODO: What is the correct implementation for this operation?
+ public org.omg.CORBA.Object get_account_epr_with_no_use_attribute(String account_name) {
+ System.out.println("[Bank] Called get_epr_with_no_use_attribute( " + account_name + " )...");
+ System.out.println();
+ return null;
+ }
+
+ // TODO: What is the correct implementation for this operation?
+ public void find_account(org.omg.CORBA.AnyHolder account_details) {
+ System.out.println("[Bank] Called find_account (account_details)...");
+ System.out.println();
+ }
+
+ public POA _default_POA() {
+ return poa_;
+ }
+}
Propchange: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/server/Bank_impl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/server/Bank_impl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/server/Server.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/server/Server.java?view=auto&rev=514835
==============================================================================
--- incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/server/Server.java (added)
+++ incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/server/Server.java Mon Mar 5 11:48:26 2007
@@ -0,0 +1,118 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+
+package corba.server;
+
+import java.util.Properties;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.UserException;
+import org.omg.CORBA.ORBPackage.InvalidName;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.POAHelper;
+import org.omg.PortableServer.POAManager;
+
+import org.apache.yoko.orb.OB.BootManager;
+import org.apache.yoko.orb.OB.BootManagerHelper;
+import org.apache.yoko.orb.OB.BootManagerPackage.AlreadyExists;
+
+public class Server
+{
+ static int
+ run(ORB orb, String[] args) throws UserException
+ {
+ //
+ // Resolve Root POA
+ //
+ POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
+
+ //
+ // Get a reference to the POA manager
+ //
+ POAManager manager = rootPOA.the_POAManager();
+
+ //
+ // Create implementation object
+ //
+ Bank_impl bankImpl = new Bank_impl(orb, rootPOA);
+ Bank bank = bankImpl._this(orb);
+
+ // Add reference to the boot manager
+ try {
+ byte[] oid = ("Bank").getBytes();
+ BootManager bootManager = BootManagerHelper.narrow(
+ orb.resolve_initial_references("BootManager"));
+ bootManager.add_binding(oid, bank);
+ } catch (InvalidName ex) {
+ throw new RuntimeException();
+ } catch (AlreadyExists ex) {
+ throw new RuntimeException();
+ }
+
+ //
+ // Run implementation
+ //
+ manager.activate();
+ orb.run();
+
+ return 0;
+ }
+
+ public static void
+ main(String args[])
+ {
+ Properties props = System.getProperties();
+ props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB");
+ props.put("org.omg.CORBA.ORBSingletonClass",
+ "org.apache.yoko.orb.CORBA.ORBSingleton");
+ props.put("yoko.orb.id", "Bank-Server");
+ // for this demo, start on localhost, port 40000
+ props.put("yoko.orb.oa.endpoint", "iiop --host localhost --port 40000");
+
+
+ int status = 0;
+ ORB orb = null;
+
+ try
+ {
+ orb = ORB.init(args, props);
+ status = run(orb, args);
+ }
+ catch(Exception ex)
+ {
+ ex.printStackTrace();
+ status = 1;
+ }
+
+ if(orb != null)
+ {
+ try
+ {
+ orb.destroy();
+ }
+ catch(Exception ex)
+ {
+ ex.printStackTrace();
+ status = 1;
+ }
+ }
+
+ System.exit(status);
+ }
+}
Propchange: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/server/Server.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/corba/server/Server.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/client/Client.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/client/Client.java?view=auto&rev=514835
==============================================================================
--- incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/client/Client.java (added)
+++ incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/client/Client.java Mon Mar 5 11:48:26 2007
@@ -0,0 +1,151 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+
+package yoko.client;
+
+import java.io.File;
+import java.net.URL;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
+
+import org.apache.cxf.jaxb.JAXBUtils;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.wsdl.EndpointReferenceUtils;
+import org.apache.cxf.wsdl.WSDLManager;
+import org.apache.cxf.wsdl11.WSDLManagerImpl;
+
+public final class Client {
+
+ private static final Logger LOG =
+ Logger.getLogger(Client.class.getPackage().getName());
+
+ private static final QName SERVICE_NAME
+ = new QName("http://schemas.apache.org/yoko/idl/Bank", "BankCORBAService");
+
+ private Client() {
+ }
+
+ public static void main(String args[]) throws Exception {
+
+ LOG.log(Level.INFO, "Resolving the bank object");
+ URL wsdlUrl = new URL("file:./BankWS-corba.wsdl");
+ BankCORBAService service = new BankCORBAService(wsdlUrl, SERVICE_NAME);
+ Bank port = service.getBankCORBAPort();
+
+ // Test the method Bank.createAccount()
+ System.out.println("Creating account called \"Account1\"");
+ EndpointReferenceType epr1 = port.createAccount("Account1");
+ Account account1 = getAccountFromEPR(epr1);
+ System.out.println("Depositing 100.00 into account \'Account1\"");
+ account1.deposit(100.00f);
+ System.out.println("Current balance of account \"Account1\" is " + account1.getBalance());
+ System.out.println();
+
+ // Test the method Bank.createEprAccount()
+ System.out.println("Creating account called \"Account2\"");
+ EndpointReferenceType epr2 = port.createEprAccount("Account2");
+ Account account2 = getAccountFromEPR(epr2);
+ System.out.println("Depositing 5.00 into account \'Account2\"");
+ account2.deposit(5.00f);
+ System.out.println("Current balance of account \"Account2\" is " + account2.getBalance());
+ System.out.println();
+
+ // create two more accounts to use with the getAccount calls
+ Account acc3 = getAccountFromEPR(port.createAccount("Account3"));
+ acc3.deposit(200.00f);
+ Account acc4 = getAccountFromEPR(port.createAccount("Account4"));
+ acc4.deposit(400.00f);
+
+ // Test the method Bank.getAccount()
+ System.out.println("Retrieving account called \"Account3\"");
+ EndpointReferenceType epr3 = port.getAccount("Account3");
+ Account account3 = getAccountFromEPR(epr3);
+ System.out.println("Current balance for \"Account3\" is " + account3.getBalance());
+ System.out.println("Depositing 10.00 into account \"Account3\"");
+ account3.deposit(10.00f);
+ System.out.println("New balance for account \"Account3\" is " + account3.getBalance());
+ System.out.println();
+
+ // Test the method Bank.getEprAccount()
+ System.out.println("Retrieving account called \"Account4\"");
+ EndpointReferenceType epr4 = port.getEprAccount("Account4");
+ Account account4 = getAccountFromEPR(epr4);
+ System.out.println("Current balance for account \"Account4\" is " + account4.getBalance());
+ System.out.println("Withdrawing 150.00 into account \"Account4\"");
+ account4.deposit(-150.00f);
+ System.out.println("New balance for account \"Account4\" is " + account4.getBalance());
+ System.out.println();
+
+ System.exit(0);
+ }
+
+ private static Account getAccountFromEPR(EndpointReferenceType epr) {
+
+ WSDLManager manager = null;
+ try {
+ manager = new WSDLManagerImpl();
+ } catch (Exception ex) {
+ LOG.log(Level.SEVERE, "Unable to create WSDLManager");
+ System.exit(1);
+ }
+
+ QName interfaceName = EndpointReferenceUtils.getInterfaceName(epr);
+ String wsdlLocation = EndpointReferenceUtils.getWSDLLocation(epr);
+ QName serviceName = EndpointReferenceUtils.getServiceName(epr);
+ String portName = EndpointReferenceUtils.getPortName(epr);
+
+ QName port = new QName(serviceName.getNamespaceURI(), portName);
+
+ StringBuffer seiName = new StringBuffer();
+ seiName.append("yoko.client.");
+ seiName.append(JAXBUtils.nameToIdentifier(interfaceName.getLocalPart(),
+ JAXBUtils.IdentifierType.INTERFACE));
+
+ Class<?> sei = null;
+ try {
+ sei = Class.forName(seiName.toString(), true, manager.getClass().getClassLoader());
+ } catch (ClassNotFoundException ex) {
+ LOG.log(Level.SEVERE, "Unable to obtain SEI class");
+ System.exit(1);
+ }
+
+ URL wsdlURL = null;
+ try {
+ wsdlURL = new URL(wsdlLocation);
+ } catch (Exception ex) {
+ LOG.log(Level.SEVERE, "Unable to create URL for WSDL");
+ System.exit(1);
+ }
+
+ Service service = Service.create(wsdlURL, serviceName);
+ Account account = (Account)service.getPort(port, sei);
+
+ // TODO: Revisit. Is this the correct way to handle EPRs for
+ // port objects?
+ Map<String, Object> requestContext = ((BindingProvider)account).getRequestContext();
+ requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, epr);
+
+ return account;
+ }
+}
Propchange: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/client/Client.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/client/Client.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/server/AccountImpl.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/server/AccountImpl.java?view=auto&rev=514835
==============================================================================
--- incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/server/AccountImpl.java (added)
+++ incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/server/AccountImpl.java Mon Mar 5 11:48:26 2007
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+*/
+
+package yoko.server;
+
+@javax.jws.WebService(portName = "AccountCORBAPort",
+ serviceName = "AccountCORBAService",
+ targetNamespace = "http://schemas.apache.org/yoko/idl/Bank",
+ endpointInterface = "yoko.server.Account")
+
+public class AccountImpl implements Account {
+
+ private float balance;
+
+ public float getBalance() {
+ System.out.println("[Account] Called AccountImpl.getBalance()...");
+ System.out.println();
+
+ return balance;
+ }
+
+ public void deposit(float addition) {
+ System.out.println("[Account] Called AccountImpl.deposit( " + addition + " )...");
+ System.out.println();
+
+ balance += addition;
+ }
+}
Propchange: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/server/AccountImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/server/AccountImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/server/BankImpl.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/server/BankImpl.java?view=auto&rev=514835
==============================================================================
--- incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/server/BankImpl.java (added)
+++ incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/server/BankImpl.java Mon Mar 5 11:48:26 2007
@@ -0,0 +1,133 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+*/
+
+package yoko.server;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Endpoint;
+import javax.xml.ws.Service;
+
+import org.apache.cxf.jaxb.JAXBUtils;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.wsdl.EndpointReferenceUtils;
+import org.apache.cxf.wsdl.WSDLManager;
+import org.apache.cxf.wsdl11.WSDLManagerImpl;
+
+@javax.jws.WebService(portName = "BankCORBAPort",
+ serviceName = "BankCORBAService",
+ targetNamespace = "http://schemas.apache.org/yoko/idl/Bank",
+ endpointInterface = "yoko.server.Bank")
+
+public class BankImpl implements Bank {
+
+ private static final QName ACCOUNT_SERVICE_NAME
+ = new QName("http://schemas.apache.org/yoko/idl/Bank", "AccountCORBAService");
+
+ private static final QName ACCOUNT_PORT_NAME
+ = new QName("http://schemas.apache.org/yoko/idl/Bank", "AccountCORBAPort");
+
+ private static final QName ACCOUNT_PORT_TYPE
+ = new QName("http://schemas.apache.org/yoko/idl/Bank", "Account");
+
+ private URL wsdlURL;
+ private Map<String, EndpointReferenceType> accountList =
+ new HashMap<String, EndpointReferenceType>();
+
+ public BankImpl(String wsdlLocation) {
+ try {
+ File wsdlFile = new File(wsdlLocation);
+ if (wsdlFile.exists()) {
+ wsdlURL = wsdlFile.toURL();
+ } else {
+ wsdlURL = new URL(wsdlLocation);
+ }
+ } catch (Exception ex) {
+ System.out.println("Unable to resolve WSDL location");
+ System.exit(1);
+ }
+ }
+
+ public EndpointReferenceType createAccount(String accountName) {
+ System.out.println("[Bank] Called createAccount( " + accountName + " )...");
+ System.out.println();
+ EndpointReferenceType ref = null;
+ ref = createAccountReference(accountName);
+ if (ref != null) {
+ accountList.put(accountName, ref);
+ }
+ return ref;
+ }
+
+ public EndpointReferenceType createEprAccount(String accountName) {
+ System.out.println("[Bank] Called createEprAccount( " + accountName + " )...");
+ System.out.println();
+ EndpointReferenceType ref = createAccountReference(accountName);
+ if (ref != null) {
+ accountList.put(accountName, ref);
+ }
+ return ref;
+ }
+
+ public EndpointReferenceType getAccount(String accountName) {
+ System.out.println("[Bank] Called getAccount( " + accountName + " )...");
+ System.out.println();
+ return accountList.get(accountName);
+ }
+
+ public EndpointReferenceType getEprAccount(String accountName) {
+ System.out.println("[Bank] Called getEprAccount( " + accountName + " )...");
+ System.out.println();
+ return accountList.get(accountName);
+ }
+
+ // TODO: What is the correct implementation for this operation?
+ public EndpointReferenceType getAccountEprWithNoUseAttribute(String accountName) {
+ return null;
+ }
+
+ // TODO: What is the correct implementation for this operation?
+ public void findAccount(javax.xml.ws.Holder<Object> accountDetails) {
+ }
+
+ private EndpointReferenceType createAccountReference(String accountName) {
+ String corbaAddress = "corbaloc::localhost:60000/" + accountName;
+
+ Object account = new AccountImpl();
+ Endpoint.publish(corbaAddress, account);
+
+ // TODO: can we just use the EndpointReferenceUtils.getEndpointRef(manager, impl);
+
+ EndpointReferenceType ref =
+ EndpointReferenceUtils.getEndpointReference(wsdlURL,
+ ACCOUNT_SERVICE_NAME,
+ ACCOUNT_PORT_NAME.getLocalPart());
+ EndpointReferenceUtils.setInterfaceName(ref, ACCOUNT_PORT_TYPE);
+ EndpointReferenceUtils.setAddress(ref, corbaAddress);
+
+ return ref;
+ }
+}
+
Propchange: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/server/BankImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/server/BankImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/server/Server.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/server/Server.java?view=auto&rev=514835
==============================================================================
--- incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/server/Server.java (added)
+++ incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/server/Server.java Mon Mar 5 11:48:26 2007
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+
+package yoko.server;
+
+import javax.xml.ws.Endpoint;
+
+public class Server {
+
+ protected Server() throws Exception {
+ System.out.println("Starting Server");
+
+ String wsdlLocation = "file:./BankWS-corba.wsdl";
+ Object implementor = new BankImpl(wsdlLocation);
+ String address = "corbaloc::localhost:40000/Bank";
+ Endpoint.publish(address, implementor);
+ }
+
+ public static void main(String args[]) throws Exception {
+ new Server();
+ System.out.println("Server ready...");
+
+ Thread.sleep(5 * 60 * 1000);
+ System.out.println("Server exiting");
+ System.exit(0);
+ }
+}
+
Propchange: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/server/Server.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/yoko/trunk/distribution/src/main/samples/ws/bank_ws_addressing/src/yoko/server/Server.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/yoko/trunk/distribution/src/main/samples/ws/resources/BankWS.wsdl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/distribution/src/main/samples/ws/resources/BankWS.wsdl?view=auto&rev=514835
==============================================================================
--- incubator/yoko/trunk/distribution/src/main/samples/ws/resources/BankWS.wsdl (added)
+++ incubator/yoko/trunk/distribution/src/main/samples/ws/resources/BankWS.wsdl Mon Mar 5 11:48:26 2007
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+-->
+<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://schemas.apache.org/yoko/idl/Bank"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:corba="http://schemas.apache.org/yoko/bindings/corba"
+ xmlns:corbatm="http://schemas.apache.org/yoko/idl/Bank/corba/typemap"
+ xmlns:wsa="http://www.w3.org/2005/08/addressing"
+ targetNamespace="http://schemas.apache.org/yoko/idl/Bank">
+ <types>
+ <schema attributeFormDefault="unqualified"
+ elementFormDefault="unqualified"
+ targetNamespace="http://schemas.apache.org/yoko/idl/Bank"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsa="http://www.w3.org/2005/08/addressing">
+ <import namespace="http://www.w3.org/2005/08/addressing" schemaLocation="http://www.w3.org/2005/08/addressing/ws-addr.xsd"/>
+ <element name="AccountRef" type="wsa:EndpointReferenceType">
+ <annotation>
+ <appinfo>corba:binding=AccountCORBABinding</appinfo>
+ </annotation>
+ </element>
+ </schema>
+ </types>
+ <message name="get_account">
+ <part name="account_name" type="xsd:string"/>
+ </message>
+ <message name="get_accountResponse">
+ <part name="return" element="tns:AccountRef"/>
+ </message>
+ <message name="get_epr_accountResponse">
+ <part name="return" type="wsa:EndpointReferenceType"/>
+ </message>
+ <message name="find_account">
+ <part name="account_details" type="xsd:anyType"/>
+ </message>
+ <message name="find_accountResponse">
+ <part name="account_details" type="xsd:anyType"/>
+ </message>
+ <message name="create_account">
+ <part name="account_name" type="xsd:string"/>
+ </message>
+ <message name="create_accountResponse">
+ <part name="return" element="tns:AccountRef"/>
+ </message>
+ <message name="create_epr_accountResponse">
+ <part name="return" type="wsa:EndpointReferenceType"/>
+ </message>
+ <message name="get_balance"/>
+ <message name="get_balanceResponse">
+ <part name="balance" type="xsd:float"/>
+ </message>
+ <message name="deposit">
+ <part name="addition" type="xsd:float"/>
+ </message>
+ <message name="depositResponse"/>
+ <portType name="Bank">
+ <operation name="create_account">
+ <input name="create_account" message="tns:create_account"/>
+ <output name="create_accountResponse" message="tns:create_accountResponse"/>
+ </operation>
+ <operation name="create_epr_account">
+ <input name="create_epr_account" message="tns:create_account"/>
+ <output name="create_epr_accountResponse" message="tns:create_epr_accountResponse"/>
+ </operation>
+ <operation name="get_account">
+ <input name="get_account" message="tns:get_account"/>
+ <output name="get_accountResponse" message="tns:get_accountResponse"/>
+ </operation>
+ <operation name="get_epr_account">
+ <input name="get_epr_account" message="tns:get_account"/>
+ <output name="get_epr_accountResponse" message="tns:get_epr_accountResponse"/>
+ </operation>
+ <operation name="get_account_epr_with_no_use_attribute">
+ <input name="get_epr_account" message="tns:get_account"/>
+ <output name="get_epr_accountResponse" message="tns:get_epr_accountResponse"/>
+ </operation>
+ <operation name="find_account">
+ <input name="find_account" message="tns:find_account"/>
+ <output name="find_accountResponse" message="tns:find_accountResponse"/>
+ </operation>
+ </portType>
+ <portType name="Account">
+ <operation name="get_balance">
+ <input name="get_balance" message="tns:get_balance"/>
+ <output name="get_balanceResponse" message="tns:get_balanceResponse"/>
+ </operation>
+ <operation name="deposit">
+ <input name="deposit" message="tns:deposit"/>
+ <output name="depositResponse" message="tns:depositResponse"/>
+ </operation>
+ </portType>
+</definitions>
+
Propchange: incubator/yoko/trunk/distribution/src/main/samples/ws/resources/BankWS.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/yoko/trunk/distribution/src/main/samples/ws/resources/BankWS.wsdl
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/yoko/trunk/distribution/src/main/samples/ws/resources/BankWS.wsdl
------------------------------------------------------------------------------
svn:mime-type = text/xml