Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can simply use the write-attribute operation.</p> <p>A healthy workflow for the Management CLI is to expose, read and write resource attributes. To give an example of this workflow, we are going to doing the following steps on a fresh default installation of JBoss Application Server 7.1.0Beta1.</p> <h2>Steps to identify and write a system resource attribute</h2> <ol> <li>Read all system properties</li> <li>Read a specific system property in more detail</li> <li>Expose an example system property attribute</li> <li>Write an example system property attribute</li> <li>Expose the change to confirm it</li> <li>Reset the attribute back to the original value</li> </ol> <h2>1. Read all system properties</h2> <p>We don't always know the exact name of what we are looking for. We can use a mix of tab completion and wildcard searches to make it easy to expose the resources and attributes. The <code>read-resource</code> operation is a great start to any workflow, as it exposes all present entities. </p> <pre><code>[domain@localhost:9999 /] /system-property=*:read-resource { "outcome" =&gt; "success", "result" =&gt; [{ "address" =&gt; [("system-property" =&gt; "java.net.preferIPv4Stack")], "outcome" =&gt; "success", "result" =&gt; { "boot-time" =&gt; true, "value" =&gt; "true" } }] } </code></pre> <h2>2. Read a specific system property in more detail</h2> <p>The <code>read-resource</code> operation has exposed the <code>java.net.preferIPv4Stack</code> property. We can query this further by using the <code>read-resource-description</code> operation.</p> <pre><code>[domain@localhost:9999 /] /system-property=java.net.preferIPv4Stack:read-resource-description { "outcome" =&gt; "success", "result" =&gt; { "description" =&gt; "A system property to set on all servers in the domain.", "head-comment-allowed" =&gt; true, "tail-comment-allowed" =&gt; false, "attributes" =&gt; { "value" =&gt; { "type" =&gt; STRING, "description" =&gt; "The value of the system property.", "required" =&gt; false, "access-type" =&gt; "read-write", "storage" =&gt; "configuration", "restart-required" =&gt; "no-services" }, "boot-time" =&gt; { "type" =&gt; BOOLEAN, "description" =&gt; "If true the system property is passed on the command-line to the started server jvm. If false, it will be pushed to the server as part of the startup sequence.", "required" =&gt; false, "default" =&gt; true, "access-type" =&gt; "read-write", "storage" =&gt; "configuration", "restart-required" =&gt; "no-services" } } } } </code></pre> <h2>3. Expose an example system property attribute</h2> <p>The <code>read-resource-description</code> operation prints information about the resource, including its attributes. We can specifically query these attributes with the <code>read-attribute</code> operation. Again, tab completion makes it easy to compose these operation strings as you begin typing, and hit tab to complete the string or to suggest available additions.</p> <p>[domain@localhost:9999 /] /system-property=java.net.preferIPv4Stack:read-attribute(name=boot-time)<br> { "outcome" => "success", "result" => true }</p> <h2>4. Write an example system property attribute</h2> <p>In the same way that we just queried the attribute, we can change it. In this case, we can use the <code>write-attribute</code> operation, keeping in mind the intended value type as reported by the <code>read-resource-description</code> operation. This operation declared the attributed to be BOOLEAN, but you should be able to work this out simply by looking at the existing value in the <code>read-attribute</code> command (where it is defined).</p> <pre><code>[domain@localhost:9999 /] /system-property=java.net.preferIPv4Stack:write-attribute(name=boot-time, value=false) { "outcome" =&gt; "success", "result" =&gt; { "domain-results" =&gt; {"step-1" =&gt; undefined}, "server-operations" =&gt; undefined } } </code></pre> <h2>5. Expose the change to confirm it</h2> <p>We can run the <code>read-attribute</code> operation again to show the value change.</p> <pre><code>[domain@localhost:9999 /] /system-property=java.net.preferIPv4Stack:read-attribute(name=boot-time) { "outcome" =&gt; "success", "result" =&gt; false } </code></pre> <h2>6. Reset the attribute back to the original value</h2> <p>Just to gracefully end the example, let's change the value back to the original state.</p> <pre><code>[domain@localhost:9999 /] /system-property=java.net.preferIPv4Stack:write-attribute(name=boot-time, value=true) { "outcome" =&gt; "success", "result" =&gt; { "domain-results" =&gt; {"step-1" =&gt; undefined}, "server-operations" =&gt; undefined } } </code></pre> <h2>Summary</h2> <p>Yes, you can write attribute values. To make the process easier, a workflow habit of exposing the attribute values and file type definitions is a good practice, and should make the process clearer. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload