summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--README.md29
-rw-r--r--RELEASE-NOTES.txt9
-rw-r--r--pom.xml7
-rw-r--r--src/main/java/com/amazon/carbonado/Cursor.java3
-rw-r--r--src/main/java/com/amazon/carbonado/Transaction.java8
-rw-r--r--src/main/java/com/amazon/carbonado/repo/logging/LoggingTransaction.java5
-rw-r--r--src/main/java/com/amazon/carbonado/repo/replicated/ReadOnlyTransaction.java7
-rw-r--r--src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableBuilder.java7
-rw-r--r--src/main/java/com/amazon/carbonado/txn/TransactionPair.java5
-rw-r--r--src/main/java/com/amazon/carbonado/txn/TransactionScope.java11
-rw-r--r--src/main/java/com/amazon/carbonado/util/BelatedCreationException.java2
12 files changed, 47 insertions, 47 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ea8c4bf
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/target
diff --git a/README.md b/README.md
index 3016dd5..942ebdc 100644
--- a/README.md
+++ b/README.md
@@ -11,35 +11,6 @@ On the surface, it may appear that Carbonado types are defined like POJOs. The
Carbonado is able to achieve high performance by imposing very low overhead when accessing the actual storage. Low overhead is achieved in part by auto generating performance critical code, via the Cojen library.
-
-Version 1.2
-------------
-
-Carbonado 1.2 adds many new features, which are summarized here and in the [release notes](RELEASE-NOTES.txt).
-
-* General features
- * Loads and queries can invoke [triggers](http://carbonado.github.io/Carbonado/apidocs/com/amazon/carbonado/Trigger.html#afterLoad%28S%29).
- * Added support for [derived](http://carbonado.github.io/Carbonado/apidocs/com/amazon/carbonado/Derived.html) properties.
- * Storable property values can be accessed by [name](http://carbonado.github.io/Carbonado/apidocs/com/amazon/carbonado/Storable.html#getPropertyValue%28java.lang.String%29) in addition to the direct method.
-
-* Repositories
- * New [volatile repository](http://carbonado.github.io/Carbonado/apidocs/com/amazon/carbonado/repo/map/MapRepositoryBuilder.html) provided, backed by a [ConcurrentSkipListMap](http://java.sun.com/javase/6/docs/api/java/util/concurrent/ConcurrentSkipListMap.html}ConcurrentSkipListMap).
- * Replicated repository resync operation allows a [listener](http://carbonado.github.io/Carbonado/apidocs/com/amazon/carbonado/capability/ResyncCapability.html#resync%28java.lang.Class,%20com.amazon.carbonado.capability.ResyncCapability.Listener,%20double,%20java.lang.String,%20java.lang.Object...%29) to be installed which can monitor progress or make changes.
- * Berkeley DB repositories add support for BigInteger and BigDecimal property types.
-* JDBC features
- * Created [@Automatic](http://carbonado.github.io/Carbonado/apidocs/com/amazon/carbonado/Automatic.html) annotation, which enables MySQL auto-increment columns.
- * Added [sequence support](http://carbonado.github.io/Carbonado/apidocs/com/amazon/carbonado/sequence/StoredSequence.html) for SQL databases that don't natively support sequences.
- * Support for [automatic version management](http://carbonado.github.io/Carbonado/apidocs/com/amazon/carbonado/repo/jdbc/JDBCRepositoryBuilder.html#setAutoVersioningEnabled%28boolean,%20java.lang.String%29) eliminating the requirement that triggers be installed on the database.
- * More lenient with respect to column mappings: numbers and dates can represented by Strings; character data type supported; non-null column can be marked as @Nullable if also @Independent.
-
-* Query engine features
- * Added [Query.fetchSlice](http://carbonado.github.io/Carbonado/apidocs/com/amazon/carbonado/Query.html#fetchSlice%28long,%20java.lang.Long%29) method for supporting limits and offsets.
- * Derived properties can be indexed, allowing function and join indexes to be defined.
- * Added support for "where exists" and outer joins in queries via new syntax. This is explained in the "Queries with joins" section of the [User Guide](http://carbonado.github.io/Carbonado/docs/CarbonadoGuide.pdf).
- * Added convenience method, [Query.exists](http://carbonado.github.io/Carbonado/apidocs/com/amazon/carbonado/Query.html#exists%28%29).
- * Optimizations for covering indexes when using Berkeley DB.
-
-
Packages
---------
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index aefa52a..e910fdf 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -1,5 +1,5 @@
-Carbonado version 1.2.2
------------------------
+Carbonado version 1.3
+---------------------
Carbonado is an extensible, high performance persistence abstraction layer for
Java applications with a relational view to the underlying persistence
@@ -11,6 +11,11 @@ https://github.com/Carbonado/Carbonado/
Carbonado change history
------------------------
+1.3
+-------------------------------
+- Depends on Java 7.
+- Added AutoCloseable support for Cursor and Transaction.
+
1.2.1 to 1.2.2
-------------------------------
- Added remote access support including remote procedures.
diff --git a/pom.xml b/pom.xml
index 71a8a0f..565f5e9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
<artifactId>carbonado</artifactId>
<packaging>jar</packaging>
<name>Carbonado</name>
- <version>1.2.3</version>
+ <version>1.3</version>
<description>
Extensible, high performance persistence abstraction layer for Java applications with a relational view to the underlying persistence technology.
</description>
@@ -195,9 +195,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
+ <version>3.1</version>
<configuration>
- <source>1.5</source>
- <target>1.5</target>
+ <source>1.7</source>
+ <target>1.7</target>
</configuration>
</plugin>
</plugins>
diff --git a/src/main/java/com/amazon/carbonado/Cursor.java b/src/main/java/com/amazon/carbonado/Cursor.java
index c7e4404..2740611 100644
--- a/src/main/java/com/amazon/carbonado/Cursor.java
+++ b/src/main/java/com/amazon/carbonado/Cursor.java
@@ -48,11 +48,12 @@ import java.util.NoSuchElementException;
* @author Brian S O'Neill
* @author Don Schneider
*/
-public interface Cursor<S> {
+public interface Cursor<S> extends AutoCloseable {
/**
* Call close to release any resources being held by this cursor. Further
* operations on this cursor will behave as if there are no results.
*/
+ @Override
void close() throws FetchException;
/**
diff --git a/src/main/java/com/amazon/carbonado/Transaction.java b/src/main/java/com/amazon/carbonado/Transaction.java
index 876c7be..6d4a9d9 100644
--- a/src/main/java/com/amazon/carbonado/Transaction.java
+++ b/src/main/java/com/amazon/carbonado/Transaction.java
@@ -61,7 +61,7 @@ import java.util.concurrent.TimeUnit;
*
* @author Brian S O'Neill
*/
-public interface Transaction {
+public interface Transaction extends AutoCloseable {
/**
* If currently in a transaction, commits all changes to the storage layer
* since the last commit within the transaction.
@@ -159,4 +159,10 @@ public interface Transaction {
* @return false if transaction has exited
*/
boolean preCommit() throws PersistException;
+
+ /**
+ * Calls {@link #exit exit}, for compatibility with AutoCloseable.
+ * @throws PersistException
+ */
+ void close() throws PersistException;
}
diff --git a/src/main/java/com/amazon/carbonado/repo/logging/LoggingTransaction.java b/src/main/java/com/amazon/carbonado/repo/logging/LoggingTransaction.java
index e2b080c..5141d6e 100644
--- a/src/main/java/com/amazon/carbonado/repo/logging/LoggingTransaction.java
+++ b/src/main/java/com/amazon/carbonado/repo/logging/LoggingTransaction.java
@@ -102,6 +102,11 @@ class LoggingTransaction implements Transaction {
return mTxn.preCommit();
}
+ @Override
+ public void close() throws PersistException {
+ exit();
+ }
+
private String idChain() {
if (mParent == null) {
return String.valueOf(mID);
diff --git a/src/main/java/com/amazon/carbonado/repo/replicated/ReadOnlyTransaction.java b/src/main/java/com/amazon/carbonado/repo/replicated/ReadOnlyTransaction.java
index 1666bf4..d3649ba 100644
--- a/src/main/java/com/amazon/carbonado/repo/replicated/ReadOnlyTransaction.java
+++ b/src/main/java/com/amazon/carbonado/repo/replicated/ReadOnlyTransaction.java
@@ -25,7 +25,7 @@ import com.amazon.carbonado.PersistException;
import com.amazon.carbonado.Transaction;
/**
- * ReadOnlyTransaction wraps an another transaction. It's only function is to
+ * ReadOnlyTransaction wraps an another transaction. Its only function is to
* serve as a marker for the ReplicatedStorage triggers that no write
* operations are allowed.
*
@@ -87,5 +87,10 @@ class ReadOnlyTransaction implements Transaction {
public String toString() {
return "ReadOnlyTransaction wrapping { " + mTxn.toString() + " }";
}
+
+ @Override
+ public void close() throws PersistException {
+ exit();
+ }
}
diff --git a/src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableBuilder.java b/src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableBuilder.java
index 9463785..3d9aaa4 100644
--- a/src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableBuilder.java
+++ b/src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableBuilder.java
@@ -422,12 +422,7 @@ public class SyntheticStorableBuilder
}
/**
- * @param annotator
- * source of annotation (eg, makeAnnotation and makeMemberValue)
- * @param indexes
- * @param position
- * @param annotationClass TODO
- * @return
+ * @param annotator source of annotation (eg, makeAnnotation and makeMemberValue)
*/
private Annotation addIndex(Annotation annotator,
Annotation.MemberValue[] indexes,
diff --git a/src/main/java/com/amazon/carbonado/txn/TransactionPair.java b/src/main/java/com/amazon/carbonado/txn/TransactionPair.java
index f719a79..e247661 100644
--- a/src/main/java/com/amazon/carbonado/txn/TransactionPair.java
+++ b/src/main/java/com/amazon/carbonado/txn/TransactionPair.java
@@ -110,4 +110,9 @@ public class TransactionPair implements Transaction {
public boolean preCommit() throws PersistException {
return mPrimaryTransaction.preCommit() ? mSecondaryTransaction.preCommit() : false;
}
+
+ @Override
+ public void close() throws PersistException {
+ exit();
+ }
}
diff --git a/src/main/java/com/amazon/carbonado/txn/TransactionScope.java b/src/main/java/com/amazon/carbonado/txn/TransactionScope.java
index 6e94b91..6061c62 100644
--- a/src/main/java/com/amazon/carbonado/txn/TransactionScope.java
+++ b/src/main/java/com/amazon/carbonado/txn/TransactionScope.java
@@ -216,7 +216,7 @@ public class TransactionScope<Txn> {
mLock.unlock();
}
}
-
+
/**
* Returns the implementation for the active transaction, only if it exists.
* (does not create a transaction like getTxn()
@@ -323,10 +323,10 @@ public class TransactionScope<Txn> {
mLock.unlock();
return;
}
-
+
Map<Class<?>, CursorList<TransactionImpl<Txn>>> cursors;
try {
- cursors = mCursors;
+ cursors = mCursors;
// Ensure that map is freed promptly. Thread-local reference to
// this scope otherwise keeps map and its contents lingering around
@@ -427,6 +427,11 @@ public class TransactionScope<Txn> {
}
}
+ @Override
+ public void close() throws PersistException {
+ exit();
+ }
+
public void commit() throws PersistException {
TransactionScope<Txn> scope = mScope;
scope.mLock.lock();
diff --git a/src/main/java/com/amazon/carbonado/util/BelatedCreationException.java b/src/main/java/com/amazon/carbonado/util/BelatedCreationException.java
index ea27e20..e9e3cad 100644
--- a/src/main/java/com/amazon/carbonado/util/BelatedCreationException.java
+++ b/src/main/java/com/amazon/carbonado/util/BelatedCreationException.java
@@ -9,7 +9,7 @@ package com.amazon.carbonado.util;
* Exception throw when attempting to perform an unavailable operation on an
* object undergoing belated creation.
*
- * @see com.amazon.carbonado.util.BelatedCreator;
+ * @see BelatedCreator
*
* @author Jesse Morgan (morganjm)
*/