Permalink
Browse files

[jdbc-driver] Remove obselete JDBC classes from base package (previou…

…sly moved to `acolyte.jdbc`).
  • Loading branch information...
cchantep
cchantep committed Aug 7, 2014
1 parent 5af9be4 commit e9c5c4777cdfa00ea5a3dfe88cf9ac7bfc8f242f
Showing with 22 additions and 11,398 deletions.
  1. +0 −200 jdbc-driver/src/main/java/acolyte/AbstractCompositeHandler.java
  2. +0 −1,708 jdbc-driver/src/main/java/acolyte/AbstractResultSet.java
  3. +0 −662 jdbc-driver/src/main/java/acolyte/AbstractStatement.java
  4. +0 −1,426 jdbc-driver/src/main/java/acolyte/CallableStatement.java
  5. +0 −110 jdbc-driver/src/main/java/acolyte/Column.java
  6. +0 −98 jdbc-driver/src/main/java/acolyte/CompositeHandler.java
  7. +0 −801 jdbc-driver/src/main/java/acolyte/Connection.java
  8. +0 −44 jdbc-driver/src/main/java/acolyte/ConnectionHandler.java
  9. +0 −1,747 jdbc-driver/src/main/java/acolyte/DatabaseMetaData.java
  10. +0 −198 jdbc-driver/src/main/java/acolyte/Defaults.java
  11. +0 −242 jdbc-driver/src/main/java/acolyte/Driver.java
  12. +0 −283 jdbc-driver/src/main/java/acolyte/ImmutableArray.java
  13. +0 −412 jdbc-driver/src/main/java/acolyte/ParameterMetaData.java
  14. +0 −973 jdbc-driver/src/main/java/acolyte/PreparedStatement.java
  15. +0 −103 jdbc-driver/src/main/java/acolyte/QueryResult.java
  16. +0 −29 jdbc-driver/src/main/java/acolyte/Result.java
  17. +0 −28 jdbc-driver/src/main/java/acolyte/Row.java
  18. +0 −91 jdbc-driver/src/main/java/acolyte/Row1.java
  19. +0 −1,515 jdbc-driver/src/main/java/acolyte/RowList.java
  20. +0 −101 jdbc-driver/src/main/java/acolyte/Savepoint.java
  21. +0 −146 jdbc-driver/src/main/java/acolyte/StatementHandler.java
  22. +0 −111 jdbc-driver/src/main/java/acolyte/UpdateResult.java
  23. +1 −1 jdbc-driver/src/main/java/acolyte/jdbc/AbstractCompositeHandler.java
  24. +1 −1 jdbc-driver/src/main/java/acolyte/jdbc/CompositeHandler.java
  25. +1 −1 jdbc-driver/src/test/scala/acolyte/jdbc/AbstractResultSetSpec.scala
  26. +0 −297 jdbc-scala/src/main/scala/Acolyte.scala
  27. +0 −53 jdbc-scala/src/main/scala/Execution.scala
  28. +10 −9 project/JdbcDriver.scala
  29. +8 −7 project/JdbcScala.scala
  30. +1 −1 src/site/markdown/scala.md
@@ -1,200 +0,0 @@
package acolyte;
import java.util.List;
import java.util.regex.Pattern;
import java.sql.SQLException;
import java.sql.ResultSet;
import acolyte.StatementHandler.Parameter;
/**
* Base for rule-based (immutable/thread-safe) statement handler.
*
* @author Cedric Chantepie
* @deprecated Use {@link acolyte.jdbc.AbstractCompositeHandler}
*/
@Deprecated
public abstract class AbstractCompositeHandler<T extends AbstractCompositeHandler> implements StatementHandler {
// --- Properties ---
/**
* Query (ordered) detection patterns
*/
protected final Pattern[] queryDetection;
/**
* Query handler
*/
protected final QueryHandler queryHandler;
/**
* Update handler
*/
protected final UpdateHandler updateHandler;
// --- Constructors ---
/**
* Constructor
*/
protected AbstractCompositeHandler() {
this.queryDetection = new Pattern[0];
this.queryHandler = null;
this.updateHandler = null;
} // end of <init>
/**
* Copy constructor.
*/
protected AbstractCompositeHandler(final Pattern[] queryDetection,
final QueryHandler queryHandler,
final UpdateHandler updateHandler) {
this.queryDetection = (queryDetection == null) ?
new Pattern[0] : queryDetection;
this.queryHandler = queryHandler;
this.updateHandler = updateHandler;
} // end of <init>
// ---
/**
* {@inheritDoc}
*/
public QueryResult whenSQLQuery(final String sql,
final List<Parameter> parameters)
throws SQLException {
if (this.queryHandler == null) {
throw new SQLException("No query handler");
} // end of if
return this.queryHandler.apply(sql, parameters);
} // end of whenSQLQuery
/**
* {@inheritDoc}
*/
public UpdateResult whenSQLUpdate(final String sql,
final List<Parameter> parameters)
throws SQLException {
if (this.updateHandler == null) {
throw new SQLException("No update handler: " + sql);
} // end of if
return this.updateHandler.apply(sql, parameters);
} // end of whenSQLUpdate
/**
* {@inheritDoc}
*/
public boolean isQuery(final String sql) {
for (final Pattern p : queryDetection) {
if (p.matcher(sql).lookingAt()) {
return true;
} // end of if
} // end of for
return false;
} // end of isQuery
// ---
/**
* Returns an new handler based on this one, but including given
* query detection |pattern|. If there is already existing pattern,
* the new one will be used after.
*
* @param pattern Query detection pattern list
* @throws java.util.regex.PatternSyntaxException If |pattern| is invalid
* @see #withQueryDetection(java.util.regex.Pattern)
*/
public T withQueryDetection(final String... pattern) {
if (pattern == null) {
throw new IllegalArgumentException();
} // end of if
// ---
final Pattern[] ps = new Pattern[pattern.length];
int i = 0;
for (final String p : pattern) {
ps[i++] = Pattern.compile(p);
} // end of for
return withQueryDetection(ps);
} // end of withQueryDetection
/**
* Returns an new handler based on this one, but including given
* query detection |pattern|. If there is already existing pattern,
* the new one will be used after.
*
* @param pattern Query detection pattern
* @throws IllegalArgumentException if pattern is null
*/
public abstract T withQueryDetection(final Pattern[] pattern);
/**
* Appends given |pattern| to current query detection.
*
* @throws IllegalArgumentException if pattern is null
*/
protected Pattern[] queryDetectionPattern(final Pattern... pattern) {
if (pattern == null) {
throw new IllegalArgumentException();
} // end of if
// ---
if (this.queryDetection == null) {
return pattern;
} // end of if
// ---
final Pattern[] patterns =
new Pattern[this.queryDetection.length + pattern.length];
System.arraycopy(this.queryDetection, 0,
patterns, 0,
this.queryDetection.length);
int i = this.queryDetection.length;
for (final Pattern p : pattern) {
patterns[i++] = p;
} // end of for
return patterns;
} // end of queryDetectionPattern
// --- Inner classes ---
/**
* Query handler.
*/
public static interface QueryHandler {
public QueryResult apply(String sql, List<Parameter> parameters) throws SQLException;
} // end of interfaceQueryHandler
/**
* Update handler.
*/
public static interface UpdateHandler {
/**
* Handles update.
*
* @return Update count
*/
public UpdateResult apply(String sql, List<Parameter> parameters)
throws SQLException;
} // end of interfaceQueryHandler
} // end of class AbstractCompositeHandler
Oops, something went wrong.

0 comments on commit e9c5c47

Please sign in to comment.