You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2011/12/18 09:36:56 UTC

svn commit: r1220353 [9/11] - in /incubator/lcf/branches/CONNECTORS-286/warthog-reimport: ./ src/main/java/org/apache/warthog/api/ src/main/java/org/apache/warthog/bytekeyvalue/ src/main/java/org/apache/warthog/common/ src/main/java/org/apache/warthog/...

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/main/java/org/apache/warthog/transactionalkeyvaluestore/WHTransaction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/main/java/org/apache/warthog/transactionalkeyvaluestore/WHTransaction.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/main/java/org/apache/warthog/transactionalkeyvaluestore/WHTransactionalStore.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/main/java/org/apache/warthog/transactionalkeyvaluestore/WHTransactionalStore.java?rev=1220353&r1=1220352&r2=1220353&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/main/java/org/apache/warthog/transactionalkeyvaluestore/WHTransactionalStore.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/main/java/org/apache/warthog/transactionalkeyvaluestore/WHTransactionalStore.java Sun Dec 18 08:36:52 2011
@@ -1,32 +1,32 @@
-/* $Id: WHTransactionalStore.java 1199794 2011-11-09 15:28:08Z kwright $ */
-
-/**
-* 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.transactionalkeyvaluestore;
-
-import org.apache.warthog.api.*;
-
-/** Interface describing a transactional key/value store.
-*/
-public interface WHTransactionalStore
-{
-  /** Begin a transaction. */
-  public WHTransaction createTransaction()
-    throws WHException;
-  
-}
+/* $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.transactionalkeyvaluestore;
+
+import org.apache.warthog.api.*;
+
+/** Interface describing a transactional key/value store.
+*/
+public interface WHTransactionalStore
+{
+  /** Begin a transaction. */
+  public WHTransaction createTransaction()
+    throws WHException;
+  
+}

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/main/java/org/apache/warthog/transactionalkeyvaluestore/WHTransactionalStore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/main/java/org/apache/warthog/transactionalkeyvaluestore/WHTransactionalStore.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemAtomicByteKeyValueStore.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemAtomicByteKeyValueStore.java?rev=1220353&r1=1220352&r2=1220353&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemAtomicByteKeyValueStore.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemAtomicByteKeyValueStore.java Sun Dec 18 08:36:52 2011
@@ -1,110 +1,110 @@
-/* $Id: InMemAtomicByteKeyValueStore.java 1206939 2011-11-28 00:37:54Z kwright $ */
-
-/**
-* 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.tests;
-
-import org.apache.warthog.api.*;
-import org.apache.warthog.bytekeyvalue.*;
-import java.util.*;
-
-/** In-memory key value store, for testing.
-*/
-public class InMemAtomicByteKeyValueStore implements WHAtomicByteKeyValueStore
-{
-  protected Map<WrappedByteKey,byte[]> database;
-  
-  /** Constructor */
-  public InMemAtomicByteKeyValueStore(int initialSize)
-  {
-    database = new HashMap<WrappedByteKey,byte[]>(initialSize);
-  }
-  
-  /** Get a value */
-  public byte[] get(byte[] key)
-    throws WHException
-  {
-    synchronized (database)
-    {
-      return database.get(new WrappedByteKey(key));
-    }
-  }
-  
-  /** Check a bunch of values atomically for consistency.
-  *@param checkValues is a map of keys/values that must be unchanged.  If any value is
-  * changed, a WHDeadlockException is thrown.
-  */
-  public void check(WHByteKeyMap checkValues)
-    throws WHException
-  {
-    synchronized (database)
-    {
-      WHByteKeyIterator iterator = checkValues.iterator();
-      while (iterator.hasNext())
-      {
-        byte[] key = iterator.next();
-        WrappedByteKey wrappedKey = new WrappedByteKey(key);
-        byte[] value = database.get(wrappedKey);
-        byte[] otherValue = checkValues.get(key);
-	if (value == null && otherValue == null)
-          continue;
-        if (value != null && otherValue != null)
-        {
-          if (value.length != otherValue.length)
-            throw new WHConcurrencyException();
-          for (int i = 0 ; i < value.length ; i++)
-          {
-            if (value[i] != otherValue[i])
-              throw new WHConcurrencyException();
-          }
-          continue;
-        }
-        //System.out.println("Type of key in contention = "+key.getClass().getName());
-        throw new WHConcurrencyException();
-      }
-    }
-  }
-  
-  /** Set a bunch of values atomically.
-  *@param checkValues is a map of keys/values that must be unchanged in order for the
-  * commit to proceed.  If these values are detected to have been changed, a WHDeadlockException
-  * will be thrown.  Null values are permitted.
-  *@param setValues is a map of keys to set to specified new values.  A null value implies removal of
-  * the key.
-  */
-  public void setAll(WHByteKeyMap checkValues, WHByteKeyMap setValues)
-    throws WHException
-  {
-    synchronized (database)
-    {
-      check(checkValues);
-      WHByteKeyIterator iterator = setValues.iterator();
-      while (iterator.hasNext())
-      {
-        byte[] key = iterator.next();
-        WrappedByteKey wrappedKey = new WrappedByteKey(key);
-        byte[] value = setValues.get(key);
-        if (value == null)
-          database.remove(wrappedKey);
-        else
-          database.put(wrappedKey,value);
-      }
-    }
-  }
-  
-}
+/* $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.tests;
+
+import org.apache.warthog.api.*;
+import org.apache.warthog.bytekeyvalue.*;
+import java.util.*;
+
+/** In-memory key value store, for testing.
+*/
+public class InMemAtomicByteKeyValueStore implements WHAtomicByteKeyValueStore
+{
+  protected Map<WrappedByteKey,byte[]> database;
+  
+  /** Constructor */
+  public InMemAtomicByteKeyValueStore(int initialSize)
+  {
+    database = new HashMap<WrappedByteKey,byte[]>(initialSize);
+  }
+  
+  /** Get a value */
+  public byte[] get(byte[] key)
+    throws WHException
+  {
+    synchronized (database)
+    {
+      return database.get(new WrappedByteKey(key));
+    }
+  }
+  
+  /** Check a bunch of values atomically for consistency.
+  *@param checkValues is a map of keys/values that must be unchanged.  If any value is
+  * changed, a WHDeadlockException is thrown.
+  */
+  public void check(WHByteKeyMap checkValues)
+    throws WHException
+  {
+    synchronized (database)
+    {
+      WHByteKeyIterator iterator = checkValues.iterator();
+      while (iterator.hasNext())
+      {
+        byte[] key = iterator.next();
+        WrappedByteKey wrappedKey = new WrappedByteKey(key);
+        byte[] value = database.get(wrappedKey);
+        byte[] otherValue = checkValues.get(key);
+	if (value == null && otherValue == null)
+          continue;
+        if (value != null && otherValue != null)
+        {
+          if (value.length != otherValue.length)
+            throw new WHConcurrencyException();
+          for (int i = 0 ; i < value.length ; i++)
+          {
+            if (value[i] != otherValue[i])
+              throw new WHConcurrencyException();
+          }
+          continue;
+        }
+        //System.out.println("Type of key in contention = "+key.getClass().getName());
+        throw new WHConcurrencyException();
+      }
+    }
+  }
+  
+  /** Set a bunch of values atomically.
+  *@param checkValues is a map of keys/values that must be unchanged in order for the
+  * commit to proceed.  If these values are detected to have been changed, a WHDeadlockException
+  * will be thrown.  Null values are permitted.
+  *@param setValues is a map of keys to set to specified new values.  A null value implies removal of
+  * the key.
+  */
+  public void setAll(WHByteKeyMap checkValues, WHByteKeyMap setValues)
+    throws WHException
+  {
+    synchronized (database)
+    {
+      check(checkValues);
+      WHByteKeyIterator iterator = setValues.iterator();
+      while (iterator.hasNext())
+      {
+        byte[] key = iterator.next();
+        WrappedByteKey wrappedKey = new WrappedByteKey(key);
+        byte[] value = setValues.get(key);
+        if (value == null)
+          database.remove(wrappedKey);
+        else
+          database.put(wrappedKey,value);
+      }
+    }
+  }
+  
+}

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemAtomicByteKeyValueStore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemAtomicByteKeyValueStore.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemAtomicKeyValueStore.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemAtomicKeyValueStore.java?rev=1220353&r1=1220352&r2=1220353&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemAtomicKeyValueStore.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemAtomicKeyValueStore.java Sun Dec 18 08:36:52 2011
@@ -1,102 +1,102 @@
-/* $Id: InMemAtomicKeyValueStore.java 1206939 2011-11-28 00:37:54Z kwright $ */
-
-/**
-* 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.tests;
-
-import org.apache.warthog.api.*;
-import org.apache.warthog.keyvalue.*;
-import org.apache.warthog.transactionalkeyvaluestore.*;
-import java.util.*;
-
-/** In-memory key value store, for testing.
-*/
-public class InMemAtomicKeyValueStore implements WHAtomicKeyValueStore
-{
-  protected Map<WrappedKey,WHKeyValue> database;
-  
-  /** Constructor */
-  public InMemAtomicKeyValueStore(int initialSize)
-  {
-    database = new HashMap<WrappedKey,WHKeyValue>(initialSize);
-  }
-  
-  /** Get a value */
-  public WHKeyValue get(WHKey key)
-    throws WHException
-  {
-    synchronized (database)
-    {
-      return database.get(new WrappedKey(key));
-    }
-  }
-  
-  /** Check a bunch of values atomically for consistency.
-  *@param checkValues is a map of keys/values that must be unchanged.  If any value is
-  * changed, a WHDeadlockException is thrown.
-  */
-  public void check(WHKeyMap checkValues)
-    throws WHException
-  {
-    synchronized (database)
-    {
-      WHKeyIterator iterator = checkValues.iterator();
-      while (iterator.hasNext())
-      {
-        WHKey key = iterator.next();
-        WrappedKey wrappedKey = new WrappedKey(key);
-        WHKeyValue value = database.get(wrappedKey);
-        WHKeyValue otherValue = checkValues.get(key);
-	if (value == null && otherValue == null)
-          continue;
-        if (value != null && otherValue != null && value.isEquals(otherValue))
-          continue;
-        //System.out.println("Type of key in contention = "+key.getClass().getName());
-        throw new WHConcurrencyException();
-      }
-    }
-  }
-  
-  /** Set a bunch of values atomically.
-  *@param checkValues is a map of keys/values that must be unchanged in order for the
-  * commit to proceed.  If these values are detected to have been changed, a WHDeadlockException
-  * will be thrown.  Null values are permitted.
-  *@param setValues is a map of keys to set to specified new values.  A null value implies removal of
-  * the key.
-  */
-  public void setAll(WHKeyMap checkValues, WHKeyMap setValues)
-    throws WHException
-  {
-    synchronized (database)
-    {
-      check(checkValues);
-      WHKeyIterator iterator = setValues.iterator();
-      while (iterator.hasNext())
-      {
-        WHKey key = iterator.next();
-        WrappedKey wrappedKey = new WrappedKey(key);
-        WHKeyValue value = setValues.get(key);
-        if (value == null)
-          database.remove(wrappedKey);
-        else
-          database.put(wrappedKey,value);
-      }
-    }
-  }
-  
-}
+/* $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.tests;
+
+import org.apache.warthog.api.*;
+import org.apache.warthog.keyvalue.*;
+import org.apache.warthog.transactionalkeyvaluestore.*;
+import java.util.*;
+
+/** In-memory key value store, for testing.
+*/
+public class InMemAtomicKeyValueStore implements WHAtomicKeyValueStore
+{
+  protected Map<WrappedKey,WHKeyValue> database;
+  
+  /** Constructor */
+  public InMemAtomicKeyValueStore(int initialSize)
+  {
+    database = new HashMap<WrappedKey,WHKeyValue>(initialSize);
+  }
+  
+  /** Get a value */
+  public WHKeyValue get(WHKey key)
+    throws WHException
+  {
+    synchronized (database)
+    {
+      return database.get(new WrappedKey(key));
+    }
+  }
+  
+  /** Check a bunch of values atomically for consistency.
+  *@param checkValues is a map of keys/values that must be unchanged.  If any value is
+  * changed, a WHDeadlockException is thrown.
+  */
+  public void check(WHKeyMap checkValues)
+    throws WHException
+  {
+    synchronized (database)
+    {
+      WHKeyIterator iterator = checkValues.iterator();
+      while (iterator.hasNext())
+      {
+        WHKey key = iterator.next();
+        WrappedKey wrappedKey = new WrappedKey(key);
+        WHKeyValue value = database.get(wrappedKey);
+        WHKeyValue otherValue = checkValues.get(key);
+	if (value == null && otherValue == null)
+          continue;
+        if (value != null && otherValue != null && value.isEquals(otherValue))
+          continue;
+        //System.out.println("Type of key in contention = "+key.getClass().getName());
+        throw new WHConcurrencyException();
+      }
+    }
+  }
+  
+  /** Set a bunch of values atomically.
+  *@param checkValues is a map of keys/values that must be unchanged in order for the
+  * commit to proceed.  If these values are detected to have been changed, a WHDeadlockException
+  * will be thrown.  Null values are permitted.
+  *@param setValues is a map of keys to set to specified new values.  A null value implies removal of
+  * the key.
+  */
+  public void setAll(WHKeyMap checkValues, WHKeyMap setValues)
+    throws WHException
+  {
+    synchronized (database)
+    {
+      check(checkValues);
+      WHKeyIterator iterator = setValues.iterator();
+      while (iterator.hasNext())
+      {
+        WHKey key = iterator.next();
+        WrappedKey wrappedKey = new WrappedKey(key);
+        WHKeyValue value = setValues.get(key);
+        if (value == null)
+          database.remove(wrappedKey);
+        else
+          database.put(wrappedKey,value);
+      }
+    }
+  }
+  
+}

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemAtomicKeyValueStore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemAtomicKeyValueStore.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemAtomicNativeKeyValueStore.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemAtomicNativeKeyValueStore.java?rev=1220353&r1=1220352&r2=1220353&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemAtomicNativeKeyValueStore.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemAtomicNativeKeyValueStore.java Sun Dec 18 08:36:52 2011
@@ -1,100 +1,100 @@
-/* $Id: InMemAtomicNativeKeyValueStore.java 1208116 2011-11-29 22:36:26Z kwright $ */
-
-/**
-* 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.tests;
-
-import org.apache.warthog.api.*;
-import org.apache.warthog.keyvalue.*;
-import org.apache.warthog.transactionalkeyvaluestore.*;
-import java.util.*;
-
-/** In-memory key value store, native hash, for testing.
-*/
-public class InMemAtomicNativeKeyValueStore implements WHAtomicKeyValueStore
-{
-  protected Map<WHKey,WHKeyValue> database;
-  
-  /** Constructor */
-  public InMemAtomicNativeKeyValueStore(int initialSize)
-  {
-    database = new HashMap<WHKey,WHKeyValue>(initialSize);
-  }
-  
-  /** Get a value */
-  public WHKeyValue get(WHKey key)
-    throws WHException
-  {
-    synchronized (database)
-    {
-      return database.get(key);
-    }
-  }
-  
-  /** Check a bunch of values atomically for consistency.
-  *@param checkValues is a map of keys/values that must be unchanged.  If any value is
-  * changed, a WHDeadlockException is thrown.
-  */
-  public void check(WHKeyMap checkValues)
-    throws WHException
-  {
-    synchronized (database)
-    {
-      WHKeyIterator iterator = checkValues.iterator();
-      while (iterator.hasNext())
-      {
-        WHKey key = iterator.next();
-        WHKeyValue value = database.get(key);
-        WHKeyValue otherValue = checkValues.get(key);
-	if (value == null && otherValue == null)
-          continue;
-        if (value != null && otherValue != null && value.equals(otherValue))
-          continue;
-        //System.out.println("Type of key in contention = "+key.getClass().getName());
-        throw new WHConcurrencyException();
-      }
-    }
-  }
-  
-  /** Set a bunch of values atomically.
-  *@param checkValues is a map of keys/values that must be unchanged in order for the
-  * commit to proceed.  If these values are detected to have been changed, a WHDeadlockException
-  * will be thrown.  Null values are permitted.
-  *@param setValues is a map of keys to set to specified new values.  A null value implies removal of
-  * the key.
-  */
-  public void setAll(WHKeyMap checkValues, WHKeyMap setValues)
-    throws WHException
-  {
-    synchronized (database)
-    {
-      check(checkValues);
-      WHKeyIterator iterator = setValues.iterator();
-      while (iterator.hasNext())
-      {
-        WHKey key = iterator.next();
-        WHKeyValue value = setValues.get(key);
-        if (value == null)
-          database.remove(key);
-        else
-          database.put(key,value);
-      }
-    }
-  }
-  
-}
+/* $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.tests;
+
+import org.apache.warthog.api.*;
+import org.apache.warthog.keyvalue.*;
+import org.apache.warthog.transactionalkeyvaluestore.*;
+import java.util.*;
+
+/** In-memory key value store, native hash, for testing.
+*/
+public class InMemAtomicNativeKeyValueStore implements WHAtomicKeyValueStore
+{
+  protected Map<WHKey,WHKeyValue> database;
+  
+  /** Constructor */
+  public InMemAtomicNativeKeyValueStore(int initialSize)
+  {
+    database = new HashMap<WHKey,WHKeyValue>(initialSize);
+  }
+  
+  /** Get a value */
+  public WHKeyValue get(WHKey key)
+    throws WHException
+  {
+    synchronized (database)
+    {
+      return database.get(key);
+    }
+  }
+  
+  /** Check a bunch of values atomically for consistency.
+  *@param checkValues is a map of keys/values that must be unchanged.  If any value is
+  * changed, a WHDeadlockException is thrown.
+  */
+  public void check(WHKeyMap checkValues)
+    throws WHException
+  {
+    synchronized (database)
+    {
+      WHKeyIterator iterator = checkValues.iterator();
+      while (iterator.hasNext())
+      {
+        WHKey key = iterator.next();
+        WHKeyValue value = database.get(key);
+        WHKeyValue otherValue = checkValues.get(key);
+	if (value == null && otherValue == null)
+          continue;
+        if (value != null && otherValue != null && value.equals(otherValue))
+          continue;
+        //System.out.println("Type of key in contention = "+key.getClass().getName());
+        throw new WHConcurrencyException();
+      }
+    }
+  }
+  
+  /** Set a bunch of values atomically.
+  *@param checkValues is a map of keys/values that must be unchanged in order for the
+  * commit to proceed.  If these values are detected to have been changed, a WHDeadlockException
+  * will be thrown.  Null values are permitted.
+  *@param setValues is a map of keys to set to specified new values.  A null value implies removal of
+  * the key.
+  */
+  public void setAll(WHKeyMap checkValues, WHKeyMap setValues)
+    throws WHException
+  {
+    synchronized (database)
+    {
+      check(checkValues);
+      WHKeyIterator iterator = setValues.iterator();
+      while (iterator.hasNext())
+      {
+        WHKey key = iterator.next();
+        WHKeyValue value = setValues.get(key);
+        if (value == null)
+          database.remove(key);
+        else
+          database.put(key,value);
+      }
+    }
+  }
+  
+}

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemAtomicNativeKeyValueStore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemAtomicNativeKeyValueStore.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemAtomicNativeNonblockingKeyValueStore.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemAtomicNativeNonblockingKeyValueStore.java?rev=1220353&r1=1220352&r2=1220353&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemAtomicNativeNonblockingKeyValueStore.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemAtomicNativeNonblockingKeyValueStore.java Sun Dec 18 08:36:52 2011
@@ -1,328 +1,328 @@
-/* $Id: InMemAtomicNativeNonblockingKeyValueStore.java 1210934 2011-12-06 14:33:45Z kwright $ */
-
-/**
-* 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.tests;
-
-import org.apache.warthog.api.*;
-import org.apache.warthog.keyvalue.*;
-import org.apache.warthog.transactionalkeyvaluestore.*;
-import java.util.*;
-
-/** In-memory key value store, native hash, for testing.
-*/
-public class InMemAtomicNativeNonblockingKeyValueStore implements WHAtomicKeyValueStore
-{
-  protected static int databaseCount = 1024;
-  protected static int databaseMask = databaseCount - 1;
-  
-  protected Map[] databaseArray;
-  
-  /** Constructor */
-  public InMemAtomicNativeNonblockingKeyValueStore(int initialSize)
-  {
-    initialSize /= databaseCount;
-    databaseArray = new Map[databaseCount];
-    for (int i = 0; i < databaseCount ; i++)
-    {
-      databaseArray[i] = new HashMap(initialSize);
-    }
-  }
-  
-  /** Get a value */
-  public WHKeyValue get(WHKey key)
-    throws WHException
-  {
-    Map database = databaseArray[key.hashCode() & databaseMask];
-    synchronized (database)
-    {
-      return (WHKeyValue)database.get(key);
-    }
-  }
-  
-  /** Check a bunch of values atomically for consistency.
-  *@param checkValues is a map of keys/values that must be unchanged.  If any value is
-  * changed, a WHDeadlockException is thrown.
-  */
-  public void check(WHKeyMap checkValues)
-    throws WHException
-  {
-    WHKeyIterator iterator = checkValues.iterator();
-    while (iterator.hasNext())
-    {
-      WHKey key = iterator.next();
-      WHKeyValue value = get(key);
-      WHKeyValue otherValue = checkValues.get(key);
-      if (value == null && otherValue == null)
-        continue;
-      if (value != null && otherValue != null && value.equals(otherValue))
-        continue;
-      //System.out.println("Type of key in contention = "+key.getClass().getName());
-      throw new WHConcurrencyException();
-    }
-  }
-  
-  /** Set a bunch of values atomically.
-  *@param checkValues is a map of keys/values that must be unchanged in order for the
-  * commit to proceed.  If these values are detected to have been changed, a WHDeadlockException
-  * will be thrown.  Null values are permitted.
-  *@param setValues is a map of keys to set to specified new values.  A null value implies removal of
-  * the key.
-  */
-  public void setAll(WHKeyMap checkValues, WHKeyMap setValues)
-    throws WHException
-  {
-    // First, get the identifier of the thread making the request
-    Long threadID = new Long(Thread.currentThread().getId());
-    // Allocate a lock vector, to be filled in as we assert the read locks
-    LockKey[] locks = new LockKey[(int)checkValues.size()];
-    int lockPointer = 0;
-    // Allocate a write lock vector, same deal
-    LockKey[] writeLocks = new LockKey[(int)setValues.size()];
-    int writeLockPointer = 0;
-    try
-    {
-      WHKeyIterator iterator = checkValues.iterator();
-      while (iterator.hasNext())
-      {
-        WHKey key = iterator.next();
-        LockKey lockKey = new LockKey(key);
-        grabLock(lockKey,threadID);
-        locks[lockPointer++] = lockKey;
-        WHKeyValue value = get(key);
-        WHKeyValue otherValue = checkValues.get(key);
-        if (value == null && otherValue == null)
-          continue;
-        if (value != null && otherValue != null && value.equals(otherValue))
-          continue;
-        //System.out.println("Type of key in check contention = "+key.getClass().getName());
-        throw new WHConcurrencyException();
-      }
-      // We got all the read locks and passed the checks!  Get the write locks now.  These represent
-      // intent to change...
-      iterator = setValues.iterator();
-      while (iterator.hasNext())
-      {
-        WHKey key = iterator.next();
-        LockKey writeLockKey = new LockKey(key);
-        grabWriteLock(writeLockKey,threadID);
-        writeLocks[writeLockPointer++] = writeLockKey;
-      }
-      // Finally, do the commit
-      int releaseLockPointer = 0;
-      iterator = setValues.iterator();
-      while (iterator.hasNext())
-      {
-        WHKey key = iterator.next();
-        WHKeyValue value = setValues.get(key);
-        if (value == null)
-          remove(key);
-        else
-          put(key,value);
-        // We can now release the write lock for this key
-        LockKey lockKey = writeLocks[releaseLockPointer];
-        releaseWriteLock(lockKey,threadID);
-        writeLocks[releaseLockPointer++] = null;
-      }
-    }
-    finally
-    {
-      // Undo write locks so far set
-      while (writeLockPointer > 0)
-      {
-        LockKey lockKey = writeLocks[--writeLockPointer];
-        if (lockKey != null)
-          releaseWriteLock(lockKey,threadID);
-      }
-      // Undo locks so far set
-      while (lockPointer > 0)
-      {
-        LockKey lockKey = locks[--lockPointer];
-        releaseLock(lockKey,threadID);
-      }
-    }
-  }
-  
-  // Basic operations
-  
-  protected void put(Object key, Object value)
-  {
-    Map database = databaseArray[key.hashCode() & databaseMask];
-    synchronized (database)
-    {
-      database.put(key,value);
-    }
-  }
-  
-  protected void remove(Object key)
-  {
-    Map database = databaseArray[key.hashCode() & databaseMask];
-    synchronized (database)
-    {
-      database.remove(key);
-    }
-  }
-  
-  protected void grabLock(LockKey key, Long threadID)
-    throws WHConcurrencyException
-  {
-    try
-    {
-      Map database = databaseArray[key.hashCode() & databaseMask];
-      synchronized (database)
-      {
-        LockValue lockValue = (LockValue)database.get(key);
-        if (lockValue == null)
-        {
-          lockValue = new LockValue();
-          database.put(key,lockValue);
-        }
-        lockValue.addReadLock(threadID);
-      }
-    }
-    catch (WHConcurrencyException e)
-    {
-      //System.out.println("Read lock concurrency: "+key.getKey().getClass().getName());
-      throw e;
-    }
-  }
-  
-  protected void grabWriteLock(LockKey key, Long threadID)
-    throws WHConcurrencyException
-  {
-    try
-    {
-      Map database = databaseArray[key.hashCode() & databaseMask];
-      synchronized (database)
-      {
-        LockValue lockValue = (LockValue)database.get(key);
-        if (lockValue == null)
-        {
-          lockValue = new LockValue();
-          database.put(key,lockValue);
-        }
-        lockValue.addWriteLock(threadID);
-      }
-    }
-    catch (WHConcurrencyException e)
-    {
-      //System.out.println("Write lock concurrency: "+key.getKey().getClass().getName());
-      throw e;
-    }
-  }
-  
-  protected void releaseLock(LockKey key, Long threadID)
-  {
-    Map database = databaseArray[key.hashCode() & databaseMask];
-    synchronized (database)
-    {
-      LockValue lockValue = (LockValue)database.get(key);
-      if (lockValue.removeReadLock(threadID))
-        database.remove(key);
-    }
-  }
-  
-  protected void releaseWriteLock(LockKey key, Long threadID)
-  {
-    Map database = databaseArray[key.hashCode() & databaseMask];
-    synchronized (database)
-    {
-      LockValue lockValue = (LockValue)database.get(key);
-      if (lockValue.removeWriteLock(threadID))
-        database.remove(key);
-    }
-  }
-  
-  // Lock class
-  
-  protected static class LockKey
-  {
-    protected WHKey key;
-    
-    public LockKey(WHKey key)
-    {
-      this.key = key;
-    }
-    
-    public int hashCode()
-    {
-      return key.hashCode() + 1532;
-    }
-    
-    public boolean equals(Object o)
-    {
-      if (o.getClass() != getClass())
-        return false;
-      return ((LockKey)o).key.equals(key);
-    }
-    
-    public WHKey getKey()
-    {
-      return key;
-    }
-  }
-  
-  // Lock value class
-  
-  protected static class LockValue
-  {
-    protected boolean writeLock = false;
-    protected boolean promotedReadLock = false;
-    protected Set<Long> threadIDs = new HashSet<Long>();
-    
-    public LockValue()
-    {
-    }
-    
-    public void addReadLock(Long threadID)
-      throws WHConcurrencyException
-    {
-      if (writeLock)
-        throw new WHConcurrencyException();
-      threadIDs.add(threadID);
-    }
-    
-    public boolean removeReadLock(Long threadID)
-    {
-      threadIDs.remove(threadID);
-      return threadIDs.size() == 0;
-    }
-    
-    public void addWriteLock(Long threadID)
-      throws WHConcurrencyException
-    {
-      if (writeLock || threadIDs.size() > 1 || (threadIDs.size() == 1 && !threadIDs.contains(threadID)))
-        throw new WHConcurrencyException();
-      writeLock = true;
-      if (threadIDs.contains(threadID))
-        promotedReadLock = true;
-      else
-        threadIDs.add(threadID);
-    }
-    
-    public boolean removeWriteLock(Long threadID)
-    {
-      writeLock = false;
-      if (promotedReadLock)
-        promotedReadLock = false;
-      else
-        threadIDs.remove(threadID);
-      return threadIDs.size() == 0;
-    }
-  }
-}
+/* $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.tests;
+
+import org.apache.warthog.api.*;
+import org.apache.warthog.keyvalue.*;
+import org.apache.warthog.transactionalkeyvaluestore.*;
+import java.util.*;
+
+/** In-memory key value store, native hash, for testing.
+*/
+public class InMemAtomicNativeNonblockingKeyValueStore implements WHAtomicKeyValueStore
+{
+  protected static int databaseCount = 1024;
+  protected static int databaseMask = databaseCount - 1;
+  
+  protected Map[] databaseArray;
+  
+  /** Constructor */
+  public InMemAtomicNativeNonblockingKeyValueStore(int initialSize)
+  {
+    initialSize /= databaseCount;
+    databaseArray = new Map[databaseCount];
+    for (int i = 0; i < databaseCount ; i++)
+    {
+      databaseArray[i] = new HashMap(initialSize);
+    }
+  }
+  
+  /** Get a value */
+  public WHKeyValue get(WHKey key)
+    throws WHException
+  {
+    Map database = databaseArray[key.hashCode() & databaseMask];
+    synchronized (database)
+    {
+      return (WHKeyValue)database.get(key);
+    }
+  }
+  
+  /** Check a bunch of values atomically for consistency.
+  *@param checkValues is a map of keys/values that must be unchanged.  If any value is
+  * changed, a WHDeadlockException is thrown.
+  */
+  public void check(WHKeyMap checkValues)
+    throws WHException
+  {
+    WHKeyIterator iterator = checkValues.iterator();
+    while (iterator.hasNext())
+    {
+      WHKey key = iterator.next();
+      WHKeyValue value = get(key);
+      WHKeyValue otherValue = checkValues.get(key);
+      if (value == null && otherValue == null)
+        continue;
+      if (value != null && otherValue != null && value.equals(otherValue))
+        continue;
+      //System.out.println("Type of key in contention = "+key.getClass().getName());
+      throw new WHConcurrencyException();
+    }
+  }
+  
+  /** Set a bunch of values atomically.
+  *@param checkValues is a map of keys/values that must be unchanged in order for the
+  * commit to proceed.  If these values are detected to have been changed, a WHDeadlockException
+  * will be thrown.  Null values are permitted.
+  *@param setValues is a map of keys to set to specified new values.  A null value implies removal of
+  * the key.
+  */
+  public void setAll(WHKeyMap checkValues, WHKeyMap setValues)
+    throws WHException
+  {
+    // First, get the identifier of the thread making the request
+    Long threadID = new Long(Thread.currentThread().getId());
+    // Allocate a lock vector, to be filled in as we assert the read locks
+    LockKey[] locks = new LockKey[(int)checkValues.size()];
+    int lockPointer = 0;
+    // Allocate a write lock vector, same deal
+    LockKey[] writeLocks = new LockKey[(int)setValues.size()];
+    int writeLockPointer = 0;
+    try
+    {
+      WHKeyIterator iterator = checkValues.iterator();
+      while (iterator.hasNext())
+      {
+        WHKey key = iterator.next();
+        LockKey lockKey = new LockKey(key);
+        grabLock(lockKey,threadID);
+        locks[lockPointer++] = lockKey;
+        WHKeyValue value = get(key);
+        WHKeyValue otherValue = checkValues.get(key);
+        if (value == null && otherValue == null)
+          continue;
+        if (value != null && otherValue != null && value.equals(otherValue))
+          continue;
+        //System.out.println("Type of key in check contention = "+key.getClass().getName());
+        throw new WHConcurrencyException();
+      }
+      // We got all the read locks and passed the checks!  Get the write locks now.  These represent
+      // intent to change...
+      iterator = setValues.iterator();
+      while (iterator.hasNext())
+      {
+        WHKey key = iterator.next();
+        LockKey writeLockKey = new LockKey(key);
+        grabWriteLock(writeLockKey,threadID);
+        writeLocks[writeLockPointer++] = writeLockKey;
+      }
+      // Finally, do the commit
+      int releaseLockPointer = 0;
+      iterator = setValues.iterator();
+      while (iterator.hasNext())
+      {
+        WHKey key = iterator.next();
+        WHKeyValue value = setValues.get(key);
+        if (value == null)
+          remove(key);
+        else
+          put(key,value);
+        // We can now release the write lock for this key
+        LockKey lockKey = writeLocks[releaseLockPointer];
+        releaseWriteLock(lockKey,threadID);
+        writeLocks[releaseLockPointer++] = null;
+      }
+    }
+    finally
+    {
+      // Undo write locks so far set
+      while (writeLockPointer > 0)
+      {
+        LockKey lockKey = writeLocks[--writeLockPointer];
+        if (lockKey != null)
+          releaseWriteLock(lockKey,threadID);
+      }
+      // Undo locks so far set
+      while (lockPointer > 0)
+      {
+        LockKey lockKey = locks[--lockPointer];
+        releaseLock(lockKey,threadID);
+      }
+    }
+  }
+  
+  // Basic operations
+  
+  protected void put(Object key, Object value)
+  {
+    Map database = databaseArray[key.hashCode() & databaseMask];
+    synchronized (database)
+    {
+      database.put(key,value);
+    }
+  }
+  
+  protected void remove(Object key)
+  {
+    Map database = databaseArray[key.hashCode() & databaseMask];
+    synchronized (database)
+    {
+      database.remove(key);
+    }
+  }
+  
+  protected void grabLock(LockKey key, Long threadID)
+    throws WHConcurrencyException
+  {
+    try
+    {
+      Map database = databaseArray[key.hashCode() & databaseMask];
+      synchronized (database)
+      {
+        LockValue lockValue = (LockValue)database.get(key);
+        if (lockValue == null)
+        {
+          lockValue = new LockValue();
+          database.put(key,lockValue);
+        }
+        lockValue.addReadLock(threadID);
+      }
+    }
+    catch (WHConcurrencyException e)
+    {
+      //System.out.println("Read lock concurrency: "+key.getKey().getClass().getName());
+      throw e;
+    }
+  }
+  
+  protected void grabWriteLock(LockKey key, Long threadID)
+    throws WHConcurrencyException
+  {
+    try
+    {
+      Map database = databaseArray[key.hashCode() & databaseMask];
+      synchronized (database)
+      {
+        LockValue lockValue = (LockValue)database.get(key);
+        if (lockValue == null)
+        {
+          lockValue = new LockValue();
+          database.put(key,lockValue);
+        }
+        lockValue.addWriteLock(threadID);
+      }
+    }
+    catch (WHConcurrencyException e)
+    {
+      //System.out.println("Write lock concurrency: "+key.getKey().getClass().getName());
+      throw e;
+    }
+  }
+  
+  protected void releaseLock(LockKey key, Long threadID)
+  {
+    Map database = databaseArray[key.hashCode() & databaseMask];
+    synchronized (database)
+    {
+      LockValue lockValue = (LockValue)database.get(key);
+      if (lockValue.removeReadLock(threadID))
+        database.remove(key);
+    }
+  }
+  
+  protected void releaseWriteLock(LockKey key, Long threadID)
+  {
+    Map database = databaseArray[key.hashCode() & databaseMask];
+    synchronized (database)
+    {
+      LockValue lockValue = (LockValue)database.get(key);
+      if (lockValue.removeWriteLock(threadID))
+        database.remove(key);
+    }
+  }
+  
+  // Lock class
+  
+  protected static class LockKey
+  {
+    protected WHKey key;
+    
+    public LockKey(WHKey key)
+    {
+      this.key = key;
+    }
+    
+    public int hashCode()
+    {
+      return key.hashCode() + 1532;
+    }
+    
+    public boolean equals(Object o)
+    {
+      if (o.getClass() != getClass())
+        return false;
+      return ((LockKey)o).key.equals(key);
+    }
+    
+    public WHKey getKey()
+    {
+      return key;
+    }
+  }
+  
+  // Lock value class
+  
+  protected static class LockValue
+  {
+    protected boolean writeLock = false;
+    protected boolean promotedReadLock = false;
+    protected Set<Long> threadIDs = new HashSet<Long>();
+    
+    public LockValue()
+    {
+    }
+    
+    public void addReadLock(Long threadID)
+      throws WHConcurrencyException
+    {
+      if (writeLock)
+        throw new WHConcurrencyException();
+      threadIDs.add(threadID);
+    }
+    
+    public boolean removeReadLock(Long threadID)
+    {
+      threadIDs.remove(threadID);
+      return threadIDs.size() == 0;
+    }
+    
+    public void addWriteLock(Long threadID)
+      throws WHConcurrencyException
+    {
+      if (writeLock || threadIDs.size() > 1 || (threadIDs.size() == 1 && !threadIDs.contains(threadID)))
+        throw new WHConcurrencyException();
+      writeLock = true;
+      if (threadIDs.contains(threadID))
+        promotedReadLock = true;
+      else
+        threadIDs.add(threadID);
+    }
+    
+    public boolean removeWriteLock(Long threadID)
+    {
+      writeLock = false;
+      if (promotedReadLock)
+        promotedReadLock = false;
+      else
+        threadIDs.remove(threadID);
+      return threadIDs.size() == 0;
+    }
+  }
+}

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemAtomicNativeNonblockingKeyValueStore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemAtomicNativeNonblockingKeyValueStore.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemByteTransactionImpl.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemByteTransactionImpl.java?rev=1220353&r1=1220352&r2=1220353&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemByteTransactionImpl.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemByteTransactionImpl.java Sun Dec 18 08:36:52 2011
@@ -1,242 +1,242 @@
-/* $Id: InMemByteTransactionImpl.java 1208500 2011-11-30 16:38:45Z kwright $ */
-
-/**
-* 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.tests;
-
-import org.apache.warthog.api.*;
-import org.apache.warthog.bytekeyvalue.*;
-import org.apache.warthog.transactionalkeyvaluestore.*;
-import java.util.*;
-
-/** This class implements a byte-based transaction that is in progress, completely in memory.
-*/
-public class InMemByteTransactionImpl implements WHTransaction
-{
-  protected WHAtomicByteKeyValueStore underlyingStore;
-  
-  protected KeyMap checkData = new KeyMap();
-  protected KeyMap localData = null;
-
-  /** Constructor */
-  public InMemByteTransactionImpl(WHAtomicByteKeyValueStore underlyingStore)
-  {
-    this.underlyingStore = underlyingStore;
-  }
-  
-  /** Set a value.  May be null. */
-  public void put(WHKey key, WHKeyValue value)
-    throws WHException
-  {
-    if (localData == null)
-      localData = new KeyMap();
-    localData.put(dematerialize(key),dematerialize(value));
-  }
-
-  /** Get a value.  Null returned if no value. */
-  public WHKeyValue get(WHKey key)
-    throws WHException
-  {
-    byte[] byteKey = dematerialize(key);
-    if (localData != null)
-    {
-      if (localData.containsKey(byteKey))
-        return materialize(localData.get(byteKey));
-    }
-    if (checkData.containsKey(byteKey))
-      return materialize(checkData.get(byteKey));
-    byte[] value = underlyingStore.get(byteKey);
-    checkData.put(byteKey,value);
-    return materialize(value);
-  }
-
-  /** Check to see if this transaction has become inconsistent.
-  * If so, a WHDeadlockException is thrown.
-  */
-  public void check()
-    throws WHException
-  {
-    underlyingStore.check(checkData);
-  }
-
-  /** Commit this transaction */
-  public void commit()
-    throws WHException
-  {
-    if (localData != null)
-      underlyingStore.setAll(checkData,localData);
-    else
-      underlyingStore.check(checkData);
-  }
-  
-  /** Abandon this transaction.
-  * This is called as a nicety to free any resources associated with the
-  * transaction.  The implementation should also be robust as far as
-  * freeing resources if this method is NOT called, but might perform
-  * the necessary logic in a finalizer at an arbitrary time.
-  */
-  public void abandon()
-  {
-    // Does nothing so long as the entire temporary transaction is in
-    // memory.
-  }
-
-  protected byte[] dematerialize(WHKeyValue value)
-  {
-    if (value == null)
-      return null;
-    try
-    {
-      byte[] classNameBytes = value.getClass().getName().getBytes("ASCII");
-      byte[] valueBytes = value.serializeObject();
-      byte[] rval = new byte[1+classNameBytes.length+valueBytes.length];
-      rval[0] = (byte)classNameBytes.length;
-      // Copy arrays around
-      System.arraycopy(classNameBytes,0,rval,1,classNameBytes.length);
-      System.arraycopy(valueBytes,0,rval,1+classNameBytes.length,valueBytes.length);
-      return rval;
-    }
-    catch (java.io.UnsupportedEncodingException e)
-    {
-      throw new RuntimeException("Couldn't locate ASCII encoder");
-    }
-  }
-  
-  protected WHKeyValue materialize(byte[] bytes)
-    throws WHException
-  {
-    if (bytes == null)
-      return null;
-    try
-    {
-      int classNameLength = (int)bytes[0];
-      String className = new String(bytes,1,classNameLength,"ASCII");
-      byte[] serializedValue = new byte[bytes.length - (classNameLength+1)];
-      // Copy bytes around
-      System.arraycopy(bytes,classNameLength+1,serializedValue,0,serializedValue.length);
-      try
-      {
-        Class classToMaterialize = Class.forName(className);
-        java.lang.reflect.Constructor constructor = classToMaterialize.getConstructor(new Class[]{byte[].class});
-        Object o = constructor.newInstance(new Object[]{serializedValue});
-        if (!(o instanceof WHKeyValue))
-          throw new WHException("Class '"+className+"' is not an instance of WHValue");
-        return (WHKeyValue)o;
-      }
-      catch (ClassNotFoundException e)
-      {
-        throw new WHException("Class '"+className+"' cannot be found");
-      }
-      catch (java.lang.reflect.InvocationTargetException e)
-      {
-        throw new WHException("Constructor exception instantiating class '"+className+"': "+e.getMessage(),e);
-      }
-      catch (InstantiationException e)
-      {
-        throw new WHException("Instantiation exception for class '"+className+"': "+e.getMessage(),e);
-      }
-      catch (NoSuchMethodException e)
-      {
-        throw new WHException("Class '"+className+"' does not include a constructor with byte[] argument");
-      }
-      catch (IllegalAccessException e)
-      {
-        throw new WHException("Class '"+className+"' byte[] constructor has protected access");
-      }
-    }
-    catch (java.io.UnsupportedEncodingException e)
-    {
-      throw new RuntimeException("Couldn't locate ASCII encoder");
-    }
-  }
-  
-  /** Local implementation of byte[] map */
-  protected static class KeyMap implements WHByteKeyMap
-  {
-    protected Map<WrappedByteKey,byte[]> map = new HashMap<WrappedByteKey,byte[]>();
-    
-    public KeyMap()
-    {
-    }
-    
-    /** Get a value from the map.
-    */
-    public byte[] get(byte[] key)
-      throws WHException
-    {
-      return map.get(new WrappedByteKey(key));
-    }
-    
-    /** Iterate over the keys in the map.
-    */
-    public WHByteKeyIterator iterator()
-      throws WHException
-    {
-      return new KeyIterator(map.keySet().iterator());
-    }
-    
-    /** Get the size of the map.
-    */
-    public long size()
-      throws WHException
-    {
-      return (long)map.size();
-    }
-
-    /** Check if the map contains the specified key.
-    */
-    public boolean containsKey(byte[] key)
-    {
-      return map.containsKey(new WrappedByteKey(key));
-    }
-
-    /** Put a value.
-    */
-    public void put(byte[] key, byte[] value)
-    {
-      map.put(new WrappedByteKey(key),value);
-    }
-  }
-  
-  /** Key iterator for KeyMap */
-  protected static class KeyIterator implements WHByteKeyIterator
-  {
-    protected Iterator<WrappedByteKey> iterator;
-    
-    public KeyIterator(Iterator<WrappedByteKey> iterator)
-    {
-      this.iterator = iterator;
-    }
-    
-    /** Check if there is another value */
-    public boolean hasNext()
-      throws WHException
-    {
-      return iterator.hasNext();
-    }
-    
-    /** Get the next value */
-    public byte[] next()
-      throws WHException
-    {
-      return iterator.next().getKey();
-    }
-
-  }
-  
-}
+/* $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.tests;
+
+import org.apache.warthog.api.*;
+import org.apache.warthog.bytekeyvalue.*;
+import org.apache.warthog.transactionalkeyvaluestore.*;
+import java.util.*;
+
+/** This class implements a byte-based transaction that is in progress, completely in memory.
+*/
+public class InMemByteTransactionImpl implements WHTransaction
+{
+  protected WHAtomicByteKeyValueStore underlyingStore;
+  
+  protected KeyMap checkData = new KeyMap();
+  protected KeyMap localData = null;
+
+  /** Constructor */
+  public InMemByteTransactionImpl(WHAtomicByteKeyValueStore underlyingStore)
+  {
+    this.underlyingStore = underlyingStore;
+  }
+  
+  /** Set a value.  May be null. */
+  public void put(WHKey key, WHKeyValue value)
+    throws WHException
+  {
+    if (localData == null)
+      localData = new KeyMap();
+    localData.put(dematerialize(key),dematerialize(value));
+  }
+
+  /** Get a value.  Null returned if no value. */
+  public WHKeyValue get(WHKey key)
+    throws WHException
+  {
+    byte[] byteKey = dematerialize(key);
+    if (localData != null)
+    {
+      if (localData.containsKey(byteKey))
+        return materialize(localData.get(byteKey));
+    }
+    if (checkData.containsKey(byteKey))
+      return materialize(checkData.get(byteKey));
+    byte[] value = underlyingStore.get(byteKey);
+    checkData.put(byteKey,value);
+    return materialize(value);
+  }
+
+  /** Check to see if this transaction has become inconsistent.
+  * If so, a WHDeadlockException is thrown.
+  */
+  public void check()
+    throws WHException
+  {
+    underlyingStore.check(checkData);
+  }
+
+  /** Commit this transaction */
+  public void commit()
+    throws WHException
+  {
+    if (localData != null)
+      underlyingStore.setAll(checkData,localData);
+    else
+      underlyingStore.check(checkData);
+  }
+  
+  /** Abandon this transaction.
+  * This is called as a nicety to free any resources associated with the
+  * transaction.  The implementation should also be robust as far as
+  * freeing resources if this method is NOT called, but might perform
+  * the necessary logic in a finalizer at an arbitrary time.
+  */
+  public void abandon()
+  {
+    // Does nothing so long as the entire temporary transaction is in
+    // memory.
+  }
+
+  protected byte[] dematerialize(WHKeyValue value)
+  {
+    if (value == null)
+      return null;
+    try
+    {
+      byte[] classNameBytes = value.getClass().getName().getBytes("ASCII");
+      byte[] valueBytes = value.serializeObject();
+      byte[] rval = new byte[1+classNameBytes.length+valueBytes.length];
+      rval[0] = (byte)classNameBytes.length;
+      // Copy arrays around
+      System.arraycopy(classNameBytes,0,rval,1,classNameBytes.length);
+      System.arraycopy(valueBytes,0,rval,1+classNameBytes.length,valueBytes.length);
+      return rval;
+    }
+    catch (java.io.UnsupportedEncodingException e)
+    {
+      throw new RuntimeException("Couldn't locate ASCII encoder");
+    }
+  }
+  
+  protected WHKeyValue materialize(byte[] bytes)
+    throws WHException
+  {
+    if (bytes == null)
+      return null;
+    try
+    {
+      int classNameLength = (int)bytes[0];
+      String className = new String(bytes,1,classNameLength,"ASCII");
+      byte[] serializedValue = new byte[bytes.length - (classNameLength+1)];
+      // Copy bytes around
+      System.arraycopy(bytes,classNameLength+1,serializedValue,0,serializedValue.length);
+      try
+      {
+        Class classToMaterialize = Class.forName(className);
+        java.lang.reflect.Constructor constructor = classToMaterialize.getConstructor(new Class[]{byte[].class});
+        Object o = constructor.newInstance(new Object[]{serializedValue});
+        if (!(o instanceof WHKeyValue))
+          throw new WHException("Class '"+className+"' is not an instance of WHValue");
+        return (WHKeyValue)o;
+      }
+      catch (ClassNotFoundException e)
+      {
+        throw new WHException("Class '"+className+"' cannot be found");
+      }
+      catch (java.lang.reflect.InvocationTargetException e)
+      {
+        throw new WHException("Constructor exception instantiating class '"+className+"': "+e.getMessage(),e);
+      }
+      catch (InstantiationException e)
+      {
+        throw new WHException("Instantiation exception for class '"+className+"': "+e.getMessage(),e);
+      }
+      catch (NoSuchMethodException e)
+      {
+        throw new WHException("Class '"+className+"' does not include a constructor with byte[] argument");
+      }
+      catch (IllegalAccessException e)
+      {
+        throw new WHException("Class '"+className+"' byte[] constructor has protected access");
+      }
+    }
+    catch (java.io.UnsupportedEncodingException e)
+    {
+      throw new RuntimeException("Couldn't locate ASCII encoder");
+    }
+  }
+  
+  /** Local implementation of byte[] map */
+  protected static class KeyMap implements WHByteKeyMap
+  {
+    protected Map<WrappedByteKey,byte[]> map = new HashMap<WrappedByteKey,byte[]>();
+    
+    public KeyMap()
+    {
+    }
+    
+    /** Get a value from the map.
+    */
+    public byte[] get(byte[] key)
+      throws WHException
+    {
+      return map.get(new WrappedByteKey(key));
+    }
+    
+    /** Iterate over the keys in the map.
+    */
+    public WHByteKeyIterator iterator()
+      throws WHException
+    {
+      return new KeyIterator(map.keySet().iterator());
+    }
+    
+    /** Get the size of the map.
+    */
+    public long size()
+      throws WHException
+    {
+      return (long)map.size();
+    }
+
+    /** Check if the map contains the specified key.
+    */
+    public boolean containsKey(byte[] key)
+    {
+      return map.containsKey(new WrappedByteKey(key));
+    }
+
+    /** Put a value.
+    */
+    public void put(byte[] key, byte[] value)
+    {
+      map.put(new WrappedByteKey(key),value);
+    }
+  }
+  
+  /** Key iterator for KeyMap */
+  protected static class KeyIterator implements WHByteKeyIterator
+  {
+    protected Iterator<WrappedByteKey> iterator;
+    
+    public KeyIterator(Iterator<WrappedByteKey> iterator)
+    {
+      this.iterator = iterator;
+    }
+    
+    /** Check if there is another value */
+    public boolean hasNext()
+      throws WHException
+    {
+      return iterator.hasNext();
+    }
+    
+    /** Get the next value */
+    public byte[] next()
+      throws WHException
+    {
+      return iterator.next().getKey();
+    }
+
+  }
+  
+}

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemByteTransactionImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemByteTransactionImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemByteTransactionalStoreImpl.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemByteTransactionalStoreImpl.java?rev=1220353&r1=1220352&r2=1220353&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemByteTransactionalStoreImpl.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemByteTransactionalStoreImpl.java Sun Dec 18 08:36:52 2011
@@ -1,46 +1,46 @@
-/* $Id: InMemByteTransactionalStoreImpl.java 1206939 2011-11-28 00:37:54Z kwright $ */
-
-/**
-* 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.tests;
-
-import org.apache.warthog.api.*;
-import org.apache.warthog.bytekeyvalue.*;
-import org.apache.warthog.transactionalkeyvaluestore.*;
-
-/** Class implementing a transactional byte-based key/value store completely in memory.
-*/
-public class InMemByteTransactionalStoreImpl implements WHTransactionalStore
-{
-  /** Underlying atomic key/value store */
-  protected WHAtomicByteKeyValueStore underlyingStore;
-  
-  /** Constructor. */
-  public InMemByteTransactionalStoreImpl(WHAtomicByteKeyValueStore underlyingStore)
-  {
-    this.underlyingStore = underlyingStore;
-  }
-  
-  /** Create a transaction. */
-  public WHTransaction createTransaction()
-    throws WHException
-  {
-    return new InMemByteTransactionImpl(this.underlyingStore);
-  }
-
-}
+/* $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.tests;
+
+import org.apache.warthog.api.*;
+import org.apache.warthog.bytekeyvalue.*;
+import org.apache.warthog.transactionalkeyvaluestore.*;
+
+/** Class implementing a transactional byte-based key/value store completely in memory.
+*/
+public class InMemByteTransactionalStoreImpl implements WHTransactionalStore
+{
+  /** Underlying atomic key/value store */
+  protected WHAtomicByteKeyValueStore underlyingStore;
+  
+  /** Constructor. */
+  public InMemByteTransactionalStoreImpl(WHAtomicByteKeyValueStore underlyingStore)
+  {
+    this.underlyingStore = underlyingStore;
+  }
+  
+  /** Create a transaction. */
+  public WHTransaction createTransaction()
+    throws WHException
+  {
+    return new InMemByteTransactionImpl(this.underlyingStore);
+  }
+
+}

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemByteTransactionalStoreImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemByteTransactionalStoreImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemNativeTransactionImpl.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemNativeTransactionImpl.java?rev=1220353&r1=1220352&r2=1220353&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemNativeTransactionImpl.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemNativeTransactionImpl.java Sun Dec 18 08:36:52 2011
@@ -1,173 +1,173 @@
-/* $Id: InMemNativeTransactionImpl.java 1208500 2011-11-30 16:38:45Z kwright $ */
-
-/**
-* 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.tests;
-
-import org.apache.warthog.api.*;
-import org.apache.warthog.keyvalue.*;
-import org.apache.warthog.transactionalkeyvaluestore.*;
-import java.util.*;
-
-/** This class implements a transaction that is in progress, completely in memory,
-* using native hash methods.
-*/
-public class InMemNativeTransactionImpl implements WHTransaction
-{
-  protected WHAtomicKeyValueStore underlyingStore;
-  
-  protected KeyMap checkData = new KeyMap();
-  protected KeyMap localData = null;
-
-  /** Constructor */
-  public InMemNativeTransactionImpl(WHAtomicKeyValueStore underlyingStore)
-  {
-    this.underlyingStore = underlyingStore;
-  }
-  
-  /** Set a value.  May be null. */
-  public void put(WHKey key, WHKeyValue value)
-    throws WHException
-  {
-    if (localData == null)
-      localData = new KeyMap();
-    localData.put(key,value);
-  }
-
-  /** Get a value.  Null returned if no value. */
-  public WHKeyValue get(WHKey key)
-    throws WHException
-  {
-    if (localData != null)
-    {
-      if (localData.containsKey(key))
-        return localData.get(key);
-    }
-    if (checkData.containsKey(key))
-      return checkData.get(key);
-    WHKeyValue value = underlyingStore.get(key);
-    checkData.put(key,value);
-    return value;
-  }
-
-  /** Check to see if this transaction has become inconsistent.
-  * If so, a WHDeadlockException is thrown.
-  */
-  public void check()
-    throws WHException
-  {
-    underlyingStore.check(checkData);
-  }
-
-  /** Commit this transaction */
-  public void commit()
-    throws WHException
-  {
-    if (localData != null)
-      underlyingStore.setAll(checkData,localData);
-    else
-      underlyingStore.check(checkData);
-  }
-  
-  /** Abandon this transaction.
-  * This is called as a nicety to free any resources associated with the
-  * transaction.  The implementation should also be robust as far as
-  * freeing resources if this method is NOT called, but might perform
-  * the necessary logic in a finalizer at an arbitrary time.
-  */
-  public void abandon()
-  {
-    // Does nothing so long as the entire temporary transaction is in
-    // memory.
-  }
-
-  /** Local implementation of WHKey/WHValue map */
-  protected static class KeyMap implements WHKeyMap
-  {
-    protected Map<WHKey,WHKeyValue> map = new HashMap<WHKey,WHKeyValue>();
-    
-    public KeyMap()
-    {
-    }
-    
-    /** Get a value from the map.
-    */
-    public WHKeyValue get(WHKey key)
-      throws WHException
-    {
-      return map.get(key);
-    }
-    
-    /** Iterate over the keys in the map.
-    */
-    public WHKeyIterator iterator()
-      throws WHException
-    {
-      return new KeyIterator(map.keySet().iterator());
-    }
-    
-    /** Get the size of the map.
-    */
-    public long size()
-      throws WHException
-    {
-      return (long)map.size();
-    }
-
-    /** Check if the map contains the specified key.
-    */
-    public boolean containsKey(WHKey key)
-    {
-      return map.containsKey(key);
-    }
-
-    /** Put a value.
-    */
-    public void put(WHKey key, WHKeyValue value)
-    {
-      map.put(key,value);
-    }
-  }
-  
-  /** Key iterator for KeyMap */
-  protected static class KeyIterator implements WHKeyIterator
-  {
-    protected Iterator<WHKey> iterator;
-    
-    public KeyIterator(Iterator<WHKey> iterator)
-    {
-      this.iterator = iterator;
-    }
-    
-    /** Check if there is another value */
-    public boolean hasNext()
-      throws WHException
-    {
-      return iterator.hasNext();
-    }
-    
-    /** Get the next value */
-    public WHKey next()
-      throws WHException
-    {
-      return iterator.next();
-    }
-
-  }
-  
-}
+/* $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.tests;
+
+import org.apache.warthog.api.*;
+import org.apache.warthog.keyvalue.*;
+import org.apache.warthog.transactionalkeyvaluestore.*;
+import java.util.*;
+
+/** This class implements a transaction that is in progress, completely in memory,
+* using native hash methods.
+*/
+public class InMemNativeTransactionImpl implements WHTransaction
+{
+  protected WHAtomicKeyValueStore underlyingStore;
+  
+  protected KeyMap checkData = new KeyMap();
+  protected KeyMap localData = null;
+
+  /** Constructor */
+  public InMemNativeTransactionImpl(WHAtomicKeyValueStore underlyingStore)
+  {
+    this.underlyingStore = underlyingStore;
+  }
+  
+  /** Set a value.  May be null. */
+  public void put(WHKey key, WHKeyValue value)
+    throws WHException
+  {
+    if (localData == null)
+      localData = new KeyMap();
+    localData.put(key,value);
+  }
+
+  /** Get a value.  Null returned if no value. */
+  public WHKeyValue get(WHKey key)
+    throws WHException
+  {
+    if (localData != null)
+    {
+      if (localData.containsKey(key))
+        return localData.get(key);
+    }
+    if (checkData.containsKey(key))
+      return checkData.get(key);
+    WHKeyValue value = underlyingStore.get(key);
+    checkData.put(key,value);
+    return value;
+  }
+
+  /** Check to see if this transaction has become inconsistent.
+  * If so, a WHDeadlockException is thrown.
+  */
+  public void check()
+    throws WHException
+  {
+    underlyingStore.check(checkData);
+  }
+
+  /** Commit this transaction */
+  public void commit()
+    throws WHException
+  {
+    if (localData != null)
+      underlyingStore.setAll(checkData,localData);
+    else
+      underlyingStore.check(checkData);
+  }
+  
+  /** Abandon this transaction.
+  * This is called as a nicety to free any resources associated with the
+  * transaction.  The implementation should also be robust as far as
+  * freeing resources if this method is NOT called, but might perform
+  * the necessary logic in a finalizer at an arbitrary time.
+  */
+  public void abandon()
+  {
+    // Does nothing so long as the entire temporary transaction is in
+    // memory.
+  }
+
+  /** Local implementation of WHKey/WHValue map */
+  protected static class KeyMap implements WHKeyMap
+  {
+    protected Map<WHKey,WHKeyValue> map = new HashMap<WHKey,WHKeyValue>();
+    
+    public KeyMap()
+    {
+    }
+    
+    /** Get a value from the map.
+    */
+    public WHKeyValue get(WHKey key)
+      throws WHException
+    {
+      return map.get(key);
+    }
+    
+    /** Iterate over the keys in the map.
+    */
+    public WHKeyIterator iterator()
+      throws WHException
+    {
+      return new KeyIterator(map.keySet().iterator());
+    }
+    
+    /** Get the size of the map.
+    */
+    public long size()
+      throws WHException
+    {
+      return (long)map.size();
+    }
+
+    /** Check if the map contains the specified key.
+    */
+    public boolean containsKey(WHKey key)
+    {
+      return map.containsKey(key);
+    }
+
+    /** Put a value.
+    */
+    public void put(WHKey key, WHKeyValue value)
+    {
+      map.put(key,value);
+    }
+  }
+  
+  /** Key iterator for KeyMap */
+  protected static class KeyIterator implements WHKeyIterator
+  {
+    protected Iterator<WHKey> iterator;
+    
+    public KeyIterator(Iterator<WHKey> iterator)
+    {
+      this.iterator = iterator;
+    }
+    
+    /** Check if there is another value */
+    public boolean hasNext()
+      throws WHException
+    {
+      return iterator.hasNext();
+    }
+    
+    /** Get the next value */
+    public WHKey next()
+      throws WHException
+    {
+      return iterator.next();
+    }
+
+  }
+  
+}

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemNativeTransactionImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemNativeTransactionImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemNativeTransactionalStoreImpl.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemNativeTransactionalStoreImpl.java?rev=1220353&r1=1220352&r2=1220353&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemNativeTransactionalStoreImpl.java (original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemNativeTransactionalStoreImpl.java Sun Dec 18 08:36:52 2011
@@ -1,46 +1,46 @@
-/* $Id: InMemNativeTransactionalStoreImpl.java 1208116 2011-11-29 22:36:26Z kwright $ */
-
-/**
-* 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.tests;
-
-import org.apache.warthog.api.*;
-import org.apache.warthog.keyvalue.*;
-import org.apache.warthog.transactionalkeyvaluestore.*;
-
-/** Class implementing a native transactional key/value store completely in memory.
-*/
-public class InMemNativeTransactionalStoreImpl implements WHTransactionalStore
-{
-  /** Underlying atomic key/value store */
-  protected WHAtomicKeyValueStore underlyingStore;
-  
-  /** Constructor. */
-  public InMemNativeTransactionalStoreImpl(WHAtomicKeyValueStore underlyingStore)
-  {
-    this.underlyingStore = underlyingStore;
-  }
-  
-  /** Create a transaction. */
-  public WHTransaction createTransaction()
-    throws WHException
-  {
-    return new InMemNativeTransactionImpl(this.underlyingStore);
-  }
-
-}
+/* $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.tests;
+
+import org.apache.warthog.api.*;
+import org.apache.warthog.keyvalue.*;
+import org.apache.warthog.transactionalkeyvaluestore.*;
+
+/** Class implementing a native transactional key/value store completely in memory.
+*/
+public class InMemNativeTransactionalStoreImpl implements WHTransactionalStore
+{
+  /** Underlying atomic key/value store */
+  protected WHAtomicKeyValueStore underlyingStore;
+  
+  /** Constructor. */
+  public InMemNativeTransactionalStoreImpl(WHAtomicKeyValueStore underlyingStore)
+  {
+    this.underlyingStore = underlyingStore;
+  }
+  
+  /** Create a transaction. */
+  public WHTransaction createTransaction()
+    throws WHException
+  {
+    return new InMemNativeTransactionImpl(this.underlyingStore);
+  }
+
+}

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemNativeTransactionalStoreImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog-reimport/src/test/java/org/apache/warthog/tests/InMemNativeTransactionalStoreImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id