Oracle GlassFish Server 3.0.1 Administration Guide

ProcedureTo Update a Node in the Tree

  1. Ensure that the server is running.

    Operations on REST resources for GlassFish Server data require a running server.

  2. Determine the acceptable message parameters for the POST method of the resource that represents the node.

    For information about how to perform this step, see To Determine the Methods and Method Parameters That a Node in the Tree Supports.

  3. Use the POST method on the REST resource that represents the node that you are updating.

  4. Confirm that the node has been updated.

    For information about how to perform this step, see To Retrieve Data for a Node in the Tree.


Example 2–24 Updating a Node in the Tree

This example uses the cURL utility to update a JDBC resource in the tree by modifying the REST resource that represents the JDBC resource.

In this example, the DAS is running on the local host and the HTTP port for administration is 4848.

Line breaks are added to enhance readability.

  1. This step determines the acceptable message parameters for the POST method of the resource jdbc-myjdbcresource.


    curl -X OPTIONS -H "Accept: application/json" 
    http://localhost:4848/management/domain/resources/
    jdbc-resource/jdbc-myjdbcresource
    {"JdbcMyjdbcresource":
      {
        "Method":{
          "Name":"POST",
          "Message Parameters":{
            "enabled":{"Key":"false", "Default Value":"true", 
                "Type":"boolean", "Optional":"true"},
            "pool-name":{"Key":"false", "Type":"string", "Optional":"true"},
            "description":{"Key":"false", "Type":"string", "Optional":"true"},
            "jndi-name":{"Key":"true", "Type":"string", "Optional":"true"},
            "object-type":{"Key":"false", "Default Value":"user", 
                "Type":"string", "Optional":"true"}
          }
        },
        "Method":{
          "Name":"GET"
        },
        "Method":{
          "Name":"DELETE",
          "Message Parameters":{
            "target":{"Acceptable Values":"", "Default Value":"", 
                "Type":"string", "Optional":"true"}
          }
        }
      }
    }
  2. This step updates the REST resource jdbc-myjdbcresource to disable the JDBC resource that jdbc-myjdbcresource represents. The -d option of the cURL utility sets the enabled message parameter to disabled.


    curl -X POST -d "enabled=false" 
    http://localhost:4848/management/domain/resources/
    jdbc-resource/jdbc-myjdbcresource
    "http://localhost:4848/management/domain/resources/jdbc-resource/
    jdbc-myjdbcresource" updated successfully.
  3. This step confirms that the node has been updated by retrieving data for the REST resource that represents the node.


    curl -X GET -H "Accept: application/json" 
    http://localhost:4848/management/domain/resources/
    jdbc-resource/jdbc-myjdbcresource
    {
    
      "JdbcMyjdbcresource":{"enabled":"false", "pool-name":"DerbyPool", 
           "description":"", "jndi-name":"jdbc/myjdbcresource", "object-type":"user"},
    
      "Methods":{
        "Method":{
          "Name":"POST",
          "Message Parameters":{
            "enabled":{"Key":"false", "Default Value":"true", 
                "Type":"boolean", "Optional":"true"},
            "pool-name":{"Key":"false", "Type":"string", "Optional":"true"},
            "description":{"Key":"false", "Type":"string", "Optional":"true"},
            "jndi-name":{"Key":"true", "Type":"string", "Optional":"true"},
            "object-type":{"Key":"false", "Default Value":"user", 
                "Type":"string", "Optional":"true"}
          }
        },
        "Method":{
          "Name":"GET"
        },
        "Method":{
          "Name":"DELETE",
          "Message Parameters":{
            "target":{"Acceptable Values":"", "Default Value":"", 
                "Type":"string", "Optional":"true"}
          }
        }
      }
    
    }