cosmetic changes

This commit is contained in:
Jörg Prante 2022-08-03 12:18:56 +02:00
parent 1c1a1ed55a
commit bd9d8b4009
25 changed files with 31 additions and 1545 deletions

View file

@ -1,6 +1,6 @@
group = org.xbib
name = database
version = 0.0.4
version = 0.0.5
org.gradle.warning.mode = ALL

View file

@ -168,9 +168,6 @@ public class Pool implements BagStateListener {
return config;
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
return poolName;
@ -339,9 +336,6 @@ public class Pool implements BagStateListener {
}
}
/**
* {@inheritDoc}
*/
@Override
public void addBagItem(final int waiting) {
final boolean shouldAdd = waiting - addConnectionQueueReadOnlyView.size() >= 0;
@ -955,13 +949,9 @@ public class Pool implements BagStateListener {
} else if (paramClass == boolean.class || paramClass == Boolean.class) {
writeMethod.invoke(target, Boolean.parseBoolean(propValue.toString()));
} else if (paramClass == String.class) {
logger.log(Level.FINE, () ->
MessageFormat.format("write method {0} {1}", target, propValue));
writeMethod.invoke(target, propValue.toString());
} else {
try {
logger.log(Level.FINE, () ->
MessageFormat.format("try to create a new instance of {0}", propValue));
writeMethod.invoke(target, Class.forName(propValue.toString()).getDeclaredConstructor().newInstance());
} catch (InstantiationException | ClassNotFoundException e) {
logger.log(Level.FINE, () ->

View file

@ -661,6 +661,6 @@ public class PoolConfig {
}
private static String generatePoolName() {
return "xbib-pool-jdbc-" + POOL_COUNTER.getAndIncrement();
return "xbib-jdbc-" + POOL_COUNTER.getAndIncrement();
}
}

View file

@ -43,9 +43,6 @@ public class PoolDataSource implements DataSource, Closeable {
return pool;
}
/**
* {@inheritDoc}
*/
@Override
public Connection getConnection() throws SQLException {
if (isClosed()) {
@ -70,26 +67,17 @@ public class PoolDataSource implements DataSource, Closeable {
return result.getConnection();
}
/**
* {@inheritDoc}
*/
@Override
public Connection getConnection(String username, String password) throws SQLException {
throw new SQLFeatureNotSupportedException();
}
/**
* {@inheritDoc}
*/
@Override
public PrintWriter getLogWriter() throws SQLException {
Pool p = pool;
return (p != null ? p.getUnwrappedDataSource().getLogWriter() : null);
}
/**
* {@inheritDoc}
*/
@Override
public void setLogWriter(PrintWriter out) throws SQLException {
Pool p = pool;
@ -98,9 +86,6 @@ public class PoolDataSource implements DataSource, Closeable {
}
}
/**
* {@inheritDoc}
*/
@Override
public void setLoginTimeout(int seconds) throws SQLException {
Pool p = pool;
@ -109,26 +94,17 @@ public class PoolDataSource implements DataSource, Closeable {
}
}
/**
* {@inheritDoc}
*/
@Override
public int getLoginTimeout() throws SQLException {
Pool p = pool;
return (p != null ? p.getUnwrappedDataSource().getLoginTimeout() : 0);
}
/**
* {@inheritDoc}
*/
@Override
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
throw new SQLFeatureNotSupportedException();
}
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("unchecked")
public <T> T unwrap(Class<T> iface) throws SQLException {
@ -148,9 +124,6 @@ public class PoolDataSource implements DataSource, Closeable {
throw new SQLException("wrapped DataSource is not an instance of " + iface);
}
/**
* {@inheritDoc}
*/
@Override
public boolean isWrapperFor(Class<?> iface) throws SQLException {
if (iface.isInstance(this)) {
@ -214,9 +187,6 @@ public class PoolDataSource implements DataSource, Closeable {
return isShutdown.get();
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
return "PoolDataSource (" + pool + ")";

View file

@ -113,9 +113,6 @@ public class PoolEntry implements BagEntry {
return ClockSource.elapsedMillis(lastBorrowed);
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
final long now = ClockSource.currentTime();
@ -124,25 +121,16 @@ public class PoolEntry implements BagEntry {
+ stateToString();
}
/**
* {@inheritDoc}
*/
@Override
public int getState() {
return stateUpdater.get(this);
}
/**
* {@inheritDoc}
*/
@Override
public boolean compareAndSet(int expect, int update) {
return stateUpdater.compareAndSet(this, expect, update);
}
/**
* {@inheritDoc}
*/
@Override
public void setState(int update) {
stateUpdater.set(this, update);

View file

@ -83,6 +83,7 @@ public class ProxyCallableStatement extends ProxyPreparedStatement implements Ca
return ((CallableStatement) delegate).getDouble(parameterIndex);
}
@SuppressWarnings("deprecation")
@Override
public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException {
return ((CallableStatement) delegate).getBigDecimal(parameterIndex, scale);

View file

@ -112,10 +112,6 @@ public class ProxyConnection implements Connection {
return isCommitStateDirty;
}
/**
*
* {@inheritDoc}
*/
@Override
public final String toString() {
return getClass().getSimpleName() + '@' + System.identityHashCode(this) + " wrapping " + delegate;
@ -215,9 +211,6 @@ public class ProxyConnection implements Connection {
}
}
/**
* {@inheritDoc}
*/
@Override
public void close() throws SQLException {
closeStatements();
@ -249,42 +242,26 @@ public class ProxyConnection implements Connection {
}
}
/**
* {@inheritDoc}
*/
@Override
public boolean isClosed() throws SQLException {
return delegate == CLOSED_CONNECTION;
}
/**
* {@inheritDoc}
*/
@Override
public Statement createStatement() throws SQLException {
return ProxyFactory.getProxyStatement(this, trackStatement(delegate.createStatement()));
}
/**
* {@inheritDoc}
*/
@Override
public Statement createStatement(int resultSetType, int concurrency) throws SQLException {
return ProxyFactory.getProxyStatement(this, trackStatement(delegate.createStatement(resultSetType, concurrency)));
}
/**
* {@inheritDoc}
*/
@Override
public Statement createStatement(int resultSetType, int concurrency, int holdability) throws SQLException {
return ProxyFactory.getProxyStatement(this, trackStatement(delegate.createStatement(resultSetType, concurrency, holdability)));
}
/**
* {@inheritDoc}
*/
@Override
public CallableStatement prepareCall(String sql) throws SQLException {
return ProxyFactory.getProxyCallableStatement(this, trackStatement(delegate.prepareCall(sql)));
@ -295,9 +272,6 @@ public class ProxyConnection implements Connection {
return delegate.nativeSQL(sql);
}
/**
* {@inheritDoc}
*/
@Override
public CallableStatement prepareCall(String sql, int resultSetType, int concurrency) throws SQLException {
return ProxyFactory.getProxyCallableStatement(this, trackStatement(delegate.prepareCall(sql, resultSetType, concurrency)));
@ -333,57 +307,36 @@ public class ProxyConnection implements Connection {
return delegate.setSavepoint(name);
}
/**
* {@inheritDoc}
*/
@Override
public CallableStatement prepareCall(String sql, int resultSetType, int concurrency, int holdability) throws SQLException {
return ProxyFactory.getProxyCallableStatement(this, trackStatement(delegate.prepareCall(sql, resultSetType, concurrency, holdability)));
}
/**
* {@inheritDoc}
*/
@Override
public PreparedStatement prepareStatement(String sql) throws SQLException {
return ProxyFactory.getProxyPreparedStatement(this, trackStatement(delegate.prepareStatement(sql)));
}
/**
* {@inheritDoc}
*/
@Override
public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
return ProxyFactory.getProxyPreparedStatement(this, trackStatement(delegate.prepareStatement(sql, autoGeneratedKeys)));
}
/**
* {@inheritDoc}
*/
@Override
public PreparedStatement prepareStatement(String sql, int resultSetType, int concurrency) throws SQLException {
return ProxyFactory.getProxyPreparedStatement(this, trackStatement(delegate.prepareStatement(sql, resultSetType, concurrency)));
}
/**
* {@inheritDoc}
*/
@Override
public PreparedStatement prepareStatement(String sql, int resultSetType, int concurrency, int holdability) throws SQLException {
return ProxyFactory.getProxyPreparedStatement(this, trackStatement(delegate.prepareStatement(sql, resultSetType, concurrency, holdability)));
}
/**
* {@inheritDoc}
*/
@Override
public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
return ProxyFactory.getProxyPreparedStatement(this, trackStatement(delegate.prepareStatement(sql, columnIndexes)));
}
/**
* {@inheritDoc}
*/
@Override
public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
return ProxyFactory.getProxyPreparedStatement(this, trackStatement(delegate.prepareStatement(sql, columnNames)));
@ -444,18 +397,12 @@ public class ProxyConnection implements Connection {
return delegate.createStruct(typeName, attributes);
}
/**
* {@inheritDoc}
*/
@Override
public DatabaseMetaData getMetaData() throws SQLException {
markCommitStateDirty();
return ProxyFactory.getProxyDatabaseMetaData(this, delegate.getMetaData());
}
/**
* {@inheritDoc}
*/
@Override
public void commit() throws SQLException {
delegate.commit();
@ -463,9 +410,6 @@ public class ProxyConnection implements Connection {
lastAccess = ClockSource.currentTime();
}
/**
* {@inheritDoc}
*/
@Override
public void rollback() throws SQLException {
delegate.rollback();
@ -473,9 +417,6 @@ public class ProxyConnection implements Connection {
lastAccess = ClockSource.currentTime();
}
/**
* {@inheritDoc}
*/
@Override
public void rollback(Savepoint savepoint) throws SQLException {
delegate.rollback(savepoint);
@ -488,9 +429,6 @@ public class ProxyConnection implements Connection {
delegate.releaseSavepoint(savepoint);
}
/**
* {@inheritDoc}
*/
@Override
public void setAutoCommit(boolean autoCommit) throws SQLException {
delegate.setAutoCommit(autoCommit);
@ -503,9 +441,6 @@ public class ProxyConnection implements Connection {
return delegate.getAutoCommit();
}
/**
* {@inheritDoc}
*/
@Override
public void setReadOnly(boolean readOnly) throws SQLException {
delegate.setReadOnly(readOnly);
@ -519,9 +454,6 @@ public class ProxyConnection implements Connection {
return delegate.isReadOnly();
}
/**
* {@inheritDoc}
*/
@Override
public void setTransactionIsolation(int level) throws SQLException {
delegate.setTransactionIsolation(level);
@ -544,9 +476,6 @@ public class ProxyConnection implements Connection {
delegate.clearWarnings();
}
/**
* {@inheritDoc}
*/
@Override
public void setCatalog(String catalog) throws SQLException {
delegate.setCatalog(catalog);
@ -559,9 +488,6 @@ public class ProxyConnection implements Connection {
return delegate.getCatalog();
}
/**
* {@inheritDoc}
*/
@Override
public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException {
delegate.setNetworkTimeout(executor, milliseconds);
@ -574,9 +500,6 @@ public class ProxyConnection implements Connection {
return delegate.getNetworkTimeout();
}
/**
* {@inheritDoc}
*/
@Override
public void setSchema(String schema) throws SQLException {
delegate.setSchema(schema);
@ -594,17 +517,11 @@ public class ProxyConnection implements Connection {
delegate.abort(executor);
}
/**
* {@inheritDoc}
*/
@Override
public final boolean isWrapperFor(Class<?> iface) throws SQLException {
return iface.isInstance(delegate) || (delegate != null && delegate.isWrapperFor(iface));
}
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("unchecked")
public <T> T unwrap(Class<T> iface) throws SQLException {

View file

@ -23,18 +23,12 @@ public class ProxyDatabaseMetaData implements DatabaseMetaData {
return connection.checkException(e);
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
final String delegateToString = delegate.toString();
return this.getClass().getSimpleName() + '@' + System.identityHashCode(this) + " wrapping " + delegateToString;
}
/**
* {@inheritDoc}
*/
@Override
public Connection getConnection() {
return connection;
@ -1035,9 +1029,6 @@ public class ProxyDatabaseMetaData implements DatabaseMetaData {
return delegate.generatedKeyAlwaysReturned();
}
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("unchecked")
public <T> T unwrap(Class<T> iface) throws SQLException {

View file

@ -55,9 +55,6 @@ public class ProxyLeakTask implements Runnable {
scheduledFuture = executorService.schedule(this, leakDetectionThreshold, TimeUnit.MILLISECONDS);
}
/**
* {@inheritDoc}
*/
@Override
public void run() {
isLeaked = true;

View file

@ -30,9 +30,6 @@ public class ProxyPreparedStatement extends ProxyStatement implements PreparedSt
super(connection, statement);
}
/**
* {@inheritDoc}
*/
@Override
public boolean execute() throws SQLException {
connection.markCommitStateDirty();
@ -199,9 +196,6 @@ public class ProxyPreparedStatement extends ProxyStatement implements PreparedSt
((PreparedStatement) delegate).setNClob(parameterIndex, reader);
}
/**
* {@inheritDoc}
*/
@Override
public ResultSet executeQuery() throws SQLException {
connection.markCommitStateDirty();
@ -209,9 +203,6 @@ public class ProxyPreparedStatement extends ProxyStatement implements PreparedSt
return ProxyFactory.getProxyResultSet(connection, this, resultSet);
}
/**
* {@inheritDoc}
*/
@Override
public int executeUpdate() throws SQLException {
connection.markCommitStateDirty();
@ -293,6 +284,7 @@ public class ProxyPreparedStatement extends ProxyStatement implements PreparedSt
((PreparedStatement) delegate).setAsciiStream(parameterIndex, x, length);
}
@SuppressWarnings("deprecation")
@Override
public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException {
((PreparedStatement) delegate).setUnicodeStream(parameterIndex, x, length);
@ -318,9 +310,6 @@ public class ProxyPreparedStatement extends ProxyStatement implements PreparedSt
((PreparedStatement) delegate).setObject(parameterIndex, x);
}
/**
* {@inheritDoc}
*/
@Override
public long executeLargeUpdate() throws SQLException {
connection.markCommitStateDirty();

View file

@ -43,17 +43,11 @@ public class ProxyResultSet implements ResultSet {
return delegate;
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
return this.getClass().getSimpleName() + '@' + System.identityHashCode(this) + " wrapping " + delegate;
}
/**
* {@inheritDoc}
*/
@Override
public Statement getStatement() throws SQLException {
return statement;
@ -439,9 +433,6 @@ public class ProxyResultSet implements ResultSet {
return delegate.getObject(columnLabel, type);
}
/**
* {@inheritDoc}
*/
@Override
public void updateRow() throws SQLException {
connection.markCommitStateDirty();
@ -503,6 +494,7 @@ public class ProxyResultSet implements ResultSet {
return delegate.getDouble(columnIndex);
}
@SuppressWarnings("deprecation")
@Override
public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException {
return delegate.getBigDecimal(columnIndex);
@ -533,6 +525,7 @@ public class ProxyResultSet implements ResultSet {
return delegate.getAsciiStream(columnIndex);
}
@SuppressWarnings("deprecation")
@Override
public InputStream getUnicodeStream(int columnIndex) throws SQLException {
return delegate.getUnicodeStream(columnIndex);
@ -583,6 +576,7 @@ public class ProxyResultSet implements ResultSet {
return delegate.getDouble(columnLabel);
}
@SuppressWarnings("deprecation")
@Override
public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException {
return delegate.getBigDecimal(columnLabel, scale);
@ -613,6 +607,7 @@ public class ProxyResultSet implements ResultSet {
return delegate.getAsciiStream(columnLabel);
}
@SuppressWarnings("deprecation")
@Override
public InputStream getUnicodeStream(String columnLabel) throws SQLException {
return delegate.getUnicodeStream(columnLabel);
@ -973,18 +968,12 @@ public class ProxyResultSet implements ResultSet {
delegate.updateObject(columnLabel, x);
}
/**
* {@inheritDoc}
*/
@Override
public void insertRow() throws SQLException {
connection.markCommitStateDirty();
delegate.insertRow();
}
/**
* {@inheritDoc}
*/
@Override
public void deleteRow() throws SQLException {
connection.markCommitStateDirty();
@ -1011,9 +1000,6 @@ public class ProxyResultSet implements ResultSet {
delegate.moveToCurrentRow();
}
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("unchecked")
public final <T> T unwrap(Class<T> iface) throws SQLException {

View file

@ -33,18 +33,12 @@ public class ProxyStatement implements Statement {
return connection.checkException(e);
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
final String delegateToString = delegate.toString();
return this.getClass().getSimpleName() + '@' + System.identityHashCode(this) + " wrapping " + delegateToString;
}
/**
* {@inheritDoc}
*/
@Override
public void close() throws SQLException {
synchronized (this) {
@ -116,9 +110,6 @@ public class ProxyStatement implements Statement {
delegate.setCursorName(name);
}
/**
* {@inheritDoc}
*/
@Override
public Connection getConnection() throws SQLException {
return connection;
@ -129,27 +120,18 @@ public class ProxyStatement implements Statement {
return delegate.getMoreResults(current);
}
/**
* {@inheritDoc}
*/
@Override
public boolean execute(String sql) throws SQLException {
connection.markCommitStateDirty();
return delegate.execute(sql);
}
/**
* {@inheritDoc}
*/
@Override
public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
connection.markCommitStateDirty();
return delegate.execute(sql, autoGeneratedKeys);
}
/**
* {@inheritDoc}
*/
@Override
public ResultSet executeQuery(String sql) throws SQLException {
connection.markCommitStateDirty();
@ -157,63 +139,42 @@ public class ProxyStatement implements Statement {
return ProxyFactory.getProxyResultSet(connection, this, resultSet);
}
/**
* {@inheritDoc}
*/
@Override
public int executeUpdate(String sql) throws SQLException {
connection.markCommitStateDirty();
return delegate.executeUpdate(sql);
}
/**
* {@inheritDoc}
*/
@Override
public int[] executeBatch() throws SQLException {
connection.markCommitStateDirty();
return delegate.executeBatch();
}
/**
* {@inheritDoc}
*/
@Override
public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
connection.markCommitStateDirty();
return delegate.executeUpdate(sql, autoGeneratedKeys);
}
/**
* {@inheritDoc}
*/
@Override
public int executeUpdate(String sql, int[] columnIndexes) throws SQLException {
connection.markCommitStateDirty();
return delegate.executeUpdate(sql, columnIndexes);
}
/**
* {@inheritDoc}
*/
@Override
public int executeUpdate(String sql, String[] columnNames) throws SQLException {
connection.markCommitStateDirty();
return delegate.executeUpdate(sql, columnNames);
}
/**
* {@inheritDoc}
*/
@Override
public boolean execute(String sql, int[] columnIndexes) throws SQLException {
connection.markCommitStateDirty();
return delegate.execute(sql, columnIndexes);
}
/**
* {@inheritDoc}
*/
@Override
public boolean execute(String sql, String[] columnNames) throws SQLException {
connection.markCommitStateDirty();
@ -250,54 +211,36 @@ public class ProxyStatement implements Statement {
return delegate.isCloseOnCompletion();
}
/**
* {@inheritDoc}
*/
@Override
public long[] executeLargeBatch() throws SQLException {
connection.markCommitStateDirty();
return delegate.executeLargeBatch();
}
/**
* {@inheritDoc}
*/
@Override
public long executeLargeUpdate(String sql) throws SQLException {
connection.markCommitStateDirty();
return delegate.executeLargeUpdate(sql);
}
/**
* {@inheritDoc}
*/
@Override
public long executeLargeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
connection.markCommitStateDirty();
return delegate.executeLargeUpdate(sql, autoGeneratedKeys);
}
/**
* {@inheritDoc}
*/
@Override
public long executeLargeUpdate(String sql, int[] columnIndexes) throws SQLException {
connection.markCommitStateDirty();
return delegate.executeLargeUpdate(sql, columnIndexes);
}
/**
* {@inheritDoc}
*/
@Override
public long executeLargeUpdate(String sql, String[] columnNames) throws SQLException {
connection.markCommitStateDirty();
return delegate.executeLargeUpdate(sql, columnNames);
}
/**
* {@inheritDoc}
*/
@Override
public ResultSet getResultSet() throws SQLException {
final ResultSet resultSet = delegate.getResultSet();
@ -361,9 +304,6 @@ public class ProxyStatement implements Statement {
delegate.clearBatch();
}
/**
* {@inheritDoc}
*/
@Override
public ResultSet getGeneratedKeys() throws SQLException {
ResultSet resultSet = delegate.getGeneratedKeys();
@ -373,9 +313,6 @@ public class ProxyStatement implements Statement {
return proxyResultSet;
}
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("unchecked")
public final <T> T unwrap(Class<T> iface) throws SQLException {

View file

@ -4,6 +4,10 @@ package org.xbib.jdbc.connection.pool.util;
* Factory class used to create a platform-specific ClockSource.
*/
public class ClockSourceFactory {
public ClockSourceFactory() {
}
public static ClockSource create() {
return new NanosecondClockSource();
}

View file

@ -137,17 +137,11 @@ public final class FastList<T> implements List<T>, RandomAccess {
return size;
}
/**
* {@inheritDoc}
*/
@Override
public boolean isEmpty() {
return size == 0;
}
/**
* {@inheritDoc}
*/
@Override
public T set(int index, T element) {
T old = elementData[index];
@ -155,9 +149,6 @@ public final class FastList<T> implements List<T>, RandomAccess {
return old;
}
/**
* {@inheritDoc}
*/
@Override
public T remove(int index) {
if (size == 0) {
@ -172,17 +163,11 @@ public final class FastList<T> implements List<T>, RandomAccess {
return old;
}
/**
* {@inheritDoc}
*/
@Override
public boolean contains(Object o) {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
@Override
public Iterator<T> iterator() {
return new Iterator<>() {
@ -203,153 +188,96 @@ public final class FastList<T> implements List<T>, RandomAccess {
};
}
/**
* {@inheritDoc}
*/
@Override
public Object[] toArray() {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
@Override
public <E> E[] toArray(E[] a) {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
@Override
public boolean containsAll(Collection<?> c) {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
@Override
public boolean addAll(Collection<? extends T> c) {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
@Override
public boolean addAll(int index, Collection<? extends T> c) {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
@Override
public boolean removeAll(Collection<?> c) {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
@Override
public boolean retainAll(Collection<?> c) {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
@Override
public void add(int index, T element) {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
@Override
public int indexOf(Object o) {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
@Override
public int lastIndexOf(Object o) {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
@Override
public ListIterator<T> listIterator() {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
@Override
public ListIterator<T> listIterator(int index) {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
@Override
public List<T> subList(int fromIndex, int toIndex) {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
@Override
public Object clone() {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
@Override
public void forEach(Consumer<? super T> action) {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
@Override
public Spliterator<T> spliterator() {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
@Override
public boolean removeIf(Predicate<? super T> filter) {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
@Override
public void replaceAll(UnaryOperator<T> operator) {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
@Override
public void sort(Comparator<? super T> c) {
throw new UnsupportedOperationException();

View file

@ -3,73 +3,50 @@ package org.xbib.jdbc.connection.pool.util;
import java.util.concurrent.TimeUnit;
public class NanosecondClockSource implements ClockSource {
/**
* {@inheritDoc}
*/
public NanosecondClockSource() {
}
@Override
public long currentTime0() {
return System.nanoTime();
}
/**
* {@inheritDoc}
*/
@Override
public long toMillis0(final long time) {
return TimeUnit.NANOSECONDS.toMillis(time);
}
/**
* {@inheritDoc}
*/
@Override
public long toNanos0(final long time) {
return time;
}
/**
* {@inheritDoc}
*/
@Override
public long elapsedMillis0(final long startTime) {
return TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime);
}
/**
* {@inheritDoc}
*/
@Override
public long elapsedMillis0(final long startTime, final long endTime) {
return TimeUnit.NANOSECONDS.toMillis(endTime - startTime);
}
/**
* {@inheritDoc}
*/
@Override
public long elapsedNanos0(final long startTime) {
return System.nanoTime() - startTime;
}
/**
* {@inheritDoc}
*/
@Override
public long elapsedNanos0(final long startTime, final long endTime) {
return endTime - startTime;
}
/**
* {@inheritDoc}
*/
@Override
public long plusMillis0(final long time, final long millis) {
return time + TimeUnit.MILLISECONDS.toNanos(millis);
}
/**
* {@inheritDoc}
*/
@Override
public TimeUnit getSourceTimeUnit0() {
return TimeUnit.NANOSECONDS;

View file

@ -9,9 +9,6 @@ public abstract class StubBaseConnection implements Connection {
public volatile boolean throwException;
/**
* {@inheritDoc}
*/
@Override
public Statement createStatement() throws SQLException {
if (throwException) {
@ -20,9 +17,6 @@ public abstract class StubBaseConnection implements Connection {
return new StubStatement(this);
}
/**
* {@inheritDoc}
*/
@Override
public PreparedStatement prepareStatement(String sql) throws SQLException {
if (throwException) {

View file

@ -48,9 +48,6 @@ public class StubConnection extends StubBaseConnection implements Connection {
}
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public <T> T unwrap(Class<T> iface) throws SQLException {
@ -65,9 +62,6 @@ public class StubConnection extends StubBaseConnection implements Connection {
throw new SQLException("Wrapped connection is not an instance of " + iface);
}
/**
* {@inheritDoc}
*/
@Override
public boolean isWrapperFor(Class<?> iface) throws SQLException {
if (throwException) {
@ -76,9 +70,6 @@ public class StubConnection extends StubBaseConnection implements Connection {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public CallableStatement prepareCall(String sql) throws SQLException {
if (throwException) {
@ -87,17 +78,11 @@ public class StubConnection extends StubBaseConnection implements Connection {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public String nativeSQL(String sql) throws SQLException {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public void setAutoCommit(boolean autoCommit) throws SQLException {
if (throwException) {
@ -106,41 +91,26 @@ public class StubConnection extends StubBaseConnection implements Connection {
this.autoCommit = autoCommit;
}
/**
* {@inheritDoc}
*/
@Override
public boolean getAutoCommit() throws SQLException {
return autoCommit;
}
/**
* {@inheritDoc}
*/
@Override
public void commit() throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void rollback() throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void close() throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public boolean isClosed() throws SQLException {
if (throwException) {
@ -149,17 +119,11 @@ public class StubConnection extends StubBaseConnection implements Connection {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public DatabaseMetaData getMetaData() throws SQLException {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public void setReadOnly(boolean readOnly) throws SQLException {
if (throwException) {
@ -167,9 +131,6 @@ public class StubConnection extends StubBaseConnection implements Connection {
}
}
/**
* {@inheritDoc}
*/
@Override
public boolean isReadOnly() throws SQLException {
if (throwException) {
@ -178,9 +139,6 @@ public class StubConnection extends StubBaseConnection implements Connection {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public void setCatalog(String catalog) throws SQLException {
if (throwException) {
@ -189,17 +147,11 @@ public class StubConnection extends StubBaseConnection implements Connection {
this.catalog = catalog;
}
/**
* {@inheritDoc}
*/
@Override
public String getCatalog() throws SQLException {
return catalog;
}
/**
* {@inheritDoc}
*/
@Override
public void setTransactionIsolation(int level) throws SQLException {
if (throwException) {
@ -208,25 +160,16 @@ public class StubConnection extends StubBaseConnection implements Connection {
this.isolation = level;
}
/**
* {@inheritDoc}
*/
@Override
public int getTransactionIsolation() throws SQLException {
return isolation;
}
/**
* {@inheritDoc}
*/
@Override
public SQLWarning getWarnings() throws SQLException {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public void clearWarnings() throws SQLException {
if (throwException) {
@ -234,9 +177,6 @@ public class StubConnection extends StubBaseConnection implements Connection {
}
}
/**
* {@inheritDoc}
*/
@Override
public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
if (throwException) {
@ -245,9 +185,6 @@ public class StubConnection extends StubBaseConnection implements Connection {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
if (throwException) {
@ -256,9 +193,6 @@ public class StubConnection extends StubBaseConnection implements Connection {
return new StubPreparedStatement(this);
}
/**
* {@inheritDoc}
*/
@Override
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
if (throwException) {
@ -267,69 +201,42 @@ public class StubConnection extends StubBaseConnection implements Connection {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public Map<String, Class<?>> getTypeMap() throws SQLException {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setHoldability(int holdability) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public int getHoldability() throws SQLException {
return (int) foo;
}
/**
* {@inheritDoc}
*/
@Override
public Savepoint setSavepoint() throws SQLException {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public Savepoint setSavepoint(String name) throws SQLException {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public void rollback(Savepoint savepoint) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void releaseSavepoint(Savepoint savepoint) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
if (throwException) {
@ -338,9 +245,6 @@ public class StubConnection extends StubBaseConnection implements Connection {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
if (throwException) {
@ -349,9 +253,6 @@ public class StubConnection extends StubBaseConnection implements Connection {
return new StubPreparedStatement(this);
}
/**
* {@inheritDoc}
*/
@Override
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
if (throwException) {
@ -360,9 +261,6 @@ public class StubConnection extends StubBaseConnection implements Connection {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
if (throwException) {
@ -371,9 +269,6 @@ public class StubConnection extends StubBaseConnection implements Connection {
return new StubPreparedStatement(this);
}
/**
* {@inheritDoc}
*/
@Override
public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
if (throwException) {
@ -382,9 +277,6 @@ public class StubConnection extends StubBaseConnection implements Connection {
return new StubPreparedStatement(this);
}
/**
* {@inheritDoc}
*/
@Override
public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
if (throwException) {
@ -393,41 +285,26 @@ public class StubConnection extends StubBaseConnection implements Connection {
return new StubPreparedStatement(this);
}
/**
* {@inheritDoc}
*/
@Override
public Clob createClob() throws SQLException {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public Blob createBlob() throws SQLException {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public NClob createNClob() throws SQLException {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public SQLXML createSQLXML() throws SQLException {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public boolean isValid(int timeout) throws SQLException {
if (throwException) {
@ -436,81 +313,48 @@ public class StubConnection extends StubBaseConnection implements Connection {
return true;
}
/**
* {@inheritDoc}
*/
@Override
public void setClientInfo(String name, String value) throws SQLClientInfoException {
}
/**
* {@inheritDoc}
*/
@Override
public void setClientInfo(Properties properties) throws SQLClientInfoException {
}
/**
* {@inheritDoc}
*/
@Override
public String getClientInfo(String name) throws SQLException {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public Properties getClientInfo() throws SQLException {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
return null;
}
/**
* {@inheritDoc}
*/
public void setSchema(String schema) throws SQLException {
}
/**
* {@inheritDoc}
*/
public String getSchema() throws SQLException {
return null;
}
/**
* {@inheritDoc}
*/
public void abort(Executor executor) throws SQLException {
throw new SQLException("Intentional exception during abort");
}
/**
* {@inheritDoc}
*/
public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException {
}
/**
* {@inheritDoc}
*/
public int getNetworkTimeout() throws SQLException {
if (oldDriver) {
throw new AbstractMethodError();

View file

@ -36,48 +36,30 @@ public class StubDataSource implements DataSource {
// we don't care
}
/**
* {@inheritDoc}
*/
@Override
public PrintWriter getLogWriter() throws SQLException {
return logWriter;
}
/**
* {@inheritDoc}
*/
@Override
public void setLogWriter(PrintWriter out) throws SQLException {
this.logWriter = out;
}
/**
* {@inheritDoc}
*/
@Override
public void setLoginTimeout(int seconds) throws SQLException {
this.loginTimeout = seconds;
}
/**
* {@inheritDoc}
*/
@Override
public int getLoginTimeout() throws SQLException {
return loginTimeout;
}
/**
* {@inheritDoc}
*/
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
return null;
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public <T> T unwrap(Class<T> iface) throws SQLException {
@ -87,17 +69,11 @@ public class StubDataSource implements DataSource {
throw new SQLException("wrapped DataSource is not an instance of " + iface);
}
/**
* {@inheritDoc}
*/
@Override
public boolean isWrapperFor(Class<?> iface) throws SQLException {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public Connection getConnection() throws SQLException {
if (throwException != null) {
@ -109,9 +85,6 @@ public class StubDataSource implements DataSource {
return new StubConnection();
}
/**
* {@inheritDoc}
*/
@Override
public Connection getConnection(String username, String password) throws SQLException {
return new StubConnection();

View file

@ -10,6 +10,7 @@ import java.util.Properties;
import java.util.logging.Logger;
public class StubDriver implements Driver {
private static final Driver driver;
static {
@ -21,57 +22,36 @@ public class StubDriver implements Driver {
}
}
/**
* {@inheritDoc}
*/
@Override
public Connection connect(String url, Properties info) throws SQLException {
return new StubConnection();
}
/**
* {@inheritDoc}
*/
@Override
public boolean acceptsURL(String url) throws SQLException {
return "jdbc:stub".equals(url);
}
/**
* {@inheritDoc}
*/
@Override
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public int getMajorVersion() {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public int getMinorVersion() {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public boolean jdbcCompliant() {
return true;
}
/**
* {@inheritDoc}
*/
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
return null;
}

View file

@ -29,130 +29,79 @@ public class StubPreparedStatement extends StubStatement implements PreparedStat
super(connection);
}
/**
* {@inheritDoc}
*/
@Override
public ResultSet executeQuery(String sql) throws SQLException {
return new StubResultSet();
}
/**
* {@inheritDoc}
*/
@Override
public int executeUpdate(String sql) throws SQLException {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public int getMaxFieldSize() throws SQLException {
throw new SQLException("Simulated disconnection error", "08999");
}
/**
* {@inheritDoc}
*/
@Override
public void setMaxFieldSize(int max) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public int getMaxRows() throws SQLException {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public void setMaxRows(int max) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setEscapeProcessing(boolean enable) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public int getQueryTimeout() throws SQLException {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public void setQueryTimeout(int seconds) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void cancel() throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public SQLWarning getWarnings() throws SQLException {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public void clearWarnings() throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setCursorName(String name) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public boolean execute(String sql) throws SQLException {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public ResultSet getResultSet() throws SQLException {
return new StubResultSet();
}
/**
* {@inheritDoc}
*/
@Override
public int getUpdateCount() throws SQLException {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public boolean getMoreResults() throws SQLException {
if (isClosed()) {
@ -161,179 +110,110 @@ public class StubPreparedStatement extends StubStatement implements PreparedStat
return false;
}
/**
* {@inheritDoc}
*/
@Override
public void setFetchDirection(int direction) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public int getFetchDirection() throws SQLException {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public void setFetchSize(int rows) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public int getFetchSize() throws SQLException {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public int getResultSetConcurrency() throws SQLException {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public int getResultSetType() throws SQLException {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public void addBatch(String sql) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void clearBatch() throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public int[] executeBatch() throws SQLException {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public boolean getMoreResults(int current) throws SQLException {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public ResultSet getGeneratedKeys() throws SQLException {
return new StubResultSet();
}
/**
* {@inheritDoc}
*/
@Override
public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public int executeUpdate(String sql, int[] columnIndexes) throws SQLException {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public int executeUpdate(String sql, String[] columnNames) throws SQLException {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public boolean execute(String sql, int[] columnIndexes) throws SQLException {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public boolean execute(String sql, String[] columnNames) throws SQLException {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public int getResultSetHoldability() throws SQLException {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public void setPoolable(boolean poolable) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public boolean isPoolable() throws SQLException {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public void closeOnCompletion() throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public boolean isCloseOnCompletion() throws SQLException {
return false;
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public <T> T unwrap(Class<T> iface) throws SQLException {
@ -344,401 +224,233 @@ public class StubPreparedStatement extends StubStatement implements PreparedStat
throw new SQLException("Wrapped connection is not an instance of " + iface);
}
/**
* {@inheritDoc}
*/
@Override
public boolean isWrapperFor(Class<?> iface) throws SQLException {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public ResultSet executeQuery() throws SQLException {
return new StubResultSet();
}
/**
* {@inheritDoc}
*/
@Override
public int executeUpdate() throws SQLException {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public void setNull(int parameterIndex, int sqlType) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setBoolean(int parameterIndex, boolean x) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setByte(int parameterIndex, byte x) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setShort(int parameterIndex, short x) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setInt(int parameterIndex, int x) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setLong(int parameterIndex, long x) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setFloat(int parameterIndex, float x) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setDouble(int parameterIndex, double x) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setString(int parameterIndex, String x) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setBytes(int parameterIndex, byte[] x) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setDate(int parameterIndex, Date x) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setTime(int parameterIndex, Time x) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("deprecation")
public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void clearParameters() throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setObject(int parameterIndex, Object x) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public boolean execute() throws SQLException {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public void addBatch() throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setRef(int parameterIndex, Ref x) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setBlob(int parameterIndex, Blob x) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setClob(int parameterIndex, Clob x) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setArray(int parameterIndex, Array x) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public ResultSetMetaData getMetaData() throws SQLException {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setURL(int parameterIndex, URL x) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public ParameterMetaData getParameterMetaData() throws SQLException {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public void setRowId(int parameterIndex, RowId x) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setNString(int parameterIndex, String value) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setNClob(int parameterIndex, NClob value) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setClob(int parameterIndex, Reader reader, long length) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setClob(int parameterIndex, Reader reader) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException {
}
/**
* {@inheritDoc}
*/
@Override
public void setNClob(int parameterIndex, Reader reader) throws SQLException {
}

View file

@ -23,9 +23,6 @@ public class StubStatement implements Statement {
simulatedQueryTime = time;
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public <T> T unwrap(Class<T> iface) throws SQLException {
@ -33,95 +30,62 @@ public class StubStatement implements Statement {
return (T) this;
}
/**
* {@inheritDoc}
*/
@Override
public boolean isWrapperFor(Class<?> iface) throws SQLException {
checkClosed();
return false;
}
/**
* {@inheritDoc}
*/
@Override
public ResultSet executeQuery(String sql) throws SQLException {
checkClosed();
return new StubResultSet();
}
/**
* {@inheritDoc}
*/
@Override
public int executeUpdate(String sql) throws SQLException {
checkClosed();
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public void close() throws SQLException {
closed = true;
}
/**
* {@inheritDoc}
*/
@Override
public int getMaxFieldSize() throws SQLException {
checkClosed();
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public void setMaxFieldSize(int max) throws SQLException {
checkClosed();
}
/**
* {@inheritDoc}
*/
@Override
public int getMaxRows() throws SQLException {
checkClosed();
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public void setMaxRows(int max) throws SQLException {
checkClosed();
}
/**
* {@inheritDoc}
*/
@Override
public void setEscapeProcessing(boolean enable) throws SQLException {
checkClosed();
}
/**
* {@inheritDoc}
*/
@Override
public int getQueryTimeout() throws SQLException {
checkClosed();
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public void setQueryTimeout(int seconds) throws SQLException {
if (oldDriver) {
@ -131,42 +95,27 @@ public class StubStatement implements Statement {
checkClosed();
}
/**
* {@inheritDoc}
*/
@Override
public void cancel() throws SQLException {
checkClosed();
}
/**
* {@inheritDoc}
*/
@Override
public SQLWarning getWarnings() throws SQLException {
checkClosed();
return null;
}
/**
* {@inheritDoc}
*/
@Override
public void clearWarnings() throws SQLException {
checkClosed();
}
/**
* {@inheritDoc}
*/
@Override
public void setCursorName(String name) throws SQLException {
checkClosed();
}
/**
* {@inheritDoc}
*/
@Override
public boolean execute(String sql) throws SQLException {
checkClosed();
@ -176,235 +125,155 @@ public class StubStatement implements Statement {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public ResultSet getResultSet() throws SQLException {
checkClosed();
return new StubResultSet();
}
/**
* {@inheritDoc}
*/
@Override
public int getUpdateCount() throws SQLException {
checkClosed();
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public boolean getMoreResults() throws SQLException {
checkClosed();
return false;
}
/**
* {@inheritDoc}
*/
@Override
public void setFetchDirection(int direction) throws SQLException {
checkClosed();
}
/**
* {@inheritDoc}
*/
@Override
public int getFetchDirection() throws SQLException {
checkClosed();
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public void setFetchSize(int rows) throws SQLException {
checkClosed();
}
/**
* {@inheritDoc}
*/
@Override
public int getFetchSize() throws SQLException {
checkClosed();
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public int getResultSetConcurrency() throws SQLException {
checkClosed();
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public int getResultSetType() throws SQLException {
checkClosed();
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public void addBatch(String sql) throws SQLException {
checkClosed();
}
/**
* {@inheritDoc}
*/
@Override
public void clearBatch() throws SQLException {
checkClosed();
}
/**
* {@inheritDoc}
*/
@Override
public int[] executeBatch() throws SQLException {
checkClosed();
return null;
}
/**
* {@inheritDoc}
*/
@Override
public Connection getConnection() throws SQLException {
checkClosed();
return connection;
}
/**
* {@inheritDoc}
*/
@Override
public boolean getMoreResults(int current) throws SQLException {
checkClosed();
return false;
}
/**
* {@inheritDoc}
*/
@Override
public ResultSet getGeneratedKeys() throws SQLException {
checkClosed();
return new StubResultSet();
}
/**
* {@inheritDoc}
*/
@Override
public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
checkClosed();
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public int executeUpdate(String sql, int[] columnIndexes) throws SQLException {
checkClosed();
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public int executeUpdate(String sql, String[] columnNames) throws SQLException {
checkClosed();
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
checkClosed();
return false;
}
/**
* {@inheritDoc}
*/
@Override
public boolean execute(String sql, int[] columnIndexes) throws SQLException {
checkClosed();
return false;
}
/**
* {@inheritDoc}
*/
@Override
public boolean execute(String sql, String[] columnNames) throws SQLException {
checkClosed();
return false;
}
/**
* {@inheritDoc}
*/
@Override
public int getResultSetHoldability() throws SQLException {
checkClosed();
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public boolean isClosed() throws SQLException {
return closed;
}
/**
* {@inheritDoc}
*/
@Override
public void setPoolable(boolean poolable) throws SQLException {
checkClosed();
}
/**
* {@inheritDoc}
*/
@Override
public boolean isPoolable() throws SQLException {
checkClosed();
return false;
}
/**
* {@inheritDoc}
*/
public void closeOnCompletion() throws SQLException {
checkClosed();
}
/**
* {@inheritDoc}
*/
@Override
public boolean isCloseOnCompletion() throws SQLException {
checkClosed();
return false;

View file

@ -29,6 +29,9 @@ public class Schema {
private String userTableName = "user_principal";
public Schema() {
}
public Sequence addSequence(String name) {
Sequence sequence = new Sequence(name);
sequences.add(sequence);

View file

@ -19,8 +19,12 @@ import java.util.Set;
* various arg*() calls and replay them later via the apply(sqlArgs) methods.
*/
public class SqlArgs implements SqlInsert.Apply, SqlUpdate.Apply, SqlSelect.Apply {
private final List<Invocation> invocations = new ArrayList<>();
public SqlArgs() {
}
public static Builder fromMetadata(Row r) {
return new Builder(r);
}

View file

@ -5,9 +5,14 @@ package org.xbib.jdbc.query;
* in terms of commit/rollback.
*/
public class TransactionImpl implements Transaction {
private boolean rollbackOnError;
private boolean rollbackOnly;
public TransactionImpl() {
}
@Override
public boolean isRollbackOnError() {
return rollbackOnError;