Configuring the AutoInstallPlugin to cater for start levels
bosschaert May 5, 2010 9:29 AMI'm currently working on implementing the Start Level Service and as part of this users should be able to set the start level of a bundle that is configured through the AutoInstallPlugin...
Currently its configuration looks like this:
{code:xml} <bean name="OSGiAutoInstallPlugin">
<!-- snip -->
<property name="autoStart">
<list elementClass="java.net.URL">
<value>${osgi.home}/server/minimal/deploy/org.apache.felix.log.jar</value>
<value>${osgi.home}/server/minimal/deploy/jboss-osgi-common.jar</value>
<value>${osgi.home}/server/minimal/deploy/jboss-osgi-hotdeploy.jar</value>
</list>
</property>
</bean>{code}
I was thinking about how users would configure this in the AutoInstall configuration... I think they're 3 options:
1. I could change the autoStart property into a map where the key is the url and the value is the start level, like this:
{code:xml} <bean name="OSGiAutoInstallPlugin">
<!-- snip -->
<property name="autoStart">
<map keyClass="java.net.URL" valueClass="java.lang.Integer">
<entry>
<key>${osgi.home}/server/minimal/deploy/org.apache.felix.log.jar</key>
<value>3</value>
</entry>
<entry>
<key>${osgi.home}/server/minimal/deploy/jboss-osgi-common.jar</key>
<value>4</value>
</entry>
<entry>
<key>/server/minimal/deploy/jboss-osgi-hotdeploy.jar</key>
<value>4</value>
</entry>
</map>
</property>
</bean>{code}
I don't really like it as it's quite verbose, not backwards compatible and cannot be extended (if we want to add further metadata to the bundle list).
2. Alternatively I could keep it a list like it is now, but enhance the syntax so that the start level can be part of the URL:
{code:xml} <bean name="OSGiAutoInstallPlugin">
<!-- snip -->
<property name="autoStart">
<list elementClass="java.net.URL">
<value>${osgi.home}/server/minimal/deploy/org.apache.felix.log.jar?startLevel=3</value>
<value>${osgi.home}/server/minimal/deploy/jboss-osgi-common.jar?startLevel=4</value>
<value>${osgi.home}/server/minimal/deploy/jboss-osgi-hotdeploy.jar?startLevel=4</value>
</list>
</property>
</bean>{code}
An advantage of this is that it can be made backward compatible and is fairly simple. It can also be enhanced to contain other metadata in the future...
3. Finally we could introduce a value object (bean) that is strongly typed and then put in a list of these. I think this is might be overkilll...
Thoughts anyone? I think I like option 2 best...