2009/3/16 Juan José Vázquez Delgado <[email protected]>: >> ...it should >> be nice to have a way to override some component properties when >> building a custom sling app. > > Maybe you can make use of Apache Felix File Install [1] (but i´m not > sure about this)....
The sling jcrinstall module [1] is similar in scope, but more integrated with Sling. Along with loading bundles from the repository, jcrinstall allows OSGi configurations to be defined using sling:OsgiConfig nodes in the repository (which can be loaded as initial content). To define an OSGi config, create a node of type sling:OsgiConfig under the /libs/*/install or /apps/*/install path, name the node according to the OSGi PID of the configuration to create, and add properties to the node to define parameters. For example, creating such a node at /apps/test/install/some.service with a property "foo=bar" creates an OSGi configuration with pid = some.service foo = bar Which the framework will provide as a configuration to the component having the "some.service" pid. The jcrinstall bundle must be active for this to happen (obviously ;-) To figure out which pid to use, you can set configuration parameters in the OSGi console for the component that you want to configure, and check the system/console/config page to see the details of the configuration that's been created. Note that this is unidirectional, changing the config later in the OSGi console does not change the node. The idea is to use those nodes as an alternative "user interface" to the OSGi configurations. Hope this helps, and don't hesitate to ask questions if anything's unclear - this needs docs and samples, obviously. -Bertrand
