commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Hammant <Paul_Hamm...@yahoo.com>
Subject Re: AltRMI chat (was: [OT] J2EE considered harmful)
Date Fri, 01 Feb 2002 16:47:47 GMT
Paulo,

 >Moving this to the Commons. Please reply only in the commons-dev list.
 >
 >Sorry Paul, I meant AspectJ.
 >
 >I do not understand the incompatibility between Dynamic proxies and
 >BeanShell. What is it.
 >
Well unless the interface it is implementing is also in beanshells
classpath, beanshell won't know what the hell the object does.  With
Altrmi the objects are castable, via sleight of hand:

This one implements the functionality and isn usable by beanshell (
getMethods() returns real methods ) without any other classes being in
the Beanshell classpath.  It can narrow to any service anywhere and use
it.  Peter Donald tells me there is a "enable scripting" method that
Rhino likes to see in Java objects, but that's a step away from the
dream IMHO.

public class AltrmiGeneratedPersonFactory_Main implements
org.apache.commons.altrmi.client.AltrmiProxy{
   private transient
org.apache.commons.altrmi.client.impl.BaseServedObject mBaseServedObject;
   public AltrmiGeneratedPersonFactory_Main
(org.apache.commons.altrmi.client.impl.BaseServedObject baseServedObject) {
       mBaseServedObject = baseServedObject;
   }
   public org.enterpriseobjectbroker.examples.example1.interfaces.Person
newPerson () {
     Object[] args = new Object[0];
     try {
       Object retVal =
mBaseServedObject.altrmiProcessObjectRequestGettingFacade("newPerson()",args,"org$enterpriseobjectbroker$examples$example1$interfaces$Person");
       return
(org.enterpriseobjectbroker.examples.example1.interfaces.Person) retVal;
     } catch (Throwable t) {
       if (t instanceof RuntimeException) {
         throw (RuntimeException) t;
       } else if (t instanceof Error) {
         throw (Error) t;
       } else {
         throw new
org.apache.commons.altrmi.common.AltrmiInvocationException("Should never
get here" + t.getMessage());
       }
     }
   }
}

This one extends the first and allows it to be cast and used nearly
perfectly on the client side by a true Java application (rather than a
scripting env).

public final class AltrmiGenerated2PersonFactory_Main extends
AltrmiGeneratedPersonFactory_Main implements
org.enterpriseobjectbroker.examples.example1.interfaces.PersonFactory {
   public AltrmiGenerated2PersonFactory_Main
(org.apache.commons.altrmi.client.impl.BaseServedObject baseServedObject) {
       super(baseServedObject);
   }
}

 >Did you try pnuts? I already found a documented way to run a pnuts
 >compiled class, although it demands the presence of some Runtime
 >support classes.
 >
 >Anyway, with pnuts you can generate/compile code in memory.
 >

Actually no, I've not really looked at pnuts beyond its webdocs before,
though it has been mentioned to me.  If it can do the above, then I can
use it.  To be honest, I can leave it till later cos it works now and is
easy to maintain at the moment.  Perfection later.

You interested in joining the EOB effort on sourceforge?  All people are
equal, Apache merit rules etc.  Smart minds required.

Regards,

- Paul H



--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message