[ 
https://issues.apache.org/jira/browse/TUSCANY-2468?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12612320#action_12612320
 ] 

Jean-Sebastien Delfino commented on TUSCANY-2468:
-------------------------------------------------

I'm not sure about the additional method to get the singleton ORB, or an 
additional ORB provider layer...

How about keeping this simple:

- a single Corba Host pluggability SPI layer

- with just start/stop methods (not exposing the complexity of knowing when or 
how to create the ORB) and add/remove/get Servant methods

- with no parameters or configuration properties which would seem to help at 
first glance but will inevitably make the layer above too aware of the 
differences between the environments (as that code will have to figure what 
parameters to pass or properties to set)

- with no common logic (leaving implementors of Corba Host completely free to 
implement it exactly the way they want)

Basically boiling down to:

public interface CorbaHost {
    void addCorbaService(String uri, Servant corbaService) throws 
CorbaHostException;
    Servant removeCorbaService(String uri) throws CorbaHostException;
    Servant getCorbaService(String uri) throws CorbaHostException;
}

A host-corba-jdk module, for use in an 'unamanaged' J2SE environment, 
containing:

class JDKCorbaHost implements {
    public void addCorbaService(String uri, Servant corbaService) throws 
CorbaHostException { ... }
    public Servant removeCorbaService(String uri) throws CorbaHostException { 
... }
    public Servant getCorbaService(String uri) throws CorbaHostException { ... }
    
    start() { <-- not on the interface, invoked by a ModuleActivator in the 
same package
        ORB.init() ...
    }

    stop() { <-- same here
        orb.shutdown() ...
    }
}

A host-corba-jee module, for use in a 'managed' JEE environment, containing:

class JEECorbaHost {
    public void addCorbaService(String uri, Servant corbaService) throws 
CorbaHostException { ... }
    public Servant removeCorbaService(String uri) throws CorbaHostException { 
... }
    public Servant getCorbaService(String uri) throws CorbaHostException { ... }
    
    start() { <-- not on the interface, invoked by a ModuleActivator in the 
same package
        context.lookup("java:/comp/ORB") ...
    }

    stop() { <-- same here
        unbind the servants we've registered
        we don't want to shutdown the ORB here
    }
}

The use case for this is:
- in a J2SE environment I put host-corba-jdk on my classpath
- in a JEE environment I put host-corba-jee on my classpath
- the rest of the system has absolutely no need to know about the differences 
between the two environments (not even a call a method to say server=true or to 
a create method or having to understand what a port number is or whatever other 
details of the ORB setup)

Now about common utility code in host-corba... Well, we have wonderful 
refactoring tools in our Java dev environments now, so I'd suggest to (1) write 
the best code for the different environments (JDK, JEE, Yoko etc) (2) observe 
what can really be made common, after a complete end to end implementation 
iteration (3) only extract common code then, really if it buys us something, 
and only a minimum of code, to not tie all implementations to a common logic if 
they don't need to.

My experience with trying to come up with common code early in the development 
cycle is that it usually leads to a multiplication of interface layers, 
multiplication of methods to expose the guts of that common code, arguments to 
parameterize the common code behavior, and eventually embarassing ties between 
multiple implementations...

So I'd suggest to do that later, way later :)


> Need a new corba-host-jee module
> --------------------------------
>
>                 Key: TUSCANY-2468
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2468
>             Project: Tuscany
>          Issue Type: Wish
>          Components: Java SCA Misc Binding Extensions
>            Reporter: Jean-Sebastien Delfino
>             Fix For: Java-SCA-Next
>
>
> In addition to host-corba-jdk, I'd like to have a host-corba-jee module for 
> use in a JEE environment.
> That module should just get the ORB to use from JNDI, as follows:
> javax.naming.Context ctx = new javax.naming.InitialContext();
> org.omg.CORBA.ORB orb = 
> (org.omg.CORBA.ORB)javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/ORB"),
>  org.omg.CORBA.ORB.class);
> This should work on all JEE servers, including JEE webapp environments.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to