OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

sca-j message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [sca-j] NEW ISSUE: @Callback injection could be NULL


So let's focus on the re-injection case for setter methods. If the Domain is changed such that a wire disappears (and the runtime supports re-injection), then wouldn't you expect a NULL to be re-injected? The answer has to be yes, so why then wouldn't you do the initial injection with NULL. I don't see why we should be inconsistent in this case either.

Dave Booz
STSM, BPM and SCA Architecture
Co-Chair OASIS SCA-Policy TC and SCA-J TC
"Distributed objects first, then world hunger"
Poughkeepsie, NY (845)-435-6093 or 8-295-6093
e-mail:booz@us.ibm.com

Inactive hide details for Jim Marino ---02/16/2009 11:37:42 AM---@Init and @Destroy are very important in both cases as they alJim Marino ---02/16/2009 11:37:42 AM---@Init and @Destroy are very important in both cases as they allow for initialization code to be ex


From:

Jim Marino <jim.marino@gmail.com>

To:

David Booz/Poughkeepsie/IBM@IBMUS

Cc:

sca-j@lists.oasis-open.org

Date:

02/16/2009 11:37 AM

Subject:

Re: [sca-j] NEW ISSUE: @Callback injection could be NULL





@Init and @Destroy are very important in both cases as they allow for initialization code to be executed before a service operation is executed and a component to receive a container callback to perform cleanup respectively.

If @Init were removed, it would force implementation code to handles these cases by inelegantly inserting an initialization method call in the code block of every service operation. Note the specs should not recommend constructors as a way to perform general initialization as the latter may be required to invoke another object instance.

@Destroy is important for stateless components for the same reason as @Init: it avoids requiring implementations to insert a method call at the end of every service operation code block. In composite scope, @Destroy is important as there is no other way to receive a container callback when an instance is shut down.

On the issue of setter injection, it's useful for the following reasons:

1. It allows for reinjection wheres CDI does not
2. It makes unit testing easier with respect to when protected fields are used for injection as testing code does not need to use reflection or a subclass to set mock component dependencies.
3. It facilitates porting component implementations to other POJO frameworks
4. Some ideologues prefer setter injection over protected fields as it preserves encapsulation. They would argue it is not really much typing as most IDEs can auto-generate setters from a field through one click (I'm not one of the ideologues but IntelliJ, the IDE I use, will do this).

Jim


On Feb 16, 2009, at 4:32 AM, David Booz wrote:




[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]