Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-5062

Document how to handle various Model types via CLI (CLI guide)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Major Major
    • None
    • 7.0.0.GA
    • Documentation
    • None

      We should add a short guide about handling a different resource types via CLI (for all model node types refer to https://github.com/jbossas/jboss-dmr/blob/master/src/main/java/org/jboss/dmr/ModelType.java). Since each attribute value can be limited by subsystem (e.g. logging level is STRING, but model doesn't accept all STRING values), there is no need to include extra details about the types (this would make more sense in admin guide anyway).

      All Model types used in EAP7 configuration can be listed by:

      [pkremens@localhost bin] $ ./jboss-cli.sh "embed-server -c=standalone-full-ha.xml, :read-resource-description(recursive=true)" | egrep "[ ]+\"type\"" | sed 's/[ ]*//' | sort | uniq | grep -v '{'"type" => BIG_DECIMAL,
      "type" => BOOLEAN,
      "type" => BYTES,
      "type" => DOUBLE,
      "type" => INT,
      "type" => LIST,
      "type" => LONG,
      "type" => OBJECT,
      "type" => STRING,
      

      My main motivation for this is that from time to time people come to me as they struggle to add a certain model type via CLI (e.g. list), this cheatsheet should help them with doing so.

      :read-resource-description operation should be used to see the actual type (we run into few cases where xsd for subsystem doesn't match the actual model implementation - JBEAP-5044 recently, :read-resource-description operation always show the type that the model is using).

      [standalone@localhost:9990 /] /subsystem=$subsystem/resource=*:read-resource-description
      ...
                      "type" => STRING,
      ...
      

      For numeric types, see also min and max in resource descriptio for value boundaries.

                          "min" => 1L,
                          "max" => 2147483647L,
      

      For STRING type, see allowed in resource description for allowed values.

                      "allowed" => [
                          "ALL",
                          "FINEST",
                          "FINER",
                          "TRACE",
                          "DEBUG",
      ...
      

      For OBJECT type, see value-type in resource description to determine the object structure.

                      "value-type" => STRING
      

      Examples
      BIG_DECIMAL

      $resource:write-attribute(name=attribute-name, value=1.5)
      

      BOOLEAN

      $resource:write-attribute(name=attribute-name, value=true)
      

      BYTES
      All resources with BYTES type are read-only
      DOUBLE

      $resource:write-attribute(name=attribute-name, value=1.5)
      

      INT

      $resource:write-attribute(name=attribute-name, value=20)
      

      LIST

      $resource:write-attribute(name=attribute-name, value=\[foo,var\])
      $resource:write-attribute(name=attribute-name, value=foo\,bar)
      

      OBJECT

      $resource:write-attribute(name=attribute-name, value={foo1=bar1, foo2=bar2, foo3=bar3})
      

      STRING

      $resource:write-attribute(name=attribute-name, value=foo)
      

              Unassigned Unassigned
              pkremens@redhat.com Petr Kremensky (Inactive)
              Marek Kopecky Marek Kopecky
              Marek Kopecky Marek Kopecky
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: