|
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
>
>
|