summaryrefslogtreecommitdiff
path: root/src/main/java/com/amazon/carbonado/repo/jdbc
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2008-05-06 13:52:12 +0000
committerBrian S. O'Neill <bronee@gmail.com>2008-05-06 13:52:12 +0000
commitab92f4ec859413b2d3612068dfb21d741fb389a3 (patch)
tree110ab1c9c6b08bd1acf40b1ac0e3192caa38cc93 /src/main/java/com/amazon/carbonado/repo/jdbc
parent6087388aca5eb50054732c2f606fa21165e88b75 (diff)
Code cleanup: add @Override annotations, remove unused imports, remove dead code and add @Deprecated annotations.
Diffstat (limited to 'src/main/java/com/amazon/carbonado/repo/jdbc')
-rw-r--r--src/main/java/com/amazon/carbonado/repo/jdbc/CompositeStatement.java2
-rw-r--r--src/main/java/com/amazon/carbonado/repo/jdbc/H2ExceptionTransformer.java1
-rw-r--r--src/main/java/com/amazon/carbonado/repo/jdbc/JDBCBlob.java3
-rw-r--r--src/main/java/com/amazon/carbonado/repo/jdbc/JDBCClob.java4
-rw-r--r--src/main/java/com/amazon/carbonado/repo/jdbc/JDBCCursor.java1
-rw-r--r--src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepository.java6
-rw-r--r--src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepositoryBuilder.java1
-rw-r--r--src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableIntrospector.java9
-rw-r--r--src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorage.java9
-rw-r--r--src/main/java/com/amazon/carbonado/repo/jdbc/JDBCTransactionManager.java5
-rw-r--r--src/main/java/com/amazon/carbonado/repo/jdbc/JoinNode.java1
-rw-r--r--src/main/java/com/amazon/carbonado/repo/jdbc/LiteralStatement.java2
-rw-r--r--src/main/java/com/amazon/carbonado/repo/jdbc/MysqlExceptionTransformer.java1
-rw-r--r--src/main/java/com/amazon/carbonado/repo/jdbc/NullablePropertyStatement.java2
-rw-r--r--src/main/java/com/amazon/carbonado/repo/jdbc/OracleExceptionTransformer.java2
-rw-r--r--src/main/java/com/amazon/carbonado/repo/jdbc/OracleSupportStrategy.java10
-rw-r--r--src/main/java/com/amazon/carbonado/repo/jdbc/SQLStatement.java1
17 files changed, 49 insertions, 11 deletions
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/CompositeStatement.java b/src/main/java/com/amazon/carbonado/repo/jdbc/CompositeStatement.java
index 48b81e5..a431ed3 100644
--- a/src/main/java/com/amazon/carbonado/repo/jdbc/CompositeStatement.java
+++ b/src/main/java/com/amazon/carbonado/repo/jdbc/CompositeStatement.java
@@ -37,6 +37,7 @@ class CompositeStatement<S extends Storable> extends SQLStatement<S> {
mStatements = statements.toArray(new SQLStatement[statements.size()]);
}
+ @Override
public int maxLength() {
int max = 0;
for (SQLStatement<S> statement : mStatements) {
@@ -45,6 +46,7 @@ class CompositeStatement<S extends Storable> extends SQLStatement<S> {
return max;
}
+ @Override
public void appendTo(StringBuilder b, FilterValues<S> filterValues) {
for (SQLStatement<S> statement : mStatements) {
statement.appendTo(b, filterValues);
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/H2ExceptionTransformer.java b/src/main/java/com/amazon/carbonado/repo/jdbc/H2ExceptionTransformer.java
index e367cb0..4fe3733 100644
--- a/src/main/java/com/amazon/carbonado/repo/jdbc/H2ExceptionTransformer.java
+++ b/src/main/java/com/amazon/carbonado/repo/jdbc/H2ExceptionTransformer.java
@@ -29,6 +29,7 @@ import java.sql.SQLException;
class H2ExceptionTransformer extends JDBCExceptionTransformer {
public static int DUPLICATE_KEY = 23001;
+ @Override
public boolean isUniqueConstraintError(SQLException e) {
return DUPLICATE_KEY == e.getErrorCode();
}
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCBlob.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCBlob.java
index 18d1eb4..cb3b7ae 100644
--- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCBlob.java
+++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCBlob.java
@@ -173,6 +173,7 @@ class JDBCBlob extends AbstractBlob implements JDBCLob {
mPos = pos;
}
+ @Override
public int read() throws IOException {
if (fillBuffer() <= 0) {
return -1;
@@ -180,6 +181,7 @@ class JDBCBlob extends AbstractBlob implements JDBCLob {
return mBuffer[mBufferPos++];
}
+ @Override
public int read(byte[] b, int off, int len) throws IOException {
int avail = fillBuffer();
if (avail <= 0) {
@@ -193,6 +195,7 @@ class JDBCBlob extends AbstractBlob implements JDBCLob {
return len;
}
+ @Override
public long skip(long n) throws IOException {
if (n <= 0) {
return 0;
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCClob.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCClob.java
index dc254bb..efbbe61 100644
--- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCClob.java
+++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCClob.java
@@ -173,6 +173,7 @@ class JDBCClob extends AbstractClob implements JDBCLob {
mPos = pos;
}
+ @Override
public int read() throws IOException {
if (fillBuffer() <= 0) {
return -1;
@@ -180,6 +181,7 @@ class JDBCClob extends AbstractClob implements JDBCLob {
return mBuffer.charAt(mBufferPos++);
}
+ @Override
public int read(char[] c, int off, int len) throws IOException {
int avail = fillBuffer();
if (avail <= 0) {
@@ -193,6 +195,7 @@ class JDBCClob extends AbstractClob implements JDBCLob {
return len;
}
+ @Override
public long skip(long n) throws IOException {
if (n <= 0) {
return 0;
@@ -221,6 +224,7 @@ class JDBCClob extends AbstractClob implements JDBCLob {
return n;
}
+ @Override
public void close() {
}
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCCursor.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCCursor.java
index 985232c..4f31d2c 100644
--- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCCursor.java
+++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCCursor.java
@@ -112,6 +112,7 @@ class JDBCCursor<S extends Storable> extends AbstractCursor<S> {
}
}
+ @Override
public int skipNext(int amount) throws FetchException {
if (amount <= 0) {
if (amount < 0) {
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepository.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepository.java
index 75fde77..250b54e 100644
--- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepository.java
+++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepository.java
@@ -626,6 +626,7 @@ public class JDBCRepository extends AbstractRepository<JDBCTransaction>
return mExceptionTransformer;
}
+ @Override
protected void shutdownHook() {
// Close all open connections.
mOpenConnectionsLock.lock();
@@ -657,10 +658,12 @@ public class JDBCRepository extends AbstractRepository<JDBCTransaction>
}
}
+ @Override
protected Log getLog() {
return mLog;
}
+ @Override
protected <S extends Storable> Storage<S> createStorage(Class<S> type)
throws RepositoryException
{
@@ -696,16 +699,19 @@ public class JDBCRepository extends AbstractRepository<JDBCTransaction>
return new JDBCStorage<S>(this, info, autoVersioning, suppressReload);
}
+ @Override
protected SequenceValueProducer createSequenceValueProducer(String name)
throws RepositoryException
{
return mSupportStrategy.createSequenceValueProducer(name);
}
+ @Override
protected final TransactionManager<JDBCTransaction> transactionManager() {
return mTxnMgr;
}
+ @Override
protected final TransactionScope<JDBCTransaction> localTransactionScope() {
return mTxnMgr.localScope();
}
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepositoryBuilder.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepositoryBuilder.java
index 1fbe2dd..0421e28 100644
--- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepositoryBuilder.java
+++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepositoryBuilder.java
@@ -392,6 +392,7 @@ public class JDBCRepositoryBuilder extends AbstractRepositoryBuilder {
mForceStoredSequence = forceStoredSequence;
}
+ @Override
public void errorCheck(Collection<String> messages) throws ConfigurationException {
super.errorCheck(messages);
if (mDataSource == null) {
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableIntrospector.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableIntrospector.java
index e775cc9..b5d7bd8 100644
--- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableIntrospector.java
+++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableIntrospector.java
@@ -24,12 +24,10 @@ import java.lang.reflect.UndeclaredThrowableException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.Date;
import java.util.LinkedHashMap;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.TreeMap;
import java.math.BigDecimal;
@@ -447,7 +445,7 @@ public class JDBCStorableIntrospector extends StorableIntrospector {
for (StorableKey<S> altKey : mainInfo.getAlternateKeys()) {
if (matchesKey(pkProps, altKey)) {
// Okay. Primary key in database matches a Storable
- // alternate key.
+ // alternate key.
foundAnyAltKey = true;
// Also check that declared primary key is a strict subset
@@ -461,7 +459,7 @@ public class JDBCStorableIntrospector extends StorableIntrospector {
if (foundAnyAltKey) {
errorMessages.add("Actual primary key matches a declared alternate key, " +
- "but declared primary key must be a strict subset. " +
+ "but declared primary key must be a strict subset. " +
mainInfo.getPrimaryKey().getProperties() +
" is not a subset of " + pkProps);
} else {
@@ -1121,6 +1119,8 @@ public class JDBCStorableIntrospector extends StorableIntrospector {
* shorthand to disambiguate the class name.
*/
private static class JProperty<S extends Storable> implements JDBCStorableProperty<S> {
+ private static final long serialVersionUID = -7333912817502875485L;
+
private final StorableProperty<S> mMainProperty;
private final String mColumnName;
private final Integer mDataType;
@@ -1393,6 +1393,7 @@ public class JDBCStorableIntrospector extends StorableIntrospector {
return mExternal.clone();
}
+ @Override
public String toString() {
return mMainProperty.toString();
}
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorage.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorage.java
index 39d5a5a..d89a291 100644
--- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorage.java
+++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorage.java
@@ -25,8 +25,6 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -111,6 +109,7 @@ class JDBCStorage<S extends Storable> extends StandardQueryFactory<S>
(info.getStorableType(), repository.mTriggerFactories);
}
+ @Override
public Class<S> getStorableType() {
return mInfo.getStorableType();
}
@@ -292,6 +291,7 @@ class JDBCStorage<S extends Storable> extends StandardQueryFactory<S>
return mInfo;
}
+ @Override
protected StandardQuery<S> createQuery(Filter<S> filter,
FilterValues<S> values,
OrderingList<S> ordering,
@@ -780,6 +780,7 @@ class JDBCStorage<S extends Storable> extends StandardQueryFactory<S>
return mOrdering;
}
+ @Override
public boolean printNative(Appendable app, int indentLevel, FilterValues<S> values)
throws IOException
{
@@ -933,18 +934,22 @@ class JDBCStorage<S extends Storable> extends StandardQueryFactory<S>
}
}
+ @Override
protected Transaction enterTransaction(IsolationLevel level) {
return getRootRepository().enterTransaction(level);
}
+ @Override
protected QueryFactory<S> queryFactory() {
return JDBCStorage.this;
}
+ @Override
protected QueryExecutorFactory<S> executorFactory() {
return JDBCStorage.this.mExecutorFactory;
}
+ @Override
protected StandardQuery<S> newInstance(FilterValues<S> values, OrderingList<S> ordering,
QueryHints hints)
{
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCTransactionManager.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCTransactionManager.java
index ca63331..c499a6b 100644
--- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCTransactionManager.java
+++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCTransactionManager.java
@@ -45,6 +45,7 @@ class JDBCTransactionManager extends TransactionManager<JDBCTransaction> {
mRepositoryRef = new WeakReference<JDBCRepository>(repository);
}
+ @Override
protected IsolationLevel selectIsolationLevel(Transaction parent, IsolationLevel level) {
JDBCRepository repo = mRepositoryRef.get();
if (repo == null) {
@@ -53,11 +54,13 @@ class JDBCTransactionManager extends TransactionManager<JDBCTransaction> {
return repo.selectIsolationLevel(parent, level);
}
+ @Override
protected boolean supportsForUpdate() {
JDBCRepository repo = mRepositoryRef.get();
return repo != null && repo.supportsSelectForUpdate();
}
+ @Override
protected JDBCTransaction createTxn(JDBCTransaction parent, IsolationLevel level)
throws SQLException, FetchException
{
@@ -82,6 +85,7 @@ class JDBCTransactionManager extends TransactionManager<JDBCTransaction> {
txn.reuse();
}
+ @Override
protected boolean commitTxn(JDBCTransaction txn) throws PersistException {
try {
txn.commit();
@@ -91,6 +95,7 @@ class JDBCTransactionManager extends TransactionManager<JDBCTransaction> {
}
}
+ @Override
protected void abortTxn(JDBCTransaction txn) throws PersistException {
try {
Connection con;
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JoinNode.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JoinNode.java
index d5a2ba4..1337476 100644
--- a/src/main/java/com/amazon/carbonado/repo/jdbc/JoinNode.java
+++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JoinNode.java
@@ -191,6 +191,7 @@ class JoinNode {
mAliasRequired = true;
}
+ @Override
public String toString() {
StringBuilder b = new StringBuilder();
b.append("{table=");
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/LiteralStatement.java b/src/main/java/com/amazon/carbonado/repo/jdbc/LiteralStatement.java
index ceedd94..f53a6c7 100644
--- a/src/main/java/com/amazon/carbonado/repo/jdbc/LiteralStatement.java
+++ b/src/main/java/com/amazon/carbonado/repo/jdbc/LiteralStatement.java
@@ -34,6 +34,7 @@ class LiteralStatement<S extends Storable> extends SQLStatement<S> {
mStr = str;
}
+ @Override
public int maxLength() {
return mStr.length();
}
@@ -43,6 +44,7 @@ class LiteralStatement<S extends Storable> extends SQLStatement<S> {
return mStr;
}
+ @Override
public void appendTo(StringBuilder b, FilterValues<S> filterValues) {
b.append(mStr);
}
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/MysqlExceptionTransformer.java b/src/main/java/com/amazon/carbonado/repo/jdbc/MysqlExceptionTransformer.java
index 6b86757..3402bda 100644
--- a/src/main/java/com/amazon/carbonado/repo/jdbc/MysqlExceptionTransformer.java
+++ b/src/main/java/com/amazon/carbonado/repo/jdbc/MysqlExceptionTransformer.java
@@ -28,6 +28,7 @@ import java.sql.SQLException;
class MysqlExceptionTransformer extends JDBCExceptionTransformer {
public static int DUPLICATE_ENTRY = 1062;
+ @Override
public boolean isUniqueConstraintError(SQLException e) {
if (isConstraintError(e)) {
String sqlstate = e.getSQLState();
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/NullablePropertyStatement.java b/src/main/java/com/amazon/carbonado/repo/jdbc/NullablePropertyStatement.java
index 4c7e4db..6843c7a 100644
--- a/src/main/java/com/amazon/carbonado/repo/jdbc/NullablePropertyStatement.java
+++ b/src/main/java/com/amazon/carbonado/repo/jdbc/NullablePropertyStatement.java
@@ -37,10 +37,12 @@ class NullablePropertyStatement<S extends Storable> extends SQLStatement<S> {
mIsNullOp = isNullOp;
}
+ @Override
public int maxLength() {
return mIsNullOp ? 8 : 12; // for " IS NULL" or " IS NOT NULL"
}
+ @Override
public void appendTo(StringBuilder b, FilterValues<S> filterValues) {
if (filterValues != null
&& filterValues.getValue(mFilter) == null
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/OracleExceptionTransformer.java b/src/main/java/com/amazon/carbonado/repo/jdbc/OracleExceptionTransformer.java
index 6f3ff4a..cb633c2 100644
--- a/src/main/java/com/amazon/carbonado/repo/jdbc/OracleExceptionTransformer.java
+++ b/src/main/java/com/amazon/carbonado/repo/jdbc/OracleExceptionTransformer.java
@@ -30,6 +30,7 @@ class OracleExceptionTransformer extends JDBCExceptionTransformer {
public static int INSUFFICIENT_PRIVILEGES = 1031;
+ @Override
public boolean isUniqueConstraintError(SQLException e) {
if (isConstraintError(e)) {
String sqlstate = e.getSQLState();
@@ -40,6 +41,7 @@ class OracleExceptionTransformer extends JDBCExceptionTransformer {
return false;
}
+ @Override
public boolean isInsufficientPrivilegesError(SQLException e) {
if (e != null) {
int errorCode = e.getErrorCode();
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/OracleSupportStrategy.java b/src/main/java/com/amazon/carbonado/repo/jdbc/OracleSupportStrategy.java
index 4098933..2a0c9be 100644
--- a/src/main/java/com/amazon/carbonado/repo/jdbc/OracleSupportStrategy.java
+++ b/src/main/java/com/amazon/carbonado/repo/jdbc/OracleSupportStrategy.java
@@ -35,14 +35,14 @@ import com.amazon.carbonado.PersistException;
* @author bcastill
*/
class OracleSupportStrategy extends JDBCSupportStrategy {
-
+
private static final String DEFAULT_SEQUENCE_SELECT_STATEMENT = "SELECT %s.NEXTVAL FROM DUAL";
private static final String TRUNCATE_STATEMENT = "TRUNCATE TABLE %s";
-
+
private static final int LOB_CHUNK_LIMIT = 2000;
- private static final String PLAN_TABLE_NAME = "TEMP_CARBONADO_PLAN_TABLE";
+ //private static final String PLAN_TABLE_NAME = "TEMP_CARBONADO_PLAN_TABLE";
final Method mBLOB_empty_lob;
final Method mBLOB_getBinaryStream;
@@ -63,7 +63,7 @@ class OracleSupportStrategy extends JDBCSupportStrategy {
setSequenceSelectStatement(DEFAULT_SEQUENCE_SELECT_STATEMENT);
setTruncateTableStatement(TRUNCATE_STATEMENT);
-
+
// Access all the custom oracle.sql.BLOB methods via reflection.
{
Method blob_empty_lob = null;
@@ -104,7 +104,7 @@ class OracleSupportStrategy extends JDBCSupportStrategy {
try {
Class clobClass = Class.forName("oracle.sql.CLOB");
-
+
clob_empty_lob = clobClass.getMethod("empty_lob");
clob_getCharacterStream = clobClass.getMethod("getCharacterStream", long.class);
clob_length = clobClass.getMethod("length");
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/SQLStatement.java b/src/main/java/com/amazon/carbonado/repo/jdbc/SQLStatement.java
index 92308f7..4cfd5f5 100644
--- a/src/main/java/com/amazon/carbonado/repo/jdbc/SQLStatement.java
+++ b/src/main/java/com/amazon/carbonado/repo/jdbc/SQLStatement.java
@@ -49,6 +49,7 @@ abstract class SQLStatement<S extends Storable> {
/**
* Just used for debugging.
*/
+ @Override
public String toString() {
StringBuilder b = new StringBuilder();
appendTo(b, null);