Re: Loading configuration files
On Fri, Nov 27, 2009 at 4:12 PM, Vidar Ramdal wrote: > On Fri, Nov 27, 2009 at 1:48 PM, Bertrand Delacretaz > wrote: >> Hi Vidar, >> >> On Fri, Nov 27, 2009 at 10:56 AM, Vidar Ramdal wrote: >>> ...Creating a node at >>> /apps/mybundle/install/org.apache.sling.commons.log.LogManager.factory.config-something.json, >>> with jcr:primaryType=sling:OsgiConfig did what I wanted... >> >> Cool - could you eventually add that as an example at >> http://sling.apache.org/site/jcr-installer-jcrjcrinstall-and-osgiinstaller.html >> >> where it says "A node named like o.a.s.foo.bar-a..." ? > > Will do. Did I understand correctly if I say that the 'a' after the > dash can in fact be any random string? Yes I think so, as long as it's unique. -Bertrand
Re: Loading configuration files
On Fri, Nov 27, 2009 at 1:48 PM, Bertrand Delacretaz wrote: > Hi Vidar, > > On Fri, Nov 27, 2009 at 10:56 AM, Vidar Ramdal wrote: >> ...Creating a node at >> /apps/mybundle/install/org.apache.sling.commons.log.LogManager.factory.config-something.json, >> with jcr:primaryType=sling:OsgiConfig did what I wanted... > > Cool - could you eventually add that as an example at > http://sling.apache.org/site/jcr-installer-jcrjcrinstall-and-osgiinstaller.html > > where it says "A node named like o.a.s.foo.bar-a..." ? Will do. Did I understand correctly if I say that the 'a' after the dash can in fact be any random string? -- Vidar S. Ramdal - http://www.idium.no Sommerrogata 13-15, N-0255 Oslo, Norway + 47 22 00 84 00 / +47 21 531941, ext 2070
Re: Loading configuration files
Hi Vidar, On Fri, Nov 27, 2009 at 10:56 AM, Vidar Ramdal wrote: > ...Creating a node at > /apps/mybundle/install/org.apache.sling.commons.log.LogManager.factory.config-something.json, > with jcr:primaryType=sling:OsgiConfig did what I wanted... Cool - could you eventually add that as an example at http://sling.apache.org/site/jcr-installer-jcrjcrinstall-and-osgiinstaller.html where it says "A node named like o.a.s.foo.bar-a..." ? Thanks, -Bertrand
RunMode service usage (was: Loading configuration files)
Hi Chris, On Fri, Nov 27, 2009 at 12:09 PM, wrote: > ...Can I ask how you might set the "runmode" of a server. The Sling 5 > instance I have doesn't seem to have the org.apache.sling.runmode > bundle. The CQ5 instance I have does, but I have looked for an OSGi > configuration page for that bundle but can't find one. I do see the > RunMode page in the felix console with the mode set to "author" I have just added a short documentation on this, should appear in a few hours under http://sling.apache.org/site/bundles.html For now, here's the relevant part: Installation The run mode service is not present in the default Sling launchpad builds, to activate it install and start the org.apache.sling.runmode bundle. Configuration Run modes can only be configured using a system property, or via the sling.properties file. Using -Dsling.run.modes=foo,bar on the JVM command-line, for example, activates the foo and bar run modes. This command-line parameter takes precedence over a similar definition (sling.run.modes=dev,staging) that might be present in the sling.properties file found in the Sling home directory. Hope this helps, -Bertrand
RE: Loading configuration files
Hi Bertrand, Can I ask how you might set the "runmode" of a server. The Sling 5 instance I have doesn't seem to have the org.apache.sling.runmode bundle. The CQ5 instance I have does, but I have looked for an OSGi configuration page for that bundle but can't find one. I do see the RunMode page in the felix console with the mode set to "author". There is just a TODO in the documentation for this feature (http://sling.apache.org/site/jcr-installer-jcrjcrinstall-and-osgiinstal ler.html) Kind regards, Chris Pilsworth -Original Message- From: Bertrand Delacretaz [mailto:bdelacre...@apache.org] Sent: 27 November 2009 09:27 To: users Subject: Re: Loading configuration files On Fri, Nov 27, 2009 at 10:06 AM, Alexander Klimetschek wrote: > .../apps/mybundle/config/org.apache.sling.config.log.LogManager.factory > (using the sling:OsgiConfig nodetype)... The folder name has to be "install" with the default jcrinstall config used in Sling (that's DEFAULT_FOLDER_NAME_REGEXP in JcrInstaller.java: .*/install$). Or install.foo where foo is a runmode that's currently active, as set by the org.apache.sling.runmode bundle - this allows you to have different configs based on run mode. So that would be /apps/mybundle/install/org and it's correct that the node that holds the config has to be of sling:OsgiConfig node type. Note that dashes in the sling:OsgiConfig node name have a special meaning, they are used to separate between the factory and configuration PIDs, a node named like o.a.s.foo.bar-a for example uses "a" as its factory PID, and "o.a.s.foo.bar" as its configuration PID . -Bertrand
Re: Loading configuration files
> On Fri, Nov 27, 2009 at 10:06 AM, Alexander Klimetschek > wrote: > >> .../apps/mybundle/config/org.apache.sling.config.log.LogManager.factory >> (using the sling:OsgiConfig nodetype)... On Fri, Nov 27, 2009 at 10:26 AM, Bertrand Delacretaz wrote: > The folder name has to be "install" with the default jcrinstall config > used in Sling (that's DEFAULT_FOLDER_NAME_REGEXP in JcrInstaller.java: > .*/install$). > > Or install.foo where foo is a runmode that's currently active, as set > by the org.apache.sling.runmode bundle - this allows you to have > different configs based on run mode. > > So that would be > > /apps/mybundle/install/org > > and it's correct that the node that holds the config has to be of > sling:OsgiConfig node type. > > Note that dashes in the sling:OsgiConfig node name have a special > meaning, they are used to separate between the factory and > configuration PIDs, a node named like o.a.s.foo.bar-a for example uses > "a" as its factory PID, and "o.a.s.foo.bar" as its configuration PID . Aha - THAT's the clue! Creating a node at /apps/mybundle/install/org.apache.sling.commons.log.LogManager.factory.config-something.json, with jcr:primaryType=sling:OsgiConfig did what I wanted. Thanks, both of you! -- Vidar S. Ramdal - http://www.idium.no Sommerrogata 13-15, N-0255 Oslo, Norway + 47 22 00 84 00 / +47 21 531941, ext 2070
Re: Loading configuration files
On Fri, Nov 27, 2009 at 10:06 AM, Alexander Klimetschek wrote: > .../apps/mybundle/config/org.apache.sling.config.log.LogManager.factory > (using the sling:OsgiConfig nodetype)... The folder name has to be "install" with the default jcrinstall config used in Sling (that's DEFAULT_FOLDER_NAME_REGEXP in JcrInstaller.java: .*/install$). Or install.foo where foo is a runmode that's currently active, as set by the org.apache.sling.runmode bundle - this allows you to have different configs based on run mode. So that would be /apps/mybundle/install/org and it's correct that the node that holds the config has to be of sling:OsgiConfig node type. Note that dashes in the sling:OsgiConfig node name have a special meaning, they are used to separate between the factory and configuration PIDs, a node named like o.a.s.foo.bar-a for example uses "a" as its factory PID, and "o.a.s.foo.bar" as its configuration PID . -Bertrand
Re: Loading configuration files
On Thu, Nov 26, 2009 at 23:08, Vidar Ramdal wrote: >> Yes, using the jcrinstall bundle and creating a sling:OsgiConfig node >> (which you can easily define as initial content). The node must reside >> in a "config" folder [...] > > You mean "install", right? No, but I think the name is not important, the nodetype sling:OsgiConfig is the marker here. (@Bertrand: could you clarify?) > I'm struggling to get this to work. When I manually create a > LogManager.factory.config configuration (through the web console), the > configuration appears on the "Configurations" drop down list. Also, a > .config file is created in the > sling/config/o/a/s/c/log/LogManager/factory/config directory, called > dc2c6dfb-47c4-40c8-bf55-1651bb557504.config. > The configuration also works: The custom logging I've set up is working. > > Now, to avoid having to set this up manually each time I deploy my > application, I thought I could just put that file in my bundle, and > loading it as initial content under > /apps/mybundle/install/dc2c6dfb-47c4-40c8-bf55-1651bb557504.config No, as mentioned above, it should have the service pid, which in this case is "org.apache.sling.config.log.LogManager.factory.config". If you look at the Felix web console you'll find it as PID at the bottom for copy&paste. The uuid you used is only an implementation detail of how Felix persists the configuration on the filesystem. Try /apps/mybundle/config/org.apache.sling.config.log.LogManager.factory (using the sling:OsgiConfig nodetype) Regards, Alex -- Alexander Klimetschek alexander.klimetsc...@day.com
Re: Loading configuration files
On Fri, Oct 30, 2009 at 7:51 PM, Alexander Klimetschek wrote: > On Fri, Oct 30, 2009 at 18:21, Vidar Ramdal wrote: >> Is there a way to provide configuration files (*.config) as >> initial-content in a bundle? >> >> We need to set a config property for the Authorization Header >> Authenticator, and I've found the config file under the >> sling/config/org/o/a/s/httpauth/impl/AuthorizationHeaderAuthenticationHandler.config >> - which I have edited. >> Now, I'd like to apply this configuration when I install a bundle. >> >> Is that possible, and how? > > Yes, using the jcrinstall bundle and creating a sling:OsgiConfig node > (which you can easily define as initial content). The node must reside > in a "config" folder [...] You mean "install", right? > and have the name of the service pid, ie. the > class name. For Example: > > /libs/sling/config/org.apache.sling.commons.log.LogManager > > The properties of this node will be mapped one to one on OSGI config > properties, eg. > > org.apache.sling.commons.log.level = info > (string property) > > See also "Install, modify and remove a configuration" on > http://sling.apache.org/site/jcr-installer-jcrjcrinstall-and-osgiinstaller.html I'm struggling to get this to work. When I manually create a LogManager.factory.config configuration (through the web console), the configuration appears on the "Configurations" drop down list. Also, a .config file is created in the sling/config/o/a/s/c/log/LogManager/factory/config directory, called dc2c6dfb-47c4-40c8-bf55-1651bb557504.config. The configuration also works: The custom logging I've set up is working. Now, to avoid having to set this up manually each time I deploy my application, I thought I could just put that file in my bundle, and loading it as initial content under /apps/mybundle/install/dc2c6dfb-47c4-40c8-bf55-1651bb557504.config Granted, the file gets picked up by JCRInstaller. In the aforementioned directory I now get an empty *folder* called dc2c6dfb. OK, maybe JCRInstaller chokes on the dashes (-) in the filename, so I removed those, renaming the file in my bundle to c2c6dfb47c440c8bf551651bb557504.config When installing the bundle again, the file pops up in the correct directory - but not on the drop down list on /system/console/configMgr. And the configuration is not working. What am I doing wrong? (I'm not really experienced with OSGI config stuff). -- Vidar S. Ramdal - http://www.idium.no Sommerrogata 13-15, N-0255 Oslo, Norway + 47 22 00 84 00 / +47 21 531941, ext 2070
Re: Loading configuration files
On Fri, Oct 30, 2009 at 18:21, Vidar Ramdal wrote: > Is there a way to provide configuration files (*.config) as > initial-content in a bundle? > > We need to set a config property for the Authorization Header > Authenticator, and I've found the config file under the > sling/config/org/o/a/s/httpauth/impl/AuthorizationHeaderAuthenticationHandler.config > - which I have edited. > Now, I'd like to apply this configuration when I install a bundle. > > Is that possible, and how? Yes, using the jcrinstall bundle and creating a sling:OsgiConfig node (which you can easily define as initial content). The node must reside in a "config" folder and have the name of the service pid, ie. the class name. For Example: /libs/sling/config/org.apache.sling.commons.log.LogManager The properties of this node will be mapped one to one on OSGI config properties, eg. org.apache.sling.commons.log.level = info (string property) See also "Install, modify and remove a configuration" on http://sling.apache.org/site/jcr-installer-jcrjcrinstall-and-osgiinstaller.html Regards, Alex -- Alexander Klimetschek alexander.klimetsc...@day.com
Loading configuration files
Is there a way to provide configuration files (*.config) as initial-content in a bundle? We need to set a config property for the Authorization Header Authenticator, and I've found the config file under the sling/config/org/o/a/s/httpauth/impl/AuthorizationHeaderAuthenticationHandler.config - which I have edited. Now, I'd like to apply this configuration when I install a bundle. Is that possible, and how? -- Vidar S. Ramdal - http://www.idium.no Sommerrogata 13-15, N-0255 Oslo, Norway + 47 22 00 84 00 / +47 21 531941, ext 2070