things.data.impl
Class ThingsPropertyTrunkInMemory

java.lang.Object
  extended by things.data.impl.ThingsPropertyTrunkInMemory
All Implemented Interfaces:
ThingsPropertyTrunk

public class ThingsPropertyTrunkInMemory
extends java.lang.Object
implements ThingsPropertyTrunk

An in-memory implementation for a property trunk. Basically, it's just a null implementation. The ID can be meaningless.

Version:
1.0

Version History

EPG - Initial - 5 JUN 05
 
Author:
Erich P. Gatejen

Nested Class Summary
 
Nested classes/interfaces inherited from interface things.data.ThingsPropertyTrunk
ThingsPropertyTrunk.Mode
 
Constructor Summary
ThingsPropertyTrunkInMemory()
           
 
Method Summary
 void endRead()
          End a read transfer.
 void endWrite()
          End a wrote transfer.
 ThingsPropertyTrunk.Mode getMode()
          Get the current Mode.
 void init(java.lang.String id, Accessor accessItem)
          Sets the ID.
 NV readNext()
          Read the next property.
 void startRead()
          Start a read.
 void startWrite()
          Start a write transfer.
 void writeNext(NVImmutable item)
          Write the next property
 void writeNext(java.lang.String name, java.lang.String value)
          Write the next property
 void writeNextMultivalue(java.lang.String name, java.lang.String... values)
          Write the next property that is a multivalue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThingsPropertyTrunkInMemory

public ThingsPropertyTrunkInMemory()
Method Detail

getMode

public ThingsPropertyTrunk.Mode getMode()
Get the current Mode.

Specified by:
getMode in interface ThingsPropertyTrunk
Returns:
the Mode.

init

public void init(java.lang.String id,
                 Accessor accessItem)
          throws ThingsException
Sets the ID. It's really up to the implementation as to what the ID means. It may be ignored and all will be transfered.

Specified by:
init in interface ThingsPropertyTrunk
Parameters:
id - An id
accessItem - A way to read and write the data.
Throws:
ThingsException

startRead

public void startRead()
               throws ThingsException
Start a read.

Specified by:
startRead in interface ThingsPropertyTrunk
Throws:
ThingsException

endRead

public void endRead()
             throws ThingsException
End a read transfer. If a read hasn't started, nothing bad will happen.

Specified by:
endRead in interface ThingsPropertyTrunk
Throws:
ThingsException

startWrite

public void startWrite()
                throws ThingsException
Start a write transfer.

Specified by:
startWrite in interface ThingsPropertyTrunk
Throws:
ThingsException

endWrite

public void endWrite()
              throws ThingsException
End a wrote transfer. If a write hasn't started, nothing bad will happen. It should flush and close the destination.

Specified by:
endWrite in interface ThingsPropertyTrunk
Throws:
ThingsException

writeNext

public void writeNext(java.lang.String name,
                      java.lang.String value)
               throws ThingsException
Write the next property

Specified by:
writeNext in interface ThingsPropertyTrunk
Parameters:
name - The property name as a string
value - The property value as a string
Throws:
ThingsException

writeNext

public void writeNext(NVImmutable item)
               throws ThingsException
Write the next property

Specified by:
writeNext in interface ThingsPropertyTrunk
Parameters:
item - the next property as an NVImmutable.
Throws:
ThingsException
See Also:
NVImmutable

writeNextMultivalue

public void writeNextMultivalue(java.lang.String name,
                                java.lang.String... values)
                         throws ThingsException
Write the next property that is a multivalue.

Specified by:
writeNextMultivalue in interface ThingsPropertyTrunk
Parameters:
name - The property name as a string
values - The property values
Throws:
ThingsException

readNext

public NV readNext()
            throws ThingsException
Read the next property. It will return null if there are non left.

Specified by:
readNext in interface ThingsPropertyTrunk
Returns:
NV
Throws:
ThingsException


Things.