incubator-yoko-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r417194 - in /incubator/yoko/trunk/distribution/src/main/samples: orb/hello_world/src/corba/server/Server.java ws/hello_world/README.txt ws/hello_world/src/corba/server/Server.java
Date Mon, 26 Jun 2006 14:03:07 GMT
Author: bravi
Date: Mon Jun 26 07:03:06 2006
New Revision: 417194

URL: http://svn.apache.org/viewvc?rev=417194&view=rev
Log:
Updated the hello_world readme and the demo corba server code.
JIRA: http://issues.apache.org/jira/browse/YOKO-54

Modified:
    incubator/yoko/trunk/distribution/src/main/samples/orb/hello_world/src/corba/server/Server.java
    incubator/yoko/trunk/distribution/src/main/samples/ws/hello_world/README.txt
    incubator/yoko/trunk/distribution/src/main/samples/ws/hello_world/src/corba/server/Server.java

Modified: incubator/yoko/trunk/distribution/src/main/samples/orb/hello_world/src/corba/server/Server.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/distribution/src/main/samples/orb/hello_world/src/corba/server/Server.java?rev=417194&r1=417193&r2=417194&view=diff
==============================================================================
--- incubator/yoko/trunk/distribution/src/main/samples/orb/hello_world/src/corba/server/Server.java
(original)
+++ incubator/yoko/trunk/distribution/src/main/samples/orb/hello_world/src/corba/server/Server.java
Mon Jun 26 07:03:06 2006
@@ -34,15 +34,15 @@
 
 public class Server {
     static int run(ORB orb, String[] args) throws UserException {
-	// Resolve Root POA
-	POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
+        // Resolve Root POA
+        POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
 
-	// Get a reference to the POA manager
-	POAManager manager = rootPOA.the_POAManager();
+        // Get a reference to the POA manager
+        POAManager manager = rootPOA.the_POAManager();
 
-	// Create implementation object
-	HelloWorldImpl hwImpl = new HelloWorldImpl(rootPOA);
-	HelloWorld hello = hwImpl._this(orb);
+        // Create implementation object
+        HelloWorldImpl hwImpl = new HelloWorldImpl(rootPOA);
+        HelloWorld hello = hwImpl._this(orb);
 
         // Add reference to the boot manager
         try {
@@ -56,11 +56,12 @@
             throw new RuntimeException();
         }
 
-	// Run implementation
-	manager.activate();
-	orb.run();
+        // Run implementation
+        manager.activate();
+        System.out.println("Server ready...");
+        orb.run();
 
-	return 0;
+        return 0;
     }
 
     public static void main(String args[]) {
@@ -68,30 +69,30 @@
         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", "HelloWorld-Server");
+        props.put("yoko.orb.id", "HelloWorld-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;
+        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;
-	    }
-	}
+        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);
+        System.exit(status);
     }
 }

Modified: incubator/yoko/trunk/distribution/src/main/samples/ws/hello_world/README.txt
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/distribution/src/main/samples/ws/hello_world/README.txt?rev=417194&r1=417193&r2=417194&view=diff
==============================================================================
--- incubator/yoko/trunk/distribution/src/main/samples/ws/hello_world/README.txt (original)
+++ incubator/yoko/trunk/distribution/src/main/samples/ws/hello_world/README.txt Mon Jun 26
07:03:06 2006
@@ -1,8 +1,8 @@
 Hello World Demo
-=============================================
+================
 
-Prerequisite
-------------
+Prerequisites
+=============
 
 If your environment already includes yoko.jar on the
 CLASSPATH, and the JDK and ant bin directories on the PATH
@@ -12,162 +12,203 @@
 javac, and java to build and run the demos, you must include the yoko.jar
 in the CLASSPATH. Also set YOKO_HOME to the installation directory.
 
-This demo allows the user to run 3 use cases.
+Demo Use Cases
+==============
 
-- Yoko client & Yoko server.
+This demo allows the user to run three use cases.
 
-   In this usecase, it is assumed that we have an existing wsdl interface
-and we want to migrate our corba servers & clients to use the web services
-interface. We start by adding a corba binding to the wsdl interface using the wsdltoidl tool.
-Then we add a corba service to this wsdl and use the celtix wsdl2java tool to generate
-java server & client code from this wsdl.
+- Case 1: Web services client & Web services server.
 
-- Yoko client & corba 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 celtix Web services framework and the IIOP protocol is enabled by installing
+the Yoko CORBA binding into celtix.
 
-  In this usecase, we want to access an existing corba server via a web services
-client. So first we use the idl interface of the corba server & use the idltowsdl tool
-to convert the idl to a wsdl with a corba binding & a corba service. Then we can use
the
-celtix wsdl2java tool to generate the client code.
+  Note: celtix is _not_ part of the Yoko product, but a celtix kit is bundled
+with Yoko for convenience of testing and running the Web services demos.
 
-- Corba Client & Yoko Server.
+- Case 2: Web services client & CORBA server.
 
-  In this usecase, we want existing corba clients to access the web service enabled
-corba server. If we have an idl, we can use the idltowsdl to generate the wsdl for our
-server implementation or if we have a wsdl, use the wsdltoidl tool to generate the idl 
-for our client.
+  In this use case, a Web services client talks to a CORBA server through the
+IIOP protocol.  The client, which is implemented using celtix, 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.
 
-Building and running the demo using ant.
-----------------------------------------
+- Case 3: CORBA client & Web services server.
 
-From the samples/ws/hello_world directory, the ant build script
-can be used to build and run the demo.
+  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 celtix, loads the Yoko CORBA binding to enable the IIOP protocol.
 
-Using either UNIX or Windows:
+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.
 
-  ant generate.corba.wsdl
 
-This will add a corba binding to the HelloWorld.wsdl & generate a 
-HelloWorld-corba.wsdl. Add a corba service to this wsdl before proceeding.
+Building the Demo
+=================
 
-<wsdl:service name="HelloWorldCORBAService">
-  <wsdl:port name="HelloWorldCORBAPort" binding="tns:HelloWorldCORBABinding">
-     <corba:address location="corbaloc::localhost:40000/hw" />
-  </wsdl:port>
-</wsdl:service>
+To build the demo code, perform the following steps:
 
-Please make sure that the address location you specify for the service & in the
-Server(yoko/server/Server.java) class matches.  Also ensure that the
-address matches those defined in the corba client (corba/client/Client.java) and 
-server (corba/server/Server.java) classes if you are using the second and
-third use cases.
+1. Open a command prompt and move into the directory <YOKO_HOME>/samples/ws/hello_world
 
-Then run,
+2. Enter the following command (UNIX or Windows):
 
-   ant build
+     ant generate.corba.wsdl
 
-This will use the wsdl2java utility in celtix to generate the server & client code.
-    
+   This command adds a CORBA binding to the samples/ws/resources/HelloWorld.wsdl file,
+   generating an output file, HelloWorld-corba.wsdl.
 
-To remove the code generated from the WSDL file and the .class
-files, run:
+3. Open the HelloWorld-corba.wsdl file using your favorite text editor and add the
+   following service definition in the scope of the wsdl:definitions element:
+  
+   <wsdl:service name="HelloWorldCORBAService">
+     <wsdl:port name="HelloWorldCORBAPort" binding="tns:HelloWorldCORBABinding">
+        <corba:address location="corbaloc::localhost:40000/hw" />
+     </wsdl:port>
+   </wsdl:service>
 
-  ant clean
+   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
+   hello_world/src/yoko/server/Server.java, hello_world/src/corba/server/Server.java and
+   hello_world/src/corba/client/Client.java files.
 
+4. From the samples/ws/hello_world directory, enter the following command (UNIX or Windows):
 
+     ant build
 
-Running the demo (First use case).
-----------------------------------
+  This command uses the celtix wsdl2java utility to generate the server & client code.
 
-From the samples/ws/hello_world directory run the commands, enter on a
-single command line:
 
-We have to set the Xbootclasspath because the ORB classes in yoko conflicts with the jdk
classes.
+Running the Demo - Use Case 1
+=============================
 
-For UNIX (must use forward slashes):
-    java -Xbootclasspath/p:$YOKO_HOME/lib/yoko-core-1.0-incubating-M1-SNAPSHOT.jar 
+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/hello_world
+
+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-core-1.0-incubating-M1-SNAPSHOT.jar 
         -Dceltix.config.file=file:$YOKO_HOME/samples/ws/etc/corba_bus_config.xml
         -classpath $CLASSPATH:build/classes yoko.server.Server &
 
-    java -Xbootclasspath/p:$YOKO_HOME%/lib/yoko-core-1.0-incubating-M1-SNAPSHOT.jar 
-        -Dceltix.config.file=file:$YOKO_HOME/samples/ws/etc/corba_bus_config.xml 
-        -classpath $CLASSPATH:build/classes yoko.client.Client <Name>
-
-The server process starts in the background.  After running the client,
-use the kill command to terminate the server process.
+   Windows (may use either forward or back slashes):
 
-For Windows (may use either forward or back slashes):
-  start 
-    java -Xbootclasspath/p:%YOKO_HOME%\lib\yoko-core-1.0-incubating-M1-SNAPSHOT.jar 
+     start java -Xbootclasspath/p:%YOKO_HOME%\lib\yoko-core-1.0-incubating-M1-SNAPSHOT.jar

         -Dceltix.config.file=file:/%YOKO_HOME%\samples\ws\etc\corba_bus_config.xml
         -classpath %CLASSPATH%;build\classes yoko.server.Server
 
-    java -Xbootclasspath/p:%YOKO_HOME%\lib\yoko-core-1.0-incubating-M1-SNAPSHOT.jar
+  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, substituting <Name> with your name:
+
+   UNIX:
+
+     java -Xbootclasspath/p:$YOKO_HOME/lib/yoko-core-1.0-incubating-M1-SNAPSHOT.jar 
+        -Dceltix.config.file=file:$YOKO_HOME/samples/ws/etc/corba_bus_config.xml 
+        -classpath $CLASSPATH:build/classes yoko.client.Client <Name>
+
+   Windows:
+
+     java -Xbootclasspath/p:%YOKO_HOME%\lib\yoko-core-1.0-incubating-M1-SNAPSHOT.jar
         -Dceltix.config.file=file:/%YOKO_HOME%\samples\ws\etc\corba_bus_config.xml
         -classpath %CLASSPATH%;build\classes yoko.client.Client <Name>
 
-A new command windows opens for the server process.  After running the
-client, terminate the server process by issuing Ctrl-C in its command window.
+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
+=============================
 
-Running the demo (Second use case).
-----------------------------------
+To run the demo for the second use case, perform the following steps:
 
-From the samples/ws/hello_world directory run the commands, enter on a
-single command line:
+1. Open a command prompt and move into the directory <YOKO_HOME>/samples/ws/hello_world
 
-For UNIX (must use forward slashes):
-    java -Xbootclasspath/p:$YOKO_HOME/lib/yoko-core-1.0-incubating-M1-SNAPSHOT.jar 
+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-core-1.0-incubating-M1-SNAPSHOT.jar 
         -classpath $CLASSPATH:build/classes corba.server.Server &
 
-    java -Xbootclasspath/p:$YOKO_HOME%/lib/yoko-core-1.0-incubating-M1-SNAPSHOT.jar 
+   Windows (may use either forward or back slashes):
+
+     start java -Xbootclasspath/p:%YOKO_HOME%\lib\yoko-core-1.0-incubating-M1-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, substituting <Name>
with your name:
+
+   UNIX:
+
+     java -Xbootclasspath/p:$YOKO_HOME/lib/yoko-core-1.0-incubating-M1-SNAPSHOT.jar 
         -Dceltix.config.file=file:$YOKO_HOME/samples/ws/etc/corba_bus_config.xml 
         -classpath $CLASSPATH:build/classes yoko.client.Client <Name>
 
-The server process starts in the background.  After running the client,
-use the kill command to terminate the server process.
-
-For Windows (may use either forward or back slashes):
-  start 
-    java -Xbootclasspath/p:%YOKO_HOME%\lib\yoko-core-1.0-incubating-M1-SNAPSHOT.jar 
-        -classpath %CLASSPATH%;build\classes corba.server.Server
+   Windows:
 
-    java -Xbootclasspath/p:%YOKO_HOME%\lib\yoko-core-1.0-incubating-M1-SNAPSHOT.jar
+     java -Xbootclasspath/p:%YOKO_HOME%\lib\yoko-core-1.0-incubating-M1-SNAPSHOT.jar
         -Dceltix.config.file=file:/%YOKO_HOME%\samples\ws\etc\corba_bus_config.xml
         -classpath %CLASSPATH%;build\classes yoko.client.Client <Name>
 
-A new command windows opens for the server process.  After running the
-client, terminate the server process by issuing Ctrl-C in its command window.
+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:
 
-Running the demo (Third use case).
-----------------------------------
+1. Open a command prompt and move into the directory <YOKO_HOME>/samples/ws/hello_world
 
-From the samples/ws/hello_world directory run the commands, enter on a
-single command line:
+2. Enter the following command to start the Web services server (on a single command line):
 
-For UNIX (must use forward slashes):
-    java -Xbootclasspath/p:$YOKO_HOME/lib/yoko-core-1.0-incubating-M1-SNAPSHOT.jar 
+   UNIX (must use forward slashes):
+
+     java -Xbootclasspath/p:$YOKO_HOME/lib/yoko-core-1.0-incubating-M1-SNAPSHOT.jar 
         -Dceltix.config.file=file:$YOKO_HOME/samples/ws/etc/corba_bus_config.xml
         -classpath $CLASSPATH:build/classes yoko.server.Server &
 
-    java -Xbootclasspath/p:$YOKO_HOME%/lib/yoko-core-1.0-incubating-M1-SNAPSHOT.jar 
-        -classpath $CLASSPATH:build/classes corba.client.Client <Name>
+   Windows (may use either forward or back slashes):
 
-The server process starts in the background.  After running the client,
-use the kill command to terminate the server process.
-
-For Windows (may use either forward or back slashes):
-  start 
-    java -Xbootclasspath/p:%YOKO_HOME%\lib\yoko-core-1.0-incubating-M1-SNAPSHOT.jar 
+     start java -Xbootclasspath/p:%YOKO_HOME%\lib\yoko-core-1.0-incubating-M1-SNAPSHOT.jar

         -Dceltix.config.file=file:/%YOKO_HOME%\samples\ws\etc\corba_bus_config.xml
         -classpath %CLASSPATH%;build\classes yoko.server.Server
 
-    java -Xbootclasspath/p:%YOKO_HOME%\lib\yoko-core-1.0-incubating-M1-SNAPSHOT.jar
+  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, substituting <Name> with
your name:
+
+   UNIX:
+
+     java -Xbootclasspath/p:$YOKO_HOME/lib/yoko-core-1.0-incubating-M1-SNAPSHOT.jar 
+        -classpath $CLASSPATH:build/classes corba.client.Client <Name>
+
+   Windows:
+
+     java -Xbootclasspath/p:%YOKO_HOME%\lib\yoko-core-1.0-incubating-M1-SNAPSHOT.jar
         -classpath %CLASSPATH%;build\classes corba.client.Client <Name>
 
-A new command windows opens for the server process.  After running the
-client, terminate the server process by issuing Ctrl-C in its command window.
+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:

Modified: incubator/yoko/trunk/distribution/src/main/samples/ws/hello_world/src/corba/server/Server.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/distribution/src/main/samples/ws/hello_world/src/corba/server/Server.java?rev=417194&r1=417193&r2=417194&view=diff
==============================================================================
--- incubator/yoko/trunk/distribution/src/main/samples/ws/hello_world/src/corba/server/Server.java
(original)
+++ incubator/yoko/trunk/distribution/src/main/samples/ws/hello_world/src/corba/server/Server.java
Mon Jun 26 07:03:06 2006
@@ -34,15 +34,15 @@
 
 public class Server {
     static int run(ORB orb, String[] args) throws UserException {
-	// Resolve Root POA
-	POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
+        // Resolve Root POA
+        POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
 
-	// Get a reference to the POA manager
-	POAManager manager = rootPOA.the_POAManager();
+        // Get a reference to the POA manager
+        POAManager manager = rootPOA.the_POAManager();
 
-	// Create implementation object
-	HelloWorldImpl hwImpl = new HelloWorldImpl(rootPOA);
-	HelloWorld hello = hwImpl._this(orb);
+        // Create implementation object
+        HelloWorldImpl hwImpl = new HelloWorldImpl(rootPOA);
+        HelloWorld hello = hwImpl._this(orb);
 
         // Add reference to the boot manager
         try {
@@ -56,11 +56,12 @@
             throw new RuntimeException();
         }
 
-	// Run implementation
-	manager.activate();
-	orb.run();
+        // Run implementation
+        manager.activate();
+        System.out.println("Server ready...");
+        orb.run();
 
-	return 0;
+        return 0;
     }
 
     public static void main(String args[]) {
@@ -68,30 +69,30 @@
         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", "HelloWorld-Server");
+        props.put("yoko.orb.id", "HelloWorld-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;
+        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;
-	    }
-	}
+        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);
+        System.exit(status);
     }
 }



Mime
View raw message