If you are writing an abstract Felix OSGi component, make sure componentAbstract is true:
@Component(componentAbstract=true, ...)//@Service Abstract component can't be Servicepublic abstract class Foo ....
Also, if you want your component to be configurable through Felix Web Console (/system/console/components shows Configure button, little wrench icon), set metatype to true
@Component(metatype=true, ...)@Servicepublic class Foo ...
Available fields on Felix Web Console can be configured using @Property annotation:
This (along with metatype=true) will create a form field on Felix Web Console that has maximum number of elements of 1000. If you put more than 1000 entries through the form, 1001th element and on will be truncated.
@Property(cardinality=-1000, label="Hosts", description="a list of hosts", value={})private static final String PROP_HOSTS = "my.hosts";
The document, http://felix.apache.org/site/scr-annotations.html, says that cardinality=Integer.MIN_INT, but it does not work if you specify a variable there. See, https://issues.apache.org/jira/browse/FELIX-2704 .
Also, cardinality=-2147483648 won't work. Probably because it's too large. I get NumberFormatException.
To set the type of the property, use longValue, doubleValue...etc instead of value={}.
No comments:
Post a Comment