You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@ace.apache.org by "Robert M. Mather" <ro...@gmail.com> on 2015/03/21 05:25:55 UTC

Some clarifications about ACE template config engine

Trying to clarify how to use ACE for provisioning configuration along with
bundles.

Using the template engine
<https://ace.apache.org/docs/user-guide.html#using-the-template-engine-for-targets>,
would a metatype.xml inside a bundle (ie in the OSGI-INF/metatype
directory, per the spec) be processed and the variables substituted, or
does the metatype need to be deployed as a separate artifact.

Just for my understanding, where does the interpolation actually take
place? I've been assuming it's a process at the client/target...

If the same "tag" key gets set at multiple stages (ie artifact, feature,
dist, and/or target), is the a "last one wins" rule or something when the
interpolation takes place?

And finally, is this example metatype.xml the right idea for adding the
${context.blah} variables (in the content field)?

<?xml version="1.0" encoding="UTF-8"?><metatype:MetaData
xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.1.0">
    <OCD id="ocd" name="ocd">
        <AD id="server" type="String" />
    </OCD>

    <Designate pid="org.amdatu.conf" bundle="org.amdatu.sample.bundle">
        <Object ocdref="ocd">
            <Attribute adref="server" name="serverurl"
content="${context.serverUrl}" />
        </Object>
    </Designate></metatype:MetaData>


I'm using declarative services with bnd(tools), which is generating
metatype from my @OCD annotated interfaces, so I'm trying to find the
best/most automated way to prepare those for Apache ACE with template
variables.

Any thoughts on the right way to do that would be much appreciated, I'm
hoping I'm not the first person to want to do something like this!

Thanks,

Robert

Re: Some clarifications about ACE template config engine

Posted by "Robert M. Mather" <ro...@gmail.com>.
Thanks so much, that's precisely the info I needed.

On Mar 23, 2015 6:33 AM, "Jan Willem Janssen" <ja...@luminis.eu>
wrote:
>
> Hi Robert,
>
> > On 21 Mar 2015, at 05:25, Robert M. Mather <ro...@gmail.com>
wrote:
> >
> > Using the template engine
> > <
https://ace.apache.org/docs/user-guide.html#using-the-template-engine-for-targets
>,
> > would a metatype.xml inside a bundle (ie in the OSGI-INF/metatype
> > directory, per the spec) be processed and the variables substituted, or
> > does the metatype need to be deployed as a separate artifact.
>
> By default, the ACE templating system only works on metatype resources
deployed
> as separate files. The idea behind this is that you generally want to
have a
> “standard” set of bundles which can be configured individually per target.
>
> > Just for my understanding, where does the interpolation actually take
> > place? I've been assuming it's a process at the client/target…
>
> The processing is done at the server side right before the deployment
package
> is transferred to the client. This way, each client can get its own
“unique”
> deployment set including the proper configuration files.
>
> > If the same "tag" key gets set at multiple stages (ie artifact, feature,
> > dist, and/or target), is the a "last one wins" rule or something when
the
> > interpolation takes place?
>
> IIRC, the last ones wins indeed, but I’d need to test that out myself...
>
> >
> > And finally, is this example metatype.xml the right idea for adding the
> > ${context.blah} variables (in the content field)?
> >
> > <?xml version="1.0" encoding="UTF-8"?><metatype:MetaData
> > xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.1.0">
> >    <OCD id="ocd" name="ocd">
> >        <AD id="server" type="String" />
> >    </OCD>
> >
> >    <Designate pid="org.amdatu.conf" bundle="org.amdatu.sample.bundle">
> >        <Object ocdref="ocd">
> >            <Attribute adref="server" name="serverurl"
> > content="${context.serverUrl}" />
> >        </Object>
> >    </Designate></metatype:MetaData>
>
> Almost: the bundle-attribute needs to be prefixed with “osgi-dp:” to make
> it clear that the configuration PID (org.amdatu.conf) is for a bundle
> that is part of a deployment package. The AutoConf resource processor used
> by ACE does not allow configurations to be provisioned to bundles that are
> *not* part of a deployment package.
> Apart from that the example metatype is correct, including the template
> variable.
>
> > I'm using declarative services with bnd(tools), which is generating
> > metatype from my @OCD annotated interfaces, so I'm trying to find the
> > best/most automated way to prepare those for Apache ACE with template
> > variables.
> >
> > Any thoughts on the right way to do that would be much appreciated, I'm
> > hoping I'm not the first person to want to do something like this!
>
> Its been a while since I played with the metatype support of Bnd, but
> I believe it will embed the metatype resource files inside the bundles,
> which (as I written above) are not considered by the ACE template
> processor. If you want to keep using Bnd for generating metatype
> resources (which I can understand, given its great support) you could
> separate the actual configuration (read: Designate) from its definition
> (read: OCD): the metatype spec does allow that. This would mean that you
> provide the designates in separate files (which the ACE template
> processor can act upon) while the OCDs are created from your Bnd build.

Perfect, this is what I was hoping for. I'm assuming everything will get
pulled together based on the PID, so the filename for the metatype
designates won't matter. I guess I'll find out pretty quick if that's not
the case.

>
> Hope this helps,
>
> --
> Met vriendelijke groeten | Kind regards
>
> Jan Willem Janssen | Software Architect
> +31 631 765 814
>
> My world is revolving around INAETICS and Amdatu
>
> Luminis Technologies B.V.
> Churchillplein 1
> 7314 BZ   Apeldoorn
> +31 88 586 46 00
>
> http://www.luminis-technologies.com
> http://www.luminis.eu
>
> KvK (CoC) 09 16 28 93
> BTW (VAT) NL8169.78.566.B.01
>

Re: Some clarifications about ACE template config engine

Posted by "Robert M. Mather" <ro...@gmail.com>.
On Wed, Apr 15, 2015 at 3:40 AM, Robert M. Mather <
robert.mather.rmm@gmail.com> wrote:

> On Wed, Apr 15, 2015 at 1:08 AM, Jan Willem Janssen <
> janwillem.janssen@luminis.eu> wrote:
>
>> Hi Robert,
>>
>> > On 14 Apr 2015, at 19:28, Robert M. Mather <ro...@gmail.com>
>> wrote:
>> >
>> >>
>> >> Ok, then I'm not sure how to explain the issue I'm having. The client
>> > side error log is the same for all the bundles I've tried:
>> >
>> >> 2015-04-14 10:13:10 | ERROR | ACE Agent Controller | 1 - Installation
>> of
>> > deployment update failed: Error while processing resource
>> >
>> 'com.patronpath.ring.channel.pubnub.PubnubChannel.Config_ring-ace-agent-test_30.0.0.xml'
>> > (463)!
>> > org.osgi.service.deploymentadmin.spi.ResourceProcessorException: No
>> Object
>> > Class Definition found with
>> > id=com.patronpath.ring.channel.pubnub.PubnubChannel
>> > at
>> >
>> org.apache.felix.deployment.rp.autoconf.AutoConfResourceProcessor.process(AutoConfResourceProcessor.java:174)
>> > […]
>> > The Object Class Definition is in the OSGI-INF/metatype directory and is
>> > being generated by bnd:
>> >
>> > <?xml version='1.0'?>
>> > <metatype:MetaData xmlns:metatype="
>> http://www.osgi.org/xmlns/metatype/v1.1.0"
>> > localization="com.patronpath.ring.channel.pubnub.PubnubChannel$Config">
>> >
>> >  <OCD name="Pubnub channel config"
>> > id="com.patronpath.ring.channel.pubnub.PubnubChannel">
>> >       <AD name="Pos client id" id="posClientId" cardinality="0"
>> > required="true" type="String"/>
>> >       <AD name="Pubnub publish key" id="pubnubPublishKey"
>> cardinality="0"
>> > required="true" type="String"/>
>> >       <AD name="Pubnub subscribe key" id="pubnubSubscribeKey"
>> > cardinality="0" required="true" type="String"/>
>> >       <AD name="Heartbeat interval seconds"
>> id="heartbeatIntervalSeconds"
>> > cardinality="0" required="true" default="3" type="Integer"
>> description="How
>> > often the Pubnub presence info should be updated."/>
>> >       <AD name="Reconnect interval seconds"
>> id="reconnectIntervalSeconds"
>> > cardinality="0" required="true" default="3" type="Integer"/>
>> >       <AD name="Retreive missed messages" id="retreiveMissedMessages"
>> > cardinality="0" required="true" default="false" type="Boolean"/>
>> >  </OCD>
>> >
>> >  <Designate pid="com.patronpath.ring.channel.pubnub.PubnubChannel">
>> >       <Object
>> ocdref="com.patronpath.ring.channel.pubnub.PubnubChannel"/>
>> >  </Designate>
>> > </metatype:MetaData>
>> >
>> > The OCD id is correct and I know it's getting picked up by the metatype
>> > service because I can see the correct entry in the configuration tab of
>> the
>> > webconsole, and I'm able to load configuration to it via fileinstall.
>> This
>> > makes it seem as though there is something wrong with the autoconf
>> resource
>> > processor preventing it from finding the OCD. Finally, here is the
>> > <Designate> definition I'm giving to ACE for interpolation:
>> >
>> > <?xml version='1.0'?>
>> > <metatype:MetaData xmlns:metatype="
>> http://www.osgi.org/xmlns/metatype/v1.1.0
>> > "
>> > localization="com.patronpath.ring.channel.pubnub.PubnubChannel$Config">
>> > <Designate pid="com.patronpath.ring.channel.pubnub.PubnubChannel"
>> > bundle="osgi-dp:com.patronpath.ring.channel.pubnub">
>> > <Object ocdref="com.patronpath.ring.channel.pubnub.PubnubChannel">
>> > <Attribute adref="posClientId" content="${context.posClientId}" />
>> > <Attribute adref="pubnubPublishKey"
>> content="${context.pubnubPublishKey}" />
>> > <Attribute adref="pubnubSubscribeKey"
>> > content="${context.pubnubSubscribeKey}" />
>> > <Attribute adref="heartbeatIntervalSeconds"
>> > content="${context.heartbeatIntervalSeconds}" />
>> > <Attribute adref="reconnectIntervalSeconds"
>> > content="${context.reconnectIntervalSeconds}" />
>> > <Attribute adref="retreiveMissedMessages"
>> > content="${context.retreiveMissedMessages}" />
>> > </Object>
>> > </Designate>
>> > </metatype:MetaData>
>>
>> Ok, you want to provide the MetaType definition from a bundle while it is
>> being
>> installed through DeploymentAdmin. For this to work, you need the MetaType
>> service as well, is this deployed as well (or already present) at the
>> target?
>>
>> The MetaType service is an optional requirement for the AutoConf resource
>> processor (if all MetaType definitions contain both a designate and OCD
>> it does
>> not use/need the MetaType service itself).
>>
>> > Is there some sort of security or permissions context I'm unaware of
>> that
>> > would prevent the resource processor from seeing the OCD from the
>> bundle?
>> > I'm using the latest binary distribution of ACE and
>> > the org.apache.felix.deployment.rp.autoconf-0.1.5.jar that comes with
>> it. A
>> > possibility I've been asking about on the bndtools group is whether the
>> > empty <Designate> generated by bnd next to the <OCD> might interfere
>> with
>> > the <Designate> I'm supplying via ACE, but I'd expect a different sort
>> of
>> > error if that were the case. Also, it's not straightforward to prevent
>> bnd
>> > from generating the empty <Designate>, so I'm hoping to explore other
>> > possibilities first.
>>
>> I think your problem is because the MetaType service is not available on
>> your
>> target. Can you confirm this?
>>
>> Yes, the Felix Metatype service version 1.0.10 was deployed. I'm seeing
> now that that version implements metatype spec 1.2, while the xml version
> I'm using specifies 1.1, so I'll try downgrading to 1.0.4 and let you know
> what happens.
>
> Thanks for your help!
>

I got the same error using Felix Metatype 1.0.4. I can see from the
Webconsole that the Metatype bundle is installed and active. If you don't
see anything wrong with the xml I wrote, then maybe there's a version
incompatibility between some of the OSGi libs I'm using. I'm on the latest
version of most Felix services supporting OSGi R5, so:
- Felix Framework 4.6.0
- Felix Config Admin 1.8.0
- OSGI CMPN 5.0.0
etc...

Is there a particular version level of OSGi or the Felix implementations
that autoconf is known to work with?

>
> Robert
>
>> --
>> Met vriendelijke groeten | Kind regards
>>
>> Jan Willem Janssen | Software Architect
>> +31 631 765 814
>>
>> My world is revolving around INAETICS and Amdatu
>>
>> Luminis Technologies B.V.
>> Churchillplein 1
>> 7314 BZ   Apeldoorn
>> +31 88 586 46 00
>>
>> http://www.luminis-technologies.com
>> http://www.luminis.eu
>>
>> KvK (CoC) 09 16 28 93
>> BTW (VAT) NL8169.78.566.B.01
>>
>>
>

Re: Some clarifications about ACE template config engine

Posted by "Robert M. Mather" <ro...@gmail.com>.
On Wed, Apr 15, 2015 at 1:08 AM, Jan Willem Janssen <
janwillem.janssen@luminis.eu> wrote:

> Hi Robert,
>
> > On 14 Apr 2015, at 19:28, Robert M. Mather <ro...@gmail.com>
> wrote:
> >
> >>
> >> Ok, then I'm not sure how to explain the issue I'm having. The client
> > side error log is the same for all the bundles I've tried:
> >
> >> 2015-04-14 10:13:10 | ERROR | ACE Agent Controller | 1 - Installation of
> > deployment update failed: Error while processing resource
> >
> 'com.patronpath.ring.channel.pubnub.PubnubChannel.Config_ring-ace-agent-test_30.0.0.xml'
> > (463)!
> > org.osgi.service.deploymentadmin.spi.ResourceProcessorException: No
> Object
> > Class Definition found with
> > id=com.patronpath.ring.channel.pubnub.PubnubChannel
> > at
> >
> org.apache.felix.deployment.rp.autoconf.AutoConfResourceProcessor.process(AutoConfResourceProcessor.java:174)
> > […]
> > The Object Class Definition is in the OSGI-INF/metatype directory and is
> > being generated by bnd:
> >
> > <?xml version='1.0'?>
> > <metatype:MetaData xmlns:metatype="
> http://www.osgi.org/xmlns/metatype/v1.1.0"
> > localization="com.patronpath.ring.channel.pubnub.PubnubChannel$Config">
> >
> >  <OCD name="Pubnub channel config"
> > id="com.patronpath.ring.channel.pubnub.PubnubChannel">
> >       <AD name="Pos client id" id="posClientId" cardinality="0"
> > required="true" type="String"/>
> >       <AD name="Pubnub publish key" id="pubnubPublishKey" cardinality="0"
> > required="true" type="String"/>
> >       <AD name="Pubnub subscribe key" id="pubnubSubscribeKey"
> > cardinality="0" required="true" type="String"/>
> >       <AD name="Heartbeat interval seconds" id="heartbeatIntervalSeconds"
> > cardinality="0" required="true" default="3" type="Integer"
> description="How
> > often the Pubnub presence info should be updated."/>
> >       <AD name="Reconnect interval seconds" id="reconnectIntervalSeconds"
> > cardinality="0" required="true" default="3" type="Integer"/>
> >       <AD name="Retreive missed messages" id="retreiveMissedMessages"
> > cardinality="0" required="true" default="false" type="Boolean"/>
> >  </OCD>
> >
> >  <Designate pid="com.patronpath.ring.channel.pubnub.PubnubChannel">
> >       <Object ocdref="com.patronpath.ring.channel.pubnub.PubnubChannel"/>
> >  </Designate>
> > </metatype:MetaData>
> >
> > The OCD id is correct and I know it's getting picked up by the metatype
> > service because I can see the correct entry in the configuration tab of
> the
> > webconsole, and I'm able to load configuration to it via fileinstall.
> This
> > makes it seem as though there is something wrong with the autoconf
> resource
> > processor preventing it from finding the OCD. Finally, here is the
> > <Designate> definition I'm giving to ACE for interpolation:
> >
> > <?xml version='1.0'?>
> > <metatype:MetaData xmlns:metatype="
> http://www.osgi.org/xmlns/metatype/v1.1.0
> > "
> > localization="com.patronpath.ring.channel.pubnub.PubnubChannel$Config">
> > <Designate pid="com.patronpath.ring.channel.pubnub.PubnubChannel"
> > bundle="osgi-dp:com.patronpath.ring.channel.pubnub">
> > <Object ocdref="com.patronpath.ring.channel.pubnub.PubnubChannel">
> > <Attribute adref="posClientId" content="${context.posClientId}" />
> > <Attribute adref="pubnubPublishKey"
> content="${context.pubnubPublishKey}" />
> > <Attribute adref="pubnubSubscribeKey"
> > content="${context.pubnubSubscribeKey}" />
> > <Attribute adref="heartbeatIntervalSeconds"
> > content="${context.heartbeatIntervalSeconds}" />
> > <Attribute adref="reconnectIntervalSeconds"
> > content="${context.reconnectIntervalSeconds}" />
> > <Attribute adref="retreiveMissedMessages"
> > content="${context.retreiveMissedMessages}" />
> > </Object>
> > </Designate>
> > </metatype:MetaData>
>
> Ok, you want to provide the MetaType definition from a bundle while it is
> being
> installed through DeploymentAdmin. For this to work, you need the MetaType
> service as well, is this deployed as well (or already present) at the
> target?
>
> The MetaType service is an optional requirement for the AutoConf resource
> processor (if all MetaType definitions contain both a designate and OCD it
> does
> not use/need the MetaType service itself).
>
> > Is there some sort of security or permissions context I'm unaware of that
> > would prevent the resource processor from seeing the OCD from the bundle?
> > I'm using the latest binary distribution of ACE and
> > the org.apache.felix.deployment.rp.autoconf-0.1.5.jar that comes with
> it. A
> > possibility I've been asking about on the bndtools group is whether the
> > empty <Designate> generated by bnd next to the <OCD> might interfere with
> > the <Designate> I'm supplying via ACE, but I'd expect a different sort of
> > error if that were the case. Also, it's not straightforward to prevent
> bnd
> > from generating the empty <Designate>, so I'm hoping to explore other
> > possibilities first.
>
> I think your problem is because the MetaType service is not available on
> your
> target. Can you confirm this?
>
> Yes, the Felix Metatype service version 1.0.10 was deployed. I'm seeing
now that that version implements metatype spec 1.2, while the xml version
I'm using specifies 1.1, so I'll try downgrading to 1.0.4 and let you know
what happens.

Thanks for your help!

Robert

> --
> Met vriendelijke groeten | Kind regards
>
> Jan Willem Janssen | Software Architect
> +31 631 765 814
>
> My world is revolving around INAETICS and Amdatu
>
> Luminis Technologies B.V.
> Churchillplein 1
> 7314 BZ   Apeldoorn
> +31 88 586 46 00
>
> http://www.luminis-technologies.com
> http://www.luminis.eu
>
> KvK (CoC) 09 16 28 93
> BTW (VAT) NL8169.78.566.B.01
>
>

Re: Some clarifications about ACE template config engine

Posted by Jan Willem Janssen <ja...@luminis.eu>.
Hi Robert,

> On 14 Apr 2015, at 19:28, Robert M. Mather <ro...@gmail.com> wrote:
> 
>> 
>> Ok, then I'm not sure how to explain the issue I'm having. The client
> side error log is the same for all the bundles I've tried:
> 
>> 2015-04-14 10:13:10 | ERROR | ACE Agent Controller | 1 - Installation of
> deployment update failed: Error while processing resource
> 'com.patronpath.ring.channel.pubnub.PubnubChannel.Config_ring-ace-agent-test_30.0.0.xml'
> (463)!
> org.osgi.service.deploymentadmin.spi.ResourceProcessorException: No Object
> Class Definition found with
> id=com.patronpath.ring.channel.pubnub.PubnubChannel
> at
> org.apache.felix.deployment.rp.autoconf.AutoConfResourceProcessor.process(AutoConfResourceProcessor.java:174)
> […]
> The Object Class Definition is in the OSGI-INF/metatype directory and is
> being generated by bnd:
> 
> <?xml version='1.0'?>
> <metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.1.0"
> localization="com.patronpath.ring.channel.pubnub.PubnubChannel$Config">
> 
>  <OCD name="Pubnub channel config"
> id="com.patronpath.ring.channel.pubnub.PubnubChannel">
>       <AD name="Pos client id" id="posClientId" cardinality="0"
> required="true" type="String"/>
>       <AD name="Pubnub publish key" id="pubnubPublishKey" cardinality="0"
> required="true" type="String"/>
>       <AD name="Pubnub subscribe key" id="pubnubSubscribeKey"
> cardinality="0" required="true" type="String"/>
>       <AD name="Heartbeat interval seconds" id="heartbeatIntervalSeconds"
> cardinality="0" required="true" default="3" type="Integer" description="How
> often the Pubnub presence info should be updated."/>
>       <AD name="Reconnect interval seconds" id="reconnectIntervalSeconds"
> cardinality="0" required="true" default="3" type="Integer"/>
>       <AD name="Retreive missed messages" id="retreiveMissedMessages"
> cardinality="0" required="true" default="false" type="Boolean"/>
>  </OCD>
> 
>  <Designate pid="com.patronpath.ring.channel.pubnub.PubnubChannel">
>       <Object ocdref="com.patronpath.ring.channel.pubnub.PubnubChannel"/>
>  </Designate>
> </metatype:MetaData>
> 
> The OCD id is correct and I know it's getting picked up by the metatype
> service because I can see the correct entry in the configuration tab of the
> webconsole, and I'm able to load configuration to it via fileinstall. This
> makes it seem as though there is something wrong with the autoconf resource
> processor preventing it from finding the OCD. Finally, here is the
> <Designate> definition I'm giving to ACE for interpolation:
> 
> <?xml version='1.0'?>
> <metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.1.0
> "
> localization="com.patronpath.ring.channel.pubnub.PubnubChannel$Config">
> <Designate pid="com.patronpath.ring.channel.pubnub.PubnubChannel"
> bundle="osgi-dp:com.patronpath.ring.channel.pubnub">
> <Object ocdref="com.patronpath.ring.channel.pubnub.PubnubChannel">
> <Attribute adref="posClientId" content="${context.posClientId}" />
> <Attribute adref="pubnubPublishKey" content="${context.pubnubPublishKey}" />
> <Attribute adref="pubnubSubscribeKey"
> content="${context.pubnubSubscribeKey}" />
> <Attribute adref="heartbeatIntervalSeconds"
> content="${context.heartbeatIntervalSeconds}" />
> <Attribute adref="reconnectIntervalSeconds"
> content="${context.reconnectIntervalSeconds}" />
> <Attribute adref="retreiveMissedMessages"
> content="${context.retreiveMissedMessages}" />
> </Object>
> </Designate>
> </metatype:MetaData>

Ok, you want to provide the MetaType definition from a bundle while it is being
installed through DeploymentAdmin. For this to work, you need the MetaType
service as well, is this deployed as well (or already present) at the target?

The MetaType service is an optional requirement for the AutoConf resource
processor (if all MetaType definitions contain both a designate and OCD it does
not use/need the MetaType service itself).

> Is there some sort of security or permissions context I'm unaware of that
> would prevent the resource processor from seeing the OCD from the bundle?
> I'm using the latest binary distribution of ACE and
> the org.apache.felix.deployment.rp.autoconf-0.1.5.jar that comes with it. A
> possibility I've been asking about on the bndtools group is whether the
> empty <Designate> generated by bnd next to the <OCD> might interfere with
> the <Designate> I'm supplying via ACE, but I'd expect a different sort of
> error if that were the case. Also, it's not straightforward to prevent bnd
> from generating the empty <Designate>, so I'm hoping to explore other
> possibilities first.

I think your problem is because the MetaType service is not available on your
target. Can you confirm this?

--
Met vriendelijke groeten | Kind regards

Jan Willem Janssen | Software Architect
+31 631 765 814

My world is revolving around INAETICS and Amdatu

Luminis Technologies B.V.
Churchillplein 1
7314 BZ   Apeldoorn
+31 88 586 46 00

http://www.luminis-technologies.com
http://www.luminis.eu

KvK (CoC) 09 16 28 93
BTW (VAT) NL8169.78.566.B.01


Re: Some clarifications about ACE template config engine

Posted by "Robert M. Mather" <ro...@gmail.com>.
On Mon, Apr 13, 2015 at 11:36 AM, Jan Willem Janssen <
janwillem.janssen@luminis.eu> wrote:

> Hi Robert,
>
> > On 13 Apr 2015, at 18:53, Robert M. Mather <ro...@gmail.com>
> wrote:
> >
> >> Almost: the bundle-attribute needs to be prefixed with “osgi-dp:” to
> make
> >> it clear that the configuration PID (org.amdatu.conf) is for a bundle
> >> that is part of a deployment package. The AutoConf resource processor
> used
> >> by ACE does not allow configurations to be provisioned to bundles that
> are
> >> *not* part of a deployment package.
> >> Apart from that the example metatype is correct, including the template
> >> variable.
> >
> >
> > I haven't done anything to explicitly prepare my bundles as part of a
> > deployment package. Does ACE do this automatically somehow, or do I need
> to
> > modify the bundle to indicate that it's associated with the same
> deployment
> > package as the metatype configuration? I've never worked with the
> > deployment package part of the OSGi spec before…
>
> Short answer: ACE uses deployment packages as vehicle for transporting and
> installing software updates. You do not need to do anything special for
> that.
>
> Long answer: each target is associated with a distribution. Based on the
> software that is already installed and the changes you want to deploy, a
> new deployment package is created once the target asks for this (the target
> knows what version is currently installed, and asks whether a newer version
> is available, and if so, downloads it and installs it). The installation of
> deployment packages is transparant to the target, so there is no need to
> get into its nitty gritty details...
>
>  Ok, then I'm not sure how to explain the issue I'm having. The client
side error log is the same for all the bundles I've tried:

> 2015-04-14 10:13:10 | ERROR | ACE Agent Controller | 1 - Installation of
deployment update failed: Error while processing resource
'com.patronpath.ring.channel.pubnub.PubnubChannel.Config_ring-ace-agent-test_30.0.0.xml'
(463)!
org.osgi.service.deploymentadmin.spi.ResourceProcessorException: No Object
Class Definition found with
id=com.patronpath.ring.channel.pubnub.PubnubChannel
at
org.apache.felix.deployment.rp.autoconf.AutoConfResourceProcessor.process(AutoConfResourceProcessor.java:174)
~[na:na]
at
org.apache.felix.deploymentadmin.spi.ProcessResourceCommand.doExecute(ProcessResourceCommand.java:100)
~[na:na]
at org.apache.felix.deploymentadmin.spi.Command.execute(Command.java:55)
~[na:na]
at
org.apache.felix.deploymentadmin.spi.DeploymentSessionImpl.call(DeploymentSessionImpl.java:77)
~[na:na]
at
org.apache.felix.deploymentadmin.DeploymentAdminImpl.installDeploymentPackage(DeploymentAdminImpl.java:214)
~[na:na]
at
org.apache.ace.agent.impl.DeploymentHandlerImpl.install(DeploymentHandlerImpl.java:237)
~[na:na]

The Object Class Definition is in the OSGI-INF/metatype directory and is
being generated by bnd:

<?xml version='1.0'?>
<metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.1.0"
localization="com.patronpath.ring.channel.pubnub.PubnubChannel$Config">

  <OCD name="Pubnub channel config"
id="com.patronpath.ring.channel.pubnub.PubnubChannel">
       <AD name="Pos client id" id="posClientId" cardinality="0"
required="true" type="String"/>
       <AD name="Pubnub publish key" id="pubnubPublishKey" cardinality="0"
required="true" type="String"/>
       <AD name="Pubnub subscribe key" id="pubnubSubscribeKey"
cardinality="0" required="true" type="String"/>
       <AD name="Heartbeat interval seconds" id="heartbeatIntervalSeconds"
cardinality="0" required="true" default="3" type="Integer" description="How
often the Pubnub presence info should be updated."/>
       <AD name="Reconnect interval seconds" id="reconnectIntervalSeconds"
cardinality="0" required="true" default="3" type="Integer"/>
       <AD name="Retreive missed messages" id="retreiveMissedMessages"
cardinality="0" required="true" default="false" type="Boolean"/>
  </OCD>

  <Designate pid="com.patronpath.ring.channel.pubnub.PubnubChannel">
       <Object ocdref="com.patronpath.ring.channel.pubnub.PubnubChannel"/>
  </Designate>
</metatype:MetaData>

The OCD id is correct and I know it's getting picked up by the metatype
service because I can see the correct entry in the configuration tab of the
webconsole, and I'm able to load configuration to it via fileinstall. This
makes it seem as though there is something wrong with the autoconf resource
processor preventing it from finding the OCD. Finally, here is the
<Designate> definition I'm giving to ACE for interpolation:

<?xml version='1.0'?>
<metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.1.0
"
localization="com.patronpath.ring.channel.pubnub.PubnubChannel$Config">
<Designate pid="com.patronpath.ring.channel.pubnub.PubnubChannel"
bundle="osgi-dp:com.patronpath.ring.channel.pubnub">
<Object ocdref="com.patronpath.ring.channel.pubnub.PubnubChannel">
<Attribute adref="posClientId" content="${context.posClientId}" />
<Attribute adref="pubnubPublishKey" content="${context.pubnubPublishKey}" />
<Attribute adref="pubnubSubscribeKey"
content="${context.pubnubSubscribeKey}" />
<Attribute adref="heartbeatIntervalSeconds"
content="${context.heartbeatIntervalSeconds}" />
<Attribute adref="reconnectIntervalSeconds"
content="${context.reconnectIntervalSeconds}" />
<Attribute adref="retreiveMissedMessages"
content="${context.retreiveMissedMessages}" />
</Object>
</Designate>
</metatype:MetaData>

Is there some sort of security or permissions context I'm unaware of that
would prevent the resource processor from seeing the OCD from the bundle?
I'm using the latest binary distribution of ACE and
the org.apache.felix.deployment.rp.autoconf-0.1.5.jar that comes with it. A
possibility I've been asking about on the bndtools group is whether the
empty <Designate> generated by bnd next to the <OCD> might interfere with
the <Designate> I'm supplying via ACE, but I'd expect a different sort of
error if that were the case. Also, it's not straightforward to prevent bnd
from generating the empty <Designate>, so I'm hoping to explore other
possibilities first.

Thanks,

Robert

>
> --
> Met vriendelijke groeten | Kind regards
>
> Jan Willem Janssen | Software Architect
> +31 631 765 814
>
> My world is revolving around INAETICS and Amdatu
>
> Luminis Technologies B.V.
> Churchillplein 1
> 7314 BZ   Apeldoorn
> +31 88 586 46 00
>
> http://www.luminis-technologies.com
> http://www.luminis.eu
>
> KvK (CoC) 09 16 28 93
> BTW (VAT) NL8169.78.566.B.01
>
>

Re: Some clarifications about ACE template config engine

Posted by Jan Willem Janssen <ja...@luminis.eu>.
Hi Robert,

> On 13 Apr 2015, at 18:53, Robert M. Mather <ro...@gmail.com> wrote:
> 
>> Almost: the bundle-attribute needs to be prefixed with “osgi-dp:” to make
>> it clear that the configuration PID (org.amdatu.conf) is for a bundle
>> that is part of a deployment package. The AutoConf resource processor used
>> by ACE does not allow configurations to be provisioned to bundles that are
>> *not* part of a deployment package.
>> Apart from that the example metatype is correct, including the template
>> variable.
> 
> 
> I haven't done anything to explicitly prepare my bundles as part of a
> deployment package. Does ACE do this automatically somehow, or do I need to
> modify the bundle to indicate that it's associated with the same deployment
> package as the metatype configuration? I've never worked with the
> deployment package part of the OSGi spec before…

Short answer: ACE uses deployment packages as vehicle for transporting and
installing software updates. You do not need to do anything special for that.

Long answer: each target is associated with a distribution. Based on the
software that is already installed and the changes you want to deploy, a
new deployment package is created once the target asks for this (the target
knows what version is currently installed, and asks whether a newer version
is available, and if so, downloads it and installs it). The installation of
deployment packages is transparant to the target, so there is no need to
get into its nitty gritty details...


--
Met vriendelijke groeten | Kind regards

Jan Willem Janssen | Software Architect
+31 631 765 814

My world is revolving around INAETICS and Amdatu

Luminis Technologies B.V.
Churchillplein 1
7314 BZ   Apeldoorn
+31 88 586 46 00

http://www.luminis-technologies.com
http://www.luminis.eu

KvK (CoC) 09 16 28 93
BTW (VAT) NL8169.78.566.B.01


Re: Some clarifications about ACE template config engine

Posted by "Robert M. Mather" <ro...@gmail.com>.
On Mon, Mar 23, 2015 at 6:32 AM, Jan Willem Janssen <
janwillem.janssen@luminis.eu> wrote:

> Hi Robert,
>
> > On 21 Mar 2015, at 05:25, Robert M. Mather <ro...@gmail.com>
> wrote:
> >
> > Using the template engine
> > <
> https://ace.apache.org/docs/user-guide.html#using-the-template-engine-for-targets
> >,
> > would a metatype.xml inside a bundle (ie in the OSGI-INF/metatype
> > directory, per the spec) be processed and the variables substituted, or
> > does the metatype need to be deployed as a separate artifact.
>
> By default, the ACE templating system only works on metatype resources
> deployed
> as separate files. The idea behind this is that you generally want to have
> a
> “standard” set of bundles which can be configured individually per target.
>
> > Just for my understanding, where does the interpolation actually take
> > place? I've been assuming it's a process at the client/target…
>
> The processing is done at the server side right before the deployment
> package
> is transferred to the client. This way, each client can get its own
> “unique”
> deployment set including the proper configuration files.
>
> > If the same "tag" key gets set at multiple stages (ie artifact, feature,
> > dist, and/or target), is the a "last one wins" rule or something when the
> > interpolation takes place?
>
> IIRC, the last ones wins indeed, but I’d need to test that out myself...
>
> >
> > And finally, is this example metatype.xml the right idea for adding the
> > ${context.blah} variables (in the content field)?
> >
> > <?xml version="1.0" encoding="UTF-8"?><metatype:MetaData
> > xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.1.0">
> >    <OCD id="ocd" name="ocd">
> >        <AD id="server" type="String" />
> >    </OCD>
> >
> >    <Designate pid="org.amdatu.conf" bundle="org.amdatu.sample.bundle">
> >        <Object ocdref="ocd">
> >            <Attribute adref="server" name="serverurl"
> > content="${context.serverUrl}" />
> >        </Object>
> >    </Designate></metatype:MetaData>
>
> Almost: the bundle-attribute needs to be prefixed with “osgi-dp:” to make
> it clear that the configuration PID (org.amdatu.conf) is for a bundle
> that is part of a deployment package. The AutoConf resource processor used
> by ACE does not allow configurations to be provisioned to bundles that are
> *not* part of a deployment package.
> Apart from that the example metatype is correct, including the template
> variable.


I haven't done anything to explicitly prepare my bundles as part of a
deployment package. Does ACE do this automatically somehow, or do I need to
modify the bundle to indicate that it's associated with the same deployment
package as the metatype configuration? I've never worked with the
deployment package part of the OSGi spec before...

>
>
> I'm using declarative services with bnd(tools), which is generating
> > metatype from my @OCD annotated interfaces, so I'm trying to find the
> > best/most automated way to prepare those for Apache ACE with template
> > variables.
> >
> > Any thoughts on the right way to do that would be much appreciated, I'm
> > hoping I'm not the first person to want to do something like this!
>
> Its been a while since I played with the metatype support of Bnd, but
> I believe it will embed the metatype resource files inside the bundles,
> which (as I written above) are not considered by the ACE template
> processor. If you want to keep using Bnd for generating metatype
> resources (which I can understand, given its great support) you could
> separate the actual configuration (read: Designate) from its definition
> (read: OCD): the metatype spec does allow that. This would mean that you
> provide the designates in separate files (which the ACE template
> processor can act upon) while the OCDs are created from your Bnd build.
>
> Hope this helps,
>
> --
> Met vriendelijke groeten | Kind regards
>
> Jan Willem Janssen | Software Architect
> +31 631 765 814
>
> My world is revolving around INAETICS and Amdatu
>
> Luminis Technologies B.V.
> Churchillplein 1
> 7314 BZ   Apeldoorn
> +31 88 586 46 00
>
> http://www.luminis-technologies.com
> http://www.luminis.eu
>
> KvK (CoC) 09 16 28 93
> BTW (VAT) NL8169.78.566.B.01
>
>

Re: Some clarifications about ACE template config engine

Posted by Jan Willem Janssen <ja...@luminis.eu>.
Hi Robert,

> On 21 Mar 2015, at 05:25, Robert M. Mather <ro...@gmail.com> wrote:
> 
> Using the template engine
> <https://ace.apache.org/docs/user-guide.html#using-the-template-engine-for-targets>,
> would a metatype.xml inside a bundle (ie in the OSGI-INF/metatype
> directory, per the spec) be processed and the variables substituted, or
> does the metatype need to be deployed as a separate artifact.

By default, the ACE templating system only works on metatype resources deployed
as separate files. The idea behind this is that you generally want to have a
“standard” set of bundles which can be configured individually per target.

> Just for my understanding, where does the interpolation actually take
> place? I've been assuming it's a process at the client/target…

The processing is done at the server side right before the deployment package
is transferred to the client. This way, each client can get its own “unique”
deployment set including the proper configuration files.

> If the same "tag" key gets set at multiple stages (ie artifact, feature,
> dist, and/or target), is the a "last one wins" rule or something when the
> interpolation takes place?

IIRC, the last ones wins indeed, but I’d need to test that out myself...

> 
> And finally, is this example metatype.xml the right idea for adding the
> ${context.blah} variables (in the content field)?
> 
> <?xml version="1.0" encoding="UTF-8"?><metatype:MetaData
> xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.1.0">
>    <OCD id="ocd" name="ocd">
>        <AD id="server" type="String" />
>    </OCD>
> 
>    <Designate pid="org.amdatu.conf" bundle="org.amdatu.sample.bundle">
>        <Object ocdref="ocd">
>            <Attribute adref="server" name="serverurl"
> content="${context.serverUrl}" />
>        </Object>
>    </Designate></metatype:MetaData>

Almost: the bundle-attribute needs to be prefixed with “osgi-dp:” to make
it clear that the configuration PID (org.amdatu.conf) is for a bundle
that is part of a deployment package. The AutoConf resource processor used
by ACE does not allow configurations to be provisioned to bundles that are
*not* part of a deployment package.
Apart from that the example metatype is correct, including the template
variable.

> I'm using declarative services with bnd(tools), which is generating
> metatype from my @OCD annotated interfaces, so I'm trying to find the
> best/most automated way to prepare those for Apache ACE with template
> variables.
> 
> Any thoughts on the right way to do that would be much appreciated, I'm
> hoping I'm not the first person to want to do something like this!

Its been a while since I played with the metatype support of Bnd, but
I believe it will embed the metatype resource files inside the bundles,
which (as I written above) are not considered by the ACE template
processor. If you want to keep using Bnd for generating metatype
resources (which I can understand, given its great support) you could
separate the actual configuration (read: Designate) from its definition
(read: OCD): the metatype spec does allow that. This would mean that you
provide the designates in separate files (which the ACE template
processor can act upon) while the OCDs are created from your Bnd build.

Hope this helps,

--
Met vriendelijke groeten | Kind regards

Jan Willem Janssen | Software Architect
+31 631 765 814

My world is revolving around INAETICS and Amdatu

Luminis Technologies B.V.
Churchillplein 1
7314 BZ   Apeldoorn
+31 88 586 46 00

http://www.luminis-technologies.com
http://www.luminis.eu

KvK (CoC) 09 16 28 93
BTW (VAT) NL8169.78.566.B.01