|
From: Paul G. <pa...@pa...> - 2005-02-19 19:24:17
|
A quick search didn't turn up anything in the archive...has anyone given serious thought to a custom language to replace the XML bean instantiation definitions that seem to be the current standard? |
|
From: jbetancourt <jbe...@co...> - 2005-02-19 20:47:42
|
There is support for scripting. I think it is part of the sandbox. Thus, you can use Beanshell, Groovy, etc. But, not sure if this is meant as a 'custom language' for bean instantiation. ----- Original Message ----- From: "Paul Galbraith" <pa...@pa...> To: <spr...@li...> Sent: Saturday, February 19, 2005 2:23 PM Subject: [Springframework-developer] Custom bean instantiation language? > A quick search didn't turn up anything in the archive...has anyone given > serious thought to a custom language to replace the XML bean > instantiation definitions that seem to be the current standard? > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > |
|
From: Paul G. <pa...@pa...> - 2005-02-20 04:11:03
|
jbetancourt wrote: >There is support for scripting. I think it is part of the sandbox. Thus, >you can use Beanshell, Groovy, etc. > >But, not sure if this is meant as a 'custom language' for bean >instantiation. > > > That might do the trick...can I use a groovy script to wire up my bean factories? >----- Original Message ----- >From: "Paul Galbraith" <pa...@pa...> >To: <spr...@li...> >Sent: Saturday, February 19, 2005 2:23 PM >Subject: [Springframework-developer] Custom bean instantiation language? > > > > >>A quick search didn't turn up anything in the archive...has anyone given >>serious thought to a custom language to replace the XML bean >>instantiation definitions that seem to be the current standard? >> >> >>------------------------------------------------------- >>SF email is sponsored by - The IT Product Guide >>Read honest & candid reviews on hundreds of IT Products from real users. >>Discover which products truly live up to the hype. Start reading now. >>http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click >>_______________________________________________ >>Springframework-developer mailing list >>Spr...@li... >>https://lists.sourceforge.net/lists/listinfo/springframework-developer >> >> >> > > > > >------------------------------------------------------- >SF email is sponsored by - The IT Product Guide >Read honest & candid reviews on hundreds of IT Products from real users. >Discover which products truly live up to the hype. Start reading now. >http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click >_______________________________________________ >Springframework-developer mailing list >Spr...@li... >https://lists.sourceforge.net/lists/listinfo/springframework-developer > > |
|
From: Paul G. <pa...@pa...> - 2005-02-20 17:41:57
|
Paul Galbraith wrote:
> jbetancourt wrote:
>
>> There is support for scripting. I think it is part of the sandbox.
>> Thus,
>> you can use Beanshell, Groovy, etc.
>>
>> But, not sure if this is meant as a 'custom language' for bean
>> instantiation.
>>
>>
>>
> That might do the trick...can I use a groovy script to wire up my bean
> factories?
>
After thinking about this, I doubt scripting is what I'm interested
in...I imagine that any creation of a BeanFactory through a scripting
engine is still ultimately using the documented core Spring API?
I'm more interested in something declarative, such as the XML
declarations that are documented in the online reference...my motivation
for raising the idea is simply that XML isn't a great language to use
for interfacing with people. I was thinking of something more
java-like, such as a bean definition like:
singleton my.package.MyClass my.beannamespace.myBean
(my.beannamespace.myBean2) {
property String stringProperty "string-property";
property my.pacakge.myClass3 my.beannamespace.myBean3;
}
Obviously I haven't put a whole lot of thought into it...just wondering
if the same thing's already been discussed or considered?
|
|
From: Jean-Philippe G. <ga...@ya...> - 2005-02-21 02:29:39
|
(This is an opportunity for me to share my thoughts about the bean factory.)
I think the current XML syntax for the BeanFactory is very verbose. Two years
ago, I developed my own BeanFactory based on Rod Johnson's initial
XmlBeanFactory (before Spring was born). I'm still using this customized
BeanFactory today. First thing I did was to remove extra XML elements that
were always implied by the context (like '<bean>' and '<property>').
So instead of...
<bean name="myBean" class="myclass">
<property name="myProperty>value</property>
</bean>
...I only need...
<myBean class="myclass">
<myProperty>value</myProperty>
</myBean>
This is more readable and much more terse. The price to pay for that: I cannot
have XML grammar validation (such as DTD or Schema) but I see little value in
that (at least, for my own needs). My XML editor can still find errors if my
document is not well-formed.
The second step I took was to add a special syntax for bean references (using
the @ symbol:
So...
<bean name="beanA" class="ClassA"/>
<bean name="beanB" class="ClassB">
<property name="otherBean" beanRef="true">beanA</property>
</bean>
...can be expressed simply as...
<beanA class="ClassA"/>
<beanB class="ClassB">
<otherBean>@beanA</otherBean>
</beanB>
I've added other lightweight syntaxes for lists and maps.
The third major change I did was to allow bean definitions to be overridden by
values specified in other files. In Spring, you would use the
PropertyResourceConfigurer instead to resolve similar (but not all) problems.
For instance, I have the following 3 files:
========base-config.xml (base configuration for the prod):
<beans>
<logger class="com.xyz.Logger">
<file>/var/log/app/log.txt</file>
<level>ERROR</level>
</logger>
<messageMailer class="com.xyz.Mailer">
<smtpHostname>mail.xyz.com</smtpHostName>
<address>ab...@xy...</address>
</messageMailer>
</beans>
========development-environment.xml (overidding for all the developers):
<beans>
<logger>
<level>INFO</level>
</logger>
</beans>
========user.xml (developer specific overriding file):
<beans>
<mailer>
<address>us...@xy...</address>
</mailer>
</beans>
I create the BeanFactory using the 3 files:
//not very accurate but you can get the idea...
BeanDefinitionContainer container = new BeanDefinitionContainer();
container.add(new XmlBeanDefinitionSource("base-config.xml"));
container.add(new XmlBeanDefinitionSource("development-environment.xml"));
container.add(new XmlBeanDefinitionSource("user.xml"));
BeanFactory factory = new BeanFactory(container);
The bean factory (the definition container, in fact) will read the 3 files and
merge property definitions specified in each files. This is very handy when
you need to have multiple levels of configuration. This lets you assemble
configurations in a very flexible manner. I think this is interesting because
an "override file" shares the same syntax (and power) as a regular bean
definition file.
The key to a "custom bean instantiation language" is to keep bean definitions
separated from the BeanFactory. Currently, in Spring,
DefaultListableBeanFactory plays both roles (it's a BeanFactory and a
BeanDefinitionRegistry). Although both interfaces exists in the framework,
they are not used separately.
Having a definition container (or registry) allows the modification of the bean
definitions before they are used by the bean factory. For example, I have a
CommandLineBeanDefinitionOverride class that modifies bean definition based on
command-line arguments.
public class MyMain
{
public static void main(String[] args)
{
BeanDefinitionContainer container = new BeanDefinitionContainer();
container.add(new XmlBeanDefinitionSource("base-config.xml"));
container.add(new XmlBeanDefinitionSource("development-environment.xml"));
container.add(new XmlBeanDefinitionSource("user.xml"));
args = CommandLineBeanDefinitionOverride.processArguments(args, container);
BeanFactory factory = new BeanFactory(container);
...
}
}
I can invoke my java app and change bean values:
$java MyTest --logger +level=DEBUG
I use "--" to specify bean name and "+" to specify property name. This opens
up bean definitions customization beyond XML configuration file.
I'm not totally familiar with the Spring framework and maybe it's already
possible to do everything I've explained above. I just wanted to talk about my
experience about the subject.
Jean-Philippe
--- Paul Galbraith <pa...@pa...> wrote:
> Paul Galbraith wrote:
>
> > jbetancourt wrote:
> >
> >> There is support for scripting. I think it is part of the sandbox.
> >> Thus,
> >> you can use Beanshell, Groovy, etc.
> >>
> >> But, not sure if this is meant as a 'custom language' for bean
> >> instantiation.
> >>
> >>
> >>
> > That might do the trick...can I use a groovy script to wire up my bean
> > factories?
> >
> After thinking about this, I doubt scripting is what I'm interested
> in...I imagine that any creation of a BeanFactory through a scripting
> engine is still ultimately using the documented core Spring API?
>
> I'm more interested in something declarative, such as the XML
> declarations that are documented in the online reference...my motivation
> for raising the idea is simply that XML isn't a great language to use
> for interfacing with people. I was thinking of something more
> java-like, such as a bean definition like:
>
> singleton my.package.MyClass my.beannamespace.myBean
> (my.beannamespace.myBean2) {
> property String stringProperty "string-property";
> property my.pacakge.myClass3 my.beannamespace.myBean3;
> }
>
> Obviously I haven't put a whole lot of thought into it...just wondering
> if the same thing's already been discussed or considered?
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
=====
---------------------------------------
Jean-Philippe Gariépy (ga...@ya...)
"Quand l'appétit va, tout va."
-Obélix
__________________________________
Do you Yahoo!?
Meet the all-new My Yahoo! - Try it today!
http://my.yahoo.com
|
|
From: Cameron B. <ca...@br...> - 2005-02-21 02:38:49
|
> -----Original Message----- > From: spr...@li... > [mailto:spr...@li...] On Behalf > Of Jean-Philippe Gariepy > Sent: Monday, 21 February 2005 12:29 PM > To: spr...@li... > Subject: Re: [Springframework-developer] Custom bean instantiation > language? > > (This is an opportunity for me to share my thoughts about the bean > factory.) --SNIP-- > I've added other lightweight syntaxes for lists and maps. > Can you please share them too. I like the look of this :) Thanks, Cameron |
|
From: Jean-Philippe G. <ga...@ya...> - 2005-02-21 15:47:37
|
I choose the { and } characters for the lists and [ ] for the maps.
So instead of...
<bean id="myBean" class="example.MyClass">
<property name="someList">
<list>
<value>item value</value>
<ref bean="beanReference"/>
</list>
</property>
<property name="someMap">
<map>
<entry key="key1">
<value>value1</value>
</entry>
<entry key="key2">
<value>value2</value>
</entry>
</map>
</property>
</bean>
...I have...
<myBean class="example.MyClass">
<someList>{item value, @beanReference}</someList>
<someMap>[key1=value1, key2=value2]</someMap>
</myBean>
Note that I've allowed bean references to be keys. Hence, the following is
legal:
<myBean class="example.MyClass">
<someList>{item value, @beanReference}</someList>
<someMap>[@beanReference=value1, key2=value2]</someMap>
</myBean>
Of course, when a meta-character (@ , [ ] { } =) is part of the key or value,
an escape character is required:
<myBean class="example.MyClass">
<emailAddresses>{user1\@domain1.com, user2\@domain2.com}</emailAddresses>
</myBean>
Jean-Philippe
--- Cameron Braid <ca...@br...> wrote:
> > -----Original Message-----
> > From: spr...@li...
> > [mailto:spr...@li...] On Behalf
> > Of Jean-Philippe Gariepy
> > Sent: Monday, 21 February 2005 12:29 PM
> > To: spr...@li...
> > Subject: Re: [Springframework-developer] Custom bean instantiation
> > language?
> >
> > (This is an opportunity for me to share my thoughts about the bean
> > factory.)
>
> --SNIP--
>
> > I've added other lightweight syntaxes for lists and maps.
> >
>
> Can you please share them too. I like the look of this :)
>
>
> Thanks,
>
> Cameron
>
=====
---------------------------------------
Jean-Philippe Gariépy (ga...@ya...)
"Quand l'appétit va, tout va."
-Obélix
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail
|
|
From: Martin K. <Mar...@St...> - 2005-02-21 20:13:18
|
Hi developers,
I am still dreaming about Spring supporting contributions
right out of the box. I posted an article in the architectural section
of the forum. I guess I found a quite good and sound implementation.
This is the short form:
1. new contribution tag features the same things bean also does.
<contribution extension-point="extensionPoint id" class="MyClass">
same as bean
</contribution>
2. A extension point is constructed by the application hosting it.
type ExtensionPoint {
//nothing just for identification
//maybe hidden storing of the extension point id for semantic equal
checking
}
3. Add support to the ApplicationContext for pulling the contributions
Object [] successfullInstanciatedContributions=
ApplicationContext.instanciateContributions(ExtensionPoint,
ExtensionPointPolicy);
4. ExtensionPointPolicy is about finishing the init process of a
contribution
since some not hardwired dependencies have to be set by the stakeholder
of the contribution and can not be described within the contribution
definition.
type ExtensionPointPolicy {
boolean isCompatibleContribution(ContributionDefinition);
injectAdditionalDependecies(Object contributionInstance);
}
So loading contributed toolbar actions may look like this:
MyApplication.loadToolBarActions{
Object [] toolBarActions=
applicationContext.instanciateContributions(toolbarActionsExtensionPoint,
new ToolBarActionsExtensionPointPolicy());
}
private class ToolBarActionsExtensionPointPolicy
implements ExtensionPointPolicy {
boolean isCompatibleContribution(ContributionDefinition) {
Class
contributionalType=contributionDefinition.getContributionType();
return contributionalType.isCompatible(ToolBarAction.class);
//no additional checking in this example
}
injectAdditionalDependencies(Object contributionInstance) {
((ToolBarAction)contributionInstance).setEnabled(true); //just to
be scenceless
}
}
Thats all. I guess this can be added quite cleanly. And I would enjoy doing
it myself :-).
It would provide great help I guess. The Spring RPC currently suffering
of the lack of defining contributions and using an extension point
mechanism.
All is described in more detail within the forum article.
Cheers,
Martin (Kersten)
----- Original Message -----
From: "Jean-Philippe Gariepy" <ga...@ya...>
To: <spr...@li...>
Sent: Monday, February 21, 2005 4:47 PM
Subject: RE: [Springframework-developer] Custom bean instantiation language?
>
> I choose the { and } characters for the lists and [ ] for the maps.
>
> So instead of...
>
> <bean id="myBean" class="example.MyClass">
> <property name="someList">
> <list>
> <value>item value</value>
> <ref bean="beanReference"/>
> </list>
> </property>
>
> <property name="someMap">
> <map>
> <entry key="key1">
> <value>value1</value>
> </entry>
> <entry key="key2">
> <value>value2</value>
> </entry>
> </map>
> </property>
> </bean>
>
> ...I have...
>
> <myBean class="example.MyClass">
> <someList>{item value, @beanReference}</someList>
> <someMap>[key1=value1, key2=value2]</someMap>
> </myBean>
>
> Note that I've allowed bean references to be keys. Hence, the following
> is
> legal:
>
> <myBean class="example.MyClass">
> <someList>{item value, @beanReference}</someList>
> <someMap>[@beanReference=value1, key2=value2]</someMap>
> </myBean>
>
> Of course, when a meta-character (@ , [ ] { } =) is part of the key or
> value,
> an escape character is required:
>
> <myBean class="example.MyClass">
> <emailAddresses>{user1\@domain1.com, user2\@domain2.com}</emailAddresses>
> </myBean>
>
> Jean-Philippe
>
> --- Cameron Braid <ca...@br...> wrote:
>
>> > -----Original Message-----
>> > From: spr...@li...
>> > [mailto:spr...@li...] On
>> > Behalf
>> > Of Jean-Philippe Gariepy
>> > Sent: Monday, 21 February 2005 12:29 PM
>> > To: spr...@li...
>> > Subject: Re: [Springframework-developer] Custom bean instantiation
>> > language?
>> >
>> > (This is an opportunity for me to share my thoughts about the bean
>> > factory.)
>>
>> --SNIP--
>>
>> > I've added other lightweight syntaxes for lists and maps.
>> >
>>
>> Can you please share them too. I like the look of this :)
>>
>>
>> Thanks,
>>
>> Cameron
>>
>
>
> =====
> ---------------------------------------
> Jean-Philippe Gariépy (ga...@ya...)
>
> "Quand l'appétit va, tout va."
> -Obélix
>
>
>
> __________________________________
> Do you Yahoo!?
> Read only the mail you want - Yahoo! Mail SpamGuard.
> http://promotions.yahoo.com/new_mail
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
|
|
From: Rob H. <ro...@ca...> - 2005-02-22 14:31:34
|
Couldn't this be done without the <contribution> tag - that is to say
just use the <bean> tag and then do:
ListableBeanFactory.getBeansOfType(Contribution.class);
Then post process them. You could actually add this support as a
BeanFactoryPostProcessor, since all you are really doing is chucking in
some additional dependencies based on the policies.
Applications can then lookup the contributions they want through some
kind of ContributionManager interface.
Basically, I think you can add this support without the need to tweak
the underlying Spring configuration format.
Rob
Martin Kersten wrote:
> Hi developers,
>
> I am still dreaming about Spring supporting contributions
> right out of the box. I posted an article in the architectural section
> of the forum. I guess I found a quite good and sound implementation.
>
> This is the short form:
>
> 1. new contribution tag features the same things bean also does.
>
> <contribution extension-point="extensionPoint id" class="MyClass">
> same as bean
> </contribution>
>
> 2. A extension point is constructed by the application hosting it.
> type ExtensionPoint {
> //nothing just for identification
> //maybe hidden storing of the extension point id for semantic equal
> checking
> }
>
> 3. Add support to the ApplicationContext for pulling the contributions
>
> Object [] successfullInstanciatedContributions=
> ApplicationContext.instanciateContributions(ExtensionPoint,
> ExtensionPointPolicy);
>
> 4. ExtensionPointPolicy is about finishing the init process of a
> contribution
> since some not hardwired dependencies have to be set by the stakeholder
> of the contribution and can not be described within the contribution
> definition.
>
> type ExtensionPointPolicy {
> boolean isCompatibleContribution(ContributionDefinition);
> injectAdditionalDependecies(Object contributionInstance);
> }
>
> So loading contributed toolbar actions may look like this:
> MyApplication.loadToolBarActions{
> Object [] toolBarActions=
>
> applicationContext.instanciateContributions(toolbarActionsExtensionPoint,
> new ToolBarActionsExtensionPointPolicy());
> }
>
> private class ToolBarActionsExtensionPointPolicy
> implements ExtensionPointPolicy {
> boolean isCompatibleContribution(ContributionDefinition) {
> Class
> contributionalType=contributionDefinition.getContributionType();
> return contributionalType.isCompatible(ToolBarAction.class);
> //no additional checking in this example
> }
>
> injectAdditionalDependencies(Object contributionInstance) {
> ((ToolBarAction)contributionInstance).setEnabled(true);
> //just to be scenceless
> }
> }
>
> Thats all. I guess this can be added quite cleanly. And I would enjoy
> doing
> it myself :-).
>
> It would provide great help I guess. The Spring RPC currently suffering
> of the lack of defining contributions and using an extension point
> mechanism.
>
> All is described in more detail within the forum article.
>
>
> Cheers,
>
> Martin (Kersten)
>
> ----- Original Message ----- From: "Jean-Philippe Gariepy"
> <ga...@ya...>
> To: <spr...@li...>
> Sent: Monday, February 21, 2005 4:47 PM
> Subject: RE: [Springframework-developer] Custom bean instantiation
> language?
>
>
>>
>> I choose the { and } characters for the lists and [ ] for the maps.
>>
>> So instead of...
>>
>> <bean id="myBean" class="example.MyClass">
>> <property name="someList">
>> <list>
>> <value>item value</value>
>> <ref bean="beanReference"/>
>> </list>
>> </property>
>>
>> <property name="someMap">
>> <map>
>> <entry key="key1">
>> <value>value1</value>
>> </entry>
>> <entry key="key2">
>> <value>value2</value>
>> </entry>
>> </map>
>> </property>
>> </bean>
>>
>> ...I have...
>>
>> <myBean class="example.MyClass">
>> <someList>{item value, @beanReference}</someList>
>> <someMap>[key1=value1, key2=value2]</someMap>
>> </myBean>
>>
>> Note that I've allowed bean references to be keys. Hence, the
>> following is
>> legal:
>>
>> <myBean class="example.MyClass">
>> <someList>{item value, @beanReference}</someList>
>> <someMap>[@beanReference=value1, key2=value2]</someMap>
>> </myBean>
>>
>> Of course, when a meta-character (@ , [ ] { } =) is part of the key
>> or value,
>> an escape character is required:
>>
>> <myBean class="example.MyClass">
>> <emailAddresses>{user1\@domain1.com,
>> user2\@domain2.com}</emailAddresses>
>> </myBean>
>>
>> Jean-Philippe
>>
>> --- Cameron Braid <ca...@br...> wrote:
>>
>>> > -----Original Message-----
>>> > From: spr...@li...
>>> > [mailto:spr...@li...] On
>>> > Behalf
>>> > Of Jean-Philippe Gariepy
>>> > Sent: Monday, 21 February 2005 12:29 PM
>>> > To: spr...@li...
>>> > Subject: Re: [Springframework-developer] Custom bean instantiation
>>> > language?
>>> >
>>> > (This is an opportunity for me to share my thoughts about the bean
>>> > factory.)
>>>
>>> --SNIP--
>>>
>>> > I've added other lightweight syntaxes for lists and maps.
>>> >
>>>
>>> Can you please share them too. I like the look of this :)
>>>
>>>
>>> Thanks,
>>>
>>> Cameron
>>>
>>
>>
>> =====
>> ---------------------------------------
>> Jean-Philippe Gariépy (ga...@ya...)
>>
>> "Quand l'appétit va, tout va."
>> -Obélix
>>
>>
>>
>> __________________________________
>> Do you Yahoo!?
>> Read only the mail you want - Yahoo! Mail SpamGuard.
>> http://promotions.yahoo.com/new_mail
>>
>>
>> -------------------------------------------------------
>> SF email is sponsored by - The IT Product Guide
>> Read honest & candid reviews on hundreds of IT Products from real users.
>> Discover which products truly live up to the hype. Start reading now.
>> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
>> _______________________________________________
>> Springframework-developer mailing list
>> Spr...@li...
>> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
>
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
>
|
|
From: Martin K. <Mar...@St...> - 2005-02-22 14:50:21
|
> Couldn't this be done without the <contribution> tag - that is to say just
> use the <bean> tag and then do:
> ListableBeanFactory.getBeansOfType(Contribution.class);
Wouldn't you think that would blow up your thinking?
You know a bean is a bean but a contribution is something diffrent.
It's the reverse way. You dont identify a contribution by its name or
id (to abuse id here). It's about I want to take part. It's not I am
what I am. It's a complete diffrent concept.
> Then post process them. You could actually add this support as a
> BeanFactoryPostProcessor, since all you are really doing is chucking in
> some additional dependencies based on the policies.
Would be working in an implementation way but the
descriptive language the xml configuration compose gets malformed.
It is like implementing a List by hacking a provided Set implementation.
Can be done but I wont use it.
> Applications can then lookup the contributions they want through some kind
> of ContributionManager interface.
Would be possible but this is ApplicationContext related stuff so I
would have to change this too.
> Basically, I think you can add this support without the need to tweak the
> underlying Spring configuration format.
It would not be possible because contributions shouldn't have an id or
name.
Let's see how easy it gets. The support wont break the API but
if you are not yet convinced, I guess the main benifit it provides to
the rich client project will do (and adding something like that to
the rich client project does not need to effect the framework API).
Cheers,
Martin (Kersten)
Martin Kersten wrote:
> Hi developers,
>
> I am still dreaming about Spring supporting contributions
> right out of the box. I posted an article in the architectural section
> of the forum. I guess I found a quite good and sound implementation.
>
> This is the short form:
>
> 1. new contribution tag features the same things bean also does.
>
> <contribution extension-point="extensionPoint id" class="MyClass">
> same as bean
> </contribution>
>
> 2. A extension point is constructed by the application hosting it.
> type ExtensionPoint {
> //nothing just for identification
> //maybe hidden storing of the extension point id for semantic equal
> checking
> }
>
> 3. Add support to the ApplicationContext for pulling the contributions
>
> Object [] successfullInstanciatedContributions=
> ApplicationContext.instanciateContributions(ExtensionPoint,
> ExtensionPointPolicy);
>
> 4. ExtensionPointPolicy is about finishing the init process of a
> contribution
> since some not hardwired dependencies have to be set by the stakeholder
> of the contribution and can not be described within the contribution
> definition.
>
> type ExtensionPointPolicy {
> boolean isCompatibleContribution(ContributionDefinition);
> injectAdditionalDependecies(Object contributionInstance);
> }
>
> So loading contributed toolbar actions may look like this:
> MyApplication.loadToolBarActions{
> Object [] toolBarActions=
>
> applicationContext.instanciateContributions(toolbarActionsExtensionPoint,
> new ToolBarActionsExtensionPointPolicy());
> }
>
> private class ToolBarActionsExtensionPointPolicy
> implements ExtensionPointPolicy {
> boolean isCompatibleContribution(ContributionDefinition) {
> Class
> contributionalType=contributionDefinition.getContributionType();
> return contributionalType.isCompatible(ToolBarAction.class);
> //no additional checking in this example
> }
>
> injectAdditionalDependencies(Object contributionInstance) {
> ((ToolBarAction)contributionInstance).setEnabled(true); //just to
> be scenceless
> }
> }
>
> Thats all. I guess this can be added quite cleanly. And I would enjoy
> doing
> it myself :-).
>
> It would provide great help I guess. The Spring RPC currently suffering
> of the lack of defining contributions and using an extension point
> mechanism.
>
> All is described in more detail within the forum article.
>
>
> Cheers,
>
> Martin (Kersten)
>
> ----- Original Message ----- From: "Jean-Philippe Gariepy"
> <ga...@ya...>
> To: <spr...@li...>
> Sent: Monday, February 21, 2005 4:47 PM
> Subject: RE: [Springframework-developer] Custom bean instantiation
> language?
>
>
>>
>> I choose the { and } characters for the lists and [ ] for the maps.
>>
>> So instead of...
>>
>> <bean id="myBean" class="example.MyClass">
>> <property name="someList">
>> <list>
>> <value>item value</value>
>> <ref bean="beanReference"/>
>> </list>
>> </property>
>>
>> <property name="someMap">
>> <map>
>> <entry key="key1">
>> <value>value1</value>
>> </entry>
>> <entry key="key2">
>> <value>value2</value>
>> </entry>
>> </map>
>> </property>
>> </bean>
>>
>> ...I have...
>>
>> <myBean class="example.MyClass">
>> <someList>{item value, @beanReference}</someList>
>> <someMap>[key1=value1, key2=value2]</someMap>
>> </myBean>
>>
>> Note that I've allowed bean references to be keys. Hence, the following
>> is
>> legal:
>>
>> <myBean class="example.MyClass">
>> <someList>{item value, @beanReference}</someList>
>> <someMap>[@beanReference=value1, key2=value2]</someMap>
>> </myBean>
>>
>> Of course, when a meta-character (@ , [ ] { } =) is part of the key or
>> value,
>> an escape character is required:
>>
>> <myBean class="example.MyClass">
>> <emailAddresses>{user1\@domain1.com,
>> user2\@domain2.com}</emailAddresses>
>> </myBean>
>>
>> Jean-Philippe
>>
>> --- Cameron Braid <ca...@br...> wrote:
>>
>>> > -----Original Message-----
>>> > From: spr...@li...
>>> > [mailto:spr...@li...] On
>>> > Behalf
>>> > Of Jean-Philippe Gariepy
>>> > Sent: Monday, 21 February 2005 12:29 PM
>>> > To: spr...@li...
>>> > Subject: Re: [Springframework-developer] Custom bean instantiation
>>> > language?
>>> >
>>> > (This is an opportunity for me to share my thoughts about the bean
>>> > factory.)
>>>
>>> --SNIP--
>>>
>>> > I've added other lightweight syntaxes for lists and maps.
>>> >
>>>
>>> Can you please share them too. I like the look of this :)
>>>
>>>
>>> Thanks,
>>>
>>> Cameron
>>>
>>
>>
>> =====
>> ---------------------------------------
>> Jean-Philippe Gariépy (ga...@ya...)
>>
>> "Quand l'appétit va, tout va."
>> -Obélix
>>
>>
>>
>> __________________________________
>> Do you Yahoo!?
>> Read only the mail you want - Yahoo! Mail SpamGuard.
>> http://promotions.yahoo.com/new_mail
>>
>>
>> -------------------------------------------------------
>> SF email is sponsored by - The IT Product Guide
>> Read honest & candid reviews on hundreds of IT Products from real users.
>> Discover which products truly live up to the hype. Start reading now.
>> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
>> _______________________________________________
>> Springframework-developer mailing list
>> Spr...@li...
>> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
>
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
>
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|
|
From: Rob H. <ro...@ca...> - 2005-02-22 15:24:57
|
I think my understanding is a little skewed. Does the extension point id
match with multiple contributions?
Rob
Martin Kersten wrote:
>> Couldn't this be done without the <contribution> tag - that is to say
>> just use the <bean> tag and then do:
>
>
>> ListableBeanFactory.getBeansOfType(Contribution.class);
>
>
> Wouldn't you think that would blow up your thinking?
> You know a bean is a bean but a contribution is something diffrent.
> It's the reverse way. You dont identify a contribution by its name or
> id (to abuse id here). It's about I want to take part. It's not I am
> what I am. It's a complete diffrent concept.
>
>> Then post process them. You could actually add this support as a
>> BeanFactoryPostProcessor, since all you are really doing is chucking
>> in some additional dependencies based on the policies.
>
>
> Would be working in an implementation way but the
> descriptive language the xml configuration compose gets malformed.
> It is like implementing a List by hacking a provided Set implementation.
> Can be done but I wont use it.
>
>> Applications can then lookup the contributions they want through some
>> kind of ContributionManager interface.
>
>
> Would be possible but this is ApplicationContext related stuff so I
> would have to change this too.
>
>> Basically, I think you can add this support without the need to tweak
>> the underlying Spring configuration format.
>
>
> It would not be possible because contributions shouldn't have an id or
> name.
>
>
> Let's see how easy it gets. The support wont break the API but
> if you are not yet convinced, I guess the main benifit it provides to
> the rich client project will do (and adding something like that to
> the rich client project does not need to effect the framework API).
>
>
> Cheers,
>
> Martin (Kersten)
>
> Martin Kersten wrote:
>
>> Hi developers,
>>
>> I am still dreaming about Spring supporting contributions
>> right out of the box. I posted an article in the architectural section
>> of the forum. I guess I found a quite good and sound implementation.
>>
>> This is the short form:
>>
>> 1. new contribution tag features the same things bean also does.
>>
>> <contribution extension-point="extensionPoint id" class="MyClass">
>> same as bean
>> </contribution>
>>
>> 2. A extension point is constructed by the application hosting it.
>> type ExtensionPoint {
>> //nothing just for identification
>> //maybe hidden storing of the extension point id for semantic equal
>> checking
>> }
>>
>> 3. Add support to the ApplicationContext for pulling the contributions
>>
>> Object [] successfullInstanciatedContributions=
>> ApplicationContext.instanciateContributions(ExtensionPoint,
>> ExtensionPointPolicy);
>>
>> 4. ExtensionPointPolicy is about finishing the init process of a
>> contribution
>> since some not hardwired dependencies have to be set by the stakeholder
>> of the contribution and can not be described within the contribution
>> definition.
>>
>> type ExtensionPointPolicy {
>> boolean isCompatibleContribution(ContributionDefinition);
>> injectAdditionalDependecies(Object contributionInstance);
>> }
>>
>> So loading contributed toolbar actions may look like this:
>> MyApplication.loadToolBarActions{
>> Object [] toolBarActions=
>>
>> applicationContext.instanciateContributions(toolbarActionsExtensionPoint,
>>
>> new ToolBarActionsExtensionPointPolicy());
>> }
>>
>> private class ToolBarActionsExtensionPointPolicy
>> implements ExtensionPointPolicy {
>> boolean isCompatibleContribution(ContributionDefinition) {
>> Class
>> contributionalType=contributionDefinition.getContributionType();
>> return contributionalType.isCompatible(ToolBarAction.class);
>> //no additional checking in this example
>> }
>>
>> injectAdditionalDependencies(Object contributionInstance) {
>> ((ToolBarAction)contributionInstance).setEnabled(true);
>> //just to be scenceless
>> }
>> }
>>
>> Thats all. I guess this can be added quite cleanly. And I would enjoy
>> doing
>> it myself :-).
>>
>> It would provide great help I guess. The Spring RPC currently suffering
>> of the lack of defining contributions and using an extension point
>> mechanism.
>>
>> All is described in more detail within the forum article.
>>
>>
>> Cheers,
>>
>> Martin (Kersten)
>>
>> ----- Original Message ----- From: "Jean-Philippe Gariepy"
>> <ga...@ya...>
>> To: <spr...@li...>
>> Sent: Monday, February 21, 2005 4:47 PM
>> Subject: RE: [Springframework-developer] Custom bean instantiation
>> language?
>>
>>
>>>
>>> I choose the { and } characters for the lists and [ ] for the maps.
>>>
>>> So instead of...
>>>
>>> <bean id="myBean" class="example.MyClass">
>>> <property name="someList">
>>> <list>
>>> <value>item value</value>
>>> <ref bean="beanReference"/>
>>> </list>
>>> </property>
>>>
>>> <property name="someMap">
>>> <map>
>>> <entry key="key1">
>>> <value>value1</value>
>>> </entry>
>>> <entry key="key2">
>>> <value>value2</value>
>>> </entry>
>>> </map>
>>> </property>
>>> </bean>
>>>
>>> ...I have...
>>>
>>> <myBean class="example.MyClass">
>>> <someList>{item value, @beanReference}</someList>
>>> <someMap>[key1=value1, key2=value2]</someMap>
>>> </myBean>
>>>
>>> Note that I've allowed bean references to be keys. Hence, the
>>> following is
>>> legal:
>>>
>>> <myBean class="example.MyClass">
>>> <someList>{item value, @beanReference}</someList>
>>> <someMap>[@beanReference=value1, key2=value2]</someMap>
>>> </myBean>
>>>
>>> Of course, when a meta-character (@ , [ ] { } =) is part of the key
>>> or value,
>>> an escape character is required:
>>>
>>> <myBean class="example.MyClass">
>>> <emailAddresses>{user1\@domain1.com,
>>> user2\@domain2.com}</emailAddresses>
>>> </myBean>
>>>
>>> Jean-Philippe
>>>
>>> --- Cameron Braid <ca...@br...> wrote:
>>>
>>>> > -----Original Message-----
>>>> > From: spr...@li...
>>>> > [mailto:spr...@li...] On
>>>> > Behalf
>>>> > Of Jean-Philippe Gariepy
>>>> > Sent: Monday, 21 February 2005 12:29 PM
>>>> > To: spr...@li...
>>>> > Subject: Re: [Springframework-developer] Custom bean instantiation
>>>> > language?
>>>> >
>>>> > (This is an opportunity for me to share my thoughts about the bean
>>>> > factory.)
>>>>
>>>> --SNIP--
>>>>
>>>> > I've added other lightweight syntaxes for lists and maps.
>>>> >
>>>>
>>>> Can you please share them too. I like the look of this :)
>>>>
>>>>
>>>> Thanks,
>>>>
>>>> Cameron
>>>>
>>>
>>>
>>> =====
>>> ---------------------------------------
>>> Jean-Philippe Gariépy (ga...@ya...)
>>>
>>> "Quand l'appétit va, tout va."
>>> -Obélix
>>>
>>>
>>>
>>> __________________________________
>>> Do you Yahoo!?
>>> Read only the mail you want - Yahoo! Mail SpamGuard.
>>> http://promotions.yahoo.com/new_mail
>>>
>>>
>>> -------------------------------------------------------
>>> SF email is sponsored by - The IT Product Guide
>>> Read honest & candid reviews on hundreds of IT Products from real
>>> users.
>>> Discover which products truly live up to the hype. Start reading now.
>>> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
>>> _______________________________________________
>>> Springframework-developer mailing list
>>> Spr...@li...
>>> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>>
>>
>>
>>
>>
>> -------------------------------------------------------
>> SF email is sponsored by - The IT Product Guide
>> Read honest & candid reviews on hundreds of IT Products from real users.
>> Discover which products truly live up to the hype. Start reading now.
>> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
>> _______________________________________________
>> Springframework-developer mailing list
>> Spr...@li...
>> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>>
>>
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
>
|
|
From: Martin K. <Mar...@St...> - 2005-02-22 16:01:20
|
>I think my understanding is a little skewed. Does the extension point id
>match with multiple contributions?
The extension point is definied by the extension point stakeholder.
Therefore imagen an application window you want to contribute
actions for.
<contribution extension-point="org.springXX.rpc.ui.toolBar"
class="MyContributedAction"/>
<contribution extension-point="org.springXX.rpc.ui.toolBar"
class="MyOtherContributedAction"/>
The RPC ApplicationWindow would hold this extension point
and it will be the ApplicationWindow which will pull the actions
and place it within its toolbar.
That's how contribution works. Contributions are nameless little
fellows contributing to features the extension-point stakeholder
would love to be extended.
Also applying this to the Hibernate core:
currently you provide the session factory with the mapping files directly.
But why not the reversed way?
<bean id="sessionFactory" ...../>
<contribution extension-point="org.springframework.orm.hibernate.mapping"/>
<mapping>Here goes my MappingFile.xml</mapping>
</contribution>
I plan to add an image repository system and extend the context processing
by adding intelligent dependency injection.
Cheers,
Martin (Kersten)
Martin Kersten wrote:
>> Couldn't this be done without the <contribution> tag - that is to say
>> just use the <bean> tag and then do:
>
>
>> ListableBeanFactory.getBeansOfType(Contribution.class);
>
>
> Wouldn't you think that would blow up your thinking?
> You know a bean is a bean but a contribution is something diffrent.
> It's the reverse way. You dont identify a contribution by its name or
> id (to abuse id here). It's about I want to take part. It's not I am
> what I am. It's a complete diffrent concept.
>
>> Then post process them. You could actually add this support as a
>> BeanFactoryPostProcessor, since all you are really doing is chucking in
>> some additional dependencies based on the policies.
>
>
> Would be working in an implementation way but the
> descriptive language the xml configuration compose gets malformed.
> It is like implementing a List by hacking a provided Set implementation.
> Can be done but I wont use it.
>
>> Applications can then lookup the contributions they want through some
>> kind of ContributionManager interface.
>
>
> Would be possible but this is ApplicationContext related stuff so I
> would have to change this too.
>
>> Basically, I think you can add this support without the need to tweak the
>> underlying Spring configuration format.
>
>
> It would not be possible because contributions shouldn't have an id or
> name.
>
>
> Let's see how easy it gets. The support wont break the API but
> if you are not yet convinced, I guess the main benifit it provides to
> the rich client project will do (and adding something like that to
> the rich client project does not need to effect the framework API).
>
>
> Cheers,
>
> Martin (Kersten)
>
> Martin Kersten wrote:
>
>> Hi developers,
>>
>> I am still dreaming about Spring supporting contributions
>> right out of the box. I posted an article in the architectural section
>> of the forum. I guess I found a quite good and sound implementation.
>>
>> This is the short form:
>>
>> 1. new contribution tag features the same things bean also does.
>>
>> <contribution extension-point="extensionPoint id" class="MyClass">
>> same as bean
>> </contribution>
>>
>> 2. A extension point is constructed by the application hosting it.
>> type ExtensionPoint {
>> //nothing just for identification
>> //maybe hidden storing of the extension point id for semantic equal
>> checking
>> }
>>
>> 3. Add support to the ApplicationContext for pulling the contributions
>>
>> Object [] successfullInstanciatedContributions=
>> ApplicationContext.instanciateContributions(ExtensionPoint,
>> ExtensionPointPolicy);
>>
>> 4. ExtensionPointPolicy is about finishing the init process of a
>> contribution
>> since some not hardwired dependencies have to be set by the stakeholder
>> of the contribution and can not be described within the contribution
>> definition.
>>
>> type ExtensionPointPolicy {
>> boolean isCompatibleContribution(ContributionDefinition);
>> injectAdditionalDependecies(Object contributionInstance);
>> }
>>
>> So loading contributed toolbar actions may look like this:
>> MyApplication.loadToolBarActions{
>> Object [] toolBarActions=
>>
>> applicationContext.instanciateContributions(toolbarActionsExtensionPoint,
>> new ToolBarActionsExtensionPointPolicy());
>> }
>>
>> private class ToolBarActionsExtensionPointPolicy
>> implements ExtensionPointPolicy {
>> boolean isCompatibleContribution(ContributionDefinition) {
>> Class
>> contributionalType=contributionDefinition.getContributionType();
>> return contributionalType.isCompatible(ToolBarAction.class);
>> //no additional checking in this example
>> }
>>
>> injectAdditionalDependencies(Object contributionInstance) {
>> ((ToolBarAction)contributionInstance).setEnabled(true); //just
>> to be scenceless
>> }
>> }
>>
>> Thats all. I guess this can be added quite cleanly. And I would enjoy
>> doing
>> it myself :-).
>>
>> It would provide great help I guess. The Spring RPC currently suffering
>> of the lack of defining contributions and using an extension point
>> mechanism.
>>
>> All is described in more detail within the forum article.
>>
>>
>> Cheers,
>>
>> Martin (Kersten)
>>
>> ----- Original Message ----- From: "Jean-Philippe Gariepy"
>> <ga...@ya...>
>> To: <spr...@li...>
>> Sent: Monday, February 21, 2005 4:47 PM
>> Subject: RE: [Springframework-developer] Custom bean instantiation
>> language?
>>
>>
>>>
>>> I choose the { and } characters for the lists and [ ] for the maps.
>>>
>>> So instead of...
>>>
>>> <bean id="myBean" class="example.MyClass">
>>> <property name="someList">
>>> <list>
>>> <value>item value</value>
>>> <ref bean="beanReference"/>
>>> </list>
>>> </property>
>>>
>>> <property name="someMap">
>>> <map>
>>> <entry key="key1">
>>> <value>value1</value>
>>> </entry>
>>> <entry key="key2">
>>> <value>value2</value>
>>> </entry>
>>> </map>
>>> </property>
>>> </bean>
>>>
>>> ...I have...
>>>
>>> <myBean class="example.MyClass">
>>> <someList>{item value, @beanReference}</someList>
>>> <someMap>[key1=value1, key2=value2]</someMap>
>>> </myBean>
>>>
>>> Note that I've allowed bean references to be keys. Hence, the following
>>> is
>>> legal:
>>>
>>> <myBean class="example.MyClass">
>>> <someList>{item value, @beanReference}</someList>
>>> <someMap>[@beanReference=value1, key2=value2]</someMap>
>>> </myBean>
>>>
>>> Of course, when a meta-character (@ , [ ] { } =) is part of the key or
>>> value,
>>> an escape character is required:
>>>
>>> <myBean class="example.MyClass">
>>> <emailAddresses>{user1\@domain1.com,
>>> user2\@domain2.com}</emailAddresses>
>>> </myBean>
>>>
>>> Jean-Philippe
>>>
>>> --- Cameron Braid <ca...@br...> wrote:
>>>
>>>> > -----Original Message-----
>>>> > From: spr...@li...
>>>> > [mailto:spr...@li...] On
>>>> > Behalf
>>>> > Of Jean-Philippe Gariepy
>>>> > Sent: Monday, 21 February 2005 12:29 PM
>>>> > To: spr...@li...
>>>> > Subject: Re: [Springframework-developer] Custom bean instantiation
>>>> > language?
>>>> >
>>>> > (This is an opportunity for me to share my thoughts about the bean
>>>> > factory.)
>>>>
>>>> --SNIP--
>>>>
>>>> > I've added other lightweight syntaxes for lists and maps.
>>>> >
>>>>
>>>> Can you please share them too. I like the look of this :)
>>>>
>>>>
>>>> Thanks,
>>>>
>>>> Cameron
>>>>
>>>
>>>
>>> =====
>>> ---------------------------------------
>>> Jean-Philippe Gariépy (ga...@ya...)
>>>
>>> "Quand l'appétit va, tout va."
>>> -Obélix
>>>
>>>
>>>
>>> __________________________________
>>> Do you Yahoo!?
>>> Read only the mail you want - Yahoo! Mail SpamGuard.
>>> http://promotions.yahoo.com/new_mail
>>>
>>>
>>> -------------------------------------------------------
>>> SF email is sponsored by - The IT Product Guide
>>> Read honest & candid reviews on hundreds of IT Products from real users.
>>> Discover which products truly live up to the hype. Start reading now.
>>> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
>>> _______________________________________________
>>> Springframework-developer mailing list
>>> Spr...@li...
>>> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>>
>>
>>
>>
>>
>> -------------------------------------------------------
>> SF email is sponsored by - The IT Product Guide
>> Read honest & candid reviews on hundreds of IT Products from real users.
>> Discover which products truly live up to the hype. Start reading now.
>> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
>> _______________________________________________
>> Springframework-developer mailing list
>> Spr...@li...
>> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>>
>>
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
>
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|
|
From: Andy D. <an...@ma...> - 2005-02-22 16:48:30
|
I'm going to add my 2c and just throw in what we do. Our rich client is
modular, in the sense that if a customer pays for a certain module, then they
get that functionality. To easily support this we split each module into its
own .jar. Our goal is that if a module's .jar is on the classpath, then its
"contributions" automatically becomes a part of the application. Our server
creates a WebStart .jnlp for each customer with their particular set of
module .jars setup for their classpath. Yes, this is basically nothing more
than a plugin architecture we are talking about.
So, how do we approach this from a configuration standpoint, seeing that we've
decided to use Spring and Spring-richclient? Basically how Rob has
described. Each module can specify its own Spring configuration file. We
can automatically detect these by requiring all module .jars to have their
Spring config in the same location and with the same name
(META-INF/context.xml). We then pass this into
FileSystemXmlApplicationContext: "classpath*:/META-INF/context.xml"
At this point we have one big ApplicationContext containing all the beans for
all modules. We now need some way to meaningfully and dynamically connect
the various beans together. Modules do not directly reference beans from
each other, because there is no guarantee that a module is going to be
present - meaning I can't do something like this:
<bean id="modelManager" class="...">
<property name="modelSources">
<list>
<ref bean="fooModuleModel"/>
<ref bean="barModuleModel"/>
...
</list>
</property>
</bean>
because fooModuleModel and/or barModuleModel might not be present in the
ApplicationContext. So, we implement an idea that is similar in spirit to
"extension points". For each "extension point" we define a simple Java
interface, and then the extension point "stakeholder" will query the
ApplicationContext for beans implementing that interface:
Map modelSources =
BeanFactoryUtils.beansOfTypeIncludingAncestors(getApplicationContext(),
ModelSource.class, false, false);
Which will rake in all beans implementing ModelSource. The interface also
defines a contract that an extension point contributor must implement in
order to meaningfully "contribute" to the extension point. Granted, it would
be nice if Spring provided some automated way to perform this so I wouldn't
have to create dependencies on Spring in my classes (ApplicationContext,
getBeansOfType, etc).
If Spring wanted to automate this "extension point" mechanism such as it
exists in our project, it could provide something like this:
<bean id="modelManager" class="...">
<property name="modelSources" extension-point="com.mypackage.ModelSource"/>
</bean>
Which would automatically build a collection by gathering all beans that
implement the specified interface and injecting the collection into the
"modelSources" property.
- Andy
PS In Spring, this whole idea is currently implemented in "recipe" fashion.
IoC containers like HiveMind make the idea a first class citizen. Actually,
we considered HiveMind, but it is not as mature as Spring and doesn't offer
many of the advanced integration constructs of Spring.
|
|
From: Martin K. <Mar...@St...> - 2005-02-22 17:24:18
|
Hi Andy,
> If Spring wanted to automate this "extension point" mechanism such as it
> exists in our project, it could provide something like this:
>
> <bean id="modelManager" class="...">
> <property name="modelSources"
> extension-point="com.mypackage.ModelSource"/>
> </bean>
>
> Which would automatically build a collection by gathering all beans that
> implement the specified interface and injecting the collection into the
> "modelSources" property.
Thats an nice idea. But you have to name the contribution. Also
refactoring the DefaultXmlBeanDefinitionParser I have learned,
that all which is needed is to add another parser to support
extensions.
Currently I am thinking of a more extense usage of the extension
point mechanism, quite like Eclipse offers.
<contribution extension-point="ep">
<any tag you want>
</contribution>
The idea is to flexiblize the contribution process. The question is what
the dtd says to it.
In Eclipse there is some kine of rule:
If you dont apply to the extension point policy, then we will ignore you.
That would make the whole thing more contributional like. So you can
describe contributions by not adding any class.
(which makes sometimes a lot of scence). Also it should be possible
to contribute in any description as you would like. There should be
support for the default way to inject bean dependencies. But maybe
I have to leave this task to extension-point stakeholder until I know
for sure.
But back on refactoring. It makes fun but I can not run test cases.
I am starting to get nervous. :-)
Cheers,
Martin (Kersten)
|
|
From: Martin K. <Mar...@St...> - 2005-02-22 18:08:17
|
Hi there, I am not sure but what exactly is a bean definiton holder? I guess it is storing a bean definition and stores the bean name and the aliases. It has only get methods. First of all its main task seams to store the bean definition. That means it is a BeanDescription? Well this would make more sence since this one does not hold anything (can't spot any hold method). I think I start to understand how this is all wired up internally. Lots of reversed responsibility if you ask me. Martin (Kersten) |
|
From: Colin S. <col...@ex...> - 2005-02-23 03:12:07
|
Andy Depue wrote: >I'm going to add my 2c and just throw in what we do. Our rich client is >modular, in the sense that if a customer pays for a certain module, then they >get that functionality. To easily support this we split each module into its >own .jar. Our goal is that if a module's .jar is on the classpath, then its >"contributions" automatically becomes a part of the application. Our server >creates a WebStart .jnlp for each customer with their particular set of >module .jars setup for their classpath. Yes, this is basically nothing more >than a plugin architecture we are talking about. >So, how do we approach this from a configuration standpoint, seeing that we've >decided to use Spring and Spring-richclient? Basically how Rob has >described. Each module can specify its own Spring configuration file. We >can automatically detect these by requiring all module .jars to have their >Spring config in the same location and with the same name >(META-INF/context.xml). We then pass this into >FileSystemXmlApplicationContext: "classpath*:/META-INF/context.xml" >At this point we have one big ApplicationContext containing all the beans for >all modules. We now need some way to meaningfully and dynamically connect >the various beans together. Modules do not directly reference beans from >each other, because there is no guarantee that a module is going to be >present - meaning I can't do something like this: > ><bean id="modelManager" class="..."> > <property name="modelSources"> > <list> > <ref bean="fooModuleModel"/> > <ref bean="barModuleModel"/> > ... > </list> > </property> ></bean> > >because fooModuleModel and/or barModuleModel might not be present in the >ApplicationContext. So, we implement an idea that is similar in spirit to >"extension points". For each "extension point" we define a simple Java >interface, and then the extension point "stakeholder" will query the >ApplicationContext for beans implementing that interface: > Map modelSources = >BeanFactoryUtils.beansOfTypeIncludingAncestors(getApplicationContext(), >ModelSource.class, false, false); >Which will rake in all beans implementing ModelSource. The interface also >defines a contract that an extension point contributor must implement in >order to meaningfully "contribute" to the extension point. Granted, it would >be nice if Spring provided some automated way to perform this so I wouldn't >have to create dependencies on Spring in my classes (ApplicationContext, >getBeansOfType, etc). >If Spring wanted to automate this "extension point" mechanism such as it >exists in our project, it could provide something like this: > ><bean id="modelManager" class="..."> > <property name="modelSources" extension-point="com.mypackage.ModelSource"/> ></bean> > >Which would automatically build a collection by gathering all beans that >implement the specified interface and injecting the collection into the >"modelSources" property. > > - Andy > >PS In Spring, this whole idea is currently implemented in "recipe" fashion. >IoC containers like HiveMind make the idea a first class citizen. Actually, >we considered HiveMind, but it is not as mature as Spring and doesn't offer >many of the advanced integration constructs of Spring. > > This is an interesting topic (to me anyway). I'm onsite at a client this week so can't really think too much about it, but it'd be nice if this discussion leads to something... |
|
From: Howard L. S. <hl...@gm...> - 2005-02-24 12:41:00
|
Have you considered using *both* HiveMind and Spring? HiveMind has good integration into Spring, and Rob recently added integration from Spring into HiveMind. Use each for its strengths. -- Howard M. Lewis Ship Independent J2EE / Open-Source Java Consultant Creator, Jakarta Tapestry Creator, Jakarta HiveMind Professional Tapestry training, mentoring, support and project work. http://howardlewisship.com On Tue, 22 Feb 2005 08:48:24 -0800, Andy Depue <an...@ma...> wrote: > I'm going to add my 2c and just throw in what we do. Our rich client is > modular, in the sense that if a customer pays for a certain module, then they > get that functionality. To easily support this we split each module into its > own .jar. Our goal is that if a module's .jar is on the classpath, then its > "contributions" automatically becomes a part of the application. Our server > creates a WebStart .jnlp for each customer with their particular set of > module .jars setup for their classpath. Yes, this is basically nothing more > than a plugin architecture we are talking about. > So, how do we approach this from a configuration standpoint, seeing that we've > decided to use Spring and Spring-richclient? Basically how Rob has > described. Each module can specify its own Spring configuration file. We > can automatically detect these by requiring all module .jars to have their > Spring config in the same location and with the same name > (META-INF/context.xml). We then pass this into > FileSystemXmlApplicationContext: "classpath*:/META-INF/context.xml" > At this point we have one big ApplicationContext containing all the beans for > all modules. We now need some way to meaningfully and dynamically connect > the various beans together. Modules do not directly reference beans from > each other, because there is no guarantee that a module is going to be > present - meaning I can't do something like this: > > <bean id="modelManager" class="..."> > <property name="modelSources"> > <list> > <ref bean="fooModuleModel"/> > <ref bean="barModuleModel"/> > ... > </list> > </property> > </bean> > > because fooModuleModel and/or barModuleModel might not be present in the > ApplicationContext. So, we implement an idea that is similar in spirit to > "extension points". For each "extension point" we define a simple Java > interface, and then the extension point "stakeholder" will query the > ApplicationContext for beans implementing that interface: > Map modelSources = > BeanFactoryUtils.beansOfTypeIncludingAncestors(getApplicationContext(), > ModelSource.class, false, false); > Which will rake in all beans implementing ModelSource. The interface also > defines a contract that an extension point contributor must implement in > order to meaningfully "contribute" to the extension point. Granted, it would > be nice if Spring provided some automated way to perform this so I wouldn't > have to create dependencies on Spring in my classes (ApplicationContext, > getBeansOfType, etc). > If Spring wanted to automate this "extension point" mechanism such as it > exists in our project, it could provide something like this: > > <bean id="modelManager" class="..."> > <property name="modelSources" extension-point="com.mypackage.ModelSource"/> > </bean> > > Which would automatically build a collection by gathering all beans that > implement the specified interface and injecting the collection into the > "modelSources" property. > > - Andy > > PS In Spring, this whole idea is currently implemented in "recipe" fashion. > IoC containers like HiveMind make the idea a first class citizen. Actually, > we considered HiveMind, but it is not as mature as Spring and doesn't offer > many of the advanced integration constructs of Spring. > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > |
|
From: Martin K. <Mar...@St...> - 2005-02-25 20:22:18
|
Hi folks, I just wanted to know why these two are named prop and props, I think property and properties would be more obvious. Are there any plans to change the tag style within the Springframework 2.x releases? Cheers, Martin (Kersten) |
|
From: Martin K. <Mar...@St...> - 2005-02-25 22:00:45
|
Hi folks,
while reviewing the code I found a construct that distracted me.
It is the BeanUtils.isAssignable method:
/* Determine if the given type is assignable from the given value,
* assuming setting by reflection. Considers primitive wrapper classes
* as assignable to the corresponding primitive types.
* [..] */
public static boolean isAssignable(Class type, Object value) {
return (value != null && isAssignable(type, value.getClass()) ||
(value == null) && !type.isPrimitive());
}
It seams odd to have something like: a && b || c && d. That is
not clearly clear which binds first and I guess this is not
which was intended.
By reducing the semantic we have:
A => value!=null
B => isAssignable...
C => value==null
D => !type.isPremitive()
So it reads:
return A && B || C && D; //What is this meaning?
I would say that this always true.
If it is not a premitve it is true, if it is null and not a premitve
it is the only thing where it might be returning null.
From the reading I guess it is ment to be:
return (A && B) || (C && D);
Cheers,
Martin (Kersten)
|
|
From: Juergen H. <ju...@in...> - 2005-02-26 20:43:27
|
Actually, there's nothing wrong with this (provided that I haven't
misunderstood the issue):
return A && B || C && D;
is semantically equivalent to
return (A && B) || (C && D);
according to the Java language spec. The && operator is stronger than ||, so
the extra brackets don't change the semantics.
Admittedly, the explicit brackets make the expression easier to read,
though, so I've changed the code accordingly. We use explicit brackets in
similar cases too, so this also makes sense for consistency.
Juergen
-----Original Message-----
From: spr...@li...
[mailto:spr...@li...]On Behalf
Of Martin Kersten
Sent: Friday, February 25, 2005 10:58 PM
To: spr...@li...
Subject: [Springframework-developer] Is BeanUtils.isAssignable correct?
Hi folks,
while reviewing the code I found a construct that distracted me.
It is the BeanUtils.isAssignable method:
/* Determine if the given type is assignable from the given value,
* assuming setting by reflection. Considers primitive wrapper classes
* as assignable to the corresponding primitive types.
* [..] */
public static boolean isAssignable(Class type, Object value) {
return (value != null && isAssignable(type, value.getClass()) ||
(value == null) && !type.isPrimitive());
}
It seams odd to have something like: a && b || c && d. That is
not clearly clear which binds first and I guess this is not
which was intended.
By reducing the semantic we have:
A => value!=null
B => isAssignable...
C => value==null
D => !type.isPremitive()
So it reads:
return A && B || C && D; //What is this meaning?
I would say that this always true.
If it is not a premitve it is true, if it is null and not a premitve
it is the only thing where it might be returning null.
From the reading I guess it is ment to be:
return (A && B) || (C && D);
Cheers,
Martin (Kersten)
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|
|
From: Erwin B. <er...@kl...> - 2005-02-26 21:12:18
|
Hi,
I'm almost afraid to intrude, but the expression here, written as
(A && B) || (C && D)
isn't it actually like this?
(A && B) || (!A && D)
which could be written shorter as
A ? B : D
or in this case:
return (value != null ? isAssignable(type, value.getClass()) :
!type.isPrimitive());
Perhaps an if-statement would be clearer, but if you want to write it as
a single expression, isn't the ternary conditional operator a clearer
way of expressing this?
Regards,
Erwin Bolwidt
Juergen Hoeller wrote:
>Actually, there's nothing wrong with this (provided that I haven't
>misunderstood the issue):
>
> return A && B || C && D;
>
>is semantically equivalent to
>
> return (A && B) || (C && D);
>
>according to the Java language spec. The && operator is stronger than ||, so
>the extra brackets don't change the semantics.
>
>Admittedly, the explicit brackets make the expression easier to read,
>though, so I've changed the code accordingly. We use explicit brackets in
>similar cases too, so this also makes sense for consistency.
>
>Juergen
>
>
>-----Original Message-----
>From: spr...@li...
>[mailto:spr...@li...]On Behalf
>Of Martin Kersten
>Sent: Friday, February 25, 2005 10:58 PM
>To: spr...@li...
>Subject: [Springframework-developer] Is BeanUtils.isAssignable correct?
>
>
>Hi folks,
>
> while reviewing the code I found a construct that distracted me.
>It is the BeanUtils.isAssignable method:
>
>/* Determine if the given type is assignable from the given value,
> * assuming setting by reflection. Considers primitive wrapper classes
> * as assignable to the corresponding primitive types.
> * [..] */
>public static boolean isAssignable(Class type, Object value) {
> return (value != null && isAssignable(type, value.getClass()) ||
> (value == null) && !type.isPrimitive());
> }
>
>It seams odd to have something like: a && b || c && d. That is
>not clearly clear which binds first and I guess this is not
>which was intended.
>
>By reducing the semantic we have:
>
>A => value!=null
>B => isAssignable...
>C => value==null
>D => !type.isPremitive()
>
>So it reads:
>
>return A && B || C && D; //What is this meaning?
>I would say that this always true.
>If it is not a premitve it is true, if it is null and not a premitve
>it is the only thing where it might be returning null.
>
>From the reading I guess it is ment to be:
>
>return (A && B) || (C && D);
>
>
>Cheers,
>
>Martin (Kersten)
>
>
>-------------------------------------------------------
>SF email is sponsored by - The IT Product Guide
>Read honest & candid reviews on hundreds of IT Products from real users.
>Discover which products truly live up to the hype. Start reading now.
>http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
>_______________________________________________
>Springframework-developer mailing list
>Spr...@li...
>https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
>
>
>-------------------------------------------------------
>SF email is sponsored by - The IT Product Guide
>Read honest & candid reviews on hundreds of IT Products from real users.
>Discover which products truly live up to the hype. Start reading now.
>http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
>_______________________________________________
>Springframework-developer mailing list
>Spr...@li...
>https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
>
|
|
From: Juergen H. <ju...@in...> - 2005-02-26 22:55:05
|
Good point. I've changed the implementation that way.
Juergen
-----Original Message-----
From: spr...@li...
[mailto:spr...@li...]On Behalf
Of Erwin Bolwidt
Sent: Saturday, February 26, 2005 10:12 PM
To: spr...@li...
Subject: Re: [Springframework-developer] Is BeanUtils.isAssignable
correct?
Hi,
I'm almost afraid to intrude, but the expression here, written as
(A && B) || (C && D)
isn't it actually like this?
(A && B) || (!A && D)
which could be written shorter as
A ? B : D
or in this case:
return (value != null ? isAssignable(type, value.getClass()) :
!type.isPrimitive());
Perhaps an if-statement would be clearer, but if you want to write it as
a single expression, isn't the ternary conditional operator a clearer
way of expressing this?
Regards,
Erwin Bolwidt
Juergen Hoeller wrote:
>Actually, there's nothing wrong with this (provided that I haven't
>misunderstood the issue):
>
> return A && B || C && D;
>
>is semantically equivalent to
>
> return (A && B) || (C && D);
>
>according to the Java language spec. The && operator is stronger than ||,
so
>the extra brackets don't change the semantics.
>
>Admittedly, the explicit brackets make the expression easier to read,
>though, so I've changed the code accordingly. We use explicit brackets in
>similar cases too, so this also makes sense for consistency.
>
>Juergen
>
>
>-----Original Message-----
>From: spr...@li...
>[mailto:spr...@li...]On Behalf
>Of Martin Kersten
>Sent: Friday, February 25, 2005 10:58 PM
>To: spr...@li...
>Subject: [Springframework-developer] Is BeanUtils.isAssignable correct?
>
>
>Hi folks,
>
> while reviewing the code I found a construct that distracted me.
>It is the BeanUtils.isAssignable method:
>
>/* Determine if the given type is assignable from the given value,
> * assuming setting by reflection. Considers primitive wrapper classes
> * as assignable to the corresponding primitive types.
> * [..] */
>public static boolean isAssignable(Class type, Object value) {
> return (value != null && isAssignable(type, value.getClass()) ||
> (value == null) && !type.isPrimitive());
> }
>
>It seams odd to have something like: a && b || c && d. That is
>not clearly clear which binds first and I guess this is not
>which was intended.
>
>By reducing the semantic we have:
>
>A => value!=null
>B => isAssignable...
>C => value==null
>D => !type.isPremitive()
>
>So it reads:
>
>return A && B || C && D; //What is this meaning?
>I would say that this always true.
>If it is not a premitve it is true, if it is null and not a premitve
>it is the only thing where it might be returning null.
>
>From the reading I guess it is ment to be:
>
>return (A && B) || (C && D);
>
>
>Cheers,
>
>Martin (Kersten)
>
>
>-------------------------------------------------------
>SF email is sponsored by - The IT Product Guide
>Read honest & candid reviews on hundreds of IT Products from real users.
>Discover which products truly live up to the hype. Start reading now.
>http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
>_______________________________________________
>Springframework-developer mailing list
>Spr...@li...
>https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
>
>
>-------------------------------------------------------
>SF email is sponsored by - The IT Product Guide
>Read honest & candid reviews on hundreds of IT Products from real users.
>Discover which products truly live up to the hype. Start reading now.
>http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
>_______________________________________________
>Springframework-developer mailing list
>Spr...@li...
>https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
>
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|
|
From: Martin K. <Mar...@St...> - 2005-02-26 23:42:17
|
> Actually, there's nothing wrong with this (provided that I haven't
> misunderstood the issue):
>
> return A && B || C && D;
>
> is semantically equivalent to
>
> return (A && B) || (C && D);
>
> according to the Java language spec. The && operator is stronger than ||,
> so
> the extra brackets don't change the semantics.
Odd. I thought it is left handed like the +/- operators. Well I checked the
specs but I couldn't find the right paragraph. I found 15.23/24 and
the syntax grammar talking about infix-operations but no destinction
between those two.
But I checked it myself and you are right. I never relied on this, but
now I learned something new. ;-)
> Admittedly, the explicit brackets make the expression easier to read,
> though, so I've changed the code accordingly. We use explicit brackets in
> similar cases too, so this also makes sense for consistency.
Thanks,
Martin (Kersten)
> -----Original Message-----
> From: spr...@li...
> [mailto:spr...@li...]On Behalf
> Of Martin Kersten
> Sent: Friday, February 25, 2005 10:58 PM
> To: spr...@li...
> Subject: [Springframework-developer] Is BeanUtils.isAssignable correct?
>
>
> Hi folks,
>
> while reviewing the code I found a construct that distracted me.
> It is the BeanUtils.isAssignable method:
>
> /* Determine if the given type is assignable from the given value,
> * assuming setting by reflection. Considers primitive wrapper classes
> * as assignable to the corresponding primitive types.
> * [..] */
> public static boolean isAssignable(Class type, Object value) {
> return (value != null && isAssignable(type, value.getClass()) ||
> (value == null) && !type.isPrimitive());
> }
>
> It seams odd to have something like: a && b || c && d. That is
> not clearly clear which binds first and I guess this is not
> which was intended.
>
> By reducing the semantic we have:
>
> A => value!=null
> B => isAssignable...
> C => value==null
> D => !type.isPremitive()
>
> So it reads:
>
> return A && B || C && D; //What is this meaning?
> I would say that this always true.
> If it is not a premitve it is true, if it is null and not a premitve
> it is the only thing where it might be returning null.
>
> From the reading I guess it is ment to be:
>
> return (A && B) || (C && D);
>
>
> Cheers,
>
> Martin (Kersten)
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
|
|
From: Martin K. <Mar...@St...> - 2005-02-25 22:20:46
|
> I just wanted to know why these two are named prop and props,
> I think property and properties would be more obvious. Are there
> any plans to change the tag style within the Springframework 2.x
> releases?
Well, I reread this post and I noticed that it isn't that obvious,
what I mean. I think about the destinction between a property
of a bean and the property of a properties. I don't know
the exactly reason why a property of properties, an element
of a map and a property of a bean are diffrently handled.
I understand the diffrence between list set map but I do
not know what property (bean), property (props)
and element(map) makes so distinct.
To substitute prop it would be possible to
use property I guess.
Looking at the property declaration:
<!ELEMENT property (
description?,
(bean | ref | idref | list | set | map | props | value | null)
)>
Wouldn't it be possible to go for:
<!ELEMENT property (
description?,
(bean | ref | idref | list | set | map | props | value | null|#PCDATA)
)>
It would also be a nice to have since to set a string property
I would only go for:
<property name="name">my name is</property>
Objects and all can be mapped to string using a special method on
the properties type/implementation.
Since props and map are semantically equal (except the destinction
for string), I don't if it shouldn't be a matter of the semantic when
the parameter gets injected.
Meaning if you declare:
setMyProperty(Map map); //you will get a map
setMyProperty(StringProperties properties); //you will get properties
I mean there is not a distinction in the general concept between
property and prop and props and map.
I guess that this destinction is not usefull in terms of the
declartive language which is used to set up the beans context.
It seams not necessary but it is not urgent or need after all.
I just wondered why this decision was made.
By the way I am still refactoring the DefaultXmlBeanDefinitionParser
and it drove me using a semantic active parse tree. You know
just like an ordinary parse tree but with a lot of semantic knowledge
I would't refer it a parse tree anymore. Currently I am addin
>
>
> Cheers,
>
> Martin (Kersten)
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
|
|
From: Martin K. <Mar...@St...> - 2005-02-26 10:47:47
|
> I understand the diffrence between list set map but I do
> not know what property (bean), property (props)
> and element(map) makes so distinct.
Thinking about it, I don't understand the distinction between
set, list, props and map not more.
All four are collections. A property is an element, too.
<collection>
<element name="element1">value</element>
<element name="element2">value</element>
</collection>
This definition defines a domain layer and the set,list,map,props
is simply a special view on this domain. So when this described
collection is injected into any bean, the beans set property
method will decide which view on this declared model has
to be injected.
setMapProperty(Map map);
setListProperty(List list);
setSetProperty(Set set);
setPropertiesProperty(Properties properties);
A collection can be expressed in all those views on the
collection's data. The view kinds are not semantically equalent
of cause. Also the view becomes independent or is a model
itself. So using a certain view becomes a conversion from
one model to another. (but relativly speaking for the
first model the second expresses a certain view
(view imposes a metamodel)).
The next thing is that a element don't need a name in case
of a list. So name is a description providing additional
informations. If it is so, we need to find a way to derive
this additional information if we need it. This can be
solved plugable with a default way of using toString().
Meaning in case there is no explicit name specified a
the implicite name is used. The implicite name is the
self description of the element (Object.toString).
The implicite name may be a source of plugable logic
(e.g. property editor). So if you add an Image having
a name, you might use something like this:
<collection>
<element><bean class="Image"/></element>
</collection>
setImages(Map images);
-> This will result in injecting a map with the following
type Map<String imageName,Image image>;
With this also injecting selfdescribing bean properties
would be possible. This would increase the abstractness of
the declaration language.
<bean class="MyApplication">
<property>
<bean class="ApplicationModel"/>
</property>
</bean>
You don't need to know the properties name. It's up
to the application and the application model to find a
suiteable solution. So the user of the application and
the model, meaning writing it's own declaration, does
not know any additional implementation details.
I guess this would ease the framework by increasing
the abstractness of the descriptive language. Which
is desireable.
Cheers,
Martin (Kersten)
|