Using sourcePlugin/sourceType in plugin descriptors
Lukas Krejci
lkrejci at redhat.com
Fri Oct 1 10:29:54 UTC 2010
Hi team,
I'm creating a bunch of test plugins for my tests and I'm trying to "pull" a
resource type from one plugin to the other using the sourcePlugin/sourceType
attributes.
My defs look like this:
<?xml version="1.0" encoding="UTF-8"?>
<plugin name="sibling"
displayName="Resource Upgrade Multi Test"
description="Resource Upgrade Multi Test"
package="org.rhq.core.pc.upgrade.plugins.multi.base"
version="1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:xmlns:rhq-plugin"
xmlns:c="urn:xmlns:rhq-configuration">
<depends plugin="base" useClasses="true"/>
<!-- This service is put in the type hierarchy in the test plugin -->
<service name="TestResourceSibling"
discovery="BaseDiscoveryComponent"
class="BaseResourceComponent">
....
</service>
</plugin>
<?xml version="1.0" encoding="UTF-8"?>
<plugin name="test"
displayName="Resource Upgrade Multi Test"
description="Resource Upgrade Multi Test"
package="org.rhq.core.pc.upgrade.plugins.multi.base"
version="1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:xmlns:rhq-plugin"
xmlns:c="urn:xmlns:rhq-configuration">
<depends plugin="base" useClasses="true"/>
<depends plugin="sibling" />
<server name="TestResourceParent"
discovery="BaseDiscoveryComponent"
class="BaseResourceComponent">
....
<service name="TestResourceSibling" sourcePlugin="sibling"
sourceType="TestResourceSibling"
class="BaseResourceComponent"
discovery="BaseDiscoveryComponent" />
</server>
</plugin>
But strangely enough, the TestResourceSibling type doesn't end up as a child
of the TestResourceParent.
I have checked that the sibling plugin gets correctly loaded.
The reason for it not being included is that the code in the
PluginDescriptorParser assumes that the services that are going to be "pulled"
are never going to be present at the top level.
I.e. when I change the "sibling" plugin to this:
<?xml version="1.0" encoding="UTF-8"?>
<plugin name="sibling"
displayName="Resource Upgrade Multi Test"
description="Resource Upgrade Multi Test"
package="org.rhq.core.pc.upgrade.plugins.multi.base"
version="1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:xmlns:rhq-plugin"
xmlns:c="urn:xmlns:rhq-configuration">
<depends plugin="base" useClasses="true"/>
<server name="Bogus" class="BaseDiscoveryComponent">
<!-- This service is put in the type hierarchy in the v1/v2 test
plugins -->
<service name="TestResourceSibling"
discovery="BaseDiscoveryComponent"
class="BaseResourceComponent">
<plugin-configuration>
<c:simple-property name="count" default="10" />
<c:simple-property name="key" default="test-resource-
sibling-%n,parent-%p" />
<c:simple-property name="upgradedKey" default="UPGRADED-test-
resource-sibling-%n,parent-%p" />
</plugin-configuration>
</service>
</server>
</plugin>
All suddenly starts to work.
I fail to imagine a reason for this behavior but I learned before that my
imagination fails frequently when it comes to complexities in the plugin
container ;)
If this is intended behavior, could someone please explain why it is so?
Thanks,
Lukas
More information about the rhq-devel
mailing list