You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Phillip Rhodes <rh...@gmail.com> on 2013/05/13 23:05:20 UTC

How to specify a @Property with a valueRef?

Hello,

I am trying to migrate from the a javadoc style of specifying OSGI
information to using the proper Java notations.   I am using information
that I found at the following URL
http://felix.apache.org/documentation/subprojects/apache-felix-maven-scr-plugin/scr-annotations.htmlbut
I haven't been able to find an example of creating a Property that has
a "valueRef"
.

Here's an example of the old style that I am trying to convert:

@scr.property name="event.topics" valueRef="ReplicationAction.EVENT_TOPIC"


I would like to be able to...

import org.apache.felix.scr.annotations.*;

...

@Component(immediate=true)
@Service
@Properties({
    @Property(name = "service.vendor", value = "xyz"),

    @Property(name = "event.topics", ????)
})


I would appreciate any pointers/links to more info.  I may not have the
right google keywords to dig the answer out.

Thanks,

Phillip

Re: How to specify a @Property with a valueRef?

Posted by Carsten Ziegeler <cz...@apache.org>.
Yepp, that's the solution :)

Carsten


2013/5/13 Neil Bartlett <nj...@gmail.com>

> Sorry if I've missed something obvious but... can't you just replace
> "????" with ReplicationAction.EVENT_TOPIC, without quotes? It's a
> direct reference to a Java literal.
>
> Neil
>
> On Mon, May 13, 2013 at 10:05 PM, Phillip Rhodes
> <rh...@gmail.com> wrote:
> > Hello,
> >
> > I am trying to migrate from the a javadoc style of specifying OSGI
> > information to using the proper Java notations.   I am using information
> > that I found at the following URL
> >
> http://felix.apache.org/documentation/subprojects/apache-felix-maven-scr-plugin/scr-annotations.htmlbut
> > I haven't been able to find an example of creating a Property that has
> > a "valueRef"
> > .
> >
> > Here's an example of the old style that I am trying to convert:
> >
> > @scr.property name="event.topics"
> valueRef="ReplicationAction.EVENT_TOPIC"
> >
> >
> > I would like to be able to...
> >
> > import org.apache.felix.scr.annotations.*;
> >
> > ...
> >
> > @Component(immediate=true)
> > @Service
> > @Properties({
> >     @Property(name = "service.vendor", value = "xyz"),
> >
> >     @Property(name = "event.topics", ????)
> > })
> >
> >
> > I would appreciate any pointers/links to more info.  I may not have the
> > right google keywords to dig the answer out.
> >
> > Thanks,
> >
> > Phillip
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
Carsten Ziegeler
cziegeler@apache.org

Re: How to specify a @Property with a valueRef?

Posted by Neil Bartlett <nj...@gmail.com>.
Sorry if I've missed something obvious but... can't you just replace
"????" with ReplicationAction.EVENT_TOPIC, without quotes? It's a
direct reference to a Java literal.

Neil

On Mon, May 13, 2013 at 10:05 PM, Phillip Rhodes
<rh...@gmail.com> wrote:
> Hello,
>
> I am trying to migrate from the a javadoc style of specifying OSGI
> information to using the proper Java notations.   I am using information
> that I found at the following URL
> http://felix.apache.org/documentation/subprojects/apache-felix-maven-scr-plugin/scr-annotations.htmlbut
> I haven't been able to find an example of creating a Property that has
> a "valueRef"
> .
>
> Here's an example of the old style that I am trying to convert:
>
> @scr.property name="event.topics" valueRef="ReplicationAction.EVENT_TOPIC"
>
>
> I would like to be able to...
>
> import org.apache.felix.scr.annotations.*;
>
> ...
>
> @Component(immediate=true)
> @Service
> @Properties({
>     @Property(name = "service.vendor", value = "xyz"),
>
>     @Property(name = "event.topics", ????)
> })
>
>
> I would appreciate any pointers/links to more info.  I may not have the
> right google keywords to dig the answer out.
>
> Thanks,
>
> Phillip

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