[jboss-jira] [JBoss JIRA] (AS7-3631) Using DMR for generic config application
Michael Voegele (JIRA)
jira-events at lists.jboss.org
Tue Mar 6 01:26:37 EST 2012
[ https://issues.jboss.org/browse/AS7-3631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12673847#comment-12673847 ]
Michael Voegele commented on AS7-3631:
--------------------------------------
{quote}
Are you suggesting to enhance the add operation in some general way to add children? Or?..
{quote}
Yes, that's exactly what I am suggesting. Or rather, as when reading a resource with recursive=true, it would be nice to have an add operation with recursive=true, in order to also have the children added in one go.
This has nothing to do with "Composite Operations".
But it's ok to leave this issue closed. I'll find another way or implement sth on my own.
Thanks for your comments and efforts!
> Using DMR for generic config application
> ----------------------------------------
>
> Key: AS7-3631
> URL: https://issues.jboss.org/browse/AS7-3631
> Project: Application Server 7
> Issue Type: Bug
> Components: CLI, Domain Management
> Affects Versions: 7.1.0.CR1b
> Reporter: Michael Voegele
> Assignee: Alexey Loubyansky
> Labels: dmr, recursive, subnode
> Attachments: add-socket-binding-group-operation.txt, template-data-source.xml, template-ports.xml, template-xa-data-source.xml
>
>
> We are looking for a generic way on how to apply configuration to a domain. We want to use a way over an xml template, convert the xml template to json and setting the attributes on a ModelNode. This way, we don't need to wrap all possible attributes in java code.
> Example:
> See attached file 'template-data-source.xml'. This file is a possible template for a normal datasource. The intention is that developers fill in that template and over a mechanism, it is applied to their profile. The mechanism converts the xml template to json, which is then applied on a ModelNode:
> {code}
> private void setXmlAttributes(ModelNode operationNode) {
> // convert xml to json
> JSONObject jsonObject;
> try {
> jsonObject = XML.toJSONObject(dmrConfigArtifact.getXmlTemplate());
> } catch (JSONException e) {
> throw new IllegalArgumentException(e);
> }
> // set json attributes on operation
> ModelNode attributes = ModelNode.fromJSONString(jsonObject.toString());
> List<Property> properties = attributes.asPropertyList();
> for (Property property : properties) {
> operationNode.get(property.getName()).set(property.getValue());
> }
> }
> {code}
> This node is then added to the configuration using normal 'add' operation (of course address and operation are also set on the operationNode, then executed by 'ModelControllerClient').
> This mechanism works fine for a normal datasource. However, if I try an xa-datasource, it does not work, as it contains subnodes (xa-datasource-properties), see attached file 'template-xa-data-source.xml'.
> When reading a node using 'read-resource', there is the possibility to set 'recursive=true' on the operation. This way, all subnodes are also returned. Is there a way to apply a node in a recursive way?
> I would like to have a statement, if it is a bug, that when adding a node containing subnodes, the subnodes cannot be handled by DMR automatically. Is it correct, that every subnode has to be handled/added separately?
> Thanks in advance for your answers.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list