incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1228581 - in /incubator/lcf/warthog/trunk/src: main/java/org/apache/warthog/api/ main/java/org/apache/warthog/common/ main/java/org/apache/warthog/keyvaluetablestore/ test/java/org/apache/warthog/tests/
Date Sat, 07 Jan 2012 09:08:37 GMT
Author: kwright
Date: Sat Jan  7 09:08:36 2012
New Revision: 1228581

URL: http://svn.apache.org/viewvc?rev=1228581&view=rev
Log:
Create a system of types that can be used for both SQL and non-SQL.

Added:
    incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/BaseValue.java   (with props)
    incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/BytearrayValue.java   (with props)
    incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/DoubleValue.java   (with props)
Modified:
    incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/api/WHTableStore.java
    incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/api/WHValue.java
    incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/BooleanValue.java
    incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/CharacterArray.java
    incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/CharacterValue.java
    incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/IntegerValue.java
    incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/LongValue.java
    incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/StringArray.java
    incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/StringValue.java
    incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/keyvaluetablestore/TableStore.java
    incubator/lcf/warthog/trunk/src/test/java/org/apache/warthog/tests/MultiThreadTest.java
    incubator/lcf/warthog/trunk/src/test/java/org/apache/warthog/tests/PerformanceTest.java
    incubator/lcf/warthog/trunk/src/test/java/org/apache/warthog/tests/SanityTest.java

Modified: incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/api/WHTableStore.java
URL: http://svn.apache.org/viewvc/incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/api/WHTableStore.java?rev=1228581&r1=1228580&r2=1228581&view=diff
==============================================================================
--- incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/api/WHTableStore.java (original)
+++ incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/api/WHTableStore.java Sat Jan  7 09:08:36 2012
@@ -19,6 +19,8 @@
 
 package org.apache.warthog.api;
 
+import java.io.*;
+
 /** This interface describes a table-based store built on top of a transactional
 * key-value store.  The basic representation is similar to SQL in that there are
 * tables and indexes; the difference is that the API used to manipulate and query
@@ -63,5 +65,51 @@ public interface WHTableStore
   /** Drop an index */
   public void dropIndex(String name)
     throws WHException;
+  
+  // Values can be constructed here, of several standard types.  Warthog is not limited to
+  // these types, but if you wander outside of them you give up the portability of the API
+  // across different database types.
+  
+  /** Construct a long value.
+  */
+  public WHValue make(long value)
+    throws WHException;
+
+  /** Construct a byte array value.
+  */
+  public WHValue make(byte[] value)
+    throws WHException;
+
+  /** Construct a string value.
+  */
+  public WHValue make(String value)
+    throws WHException;
+    
+  /** Construct a double value.
+  */
+  public WHValue make(double value)
+    throws WHException;
     
+  /** Construct a single char.
+  */
+  public WHValue make(char value)
+    throws WHException;
+
+  /** Construct a boolean value.
+  */
+  public WHValue make(boolean value)
+    throws WHException;
+
+  /** Construct an extended binary object.  (It is the caller's responsibility to close
+  * the stream).
+  */
+  public WHValue make(InputStream inputStream)
+    throws IOException,WHException;
+  
+  /** Construct an extended text object.  (It is the caller's responsibility to close
+  * the reader).
+  */
+  public WHValue make(Reader reader)
+    throws IOException,WHException;
+
 }

Modified: incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/api/WHValue.java
URL: http://svn.apache.org/viewvc/incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/api/WHValue.java?rev=1228581&r1=1228580&r2=1228581&view=diff
==============================================================================
--- incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/api/WHValue.java (original)
+++ incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/api/WHValue.java Sat Jan  7 09:08:36 2012
@@ -19,6 +19,8 @@
 
 package org.apache.warthog.api;
 
+import java.io.*;
+
 /** This object represents a value in a transaction key/value store.
 * Pretty much anything can be a value, provided it can be serialized.
 * Reconstitution will consist of calling the constructor for the object class
@@ -26,5 +28,52 @@ package org.apache.warthog.api;
 */
 public interface WHValue
 {
-  // Nothing needed right now
+  /** Discard this object; there's no further need for it.
+  * This MUST be called for all extended objects (e.g. binary and character).
+  */
+  public void discard()
+    throws WHException;
+  
+  /** Get the value as a long.
+  */
+  public long longValue()
+    throws WHException;
+  
+  /** Get the value as a byte array.
+  */
+  public byte[] bytearrayValue()
+    throws WHException;
+  
+  /** Get the value as a string.
+  */
+  public String stringValue()
+    throws WHException;
+  
+  /** Get the value as a double.
+  */
+  public double doubleValue()
+    throws WHException;
+  
+  /** Get the value as a char.
+  */
+  public char charValue()
+    throws WHException;
+  
+  /** Get the value as a boolean.
+  */
+  public boolean booleanValue()
+    throws WHException;
+    
+  /** Write the value to a byte stream.
+  * It is the caller's responsibility to close the stream.
+  */
+  public void streamValue(OutputStream outputStream)
+    throws IOException,WHException;
+    
+  /** Write the value to character stream.
+  * It is the caller's responsibility to close the stream.
+  */
+  public void writerValue(Writer writer)
+    throws IOException,WHException;
+
 }

Added: incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/BaseValue.java
URL: http://svn.apache.org/viewvc/incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/BaseValue.java?rev=1228581&view=auto
==============================================================================
--- incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/BaseValue.java (added)
+++ incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/BaseValue.java Sat Jan  7 09:08:36 2012
@@ -0,0 +1,111 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.warthog.common;
+
+import org.apache.warthog.api.*;
+
+import java.io.*;
+
+/** Base WHValue class that has a lot of useful method defaults.
+*/
+public class BaseValue implements WHValue
+{
+  public BaseValue()
+  {
+  }
+
+  /** Discard this object; there's no further need for it.
+  * This MUST be called for all extended objects (e.g. binary and character).
+  */
+  public void discard()
+    throws WHException
+  {
+  }
+  
+  /** Get the value as a long.
+  */
+  public long longValue()
+    throws WHException
+  {
+    throw new WHException("Can't convert object to long value");
+  }
+  
+  /** Get the value as a byte array.
+  */
+  public byte[] bytearrayValue()
+    throws WHException
+  {
+    throw new WHException("Can't convert object to byte array value");
+  }
+  
+  /** Get the value as a string.
+  */
+  public String stringValue()
+    throws WHException
+  {
+    throw new WHException("Can't convert object to string value");
+  }
+  
+  /** Get the value as a double.
+  */
+  public double doubleValue()
+    throws WHException
+  {
+    throw new WHException("Can't convert object to double value");
+  }
+  
+  /** Get the value as a char.
+  */
+  public char charValue()
+    throws WHException
+  {
+    throw new WHException("Can't convert object to character value");
+  }
+  
+  /** Get the value as a boolean.
+  */
+  public boolean booleanValue()
+    throws WHException
+  {
+    throw new WHException("Can't convert object to boolean value");
+  }
+    
+  /** Write the value to a byte stream.
+  * It is the caller's responsibility to close the stream.
+  */
+  public void streamValue(OutputStream outputStream)
+    throws IOException,WHException
+  {
+    throw new WHException("Can't write object as binary stream");
+  }
+    
+  /** Write the value to character stream.
+  * It is the caller's responsibility to close the stream.
+  */
+  public void writerValue(Writer writer)
+    throws IOException,WHException
+  {
+    throw new WHException("Can't write object as character stream");
+  }
+
+
+}
+
+

Propchange: incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/BaseValue.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/BaseValue.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/BooleanValue.java
URL: http://svn.apache.org/viewvc/incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/BooleanValue.java?rev=1228581&r1=1228580&r2=1228581&view=diff
==============================================================================
--- incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/BooleanValue.java (original)
+++ incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/BooleanValue.java Sat Jan  7 09:08:36 2012
@@ -24,7 +24,7 @@ import org.apache.warthog.transactionalk
 
 /** Boolean value, serializable.
 */
-public class BooleanValue implements WHValue,WHKeyValue
+public class BooleanValue extends BaseValue implements WHKeyValue
 {
   boolean value;
   
@@ -50,6 +50,14 @@ public class BooleanValue implements WHV
     return value;
   }
 
+  /** Get the value as a boolean.
+  */
+  public boolean booleanValue()
+    throws WHException
+  {
+    return value;
+  }
+
   public boolean isEquals(WHKeyValue value)
   {
     return this.value == ((BooleanValue)value).value;

Added: incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/BytearrayValue.java
URL: http://svn.apache.org/viewvc/incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/BytearrayValue.java?rev=1228581&view=auto
==============================================================================
--- incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/BytearrayValue.java (added)
+++ incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/BytearrayValue.java Sat Jan  7 09:08:36 2012
@@ -0,0 +1,93 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.warthog.common;
+
+import org.apache.warthog.api.*;
+import org.apache.warthog.transactionalkeyvaluestore.*;
+
+/** This object represents a binary array that can be stored in the key/value store.
+*/
+public class BytearrayValue extends BaseValue implements WHKeyValue
+{
+  protected byte[] value;
+  
+  public BytearrayValue(byte[] bytes)
+  {
+    value = bytes;
+  }
+  
+  public byte[] getValue()
+  {
+    return value;
+  }
+
+  /** Get the value as a byte array.
+  */
+  public byte[] bytearrayValue()
+    throws WHException
+  {
+    return value;
+  }
+
+  public byte[] serializeObject()
+  {
+    return value;
+  }
+
+  /** Check if equals (classes must already agree) */
+  public boolean isEquals(WHKeyValue value)
+  {
+    BytearrayValue thisValue = (BytearrayValue)value;
+    if (thisValue.value.length != this.value.length)
+      return false;
+    for (int i = 0 ; i < this.value.length ; i++)
+    {
+      if (thisValue.value[i] != this.value[i])
+        return false;
+    }
+    return true;
+  }
+  
+  public int hashCode()
+  {
+    int rval = 0;
+    for (int i = 0 ; i < value.length ; i++)
+    {
+      rval += ((int)value[i]) << 5 ^ ((int)value[i]) >> 3;
+    }
+    return rval;
+  }
+  
+  public boolean equals(Object o)
+  {
+    if (this.getClass() != o.getClass())
+      return false;
+    BytearrayValue thisValue = (BytearrayValue)o;
+    if (thisValue.value.length != this.value.length)
+      return false;
+    for (int i = 0 ; i < this.value.length ; i++)
+    {
+      if (thisValue.value[i] != this.value[i])
+        return false;
+    }
+    return true;
+  }
+
+}
\ No newline at end of file

Propchange: incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/BytearrayValue.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/BytearrayValue.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/CharacterArray.java
URL: http://svn.apache.org/viewvc/incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/CharacterArray.java?rev=1228581&r1=1228580&r2=1228581&view=diff
==============================================================================
--- incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/CharacterArray.java (original)
+++ incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/CharacterArray.java Sat Jan  7 09:08:36 2012
@@ -24,7 +24,7 @@ import org.apache.warthog.transactionalk
 
 /** Character array, serializable.
 */
-public class CharacterArray implements WHValue,WHKeyValue
+public class CharacterArray extends BaseValue implements WHKeyValue
 {
   char[] value;
   
@@ -54,6 +54,14 @@ public class CharacterArray implements W
     return value;
   }
 
+  /** Get the value as a string.
+  */
+  public String stringValue()
+    throws WHException
+  {
+    return new String(value);
+  }
+
   /** Check if equals (classes must already agree) */
   public boolean isEquals(WHKeyValue value)
   {

Modified: incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/CharacterValue.java
URL: http://svn.apache.org/viewvc/incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/CharacterValue.java?rev=1228581&r1=1228580&r2=1228581&view=diff
==============================================================================
--- incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/CharacterValue.java (original)
+++ incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/CharacterValue.java Sat Jan  7 09:08:36 2012
@@ -24,7 +24,7 @@ import org.apache.warthog.transactionalk
 
 /** Character value, serializable.
 */
-public class CharacterValue implements WHValue,WHKeyValue
+public class CharacterValue extends BaseValue implements WHKeyValue
 {
   char value;
   
@@ -56,6 +56,22 @@ public class CharacterValue implements W
     return value;
   }
   
+  /** Get the value as a char.
+  */
+  public char charValue()
+    throws WHException
+  {
+    return value;
+  }
+
+  /** Get the value as a string.
+  */
+  public String stringValue()
+    throws WHException
+  {
+    return new StringBuilder(value).toString();
+  }
+
   public int hashCode()
   {
     return (((int)value) << 5) ^ (((int)value) >> 3);

Added: incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/DoubleValue.java
URL: http://svn.apache.org/viewvc/incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/DoubleValue.java?rev=1228581&view=auto
==============================================================================
--- incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/DoubleValue.java (added)
+++ incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/DoubleValue.java Sat Jan  7 09:08:36 2012
@@ -0,0 +1,108 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.warthog.common;
+
+import org.apache.warthog.api.*;
+import org.apache.warthog.transactionalkeyvaluestore.*;
+
+/** Double value, serializable.
+*/
+public class DoubleValue extends BaseValue implements WHKeyValue
+{
+  double value;
+  
+  public DoubleValue(double value)
+  {
+    this.value = value;
+  }
+  
+  public DoubleValue(byte[] bytes)
+  {
+    value = readObject(new BufferPointer(bytes));
+  }
+  
+  public byte[] serializeObject()
+  {
+    byte[] rval = new byte[sizeObject()];
+    writeObject(new BufferPointer(rval),value);
+    return rval;
+  }
+  
+  /** Check if equals (classes must already agree) */
+  public boolean isEquals(WHKeyValue value)
+  {
+    return this.value == ((DoubleValue)value).value;
+  }
+
+  public double getValue()
+  {
+    return value;
+  }
+  
+  /** Get the value as a string.
+  */
+  public String stringValue()
+    throws WHException
+  {
+    return new Double(value).toString();
+  }
+
+  /** Get the value as a double.
+  */
+  public double doubleValue()
+    throws WHException
+  {
+    return value;
+  }
+
+  public int hashCode()
+  {
+    return new Double(value).hashCode();
+  }
+  
+  public boolean equals(Object o)
+  {
+    if (this.getClass() != o.getClass())
+      return false;
+    return ((DoubleValue)o).value == value;
+  }
+
+  public static int sizeObject()
+  {
+    // No idea
+    // MHL
+    return 0;
+  }
+  
+  public static double readObject(BufferPointer bp)
+  {
+    // No idea how to do this...
+    // MHL
+    return 0.0;
+  }
+  
+  public static void writeObject(BufferPointer bp, double value)
+  {
+    // No idea how to do this...
+    // MHL
+  }
+}
+
+

Propchange: incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/DoubleValue.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/DoubleValue.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/IntegerValue.java
URL: http://svn.apache.org/viewvc/incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/IntegerValue.java?rev=1228581&r1=1228580&r2=1228581&view=diff
==============================================================================
--- incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/IntegerValue.java (original)
+++ incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/IntegerValue.java Sat Jan  7 09:08:36 2012
@@ -24,7 +24,7 @@ import org.apache.warthog.transactionalk
 
 /** Integer value, serializable.
 */
-public class IntegerValue implements WHValue,WHKeyValue
+public class IntegerValue extends BaseValue implements WHKeyValue
 {
   int value;
   
@@ -56,7 +56,31 @@ public class IntegerValue implements WHV
   {
     return value;
   }
+
+  /** Get the value as a long.
+  */
+  public long longValue()
+    throws WHException
+  {
+    return (long)value;
+  }
+
+  /** Get the value as a string.
+  */
+  public String stringValue()
+    throws WHException
+  {
+    return Integer.toString(value);
+  }
   
+  /** Get the value as a double.
+  */
+  public double doubleValue()
+    throws WHException
+  {
+    return new Double(value).doubleValue();
+  }
+
   public int hashCode()
   {
     return (value << 5) ^ (value >> 3);

Modified: incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/LongValue.java
URL: http://svn.apache.org/viewvc/incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/LongValue.java?rev=1228581&r1=1228580&r2=1228581&view=diff
==============================================================================
--- incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/LongValue.java (original)
+++ incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/LongValue.java Sat Jan  7 09:08:36 2012
@@ -24,7 +24,7 @@ import org.apache.warthog.transactionalk
 
 /** Long value, serializable.
 */
-public class LongValue implements WHValue,WHKeyValue,WHRowID
+public class LongValue extends BaseValue implements WHKeyValue,WHRowID
 {
   long value;
   
@@ -51,7 +51,31 @@ public class LongValue implements WHValu
     LongValue k = (LongValue)value;
     return k.value == this.value;
   }
+
+  /** Get the value as a long.
+  */
+  public long longValue()
+    throws WHException
+  {
+    return value;
+  }
   
+  /** Get the value as a string.
+  */
+  public String stringValue()
+    throws WHException
+  {
+    return new Long(value).toString();
+  }
+
+  /** Get the value as a double.
+  */
+  public double doubleValue()
+    throws WHException
+  {
+    return new Double(value).doubleValue();
+  }
+
   public long getValue()
   {
     return value;

Modified: incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/StringArray.java
URL: http://svn.apache.org/viewvc/incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/StringArray.java?rev=1228581&r1=1228580&r2=1228581&view=diff
==============================================================================
--- incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/StringArray.java (original)
+++ incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/StringArray.java Sat Jan  7 09:08:36 2012
@@ -24,7 +24,7 @@ import org.apache.warthog.transactionalk
 
 /** String array, serializable.
 */
-public class StringArray implements WHValue,WHKeyValue
+public class StringArray extends BaseValue implements WHKeyValue
 {
   String[] value;
   

Modified: incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/StringValue.java
URL: http://svn.apache.org/viewvc/incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/StringValue.java?rev=1228581&r1=1228580&r2=1228581&view=diff
==============================================================================
--- incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/StringValue.java (original)
+++ incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/common/StringValue.java Sat Jan  7 09:08:36 2012
@@ -24,7 +24,7 @@ import org.apache.warthog.transactionalk
 
 /** This object represents a string that can be stored in the key/value store.
 */
-public class StringValue implements WHValue,WHKeyValue
+public class StringValue extends BaseValue implements WHKeyValue
 {
   protected String value;
   
@@ -43,6 +43,32 @@ public class StringValue implements WHVa
     return value;
   }
 
+  /** Get the value as a long.
+  */
+  public long longValue()
+    throws WHException
+  {
+    // May want to throw exception if conversion not possible
+    return new Long(value).longValue();
+  }
+
+  /** Get the value as a string.
+  */
+  public String stringValue()
+    throws WHException
+  {
+    return value;
+  }
+
+  /** Get the value as a double.
+  */
+  public double doubleValue()
+    throws WHException
+  {
+    // May want to throw exception if conversion not possible
+    return new Double(value).doubleValue();
+  }
+
   public byte[] serializeObject()
   {
     byte[] rval = new byte[sizeObject(value)];

Modified: incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/keyvaluetablestore/TableStore.java
URL: http://svn.apache.org/viewvc/incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/keyvaluetablestore/TableStore.java?rev=1228581&r1=1228580&r2=1228581&view=diff
==============================================================================
--- incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/keyvaluetablestore/TableStore.java (original)
+++ incubator/lcf/warthog/trunk/src/main/java/org/apache/warthog/keyvaluetablestore/TableStore.java Sat Jan  7 09:08:36 2012
@@ -23,6 +23,7 @@ import org.apache.warthog.api.*;
 import org.apache.warthog.transactionalkeyvaluestore.*;
 import org.apache.warthog.common.*;
 import java.util.*;
+import java.io.*;
 
 /** This is the standard implementation of WHTableStore.
 */
@@ -199,6 +200,78 @@ public class TableStore implements WHTab
     deleteIndex(i);
   }
   
+  // Values can be constructed here, of several standard types.  Warthog is not limited to
+  // these types, but if you wander outside of them you give up the portability of the API
+  // across different database types.
+  
+  /** Construct a long value.
+  */
+  public WHValue make(long value)
+    throws WHException
+  {
+    return new LongValue(value);
+  }
+
+  /** Construct a byte array value.
+  */
+  public WHValue make(byte[] value)
+    throws WHException
+  {
+    return new BytearrayValue(value);
+  }
+
+  /** Construct a string value.
+  */
+  public WHValue make(String value)
+    throws WHException
+  {
+    return new StringValue(value);
+  }
+    
+  /** Construct a double value.
+  */
+  public WHValue make(double value)
+    throws WHException
+  {
+    return new DoubleValue(value);
+  }
+    
+  /** Construct a single char.
+  */
+  public WHValue make(char value)
+    throws WHException
+  {
+    return new CharacterValue(value);
+  }
+
+  /** Construct a boolean value.
+  */
+  public WHValue make(boolean value)
+    throws WHException
+  {
+    return new BooleanValue(value);
+  }
+  
+  /** Construct an extended binary object.  (It is the caller's responsibility to close
+  * the stream).
+  */
+  public WHValue make(InputStream inputStream)
+    throws IOException,WHException
+  {
+    throw new WHException("Not yet implemented.");
+    //return new ExtendedBinaryValue(inputStream);
+  }
+  
+  /** Construct an extended text object.  (It is the caller's responsibility to close
+  * the reader).
+  */
+  public WHValue make(Reader reader)
+    throws IOException,WHException
+  {
+    throw new WHException("Not yet implemented.");
+    //return new ExtendedTextValue(reader);
+  }
+
   // Non-interface public methods
   
   protected Map<LongValue,LongValue> startMap = new HashMap<LongValue,LongValue>();

Modified: incubator/lcf/warthog/trunk/src/test/java/org/apache/warthog/tests/MultiThreadTest.java
URL: http://svn.apache.org/viewvc/incubator/lcf/warthog/trunk/src/test/java/org/apache/warthog/tests/MultiThreadTest.java?rev=1228581&r1=1228580&r2=1228581&view=diff
==============================================================================
--- incubator/lcf/warthog/trunk/src/test/java/org/apache/warthog/tests/MultiThreadTest.java (original)
+++ incubator/lcf/warthog/trunk/src/test/java/org/apache/warthog/tests/MultiThreadTest.java Sat Jan  7 09:08:36 2012
@@ -320,11 +320,11 @@ public class MultiThreadTest
             WHTable table = ts.lookupTable("testtable");
             table.insertRow(new String[]{"colA","colB","colC","colD","colE","colF","colG","colH","colI","colJ"},
               new WHValue[]{
-                new LongValue(randomLong(r)),new StringValue(randomString(r)),
-                new LongValue(randomLong(r)),new StringValue(randomString(r)),
-                new LongValue(randomLong(r)),new StringValue(randomString(r)),
-                new LongValue(randomLong(r)),new StringValue(randomString(r)),
-                new LongValue(randomLong(r)),new StringValue(randomString(r))});
+                ts.make(randomLong(r)),ts.make(randomString(r)),
+                ts.make(randomLong(r)),ts.make(randomString(r)),
+                ts.make(randomLong(r)),ts.make(randomString(r)),
+                ts.make(randomLong(r)),ts.make(randomString(r)),
+                ts.make(randomLong(r)),ts.make(randomString(r))});
             ts.commitTransaction();
             break;
           }
@@ -405,11 +405,11 @@ public class MultiThreadTest
             WHTable table = ts.lookupTable("testtable");
             table.insertRow(new String[]{"colA","colB","colC","colD","colE","colF","colG","colH","colI","colJ"},
               new WHValue[]{
-                new LongValue(randomLong(r)),new StringValue(randomString(r)),
-                new LongValue(randomLong(r)),new StringValue(randomString(r)),
-                new LongValue(randomLong(r)),new StringValue(randomString(r)),
-                new LongValue(randomLong(r)),new StringValue(randomString(r)),
-                new LongValue(randomLong(r)),new StringValue(randomString(r))});
+                ts.make(randomLong(r)),ts.make(randomString(r)),
+                ts.make(randomLong(r)),ts.make(randomString(r)),
+                ts.make(randomLong(r)),ts.make(randomString(r)),
+                ts.make(randomLong(r)),ts.make(randomString(r)),
+                ts.make(randomLong(r)),ts.make(randomString(r))});
             ts.commitTransaction();
             break;
           }
@@ -432,7 +432,7 @@ public class MultiThreadTest
           {
             WHIndex index = ts.lookupIndex("testindex1");
             WHAccessor accessor = index.buildAccessor(new IndexCriteria[]{
-              new IndexBetween(new StringValue("1"),new StringValue("2")),
+              new IndexBetween(ts.make("1"),ts.make("2")),
               null},null);
             while (true)
             {
@@ -462,7 +462,7 @@ public class MultiThreadTest
           {
             WHIndex index = ts.lookupIndex("testindex2");
             WHAccessor accessor = index.buildAccessor(new IndexCriteria[]{
-              new IndexBetween(new StringValue("23"),new StringValue("25")),
+              new IndexBetween(ts.make("23"),ts.make("25")),
               null},null);
             while (true)
             {
@@ -492,7 +492,7 @@ public class MultiThreadTest
           {
             WHIndex index = ts.lookupIndex("testindex3");
             WHAccessor accessor = index.buildAccessor(new IndexCriteria[]{
-              new IndexBetween(new StringValue("02"),new StringValue("04")),
+              new IndexBetween(ts.make("02"),ts.make("04")),
               null},null);
             while (true)
             {

Modified: incubator/lcf/warthog/trunk/src/test/java/org/apache/warthog/tests/PerformanceTest.java
URL: http://svn.apache.org/viewvc/incubator/lcf/warthog/trunk/src/test/java/org/apache/warthog/tests/PerformanceTest.java?rev=1228581&r1=1228580&r2=1228581&view=diff
==============================================================================
--- incubator/lcf/warthog/trunk/src/test/java/org/apache/warthog/tests/PerformanceTest.java (original)
+++ incubator/lcf/warthog/trunk/src/test/java/org/apache/warthog/tests/PerformanceTest.java Sat Jan  7 09:08:36 2012
@@ -96,11 +96,11 @@ public class PerformanceTest
       table = ts.lookupTable("testtable");
       table.insertRow(new String[]{"colA","colB","colC","colD","colE","colF","colG","colH","colI","colJ"},
         new WHValue[]{
-          new LongValue(long1Values[i]),new StringValue(str1Values[i]),
-          new LongValue(long2Values[i]),new StringValue(str2Values[i]),
-          new LongValue(long3Values[i]),new StringValue(str3Values[i]),
-          new LongValue(long4Values[i]),new StringValue(str4Values[i]),
-          new LongValue(long5Values[i]),new StringValue(str5Values[i])});
+          ts.make(long1Values[i]),ts.make(str1Values[i]),
+          ts.make(long2Values[i]),ts.make(str2Values[i]),
+          ts.make(long3Values[i]),ts.make(str3Values[i]),
+          ts.make(long4Values[i]),ts.make(str4Values[i]),
+          ts.make(long5Values[i]),ts.make(str5Values[i])});
       ts.commitTransaction();
     }
     System.out.println("Create of "+Integer.toString(rowCount)+" rows took "+new Long(System.currentTimeMillis() - startTime).toString()+" ms");

Modified: incubator/lcf/warthog/trunk/src/test/java/org/apache/warthog/tests/SanityTest.java
URL: http://svn.apache.org/viewvc/incubator/lcf/warthog/trunk/src/test/java/org/apache/warthog/tests/SanityTest.java?rev=1228581&r1=1228580&r2=1228581&view=diff
==============================================================================
--- incubator/lcf/warthog/trunk/src/test/java/org/apache/warthog/tests/SanityTest.java (original)
+++ incubator/lcf/warthog/trunk/src/test/java/org/apache/warthog/tests/SanityTest.java Sat Jan  7 09:08:36 2012
@@ -42,12 +42,12 @@ public class SanityTest
     
     ts.beginTransaction(true);
     WHTable table = ts.lookupTable("testtable");
-    table.insertRow(new String[]{"colA","colC"},new WHValue[]{new LongValue(123L),new StringValue("hello")});
+    table.insertRow(new String[]{"colA","colC"},new WHValue[]{ts.make(123L),ts.make("hello")});
     ts.commitTransaction();
     
     ts.beginTransaction(true);
     table = ts.lookupTable("testtable");
-    table.insertRow(new String[]{"colA","colC","colB"},new WHValue[]{new LongValue(456L),new StringValue("goodbye"),new BooleanValue(true)});
+    table.insertRow(new String[]{"colA","colC","colB"},new WHValue[]{ts.make(456L),ts.make("goodbye"),new BooleanValue(true)});
     ts.commitTransaction();
 
     ts.beginTransaction(true);
@@ -78,7 +78,7 @@ public class SanityTest
     
     ts.beginTransaction(true);
     table = ts.lookupTable("testtable");
-    table.updateRows(new String[]{"colC"},new WHValue[]{new StringValue("abcdefg")},table.buildAccessor());
+    table.updateRows(new String[]{"colC"},new WHValue[]{ts.make("abcdefg")},table.buildAccessor());
     ts.commitTransaction();
     
     ts.beginTransaction(true);
@@ -150,7 +150,7 @@ public class SanityTest
     // Now add a row while the index is set up to see if it appears
     ts.beginTransaction(true);
     table = ts.lookupTable("testtable");
-    table.insertRow(new String[]{"colA","colB"},new WHValue[]{new LongValue(333L),new StringValue("><")});
+    table.insertRow(new String[]{"colA","colB"},new WHValue[]{ts.make(333L),ts.make("><")});
     ts.commitTransaction();
     
     // Read in index order
@@ -193,7 +193,7 @@ public class SanityTest
     // Build a bunch of accessors and see if they do what we expect
     ts.beginTransaction(true);
     index = ts.lookupIndex("testindex");
-    accessor = index.buildAccessor(new IndexCriteria[]{new IndexEquals(new LongValue(124L))},null);
+    accessor = index.buildAccessor(new IndexCriteria[]{new IndexEquals(ts.make(124L))},null);
     assertNotNull(accessor.getCurrentRowID());
     value = accessor.getValue("colA");
     assertNotNull(value);
@@ -206,7 +206,7 @@ public class SanityTest
     // Various index criteria
     ts.beginTransaction(true);
     index = ts.lookupIndex("testindex");
-    accessor = index.buildAccessor(new IndexCriteria[]{new IndexEqualsOrBefore(new LongValue(124L))},null);
+    accessor = index.buildAccessor(new IndexCriteria[]{new IndexEqualsOrBefore(ts.make(124L))},null);
     assertNotNull(accessor.getCurrentRowID());
     value = accessor.getValue("colA");
     assertNotNull(value);
@@ -230,7 +230,7 @@ public class SanityTest
 
     ts.beginTransaction(true);
     index = ts.lookupIndex("testindex");
-    accessor = index.buildAccessor(new IndexCriteria[]{new IndexEqualsOrAfter(new LongValue(124L))},null);
+    accessor = index.buildAccessor(new IndexCriteria[]{new IndexEqualsOrAfter(ts.make(124L))},null);
     assertNotNull(accessor.getCurrentRowID());
     value = accessor.getValue("colA");
     assertNotNull(value);
@@ -254,7 +254,7 @@ public class SanityTest
 
     ts.beginTransaction(true);
     index = ts.lookupIndex("testindex");
-    accessor = index.buildAccessor(new IndexCriteria[]{new IndexBefore(new LongValue(124L))},null);
+    accessor = index.buildAccessor(new IndexCriteria[]{new IndexBefore(ts.make(124L))},null);
     assertNotNull(accessor.getCurrentRowID());
     value = accessor.getValue("colA");
     assertNotNull(value);
@@ -272,7 +272,7 @@ public class SanityTest
 
     ts.beginTransaction(true);
     index = ts.lookupIndex("testindex");
-    accessor = index.buildAccessor(new IndexCriteria[]{new IndexAfter(new LongValue(124L))},null);
+    accessor = index.buildAccessor(new IndexCriteria[]{new IndexAfter(ts.make(124L))},null);
     assertNotNull(accessor.getCurrentRowID());
     value = accessor.getValue("colA");
     assertNotNull(value);
@@ -290,7 +290,7 @@ public class SanityTest
     
     ts.beginTransaction(true);
     index = ts.lookupIndex("testindex");
-    accessor = index.buildAccessor(new IndexCriteria[]{new IndexEqualsMultiple(new WHValue[]{new LongValue(123L),new LongValue(333L)})},null);
+    accessor = index.buildAccessor(new IndexCriteria[]{new IndexEqualsMultiple(new WHValue[]{ts.make(123L),ts.make(333L)})},null);
     assertNotNull(accessor.getCurrentRowID());
     value = accessor.getValue("colA");
     assertNotNull(value);
@@ -308,7 +308,7 @@ public class SanityTest
 
     ts.beginTransaction(true);
     index = ts.lookupIndex("testindex");
-    accessor = index.buildAccessor(new IndexCriteria[]{new IndexBetween(new LongValue(123L),new LongValue(333L))},null);
+    accessor = index.buildAccessor(new IndexCriteria[]{new IndexBetween(ts.make(123L),ts.make(333L))},null);
     assertNotNull(accessor.getCurrentRowID());
     value = accessor.getValue("colA");
     assertNotNull(value);
@@ -322,7 +322,7 @@ public class SanityTest
     ts.beginTransaction(true);
     table = ts.lookupTable("testtable");
     index = ts.lookupIndex("testindex");
-    table.deleteRows(index.buildAccessor(new IndexCriteria[]{new IndexEquals(new LongValue(124L))},null));
+    table.deleteRows(index.buildAccessor(new IndexCriteria[]{new IndexEquals(ts.make(124L))},null));
     ts.commitTransaction();
 
     // Go through the iterator to see if it's gone
@@ -413,8 +413,8 @@ public class SanityTest
     ts.beginTransaction(true);
     index = ts.lookupIndex("testindex");
     accessor = index.buildAccessor(new IndexCriteria[]{
-      new IndexEquals(new StringValue("hello")),
-      new IndexBefore(new LongValue(123L))},null);
+      new IndexEquals(ts.make("hello")),
+      new IndexBefore(ts.make(123L))},null);
     assertNotNull(accessor.getCurrentRowID());
     value = accessor.getValue("colA");
     assertNotNull(value);
@@ -443,22 +443,22 @@ public class SanityTest
     
     ts.beginTransaction(true);
     WHTable table = ts.lookupTable("testtable");
-    table.insertRow(new String[]{"colA","colB"},new WHValue[]{new LongValue(1L),new StringValue("hello")});
+    table.insertRow(new String[]{"colA","colB"},new WHValue[]{ts.make(1L),ts.make("hello")});
     ts.commitTransaction();
     
     ts.beginTransaction(true);
     table = ts.lookupTable("testtable");
-    table.insertRow(new String[]{"colA","colB"},new WHValue[]{new LongValue(4L),new StringValue("goodbye")});
+    table.insertRow(new String[]{"colA","colB"},new WHValue[]{ts.make(4L),ts.make("goodbye")});
     ts.commitTransaction();
 
     ts.beginTransaction(true);
     table = ts.lookupTable("testtable");
-    table.insertRow(new String[]{"colA","colB"},new WHValue[]{new LongValue(3L),new StringValue("hello")});
+    table.insertRow(new String[]{"colA","colB"},new WHValue[]{ts.make(3L),ts.make("hello")});
     ts.commitTransaction();
 
     ts.beginTransaction(true);
     table = ts.lookupTable("testtable");
-    table.insertRow(new String[]{"colA","colB"},new WHValue[]{new LongValue(2L),new StringValue("goodbye")});
+    table.insertRow(new String[]{"colA","colB"},new WHValue[]{ts.make(2L),ts.make("goodbye")});
     ts.commitTransaction();
 
     // Build an index on this table to establish ordering on ColB
@@ -591,7 +591,7 @@ public class SanityTest
     
     ts.beginTransaction(true);
     index = ts.lookupIndex("testindex");
-    filterRelationship = new FilterRelationship(index,new FilterEqualsOrBefore("colA",new LongValue(124L),
+    filterRelationship = new FilterRelationship(index,new FilterEqualsOrBefore("colA",ts.make(124L),
       new LongComparatorAscending()));
     accessor = filterRelationship.buildAccessor();
     assertNotNull(accessor.getCurrentRowID());
@@ -617,7 +617,7 @@ public class SanityTest
 
     ts.beginTransaction(true);
     index = ts.lookupIndex("testindex");
-    filterRelationship = new FilterRelationship(index,new FilterEqualsOrAfter("colA",new LongValue(124L),
+    filterRelationship = new FilterRelationship(index,new FilterEqualsOrAfter("colA",ts.make(124L),
       new LongComparatorAscending()));
     accessor = filterRelationship.buildAccessor();
     assertNotNull(accessor.getCurrentRowID());
@@ -637,7 +637,7 @@ public class SanityTest
 
     ts.beginTransaction(true);
     index = ts.lookupIndex("testindex");
-    filterRelationship = new FilterRelationship(index,new FilterBefore("colA",new LongValue(124L),
+    filterRelationship = new FilterRelationship(index,new FilterBefore("colA",ts.make(124L),
       new LongComparatorAscending()));
     accessor = filterRelationship.buildAccessor();
     assertNotNull(accessor.getCurrentRowID());
@@ -657,7 +657,7 @@ public class SanityTest
 
     ts.beginTransaction(true);
     index = ts.lookupIndex("testindex");
-    filterRelationship = new FilterRelationship(index,new FilterAfter("colA",new LongValue(124L),
+    filterRelationship = new FilterRelationship(index,new FilterAfter("colA",ts.make(124L),
       new LongComparatorAscending()));
     accessor = filterRelationship.buildAccessor();
     value = accessor.getValue("colA");
@@ -670,7 +670,7 @@ public class SanityTest
     
     ts.beginTransaction(true);
     index = ts.lookupIndex("testindex");
-    filterRelationship = new FilterRelationship(index,new FilterEqualsMultiple("colA",new WHValue[]{new LongValue(123L),new LongValue(333L)},
+    filterRelationship = new FilterRelationship(index,new FilterEqualsMultiple("colA",new WHValue[]{ts.make(123L),ts.make(333L)},
       new LongComparatorAscending()));
     accessor = filterRelationship.buildAccessor();
     assertNotNull(accessor.getCurrentRowID());
@@ -684,7 +684,7 @@ public class SanityTest
 
     ts.beginTransaction(true);
     index = ts.lookupIndex("testindex");
-    filterRelationship = new FilterRelationship(index,new FilterBetween("colA",new LongValue(123L),new LongValue(333L),
+    filterRelationship = new FilterRelationship(index,new FilterBetween("colA",ts.make(123L),ts.make(333L),
       new LongComparatorAscending()));
     accessor = filterRelationship.buildAccessor();
     assertNotNull(accessor.getCurrentRowID());
@@ -711,22 +711,22 @@ public class SanityTest
     
     ts.beginTransaction(true);
     WHTable table = ts.lookupTable("testtable1");
-    table.insertRow(new String[]{"colC"},new WHValue[]{new LongValue(123L)});
+    table.insertRow(new String[]{"colC"},new WHValue[]{ts.make(123L)});
     ts.commitTransaction();
     
     ts.beginTransaction(true);
     table = ts.lookupTable("testtable1");
-    table.insertRow(new String[]{"colC"},new WHValue[]{new LongValue(456L)});
+    table.insertRow(new String[]{"colC"},new WHValue[]{ts.make(456L)});
     ts.commitTransaction();
 
     ts.beginTransaction(true);
     table = ts.lookupTable("testtable1");
-    table.insertRow(new String[]{"colC"},new WHValue[]{new LongValue(124L)});
+    table.insertRow(new String[]{"colC"},new WHValue[]{ts.make(124L)});
     ts.commitTransaction();
 
     ts.beginTransaction(true);
     table = ts.lookupTable("testtable1");
-    table.insertRow(new String[]{"colC"},new WHValue[]{new LongValue(111L)});
+    table.insertRow(new String[]{"colC"},new WHValue[]{ts.make(111L)});
     ts.commitTransaction();
 
     ts.beginTransaction(true);
@@ -735,27 +735,27 @@ public class SanityTest
     
     ts.beginTransaction(true);
     table = ts.lookupTable("testtable2");
-    table.insertRow(new String[]{"colA","colB"},new WHValue[]{new LongValue(123L),new StringValue("hello")});
+    table.insertRow(new String[]{"colA","colB"},new WHValue[]{ts.make(123L),ts.make("hello")});
     ts.commitTransaction();
 
     ts.beginTransaction(true);
     table = ts.lookupTable("testtable2");
-    table.insertRow(new String[]{"colA","colB"},new WHValue[]{new LongValue(123L),new StringValue("world")});
+    table.insertRow(new String[]{"colA","colB"},new WHValue[]{ts.make(123L),ts.make("world")});
     ts.commitTransaction();
     
     ts.beginTransaction(true);
     table = ts.lookupTable("testtable2");
-    table.insertRow(new String[]{"colA","colB"},new WHValue[]{new LongValue(456L),new StringValue("goodbye")});
+    table.insertRow(new String[]{"colA","colB"},new WHValue[]{ts.make(456L),ts.make("goodbye")});
     ts.commitTransaction();
 
     ts.beginTransaction(true);
     table = ts.lookupTable("testtable2");
-    table.insertRow(new String[]{"colA","colB"},new WHValue[]{new LongValue(456L),new StringValue("world")});
+    table.insertRow(new String[]{"colA","colB"},new WHValue[]{ts.make(456L),ts.make("world")});
     ts.commitTransaction();
 
     ts.beginTransaction(true);
     table = ts.lookupTable("testtable2");
-    table.insertRow(new String[]{"colA","colB"},new WHValue[]{new LongValue(124L),new StringValue("...")});
+    table.insertRow(new String[]{"colA","colB"},new WHValue[]{ts.make(124L),ts.make("...")});
     ts.commitTransaction();
 
     // Build indexes on both of these so we establish order for the test
@@ -869,22 +869,22 @@ public class SanityTest
     
     ts.beginTransaction(true);
     WHTable table = ts.lookupTable("testtable");
-    table.insertRow(new String[]{"colA","colB"},new WHValue[]{new LongValue(123L),new StringValue("hello")});
+    table.insertRow(new String[]{"colA","colB"},new WHValue[]{ts.make(123L),ts.make("hello")});
     ts.commitTransaction();
     
     ts.beginTransaction(true);
     table = ts.lookupTable("testtable");
-    table.insertRow(new String[]{"colA","colB"},new WHValue[]{new LongValue(456L),new StringValue("goodbye")});
+    table.insertRow(new String[]{"colA","colB"},new WHValue[]{ts.make(456L),ts.make("goodbye")});
     ts.commitTransaction();
 
     ts.beginTransaction(true);
     table = ts.lookupTable("testtable");
-    table.insertRow(new String[]{"colA","colB"},new WHValue[]{new LongValue(124L),new StringValue("...")});
+    table.insertRow(new String[]{"colA","colB"},new WHValue[]{ts.make(124L),ts.make("...")});
     ts.commitTransaction();
 
     ts.beginTransaction(true);
     table = ts.lookupTable("testtable");
-    table.insertRow(new String[]{"colA","colB"},new WHValue[]{new LongValue(111L),new StringValue("<>")});
+    table.insertRow(new String[]{"colA","colB"},new WHValue[]{ts.make(111L),ts.make("<>")});
     ts.commitTransaction();
   }
 
@@ -897,22 +897,22 @@ public class SanityTest
     
     ts.beginTransaction(true);
     WHTable table = ts.lookupTable("testtable");
-    table.insertRow(new String[]{"colA","colB"},new WHValue[]{new LongValue(123L),new StringValue("hello")});
+    table.insertRow(new String[]{"colA","colB"},new WHValue[]{ts.make(123L),ts.make("hello")});
     ts.commitTransaction();
     
     ts.beginTransaction(true);
     table = ts.lookupTable("testtable");
-    table.insertRow(new String[]{"colA","colB"},new WHValue[]{new LongValue(456L),new StringValue("goodbye")});
+    table.insertRow(new String[]{"colA","colB"},new WHValue[]{ts.make(456L),ts.make("goodbye")});
     ts.commitTransaction();
 
     ts.beginTransaction(true);
     table = ts.lookupTable("testtable");
-    table.insertRow(new String[]{"colA","colB"},new WHValue[]{new LongValue(124L),new StringValue("...")});
+    table.insertRow(new String[]{"colA","colB"},new WHValue[]{ts.make(124L),ts.make("...")});
     ts.commitTransaction();
 
     ts.beginTransaction(true);
     table = ts.lookupTable("testtable");
-    table.insertRow(new String[]{"colA","colB"},new WHValue[]{new LongValue(111L),new StringValue("hello")});
+    table.insertRow(new String[]{"colA","colB"},new WHValue[]{ts.make(111L),ts.make("hello")});
     ts.commitTransaction();
   }
 



Mime
View raw message