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

java.lang.Object
  extended by org.codehaus.jettison.json.JSONObject
      extended by org.modeshape.web.jcr.rest.client.json.JsonNode
          extended by org.modeshape.web.jcr.rest.client.json.NodeTypeNode

@Immutable
public final class NodeTypeNode
extends JsonNode

The NodeTypeNode class is responsible for knowing how to obtain a NodeType based on the Workspace.
An example URL to obtain all the node types would look like:
{context root}/{repository name}/{workspace name}/items/jcr:system/jcr:nodeTypes"
And an example url to obtain a specific node type would look like:
{context root}/{repository name}/{workspace name}/items/jcr:system/jcr:nodeTypes/{node type name}


Field Summary
 
Fields inherited from class org.codehaus.jettison.json.JSONObject
NULL
 
Constructor Summary
NodeTypeNode(Workspace workspace, String relative_path, String nodeDepth)
          Use this constructor if wanting all node types for a workspace
 
Method Summary
 NodeType getNodeType(String jsonResponse)
           
 Collection<NodeType> getNodeTypes(String jsonResponse)
           
 String getPath()
           
 URL getUrl()
           The URL will NOT end in '/'.
protected  void processBody(org.codehaus.jettison.json.JSONObject body, Collection<NodeType> nodetypes, NodeType parentNodeType)
           
 
Methods inherited from class org.modeshape.web.jcr.rest.client.json.JsonNode
getContent, getId, toString
 
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

NodeTypeNode

public NodeTypeNode(Workspace workspace,
                    String relative_path,
                    String nodeDepth)
             throws Exception
Use this constructor if wanting all node types for a workspace

Parameters:
workspace - the workspace being used (never null)
relative_path - is the relative location after the workspace
nodeDepth - , nullable, can specify the depth of the node types to be returned
Throws:
Exception - if there is a problem creating the folder node
Method Detail

getPath

public String getPath()
Returns:
the full path of folder within the workspace

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()

getNodeTypes

public Collection<NodeType> getNodeTypes(String jsonResponse)
                                  throws Exception
Parameters:
jsonResponse - the HTTP connection JSON response (never null) containing the NodeTypes
Returns:
the node types for this workspace (never null)
Throws:
Exception - if there is a problem obtaining the node types

processBody

protected void processBody(org.codehaus.jettison.json.JSONObject body,
                           Collection<NodeType> nodetypes,
                           NodeType parentNodeType)
                    throws Exception
Throws:
Exception

getNodeType

public NodeType getNodeType(String jsonResponse)
                     throws Exception
Parameters:
jsonResponse - the HTTP connection JSON response (never null) containing the NodeTypes
Returns:
the node types for this workspace (never null)
Throws:
Exception - if there is a problem obtaining the node types


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