You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by Shay Thompson <st...@adobe.com> on 2011/02/21 01:20:10 UTC

Add Configuration to Bundle at Install

First off, forgive me if this should be sent to Felix list.

I have a bundle which after installing requires the user to go to the Configuration tab in the Felix Web Console, click on the Bundle name or the + symbol to open the 'Create new factory configuration' window and then hit Save to create a new configuration for that bundle with the default values.

My question is, is there a setting I can put somewhere in the bundle so when it gets installed a default Configuration is created for it automatically?  Some switch or setting in the manifest perhaps?

Thanks,
Shay

______________________________________________________________________________

Shay Thompson - Lead Computer Scientist
Adobe Systems, Inc. - AES Foundation



Re: Add Configuration to Bundle at Install

Posted by Vidar Ramdal <vi...@idium.no>.
> On Sun, Feb 20, 2011 at 7:20 PM, Shay Thompson <st...@adobe.com> wrote:
>> I have a bundle which after installing requires the user to go to the Configuration tab in the Felix Web Console, click on the Bundle name or the + symbol to open the 'Create new factory configuration' window and then hit Save to create a new configuration for that bundle with the default values.
>>
>> My question is, is there a setting I can put somewhere in the bundle so when it gets installed a default Configuration is created for it automatically?  Some switch or setting in the manifest perhaps?
>>

On Mon, Feb 21, 2011 at 1:43 AM, Justin Edelson
<ju...@justinedelson.com> wrote:
> AFAIK, you have to do this in code. But it isn't a lot of code :)
>
> Take a look at the Activator in the jackrabbit server bundle. Either
> on bundle start or when the ConfigAdmin service becomes available
> (which ever comes first), the verifyConfiguration() method is called.
>
> This method does the following:
> * lists the configurations for the factory PID
> * if there aren't any configurations for the PID, create a default one
> and save it.
>
> You could also use JCRInstall or FileInstall. These will let you
> install a default configuration.

... and that default configuration could be supplied in your bundle.

You might find some useful information on this in this thread:
http://sling.markmail.org/thread/vd2az5cj3sogf7u2#mid:lqogsvyschzzcnwj+state:results

Especially note the meaning of dashes in the config node name, as
explained by Bertrand in this message:
http://markmail.org/message/6lum4u6vnu2doanb

-- 
Vidar S. Ramdal <vi...@idium.no> - http://www.idium.no
Sommerrogata 13-15, N-0255 Oslo, Norway
+ 47 22 00 84 00
Quando omni flunkus moritatus!

Re: Add Configuration to Bundle at Install

Posted by Justin Edelson <ju...@justinedelson.com>.
AFAIK, you have to do this in code. But it isn't a lot of code :)

Take a look at the Activator in the jackrabbit server bundle. Either
on bundle start or when the ConfigAdmin service becomes available
(which ever comes first), the verifyConfiguration() method is called.

This method does the following:
* lists the configurations for the factory PID
* if there aren't any configurations for the PID, create a default one
and save it.

You could also use JCRInstall or FileInstall. These will let you
install a default configuration. HOWEVER, only writing code will let
you have logic like "only create this configuration if there aren't
any for this PID" (which is the true meaning of a default
configuration)

HTH,
Justin

On Sun, Feb 20, 2011 at 7:20 PM, Shay Thompson <st...@adobe.com> wrote:
>
> First off, forgive me if this should be sent to Felix list.
>
> I have a bundle which after installing requires the user to go to the Configuration tab in the Felix Web Console, click on the Bundle name or the + symbol to open the 'Create new factory configuration' window and then hit Save to create a new configuration for that bundle with the default values.
>
> My question is, is there a setting I can put somewhere in the bundle so when it gets installed a default Configuration is created for it automatically?  Some switch or setting in the manifest perhaps?
>
> Thanks,
> Shay
>
> ______________________________________________________________________________
>
> Shay Thompson - Lead Computer Scientist
> Adobe Systems, Inc. - AES Foundation
>
>
>