You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Peter Donald <pe...@apache.org> on 2001/12/02 07:39:00 UTC

Magic execute adaptor ?

Hi,

Today I just noticed that you could implement a get(String name) method an 
object and access to properties would be routed through that. Unfrotunately I 
had already done a bunch of work to wrap some objects but now that I know 
about get() I am rewriting them to use get. 

Question: Is this documented anywhere ? I didn't notice any documentation and 
some doco would have saved me a bunch of work ... though it could be Ijust 
missed it ;)

However the real question for this mail is - is there an equivelent for 
method calls. For instance I wouldn't mind it at all if you could do 
something like

public Object execute( String name, Object[] params ) {}

and rout method calls in a similar way. So am I in luck ? ;)

BTW I am using this to adapt JMX objects so that I can use them like normal 
beans in the page. Has anyone done something similar to this? Or any other 
sort of management app written using Velocity for the view ?

-- 
Cheers,

Pete

------------------------------------------------------
 Mark Twain: "In the real world, the right thing never
happens in the right place at the right time. It is 
the task of journalists and historians to rectify 
this error."
------------------------------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by Peter Donald <pe...@apache.org>.
On Mon, 3 Dec 2001 09:29, Dan Bachelder wrote:
> I guess I am missing something, but can't you do this now?

I don't think so - but I never claimed to be an expert on the 
matter;)

> $dateUtilObject.parseDate($dob) ## .parseDate(Date date)

Doesn't this just call the parseDate(Date) method on the object bound to 
dateUtilObject.

-- 
Cheers,

Pete

-------------------------------------------------------
To fight and conquer in all your battles is not supreme 
excellence; supreme excellence consists in breaking the 
enemy's resistance without fighting. - Sun Tzu, 300 B.C.
-------------------------------------------------------


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Magic execute adaptor ?

Posted by Paulo Gaspar <pa...@krankikom.de>.
Nick, answer follows a bit of your mail...

> -----Original Message-----
> From: Nick Bauman [mailto:nick@cortexity.com]
> Sent: Monday, December 03, 2001 3:49 PM
>
> ...
>
> Peace brutha! Sorry I came across so ... But yeah, I know what you want.
> Geir sums it up right up there, or doesn't he? You want a _language
> extension_ to support mapping an arbitrary method call to a single method,
> that takes as an argument the method name in the template as a string.
>
> And for Geir to let you do that he has to add something to Velocity.
> (something dubious, IMO) That's cool. I just think you could do something
> very close to this with a Visitor without extending the language.
>
> http://rampages.onramp.net/~huston/dp/visitor.html


Actually, it is nor really a language extension, it is quite simple and has
other advantages, including easier test of new alternatives for caching,
introspection and so.

I append to this mail a previous posting I made on this thread that
presents a simple enough solution.


Have fun,
Paulo Gaspar

http://www.krankikom.de
http://www.ruhronline.de

> -----Original Message-----
> From: Paulo Gaspar [mailto:paulo.gaspar@krankikom.de]
> Sent: Sunday, December 02, 2001 5:10 PM
> To: Velocity Users List
> Subject: RE: Magic execute adaptor ?
>
>
> This triggers again that old subject:
>  - Pluggable introspection.
>
> There are 3 places where I miss it a bit:
>  (1) #foreach
>  (2) property introspection
>  (3) Method introspection
>
> In my case I miss them because
>  (1) I have another interface (a ResultSet Cursor) that I would
>      like to iterate trough;
>  (2) I would like properties to be case insensitive;
>  (3) I would like methods to be case insensitive.
>
> OF COURSE that I do not want Velocity to support my specific wishes.
> But I would like to be able to customize it to do it without
> customizing its source code.
>
> Peter is probably in the same situation.
>
>
> While working in my configuration system (BTW, I derivative of
> Peter's work in Avalon + Ant-Myrmidon-proposal) I used a common
> interface called IRecord to wrap beans. I also used it to wrap
> database ResultSets.
>
> The interesting bit of it is the use of a common introspection
> interface (IRecordIntrospector) that introspects some object and
> builds an object with type information (of a class implementing an
> IRecordTypeInfo interface) that can be used to access the
> introspector object.
>
> The idea sounds complex but the implementation was surprisingly
> simple and almost bug free at the first time.
>
>
> In Velocity's case, pluggable introspection could be implemented
> using interfaces like these:
>
>     interface IBeanIntrospector
>     {
>         IBeanTypeInfo introspect(Object bean);
>     }
>
>
>     interface IBeanTypeInfo
>     {
>         IForeach getForeach(Object bean)
>             throws Exception;
>
>         Object get(Object bean, String propertyName)
>             throws Exception;
>         void   set(Object bean, String propertyName, Object value)
>             throws Exception;
>
>         Object call(Object bean, String methodName, Object[] arguments)
>             throws Exception;
>
>         // And maybe...
>         String toString(Object bean)
>             throws Exception;
>     }
>
>
>     interface IForeach
>     {
>         boolean next();
>         Object  current();
>     }
>
>
> Notice that IBeanIntrospector could hold the introspection cache.
> You can even have an IBeanIntrospector per Context in order to:
>  - Having a "local" introspection cache and avoid synchronization
>    accessing it, while still taking advantage of a 2nd level
>    global introspection cache (just as it is now);
>
>  - Allowing the use of a different introspection algorithm just
>    for a single "run".
>
>
> IForeach might look strange, but it is the interface that makes
> all implementations I have in mind simpler (the current ones +
> ResultSet cursor).
>
>
> I took a look at the code when I first talked about this several
> months ago and I think that this is not very hard to achieve. I
> would like to give it a try, but I still must learn back Velocity
> internals - I don't take a look at the source for some 4 or 5
> months now.
>
>
> What do you think?
>
>
> Have fun,
> Paulo Gaspar
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by Nick Bauman <ni...@cortexity.com>.
> On Mon, 3 Dec 2001 15:42, Nick Bauman wrote:
>> > He wants the following :
>> >
>> >   $foo.bar()
>> >
>> > To map to, in the event there is no public bar() method, a call to
>> >
>> >
>> >   public execute( "bar", null)
>> >
>> > Or something like that.
>>
>> If he wants a magic execute method like what you are saying he should
>> write a class that extends his class that will do that and STICK THAT
>> IN THE CONTEXT.
> 
> I highly recomend that you follow the steps;
> 
> 1. read 
> 2. understand
> 3. reply
> 
> Follow those steps in order and you may not sound so ... 

Peace brutha! Sorry I came across so ... But yeah, I know what you want.
Geir sums it up right up there, or doesn't he? You want a _language
extension_ to support mapping an arbitrary method call to a single method,
that takes as an argument the method name in the template as a string.

And for Geir to let you do that he has to add something to Velocity.
(something dubious, IMO) That's cool. I just think you could do something
very close to this with a Visitor without extending the language.

http://rampages.onramp.net/~huston/dp/visitor.html

> 
>> Incidentally, this is called the Visitor pattern. *sheesh* Old as
>> time!
> 
> oh is it ? hmmmm
> 
> -- 
> Cheers,
> 
> Pete
> 
> ---------------------------------
> I think not; therefore I ain't...
> ---------------------------------
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org> For additional
> commands, e-mail: <ma...@jakarta.apache.org>


-- 
Nick Bauman 
Cortexity Development
Intellectual Process is more important than
Intellectual Property -- you'll see.
http://www.cortexity.com/


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by Peter Donald <pe...@apache.org>.
On Mon, 3 Dec 2001 15:42, Nick Bauman wrote:
> > He wants the following :
> >
> >   $foo.bar()
> >
> > To map to, in the event there is no public bar() method, a call to
> >
> >
> >   public execute( "bar", null)
> >
> > Or something like that.
>
> If he wants a magic execute method like what you are saying he should write
> a class that extends his class that will do that and STICK THAT IN THE
> CONTEXT.

I highly recomend that you follow the steps;

1. read 
2. understand
3. reply

Follow those steps in order and you may not sound so ... 

> Incidentally, this is called the Visitor pattern. *sheesh* Old as time!

oh is it ? hmmmm

-- 
Cheers,

Pete

---------------------------------
I think not; therefore I ain't...
---------------------------------


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by Nick Bauman <ni...@cortexity.com>.
> On 12/2/01 6:03 PM, "Dan Bachelder" <ch...@chowda.net> wrote:
> 
>>> I have an idea for a quick change that will let him solve it for his
>>> own
>> use
>>> easily...  When I quit quibbling with him, I can get some cycles to
>>> code
>> it
>>> :)
>>> 
>> 
>> 
>> I guess i dont understand what needs to change... it seems to me
>> everything he is asking for is available under a different name... are
>> you going to update the under docs to include "operation" everywhere
>> it now says "method" ? :)
>> 
> 
> Hell no. :)
> 
> He wants the following :
> 
>   $foo.bar()
> 
> To map to, in the event there is no public bar() method, a call to
> 
> 
>   public execute( "bar", null)
> 
> Or something like that.

If he wants a magic execute method like what you are saying he should write 
a class that extends his class that will do that and STICK THAT IN THE 
CONTEXT. 

Incidentally, this is called the Visitor pattern. *sheesh* Old as time!

> 
> I am  just going to make it easy for him to write some low level code
> to plug in...
> 
> -- 
> Geir Magnusson Jr.                                    
> geirm@optonline.net System and Software Consulting
> Be a giant.  Take giant steps.  Do giant things...

-- 
Nick Bauman 
Cortexity Development
Intellectual Process is more important than
Intellectual Property -- you'll see.
http://www.cortexity.com/


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/2/01 6:03 PM, "Dan Bachelder" <ch...@chowda.net> wrote:

>> I have an idea for a quick change that will let him solve it for his own
> use
>> easily...  When I quit quibbling with him, I can get some cycles to code
> it
>> :)
>> 
> 
> 
> I guess i dont understand what needs to change... it seems to me everything
> he is asking for is available under a different name... are you going to
> update the under docs to include "operation" everywhere it now says "method"
> ? :)
> 

Hell no. :)

He wants the following :

  $foo.bar()

To map to, in the event there is no public bar() method, a call to


  public execute( "bar", null)

Or something like that.


I am  just going to make it easy for him to write some low level code to
plug in...

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
Be a giant.  Take giant steps.  Do giant things...


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by Dan Bachelder <ch...@chowda.net>.
> I have an idea for a quick change that will let him solve it for his own
use
> easily...  When I quit quibbling with him, I can get some cycles to code
it
> :)
>


I guess i dont understand what needs to change... it seems to me everything
he is asking for is available under a different name... are you going to
update the under docs to include "operation" everywhere it now says "method"
? :)


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/2/01 5:29 PM, "Dan Bachelder" <ch...@chowda.net> wrote:

> I guess I am missing something, but can't you do this now?
> 
> $dateUtilObject.parseDate($dob) ## .parseDate(Date date)
> 
> and
> 
> $dateUtilObject.parseDate() ## .parseDate() //returns current date
> 

Yes, of course.

I think this is going to be material for the next Foster's commercial "How
to speak Austrailian" :)

I think peter needs something called an 'operation', which is different from
a method (bare mapping to the object's methods) or a property, which follows
the beanspec.

I have an idea for a quick change that will let him solve it for his own use
easily...  When I quit quibbling with him, I can get some cycles to code it
:)


> 
>> I have no idea what you are talking about. get() is for property access
>> right? I want to map operations. What you said would map $foo.bar to the
>> results of an operation. Not what I want to do. I want to have operations
>> (that take parameters) accessible via an object so that I could do
> something
>> like
>> 
>> $foo.bar("param")
>> $foo.bar()
>> $foo.baz()
>> $foo.meep(3)
>> 
>> 
>> --
>> Cheers,
>> 
>> Pete
>> 
>> ---------------------------------------------------
>> "If you don't know where you want to go, we'll make
>> sure you get taken."
>> Microsoft ad slogan, translated into Japanese.
>> ---------------------------------------------------
>> 
>> --
>> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>> 
>> 
> 
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
"They that can give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety." - Benjamin Franklin



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by Dan Bachelder <ch...@chowda.net>.
I guess I am missing something, but can't you do this now?

$dateUtilObject.parseDate($dob) ## .parseDate(Date date)

and

$dateUtilObject.parseDate() ## .parseDate() //returns current date



> I have no idea what you are talking about. get() is for property access
> right? I want to map operations. What you said would map $foo.bar to the
> results of an operation. Not what I want to do. I want to have operations
> (that take parameters) accessible via an object so that I could do
something
> like
>
> $foo.bar("param")
> $foo.bar()
> $foo.baz()
> $foo.meep(3)
>
>
> --
> Cheers,
>
> Pete
>
> ---------------------------------------------------
> "If you don't know where you want to go, we'll make
> sure you get taken."
> Microsoft ad slogan, translated into Japanese.
> ---------------------------------------------------
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Magic execute adaptor ?

Posted by Paulo Gaspar <pa...@krankikom.de>.
> I understand that the current interpretation of method is a direct mapping to 
> java Methods but instead of creating a new concept like "operation" wouldn't 
> it be best just to expand Velocitys notion of method to encompass more than 
> java methods - in fact make in encompass all behaviour  thingies? 
> (whether they be java methods, MBean operations, EJB calls, CORBA invocations... )

IMO it is better to keep using the "method" expression.

Currently the thing we call method is mapped to a method. In the future, if this
stuff gets implemented, it will still usually be mapped to a method. Even in your
case (MBEANs) it will usually end up being mapped to a method, although in a not
so direct way.

"Method" is something straightforward for a Java programmer and the many of 
Velocity users do not have the kind of "culture" of Avalon users.


One thing I have been learning the hard way is that the best way of getting your
message across is NOT always by being precise. Quite often, if you are a bit 
less concerned with the precision of your speech and more concerned with using a
language that your audience understands, more of your message comes across to 
people that have a different culture and that are not used to you vocabulary.

Maybe you will be committing an imprecision here and there, but if you audience
gets more from what you want to say, maybe it is the best that can be done. 

The fact is that someone from a different "culture" (not less, not more, just 
different), will usually be UNable to understand all you want to transmit - very
often, when it is about technical stuff. They would need to acquire your own 
culture before they do and that is a lengthy process. Besides, maybe they just 
do not want to learn your culture.

It works this way when talking with non programmers, but it is also true when
talking with programmers of a different "culture".

Lets not be so picky about words. It is much more important that we accomplish
something that works better for all of us.


Have fun,
Paulo Gaspar

http://www.krankikom.de
http://www.ruhronline.de
 

> -----Original Message-----
> From: Peter Donald [mailto:peter@apache.org]
> Sent: Monday, December 03, 2001 9:09 AM
> To: Velocity Users List
> Subject: Re: Magic execute adaptor ?
> 
> 
> On Mon, 3 Dec 2001 13:35, Geir Magnusson Jr. wrote:
> > On 12/2/01 9:11 PM, "Peter Donald" <pe...@apache.org> wrote:
> > > On Mon, 3 Dec 2001 09:55, Geir Magnusson Jr. wrote:
> > >>> I want to map operations. What you said would map $foo.bar to the
> > >>> results of an operation. Not what I want to do. I want to have
> > >>> operations (that take parameters) accessible via an object so that I
> > >>> could do something like
> > >>>
> > >>> $foo.bar("param")
> > >>> $foo.bar()
> > >>> $foo.baz()
> > >>> $foo.meep(3)
> > >>
> > >> Ok - we can call this "Milestone 1" as its clear you want to 
> add a new
> > >> notion, called an 'operation' right?
> > >
> > > Actually I would use the term "method" because that is altimately what
> > > they map to .. but if you want a generic term then go for "behaviour"
> >
> > No, as I tried to explain, we already have a notion of invoking 
> a method,
> > and you are asking for something different here...
> 
> I understand that the current interpretation of method is a 
> direct mapping to 
> java Methods but instead of creating a new concept like 
> "operation" wouldn't 
> it be best just to expand Velocitys notion of method to encompass 
> more than 
> java methods - in fact make in encompass all behaviour  thingies? 
> (whether 
> they be java methods, MBean operations, EJB calls, CORBA invocations ... )
> 
> -- 
> Cheers,
> 
> Pete
> 
> *------------------------------------------------------*
> | "Nearly all men can stand adversity, but if you want |
> | to test a man's character, give him power."          |
> |       -Abraham Lincoln                               |
> *------------------------------------------------------*
> 
> 
> --
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by Peter Donald <pe...@apache.org>.
On Mon, 3 Dec 2001 13:35, Geir Magnusson Jr. wrote:
> On 12/2/01 9:11 PM, "Peter Donald" <pe...@apache.org> wrote:
> > On Mon, 3 Dec 2001 09:55, Geir Magnusson Jr. wrote:
> >>> I want to map operations. What you said would map $foo.bar to the
> >>> results of an operation. Not what I want to do. I want to have
> >>> operations (that take parameters) accessible via an object so that I
> >>> could do something like
> >>>
> >>> $foo.bar("param")
> >>> $foo.bar()
> >>> $foo.baz()
> >>> $foo.meep(3)
> >>
> >> Ok - we can call this "Milestone 1" as its clear you want to add a new
> >> notion, called an 'operation' right?
> >
> > Actually I would use the term "method" because that is altimately what
> > they map to .. but if you want a generic term then go for "behaviour"
>
> No, as I tried to explain, we already have a notion of invoking a method,
> and you are asking for something different here...

I understand that the current interpretation of method is a direct mapping to 
java Methods but instead of creating a new concept like "operation" wouldn't 
it be best just to expand Velocitys notion of method to encompass more than 
java methods - in fact make in encompass all behaviour  thingies? (whether 
they be java methods, MBean operations, EJB calls, CORBA invocations ... )

-- 
Cheers,

Pete

*------------------------------------------------------*
| "Nearly all men can stand adversity, but if you want |
| to test a man's character, give him power."          |
|       -Abraham Lincoln                               |
*------------------------------------------------------*


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/2/01 9:11 PM, "Peter Donald" <pe...@apache.org> wrote:

> On Mon, 3 Dec 2001 09:55, Geir Magnusson Jr. wrote:
>>> I want to map operations. What you said would map $foo.bar to the
>>> results of an operation. Not what I want to do. I want to have operations
>>> (that take parameters) accessible via an object so that I could do
>>> something like
>>> 
>>> $foo.bar("param")
>>> $foo.bar()
>>> $foo.baz()
>>> $foo.meep(3)
>> 
>> Ok - we can call this "Milestone 1" as its clear you want to add a new
>> notion, called an 'operation' right?
> 
> Actually I would use the term "method" because that is altimately what they
> map to .. but if you want a generic term then go for "behaviour"

No, as I tried to explain, we already have a notion of invoking a method,
and you are asking for something different here...

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
Be a giant.  Take giant steps.  Do giant things...


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by Peter Donald <pe...@apache.org>.
On Mon, 3 Dec 2001 09:55, Geir Magnusson Jr. wrote:
> > I want to map operations. What you said would map $foo.bar to the
> > results of an operation. Not what I want to do. I want to have operations
> > (that take parameters) accessible via an object so that I could do
> > something like
> >
> > $foo.bar("param")
> > $foo.bar()
> > $foo.baz()
> > $foo.meep(3)
>
> Ok - we can call this "Milestone 1" as its clear you want to add a new
> notion, called an 'operation' right?

Actually I would use the term "method" because that is altimately what they 
map to .. but if you want a generic term then go for "behaviour"

-- 
Cheers,

Pete

-------------------------------------------------------
To fight and conquer in all your battles is not supreme 
excellence; supreme excellence consists in breaking the 
enemy's resistance without fighting. - Sun Tzu, 300 B.C.
-------------------------------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/2/01 3:24 PM, "Peter Donald" <pe...@apache.org> wrote:

> On Mon, 3 Dec 2001 04:14, Geir Magnusson Jr. wrote:
>> On 12/2/01 11:50 AM, "Peter Donald" <pe...@apache.org> wrote:
>>> On Mon, 3 Dec 2001 03:36, Geir Magnusson Jr. wrote:
>>>> On 12/2/01 11:07 AM, "Peter Donald" <pe...@apache.org> wrote:
>>>>> On Mon, 3 Dec 2001 03:02, Geir Magnusson Jr. wrote:
>>>>>>> Foo.doSomething(String)
>>>>>>> 
>>>>>>> However because the objects I put in the context need to be wrapped
>>>>>>> because their "doSomething()" call actuuaklly looks like
>>>>>>> 
>>>>>>> mBeanServer.invoke( new ObjectName(name),
>>>>>>>                   "doSomething"
>>>>>>>                   new String[] { "java.lang.String" },
>>>>>>>                   new Object[] { "blah" } );
>>>>>>> 
>>>>>>> So I would still like to be able to use the
>>>>>>> 
>>>>>>> $someObject.doSomething("blah")
>>>>>>> 
>>>>>>> notation but it would be translated behind the scenes into above.
>>>>>>> 
>>>>>>> This sort of parrallels retriving propertys and the get() method.
>>>>>> 
>>>>>> And you would modify velocity to do this rather than just wrap your
>>>>>> real object in an adapter?
>>>>> 
>>>>> I would modify Velocity so that I could build a single wrapper object
>>>>> rather than 70 (1 for each different type of bean).
>>>> 
>>>> I don't get this - if you can make one wrapper, why not use that?
>>> 
>>> eh?
>>> 
>>> I have 30 different MBeans, each having different
>>> 
>>>>> You already have support for
>>>>> delegating access to propertys - why do you see it as bad for methods ?
>>>> 
>>>> Because properties are something common to java-ish scripters because of
>>>> the beanspec, and we followed that (to some degree).
>>> 
>>> methods/operations/functions are common to java-ish scripters because of
>>> the beanspec, and we followed that (to some degree).
>>> 
>>>> With methods, I can't see that
>>> 
>>> oh?
>>> 
>>>> $foo.bar
>>> 
>>> Should be $foo.bar()
>> 
>> I'm pretty familiar with the syntax...
> 
> then why did you put the wrong syntax in ? We are talking about operations
> here arent we? At least I am. So $foo.bar() is the right syntax?

There is no such thing, a syntax for 'operations', is you wish to be
pedantic.

There is a syntax for invoking methods

  $foo.<methodname>( [ param ]* )

Which invokes a specific method with the given parameters, if any, on the
object specified.

There is a syntax for accessing properties

  $foo.<propertyname>

Which has it's own contract...

 
>> 
>>>> naturally maps to
>>>> 
>>>>   $foo.execute( magicobject1, magicobject2, new String[], new Object[] {
>>>> "bar" } )
>>> 
>>> this is all hidden inside the delegate. It would actually be equivelent
>>> to
>>> 
>>> $foo.execute("bar");
>> 
>> Neat.  Then I can write those 30 wrapper classes as :
>> 
>> 
>> public UniWrapper
>> {
>>   public Object get( String foo )
>>   {
>>      mbean.execute( foo )
>>   }
>> }
>> 
>> Right?
> 
> I have no idea what you are talking about. get() is for property access
> right?

 get() is a method.

There is no 'magic' methods or holy blessings bestowed upon anything.

If you say

  $foo.get("bar")

Then you invoked a method.  If that fails, Velocity isn't going to
anthropomorphically say "Hmm.  They must have wanted a property, so I am
also going to try  getBar() and isBar()"

See?  It's just a method.

If you say

  $foo.bar

Then you get the value for 'bar'.  It could come from getBar().  It could
come from get("bar").  It could come from isBar().

The point is that you don't know, and it doesn't matter.

> I want to map operations. What you said would map $foo.bar to the
> results of an operation. Not what I want to do. I want to have operations
> (that take parameters) accessible via an object so that I could do something
> like
> 
> $foo.bar("param")
> $foo.bar()
> $foo.baz()
> $foo.meep(3)
> 


Ok - we can call this "Milestone 1" as its clear you want to add a new
notion, called an 'operation' right?

geir

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
"He who throws mud only loses ground." - Fat Albert


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by Peter Donald <pe...@apache.org>.
On Mon, 3 Dec 2001 04:14, Geir Magnusson Jr. wrote:
> On 12/2/01 11:50 AM, "Peter Donald" <pe...@apache.org> wrote:
> > On Mon, 3 Dec 2001 03:36, Geir Magnusson Jr. wrote:
> >> On 12/2/01 11:07 AM, "Peter Donald" <pe...@apache.org> wrote:
> >>> On Mon, 3 Dec 2001 03:02, Geir Magnusson Jr. wrote:
> >>>>> Foo.doSomething(String)
> >>>>>
> >>>>> However because the objects I put in the context need to be wrapped
> >>>>> because their "doSomething()" call actuuaklly looks like
> >>>>>
> >>>>> mBeanServer.invoke( new ObjectName(name),
> >>>>>                   "doSomething"
> >>>>>                   new String[] { "java.lang.String" },
> >>>>>                   new Object[] { "blah" } );
> >>>>>
> >>>>> So I would still like to be able to use the
> >>>>>
> >>>>> $someObject.doSomething("blah")
> >>>>>
> >>>>> notation but it would be translated behind the scenes into above.
> >>>>>
> >>>>> This sort of parrallels retriving propertys and the get() method.
> >>>>
> >>>> And you would modify velocity to do this rather than just wrap your
> >>>> real object in an adapter?
> >>>
> >>> I would modify Velocity so that I could build a single wrapper object
> >>> rather than 70 (1 for each different type of bean).
> >>
> >> I don't get this - if you can make one wrapper, why not use that?
> >
> > eh?
> >
> > I have 30 different MBeans, each having different
> >
> >>> You already have support for
> >>> delegating access to propertys - why do you see it as bad for methods ?
> >>
> >> Because properties are something common to java-ish scripters because of
> >> the beanspec, and we followed that (to some degree).
> >
> > methods/operations/functions are common to java-ish scripters because of
> > the beanspec, and we followed that (to some degree).
> >
> >> With methods, I can't see that
> >
> > oh?
> >
> >> $foo.bar
> >
> > Should be $foo.bar()
>
> I'm pretty familiar with the syntax...

then why did you put the wrong syntax in ? We are talking about operations 
here arent we? At least I am. So $foo.bar() is the right syntax?

>
> >> naturally maps to
> >>
> >>   $foo.execute( magicobject1, magicobject2, new String[], new Object[] {
> >> "bar" } )
> >
> > this is all hidden inside the delegate. It would actually be equivelent
> > to
> >
> > $foo.execute("bar");
>
> Neat.  Then I can write those 30 wrapper classes as :
>
>
> public UniWrapper
> {
>   public Object get( String foo )
>   {
>      mbean.execute( foo )
>   }
> }
>
> Right?

I have no idea what you are talking about. get() is for property access 
right? I want to map operations. What you said would map $foo.bar to the 
results of an operation. Not what I want to do. I want to have operations 
(that take parameters) accessible via an object so that I could do something 
like

$foo.bar("param")
$foo.bar()
$foo.baz()
$foo.meep(3)


-- 
Cheers,

Pete

---------------------------------------------------
"If you don't know where you want to go, we'll make 
sure you get taken." 
Microsoft ad slogan, translated into Japanese.
---------------------------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by Konstantin Priblouda <kp...@yahoo.com>.
> Neat.  Then I can write those 30 wrapper classes as
> :
> 
> 
> public UniWrapper 
> {
>   public Object get( String foo )
>   {
>      mbean.execute( foo )
>   }
> }
> 
> Right?

And this can be done automatically by xdoclet.
Only thing you need to use it is to tag
mbean classes & exposed methods by javadoc tags.

( and of course writing template and subtask for it )

regards,

=====
Konstantin Priblouda ( ko5tik )    Freelance Software developer
< http://www.pribluda.de > < play java games -> http://www.yook.de >
< render charts online -> http://www.pribluda.de/povray/ >

__________________________________________________
Do You Yahoo!?
Buy the perfect holiday gifts at Yahoo! Shopping.
http://shopping.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/2/01 11:50 AM, "Peter Donald" <pe...@apache.org> wrote:

> On Mon, 3 Dec 2001 03:36, Geir Magnusson Jr. wrote:
>> On 12/2/01 11:07 AM, "Peter Donald" <pe...@apache.org> wrote:
>>> On Mon, 3 Dec 2001 03:02, Geir Magnusson Jr. wrote:
>>>>> Foo.doSomething(String)
>>>>> 
>>>>> However because the objects I put in the context need to be wrapped
>>>>> because their "doSomething()" call actuuaklly looks like
>>>>> 
>>>>> mBeanServer.invoke( new ObjectName(name),
>>>>>                   "doSomething"
>>>>>                   new String[] { "java.lang.String" },
>>>>>                   new Object[] { "blah" } );
>>>>> 
>>>>> So I would still like to be able to use the
>>>>> 
>>>>> $someObject.doSomething("blah")
>>>>> 
>>>>> notation but it would be translated behind the scenes into above.
>>>>> 
>>>>> This sort of parrallels retriving propertys and the get() method.
>>>> 
>>>> And you would modify velocity to do this rather than just wrap your real
>>>> object in an adapter?
>>> 
>>> I would modify Velocity so that I could build a single wrapper object
>>> rather than 70 (1 for each different type of bean).
>> 
>> I don't get this - if you can make one wrapper, why not use that?
> 
> eh?
> 
> I have 30 different MBeans, each having different
> 
>>> You already have support for
>>> delegating access to propertys - why do you see it as bad for methods ?
>> 
>> Because properties are something common to java-ish scripters because of
>> the beanspec, and we followed that (to some degree).
> 
> methods/operations/functions are common to java-ish scripters because of the
> beanspec, and we followed that (to some degree).
> 
>> With methods, I can't see that
> 
> oh?
> 
>> $foo.bar
> 
> Should be $foo.bar()

I'm pretty familiar with the syntax...

> 
>> naturally maps to
>> 
>>   $foo.execute( magicobject1, magicobject2, new String[], new Object[] {
>> "bar" } )
> 
> this is all hidden inside the delegate. It would actually be equivelent to
> 
> $foo.execute("bar");

Neat.  Then I can write those 30 wrapper classes as :


public UniWrapper 
{
  public Object get( String foo )
  {
     mbean.execute( foo )
  }
}

Right?
 
  
>> as being something common to designers...
> 
> It is no different from "$foo.bar" mapping to $foo.get("bar") but you do
> that. Most dynamic interface APIs allow something similar to this (including
> the JavaBean spec)
> 
>> I believe I must be missing the point.
> 
> Maybe ;) Or it could be me. You keep talking about wrappers but I think you
> mean something different from me ?

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
"He who throws mud only loses ground." - Fat Albert


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by Peter Donald <pe...@apache.org>.
On Mon, 3 Dec 2001 03:36, Geir Magnusson Jr. wrote:
> On 12/2/01 11:07 AM, "Peter Donald" <pe...@apache.org> wrote:
> > On Mon, 3 Dec 2001 03:02, Geir Magnusson Jr. wrote:
> >>> Foo.doSomething(String)
> >>>
> >>> However because the objects I put in the context need to be wrapped
> >>> because their "doSomething()" call actuuaklly looks like
> >>>
> >>> mBeanServer.invoke( new ObjectName(name),
> >>>                   "doSomething"
> >>>                   new String[] { "java.lang.String" },
> >>>                   new Object[] { "blah" } );
> >>>
> >>> So I would still like to be able to use the
> >>>
> >>> $someObject.doSomething("blah")
> >>>
> >>> notation but it would be translated behind the scenes into above.
> >>>
> >>> This sort of parrallels retriving propertys and the get() method.
> >>
> >> And you would modify velocity to do this rather than just wrap your real
> >> object in an adapter?
> >
> > I would modify Velocity so that I could build a single wrapper object
> > rather than 70 (1 for each different type of bean).
>
> I don't get this - if you can make one wrapper, why not use that?

eh?

I have 30 different MBeans, each having different 

> > You already have support for
> > delegating access to propertys - why do you see it as bad for methods ?
>
> Because properties are something common to java-ish scripters because of
> the beanspec, and we followed that (to some degree).

methods/operations/functions are common to java-ish scripters because of the 
beanspec, and we followed that (to some degree).

> With methods, I can't see that

oh?

> $foo.bar

Should be $foo.bar()

> naturally maps to
>
>   $foo.execute( magicobject1, magicobject2, new String[], new Object[] {
> "bar" } )

this is all hidden inside the delegate. It would actually be equivelent to 

$foo.execute("bar");

> as being something common to designers...

It is no different from "$foo.bar" mapping to $foo.get("bar") but you do 
that. Most dynamic interface APIs allow something similar to this (including 
the JavaBean spec)

> I believe I must be missing the point.

Maybe ;) Or it could be me. You keep talking about wrappers but I think you 
mean something different from me ?

-- 
Cheers,

Pete

"abandon all hope , ye who enter here" - dante, inferno

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/2/01 11:07 AM, "Peter Donald" <pe...@apache.org> wrote:

> On Mon, 3 Dec 2001 03:02, Geir Magnusson Jr. wrote:
>>> Foo.doSomething(String)
>>> 
>>> However because the objects I put in the context need to be wrapped
>>> because their "doSomething()" call actuuaklly looks like
>>> 
>>> mBeanServer.invoke( new ObjectName(name),
>>>                   "doSomething"
>>>                   new String[] { "java.lang.String" },
>>>                   new Object[] { "blah" } );
>>> 
>>> So I would still like to be able to use the
>>> 
>>> $someObject.doSomething("blah")
>>> 
>>> notation but it would be translated behind the scenes into above.
>>> 
>>> This sort of parrallels retriving propertys and the get() method.
>> 
>> And you would modify velocity to do this rather than just wrap your real
>> object in an adapter?
> 
> I would modify Velocity so that I could build a single wrapper object rather
> than 70 (1 for each different type of bean).

I don't get this - if you can make one wrapper, why not use that?


> You already have support for
> delegating access to propertys - why do you see it as bad for methods ?

Because properties are something common to java-ish scripters because of the
beanspec, and we followed that (to some degree).

With methods, I can't see that

$foo.bar 

naturally maps to

  $foo.execute( magicobject1, magicobject2, new String[], new Object[] {
"bar" } )

as being something common to designers...


I believe I must be missing the point.


-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
"They that can give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety." - Benjamin Franklin



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by Peter Donald <pe...@apache.org>.
On Mon, 3 Dec 2001 03:02, Geir Magnusson Jr. wrote:
> > Foo.doSomething(String)
> >
> > However because the objects I put in the context need to be wrapped
> > because their "doSomething()" call actuuaklly looks like
> >
> > mBeanServer.invoke( new ObjectName(name),
> >                   "doSomething"
> >                   new String[] { "java.lang.String" },
> >                   new Object[] { "blah" } );
> >
> > So I would still like to be able to use the
> >
> > $someObject.doSomething("blah")
> >
> > notation but it would be translated behind the scenes into above.
> >
> > This sort of parrallels retriving propertys and the get() method.
>
> And you would modify velocity to do this rather than just wrap your real
> object in an adapter?

I would modify Velocity so that I could build a single wrapper object rather 
than 70 (1 for each different type of bean). You already have support for 
delegating access to propertys - why do you see it as bad for methods ?

-- 
Cheers,

Pete

-------------------------------------------------------------
|  Egoism is the drug that soothes the pain of stupidity.   |
-------------------------------------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/2/01 10:39 AM, "Peter Donald" <pe...@apache.org> wrote:

> On Mon, 3 Dec 2001 00:05, Geir Magnusson Jr. wrote:
>> On 12/2/01 1:39 AM, "Peter Donald" <pe...@apache.org> wrote:
>>> Hi,
>>> 
>>> Today I just noticed that you could implement a get(String name) method
>>> an object and access to properties would be routed through that.
>>> Unfrotunately I had already done a bunch of work to wrap some objects but
>>> now that I know about get() I am rewriting them to use get.
>>> 
>>> Question: Is this documented anywhere ? I didn't notice any documentation
>>> and some doco would have saved me a bunch of work ... though it could be
>>> Ijust missed it ;)
>> 
>> It may be in the user or VTL doc.  I am meaning to update it as it will
>> search out 'isFoo()' as well now.
> 
> damn - must have missed it then ;)
> 
>>> However the real question for this mail is - is there an equivelent for
>>> method calls. For instance I wouldn't mind it at all if you could do
>>> something like
>>> 
>>> public Object execute( String name, Object[] params ) {}
>>> 
>>> and rout method calls in a similar way. So am I in luck ? ;)
>> 
>> How do you mean?
> 
> Well just say I do
> 
> $someObject.doSomething("blah")
> 
> it Will then lookup the method "doSomething" with 1 string parameter on the
> object "someObject". Let say "someObject" was of type Foo then it would
> lookup method
> 
> Foo.doSomething(String)
> 
> However because the objects I put in the context need to be wrapped because
> their "doSomething()" call actuuaklly looks like
> 
> mBeanServer.invoke( new ObjectName(name),
>                   "doSomething"
>                   new String[] { "java.lang.String" },
>                   new Object[] { "blah" } );
> 
> So I would still like to be able to use the
> 
> $someObject.doSomething("blah")
> 
> notation but it would be translated behind the scenes into above.
> 
> This sort of parrallels retriving propertys and the get() method.


And you would modify velocity to do this rather than just wrap your real
object in an adapter?

> 
>>> BTW I am using this to adapt JMX objects so that I can use them like
>>> normal beans in the page. Has anyone done something similar to this? Or
>>> any other sort of management app written using Velocity for the view ?
>> 
>> Look at Xadra in the powered-by page - its some kind of JMX management
>> console product (not free...)
> 
> will do .. bugger about not being free though ... can still ... err ...
> borrow ideas from it hopefully ;)

-- 
Geir Magnusson Jr.                       geirm@optonline.net
System and Software Consulting
You're going to end up getting pissed at your software
anyway, so you might as well not pay for it. Try Open Source.



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by Peter Donald <pe...@apache.org>.
On Mon, 3 Dec 2001 03:16, Konstantin Priblouda wrote:
> > However because the objects I put in the context
> > need to be wrapped because
> > their "doSomething()" call actuuaklly looks like
> >
> > mBeanServer.invoke( new ObjectName(name),
> >                     "doSomething"
> >                     new String[] {
> > "java.lang.String" },
> >                     new Object[] { "blah" } );
> >
> > So I would still like to be able to use the
> >
> > $someObject.doSomething("blah")
>
> And this usage pattern just screams loud:
> "generate those wrapper classes using xdoclet
> automagically"

Doesn't work as the name and type of beans are determined at runtime. So an 
application could add a few methods to it's MBean then re-register it with 
the MBean server and thus the wrapper becomes out of date and so forth.

-- 
Cheers,

Pete

*--------------------------------*
| Every rule has an exception,   |
| except the rule of exceptions. |
*--------------------------------*

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: XDoclet w/ Velocity

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/2/01 5:36 PM, "Mike Williams" <mi...@cortexebusiness.com.au> wrote:

> Geir> What is xdoclet?
> 
> Konstantin> http://www.sourceforge.net/projects/xdoclet
> 
> Geir> That's wild.  I wonder if they would use Velocity for templating :)
> 
> I've been working on just such a thing: an EJB code-generator using
> Velocity.  Unfortunately, my employer wants to keep it in-house at the
> moment, but there's a chance that I might convince them to release it as
> open-source eventually.

That would be cool. Please try.

> 
> My experience so far has been that doing it with Velocity has made for a
> much cleaner, MVC-ish design.  And the templates are considerably more
> readable than the XDoclet equivalents.  Of course, I haven't matched all of
> their functionality yet :-)

Yah,  I know that feeling.  I like generating XML with Velocity because the
control and logic stand out.  Using XSLT, for example, it all becomes a blur
for me.  JSP too, to some degree as well...


-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
"They that can give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety." - Benjamin Franklin



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


XDoclet w/ Velocity

Posted by Mike Williams <mi...@cortexebusiness.com.au>.
  Geir> What is xdoclet?

  Konstantin> http://www.sourceforge.net/projects/xdoclet

  Geir> That's wild.  I wonder if they would use Velocity for templating :)

I've been working on just such a thing: an EJB code-generator using
Velocity.  Unfortunately, my employer wants to keep it in-house at the
moment, but there's a chance that I might convince them to release it as
open-source eventually.

My experience so far has been that doing it with Velocity has made for a
much cleaner, MVC-ish design.  And the templates are considerably more
readable than the XDoclet equivalents.  Of course, I haven't matched all of
their functionality yet :-)

-- 
cheers, Mike

"In the beginning the Universe was created. This has made a lot of people
 very angry and been widely regarded as a bad move."
    -- Douglas Adams


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by Konstantin Priblouda <kp...@yahoo.com>.
> > And javadoc replacement tool also grows up inside
> of
> > this project :)

Well, javadoc makes a lot of silly warnings, 
is memory hog etc. And since there already was
"prettifier", which is in turn a tool
to parse and modify java source code, decision
cam to write replacement to javadoc.

AFAIK, it's called Xjavadoc and is also on 
sourceforge  :)

regards,

=====
Konstantin Priblouda ( ko5tik )    Freelance Software developer
< http://www.pribluda.de > < play java games -> http://www.yook.de >
< render charts online -> http://www.pribluda.de/povray/ >

__________________________________________________
Do You Yahoo!?
Buy the perfect holiday gifts at Yahoo! Shopping.
http://shopping.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/2/01 12:02 PM, "Konstantin Priblouda" <kp...@yahoo.com> wrote:

> 
>> That's wild.  I wonder if they would use Velocity
>> for templating :)
> 
> At the moment not, but with some wrappers it would be
> possible. At the moment there is homegrown
> (and recently refactored) templating solution
> with xml-ish syntax and bunch of "tag support"
> classes tp support all the weird tags and iterators
> ( like:
> <XDt:forAllClassMethods>
> </XDt:forAllClassMethods>
> )

Seems cool. 
 
> And javadoc replacement tool also grows up inside of
> this project :)
> 

?

-- 
Geir Magnusson Jr.     geirm@optonline.net
System and Software Consulting
"Whoever would overthrow the liberty of a nation must begin by subduing the
freeness of speech." - Benjamin Franklin



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by Konstantin Priblouda <kp...@yahoo.com>.
> That's wild.  I wonder if they would use Velocity
> for templating :)

At the moment not, but with some wrappers it would be 
possible. At the moment there is homegrown
(and recently refactored) templating solution
with xml-ish syntax and bunch of "tag support" 
classes tp support all the weird tags and iterators
( like:
<XDt:forAllClassMethods>
</XDt:forAllClassMethods>
)

And javadoc replacement tool also grows up inside of
this project :)

regards,

=====
Konstantin Priblouda ( ko5tik )    Freelance Software developer
< http://www.pribluda.de > < play java games -> http://www.yook.de >
< render charts online -> http://www.pribluda.de/povray/ >

__________________________________________________
Do You Yahoo!?
Buy the perfect holiday gifts at Yahoo! Shopping.
http://shopping.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/2/01 11:48 AM, "Konstantin Priblouda" <kp...@yahoo.com> wrote:

> 
>> What is xdoclet?
> 
> http://www.sourceforge.net/projects/xdoclet
> 
> Basically it is [still] javadoc plugin
> which is usefull to generate all sorts of stuff
> out of javadoc-style tagged java classes.
> 
> Currently it is used for
> ( list may be incomplete :) )
> 
> - generating all the interfaces ( home, remote, some
> utility objects ) and deployment descriptors for EJB
> out of abstract bean class
> 
> - generating struts forms out of the same abstract
> beans
> 
> - apache soap descriptors
> 
> - struts acton mappings
> 
> - castor stuff
> 
> And whatever else through custom templates.
> 
> This lists grows every day, so I lost track on what
> else it can do besides
> my daily usage of it ( generating EJB/struts stuff )

That's wild.  I wonder if they would use Velocity for templating :)

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
"He who throws mud only loses ground." - Fat Albert


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by Konstantin Priblouda <kp...@yahoo.com>.
> What is xdoclet?

http://www.sourceforge.net/projects/xdoclet

Basically it is [still] javadoc plugin
which is usefull to generate all sorts of stuff
out of javadoc-style tagged java classes. 

Currently it is used for
( list may be incomplete :) )

- generating all the interfaces ( home, remote, some
utility objects ) and deployment descriptors for EJB
out of abstract bean class

- generating struts forms out of the same abstract 
beans

- apache soap descriptors

- struts acton mappings

- castor stuff

And whatever else through custom templates.

This lists grows every day, so I lost track on what
else it can do besides
my daily usage of it ( generating EJB/struts stuff )

regards,

=====
Konstantin Priblouda ( ko5tik )    Freelance Software developer
< http://www.pribluda.de > < play java games -> http://www.yook.de >
< render charts online -> http://www.pribluda.de/povray/ >

__________________________________________________
Do You Yahoo!?
Buy the perfect holiday gifts at Yahoo! Shopping.
http://shopping.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/2/01 11:16 AM, "Konstantin Priblouda" <kp...@yahoo.com> wrote:

> 
>> However because the objects I put in the context
>> need to be wrapped because
>> their "doSomething()" call actuuaklly looks like
>> 
>> mBeanServer.invoke( new ObjectName(name),
>>                     "doSomething"
>>                     new String[] {
>> "java.lang.String" },
>>                     new Object[] { "blah" } );
>> 
>> So I would still like to be able to use the
>> 
>> $someObject.doSomething("blah")
> 
> And this usage pattern just screams loud:
> "generate those wrapper classes using xdoclet
> automagically"
> 

What is xdoclet?

-- 
Geir Magnusson Jr.                       geirm@optonline.net
System and Software Consulting
You're going to end up getting pissed at your software
anyway, so you might as well not pay for it. Try Open Source.



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by Konstantin Priblouda <kp...@yahoo.com>.
> However because the objects I put in the context
> need to be wrapped because 
> their "doSomething()" call actuuaklly looks like
> 
> mBeanServer.invoke( new ObjectName(name), 
>                     "doSomething"
>                     new String[] {
> "java.lang.String" }, 
>                     new Object[] { "blah" } );
> 
> So I would still like to be able to use the 
> 
> $someObject.doSomething("blah")

And this usage pattern just screams loud:
"generate those wrapper classes using xdoclet
automagically"


regards,

=====
Konstantin Priblouda ( ko5tik )    Freelance Software developer
< http://www.pribluda.de > < play java games -> http://www.yook.de >
< render charts online -> http://www.pribluda.de/povray/ >

__________________________________________________
Do You Yahoo!?
Buy the perfect holiday gifts at Yahoo! Shopping.
http://shopping.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by Peter Donald <pe...@apache.org>.
On Mon, 3 Dec 2001 00:05, Geir Magnusson Jr. wrote:
> On 12/2/01 1:39 AM, "Peter Donald" <pe...@apache.org> wrote:
> > Hi,
> >
> > Today I just noticed that you could implement a get(String name) method
> > an object and access to properties would be routed through that.
> > Unfrotunately I had already done a bunch of work to wrap some objects but
> > now that I know about get() I am rewriting them to use get.
> >
> > Question: Is this documented anywhere ? I didn't notice any documentation
> > and some doco would have saved me a bunch of work ... though it could be
> > Ijust missed it ;)
>
> It may be in the user or VTL doc.  I am meaning to update it as it will
> search out 'isFoo()' as well now.

damn - must have missed it then ;)

> > However the real question for this mail is - is there an equivelent for
> > method calls. For instance I wouldn't mind it at all if you could do
> > something like
> >
> > public Object execute( String name, Object[] params ) {}
> >
> > and rout method calls in a similar way. So am I in luck ? ;)
>
> How do you mean?

Well just say I do

$someObject.doSomething("blah")

it Will then lookup the method "doSomething" with 1 string parameter on the 
object "someObject". Let say "someObject" was of type Foo then it would 
lookup method

Foo.doSomething(String)

However because the objects I put in the context need to be wrapped because 
their "doSomething()" call actuuaklly looks like

mBeanServer.invoke( new ObjectName(name), 
                    "doSomething"
                    new String[] { "java.lang.String" }, 
                    new Object[] { "blah" } );

So I would still like to be able to use the 

$someObject.doSomething("blah")

notation but it would be translated behind the scenes into above.

This sort of parrallels retriving propertys and the get() method.

> > BTW I am using this to adapt JMX objects so that I can use them like
> > normal beans in the page. Has anyone done something similar to this? Or
> > any other sort of management app written using Velocity for the view ?
>
> Look at Xadra in the powered-by page - its some kind of JMX management
> console product (not free...)

will do .. bugger about not being free though ... can still ... err ... 
borrow ideas from it hopefully ;)

-- 
Cheers,

Pete

--------------------------------------------
 Beer is proof that God loves us and wants 
 us to be happy. -- Benjamin Franklin
--------------------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Magic execute adaptor ?

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/2/01 1:39 AM, "Peter Donald" <pe...@apache.org> wrote:

> Hi,
> 
> Today I just noticed that you could implement a get(String name) method an
> object and access to properties would be routed through that. Unfrotunately I
> had already done a bunch of work to wrap some objects but now that I know
> about get() I am rewriting them to use get.
> 
> Question: Is this documented anywhere ? I didn't notice any documentation and
> some doco would have saved me a bunch of work ... though it could be Ijust
> missed it ;)
>

It may be in the user or VTL doc.  I am meaning to update it as it will
search out 'isFoo()' as well now.
 
> However the real question for this mail is - is there an equivelent for
> method calls. For instance I wouldn't mind it at all if you could do
> something like
> 
> public Object execute( String name, Object[] params ) {}
> 
> and rout method calls in a similar way. So am I in luck ? ;)

How do you mean?

You could always call

$foo.execute("woogie", $array )


note that Velocity can create ArrayList objects in VTL :

#set( $arr = [ $foo, $bar, $woogie, 1] )


So you might want to do something like


public Object execute( String, List )

If you want to use the VTL ArrayObject creation

> 
> BTW I am using this to adapt JMX objects so that I can use them like normal
> beans in the page. Has anyone done something similar to this? Or any other
> sort of management app written using Velocity for the view ?

Look at Xadra in the powered-by page - its some kind of JMX management
console product (not free...)


-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
Be a giant.  Take giant steps.  Do giant things...


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>