A bunch of Eclipse appeasement.
This commit is contained in:
@@ -23,12 +23,27 @@ import static com.samskivert.Log.log;
|
|||||||
*/
|
*/
|
||||||
public abstract class BaseLiaison implements DatabaseLiaison
|
public abstract class BaseLiaison implements DatabaseLiaison
|
||||||
{
|
{
|
||||||
public BaseLiaison ()
|
public BaseLiaison () {
|
||||||
{
|
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // from DatabaseLiaison
|
// we override all the interface methods here so that our subclasses can use @Override without
|
||||||
|
// incurring the wrath of the Eclipse Java 1.5 compiler; Jesus Fuck, why do we support 1.5?
|
||||||
|
|
||||||
|
// from DatabaseLiaison
|
||||||
|
public abstract boolean matchesURL (String url);
|
||||||
|
|
||||||
|
// from DatabaseLiaison
|
||||||
|
public abstract boolean isDuplicateRowException (SQLException sqe);
|
||||||
|
|
||||||
|
// from DatabaseLiaison
|
||||||
|
public abstract boolean isTransientException (SQLException sqe);
|
||||||
|
|
||||||
|
// from DatabaseLiaison
|
||||||
|
public abstract int lastInsertedId (Connection conn, String table, String column)
|
||||||
|
throws SQLException;
|
||||||
|
|
||||||
|
// from DatabaseLiaison
|
||||||
public boolean tableExists (Connection conn, String name) throws SQLException
|
public boolean tableExists (Connection conn, String name) throws SQLException
|
||||||
{
|
{
|
||||||
ResultSet rs = conn.getMetaData().getTables(null, null, name, null);
|
ResultSet rs = conn.getMetaData().getTables(null, null, name, null);
|
||||||
@@ -41,7 +56,7 @@ public abstract class BaseLiaison implements DatabaseLiaison
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // from DatabaseLiaison
|
// from DatabaseLiaison
|
||||||
public boolean tableContainsColumn (Connection conn, String table, String column)
|
public boolean tableContainsColumn (Connection conn, String table, String column)
|
||||||
throws SQLException
|
throws SQLException
|
||||||
{
|
{
|
||||||
@@ -56,7 +71,7 @@ public abstract class BaseLiaison implements DatabaseLiaison
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // from DatabaseLiaison
|
// from DatabaseLiaison
|
||||||
public boolean tableContainsIndex (Connection conn, String table, String index)
|
public boolean tableContainsIndex (Connection conn, String table, String index)
|
||||||
throws SQLException
|
throws SQLException
|
||||||
{
|
{
|
||||||
@@ -71,7 +86,7 @@ public abstract class BaseLiaison implements DatabaseLiaison
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // from DatabaseLiaison
|
// from DatabaseLiaison
|
||||||
public boolean addIndexToTable (Connection conn, String table, List<String> columns,
|
public boolean addIndexToTable (Connection conn, String table, List<String> columns,
|
||||||
String ixName, boolean unique) throws SQLException
|
String ixName, boolean unique) throws SQLException
|
||||||
{
|
{
|
||||||
@@ -95,7 +110,7 @@ public abstract class BaseLiaison implements DatabaseLiaison
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // from DatabaseLiaison
|
// from DatabaseLiaison
|
||||||
public void addPrimaryKey (Connection conn, String table, List<String> columns)
|
public void addPrimaryKey (Connection conn, String table, List<String> columns)
|
||||||
throws SQLException
|
throws SQLException
|
||||||
{
|
{
|
||||||
@@ -108,20 +123,20 @@ public abstract class BaseLiaison implements DatabaseLiaison
|
|||||||
log.info("Primary key " + fields + " added to table '" + table + "'");
|
log.info("Primary key " + fields + " added to table '" + table + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // from DatabaseLiaison
|
// from DatabaseLiaison
|
||||||
public void dropIndex (Connection conn, String table, String index) throws SQLException
|
public void dropIndex (Connection conn, String table, String index) throws SQLException
|
||||||
{
|
{
|
||||||
executeQuery(conn, "DROP INDEX " + columnSQL(index));
|
executeQuery(conn, "DROP INDEX " + columnSQL(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // from DatabaseLiaison
|
// from DatabaseLiaison
|
||||||
public void dropPrimaryKey (Connection conn, String table, String pkName) throws SQLException
|
public void dropPrimaryKey (Connection conn, String table, String pkName) throws SQLException
|
||||||
{
|
{
|
||||||
executeQuery(conn, "ALTER TABLE " + tableSQL(table) +
|
executeQuery(conn, "ALTER TABLE " + tableSQL(table) +
|
||||||
" DROP CONSTRAINT " + columnSQL(pkName));
|
" DROP CONSTRAINT " + columnSQL(pkName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // from DatabaseLiaison
|
// from DatabaseLiaison
|
||||||
public boolean addColumn (Connection conn, String table, String column, String definition,
|
public boolean addColumn (Connection conn, String table, String column, String definition,
|
||||||
boolean check) throws SQLException
|
boolean check) throws SQLException
|
||||||
{
|
{
|
||||||
@@ -135,7 +150,7 @@ public abstract class BaseLiaison implements DatabaseLiaison
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // from DatabaseLiaison
|
// from DatabaseLiaison
|
||||||
public boolean addColumn (Connection conn, String table, String column,
|
public boolean addColumn (Connection conn, String table, String column,
|
||||||
ColumnDefinition newColumnDef, boolean check)
|
ColumnDefinition newColumnDef, boolean check)
|
||||||
throws SQLException
|
throws SQLException
|
||||||
@@ -150,7 +165,7 @@ public abstract class BaseLiaison implements DatabaseLiaison
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // from DatabaseLiaison
|
// from DatabaseLiaison
|
||||||
public boolean changeColumn (Connection conn, String table, String column, String type,
|
public boolean changeColumn (Connection conn, String table, String column, String type,
|
||||||
Boolean nullable, Boolean unique, String defaultValue)
|
Boolean nullable, Boolean unique, String defaultValue)
|
||||||
throws SQLException
|
throws SQLException
|
||||||
@@ -165,7 +180,7 @@ public abstract class BaseLiaison implements DatabaseLiaison
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // from DatabaseLiaison
|
// from DatabaseLiaison
|
||||||
public boolean renameColumn (Connection conn, String table, String from, String to,
|
public boolean renameColumn (Connection conn, String table, String from, String to,
|
||||||
ColumnDefinition newColumnDef) throws SQLException
|
ColumnDefinition newColumnDef) throws SQLException
|
||||||
{
|
{
|
||||||
@@ -175,7 +190,16 @@ public abstract class BaseLiaison implements DatabaseLiaison
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // from DatabaseLiaison
|
// from DatabaseLiaison
|
||||||
|
public abstract void createGenerator (Connection conn, String tableName, String columnName,
|
||||||
|
int initialValue)
|
||||||
|
throws SQLException;
|
||||||
|
|
||||||
|
// from DatabaseLiaison
|
||||||
|
public abstract void deleteGenerator (Connection conn, String tableName, String columnName)
|
||||||
|
throws SQLException;
|
||||||
|
|
||||||
|
// from DatabaseLiaison
|
||||||
public boolean dropColumn (Connection conn, String table, String column) throws SQLException
|
public boolean dropColumn (Connection conn, String table, String column) throws SQLException
|
||||||
{
|
{
|
||||||
if (!tableContainsColumn(conn, table, column)) {
|
if (!tableContainsColumn(conn, table, column)) {
|
||||||
@@ -198,7 +222,7 @@ public abstract class BaseLiaison implements DatabaseLiaison
|
|||||||
Collections.<List<String>>emptyList(), primaryKeyColumns);
|
Collections.<List<String>>emptyList(), primaryKeyColumns);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // from DatabaseLiaison
|
// from DatabaseLiaison
|
||||||
public boolean createTableIfMissing (Connection conn, String table, List<String> columns,
|
public boolean createTableIfMissing (Connection conn, String table, List<String> columns,
|
||||||
List<ColumnDefinition> definitions,
|
List<ColumnDefinition> definitions,
|
||||||
List<List<String>> uniqueConstraintColumns,
|
List<List<String>> uniqueConstraintColumns,
|
||||||
@@ -241,6 +265,7 @@ public abstract class BaseLiaison implements DatabaseLiaison
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// from DatabaseLiaison
|
||||||
public boolean dropTable (Connection conn, String name) throws SQLException
|
public boolean dropTable (Connection conn, String name) throws SQLException
|
||||||
{
|
{
|
||||||
if (!tableExists(conn, name)) {
|
if (!tableExists(conn, name)) {
|
||||||
@@ -251,6 +276,15 @@ public abstract class BaseLiaison implements DatabaseLiaison
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// from DatabaseLiaison
|
||||||
|
public abstract String tableSQL (String table);
|
||||||
|
|
||||||
|
// from DatabaseLiaison
|
||||||
|
public abstract String columnSQL (String column);
|
||||||
|
|
||||||
|
// from DatabaseLiaison
|
||||||
|
public abstract String indexSQL (String index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an SQL string that summarizes a column definition in that format generally accepted
|
* Create an SQL string that summarizes a column definition in that format generally accepted
|
||||||
* in table creation and column addition statements, e.g. {@code INTEGER UNIQUE NOT NULL
|
* in table creation and column addition statements, e.g. {@code INTEGER UNIQUE NOT NULL
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
package com.samskivert.jdbc;
|
package com.samskivert.jdbc;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
package com.samskivert.jdbc;
|
package com.samskivert.jdbc;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -17,8 +16,6 @@ import java.sql.ResultSet;
|
|||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
import com.samskivert.util.ArrayUtil;
|
|
||||||
|
|
||||||
import static com.samskivert.Log.log;
|
import static com.samskivert.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -22,16 +22,16 @@ public class SiteIdentifiers
|
|||||||
/** Returns a site identifier that returns the specified site always. */
|
/** Returns a site identifier that returns the specified site always. */
|
||||||
public static SiteIdentifier single (final int siteId, final String siteString) {
|
public static SiteIdentifier single (final int siteId, final String siteString) {
|
||||||
return new SiteIdentifier() {
|
return new SiteIdentifier() {
|
||||||
@Override public int identifySite (HttpServletRequest req) {
|
public int identifySite (HttpServletRequest req) {
|
||||||
return siteId;
|
return siteId;
|
||||||
}
|
}
|
||||||
@Override public String getSiteString (int siteId) {
|
public String getSiteString (int siteId) {
|
||||||
return siteString;
|
return siteString;
|
||||||
}
|
}
|
||||||
@Override public int getSiteId (String siteString) {
|
public int getSiteId (String siteString) {
|
||||||
return siteId;
|
return siteId;
|
||||||
}
|
}
|
||||||
@Override public Iterator<Site> enumerateSites () {
|
public Iterator<Site> enumerateSites () {
|
||||||
return Collections.singletonList(new Site(siteId, siteString)).iterator();
|
return Collections.singletonList(new Site(siteId, siteString)).iterator();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ public abstract class ObserverList<T>
|
|||||||
// our copy on write array list will prevent us from getting hosed if modifications
|
// our copy on write array list will prevent us from getting hosed if modifications
|
||||||
// take place during iteration
|
// take place during iteration
|
||||||
Iterator<T> iter = _list.iterator();
|
Iterator<T> iter = _list.iterator();
|
||||||
for (int ii = 0; iter.hasNext(); ii++) {
|
while (iter.hasNext()) {
|
||||||
T elem = iter.next();
|
T elem = iter.next();
|
||||||
if (!checkedApply(obop, elem)) {
|
if (!checkedApply(obop, elem)) {
|
||||||
// can't remove via COWArrayList iterator, and to be totally safe (because
|
// can't remove via COWArrayList iterator, and to be totally safe (because
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ public class HashIntMapTest
|
|||||||
ObjectInputStream in = new ObjectInputStream(fin);
|
ObjectInputStream in = new ObjectInputStream(fin);
|
||||||
@SuppressWarnings("unchecked") HashIntMap<Integer> map =
|
@SuppressWarnings("unchecked") HashIntMap<Integer> map =
|
||||||
(HashIntMap<Integer>)in.readObject();
|
(HashIntMap<Integer>)in.readObject();
|
||||||
|
in.close();
|
||||||
|
|
||||||
// check the table contents
|
// check the table contents
|
||||||
for (int i = 10; i < 20; i++) {
|
for (int i = 10; i < 20; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user