|
From: Rod J. <rod...@in...> - 2004-07-30 17:38:43
|
I've just written something that I think is rather cool that allows a bean to be written in Groovy yet configured via the full power of Spring Dependency Injection. It also supports reloading if the script changes, preserving existing references. I would like to check this into the sandbox. However, that would mean adding the groovy jar. Personally I'm in favour of adding Groovy anyway, as I think it would be good to be able to use it for tests, even before 1.1 final. Thoughts? R |
|
From: Colin S. <col...@ex...> - 2004-07-30 17:48:06
|
+1 Rod Johnson wrote: >I've just written something that I think is rather cool that allows a bean >to be written in Groovy yet configured via the full power of Spring >Dependency Injection. It also supports reloading if the script changes, >preserving existing references. > >I would like to check this into the sandbox. However, that would mean adding >the groovy jar. Personally I'm in favour of adding Groovy anyway, as I think >it would be good to be able to use it for tests, even before 1.1 final. > >Thoughts? > >R > > > > >------------------------------------------------------- >This SF.Net email is sponsored by OSTG. Have you noticed the changes on >Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, >one more big change to announce. We are now OSTG- Open Source Technology >Group. Come see the changes on the new OSTG site. www.ostg.com >_______________________________________________ >Springframework-developer mailing list >Spr...@li... >https://lists.sourceforge.net/lists/listinfo/springframework-developer > > |
|
From: Colin S. <col...@ex...> - 2004-08-13 18:12:37
|
I thought I replied to this, but looks like I didn't. I'm in favour of this being checked in, including groovy.jar. Colin Rod Johnson wrote: >I've just written something that I think is rather cool that allows a bean >to be written in Groovy yet configured via the full power of Spring >Dependency Injection. It also supports reloading if the script changes, >preserving existing references. > >I would like to check this into the sandbox. However, that would mean adding >the groovy jar. Personally I'm in favour of adding Groovy anyway, as I think >it would be good to be able to use it for tests, even before 1.1 final. > >Thoughts? > >R > > |
|
From: Darren D. <da...@da...> - 2004-08-13 19:17:33
|
On Friday 13 August 2004 19:11, Colin Sampaleanu wrote: > I thought I replied to this you did, on the 30th July :) -- Darren Davison Public Key: http://www.davison.uk.net/pages/key.htm |
|
From: Colin S. <col...@ex...> - 2004-08-13 19:26:31
|
Never mind, I got confused and thought this wasn't checked in, since the package name has changed since Dion's original post about this code. Colin Sampaleanu wrote: > I thought I replied to this, but looks like I didn't. I'm in favour of > this being checked in, including groovy.jar. > > Colin > > > Rod Johnson wrote: > >> I've just written something that I think is rather cool that allows a >> bean >> to be written in Groovy yet configured via the full power of Spring >> Dependency Injection. It also supports reloading if the script changes, >> preserving existing references. >> >> I would like to check this into the sandbox. However, that would mean >> adding >> the groovy jar. Personally I'm in favour of adding Groovy anyway, as >> I think >> it would be good to be able to use it for tests, even before 1.1 final. >> >> Thoughts? >> >> R >> > |
|
From: Ugo C. <ug...@ap...> - 2004-09-30 11:28:12
Attachments:
smime.p7s
|
Il giorno 30/lug/04, alle 19:38, Rod Johnson ha scritto: > I've just written something that I think is rather cool that allows a > bean > to be written in Groovy yet configured via the full power of Spring > Dependency Injection. It also supports reloading if the script changes, > preserving existing references. I am trying to do the same for Javascript (using the Mozilla Rhino interpreter) and I have been able to load a script and instantiate a prototype object (sort of like a class) defined in it. Now I'm trying to set its properties via Spring, but I found a problem in that the Javascript object is seen from Java as an instance of org.mozilla.javascript.Scriptable and doesn't define getter and setter methods for its properties. Thus, AFAIU, Spring isn't able to set its properties using reflection, whereas I suppose a Groovy class does define getters and setters. I am thinking about wrapping the Javascript object in some kind of generated proxy, but before I begin (and I don't even know *where* to begin from), I wanted to ask if someone has any suggestions about this issue. TIA, Ugo -- Ugo Cei - http://beblogging.com/ |
|
From: Rod J. <ro...@in...> - 2004-10-01 20:49:15
|
Ugo Look at the beanshell support, also in the sandbox. This creates an interface from the bean properties, along with an introduction to set the properties. Your introduction could use whatever API to "implement" the setters. Good to meet you at JAOO! Rgds Rod -----Original Message----- From: spr...@li... [mailto:spr...@li...] On Behalf Of Ugo Cei Sent: 30 September 2004 12:28 To: spr...@li... Subject: Re: [Springframework-developer] Groovy/Spring Il giorno 30/lug/04, alle 19:38, Rod Johnson ha scritto: > I've just written something that I think is rather cool that allows a > bean to be written in Groovy yet configured via the full power of > Spring Dependency Injection. It also supports reloading if the script > changes, preserving existing references. I am trying to do the same for Javascript (using the Mozilla Rhino interpreter) and I have been able to load a script and instantiate a prototype object (sort of like a class) defined in it. Now I'm trying to set its properties via Spring, but I found a problem in that the Javascript object is seen from Java as an instance of org.mozilla.javascript.Scriptable and doesn't define getter and setter methods for its properties. Thus, AFAIU, Spring isn't able to set its properties using reflection, whereas I suppose a Groovy class does define getters and setters. I am thinking about wrapping the Javascript object in some kind of generated proxy, but before I begin (and I don't even know *where* to begin from), I wanted to ask if someone has any suggestions about this issue. TIA, Ugo -- Ugo Cei - http://beblogging.com/ |
|
From: Ugo C. <ug...@ap...> - 2004-10-02 08:11:13
Attachments:
smime.p7s
|
Il giorno 01/ott/04, alle 22:46, Rod Johnson ha scritto: > Look at the beanshell support, also in the sandbox. This creates an > interface from the bean properties, along with an introduction to set > the > properties. Your introduction could use whatever API to "implement" the > setters. After asking the experts on the Mozilla list, I have already implemented a solution using the "JavaAdapter" construct from Rhino. But since it's not as transparent as I would like (Javascript beans have to implement a Java interface which declares setters for all properties), I am going to follow your suggestion and then decide what's better. > Good to meet you at JAOO! Ditto! :-) Ugo -- Ugo Cei - http://beblogging.com/ |
|
From: Ugo C. <ug...@ap...> - 2004-10-02 13:07:54
Attachments:
smime.p7s
|
Il giorno 01/ott/04, alle 22:46, Rod Johnson ha scritto: > Look at the beanshell support, also in the sandbox. This creates an > interface from the bean properties, along with an introduction to set > the > properties. Your introduction could use whatever API to "implement" the > setters. I looked at the beanshell support, but I don't think it does what I need, that is to provide a default implementation for property setters, or am I mistaken? Besides, all this AOP stuff is pretty new to me, so for the moment I will stick to the current implementation. Would you be interested in adding it to Spring? The only dependency is Rhino's js.jar (700kB) and I have reimplemented most of the testcases that are there for the Groovy version (but defining beans inline is not supported at the moment). In case you are, what is the accepted procedure? Send the files to this list? Post them to JIRA? Ugo -- Ugo Cei - http://beblogging.com/ |
|
From: Rod J. <ro...@in...> - 2004-10-02 16:49:48
|
Ugo The beanshell support does implement property setters. The problem is that beanshell can only provide a dynamic proxy, implementing one interface at a time. So my solution was to use CGLIB InterfaceMaker (suggested by Chris Nokleberg on the Spring forum) to create an interface of setters for every bean property set on the bean definition, and handle this as an introduction with Spring AOP. This is actually a very generic approach, that allows just about anything to be configured by "virtual dependency injection". As for adding Rhino support, scripting overall will go into core in Spring 1.2. The number of scripting languages is high, so it might be good to have a module for additional language support. So ship with only Groovy and bsh, which are both likely to be used elsewhere in the framework, and have a separate module for Jython, Rhino etc. But definitely, it would be great to have comprehensive scripting support for many languages before 1.2! I would want this support to be consistent. For example, the present approach is designed so that all scripts implement the DynamicScript interface, allowing control over forcible reload, auto reload settings. The present code needs refinement, but I'm fairly happy with the overall approach. I assume you've adopted the consistent approach, as you have most of the test cases passing... If you can send me your Rhino code I'd like to take a look. Unfortunately I'm snowed under for at least the next week, but should be able to look at it sometime this month. R -----Original Message----- From: spr...@li... [mailto:spr...@li...] On Behalf Of Ugo Cei Sent: 02 October 2004 14:07 To: spr...@li... Subject: Re: [Springframework-developer] Groovy/Spring Il giorno 01/ott/04, alle 22:46, Rod Johnson ha scritto: > Look at the beanshell support, also in the sandbox. This creates an > interface from the bean properties, along with an introduction to set > the properties. Your introduction could use whatever API to > "implement" the setters. I looked at the beanshell support, but I don't think it does what I need, that is to provide a default implementation for property setters, or am I mistaken? Besides, all this AOP stuff is pretty new to me, so for the moment I will stick to the current implementation. Would you be interested in adding it to Spring? The only dependency is Rhino's js.jar (700kB) and I have reimplemented most of the testcases that are there for the Groovy version (but defining beans inline is not supported at the moment). In case you are, what is the accepted procedure? Send the files to this list? Post them to JIRA? Ugo -- Ugo Cei - http://beblogging.com/ |