You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Benson Margulies <be...@basistech.com> on 2015/11/17 19:00:25 UTC

DRY for DS?

I'm feeling a bit sad; I have a family of 12 very similar services,
but I can't put the @Reference, @Activate, and @Deactivate into the
base class, I have to copy and paste it into each component class.

Have I missed an alternative?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: DRY for DS?

Posted by Robert Munteanu <ro...@apache.org>.
On Tue, Nov 17, 2015 at 10:19 PM, Ferry Huberts <ma...@hupie.com> wrote:
> For bnd you really do need the @Activate and @Deactivate annotations,
> otherwise the component XML doesn't specify them

To my understanding they don't have to be in the component XML.


See 112.5.8 - Activate Method and 112.5.15 - Deactivate Method in the
OSGi R6 Compendium specs for details.

Robert

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: DRY for DS?

Posted by Ferry Huberts <ma...@hupie.com>.
For bnd you really do need the @Activate and @Deactivate annotations, 
otherwise the component XML doesn't specify them

On 17/11/15 20:57, Robert Munteanu wrote:
> On Tue, Nov 17, 2015 at 9:47 PM, Benson Margulies <be...@basistech.com> wrote:
>> On Tue, Nov 17, 2015 at 2:43 PM, Robert Munteanu <ro...@apache.org> wrote:
>>> Hi Benson,
>>>
>>> On Tue, Nov 17, 2015 at 8:00 PM, Benson Margulies <be...@basistech.com> wrote:
>>>> I'm feeling a bit sad; I have a family of 12 very similar services,
>>>> but I can't put the @Reference, @Activate, and @Deactivate into the
>>>> base class, I have to copy and paste it into each component class.
>>>>
>>>> Have I missed an alternative?
>>>
>>> The @Activate and @Deactivate annotations are optional if you stick to
>>> the standard 'activate' and 'deactivate' method names.
>>
>> I've also got some @References being repeated.
>>
>> As far as 'standard' goes, this is the standard that specs how bnd
>> turns .class files into XML? So my only concern would be that some
>> other tool might not do it?
>
> The default activate and deactivate method names are not tied to bnd.
> They are considered when these method names are not defined in the XML
> descriptor.
>
> Robert
>
>
>

-- 
Ferry Huberts

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: DRY for DS?

Posted by Robert Munteanu <ro...@lmn.ro>.
On Tue, Nov 17, 2015 at 9:47 PM, Benson Margulies <be...@basistech.com> wrote:
> On Tue, Nov 17, 2015 at 2:43 PM, Robert Munteanu <ro...@apache.org> wrote:
>> Hi Benson,
>>
>> On Tue, Nov 17, 2015 at 8:00 PM, Benson Margulies <be...@basistech.com> wrote:
>>> I'm feeling a bit sad; I have a family of 12 very similar services,
>>> but I can't put the @Reference, @Activate, and @Deactivate into the
>>> base class, I have to copy and paste it into each component class.
>>>
>>> Have I missed an alternative?
>>
>> The @Activate and @Deactivate annotations are optional if you stick to
>> the standard 'activate' and 'deactivate' method names.
>
> I've also got some @References being repeated.
>
> As far as 'standard' goes, this is the standard that specs how bnd
> turns .class files into XML? So my only concern would be that some
> other tool might not do it?

The default activate and deactivate method names are not tied to bnd.
They are considered when these method names are not defined in the XML
descriptor.

Robert



-- 
Sent from my (old) computer

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: DRY for DS?

Posted by David Jencks <da...@gmail.com>.
Actually…. now the @Component has a reference member and you can specify the @References there.  You’ll have to do a lot of specifying, so I’d use the bnd-specific inherit support but if you are really worried about compatibility you can put everything in the @Component annotation.

My theory is that 
(1) allowing this for classes where all the annotated superclasses are in the same bundle is completely safe
(2) in any case it is just as safe as the service-component header method.

So I’d be in favor of lobbying that the 1.4 ds spec allow at least case (1).

david jencks

> On Nov 17, 2015, at 4:24 PM, Benson Margulies <be...@basistech.com> wrote:
> 
> On Tue, Nov 17, 2015 at 3:32 PM, David Jencks <david.a.jencks@gmail.com <ma...@gmail.com>> wrote:
>> nonstandard == not in the DS 1.3 spec.
>> 
>> These options are only supported by bnd, but I don’t really foresee anyone else writing a ds annotation processing tool.  Do you?
> 
> That was the point I was trying to make.
> 
>> 
>> thanks
>> david jencks
>> 
>>> On Nov 17, 2015, at 2:47 PM, Benson Margulies <be...@basistech.com> wrote:
>>> 
>>> On Tue, Nov 17, 2015 at 2:43 PM, Robert Munteanu <ro...@apache.org> wrote:
>>>> Hi Benson,
>>>> 
>>>> On Tue, Nov 17, 2015 at 8:00 PM, Benson Margulies <be...@basistech.com> wrote:
>>>>> I'm feeling a bit sad; I have a family of 12 very similar services,
>>>>> but I can't put the @Reference, @Activate, and @Deactivate into the
>>>>> base class, I have to copy and paste it into each component class.
>>>>> 
>>>>> Have I missed an alternative?
>>>> 
>>>> The @Activate and @Deactivate annotations are optional if you stick to
>>>> the standard 'activate' and 'deactivate' method names.
>>> 
>>> I've also got some @References being repeated.
>>> 
>>> As far as 'standard' goes, this is the standard that specs how bnd
>>> turns .class files into XML? So my only concern would be that some
>>> other tool might not do it?
>>> 
>>> 
>>>> 
>>>> See 112.5.8 - Activate Method and 112.5.15 - Deactivate Method in the
>>>> OSGi R6 Compendium specs for details.
>>>> 
>>>> Robert
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org <ma...@felix.apache.org>
> For additional commands, e-mail: users-help@felix.apache.org <ma...@felix.apache.org>

Re: DRY for DS?

Posted by Benson Margulies <be...@basistech.com>.
On Tue, Nov 17, 2015 at 3:32 PM, David Jencks <da...@gmail.com> wrote:
> nonstandard == not in the DS 1.3 spec.
>
> These options are only supported by bnd, but I don’t really foresee anyone else writing a ds annotation processing tool.  Do you?

That was the point I was trying to make.

>
> thanks
> david jencks
>
>> On Nov 17, 2015, at 2:47 PM, Benson Margulies <be...@basistech.com> wrote:
>>
>> On Tue, Nov 17, 2015 at 2:43 PM, Robert Munteanu <ro...@apache.org> wrote:
>>> Hi Benson,
>>>
>>> On Tue, Nov 17, 2015 at 8:00 PM, Benson Margulies <be...@basistech.com> wrote:
>>>> I'm feeling a bit sad; I have a family of 12 very similar services,
>>>> but I can't put the @Reference, @Activate, and @Deactivate into the
>>>> base class, I have to copy and paste it into each component class.
>>>>
>>>> Have I missed an alternative?
>>>
>>> The @Activate and @Deactivate annotations are optional if you stick to
>>> the standard 'activate' and 'deactivate' method names.
>>
>> I've also got some @References being repeated.
>>
>> As far as 'standard' goes, this is the standard that specs how bnd
>> turns .class files into XML? So my only concern would be that some
>> other tool might not do it?
>>
>>
>>>
>>> See 112.5.8 - Activate Method and 112.5.15 - Deactivate Method in the
>>> OSGi R6 Compendium specs for details.
>>>
>>> Robert
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: DRY for DS?

Posted by David Jencks <da...@gmail.com>.
nonstandard == not in the DS 1.3 spec.

These options are only supported by bnd, but I don’t really foresee anyone else writing a ds annotation processing tool.  Do you?

thanks
david jencks

> On Nov 17, 2015, at 2:47 PM, Benson Margulies <be...@basistech.com> wrote:
> 
> On Tue, Nov 17, 2015 at 2:43 PM, Robert Munteanu <ro...@apache.org> wrote:
>> Hi Benson,
>> 
>> On Tue, Nov 17, 2015 at 8:00 PM, Benson Margulies <be...@basistech.com> wrote:
>>> I'm feeling a bit sad; I have a family of 12 very similar services,
>>> but I can't put the @Reference, @Activate, and @Deactivate into the
>>> base class, I have to copy and paste it into each component class.
>>> 
>>> Have I missed an alternative?
>> 
>> The @Activate and @Deactivate annotations are optional if you stick to
>> the standard 'activate' and 'deactivate' method names.
> 
> I've also got some @References being repeated.
> 
> As far as 'standard' goes, this is the standard that specs how bnd
> turns .class files into XML? So my only concern would be that some
> other tool might not do it?
> 
> 
>> 
>> See 112.5.8 - Activate Method and 112.5.15 - Deactivate Method in the
>> OSGi R6 Compendium specs for details.
>> 
>> Robert
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: DRY for DS?

Posted by Benson Margulies <be...@basistech.com>.
On Tue, Nov 17, 2015 at 2:43 PM, Robert Munteanu <ro...@apache.org> wrote:
> Hi Benson,
>
> On Tue, Nov 17, 2015 at 8:00 PM, Benson Margulies <be...@basistech.com> wrote:
>> I'm feeling a bit sad; I have a family of 12 very similar services,
>> but I can't put the @Reference, @Activate, and @Deactivate into the
>> base class, I have to copy and paste it into each component class.
>>
>> Have I missed an alternative?
>
> The @Activate and @Deactivate annotations are optional if you stick to
> the standard 'activate' and 'deactivate' method names.

I've also got some @References being repeated.

As far as 'standard' goes, this is the standard that specs how bnd
turns .class files into XML? So my only concern would be that some
other tool might not do it?


>
> See 112.5.8 - Activate Method and 112.5.15 - Deactivate Method in the
> OSGi R6 Compendium specs for details.
>
> Robert
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: DRY for DS?

Posted by Robert Munteanu <ro...@apache.org>.
Hi Benson,

On Tue, Nov 17, 2015 at 8:00 PM, Benson Margulies <be...@basistech.com> wrote:
> I'm feeling a bit sad; I have a family of 12 very similar services,
> but I can't put the @Reference, @Activate, and @Deactivate into the
> base class, I have to copy and paste it into each component class.
>
> Have I missed an alternative?

The @Activate and @Deactivate annotations are optional if you stick to
the standard 'activate' and 'deactivate' method names.

See 112.5.8 - Activate Method and 112.5.15 - Deactivate Method in the
OSGi R6 Compendium specs for details.

Robert

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: DRY for DS?

Posted by Ferry Huberts <ma...@hupie.com>.

On 17/11/15 19:00, Benson Margulies wrote:
> I'm feeling a bit sad; I have a family of 12 very similar services,
> but I can't put the @Reference, @Activate, and @Deactivate into the
> base class, I have to copy and paste it into each component class.
>
> Have I missed an alternative?

(bnd instructions)

-dsannotations: *
-dsannotations-options: inherit
-metatypeannotations: *


The relevant one is the 'inherit' one.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: DRY for DS?

Posted by Benson Margulies <be...@basistech.com>.
They are.

On Tue, Nov 17, 2015 at 1:10 PM, David Jencks <da...@gmail.com> wrote:
> sure you can
>
> -dsannotations-options=inherit
>
> not spec yet, but maybe we can eventually twist some arms :-)
>
> I really recommend only doing this if all the classes with annotations are in the same bundle.
>
> david jencks
>
>> On Nov 17, 2015, at 1:00 PM, Benson Margulies <be...@basistech.com> wrote:
>>
>> I'm feeling a bit sad; I have a family of 12 very similar services,
>> but I can't put the @Reference, @Activate, and @Deactivate into the
>> base class, I have to copy and paste it into each component class.
>>
>> Have I missed an alternative?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: DRY for DS?

Posted by David Jencks <da...@gmail.com>.
sure you can

-dsannotations-options=inherit

not spec yet, but maybe we can eventually twist some arms :-)

I really recommend only doing this if all the classes with annotations are in the same bundle.

david jencks

> On Nov 17, 2015, at 1:00 PM, Benson Margulies <be...@basistech.com> wrote:
> 
> I'm feeling a bit sad; I have a family of 12 very similar services,
> but I can't put the @Reference, @Activate, and @Deactivate into the
> base class, I have to copy and paste it into each component class.
> 
> Have I missed an alternative?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>