aries-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Norman Maurer <nor...@apache.org>
Subject Re: Add custom lifecycle management
Date Fri, 18 Jun 2010 17:49:41 GMT
Hi Valentin,

thanks for the response. I will try out the BeanProcessor stuff and
come back to you.. At the end maybe I can contribute something back ;)

BTW, would it be possible to publish the javadocs online ?

Bye,
Norman


2010/6/18 Valentin Mahrwald <vmahrwald@googlemail.com>:
> Hi Norman,
>
> that sounds like quite a tall order :) Especially, ordering configuration and JSR250
(or blueprint) lifecycle callbacks sounds like something blueprint is unlikely to support
out of the box.
>
> By the sounds of it for the level of control you want, you might want to use the org.apache.aries.blueprint.BeanProcessor
extension point. This allows you to intercept beans during creation where you could the instanceof
checks against LogEnabled and Configurable as well as look at annotations (assuming no other
BeanProcessor proxied the bean previously).
>
> Now, the BeanProcessor is on the far end of supported extensions in that it is more likely
to change or be completely redesigned :)
>
> Regards,
>
> Valentin
>
>
>
> On 18 Jun 2010, at 18:20, Norman Maurer wrote:
>
>> Hi Lin,
>>
>> not exactly. I want to implement 3 things..
>>
>> 1) LogEnabled.
>> Every component which is instanced by aries should get checked if it
>> implement LogEnabled. If so it has a setLog(Log logger) method which
>> should get called to inject a Log instance
>>
>> 2) Configurable.
>> Every component which is instanced by aries should get checked if it
>> implement Configurable. If so it need to get the "right" configuration
>> passed to its configure(HierachicalConfiguration config) methd.
>>
>> 3) JSR250
>> Check if the component which is instanced by aries has
>> @Resource(name="example"), @PostConstruct, @PreDestroy annotations on
>> methods. If so inject the service with name example to the setter.
>> Then call method which is annotated by @PostConstruct.  On shutdown /
>> undeploy etc the method annoted with @PreDestroy should get called.
>>
>> I need to be sure that it is handled in the right order.
>>
>> LogEnabled, Configurable, JSR250
>>
>> Hope its now clear what I want todo :)
>>
>> Thx,
>> Norman
>>
>>
>>
>> 2010/6/18 Lin Sun <linsun.unc@gmail.com>:
>>> Hi
>>>
>>> Aries already has this bean Interceptor concept that allows you to
>>> specify precall before the method is invoked and specify postCall
>>> after the method is invoked, see the Interceptor interface.
>>>
>>> Aries also has an example in transaction-blueprint project where it
>>> specifies a custom name space for transaction blueprint and allow
>>> users to intercept attribute with certain transaction attribute on
>>> bean method invocations.
>>>
>>> for example -
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>>>    xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0">
>>>     <bean id="TestBeanImpl" class="org.apache.aries.simple.TestBeanImpl">
>>>        <tx:transaction method="insertRow" value="required"/>
>>>     </bean>
>>>
>>> </blueprint>
>>>
>>> basically asks the blueprint container to manage required transaction
>>> attribute/strategy on insertRow method invocation.
>>>
>>> Is this similar as what you want to do, except you want to do it with logging?
>>>
>>> HTH
>>>
>>> Lin
>>>
>>>
>>> On Fri, Jun 18, 2010 at 12:19 PM, Norman Maurer <norman@apache.org> wrote:
>>>> Hi all,
>>>>
>>>> I'm very new to Aries and wonder if its possible to add some kind of
>>>> "PostBeanProcessor" (this is how it get called in spring). We at JAMES
>>>> use spring at the moment to wire up our application as standalone
>>>> application. Now we are working on "osgify" JAMES. We need to
>>>> implement some kind of lifecycle methods. For example if a "service"
>>>> implements LogEnabled interface it need to get a Log injected. The
>>>> same is true for other dependencies.. We use JSR250 annotations, so we
>>>> would need to handle this kind of stuff. I did some tests with
>>>> spring-dm the last weeks and it seems to work but aries looks very
>>>> interesting too.
>>>>
>>>> You know, Eat your own dogfood ;)
>>>>
>>>>
>>>> Thx,
>>>> Norman
>>>>
>>>
>
>

Mime
View raw message