Sun GlassFish Enterprise Server v3 Administration Guide

ProcedureTo Delete a Node From the Tree

  1. Ensure that the server is running.

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

  2. Confirm that the node can be deleted.

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

  3. Confirm that the node has been deleted.

    Perform this step on the resource that represents the parent of the node that you have just deleted. For information about how to perform this step, see To Retrieve Data for a Node in the Tree.


Example 2–25 Deleting a Node From the Tree

This example uses the cURL utility to delete a JDBC resource from the tree by deleting 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 confirms that the node can be deleted by retrieving the REST methods that the resource jdbc-myjdbcresource supports.


    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 deletes the jdbc-myjdbcresource resource.


    curl -X DELETE http://localhost:4848/management/domain/resources/
    jdbc-resource/jdbc-myjdbcresource
    
  3. This step confirms that the node has been deleted by retrieving data for the REST resource that represents the parent of the node.


    curl -X GET -H "Accept: application/json" 
    http://localhost:4848/management/domain/resources/jdbc-resource/
    {
    
      "JdbcResource":{},
    
      "Methods":{
        "Method":{
          "Name":"POST",
          "Message Parameters":{
            "id":{"Acceptable Values":"", "Default Value":"", "Type":"string", 
                "Optional":"false"},
            "enabled":{"Acceptable Values":"", "Default Value":"true", 
                "Type":"boolean", "Optional":"true"},
            "description":{"Acceptable Values":"", "Default Value":"", 
                "Type":"string", "Optional":"true"},
            "target":{"Acceptable Values":"", "Default Value":"", "Type":"string", 
                "Optional":"true"},
            "property":{"Acceptable Values":"", "Default Value":"", "Type":"string",
                "Optional":"true"},
            "connectionpoolid":{"Acceptable Values":"", "Default Value":"", 
                "Type":"string", "Optional":"false"}
          }
        },
        "Method":{
          "Name":"GET"
        }
      },
    
      "Child Resources":[
        "http://localhost:4848/management/domain/resources/jdbc-resource/
            jdbc-__TimerPool",
        "http://localhost:4848/management/domain/resources/jdbc-resource/
            jdbc-__default"
      ]