Ok, so if I understand this, simple properties are data when children of plugin
configuration, but metadata when children of configuration properties? Is it possible to
create a list of simple properties that I can iterate through in the code?
John Mazzitelli <mazz(a)redhat.com> wrote:
You cannot pre-populate a property definition with property data
within
the xml.
In your XML, you basically have this:
<c:list-property name="logFiles">
<c:map-property name="logFiles">
<c:simple-property name="quoteserver"
default="Quoteserver.log"/>
<c:simple-property name="framework"
default="Framework.log"/>
</c:map-property>
</c:list-property>
With those two simple-properties, you appear to be confusing DATA with
DEFINITION. When you put children under map-property, those children
are
not DATA values, they are metadata DEFINITIONS for the different keys
in
the map.
So that XML above, what you are saying is:
"I have a list, where each element of that list is a map. Each map
found
in my list will have two keys where the one key is "quoteserver" and
the
second key is "framework".
In other words, you are telling RHQ that it can expect two keys to be
in
each map item - quoteserver and framework. The DATA that can be
expected, would look like this (this is just an example of what such a
list-of-maps would look like):
List item #1: Map{quoteserver=foo, framework=bar}
List item #2: Map{quoteserver=hello, framework=world}
List item #3: Map{quoteserver=q, framework=f}
See how the definition defines the keys, while the data (not modeled in
the XML) can have various values for each key value? The default values
you specified are only used by the UI to prepopulate the forms for you
when you are asked to add a new map item to the list.
To be clear, your XML is *not* saying, "my map will have two default
key/value pairs where the first is quoteserver/Quoteserver.log and
framework/Framework.log. For in that case, you would be missing what
the
metadata is for that map!! In other words, RHQ doesn't know what keys
are expected to be in the map.
On 04/25/2011 11:52 AM, Bala Nair wrote:
> I am trying to add log files as event sources to one of my plugins
and I
> want to be able to pre-define the file names in the plugin xml. I
have
> seen how the rhq agent plugin does this by adding files to the
> logEventSources property list as part of the discoverResources
method.
> I'd like to do the same thing in my plugin but have the name and
> location of the files to use be defined in the plugin xml itself,
rather
> than hard coded in the code. So I added the following to my plugin
> configuration section:
>
> <plugin-configuration>
> <c:simple-property name="objectName"
> default="tv.seachange.adrenalin.Quoteserver:type=QuoteMXBean"
> readOnly="true"/>
> <c:simple-property name="nameTemplate" default="Stock Quote
Service"/>
>
> <c:group name="logs" displayName="Log Files">
> <c:simple-property name="logFilePathRoot"
default="/seachange/logs"/>
> <c:list-property name="logFiles" description="Log files to track
for
> events">
> <c:map-property name="logFiles">
> <c:simple-property name="quoteserver"
default="Quoteserver.log"/>
> <c:simple-property name="framework"
default="Framework.log"/>
> </c:map-property>
> </c:list-property>
> </c:group>
> </plugin-configuration>
>
> The service is discovered correctly and the simple properties show
up.
> However, I can't see any of the children of the property list when I
run
> my plugin in the standalone container. Here's the output from the pc
> command for this resource:
>
> [
> PropertySimple[id=0, name=logFilePathRoot, value=/seachange/logs,
> override=null],
> PropertySimple[id=0, name=objectName,
> value=tv.seachange.adrenalin.Quoteserver:type=QuoteMXBean,
override=null],
> PropertySimple[id=0, name=nameTemplate, value=Stock Quote
Service,
> override=null],
> PropertyList[id=0, name=logFiles, list=[]]
> ]
>
> The plugin validates correctly using the plugin validator and I have
run
> the plugin xml through xmlspy to validate it against the plugin and
> configuration schemas and xmlspy reports that the xml is valid. I
have
> turned up the log level for org.rhq.core.pc.plugin and everything in
the
> log appears ok. I have tried various combinations of configuration
> properties and nothing seems to get me a property list of multiple
> objects. Any idea what I'm doing wrong?
>
> Bala Nair
> SeaChange International
>
>
> _______________________________________________
> rhq-devel mailing list
> rhq-devel(a)lists.fedorahosted.org
>
https://fedorahosted.org/mailman/listinfo/rhq-devel
_______________________________________________
rhq-devel mailing list
rhq-devel(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/rhq-devel
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.