A while ago I posted the question below to the incubator mailing list. I
wanted to get an entity to use runtime files from a resource in one of its
libraries but found that Brooklyn was unable to resolve it.
I recently had a chance to discuss the problem in more detail with Svet and
learned the solution.
Here's an example catalogue entry from a test in Brooklyn with the solution
in bold:
brooklyn.catalog:
id: vanilla-software-resource-test
version: 1.0
item:
services:
- type: org.apache.brooklyn.entity.stock.BasicApplication
brooklyn.children:
- type: *java:*
org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
brooklyn.config:
launch.command: true
checkRunning.command: true
# Contained in brooklyn-test-osgi-entities.jar.
runtimeFiles:
classpath://org/apache/brooklyn/test/osgi/resources/message.txt: message.txt
libraries:
- classpath://brooklyn/osgi/brooklyn-test-osgi-entities.jar
In case the formatting is lost the key point is the "java:" at the front of
the VanillaSoftwareProcess type. Without this Brooklyn is unable to resolve
message.txt.
Sam
On 16 November 2015 at 19:21, Sam Corbett <[email protected]>
wrote:
> Hi Alex/Svet,
>
> Per our conversations on IRC today about VanillaSoftwareProcesses
> referencing resources in bundles, I pushed a couple of test cases to
> https://github.com/sjcorbett/incubator-brooklyn/tree/vsp-bundles.
>
> Each test adds the same blueprint, for a VanillaSoftwareProcess that
> references a resource in a bundle, to its catalogue then makes a deployment
> of that item to localhost. You should find that
> camp/VanillaSoftwareProcessYamlTest passes but
> rest-server/VanillaSoftwareProcessTest fails. (Make sure to rebuild
> utils/rt-osgi.) The former instantiates an assembly template directly (via
> AbstractYamlTest), the latter does the important bits with the rest api.
>
> Stick a breakpoint in AbstractSoftwareProcessDriver#copyRuntimeResources
> and you'll see that the catalogue item ID of the entity in the camp test is
> vanilla-software-resource-test:1.0 but via the rest test is
> org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess:0.9.0-SNAPSHOT.
>
> Sam
>
>
>