org.modeshape.web.jcr.rest.client.json

## Class ServerNode

- java.lang.Object
- - org.codehaus.jettison.json.JSONObject
  - - org.modeshape.web.jcr.rest.client.json.JsonNode
    - - org.modeshape.web.jcr.rest.client.json.ServerNode

- All Implemented Interfaces:
    Serializable

      public final class ServerNode
      extends JsonNode

  The `ServerNode` class is responsible for knowing how to create a URL for a server, create a URL to obtain a server's repositories, and parse a JSON response into `repository` objects.
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class org.codehaus.jettison.json.JSONObject

      `NULL`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ServerNode(Server server)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `URL` | `getFindRepositoriesUrl()`
    `Collection<Repository>` | `getRepositories(String jsonResponse)`
    `URL` | `getUrl()` The URL will NOT end in '/'.

    - ### Methods inherited from class org.modeshape.web.jcr.rest.client.json.JsonNode

      `children, getContent, getId, properties, toString, withChild, withMixin, withPrimaryType, withProperty`

    - ### Methods inherited from class org.codehaus.jettison.json.JSONObject

      `accumulate, append, doubleToString, get, getBoolean, getDouble, getInt, getJSONArray, getJSONObject, getLong, getString, has, isNull, keys, length, names, numberToString, opt, optBoolean, optBoolean, optDouble, optDouble, optInt, optInt, optJSONArray, optJSONObject, optLong, optLong, optString, optString, put, put, put, put, put, put, put, putOpt, quote, remove, toJSONArray, toString, write`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ServerNode

          public ServerNode(Server server)

      Parameters:
        `server` - the server containing the repositories (never `null`)

  - ### Method Detail

    - #### getUrl

          public URL getUrl()
                     throws Exception

      The URL will NOT end in '/'.

      Specified by:
        `getUrl` in class `JsonNode`
      Returns:
        an HTTP URL representing this node
      Throws:
        `Exception` - if there is a problem constructing the URL
      See Also:
        `JsonNode.getUrl()`

    - #### getFindRepositoriesUrl

          public URL getFindRepositoriesUrl()
                                     throws Exception

      Returns:
        the URL to use when requesting the repositories (never `null`)
      Throws:
        `Exception` - if there is a problem obtaining the repositories

    - #### getRepositories

          public Collection<Repository> getRepositories(String jsonResponse)
                                                 throws Exception

      Parameters:
        `jsonResponse` - the HTTP connection JSON response (never `null`) containing the repositories
      Returns:
        the repositories found in the JSON response (never `null`)
      Throws:
        `Exception` - if there is a problem obtaining the repositories

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.