How can I add a subsystem model step to a different context?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How can I add a subsystem model step to a different context?

Michael Musgrove
I have subsystem model operation that removes a model node:

{
    "address" => [
        ("subsystem" => "transactions"),
        ("log-store" => "log-store"),
        ("transactions" => "0:ffffac11829d:83bb:57f3b02a:1e"),
        ("participants" => "1")
    ],
    "operation" => "delete",
    "operation-headers" => {
        "caller-type" => "user",
        "access-mechanism" => "NATIVE"
    }
}

After removing the node (which can result in removing the participant and transaction) I need to add a step that will refresh the model. I cannot do the refresh from the current context (which will be the node I am deleting) so I need to refresh from a context that is "higher up the tree". Ideally I want to do

  PathAddress logStoreAddress = context.getCurrentAddress().getParent().getParent();

and then do a refresh from logStoreAddress.

My question is how can I trigger a refresh when I am in the "wrong context"?

Mike


--
Michael Musgrove
Transactions Team
t: +44 191 243 0870

Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham (US), Paul Hickey (Ireland), Matt Parson
(US), Charles Peters (US)

Michael Cunningham (US), Charles Peters (US), Matt Parson (US), Michael O'Neill(Ireland)

_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Reply | Threaded
Open this post in threaded view
|

Re: How can I add a subsystem model step to a different context?

kkhan
Try in your operation's execute():

public void execute(OperationContext context, ModelNode operation) {
        ModelNode operation = Util.createEmptyOperation("whatever", context.getCurrentAddress().getParent().getParent());
        context.addStep(final ModelNode operation, new OperationStepHandler{
                public void execute(OperationContext context, ModelNode operation) {
               
        }
        }, MODEL);
}


> On 17 Oct 2016, at 13:30, Michael Musgrove <[hidden email]> wrote:
>
> I have subsystem model operation that removes a model node:
>
> {
>     "address" => [
>         ("subsystem" => "transactions"),
>         ("log-store" => "log-store"),
>         ("transactions" => "0:ffffac11829d:83bb:57f3b02a:1e"),
>         ("participants" => "1")
>     ],
>     "operation" => "delete",
>     "operation-headers" => {
>         "caller-type" => "user",
>         "access-mechanism" => "NATIVE"
>     }
> }
>
> After removing the node (which can result in removing the participant and transaction) I need to add a step that will refresh the model. I cannot do the refresh from the current context (which will be the node I am deleting) so I need to refresh from a context that is "higher up the tree". Ideally I want to do
>
>   PathAddress logStoreAddress = context.getCurrentAddress().getParent().getParent();
>
> and then do a refresh from logStoreAddress.
>
> My question is how can I trigger a refresh when I am in the "wrong context"?
>
> Mike
>
>
> --
> Michael Musgrove
> Transactions Team
> e: [hidden email]
> t: +44 191 243 0870
>
> Registered in England and Wales under Company Registration No. 03798903
> Directors: Michael Cunningham (US), Paul Hickey (Ireland), Matt Parson
> (US), Charles Peters (US)
>
> Michael Cunningham (US), Charles Peters (US), Matt Parson (US), Michael O'Neill(Ireland)
> _______________________________________________
> wildfly-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/wildfly-dev


_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Reply | Threaded
Open this post in threaded view
|

Re: How can I add a subsystem model step to a different context?

Michael Musgrove
Thanks Karbir, that works great.

Mike

On Mon, Oct 17, 2016 at 9:20 PM, Kabir Khan <[hidden email]> wrote:
Try in your operation's execute():

public void execute(OperationContext context, ModelNode operation) {
        ModelNode operation = Util.createEmptyOperation("whatever", context.getCurrentAddress().getParent().getParent());
        context.addStep(final ModelNode operation, new OperationStepHandler{
                public void execute(OperationContext context, ModelNode operation) {

                }
        }, MODEL);
}


> On 17 Oct 2016, at 13:30, Michael Musgrove <[hidden email]> wrote:
>
> I have subsystem model operation that removes a model node:
>
> {
>     "address" => [
>         ("subsystem" => "transactions"),
>         ("log-store" => "log-store"),
>         ("transactions" => "0:ffffac11829d:83bb:57f3b02a:1e"),
>         ("participants" => "1")
>     ],
>     "operation" => "delete",
>     "operation-headers" => {
>         "caller-type" => "user",
>         "access-mechanism" => "NATIVE"
>     }
> }
>
> After removing the node (which can result in removing the participant and transaction) I need to add a step that will refresh the model. I cannot do the refresh from the current context (which will be the node I am deleting) so I need to refresh from a context that is "higher up the tree". Ideally I want to do
>
>   PathAddress logStoreAddress = context.getCurrentAddress().getParent().getParent();
>
> and then do a refresh from logStoreAddress.
>
> My question is how can I trigger a refresh when I am in the "wrong context"?
>
> Mike
>
>
> --
> Michael Musgrove
> Transactions Team
> e: [hidden email]
> t: <a href="tel:%2B44%20191%20243%200870" value="+441912430870">+44 191 243 0870
>
> Registered in England and Wales under Company Registration No. 03798903
> Directors: Michael Cunningham (US), Paul Hickey (Ireland), Matt Parson
> (US), Charles Peters (US)
>
> Michael Cunningham (US), Charles Peters (US), Matt Parson (US), Michael O'Neill(Ireland)
> _______________________________________________
> wildfly-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/wildfly-dev




--
Michael Musgrove
Transactions Team
t: +44 191 243 0870

Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham (US), Paul Hickey (Ireland), Matt Parson
(US), Charles Peters (US)

Michael Cunningham (US), Charles Peters (US), Matt Parson (US), Michael O'Neill(Ireland)

_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev