org.modeshape.connector.jcr
Class JcrRequestProcessor.Workspace

java.lang.Object
  extended by org.modeshape.connector.jcr.JcrRequestProcessor.Workspace
Enclosing class:
JcrRequestProcessor

protected class JcrRequestProcessor.Workspace
extends Object

An encapsulation of a remote JCR Session, with an ExecutionContext that contains a namespace registry which mirrors the session's registry, and with factories that convert the JCR-specific values, paths, and names into their graph-equivalents.


Constructor Summary
protected JcrRequestProcessor.Workspace(Session jcrSession)
           
 
Method Summary
 Object convert(Value value, Property jcrProperty)
          Utility method used to convert a JCR Value object into a valid graph property value.
protected  Value convertToJcrValue(PropertyType graphType, Object graphValue)
           
protected  Set<Name> getMultiValuedProperties(Property multiValuedProperty)
           
 Location locationFor(Node node)
          Obtain the actual location for the supplied node.
 Location locationForRootNode()
           
 Location move(Node original, Node newParent, Name newName, Node beforeSibling)
           
 String name()
           
protected  String nameFor(Node node)
           
 Node node(Location location)
          Find the existing node given the location.
 Property propertyFor(Name name, Object... values)
           
 Property propertyFor(Property jcrProperty)
          Get the graph property for the supplied JCR property representation.
 Session session()
           
 void setProperties(Node node, Iterable<Property> properties)
           
protected  void setProperty(Node node, Property property, boolean isMultiValued)
           
protected  String stringFor(Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JcrRequestProcessor.Workspace

protected JcrRequestProcessor.Workspace(Session jcrSession)
                                 throws RepositoryException
Throws:
RepositoryException
Method Detail

move

public Location move(Node original,
                     Node newParent,
                     Name newName,
                     Node beforeSibling)
              throws RepositoryException
Throws:
RepositoryException

name

public String name()

session

public Session session()

stringFor

protected String stringFor(Object value)

nameFor

protected String nameFor(Node node)
                  throws RepositoryException
Throws:
RepositoryException

propertyFor

public Property propertyFor(Name name,
                            Object... values)

propertyFor

public Property propertyFor(Property jcrProperty)
                     throws RepositoryException
Get the graph property for the supplied JCR property representation.

Parameters:
jcrProperty - the JCR property; may not be null
Returns:
the graph property
Throws:
RepositoryException - if there is an error working with the session

convert

public Object convert(Value value,
                      Property jcrProperty)
               throws RepositoryException
Utility method used to convert a JCR Value object into a valid graph property value.

Parameters:
value - the JCR value; may be null
jcrProperty - the JCR property, used to access the session (if needed)
Returns:
the graph representation of the value
Throws:
RepositoryException - if there is an error working with the session

locationFor

public Location locationFor(Node node)
                     throws RepositoryException
Obtain the actual location for the supplied node.

Parameters:
node - the existing node; may not be null
Returns:
the actual location, with UUID if the node is "mix:referenceable"
Throws:
RepositoryException - if there is an error

locationForRootNode

public Location locationForRootNode()
                             throws RepositoryException
Throws:
RepositoryException

node

public Node node(Location location)
          throws RepositoryException
Find the existing node given the location.

Parameters:
location - the location of the node, which must have a path and/or UUID
Returns:
the existing node; never null
Throws:
RepositoryException - if there is an error working with the session
PathNotFoundException - if the node could not be found by its path

setProperties

public void setProperties(Node node,
                          Iterable<Property> properties)
                   throws RepositoryException
Throws:
RepositoryException

getMultiValuedProperties

protected Set<Name> getMultiValuedProperties(Property multiValuedProperty)

setProperty

protected void setProperty(Node node,
                           Property property,
                           boolean isMultiValued)
                    throws RepositoryException
Throws:
RepositoryException

convertToJcrValue

protected Value convertToJcrValue(PropertyType graphType,
                                  Object graphValue)
                           throws RepositoryException
Throws:
RepositoryException


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