[jboss-as7-dev] Level for add operations
Brian Stansberry
brian.stansberry at redhat.com
Thu Jan 20 11:50:18 EST 2011
On 1/20/11 10:06 AM, Kabir Khan wrote:
> For the threads subsystem I register a description provider at profile => test => subsystem => threads. For that node I have an ADD_THREAD_FACTORY operation which implements ModelAddOperationHandler. I can then invoke that operation for the address profile => test => subsystem => threads to add a ThreadFactory. However, if I add more than one ThreadFactory, the last overwrites the previous, meaning I can only have one ThreadFactory.
>
> What I originally had in mind was to register this add handler at profile => test => subsystem => threads => threadfactory => * , but when I try to invoke the operation for the address profile => test => subsystem => threads => threadfactory => threadfactoryA it fails since the model controller does not find the operation since that node does not exist yet (that node is what I am trying to add)
>
This approach is what's intended; I'll think a bit about what the
problem is.
> So, in a nutshell, I am unsure how to properly handle add operations.
>
> Also, when parsing the xml into add operations I need the address that the add operation should apply to, where can I get that? At the moment I am just hard-coding it
The parent address should be parsed into the parsing method. The parser
creates the operation address as follows:
Option A)
op.get(OP_ADDR).set(parentAddress).add("childtype", name);
Option B) -- if you need a ref to the new address
ModelNode address = parentAddress.clone().add("childtype", name);
op.get(OP_ADDR).set(address);
In Option A the set() call copies parentAddress, so it's safe to mutate
it via the add().
> _______________________________________________
> jboss-as7-dev mailing list
> jboss-as7-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
--
Brian Stansberry
Principal Software Engineer
JBoss by Red Hat
More information about the jboss-as7-dev
mailing list