Author: antelder
Date: Thu Oct 5 06:13:18 2006
New Revision: 453224
URL: http://svn.apache.org/viewvc?view=rev&rev=453224
Log:
TUSCANY-799, Commit patches from Venkat:
Fix RMI Service and Reference sample so that it can be run over Tuscany Java
SCA Standalone.
Added:
incubator/tuscany/java/samples/sca/helloworld.rmiService/readme.htm
incubator/tuscany/java/samples/sca/helloworld.rmiService/src/main/java/helloworld/HelloWorldRmiServer.java
Removed:
incubator/tuscany/java/samples/sca/helloworld.rmiService/src/test/java/helloworld/HelloWorldTestCase.java
Modified:
incubator/tuscany/java/samples/sca/helloworld.rmiService/pom.xml
incubator/tuscany/java/samples/sca/helloworld.rmiService/src/main/java/helloworld/HelloWorldImpl.java
incubator/tuscany/java/samples/sca/helloworld.rmiService/src/main/java/helloworld/HelloWorldService.java
incubator/tuscany/java/samples/sca/helloworld.rmiService/src/main/resources/META-INF/sca/default.scdl
Modified: incubator/tuscany/java/samples/sca/helloworld.rmiService/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworld.rmiService/pom.xml?view=diff&rev=453224&r1=453223&r2=453224
==============================================================================
--- incubator/tuscany/java/samples/sca/helloworld.rmiService/pom.xml (original)
+++ incubator/tuscany/java/samples/sca/helloworld.rmiService/pom.xml Thu Oct 5
06:13:18 2006
@@ -47,4 +47,20 @@
<scope>test</scope>
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+
<mainClass>helloworld.HelloWorldRmiServer</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
Added: incubator/tuscany/java/samples/sca/helloworld.rmiService/readme.htm
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworld.rmiService/readme.htm?view=auto&rev=453224
==============================================================================
--- incubator/tuscany/java/samples/sca/helloworld.rmiService/readme.htm (added)
+++ incubator/tuscany/java/samples/sca/helloworld.rmiService/readme.htm Thu Oct
5 06:13:18 2006
@@ -0,0 +1,166 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head><!-- Copyright (c) 2005 The Apache Software Foundation or its
licensors, as applicable. 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. -->
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta
http-equiv="Content-Style-Type" content="text/css"><title>Tuscany
+Hello World Web Service Sample</title><!-- LINK rel="stylesheet"
href="ait.css" type="text/css" --><!-- maven -->
+<style type="text/css" media="all">
[EMAIL PROTECTED] url("../../../../css/maven-base.css");
[EMAIL PROTECTED] url("../../../../css/maven-theme.css");
[EMAIL PROTECTED] url("../../../../css/site.css");
+</style><link rel="stylesheet" href="./css/print.css" type="text/css"
media="print"><!-- end maven --></head>
+<body>
+<H1>Tuscany HelloWorld - RMI Service & RMI Reference Samples</H1>
+<H2>Overview</H2>
+<TABLE border="0">
+ <TBODY>
+ <TR>
+ <TD width="100%" valign="top" align="left">This is a
two part sample - RMI Service and RMI Reference. The RMI Service sample
demonstrates how the Tuscany Runtime can be used to host service components as
RMI Services. The RMI Reference sample demonstrates how the Tuscany Runtime
provides RMI client bindings for service components that would like to refer
RMI Servcies.</TD>
+ </TR>
+ </TBODY>
+</TABLE>
+<H2>Location</H2>
+<P>This sample is located in the samples\sca\helloworld.rmiSevice
+and samples\sca\helloworld.rmiSevice directories in the source
+distribution.</P>
+<P>In the binary distribution the samples are available as
+<I> sample-helloworld-rmiService-1.0-incubator-M2-SNAPSHOT.jar and
+sample-helloworld-rmiReference-1.0-incubator-M2-SNAPSHOT.jar</I>
+
+ . If you have downloaded the source and have built Tuscany Java SCA then
these jars would be found in the
+<I>target</I>
+sub-directory of the
+<I>samples/sca/helloworld.rmiSevice</I>
+and
+<I>samples/sca/helloworld.rmiReference</I>
+project directories respectively and also in your Local Maven Repository under
the path
+<I>org/apache/tuscany/samples/sca</I>/
+<I>/helloworld.rmiSevice</I>
+and
+<I>org/apache/tuscany/samples/sca</I>
+/
+<I>/helloworld.rmiReference </I>respectively.<BR></P>
+<H2>Setup<BR>
+</H2>
+<P>1) Download the Tuscany SCA Standalone Host distribution. The standalone
distribution comes in two forms: -<BR>
+ <I> standalone-1.0-incubator-M2-SNAPSHOT-bin.zip </I> and
<I>standalone-1.0-incubator-M2-SNAPSHOT-bin.tar.gz<BR>
+</I>Choose the one that best suits your platform.<BR>
+<BR>2) Extract the contents of this archive file into a local directory say
<I><tuscany
+samples></I>. This will create the following subdirectories with contents
in each: -<BR>
+<I><BR>
+<tuscany samples></I>/boot<I> <BR><tuscany samples></I>/bin<BR>
+<I><tuscany samples></I>/lib
+</P>
+<P>3) Create a sub-directory called 'extension' under <I><tuscany
+samples></I><BR>
+<BR>4) Copy the SCA RMI Extension jar into this sub-directory named
'extension'. This jar can be found in the binary distribution as
<I>rmi-1.0-incubator-M2-SNAPSHOT.jar</I>. Alternative if you have built the
source yourself, then you may find this jar in your local Maven Repository, in
the path
<I>org/apache/tuscany/sca/services/bindings/rmi/1.0-incubator-M2-SNAPSHOT/rmi-1.0-incubator-M2-SNAPSHOT.jar</I>
and also in the <I>target </I>directory of the project
<I>sca/services/bindings/binding.rmi</I>.<BR>
+<BR>5) Create a sub-directory called 'rmiSample' under <I><tuscany
+samples></I>. <BR>
+<BR>6) Copy the
<I>sample-helloworld-rmiService-1.0-incubator-M2-SNAPSHOT.jar</I> and
<I>sample-helloworld-rmiReference-1.0-incubator-M2-SNAPSHOT.jar</I> into this
sub-directory. Look at the section Location above, about locating these
jars.<BR>
+<BR>
+7) <Subject to change> : Copy the cglib-nodep-2.1_3.jar file into the
the <I><tuscany
+samples></I>/boot directory. This jar can be found in your Maven Local
Repository under the path <I>cglib/cglib-nodep/2.1_3. </I></P>
+<P>In summary the following must be your directory structure after doing all
of the above</P>
+<P><I><tuscany samples></I>/boot<I> <BR>
+<tuscany samples></I>/bin<BR>
+<I><tuscany samples></I>/lib<BR>
+<I><tuscany samples></I>/extension<BR>
+<I><tuscany samples></I>/rmiSample
+</P>
+<P></P>
+<H2>Running</H2>
+<P></P>
+<P>1) Open up a commandline window and go to the
+directory <I><tuscany samples></I>. First run the RMI Service Sample as
follows : -<BR>
+<BR>
+<FONT color="purple"><I><tuscany samples></I></FONT><FONT
color="navy">java -jar
+bin/launcher.jar
+rmiSample/sample-helloworld-rmiService-1.0-incubator-M2-SNAPSHOT.jar</FONT><BR>
+<BR>
+On running the RMI Service sample the console will display ....<BR>
+<BR>
+<FONT color="green"> </FONT><FONT color="green" face="Courier New">Service
+Started and Running...<BR>
+Hit ENTER to exit</FONT><BR>
+<BR>2) Open up another commandline window and go to the
+directory <I><tuscany samples></I>. Here, run the RMI Reference sample
as follows : -<BR>
+<FONT color="purple"><I><tuscany samples></I></FONT><FONT
color="navy">java -jar
+bin/launcher.jar
+rmiSample/sample-helloworld-rmiReference-1.0-incubator-M2-SNAPSHOT.jar</FONT></P><P>On
+running the RMI Reference sample the console will display ....</P>
+<P><FONT color="green" face="Courier New">Hello SCA RMI Client - from the SCA
RMI Service</FONT><BR>
+<BR>
+<BR>Thus a component of the <I>HelloWorld RMI Reference</I> Sample
Application running in one SCA Standalone Runtime was able to invoke a service
component <I> </I>hosted as an an RMI service by another SCA Standalone
Runtime that was running the <I>HelloWorld
+RMI Service </I>sample application.<BR>
+<BR>Press 'Enter' key in the console running the RMI Service sample to shut
down that server.</P>
+<H2>Code Overview</H2>
+The source files are physically organized as shown below:<br>
+<table style="text-align: left; width: 100%;" border="1" cellpadding="2"
cellspacing="2"><tbody><tr><td>
+<pre>
+<B><U>RMI Service Sample</U></B>
++---main<br> +---java<br> | +---helloworld
+ HelloWorldService.java
+ HelloWorldImpl.java
+ HelloWorldRmiServer.java
+ +---resources
+ +----META-INF
+ +----sca
+ default.scdl
+
+<U><B>RMI Reference Sample</B><B></B></U>
++---main<BR> +---java<BR> | +---helloworld
+ HelloWorldService.java
+ HelloWorldImpl.java
+ HelloWorldRmiClient.java
+ +---resources
+ +----META-INF
+ +----sca
+ default.scdl</pre></td></tr></tbody></table>
+<B> <BR>RMI Service Sample</B>
+<TABLE border="1">
+ <TBODY>
+ <TR>
+ <TD width="230" valign="top">default.scdl</TD>
+ <TD width="396" valign="top">Defines the assembly of
the Helloworld Server Application with the HelloWorldImpl component defined to
be hosted as an RMI Service under the covers of the SCA Runtime. You will never
notice any APIs in java.rmi.*</TD>
+ </TR>
+ <TR>
+ <TD width="230">HelloWorldService.java</TD>
+ <TD width="396">Defines a HelloWorld service
interface</TD>
+ </TR>
+ <TR>
+ <TD width="230">HelloWorldImpl.java</TD>
+ <TD width="396">Implements the HelloWorldService
interface</TD>
+ </TR>
+ <TR>
+ <TD width="230">HelloWorldRmiServer.java</TD>
+ <TD width="396">Launches the Standalone Tuscany Runtime
with the RMI Server SCA Application loaded and running</TD>
+ </TR>
+ </TBODY>
+</TABLE>
+
+<P><BR>
+<B>RMI Reference Sample</B>
+
+</P>
+
+<TABLE border="1">
+ <TBODY>
+ <TR>
+ <TD width="230" valign="top">default.scdl</TD>
+ <TD width="396" valign="top">Defines the assembly of
the Helloworld
+ Application with the HelloWorldImpl component
referring the a HelloWorld RMI Service</TD>
+ </TR>
+ <TR>
+ <TD width="230">HelloWorldService.java</TD>
+ <TD width="396">Defines a HelloWorld service
interface</TD>
+ </TR>
+ <TR>
+ <TD width="230">HelloWorldImpl.java</TD>
+ <TD width="396">Implements the HelloWorldService
interface. This implementation inturn calls out to the RMI Service under the
covers of the SCA Runtime - i.e. you will never notice any APIs in java.rmi.*
used in this application</TD>
+ </TR>
+ <TR>
+ <TD width="230">HelloWorldRmiClient.java</TD>
+ <TD width="396">Launches the Standalone Tuscany Runtime
with the RMI
+ Client SCA Application loaded and run.</TD>
+ </TR>
+ </TBODY>
+</TABLE>
+</p></body></html>
Modified:
incubator/tuscany/java/samples/sca/helloworld.rmiService/src/main/java/helloworld/HelloWorldImpl.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworld.rmiService/src/main/java/helloworld/HelloWorldImpl.java?view=diff&rev=453224&r1=453223&r2=453224
==============================================================================
---
incubator/tuscany/java/samples/sca/helloworld.rmiService/src/main/java/helloworld/HelloWorldImpl.java
(original)
+++
incubator/tuscany/java/samples/sca/helloworld.rmiService/src/main/java/helloworld/HelloWorldImpl.java
Thu Oct 5 06:13:18 2006
@@ -18,8 +18,6 @@
*/
package helloworld;
-import java.rmi.RemoteException;
-
import org.osoa.sca.annotations.Service;
/**
@@ -29,7 +27,7 @@
public class HelloWorldImpl implements HelloWorldService
{
- public String sayHello(String name) throws RemoteException
+ public String sayHello(String name)
{
return "Hello " + name + " - from the SCA RMI Service";
}
Added:
incubator/tuscany/java/samples/sca/helloworld.rmiService/src/main/java/helloworld/HelloWorldRmiServer.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworld.rmiService/src/main/java/helloworld/HelloWorldRmiServer.java?view=auto&rev=453224
==============================================================================
---
incubator/tuscany/java/samples/sca/helloworld.rmiService/src/main/java/helloworld/HelloWorldRmiServer.java
(added)
+++
incubator/tuscany/java/samples/sca/helloworld.rmiService/src/main/java/helloworld/HelloWorldRmiServer.java
Thu Oct 5 06:13:18 2006
@@ -0,0 +1,38 @@
+/*
+ * 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 helloworld;
+
+
+/**
+ * @author administrator
+ */
+public class HelloWorldRmiServer {
+
+ public static void main(String[] args) {
+ try {
+ System.out.println("Service Started and Running...");
+ System.out.println("Hit ENTER to exit");
+ System.in.read();
+ System.out.println("Server Stopped!");
+ System.exit(0);
+ } catch ( Exception e ) {
+ e.printStackTrace();
+ }
+ }
+}
Modified:
incubator/tuscany/java/samples/sca/helloworld.rmiService/src/main/java/helloworld/HelloWorldService.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworld.rmiService/src/main/java/helloworld/HelloWorldService.java?view=diff&rev=453224&r1=453223&r2=453224
==============================================================================
---
incubator/tuscany/java/samples/sca/helloworld.rmiService/src/main/java/helloworld/HelloWorldService.java
(original)
+++
incubator/tuscany/java/samples/sca/helloworld.rmiService/src/main/java/helloworld/HelloWorldService.java
Thu Oct 5 06:13:18 2006
@@ -18,15 +18,13 @@
*/
package helloworld;
-import java.rmi.Remote;
-import java.rmi.RemoteException;
/**
* This is the business interface of the HelloWorld greetings service.
*/
-public interface HelloWorldService extends Remote {
+public interface HelloWorldService {
- public String sayHello(String name) throws RemoteException ;
+ public String sayHello(String name);
}
Modified:
incubator/tuscany/java/samples/sca/helloworld.rmiService/src/main/resources/META-INF/sca/default.scdl
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworld.rmiService/src/main/resources/META-INF/sca/default.scdl?view=diff&rev=453224&r1=453223&r2=453224
==============================================================================
---
incubator/tuscany/java/samples/sca/helloworld.rmiService/src/main/resources/META-INF/sca/default.scdl
(original)
+++
incubator/tuscany/java/samples/sca/helloworld.rmiService/src/main/resources/META-INF/sca/default.scdl
Thu Oct 5 06:13:18 2006
@@ -21,11 +21,11 @@
xmlns:rmi="http://tuscany.apache.org/xmlns/binding/rmi/1.0-SNAPSHOT"
name="HelloWorldRmiComposite">
- <service name="HelloWorldRmiService">
+ <service name="HelloWorldRmiService">
<interface.java interface="helloworld.HelloWorldService"/>
- <rmi:binding.rmi uri="HelloWorldRmiService" />
+ <rmi:binding.rmi host="localhost" port="1099"
serviceName="HelloWorldRemoteService" />
<reference>HelloWorldServiceComponent</reference>
- </service>
+ </service>
<component name="HelloWorldServiceComponent">
<implementation.java class="helloworld.HelloWorldImpl"/>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]