org.openanzo.common.rdb.layout
Class ValueLayout

java.lang.Object
  extended by org.openanzo.common.rdb.layout.ValueLayout
All Implemented Interfaces:
IValueLayout

public class ValueLayout
extends java.lang.Object
implements IValueLayout

Provides read/write access to persisted string values of limited length in a single table. This class's original purpose was for storing RDF datatype and language strings. The length limit is database dependant. For example, a DB2 instance may limit length to 250 chars.

Author:
Joe Betz, Stephen Evanchik

Constructor Summary
ValueLayout(SQLCache sqlCache, NodeType type, Sequence sequence, java.lang.String sequenceName, java.lang.String tableName, java.lang.String optimizationString)
          Construct a layout to store String values in a database
 
Method Summary
 void batchAdd(java.util.Iterator<java.lang.String> iter)
          Add a set of strings, ignoring resulting IDs
 ClosableIterator<NodeSQL.FetchAllCommonValuesResult> fetchAll()
          FetchAll the values for this type
 java.lang.Long fetchId(java.lang.String value)
          Fetch the ID for this value
 java.lang.String fetchValue(java.lang.Long id)
          Fetch the value for this ID
 java.lang.Long store(java.lang.String value)
          Store String value
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValueLayout

public ValueLayout(SQLCache sqlCache,
                   NodeType type,
                   Sequence sequence,
                   java.lang.String sequenceName,
                   java.lang.String tableName,
                   java.lang.String optimizationString)
Construct a layout to store String values in a database

Parameters:
type - Type of nodes this is storing
sqlCache - The interface to the SQL prepared statement cache
sequence - The sequence Object that is used to get IDs
sequenceName - The name of the sequence that is used to get IDs
tableName - The name of the table where the nodes are stored
optimizationString - Extra parameters added to queries for database specific optimizations
Method Detail

store

public java.lang.Long store(java.lang.String value)
Description copied from interface: IValueLayout
Store String value

Specified by:
store in interface IValueLayout
Parameters:
value - value to store
Returns:
ID of stored value

fetchId

public java.lang.Long fetchId(java.lang.String value)
Description copied from interface: IValueLayout
Fetch the ID for this value

Specified by:
fetchId in interface IValueLayout
Parameters:
value - value to lookup
Returns:
ID of stored value

fetchValue

public java.lang.String fetchValue(java.lang.Long id)
Description copied from interface: IValueLayout
Fetch the value for this ID

Specified by:
fetchValue in interface IValueLayout
Parameters:
id - id to lookup
Returns:
the value for this ID

batchAdd

public void batchAdd(java.util.Iterator<java.lang.String> iter)
Description copied from interface: IValueLayout
Add a set of strings, ignoring resulting IDs

Specified by:
batchAdd in interface IValueLayout
Parameters:
iter - Set of strings to store

fetchAll

public ClosableIterator<NodeSQL.FetchAllCommonValuesResult> fetchAll()
Description copied from interface: IValueLayout
FetchAll the values for this type

Specified by:
fetchAll in interface IValueLayout
Returns:
all values for this type


Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.