org.modeshape.repository.sequencer
Class SequencerOutputMap

java.lang.Object
  extended by org.modeshape.repository.sequencer.SequencerOutputMap
All Implemented Interfaces:
Iterable<SequencerOutputMap.Entry>, SequencerOutput

@NotThreadSafe
public class SequencerOutputMap
extends Object
implements SequencerOutput, Iterable<SequencerOutputMap.Entry>

A basic SequencerOutput that records all information in-memory and which organizes the properties by node paths and provides access to the nodes in a natural path-order.


Nested Class Summary
 class SequencerOutputMap.Entry
          An entry in a SequencerOutputMap, which contains the path of the node and the property values on the node.
protected  class SequencerOutputMap.EntryIterator
           
 class SequencerOutputMap.PropertyValue
          A property name and value pair.
 
Constructor Summary
SequencerOutputMap(ValueFactories factories)
           
 
Method Summary
protected  List<SequencerOutputMap.PropertyValue> getProperties(Path nodePath)
          Get the properties for the node given by the supplied path.
 boolean isEmpty()
          Return whether there are no entries
 Iterator<SequencerOutputMap.Entry> iterator()
          Return the entries in this output in an order with shorter paths first.
protected  List<SequencerOutputMap.PropertyValue> removeProperties(Path nodePath)
           
 void setProperty(Path nodePath, Name propertyName, Object... values)
          Set the supplied property on the supplied node.
 void setProperty(String nodePath, String property, Object... values)
          Deprecated. As of ModeShape 2.0, the preferred approach is to use setProperty(Path, Name, Object...), which properly addresses the session having different namespace mappings. This method depends on the namespace mappings for the given URIs in the name components of the nodePath and propertyName to be mapped in the NamespaceRegistry of the ModeShapeEngine's (or JcrEngine's) ExecutionContext.
 void setReference(String nodePath, String propertyName, String... paths)
          Deprecated. As of ModeShape 2.0, the preferred approach is to use setProperty(Path, Name, Object...), which properly addresses the session having different namespace mappings. This method depends on the namespace mappings for the given URIs in the name components of the nodePath and propertyName to be mapped in the NamespaceRegistry of the ModeShapeEngine's (or JcrEngine's) ExecutionContext.
 int size()
          Return the number of node entries in this map.
protected  void sortValues()
           
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SequencerOutputMap

public SequencerOutputMap(ValueFactories factories)
Method Detail

setProperty

public void setProperty(Path nodePath,
                        Name propertyName,
                        Object... values)
Set the supplied property on the supplied node.

The value factories should be used to create paths, names, and values. These factories can be used to create new values or convert values from one property type to another. (Note that each of the factories have methods that create values from all of the property types.)

Specified by:
setProperty in interface SequencerOutput
Parameters:
nodePath - the path to the node containing the property; may not be null
propertyName - the name of the property to be set
values - the value(s) for the property; may be empty if any existing property is to be removed

setProperty

@Deprecated
public void setProperty(String nodePath,
                                   String property,
                                   Object... values)
Deprecated. As of ModeShape 2.0, the preferred approach is to use setProperty(Path, Name, Object...), which properly addresses the session having different namespace mappings. This method depends on the namespace mappings for the given URIs in the name components of the nodePath and propertyName to be mapped in the NamespaceRegistry of the ModeShapeEngine's (or JcrEngine's) ExecutionContext.

Set the supplied property on the supplied node.

The value factories should be used to create paths, names, and values. These factories can be used to create new values or convert values from one property type to another. (Note that each of the factories have methods that create values from all of the property types.)

This method is provided as a convenience, but it identical to creating a Path and Name using the factories and calling SequencerOutput.setProperty(Path, Name, Object...).

Specified by:
setProperty in interface SequencerOutput
Parameters:
nodePath - the path to the node containing the property; may not be null
property - the name of the property to be set
values - the value(s) for the property; may be empty if any existing property is to be removed

setReference

@Deprecated
public void setReference(String nodePath,
                                    String propertyName,
                                    String... paths)
Deprecated. As of ModeShape 2.0, the preferred approach is to use setProperty(Path, Name, Object...), which properly addresses the session having different namespace mappings. This method depends on the namespace mappings for the given URIs in the name components of the nodePath and propertyName to be mapped in the NamespaceRegistry of the ModeShapeEngine's (or JcrEngine's) ExecutionContext.

Set the supplied reference on the supplied node.

This method is provided as a convenience, but it identical to creating a Path and Name using the factories and calling SequencerOutput.setProperty(Path, Name, Object...).

Specified by:
setReference in interface SequencerOutput
Parameters:
nodePath - the path to the node containing the property; may not be null
propertyName - the name of the property to be set
paths - the paths to the referenced property, which may be absolute paths or relative to the sequencer output node; may be empty if any existing property is to be removed

size

public int size()
Return the number of node entries in this map.

Returns:
the number of entries

isEmpty

public boolean isEmpty()
Return whether there are no entries

Returns:
true if this container is empty, or false otherwise

removeProperties

protected List<SequencerOutputMap.PropertyValue> removeProperties(Path nodePath)

getProperties

protected List<SequencerOutputMap.PropertyValue> getProperties(Path nodePath)
Get the properties for the node given by the supplied path.

Parameters:
nodePath - the path to the node
Returns:
the property values, or null if there are none

iterator

public Iterator<SequencerOutputMap.Entry> iterator()
Return the entries in this output in an order with shorter paths first.

Specified by:
iterator in interface Iterable<SequencerOutputMap.Entry>

sortValues

protected void sortValues()

toString

public String toString()

Overrides:
toString in class Object


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