Venkat,
For solving the issue of interfaces needing to extend java.RMI.Remote
and needing to throw exceptions that extend java.RMI.RemoteException,
would it be possible to code-generate interfaces that are based on
the original POJO interfaces but conform to the RMI rules?

I would expect that EJB 3 has solved a similar problem arising from
its introduction of business interfaces.  Somewhere under the covers
of an EJB3 there must be an RMI-IIOP remote interface that conforms
to the RMI rules and has the same methods as the business interface.
I am guessing that this RMI remote interface is generated from the
business interface, wither as source code or bytecode.  Does anyone
happen to know more about how this works?

  Simon

Venkatakrishnan (JIRA) wrote:

     [ http://issues.apache.org/jira/browse/TUSCANY-467?page=all ]

Venkatakrishnan updated TUSCANY-467:
------------------------------------

    Attachment: binding.rmi.zip
                hellworld-rmi-server.zip
                hellworld-rmi-client.zip

This is my first shot at developing extensions.  I have created a simple RMI 
Binding extension.  Though it works, there are some issues which had to be 
worked around.  I hope to resolve them with the help of the community as my 
induvidual attempts have failed.  Since this is still open for improvments I am 
not attaching the codes for this as a patch.  I have rather attached them as 
project zip files that can be extracted and tried out.  So play around with 
them and suggest if this is useful to have and the areas that need to be taken 
care of.   The issues that I faced have been stated in the sub-heading 'Issues'.

Installation
----------------
You may extract the zip binding.rmi.zip into the java/sca/bindings folder and 
helloworld-rmi-server.zip and helloworld-rmi-client.zip into java/samples/sca 
folders in the Tuscany codebase local to your machine.  These three zips 
contain three projects that have been built locally and hence contain the 
compiled class files.  The eclipse projects have also been generated for these. 
 Hence you my even import these projects into your Eclipse IDE.

sample-helloworld-rmi
----------------------------------
This is a sample to demonstrate rmi bindings for entry points.

1) Go to the sample-helloworld-rmi project directory.  Go to the target/classes 
sub directory within and start the rmiregistry.  Alternatively you may start 
the rmiregistry elsewhere provided the remote interfaces are in the classpath.
2) Run the class helloworld.HelloWorldServer from the helloworld-rmi project

Issues
----------------
- This is not complete in the sense that the interface 
helloworld.HelloWorldService has been modified to extend from java.rmi.Remote 
and the method 'getGreetings' has been modified to throw 
java.rmi.RemoteException.  It is essential for the remote interfaces to have 
this sort of signature.

In real applications I don't think we can ask the application assemblers / developers to modify the service interfaces this way. I have tried several options in trying to maintain the HelloWorldSevice interface as it and generating a Remote interface dynamically using asm and cglib libraries, but none of them allow me to create a java interface that extends from java.rmi.Remote. I hope to be able to achieve this with some help from the community.

sample-helloworldrmiclient
--------------------------------------
This is a sample to demonstrate rmi bindings for external services.

1) Ensure that the HelloWorldServer under sample-helloworld-rmi is up and 
running.
2) Go to the sample-helloworldrmiclient project and run the class 
helloworld.HelloWorldClient with the following JVM arguments
-Djava.security.manager -Djava.security.policy=<location of the java.policy 
file>

There is a sample java.policy file in the target/classes directory of this project.
Issues
---------
- Is it a good idea to load the Security Manger programmatically in the 
'bindings' code or should that be left to application developers to decide.
- Should we also draw a schema for including policy statements in the sca.module file when external services are defined.


Java RMI Binding Extension
--------------------------

        Key: TUSCANY-467
        URL: http://issues.apache.org/jira/browse/TUSCANY-467
    Project: Tuscany
       Type: New Feature


 Components: Java SCA Samples
   Reporter: Venkatakrishnan
   Priority: Minor
Attachments: binding.rmi.zip, hellworld-rmi-client.zip, hellworld-rmi-server.zip

Create Java RMI bindings for Tuscany to enable components to connect to 
external RMI services and also allow components to be exposted as RM services.





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to