<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Format of a Detyped Operation Request
</h3>
<span style="margin-bottom: 10px;">
    modified by <a href="http://community.jboss.org/people/bstansberry%40jboss.com">Brian Stansberry</a> in <i>JBoss AS7 Development</i> - <a href="http://community.jboss.org/docs/DOC-16336">View the full document</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>The basic method a user of the AS 7 programmatic managment API would use it very simple:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160; <span style="font-family: courier new,courier;">ModelNode execute(ModelNode operation) throws CancellationException, IOException;</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>where the return value is the detyped representation of the response, and <span style="font-family: courier new,courier;">operation</span> is the detyped representation of the operating being invoked.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The purpose of this article is to document the structure of <span style="font-family: courier new,courier;">operation.</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><h3>Simple Operations</h3><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>A text representation of simple operation would look like this:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code">{
&#160;&#160;&#160; "op" =&gt; "setCoreThreads",
&#160;&#160;&#160; "op-addr" =&gt; [
&#160;&#160;&#160;&#160;&#160;&#160;&#160; ("base" =&gt; "domain"),
&#160;&#160;&#160;&#160;&#160;&#160;&#160; ("profile" =&gt; "production"),
&#160;&#160;&#160;&#160;&#160;&#160;&#160; ("subsystem" =&gt; "threads"),
&#160;&#160;&#160;&#160;&#160;&#160;&#160; ("bounded-queue-thread-pool" =&gt; "pool1")
&#160;&#160;&#160; ],
&#160;&#160;&#160; "count" =&gt; 0,
&#160;&#160;&#160; "per-cpu" =&gt; 20
}
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Java code to produce that output would be:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code jive-java">ModelNode op = <font color="navy"><b>new</b></font> ModelNode();
op.get(<font color="red">"op"</font>).set(<font color="red">"setCoreThreads"</font>);
ModelNode addr = opB.get(<font color="red">"op-addr"</font>);
addr.add(<font color="red">"base"</font>, <font color="red">"domain"</font>);
addr.add(<font color="red">"profile"</font>, <font color="red">"production"</font>);
addr.add(<font color="red">"subsystem"</font>, <font color="red">"threads"</font>);
addr.add(<font color="red">"bounded-queue-thread-pool"</font>, <font color="red">"pool1"</font>);
op.get(<font color="red">"count"</font>).set(0);
op.get(<font color="red">"per-cpu"</font>).set(20);
&#160;
System.out.println(op);
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The order in which the items appear in the request is not relevant. The required elements are:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><ul><li><span style="font-family: courier new,courier;">op</span> -- String -- The name of the operation being invoked.</li><li><span style="font-family: courier new,courier;">op-addr</span> -- the address of the managed resource against which the request should be executed.</li></ul><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The other key/value pairs are parameter names and their values. The names and values should match what is specified in the operation's <a class="jive-link-wiki-small" href="http://community.jboss.org/docs/DOC-16317">description</a>.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Parameters may have any name, except for <span style="font-family: courier new,courier;">op</span>, <span style="font-family: courier new,courier;">op-addr</span> and <span style="font-family: courier new,courier;">rollout-plan</span>.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><h3>Composite Operations</h3><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The root resource managed by a (Domain|Host|Server)Controller will expose an operation named "composite".&#160;&#160; This operation executes a list of other operations as a (semi-)atomic unit.&#160; The structure of the request for the "composite" operations has the same fundamental structure as a simple operation (operation name, address, params as key value pairs.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre ___default_attr="plain" class="jive_text_macro jive_macro_code"><pre class="jive-pre"><code class="jive-code">{
&#160;&#160;&#160; "op" =&gt; "composite",
&#160;&#160;&#160; "op-addr" =&gt; [],
&#160;&#160;&#160; "steps" =&gt; [
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; "op" =&gt; "write-core-threads",
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; "op-addr" =&gt; [
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ("base" =&gt; "domain"),
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ("profile" =&gt; "production"),
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ("subsystem" =&gt; "threads"),
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ("bounded-queue-thread-pool" =&gt; "pool1")
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ],
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; "count" =&gt; 0,
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; "per-cpu" =&gt; 20
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }, 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; "op" =&gt; "write-core-threads",
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; "op-addr" =&gt; [
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ("base" =&gt; "domain"),
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ("profile" =&gt; "production"),
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ("subsystem" =&gt; "threads"),
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ("bounded-queue-thread-pool" =&gt; "pool2")
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ],
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; "count" =&gt; 5,
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; "per-cpu" =&gt; 10
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }
&#160;&#160;&#160; ],
&#160;&#160;&#160; "rollback-on-runtime-failure" =&gt; false
}
</code></pre>
</pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The "composite" operation takes two parameters:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><ul><li><span style="font-family: courier new,courier;">steps</span> -- a list, where each item in the list has the same structure as a simple operation request. In the example above each of the two steps is modifying the thread pool configuration for a different pool. There need not be any particular relationship between the steps.</li><li><span style="font-family: courier new,courier;">rollback-on-runtime-failure</span> -- boolean, optional, defaults to <span style="font-family: courier new,courier;">true</span>. Whether steps that successfully execute should be reverted if other steps fail at runtime. Note that if any steps modify the persistent configuration, and any of those steps fail, all steps will be reverted. Partial/incomplete changes to the persistent configuration are not allowed. So, this flag only deals with what happens if there is a problem applying an operation to the running state of a server (e.g. actually increasing the size of a runtime thread pool.)</li></ul><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><h3>Operations with a Rollout Plan</h3><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Operations targetted at domain or host level resources can potentially impact multiple servers. Such operations can include a "rollout plan" detailing the sequence in which the operation should be applied to servers as well as policies for detailing whether the operation should be reverted if it fails to execute successfully on some servers.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>If the operation includes a rollout plan, the structure is as follows:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre ___default_attr="plain" class="jive_text_macro jive_macro_code"><p><span style="font-family: courier new,courier;">{</span></p><p><span style="font-family: courier new,courier;">&#160;&#160;&#160; "op" =&gt; "setCoreThreads",</span></p><p><span style="font-family: courier new,courier;">&#160;&#160;&#160; "op-addr" =&gt; [</span></p><p><span style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; ("base" =&gt; "domain"),</span></p><p><span style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; ("profile" =&gt; "production"),</span></p><p><span style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; ("subsystem" =&gt; "threads"),</span></p><p><span style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; ("bounded-queue-thread-pool" =&gt; "pool1")</span></p><p><span style="font-family: courier new,courier;">&#160;&#160;&#160; ],</span></p><p><span style="font-family: courier new,courier;">&#160;&#160;&#160; "count" =&gt; 0,</span></p><p><span style="font-family: courier new,courier;">&#160;&#160;&#160; "per-cpu" =&gt; 20</span></p><p><span style="font-family: courier new,courier;">&#160;&#160;&#160; "rollout-plan" =&gt; "TODO"<br/></span></p><p><span style="font-family: courier new,courier;">}</span></p></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><em>TODO -- flesh out the structure of the rollout plan. Deployment plans in Alpha1 had a structure that could apply very easily, but it's not particularly intuitive. It was hidden from users by the DeploymentPlanBuilder API. So I want to tweak it a bit to make it more understandable to the end user.<br/></em></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>As you can see, the rollout plan is simply another structure at the same level as op, op-addr and the operation parameters.<em><br/></em></p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Comment by <a href="http://community.jboss.org/docs/DOC-16336">going to Community</a></p>

        <p style="margin: 0;">Create a new document in JBoss AS7 Development at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=102&containerType=14&container=2225">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>