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/11/09 16:28:09 UTC
svn commit: r1199794 - in /incubator/lcf/branches/CONNECTORS-286/warthog: ./
lib/ src/ src/main/ src/main/java/ src/main/java/org/
src/main/java/org/apache/ src/main/java/org/apache/warthog/
src/main/java/org/apache/warthog/atomicserialization/ src/mai...
Author: kwright
Date: Wed Nov 9 15:28:08 2011
New Revision: 1199794
URL: http://svn.apache.org/viewvc?rev=1199794&view=rev
Log:
Initial interfaces
Added:
incubator/lcf/branches/CONNECTORS-286/warthog/
incubator/lcf/branches/CONNECTORS-286/warthog/build.xml (with props)
incubator/lcf/branches/CONNECTORS-286/warthog/lib/
incubator/lcf/branches/CONNECTORS-286/warthog/src/
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/atomicserialization/
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/atomictransaction/
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/atomictransaction/TransactionImpl.java (with props)
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/atomictransaction/TransactionalStoreImpl.java (with props)
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHAccessor.java (with props)
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHAtomicKeyValueStore.java (with props)
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHColumnDescription.java (with props)
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHComparator.java (with props)
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHDeadlockException.java (with props)
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHException.java (with props)
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHIndex.java (with props)
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHIndexCriteria.java (with props)
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHKey.java (with props)
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHQueryDescription.java (with props)
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHQueryResult.java (with props)
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHRelationship.java (with props)
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHRowCriteria.java (with props)
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTable.java (with props)
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTableStore.java (with props)
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTransaction.java (with props)
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTransactionalStore.java (with props)
incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHValue.java (with props)
Added: incubator/lcf/branches/CONNECTORS-286/warthog/build.xml
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/build.xml?rev=1199794&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/build.xml (added)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/build.xml Wed Nov 9 15:28:08 2011
@@ -0,0 +1,37 @@
+<!--
+ 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.
+-->
+
+<project default="all">
+
+ <target name="clean">
+ <delete dir="build"/>
+ </target>
+
+ <target name="compile">
+ <mkdir dir="build/classes"/>
+ <javac srcdir="src/main/java" destdir="build/classes" target="1.5" source="1.5" debug="true" debuglevel="lines,vars,source">
+ <classpath>
+ <fileset dir="lib">
+ <include name="*.jar"/>
+ </fileset>
+ </classpath>
+ </javac>
+ </target>
+
+ <target name="all" depends="compile"/>
+
+</project>
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/build.xml
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/atomictransaction/TransactionImpl.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/atomictransaction/TransactionImpl.java?rev=1199794&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/atomictransaction/TransactionImpl.java (added)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/atomictransaction/TransactionImpl.java Wed Nov 9 15:28:08 2011
@@ -0,0 +1,80 @@
+/* $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.atomictransaction;
+
+import org.apache.warthog.interfaces.*;
+import java.util.*;
+
+/** This class implements a transaction that is in progress.
+*/
+public class TransactionImpl implements WHTransaction
+{
+ protected WHAtomicKeyValueStore underlyingStore;
+
+ protected Map<WHKey,WHValue> checkData = new HashMap<WHKey,WHValue>();
+ protected Map<WHKey,WHValue> localData = null;
+
+ /** Constructor */
+ public TransactionImpl(WHAtomicKeyValueStore underlyingStore)
+ {
+ this.underlyingStore = underlyingStore;
+ }
+
+ /** Set a value. May be null. */
+ public void put(WHKey key, WHValue value)
+ throws WHException
+ {
+ if (localData == null)
+ localData = new HashMap<WHKey,WHValue>();
+ localData.put(key,value);
+ }
+
+ /** Get a value. Null returned if no value. */
+ public WHValue get(WHKey key)
+ throws WHException
+ {
+ if (localData != null)
+ {
+ if (localData.containsKey(key))
+ return localData.get(key);
+ }
+ if (checkData.containsKey(key))
+ return checkData.get(key);
+ WHValue 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
+ {
+ underlyingStore.setAll(checkData,localData);
+ }
+}
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/atomictransaction/TransactionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/atomictransaction/TransactionImpl.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/atomictransaction/TransactionalStoreImpl.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/atomictransaction/TransactionalStoreImpl.java?rev=1199794&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/atomictransaction/TransactionalStoreImpl.java (added)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/atomictransaction/TransactionalStoreImpl.java Wed Nov 9 15:28:08 2011
@@ -0,0 +1,44 @@
+/* $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.atomictransaction;
+
+import org.apache.warthog.interfaces.*;
+
+/** Class implementing a transactional key/value store.
+*/
+public class TransactionalStoreImpl implements WHTransactionalStore
+{
+ /** Underlying atomic key/value store */
+ protected WHAtomicKeyValueStore underlyingStore;
+
+ /** Constructor. */
+ public TransactionalStoreImpl(WHAtomicKeyValueStore underlyingStore)
+ {
+ this.underlyingStore = underlyingStore;
+ }
+
+ /** Create a transaction. */
+ public WHTransaction createTransaction()
+ throws WHException
+ {
+ return new TransactionImpl(this.underlyingStore);
+ }
+
+}
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/atomictransaction/TransactionalStoreImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/atomictransaction/TransactionalStoreImpl.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHAccessor.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHAccessor.java?rev=1199794&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHAccessor.java (added)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHAccessor.java Wed Nov 9 15:28:08 2011
@@ -0,0 +1,36 @@
+/* $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.interfaces;
+
+/** Use one of several means to find rows within a relationship. The implementer
+* of this interface determines just how this is to be done.
+*/
+public interface WHAccessor
+{
+ /** Are there any more rows?
+ */
+ public boolean hasNext()
+ throws WHException;
+
+ /** Read the next matching relationship row number,
+ */
+ public int getNext()
+ throws WHException;
+}
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHAccessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHAccessor.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHAtomicKeyValueStore.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHAtomicKeyValueStore.java?rev=1199794&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHAtomicKeyValueStore.java (added)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHAtomicKeyValueStore.java Wed Nov 9 15:28:08 2011
@@ -0,0 +1,49 @@
+/* $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.interfaces;
+import java.util.*;
+
+/** Describes the general functionality requirements of an underlying (distributed?)
+* key value store, which use conflict detection as its mechanism for handling transactional
+* integrity.
+*/
+public interface WHAtomicKeyValueStore
+{
+ /** Get a value */
+ public WHValue get(WHKey key)
+ throws WHException;
+
+ /** 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(Map<WHKey,WHValue> checkValues)
+ throws WHException;
+
+ /** 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(Map<WHKey,WHValue> checkValues, Map<WHKey,WHValue> setValues)
+ throws WHException;
+}
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHAtomicKeyValueStore.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHAtomicKeyValueStore.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHColumnDescription.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHColumnDescription.java?rev=1199794&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHColumnDescription.java (added)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHColumnDescription.java Wed Nov 9 15:28:08 2011
@@ -0,0 +1,27 @@
+/* $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.interfaces;
+
+/** Describe a column.
+*/
+public interface WHColumnDescription
+{
+ // MHL
+}
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHColumnDescription.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHColumnDescription.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHComparator.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHComparator.java?rev=1199794&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHComparator.java (added)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHComparator.java Wed Nov 9 15:28:08 2011
@@ -0,0 +1,39 @@
+/* $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.interfaces;
+
+/** Interface that describes comparison functionality.
+* This is an underpinning of the btree structure.
+*/
+public interface WHComparator
+{
+ // Comparison result values
+
+ public static int RESULT_EQUALS = 0;
+ public static int RESULT_LESS = -1;
+ public static int RESULT_GREATER = 1;
+
+ /** Comparison method.
+ * This is only ever used to compare values; it cannot be used to compare null vs. non-null.
+ */
+ public int compare(WHValue leftValue, WHValue rightValue)
+ throws WHException;
+
+}
\ No newline at end of file
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHComparator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHComparator.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHDeadlockException.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHDeadlockException.java?rev=1199794&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHDeadlockException.java (added)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHDeadlockException.java Wed Nov 9 15:28:08 2011
@@ -0,0 +1,32 @@
+/* $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.interfaces;
+
+/** This exception is special in that it indicates a deadlock detection, which means
+* transaction has to be backed out and retried from start.
+*/
+public class WHDeadlockException extends WHException
+{
+ public WHDeadlockException()
+ {
+ super("Deadlock occurred");
+ }
+
+}
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHDeadlockException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHDeadlockException.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHException.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHException.java?rev=1199794&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHException.java (added)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHException.java Wed Nov 9 15:28:08 2011
@@ -0,0 +1,34 @@
+/* $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.interfaces;
+
+/** General exception */
+public class WHException extends Exception
+{
+ public WHException(String message)
+ {
+ super(message);
+ }
+
+ public WHException(String message, Throwable e)
+ {
+ super(message,e);
+ }
+}
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHException.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHIndex.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHIndex.java?rev=1199794&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHIndex.java (added)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHIndex.java Wed Nov 9 15:28:08 2011
@@ -0,0 +1,79 @@
+/* $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.interfaces;
+
+/** This abstraction provides access to a btree index. Note: This is a permanent
+* structure, and can only index a permanent table.
+*/
+public interface WHIndex
+{
+ /** Get the table name the index applies to.
+ */
+ public String getTableName()
+ throws WHException;
+
+ /** Get the columns that are indexed
+ */
+ public String[] getColumnNames()
+ throws WHException;
+
+ /** Get the comparator class names corresponding to the columns.
+ * Effectively also returns the index order for each of those columns
+ * (as determined by the comparator).
+ */
+ public String[] getComparatorClassNames()
+ throws WHException;
+
+ /** Add a new row to the index.
+ */
+ public void addNewRow(int rowNumber)
+ throws WHException;
+
+ /** Remove a row from the index. The row must currently exist.
+ */
+ public void deleteRow(int rowNumber)
+ throws WHException;
+
+ // Accessor support methods.
+ //
+ // Index access supports any kind of matches which allow pruning of whole subtrees
+ // during index scanning. Effectively this means that any criteria supplied must have
+ // something to do with the comparator order for this index and the column in
+ // question.
+ //
+ // Furthermore, the btree is set up specifically to allow efficient pruning. That
+ // means that each node has a greater/lesser link for index criteria, in order. It
+ // is therefore the first column in the index which has the greatest ability to prune,
+ // while secondary, tertiary columns etc. have progressively less ability.
+ // Thus, it is very possible that a limited index scan with criteria may be expensive
+ // as a result of those criteria applying too low down in order of columns, thus
+ // requiring too many nodes to be processed.
+ //
+ // One can imagine index structures which would not have this flaw, but would gain
+ // performance at the expense of more complicated structures. I've yet to come up
+ // with an algorithm, though, that has all the right characteristics.
+
+ /** Create an accessor based on this index which uses the provided criteria. The
+ * criteria must align with the index's columns. Null values are permitted where
+ * no criteria are present.
+ */
+ public WHAccessor buildAccessor(WHIndexCriteria[] criteria);
+
+}
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHIndex.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHIndex.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHIndexCriteria.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHIndexCriteria.java?rev=1199794&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHIndexCriteria.java (added)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHIndexCriteria.java Wed Nov 9 15:28:08 2011
@@ -0,0 +1,43 @@
+/* $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.interfaces;
+
+/** This interface represents what is needed to scan an index and make decisions about
+* what subtrees to descend into, and which not to. The implementation of this interface
+* determines the actual behavior. An instance of this interface may be present for each
+* column present in the index.
+*/
+public interface WHIndexCriteria
+{
+ // Return signals. This constitutes 3 bits which determine how to proceed.
+ // Zero value for the bit indicates "skip", while a 1 value indicates "accept".
+ public static final int SIGNAL_LESSER = 1;
+ public static final int SIGNAL_GREATER = 2;
+ public static final int SIGNAL_EQUALS = 4;
+
+ /** Evaluate a given value (which may be null) against the criteria described
+ * by the implementer of this interface, and return the appropriate bit pattern.
+ * The comparator is provided.
+ */
+ public int evaluateValue(WHValue value, WHComparator comparator)
+ throws WHException;
+}
+
+
\ No newline at end of file
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHIndexCriteria.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHIndexCriteria.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHKey.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHKey.java?rev=1199794&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHKey.java (added)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHKey.java Wed Nov 9 15:28:08 2011
@@ -0,0 +1,31 @@
+/* $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.interfaces;
+
+/** This object represents a key in a transactional key/value store.
+* Pretty much any (serializable) object can be used, provided there
+* is an available hash function and equals method.
+*/
+public interface WHKey extends WHValue
+{
+ /** Calculate the hash function. */
+ public int hashCode();
+
+}
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHKey.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHKey.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHQueryDescription.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHQueryDescription.java?rev=1199794&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHQueryDescription.java (added)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHQueryDescription.java Wed Nov 9 15:28:08 2011
@@ -0,0 +1,57 @@
+/* $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.interfaces;
+
+/** This describes the return columns, source relations, and row criteria for a query.
+* NOTE: This is a transient structure.
+*/
+public interface WHQueryDescription
+{
+ /** Get the return columns. This may involve some manipulation of the results,
+ * including renaming of columns, mathematical calculations based on row data, etc.
+ */
+ //public WHColumn[] getReturnColumns();
+
+ // MHL. Group-by and other operations that agglomerate rows need to be specified
+ // at this level.
+
+ /** Get the source relationship.
+ */
+ public WHRelationship getRelationship();
+
+ /** Get the row accessor. This determines
+ * both the initial set of rows and the ordering. The results can be later filtered to
+ * yield the final output data.
+ */
+ public WHAccessor getAccessor();
+
+ /** Get the row criteria. This is an expression written in terms of the columns
+ * of the WHRelationship which determines what to include (and what to filter) from
+ * the accessor results.
+ */
+ public WHRowCriteria getRowCriteria();
+
+ /** Get the starting result row number we're interested in. */
+ public int getOffset();
+
+ /** Get the maximum number of rows we are interested in. */
+ public int getReturnLimit();
+
+}
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHQueryDescription.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHQueryDescription.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHQueryResult.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHQueryResult.java?rev=1199794&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHQueryResult.java (added)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHQueryResult.java Wed Nov 9 15:28:08 2011
@@ -0,0 +1,36 @@
+/* $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.interfaces;
+
+/** The result of a query, which is in fact a local table all of its own.
+*/
+public interface WHQueryResult
+{
+ /** Get the column names for this result. */
+ public String[] getColumnNames();
+
+ /** Get an accessor for the result rows. */
+ public WHAccessor buildAccessor()
+ throws WHException;
+
+ /** Get a value for the result. */
+ public WHValue getValue(int rowNumber, String columnName)
+ throws WHException;
+}
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHQueryResult.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHQueryResult.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHRelationship.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHRelationship.java?rev=1199794&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHRelationship.java (added)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHRelationship.java Wed Nov 9 15:28:08 2011
@@ -0,0 +1,35 @@
+/* $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.interfaces;
+
+/** This describes an abstract "table" of rows and columns. This can be implemented
+* in a number of ways: as a straight table, as a join (with join criteria), and as the
+* result of a query.
+*/
+public interface WHRelationship
+{
+ /** Get the column names represented by the relationship. */
+ public String[] getColumnNames()
+ throws WHException;
+
+ /** Get the data for a given row # and column. */
+ public WHValue getValue(int rowNumber, String columnName)
+ throws WHException;
+}
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHRelationship.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHRelationship.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHRowCriteria.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHRowCriteria.java?rev=1199794&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHRowCriteria.java (added)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHRowCriteria.java Wed Nov 9 15:28:08 2011
@@ -0,0 +1,28 @@
+/* $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.interfaces;
+
+/** Interface describing the row criteria that will be used to filter rows
+* returned by an accessor.
+*/
+public interface WHRowCriteria
+{
+ // MHL
+}
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHRowCriteria.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHRowCriteria.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTable.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTable.java?rev=1199794&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTable.java (added)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTable.java Wed Nov 9 15:28:08 2011
@@ -0,0 +1,68 @@
+/* $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.interfaces;
+
+/** This abstraction permits access to a table structure. An object of this kind can ONLY
+* be used within the context of the WHTableStore object that created it. Note: This is a
+* permanent structure.
+*/
+public interface WHTable
+{
+ /** Get the column names.
+ */
+ public String[] getColumnNames()
+ throws WHException;
+
+ /** Compact the table.
+ */
+ public void compact()
+ throws WHException;
+
+ /** Insert a row */
+ public void insertRow(String[] columns, WHValue[] values)
+ throws WHException;
+
+ /** Update row(s) */
+ public void updateRows(String[] columns, WHValue[] values,
+ WHAccessor accessor, WHRowCriteria criteria)
+ throws WHException;
+
+ /** Delete row(s) */
+ public void deleteRows(WHAccessor accessor, WHRowCriteria criteria)
+ throws WHException;
+
+ // Below this point is the 'non-public' part of the API, which may eventually be moved into implementation classes.
+
+ /** Get the row count */
+ public int getRowCount()
+ throws WHException;
+
+ /** Get the max row number, plus one */
+ public int getMaxRowNumber()
+ throws WHException;
+
+ /** Get the data for a given row # and column. */
+ public WHValue getValue(int rowNumber, String columnName)
+ throws WHException;
+
+ /** Build an accessor that simply scans all the rows in the table */
+ public WHAccessor buildAccessor();
+
+}
\ No newline at end of file
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTable.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTable.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTableStore.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTableStore.java?rev=1199794&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTableStore.java (added)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTableStore.java Wed Nov 9 15:28:08 2011
@@ -0,0 +1,69 @@
+/* $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.interfaces;
+
+/** 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
+* these constructs is not SQL based, but is rather a general Java API.
+*/
+public interface WHTableStore
+{
+ /** Begin a transaction */
+ public void beginTransaction()
+ throws WHException;
+
+ /** Commit a transaction */
+ public void commitTransaction()
+ throws WHException;
+
+ /** Abandon a transaction */
+ public void abandonTransaction()
+ throws WHException;
+
+ /** Lookup table */
+ public WHTable lookupTable(String name)
+ throws WHException;
+
+ /** Create a table */
+ public WHTable createTable(String name, WHColumnDescription[] columns)
+ throws WHException;
+
+ /** Drop a table */
+ public void dropTable(String name)
+ throws WHException;
+
+ /** Find an index */
+ public WHIndex lookupIndex(String name)
+ throws WHException;
+
+ /** Create an index */
+ public WHIndex createIndex(String name, String tableName, String[] columnNames, String[] comparatorClasses)
+ throws WHException;
+
+ /** Drop an index */
+ public void dropIndex(String name)
+ throws WHException;
+
+ /** Perform a query */
+ public WHQueryResult performQuery(WHQueryDescription specification)
+ throws WHException;
+
+}
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTableStore.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTableStore.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTransaction.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTransaction.java?rev=1199794&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTransaction.java (added)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTransaction.java Wed Nov 9 15:28:08 2011
@@ -0,0 +1,44 @@
+/* $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.interfaces;
+
+/** This interface represents a transaction that is in progress.
+*/
+public interface WHTransaction
+{
+ /** Set a value. May be null. */
+ public void put(WHKey key, WHValue value)
+ throws WHException;
+
+ /** Get a value. Null returned if no value. */
+ public WHValue get(WHKey key)
+ throws WHException;
+
+ /** Check to see if this transaction has become inconsistent.
+ * If so, a WHDeadlockException is thrown.
+ */
+ public void check()
+ throws WHException;
+
+ /** Commit this transaction. If the transaction is inconsistent,
+ * a WHDeadlockException will be thrown. */
+ public void commit()
+ throws WHException;
+}
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTransaction.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTransaction.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTransactionalStore.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTransactionalStore.java?rev=1199794&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTransactionalStore.java (added)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTransactionalStore.java Wed Nov 9 15:28:08 2011
@@ -0,0 +1,30 @@
+/* $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.interfaces;
+
+/** 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/src/main/java/org/apache/warthog/interfaces/WHTransactionalStore.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHTransactionalStore.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHValue.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHValue.java?rev=1199794&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHValue.java (added)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHValue.java Wed Nov 9 15:28:08 2011
@@ -0,0 +1,42 @@
+/* $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.interfaces;
+
+/** 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
+* with the object's serialized byte array as the sole argument.
+*/
+public interface WHValue
+{
+ /** Fetch the class of the object.
+ */
+ //public Class getClass();
+
+ /** Calculate the serialized value of the object.
+ */
+ public byte[] serializeObject();
+
+ /** Determine if the value is equal to another. This must be implemented
+ * in order to support transactions.
+ */
+ public boolean equals(Object o);
+
+}
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHValue.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHValue.java
------------------------------------------------------------------------------
svn:keywords = Id