[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [sca-j] [NEW ISSUE] Java C&I Constrctor Examples are incorrect
Perhaps a good way to handle this would be to include a simple example of an unannotated implementation with a single property and a single reference, and a no-arg constructor. This could go in section 8.2. Simon Simon Nash wrote: > Vamsi, > I'm not sure it's necessary to say specifically that an unannotated > implementation needs to have a no-argument constructor, as this > is implied by other normative statements. However, it wouldn't do > any harm to have a non-normative comment somewhere mentioning it. > > Simon > > Mike Edwards wrote: >> >> Vamsi, >> >> I think this misses the point. >> >> It does not matter whether the implementation code has any @Reference >> or @Property annotations, what >> does matter is that the class must have a constructor that the SCA >> runtime can invoke to create an instance >> of the class. That constructor can be no-arg, or it can have >> arguments BUT if it does have arguments then >> they MUST all be annotated with either @Reference or @Property. >> What I'm getting at is that the rule here is about the constructors >> themselves, not about the rest of the class. >> >> >> Yours, Mike. >> >> Strategist - Emerging Technologies, SCA & SDO. >> Co Chair OASIS SCA Assembly TC. >> IBM Hursley Park, Mail Point 146, Winchester, SO21 2JN, Great Britain. >> Phone & FAX: +44-1962-818014 Mobile: +44-7802-467431 Email: >> mike_edwards@uk.ibm.com >> >> >> From: C Vamsi <vamsic007@in.ibm.com> >> To: OASIS Java <sca-j@lists.oasis-open.org> >> Date: 17/03/2009 13:29 >> Subject: Re: [sca-j] [NEW ISSUE] Java C&I Constrctor Examples are >> incorrect >> >> >> ------------------------------------------------------------------------ >> >> >> >> Simon, >> >> What happens if there is no no-argument constructor? I see that it is >> implicit from the starting sentence in section 5, "A Java implementation >> class MUST provide a public or protected constructor that can be used by >> the SCA runtime to create the implementation instance. [JCI50001]" >> plus the >> selection algorithm. I feel it would be useful to explicitly state >> that an >> implementation with no @Reference or @Property annotations should have a >> public or protected no-argument constructor. >> >> ++Vamsi >> Apache Tuscany Committer http://tuscany.apache.org >> <http://tuscany.apache.org/> >> Apache Geronimo Committer and Member of PMC >> http://geronimo.apache.org <http://geronimo.apache.org/> >> >> >> >> >> Simon >> Nash >> <oasis@cjnash.com >> > To >> OASIS >> Java 17/03/2009 15:38 >> <sca-j@lists.oasis-open.org> >> cc >> >> Subject >> Re: [sca-j] [NEW ISSUE] Java >> C&I Constrctor Examples are >> incorrect >> >> >> >> >> >> >> >> >> Vamsi, >> This is in Chapter 5 (Implementation Instance Creation) of JavaCI. >> Step 3 of the constructor selection algorithm allows for this case. >> >> Simon >> >> C Vamsi wrote: >> > Hi Simon, >> > >> > I do not recall coming across the requirement, "allows unannotated >> > implementations if they have a no-parameter constructor" made clear in >> the >> > current spec. To speed things up, can you please point me to the >> > section/paragraph? >> > >> > Thanks. >> > >> > ++Vamsi >> > Apache Tuscany Committer http://tuscany.apache.org >> <http://tuscany.apache.org/> >> > Apache Geronimo Committer and Member of PMC >> http://geronimo.apache.org <http://geronimo.apache.org/> >> > >> > >> > >> > >> > Simon Nash >> > <oasis@cjnash.com >> > > >> To >> > OASIS Java >> > 09/03/2009 19:43 <sca-j@lists.oasis-open.org> >> > >> cc >> > >> > >> Subject >> > Re: [sca-j] [NEW ISSUE] Java >> C&I >> > Constrctor Examples are >> incorrect >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > Vamsi, >> > I agree that it's unfortunate that constructor injection isn't >> > possible for properties and references of unnanotated implementations. >> > This is because it's not possible to infer the name of a property >> > or reference that appears as a constructor parameter. >> > >> > I'm not sure why you think a new issue is needed. The current spec >> > allows unannotated implementations if they have a no-parameter >> constructor. >> > Do you think there is some way to improve on this? >> > >> > Simon >> > >> > C Vamsi wrote: >> >> Simon, >> >> >> >> When JAVA-39 was raised, I have not thought about the >> constructors. Now >> >> that we require all parameters of a constructor annotated with a >> >> @Constructor annotation to have either a @Property or a @Reference >> >> annotation (JCA90003 in CAA spec), we need to revisit these examples. >> >> Appears like we have to require an unannotated implementation >> (i.e., one >> >> with no @Property or @Referene annotations) to have a constructor >> with >> no >> >> parameters. I guess it will call for a new issue!! >> >> >> >> ++Vamsi >> >> Apache Tuscany Committer http://tuscany.apache.org >> <http://tuscany.apache.org/> >> >> Apache Geronimo Committer and Member of PMC >> http://geronimo.apache.org <http://geronimo.apache.org/> >> >> >> >> >> >> >> >> >> >> Simon Nash >> >> <oasis@cjnash.com >> >> > >> > To >> >> OASIS Java >> >> 27/02/2009 20:40 <sca-j@lists.oasis-open.org> >> >> >> > cc >> >> >> > Subject >> >> Re: [sca-j] [NEW ISSUE] >> Java C&I >> >> Constrctor Examples are >> incorrect >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> I believe this is a duplicate of issue JAVA-39. However, I'd like >> >> to understand the reason for the assertion that the examples noted as >> >> "does not unambiguously identify all property and reference values" >> >> are incorrect. >> >> >> >> Simon >> >> >> >> Mike Edwards wrote: >> >>> Raiser: Mike Edwards >> >>> >> >>> Target: sca-javaci-1.1-spec-wd03.pdf >> >>> >> >>> Description: >> >>> >> >>> The constructor examples in section 5 contain errors that make >> some of >> >>> them illegal and they must be fixed. >> >>> >> >>> /** Simple class taking a single property value */ >> >>> >> >>> public class Impl1 { >> >>> >> >>> String someProperty; >> >>> >> >>> public Impl1(String propval) {...} >> >>> >> >>> } >> >>> >> >>> *<mje> This one does not "unambiguously identify all property and >> >>> reference values"</mje>* >> >>> >> >>> /** Simple class taking a property and reference in the constructor; >> >>> >> >>> * The values are not injected into the fields. >> >>> >> >>> *// >> >>> >> >>> public class Impl2 { >> >>> >> >>> public String someProperty; >> >>> >> >>> public SomeService someReference; >> >>> >> >>> public Impl2(String a, SomeService b) {...} >> >>> >> >>> } >> >>> >> >>> *<mje> This one does not "unambiguously identify all property and >> >>> reference values"</mje>* >> >>> >> >>> /** Class declaring a named property and reference through the >> >>> constructor */ >> >>> >> >>> public class Impl3 { >> >>> >> >>> @Constructor({"someProperty", "someReference"}) >> >>> >> >>> public Impl3(String a, SomeService b) {...} >> >>> >> >>> } >> >>> >> >>> *<mje>@Constructor annotation has no such attributes (see [JAVACAA]) >> >>> </mje>* >> >>> >> >>> /** Class declaring a named property and reference through >> parameters >> */ >> >>> >> >>> public class Impl3b { >> >>> >> >>> public Impl3b( >> >>> >> >>> @Property("someProperty") String a, >> >>> >> >>> @Reference("someReference) SomeService b >> >>> >> >>> ) {...} >> >>> >> >>> } >> >>> >> >>> *<mje>This one is OK</mje>* >> >>> >> >>> /** Additional property set through a method */ >> >>> >> >>> public class Impl4 { >> >>> >> >>> public String someProperty; >> >>> >> >>> public SomeService someReference; >> >>> >> >>> public Impl2(String a, SomeService b) {...} >> >>> >> >>> @Property public void setAnotherProperty(int x) {...} >> >>> >> >>> } >> >>> >> >>> *<mje> This one does not "unambiguously identify all property and >> >>> reference values"</mje>* >> >>> >> >>> >> >>> Proposal: >> >>> >> >>> Replace the examples with the following ones: >> >>> >> >>> /** Constructor declared using @Constructor annotation */ >> >>> >> >>> public class Impl1 { >> >>> >> >>> private String someProperty; >> >>> >> >>> @Constructor >> >>> >> >>> public Impl1( @Property("someProperty") String propval ) {...} >> >>> >> >>> } >> >>> >> >>> /** Declared constructor unambiguously identifying all Property and >> >>> Reference values */ >> >>> >> >>> public class Impl2 { >> >>> >> >>> private String someProperty; >> >>> >> >>> private SomeService someReference; >> >>> >> >>> public Impl2( @Property("someProperty") String a, >> >>> >> >>> @Reference("someReference") SomeService b ) >> >>> >> >>> {...} >> >>> >> >>> } >> >>> >> >>> /** Declared constructor unambiguously identifying all Property and >> >>> Reference values >> >>> >> >>> plus an additional Property injected via a setter method */ >> >>> >> >>> public class Impl3 { >> >>> >> >>> private String someProperty; >> >>> >> >>> private String anotherProperty; >> >>> >> >>> private SomeService someReference; >> >>> >> >>> public Impl3( @Property("someProperty") String a, >> >>> >> >>> @Reference("someReference") SomeService b) >> >>> >> >>> {...} >> >>> >> >>> @Property >> >>> >> >>> public void setAnotherProperty( String anotherProperty ) {...} >> >>> >> >>> } >> >>> >> >>> /** No-arg constructor */ >> >>> >> >>> public class Impl4 { >> >>> >> >>> @Property >> >>> >> >>> public String someProperty; >> >>> >> >>> @Reference >> >>> >> >>> public SomeService someReference; >> >>> >> >>> public Impl4() {...} >> >>> >> >>> } >> >>> >> >>> >> >>> Yours, Mike. >> >>> >> >>> Strategist - Emerging Technologies, SCA & SDO. >> >>> Co Chair OASIS SCA Assembly TC. >> >>> IBM Hursley Park, Mail Point 146, Winchester, SO21 2JN, Great >> Britain. >> >>> Phone & FAX: +44-1962-818014 Mobile: +44-7802-467431 >> >>> Email: mike_edwards@uk.ibm.com >> >>> >> >>> >> >>> >> ------------------------------------------------------------------------ >> >>> >> >>> / >> >>> / >> >>> >> >>> /Unless stated otherwise above: >> >>> IBM United Kingdom Limited - Registered in England and Wales with >> number >> >>> 741598. >> >>> Registered office: PO Box 41, North Harbour, Portsmouth, >> Hampshire PO6 >> >> 3AU/ >> >>> >> >>> >> >>> >> >>> >> >> >> >> >> >> --------------------------------------------------------------------- >> >> To unsubscribe from this mail list, you must leave the OASIS TC that >> >> generates this mail. Follow this link to all your TCs in OASIS at: >> >> >> https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php >> >> >> >> >> >> >> >> >> >> --------------------------------------------------------------------- >> >> To unsubscribe from this mail list, you must leave the OASIS TC that >> >> generates this mail. Follow this link to all your TCs in OASIS at: >> >> >> https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php >> >> >> >> >> >> >> > >> > >> > >> > --------------------------------------------------------------------- >> > To unsubscribe from this mail list, you must leave the OASIS TC that >> > generates this mail. Follow this link to all your TCs in OASIS at: >> > https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php >> > >> > >> > >> > >> > --------------------------------------------------------------------- >> > To unsubscribe from this mail list, you must leave the OASIS TC that >> > generates this mail. Follow this link to all your TCs in OASIS at: >> > https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php >> > >> > >> > >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe from this mail list, you must leave the OASIS TC that >> generates this mail. Follow this link to all your TCs in OASIS at: >> https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php >> >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe from this mail list, you must leave the OASIS TC that >> generates this mail. Follow this link to all your TCs in OASIS at: >> https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php >> >> >> >> >> >> >> ------------------------------------------------------------------------ >> >> / >> / >> >> /Unless stated otherwise above: >> IBM United Kingdom Limited - Registered in England and Wales with >> number 741598. >> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 >> 3AU/ >> >> >> >> >> >> > > > > --------------------------------------------------------------------- > To unsubscribe from this mail list, you must leave the OASIS TC that > generates this mail. Follow this link to all your TCs in OASIS at: > https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php > >
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]