Index: extensions/dna-common-jdbc/.classpath =================================================================== --- extensions/dna-common-jdbc/.classpath (revision 1450) +++ extensions/dna-common-jdbc/.classpath (working copy) @@ -1,9 +0,0 @@ - - - - - - - - - Index: extensions/dna-common-jdbc/.project =================================================================== --- extensions/dna-common-jdbc/.project (revision 1450) +++ extensions/dna-common-jdbc/.project (working copy) @@ -1,23 +0,0 @@ - - - dna-common-jdbc - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - Index: extensions/dna-common-jdbc/.settings/org.eclipse.jdt.core.prefs =================================================================== --- extensions/dna-common-jdbc/.settings/org.eclipse.jdt.core.prefs (revision 1450) +++ extensions/dna-common-jdbc/.settings/org.eclipse.jdt.core.prefs (working copy) @@ -1,5 +0,0 @@ -#Mon Nov 17 23:04:18 EST 2008 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.source=1.5 Index: extensions/dna-common-jdbc/.settings/org.maven.ide.eclipse.prefs =================================================================== --- extensions/dna-common-jdbc/.settings/org.maven.ide.eclipse.prefs (revision 1450) +++ extensions/dna-common-jdbc/.settings/org.maven.ide.eclipse.prefs (working copy) @@ -1,8 +0,0 @@ -#Mon Nov 17 23:04:18 EST 2008 -activeProfiles= -eclipse.preferences.version=1 -fullBuildGoals=process-test-resources -includeModules=false -resolveWorkspaceProjects=true -resourceFilterGoals=process-resources resources\:testResources -version=1 Index: extensions/dna-common-jdbc/pom.xml =================================================================== --- extensions/dna-common-jdbc/pom.xml (revision 1450) +++ extensions/dna-common-jdbc/pom.xml (working copy) @@ -1,60 +0,0 @@ - - 4.0.0 - - dna - org.jboss.dna - 0.7-SNAPSHOT - ../.. - - - dna-common-jdbc - jar - JBoss DNA JDBC Common model - JBoss DNA Common Model that stores JDBC related metadata - http://labs.jboss.org/dna - - - org.jboss.dna - dna-common - - - org.jboss.dna - dna-graph - - - commons-beanutils - commons-beanutils - 1.8.0 - - - - - org.slf4j - slf4j-api - - - org.slf4j - slf4j-log4j12 - test - - - log4j - log4j - test - - - junit - junit - 4.4 - test - - - hsqldb - hsqldb - 1.8.0.7 - test - - - \ No newline at end of file Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/JdbcMetadataI18n.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/JdbcMetadataI18n.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/JdbcMetadataI18n.java (working copy) @@ -1,58 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. -* See the AUTHORS.txt file in the distribution for a full listing of -* individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc; - -import java.util.Locale; -import java.util.Set; -import org.jboss.dna.common.i18n.I18n; - -/** - * The internationalized string constants for the org.jboss.dna.common.jdbc* packages. - */ -public final class JdbcMetadataI18n { - public static I18n databaseConnectionHasBeenReleased; - public static I18n errorClosingDatabaseConnection; - public static I18n databaseConnectionHasBeenEstablished; - public static I18n unableToGetValueFromColumn; - - static { - try { - I18n.initialize(JdbcMetadataI18n.class); - } catch (final Exception err) { - System.err.println(err); - } - } - - public static Set getLocalizationProblemLocales() { - return I18n.getLocalizationProblemLocales(JdbcMetadataI18n.class); - } - - public static Set getLocalizationProblems() { - return I18n.getLocalizationProblems(JdbcMetadataI18n.class); - } - - public static Set getLocalizationProblems( Locale locale ) { - return I18n.getLocalizationProblems(JdbcMetadataI18n.class, locale); - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Attribute.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Attribute.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Attribute.java (working copy) @@ -1,46 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -/** - * Provides User Defined Type (UDT) attribute specific metadata. - * - * @author Sergiy Litsenko - * @since 1.4 (JDBC 3.0) - */ -public interface Attribute extends Column { - /** - * Returns column reference if datatype is REF - * - * @return column reference if datatype is REF - */ - Reference getReference(); - - /** - * Sets reference - * - * @param reference the reference to set - */ - void setReference( Reference reference ); -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/BestRowIdentifier.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/BestRowIdentifier.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/BestRowIdentifier.java (working copy) @@ -1,77 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -import java.util.Set; - -/** - * Provides table's best row identifies specific metadata. - * - * @author Sergiy Litsenko - */ -public interface BestRowIdentifier extends CoreMetaData { - - /** - * Return the scope of best row identifier - * - * @return the scope of best row identifier - */ - BestRowIdentifierScopeType getScopeType(); - - /** - * Sets the scope of best row identifier - * - * @param scopeType the scope of best row identifier - */ - void setScopeType( BestRowIdentifierScopeType scopeType ); - - /** - * Retrieves best row identifier columns - * - * @return best row identifier columns - */ - Set getColumns(); - - /** - * Adds column to the best row identifier - * - * @param column the column that part of best row identifier - */ - void addColumn( Column column ); - - /** - * Deletes column from the best row identifier - * - * @param column the column that no longer part of best row identifier - */ - void deleteColumn( Column column ); - - /** - * Searches column by name - * - * @param columnName the column name to search - * @return column if found, otherwise return null - */ - Column findColumnByName( String columnName ); -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/BestRowIdentifierScopeType.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/BestRowIdentifierScopeType.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/BestRowIdentifierScopeType.java (working copy) @@ -1,53 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -import java.sql.DatabaseMetaData; - -/** - * Provides RDBMS supported best row identifier scope types as enumeration set. - * - * @author Sergiy Litsenko - */ -public enum BestRowIdentifierScopeType { - - TEMPORARY(DatabaseMetaData.bestRowTemporary), // Indicates that the scope is very temporary, lasting only while the row is - // being used. - TRANSACTION(DatabaseMetaData.bestRowTransaction), // Indicates that the scope is the remainder of the current transaction. - SESSION(DatabaseMetaData.bestRowSession); // Indicates that the scope is the remainder of the current session. - - private final int scope; - - BestRowIdentifierScopeType( int scope ) { - this.scope = scope; - } - - public int getScope() { - return scope; - } - - public String getName() { - return name(); - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Catalog.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Catalog.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Catalog.java (working copy) @@ -1,32 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -/** - * Provides all core database catalog specific metadata. - * - * @author Sergiy Litsenko - */ -public interface Catalog extends DatabaseNamedObject { -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Column.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Column.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Column.java (working copy) @@ -1,209 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -import java.util.Set; - -/** - * Provides all column specific metadata. - * - * @author Sergiy Litsenko - */ -public interface Column extends DatabaseNamedObject { - - /** - * Returns owner of ColumnMetaData such as Table, or Stored Procedure, UDT, PK, FK, Index, etc. May return NULL - * - * @return owner of ColumnMetaData such as Table, or Stored Procedure, or UDT, PK, FK, Index, etc. May return NULL - */ - SchemaObject getOwner(); - - /** - * Sets the owner of ColumnMetaData - * - * @param owner the owner of ColumnMetaData - */ - void setOwner( SchemaObject owner ); - - /** - * Gets column nullability - * - * @return column nullability - */ - NullabilityType getNullabilityType(); - - /** - * Sets column nullability - * - * @param nullabilityType the column nullability - */ - void setNullabilityType( NullabilityType nullabilityType ); - - /** - * Gets SQL type from java.sql.Types - * - * @return SQL type from java.sql.Types - */ - SqlType getSqlType(); - - /** - * Sets SQL type from java.sql.Types - * - * @param sqlType the SQL type from java.sql.Types - */ - void setSqlType( SqlType sqlType ); - - /** - * Data source dependent type name. For a UDT, the type name is fully qualified. For a REF, the type name is fully qualified - * and represents the target type of the reference type. - * - * @return data source dependent type name - */ - String getTypeName(); - - /** - * Data source dependent type name. For a UDT, the type name is fully qualified. For a REF, the type name is fully qualified - * and represents the target type of the reference type. - * - * @param typeName data source dependent type name - */ - void setTypeName( String typeName ); - - /** - * Gets column size. For char or date types this is the maximum number of characters, for numeric or decimal types this is - * precision. For Stored procedure columns it is length in bytes of data - * - * @return column size - */ - Integer getSize(); - - /** - * Sets column size. For char or date types this is the maximum number of characters, for numeric or decimal types this is - * precision. For Stored procedure columns it is length in bytes of data - * - * @param size the column size - */ - void setSize( Integer size ); - - /** - * Gets precision if applicable otherwise 0. For table columns return the number of fractional digits; for stored procedure - * column - scale. - * - * @return precision if applicable otherwise 0 - */ - Integer getPrecision(); - - /** - * Sets precision if applicable otherwise 0. For table columns return the number of fractional digits; for stored procedure - * column - scale. - * - * @param precision the precision if applicable otherwise 0 - */ - void setPrecision( Integer precision ); - - /** - * Gets radix if applicable - * - * @return radix if applicable - */ - Integer getRadix(); - - /** - * Sets radix if applicable - * - * @param radix if applicable - */ - void setRadix( Integer radix ); - - /** - * Gets default value (may be null) - * - * @return default value (may be null) - */ - String getDefaultValue(); - - /** - * Sets default value (may be null) - * - * @param defaultValue the default value (may be null) - */ - void setDefaultValue( String defaultValue ); - - /** - * Returns index of column starting at 1 - if applicable. Otherwise returns -1. - * - * @return index of column starting at 1 - if applicable. Otherwise returns -1. - */ - Integer getOrdinalPosition(); - - /** - * Sets index of column starting at 1 - if applicable. Otherwise returns -1. - * - * @param ordinalPosition the index of column starting at 1 - if applicable. Otherwise returns -1. - */ - void setOrdinalPosition( Integer ordinalPosition ); - - /** - * For char types returns the maximum number of bytes in the column. Otherwise returns -1. May return null. - * - * @return For char types returns the maximum number of bytes in the column. Otherwise returns -1. May return null. - */ - Integer getCharOctetLength(); - - /** - * For char types sets the maximum number of bytes in the column. Otherwise -1. - * - * @param charOctetLength For char types sets the maximum number of bytes in the column. Otherwise -1. - */ - void setCharOctetLength( Integer charOctetLength ); - - /** - * Gets table column privileges. - * - * @return set of table column privileges - */ - Set getPrivileges(); - - /** - * Adds table column priviledge - * - * @param privilege the table column priviledge - */ - void addPrivilege( Privilege privilege ); - - /** - * Deletes table column priviledge - * - * @param privilege the table column priviledge - */ - void deletePrivilege( Privilege privilege ); - - /** - * Searches priviledge by name - * - * @param priviledgeName the priviledge name to search - * @return priviledge if found, otherwise return null - */ - Privilege findPriviledgeByName( String priviledgeName ); -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/ColumnPseudoType.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/ColumnPseudoType.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/ColumnPseudoType.java (working copy) @@ -1,50 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -/** - * Provides RDBMS supported best row identifier pseudo types as enumeration set. - * - * @author Sergiy Litsenko - */ -public enum ColumnPseudoType { - - UNKNOWN(0), // Indicates that the column may or may not be a pseudo column. - NOT_PSEUDO(1), // Indicates that the column is NOT a pseudo column. - PSEUDO(2); // Indicates that the column is a pseudo column. - - private final int type; - - ColumnPseudoType( int type ) { - this.type = type; - } - - public int getType() { - return type; - } - - public String getName() { - return name(); - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/CoreMetaData.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/CoreMetaData.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/CoreMetaData.java (working copy) @@ -1,35 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -import java.io.Serializable; - -/** - * Provides core metadata functionality - * - * @author Sergiy Litsenko - */ -public interface CoreMetaData extends Serializable { - -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Database.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Database.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Database.java (working copy) @@ -1,3016 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -import java.util.List; -import java.util.Set; - -/** - * Provides RDBMS wide meta data retrieved from java.sql.DatabaseMetaData. - * - * @author Sergiy Litsenko - */ -public interface Database extends CoreMetaData { - - /** - * Returns list of failed database metadata methods through the DatabaseMetaDataMethodExceptions - * - * @return list of failed database metadata methods through the DatabaseMetaDataMethodExceptions - */ - List getExceptionList(); - - /** - * Adds the DatabaseMetaDataMethodException to the DatabaseMetadataProvider exception list - * - * @param exception the DatabaseMetaDataMethodException - */ - void addException( DatabaseMetaDataMethodException exception ); - - /** - * Searches the DatabaseMetaDataMethodException by method name - * - * @param methodName the name of method that caused exception - * @return the DatabaseMetaDataMethodException if found, otherwise returns null - */ - DatabaseMetaDataMethodException findException( String methodName ); - - /** - * Checks that specified database metadata method of provider is failed or not - * - * @param methodName the name of method that caused exception - * @return true if method failed; false otherwise - */ - boolean isDatabaseMetaDataMethodFailed( String methodName ); - - /** - * Gets database name - * - * @return database name - */ - String getName(); - - /** - * Sets database name - * - * @param name the database name - */ - void setName( String name ); - - // ---------------------------------------------------------------------- - // A variety of minor information about the target database. - // ---------------------------------------------------------------------- - - /** - * Retrieves whether the current user can call all the procedures returned by the method - * DatabaseMetaData.getProcedures. - * - * @return true if so; false otherwise - */ - Boolean isAllProceduresAreCallable(); - - /** - * sets whether the current user can call all the procedures returned by the method - * DatabaseMetaData.getProcedures. - * - * @param allProceduresAreCallable true if so; false otherwise - */ - void setAllProceduresAreCallable( Boolean allProceduresAreCallable ); - - /** - * Retrieves whether the current user can use all the tables returned by the method DatabaseMetaData.getTables in - * a SELECT statement. - * - * @return true if so; false otherwise - */ - Boolean isAllTablesAreSelectable(); - - /** - * Sets whether the current user can use all the tables returned by the method DatabaseMetaData.getTables in a - * SELECT statement. - * - * @param allTablesAreSelectable true if so; false otherwise - */ - void setAllTablesAreSelectable( Boolean allTablesAreSelectable ); - - /** - * Retrieves the URL for this DBMS. - * - * @return the URL for this DBMS or null if it cannot be generated - */ - String getURL(); - - /** - * Sets the URL for this DBMS. - * - * @param url the URL for this DBMS or null if it cannot be generated - */ - void setURL( String url ); - - /** - * Retrieves the user name as known to this database. - * - * @return the database user name - */ - String getUserName(); - - /** - * Sets the user name as known to this database. - * - * @param userName the database user name - */ - void setUserName( String userName ); - - /** - * Retrieves whether this database is in read-only mode. - * - * @return true if so; false otherwise - */ - Boolean isReadOnly(); - - /** - * Sets whether this database is in read-only mode. - * - * @param readOnly true if so; false otherwise - */ - void setReadOnly( Boolean readOnly ); - - /** - * Retrieves whether NULL values are sorted high. Sorted high means that NULL values sort higher - * than any other value in a domain. In an ascending order, if this method returns true, NULL values - * will appear at the end. By contrast, the method DatabaseMetaData.nullsAreSortedAtEnd indicates whether - * NULL values are sorted at the end regardless of sort order. - * - * @return true if so; false otherwise - */ - Boolean isNullsAreSortedHigh(); - - /** - * Sets whether NULL values are sorted high. Sorted high means that NULL values sort higher than any - * other value in a domain. In an ascending order, if this method returns true, NULL values will - * appear at the end. By contrast, the method DatabaseMetaData.nullsAreSortedAtEnd indicates whether - * NULL values are sorted at the end regardless of sort order. - * - * @param nullsAreSortedHigh true if so; false otherwise - */ - void setNullsAreSortedHigh( Boolean nullsAreSortedHigh ); - - /** - * Retrieves whether NULL values are sorted low. Sorted low means that NULL values sort lower than - * any other value in a domain. In an ascending order, if this method returns true, NULL values will - * appear at the beginning. By contrast, the method DatabaseMetaData.nullsAreSortedAtStart indicates whether - * NULL values are sorted at the beginning regardless of sort order. - * - * @return true if so; false otherwise - */ - Boolean isNullsAreSortedLow(); - - /** - * Sets whether NULL values are sorted low. Sorted low means that NULL values sort lower than any - * other value in a domain. In an ascending order, if this method returns true, NULL values will - * appear at the beginning. By contrast, the method DatabaseMetaData.nullsAreSortedAtStart indicates whether - * NULL values are sorted at the beginning regardless of sort order. - * - * @param nullsAreSortedLow true if so; false otherwise - */ - void setNullsAreSortedLow( Boolean nullsAreSortedLow ); - - /** - * Retrieves whether NULL values are sorted at the start regardless of sort order. - * - * @return true if so; false otherwise - */ - Boolean isNullsAreSortedAtStart(); - - /** - * Sets whether NULL values are sorted at the start regardless of sort order. - * - * @param nullsAreSortedAtStart true if so; false otherwise - */ - void setNullsAreSortedAtStart( Boolean nullsAreSortedAtStart ); - - /** - * Retrieves whether NULL values are sorted at the end regardless of sort order. - * - * @return true if so; false otherwise - */ - Boolean isNullsAreSortedAtEnd(); - - /** - * Sets whether NULL values are sorted at the end regardless of sort order. - * - * @param nullsAreSortedAtEnd true if so; false otherwise - */ - void setNullsAreSortedAtEnd( Boolean nullsAreSortedAtEnd ); - - /** - * Retrieves the name of this database product. - * - * @return database product name - */ - String getDatabaseProductName(); - - /** - * Sets the name of this database product. - * - * @param databaseProductName database product name - */ - void setDatabaseProductName( String databaseProductName ); - - /** - * Retrieves the version number of this database product. - * - * @return database version number - */ - String getDatabaseProductVersion(); - - /** - * Sets the version number of this database product. - * - * @param databaseProductVersion database version number - */ - void setDatabaseProductVersion( String databaseProductVersion ); - - /** - * Retrieves the name of this JDBC driver. - * - * @return JDBC driver name - */ - String getDriverName(); - - /** - * Sets the name of this JDBC driver. - * - * @param driverName JDBC driver name - */ - void setDriverName( String driverName ); - - /** - * Retrieves the version number of this JDBC driver as a String. - * - * @return JDBC driver version - */ - String getDriverVersion(); - - /** - * Sets the version number of this JDBC driver as a String. - * - * @param driverVersion the JDBC driver version - */ - void setDriverVersion( String driverVersion ); - - /** - * Retrieves this JDBC driver's minor version number. - * - * @return JDBC driver minor version number - */ - Integer getDriverMajorVersion(); - - /** - * Sets this JDBC driver's major version number. - * - * @param driverMajorVersion the JDBC driver major version - */ - void setDriverMajorVersion( Integer driverMajorVersion ); - - /** - * Retrieves this JDBC driver's minor version number. - * - * @return JDBC driver minor version number - */ - Integer getDriverMinorVersion(); - - /** - * Sets this JDBC driver's minor version number. - * - * @param driverMinorVersion the JDBC driver minor version number - */ - void setDriverMinorVersion( Integer driverMinorVersion ); - - /** - * Retrieves whether this database stores tables in a local file. - * - * @return true if so; false otherwise - */ - Boolean isUsesLocalFiles(); - - /** - * Sets whether this database stores tables in a local file. - * - * @param usesLocalFiles true if so; false otherwise - */ - void setUsesLocalFiles( Boolean usesLocalFiles ); - - /** - * Retrieves whether this database uses a file for each table. - * - * @return true if this database uses a local file for each table; false otherwise - */ - Boolean isUsesLocalFilePerTable(); - - /** - * Sets whether this database uses a file for each table. - * - * @param usesLocalFilePerTable true if this database uses a local file for each table; false - * otherwise - */ - void setUsesLocalFilePerTable( Boolean usesLocalFilePerTable ); - - /** - * Retrieves whether this database treats mixed case unquoted SQL identifiers as case sensitive and as a result stores them in - * mixed case. - * - * @return true if so; false otherwise - */ - Boolean isSupportsMixedCaseIdentifiers(); - - /** - * Sets whether this database treats mixed case unquoted SQL identifiers as case sensitive and as a result stores them in - * mixed case. - * - * @param supportsMixedCaseIdentifiers true if so; false otherwise - */ - void setSupportsMixedCaseIdentifiers( Boolean supportsMixedCaseIdentifiers ); - - /** - * Retrieves whether this database treats mixed case unquoted SQL identifiers as case insensitive and stores them in upper - * case. - * - * @return true if so; false otherwise - */ - Boolean isStoresUpperCaseIdentifiers(); - - /** - * Sets whether this database treats mixed case unquoted SQL identifiers as case insensitive and stores them in upper case. - * - * @param storesUpperCaseIdentifiers true if so; false otherwise - */ - void setStoresUpperCaseIdentifiers( Boolean storesUpperCaseIdentifiers ); - - /** - * Retrieves whether this database treats mixed case unquoted SQL identifiers as case insensitive and stores them in lower - * case. - * - * @return true if so; false otherwise - */ - Boolean isStoresLowerCaseIdentifiers(); - - /** - * sets whether this database treats mixed case unquoted SQL identifiers as case insensitive and stores them in lower case. - * - * @param storesLowerCaseIdentifiers true if so; false otherwise - */ - void setStoresLowerCaseIdentifiers( Boolean storesLowerCaseIdentifiers ); - - /** - * Retrieves whether this database treats mixed case unquoted SQL identifiers as case insensitive and stores them in mixed - * case. - * - * @return true if so; false otherwise - */ - Boolean isStoresMixedCaseIdentifiers(); - - /** - * Sets whether this database treats mixed case unquoted SQL identifiers as case insensitive and stores them in mixed case. - * - * @param storesMixedCaseIdentifiers true if so; false otherwise - */ - void setStoresMixedCaseIdentifiers( Boolean storesMixedCaseIdentifiers ); - - /** - * Retrieves whether this database treats mixed case quoted SQL identifiers as case sensitive and as a result stores them in - * mixed case. - * - * @return true if so; false otherwise - */ - Boolean isSupportsMixedCaseQuotedIdentifiers(); - - /** - * Sets whether this database treats mixed case quoted SQL identifiers as case sensitive and as a result stores them in mixed - * case. - * - * @param supportsMixedCaseQuotedIdentifiers true if so; false otherwise - */ - void setSupportsMixedCaseQuotedIdentifiers( Boolean supportsMixedCaseQuotedIdentifiers ); - - /** - * Retrieves whether this database treats mixed case quoted SQL identifiers as case insensitive and stores them in upper case. - * - * @return true if so; false otherwise - */ - Boolean isStoresUpperCaseQuotedIdentifiers(); - - /** - * Sets whether this database treats mixed case quoted SQL identifiers as case insensitive and stores them in upper case. - * - * @param storesUpperCaseQuotedIdentifiers true if so; false otherwise - */ - void setStoresUpperCaseQuotedIdentifiers( Boolean storesUpperCaseQuotedIdentifiers ); - - /** - * Retrieves whether this database treats mixed case quoted SQL identifiers as case insensitive and stores them in lower case. - * - * @return true if so; false otherwise - */ - Boolean isStoresLowerCaseQuotedIdentifiers(); - - /** - * Sets whether this database treats mixed case quoted SQL identifiers as case insensitive and stores them in lower case. - * - * @param storesLowerCaseQuotedIdentifiers true if so; false otherwise - */ - void setStoresLowerCaseQuotedIdentifiers( Boolean storesLowerCaseQuotedIdentifiers ); - - /** - * Retrieves whether this database treats mixed case quoted SQL identifiers as case insensitive and stores them in mixed case. - * - * @return true if so; false otherwise - */ - Boolean isStoresMixedCaseQuotedIdentifiers(); - - /** - * Sets whether this database treats mixed case quoted SQL identifiers as case insensitive and stores them in mixed case. - * - * @param storesMixedCaseQuotedIdentifiers true if so; false otherwise - */ - void setStoresMixedCaseQuotedIdentifiers( Boolean storesMixedCaseQuotedIdentifiers ); - - /** - * Retrieves the string used to quote SQL identifiers. This method returns a space " " if identifier quoting is not supported. - * - * @return the quoting string or a space if quoting is not supported - */ - String getIdentifierQuoteString(); - - /** - * Sets the string used to quote SQL identifiers. This method returns a space " " if identifier quoting is not supported. - * - * @param identifierQuoteString the quoting string or a space if quoting is not supported - */ - void setIdentifierQuoteString( String identifierQuoteString ); - - /** - * Retrieves a list of all of this database's SQL keywords that are NOT also SQL92 keywords. - * - * @return the list of this database's keywords that are not also SQL92 keywords - */ - Set getSQLKeywords(); - - /** - * Adds SQL keyword - * - * @param sqlKeyword the SQL keyword to add - */ - void addSQLKeyword( String sqlKeyword ); - - /** - * Deletes SQL keyword - * - * @param sqlKeyword the SQL keyword to delete - */ - void deleteSQLKeyword( String sqlKeyword ); - - /** - * Is SQL keyword supported - * - * @param sqlKeyword the SQL keyword to search - * @return true if supported; false otherwiose - */ - Boolean isSQLKeywordSupported( String sqlKeyword ); - - /** - * Retrieves a list of math functions available with this database. These are the Open /Open CLI math function names used in - * the JDBC function escape clause. - * - * @return the list of math functions supported by this database - */ - Set getNumericFunctions(); - - /** - * Adds numeric function - * - * @param functionName the name of numeric function to add - */ - void addNumericFunction( String functionName ); - - /** - * Deletes numeric function - * - * @param functionName the name of numeric function to delete - */ - void deleteNumericFunction( String functionName ); - - /** - * Is Numeric function supported - * - * @param functionName the name of numeric function - * @return true is supported; false otherwise - */ - Boolean isNumericFunctionSupported( String functionName ); - - /** - * Retrieves a list of string functions available with this database. These are the Open Group CLI string function names used - * in the JDBC function escape clause. - * - * @return the list of string functions supported by this database - */ - Set getStringFunctions(); - - /** - * Adds String function - * - * @param functionName the name of String function to add - */ - void addStringFunction( String functionName ); - - /** - * Deletes String function - * - * @param functionName the name of String function to delete - */ - void deleteStringFunction( String functionName ); - - /** - * Is String function supported - * - * @param functionName the name of String function - * @return true is supported; false otherwise - */ - Boolean isStringFunctionSupported( String functionName ); - - /** - * Retrieves a list of system functions available with this database. These are the Open Group CLI system function names used - * in the JDBC function escape clause. - * - * @return a list of system functions supported by this database - */ - Set getSystemFunctions(); - - /** - * Adds System function - * - * @param functionName the name of System function to add - */ - void addSystemFunction( String functionName ); - - /** - * deletes System function - * - * @param functionName the name of System function to delete - */ - void deleteSystemFunction( String functionName ); - - /** - * Is System function supported - * - * @param functionName the name of System function - * @return true is supported; false otherwise - */ - Boolean isSystemFunctionSupported( String functionName ); - - /** - * Retrieves a list of the time and date functions available with this database. - * - * @return the list of time and date functions supported by this database - */ - Set getTimeDateFunctions(); - - /** - * Adds Time/Date function - * - * @param functionName the name of Time/Date function to add - */ - void addTimeDateFunction( String functionName ); - - /** - * deletes Time/Date function - * - * @param functionName the name of Time/Date function to delete - */ - void deleteTimeDateFunction( String functionName ); - - /** - * Is Time/Date function supported - * - * @param functionName the name of Time/Date function - * @return true is supported; false otherwise - */ - Boolean isTimeDateFunctionSupported( String functionName ); - - /** - * Retrieves the string that can be used to escape wildcard characters. This is the string that can be used to escape '_' or - * '%' in the catalog search parameters that are a pattern (and therefore use one of the wildcard characters). - *

- * The '_' character represents any single character; the '%' character represents any sequence of zero or more characters. - * - * @return the string used to escape wildcard characters - */ - String getSearchStringEscape(); - - /** - * Sets the string that can be used to escape wildcard characters. This is the string that can be used to escape '_' or '%' in - * the catalog search parameters that are a pattern (and therefore use one of the wildcard characters). - *

- * The '_' character represents any single character; the '%' character represents any sequence of zero or more characters. - * - * @param searchStringEscape the string used to escape wildcard characters - */ - void setSearchStringEscape( String searchStringEscape ); - - /** - * Retrieves all the "extra" characters that can be used in unquoted identifier names (those beyond a-z, A-Z, 0-9 and _). - * - * @return the string containing the extra characters - */ - String getExtraNameCharacters(); - - /** - * Sets all the "extra" characters that can be used in unquoted identifier names (those beyond a-z, A-Z, 0-9 and _). - * - * @param extraNameCharacters the string containing the extra characters - */ - void setExtraNameCharacters( String extraNameCharacters ); - - // -------------------------------------------------------------------- - // Functions describing which features are supported. - // -------------------------------------------------------------------- - - /** - * Retrieves whether this database supports ALTER TABLE with add column. - * - * @return true if so; false otherwise - */ - Boolean isSupportsAlterTableWithAddColumn(); - - /** - * Sets whether this database supports ALTER TABLE with add column. - * - * @param supportsAlterTableWithAddColumn true if so; false otherwise - */ - void setSupportsAlterTableWithAddColumn( Boolean supportsAlterTableWithAddColumn ); - - /** - * Retrieves whether this database supports ALTER TABLE with drop column. - * - * @return true if so; false otherwise - */ - Boolean isSupportsAlterTableWithDropColumn(); - - /** - * Sets whether this database supports ALTER TABLE with drop column. - * - * @param supportsAlterTableWithDropColumn true if so; false otherwise - */ - void setSupportsAlterTableWithDropColumn( Boolean supportsAlterTableWithDropColumn ); - - /** - * Retrieves whether this database supports column aliasing. - *

- * If so, the SQL AS clause can be used to provide names for computed columns or to provide alias names for columns as - * required. - * - * @return true if so; false otherwise - */ - Boolean isSupportsColumnAliasing(); - - /** - * Sets whether this database supports column aliasing. - *

- * If so, the SQL AS clause can be used to provide names for computed columns or to provide alias names for columns as - * required. - * - * @param supportsColumnAliasing true if so; false otherwise - */ - void setSupportsColumnAliasing( Boolean supportsColumnAliasing ); - - /** - * Retrieves whether this database supports concatenations between NULL and non-NULL values being - * NULL. - * - * @return true if so; false otherwise - */ - Boolean isNullPlusNonNullIsNull(); - - /** - * Sets whether this database supports concatenations between NULL and non-NULL values being - * NULL. - * @param nullPlusNonNullIsNull true if so; false otherwise - * - */ - void setNullPlusNonNullIsNull( Boolean nullPlusNonNullIsNull ); - - /** - * Retrieves whether this database supports the CONVERT function between SQL types. - * - * @return true if so; false otherwise - */ - Boolean isSupportsConvert(); - - /** - * Sets whether this database supports the CONVERT function between SQL types. - * - * @param supportsConvert true if so; false otherwise - */ - void setSupportsConvert( Boolean supportsConvert ); - - /** - * Retrieves whether this database supports the CONVERT for given SQL types. It uses original - * DatabaseMetaData.supportsConvert to check common (NOT ALL POSSIBLE) conversions. - * - * @return list of common (NOT ALL POSSIBLE) conversions. - * @see java.sql.Types - */ - Set getSupportedConversions(); - - /** - * Adds SqlTypeConversionPair - * - * @param sqlTypeConversionPair the SqlTypeConversionPair - */ - void addSqlTypeConversionPair( SqlTypeConversionPair sqlTypeConversionPair ); - - /** - * deletes SqlTypeConversionPair - * - * @param sqlTypeConversionPair the SqlTypeConversionPair - */ - void deleteSqlTypeConversionPair( SqlTypeConversionPair sqlTypeConversionPair ); - - /** - * Searches set of SqlTypeConversionPair by SrcType - * @param srcType the source type - * - * @return set of SqlTypeConversionPair - */ - Set findSqlTypeConversionPairBySrcType( String srcType ); - - /** - * Retrieves whether this database supports table correlation names. - * - * @return true if so; false otherwise - */ - Boolean isSupportsTableCorrelationNames(); - - /** - * Sets whether this database supports table correlation names. - * - * @param supportsTableCorrelationNames true if so; false otherwise - */ - void setSupportsTableCorrelationNames( Boolean supportsTableCorrelationNames ); - - /** - * Retrieves whether, when table correlation names are supported, they are restricted to being different from the names of the - * tables. - * - * @return true if so; false otherwise - */ - Boolean isSupportsDifferentTableCorrelationNames(); - - /** - * Sets whether, when table correlation names are supported, they are restricted to being different from the names of the - * tables. - * - * @param supportsDifferentTableCorrelationNames true if so; false otherwise - */ - void setSupportsDifferentTableCorrelationNames( Boolean supportsDifferentTableCorrelationNames ); - - /** - * Retrieves whether this database supports expressions in ORDER BY lists. - * - * @return true if so; false otherwise - */ - Boolean isSupportsExpressionsInOrderBy(); - - /** - * Sets whether this database supports expressions in ORDER BY lists. - * - * @param supportsExpressionsInOrderBy true if so; false otherwise - */ - void setSupportsExpressionsInOrderBy( Boolean supportsExpressionsInOrderBy ); - - /** - * Retrieves whether this database supports using a column that is not in the SELECT statement in an - * ORDER BY clause. - * - * @return true if so; false otherwise - */ - Boolean isSupportsOrderByUnrelated(); - - /** - * Sets whether this database supports using a column that is not in the SELECT statement in an - * ORDER BY clause. - * - * @param supportsOrderByUnrelated true if so; false otherwise - */ - void setSupportsOrderByUnrelated( Boolean supportsOrderByUnrelated ); - - /** - * Retrieves whether this database supports some form of GROUP BY clause. - * - * @return true if so; false otherwise - */ - Boolean isSupportsGroupBy(); - - /** - * Sets whether this database supports some form of GROUP BY clause. - * - * @param supportsGroupBy true if so; false otherwise - */ - void setSupportsGroupBy( Boolean supportsGroupBy ); - - /** - * Retrieves whether this database supports using a column that is not in the SELECT statement in a - * GROUP BY clause. - * - * @return true if so; false otherwise - */ - Boolean isSupportsGroupByUnrelated(); - - /** - * Sets whether this database supports using a column that is not in the SELECT statement in a - * GROUP BY clause. - * - * @param supportsGroupByUnrelated true if so; false otherwise - */ - void setSupportsGroupByUnrelated( Boolean supportsGroupByUnrelated ); - - /** - * Retrieves whether this database supports using columns not included in the SELECT statement in a - * GROUP BY clause provided that all of the columns in the SELECT statement are included in the - * GROUP BY clause. - * - * @return true if so; false otherwise - */ - Boolean isSupportsGroupByBeyondSelect(); - - /** - * Sets whether this database supports using columns not included in the SELECT statement in a - * GROUP BY clause provided that all of the columns in the SELECT statement are included in the - * GROUP BY clause. - * - * @param supportsGroupByBeyondSelect true if so; false otherwise - */ - void setSupportsGroupByBeyondSelect( Boolean supportsGroupByBeyondSelect ); - - /** - * Retrieves whether this database supports specifying a LIKE escape clause. - * - * @return true if so; false otherwise - */ - Boolean isSupportsLikeEscapeClause(); - - /** - * Sets whether this database supports specifying a LIKE escape clause. - * - * @param supportsLikeEscapeClause true if so; false otherwise - */ - void setSupportsLikeEscapeClause( Boolean supportsLikeEscapeClause ); - - /** - * Retrieves whether this database supports getting multiple ResultSet objects from a single call to the method - * execute. - * - * @return true if so; false otherwise - */ - Boolean isSupportsMultipleResultSets(); - - /** - * Sets whether this database supports getting multiple ResultSet objects from a single call to the method - * execute. - * - * @param supportsMultipleResultSets true if so; false otherwise - */ - void setSupportsMultipleResultSets( Boolean supportsMultipleResultSets ); - - /** - * Retrieves whether this database allows having multiple transactions open at once (on different connections). - * - * @return true if so; false otherwise - */ - Boolean isSupportsMultipleTransactions(); - - /** - * Sets whether this database allows having multiple transactions open at once (on different connections). - * - * @param supportsMultipleTransactions true if so; false otherwise - */ - void setSupportsMultipleTransactions( Boolean supportsMultipleTransactions ); - - /** - * Retrieves whether columns in this database may be defined as non-nullable. - * - * @return true if so; false otherwise - */ - Boolean isSupportsNonNullableColumns(); - - /** - * Sets whether columns in this database may be defined as non-nullable. - * - * @param supportsNonNullableColumns true if so; false otherwise - */ - void setSupportsNonNullableColumns( Boolean supportsNonNullableColumns ); - - /** - * Retrieves whether this database supports the ODBC Minimum SQL grammar. - * - * @return true if so; false otherwise - */ - Boolean isSupportsMinimumSQLGrammar(); - - /** - * Sets whether this database supports the ODBC Minimum SQL grammar. - * - * @param supportsMinimumSQLGrammar true if so; false otherwise - */ - void setSupportsMinimumSQLGrammar( Boolean supportsMinimumSQLGrammar ); - - /** - * Retrieves whether this database supports the ODBC Core SQL grammar. - * - * @return true if so; false otherwise - */ - Boolean isSupportsCoreSQLGrammar(); - - /** - * Sets whether this database supports the ODBC Core SQL grammar. - * - * @param supportsCoreSQLGrammar true if so; false otherwise - */ - void setSupportsCoreSQLGrammar( Boolean supportsCoreSQLGrammar ); - - /** - * Retrieves whether this database supports the ODBC Extended SQL grammar. - * - * @return true if so; false otherwise - */ - Boolean isSupportsExtendedSQLGrammar(); - - /** - * Sets whether this database supports the ODBC Extended SQL grammar. - * - * @param supportsExtendedSQLGrammar true if so; false otherwise - */ - void setSupportsExtendedSQLGrammar( Boolean supportsExtendedSQLGrammar ); - - /** - * Retrieves whether this database supports the ANSI92 entry level SQL grammar. - * - * @return true if so; false otherwise - */ - Boolean isSupportsANSI92EntryLevelSQL(); - - /** - * Sets whether this database supports the ANSI92 entry level SQL grammar. - * - * @param supportsANSI92EntryLevelSQL true if so; false otherwise - */ - void setSupportsANSI92EntryLevelSQL( Boolean supportsANSI92EntryLevelSQL ); - - /** - * Retrieves whether this database supports the ANSI92 intermediate SQL grammar supported. - * - * @return true if so; false otherwise - */ - Boolean isSupportsANSI92IntermediateSQL(); - - /** - * Sets whether this database supports the ANSI92 intermediate SQL grammar supported. - * - * @param supportsANSI92IntermediateSQL true if so; false otherwise - */ - void setSupportsANSI92IntermediateSQL( Boolean supportsANSI92IntermediateSQL ); - - /** - * Retrieves whether this database supports the ANSI92 full SQL grammar supported. - * - * @return true if so; false otherwise - */ - Boolean isSupportsANSI92FullSQL(); - - /** - * Sets whether this database supports the ANSI92 full SQL grammar supported. - * - * @param supportsANSI92FullSQL true if so; false otherwise - */ - void setSupportsANSI92FullSQL( Boolean supportsANSI92FullSQL ); - - /** - * Retrieves whether this database supports the SQL Integrity Enhancement Facility. - * - * @return true if so; false otherwise - */ - Boolean isSupportsIntegrityEnhancementFacility(); - - /** - * Sets whether this database supports the SQL Integrity Enhancement Facility. - * - * @param supportsIntegrityEnhancementFacility true if so; false otherwise - */ - void setSupportsIntegrityEnhancementFacility( Boolean supportsIntegrityEnhancementFacility ); - - /** - * Retrieves whether this database supports some form of outer join. - * - * @return true if so; false otherwise - */ - Boolean isSupportsOuterJoins(); - - /** - * Sets whether this database supports some form of outer join. - * - * @param supportsOuterJoins true if so; false otherwise - */ - void setSupportsOuterJoins( Boolean supportsOuterJoins ); - - /** - * Retrieves whether this database supports full nested outer joins. - * - * @return true if so; false otherwise - */ - Boolean isSupportsFullOuterJoins(); - - /** - * Sets whether this database supports full nested outer joins. - * - * @param supportsFullOuterJoins true if so; false otherwise - */ - void setSupportsFullOuterJoins( Boolean supportsFullOuterJoins ); - - /** - * Retrieves whether this database provides limited support for outer joins. (This will be true if the method - * DatabaseMetaData.supportsFullOuterJoins returns true). - * - * @return true if so; false otherwise - */ - Boolean isSupportsLimitedOuterJoins(); - - /** - * Sets whether this database provides limited support for outer joins. (This will be true if the method - * DatabaseMetaData.supportsFullOuterJoins returns true). - * - * @param supportsLimitedOuterJoins true if so; false otherwise - */ - void setSupportsLimitedOuterJoins( Boolean supportsLimitedOuterJoins ); - - /** - * Retrieves the database vendor's preferred term for "schema". - * - * @return the vendor term for "schema" - */ - String getSchemaTerm(); - - /** - * Sets the database vendor's preferred term for "schema". - * - * @param schemaTerm the vendor term for "schema" - */ - void setSchemaTerm( String schemaTerm ); - - /** - * Retrieves the database vendor's preferred term for "procedure". - * - * @return the vendor term for "procedure" - */ - String getProcedureTerm(); - - /** - * Sets the database vendor's preferred term for "procedure". - * - * @param procedureTerm the vendor term for "procedure" - */ - void setProcedureTerm( String procedureTerm ); - - /** - * Retrieves the database vendor's preferred term for "catalog". - * - * @return the vendor term for "catalog" - */ - String getCatalogTerm(); - - /** - * Sets the database vendor's preferred term for "catalog". - * - * @param catalogTerm the vendor term for "catalog" - */ - void setCatalogTerm( String catalogTerm ); - - /** - * Retrieves whether a catalog appears at the start of a fully qualified table name. If not, the catalog appears at the end. - * - * @return true if the catalog name appears at the beginning of a fully qualified table name; false - * otherwise - */ - Boolean isCatalogAtStart(); - - /** - * Sets whether a catalog appears at the start of a fully qualified table name. If not, the catalog appears at the end. - * - * @param catalogAtStart true if the catalog name appears at the beginning of a fully qualified table name; - * false otherwise - */ - void setCatalogAtStart( Boolean catalogAtStart ); - - /** - * Retrieves the String that this database uses as the separator between a catalog and table name. - * - * @return the separator string - */ - String getCatalogSeparator(); - - /** - * Sets the String that this database uses as the separator between a catalog and table name. - * - * @param catalogSeparator the separator string - */ - void setCatalogSeparator( String catalogSeparator ); - - /** - * Retrieves whether a schema name can be used in a data manipulation statement. - * - * @return true if so; false otherwise - */ - Boolean isSupportsSchemasInDataManipulation(); - - /** - * Sets whether a schema name can be used in a data manipulation statement. - * - * @param supportsSchemasInDataManipulation true if so; false otherwise - */ - void setSupportsSchemasInDataManipulation( Boolean supportsSchemasInDataManipulation ); - - /** - * Retrieves whether a schema name can be used in a procedure call statement. - * - * @return true if so; false otherwise - */ - Boolean isSupportsSchemasInProcedureCalls(); - - /** - * Sets whether a schema name can be used in a procedure call statement. - * - * @param supportsSchemasInProcedureCalls true if so; false otherwise - */ - void setSupportsSchemasInProcedureCalls( Boolean supportsSchemasInProcedureCalls ); - - /** - * Retrieves whether a schema name can be used in a table definition statement. - * - * @return true if so; false otherwise - */ - Boolean isSupportsSchemasInTableDefinitions(); - - /** - * Sets whether a schema name can be used in a table definition statement. - * - * @param supportsSchemasInTableDefinitions true if so; false otherwise - */ - void setSupportsSchemasInTableDefinitions( Boolean supportsSchemasInTableDefinitions ); - - /** - * Retrieves whether a schema name can be used in an index definition statement. - * - * @return true if so; false otherwise - */ - Boolean isSupportsSchemasInIndexDefinitions(); - - /** - * Sets whether a schema name can be used in an index definition statement. - * - * @param supportsSchemasInIndexDefinitions true if so; false otherwise - */ - void setSupportsSchemasInIndexDefinitions( Boolean supportsSchemasInIndexDefinitions ); - - /** - * Retrieves whether a schema name can be used in a privilege definition statement. - * - * @return true if so; false otherwise - */ - Boolean isSupportsSchemasInPrivilegeDefinitions(); - - /** - * Sets whether a schema name can be used in a privilege definition statement. - * - * @param supportsSchemasInPrivilegeDefinitions true if so; false otherwise - */ - void setSupportsSchemasInPrivilegeDefinitions( Boolean supportsSchemasInPrivilegeDefinitions ); - - /** - * Retrieves whether a catalog name can be used in a data manipulation statement. - * - * @return true if so; false otherwise - */ - Boolean isSupportsCatalogsInDataManipulation(); - - /** - * Sets whether a catalog name can be used in a data manipulation statement. - * - * @param supportsCatalogsInDataManipulation true if so; false otherwise - */ - void setSupportsCatalogsInDataManipulation( Boolean supportsCatalogsInDataManipulation ); - - /** - * Retrieves whether a catalog name can be used in a procedure call statement. - * - * @return true if so; false otherwise - */ - Boolean isSupportsCatalogsInProcedureCalls(); - - /** - * Sets whether a catalog name can be used in a procedure call statement. - * - * @param supportsCatalogsInProcedureCalls true if so; false otherwise - */ - void setSupportsCatalogsInProcedureCalls( Boolean supportsCatalogsInProcedureCalls ); - - /** - * Retrieves whether a catalog name can be used in a table definition statement. - * - * @return true if so; false otherwise - */ - Boolean isSupportsCatalogsInTableDefinitions(); - - /** - * Sets whether a catalog name can be used in a table definition statement. - * - * @param supportsCatalogsInTableDefinitions true if so; false otherwise - */ - void setSupportsCatalogsInTableDefinitions( Boolean supportsCatalogsInTableDefinitions ); - - /** - * Retrieves whether a catalog name can be used in an index definition statement. - * - * @return true if so; false otherwise - */ - Boolean isSupportsCatalogsInIndexDefinitions(); - - /** - * Sets whether a catalog name can be used in an index definition statement. - * - * @param supportsCatalogsInIndexDefinitions true if so; false otherwise - */ - void setSupportsCatalogsInIndexDefinitions( Boolean supportsCatalogsInIndexDefinitions ); - - /** - * Retrieves whether a catalog name can be used in a privilege definition statement. - * - * @return true if so; false otherwise - */ - Boolean isSupportsCatalogsInPrivilegeDefinitions(); - - /** - * Sets whether a catalog name can be used in a privilege definition statement. - * - * @param supportsCatalogsInPrivilegeDefinitions true if so; false otherwise - */ - void setSupportsCatalogsInPrivilegeDefinitions( Boolean supportsCatalogsInPrivilegeDefinitions ); - - /** - * Retrieves whether this database supports positioned DELETE statements. - * - * @return true if so; false otherwise - */ - Boolean isSupportsPositionedDelete(); - - /** - * Sets whether this database supports positioned DELETE statements. - * - * @param supportsPositionedDelete true if so; false otherwise - */ - void setSupportsPositionedDelete( Boolean supportsPositionedDelete ); - - /** - * Retrieves whether this database supports positioned UPDATE statements. - * - * @return true if so; false otherwise - */ - Boolean isSupportsPositionedUpdate(); - - /** - * Sets whether this database supports positioned UPDATE statements. - * - * @param supportsPositionedUpdate true if so; false otherwise - */ - void setSupportsPositionedUpdate( Boolean supportsPositionedUpdate ); - - /** - * Retrieves whether this database supports SELECT FOR UPDATE statements. - * - * @return true if so; false otherwise - */ - Boolean isSupportsSelectForUpdate(); - - /** - * Sets whether this database supports SELECT FOR UPDATE statements. - * - * @param supportsSelectForUpdate true if so; false otherwise - */ - void setSupportsSelectForUpdate( Boolean supportsSelectForUpdate ); - - /** - * Retrieves whether this database supports stored procedure calls that use the stored procedure escape syntax. - * - * @return true if so; false otherwise - */ - Boolean isSupportsStoredProcedures(); - - /** - * Sets whether this database supports stored procedure calls that use the stored procedure escape syntax. - * - * @param supportsStoredProcedures true if so; false otherwise - */ - void setSupportsStoredProcedures( Boolean supportsStoredProcedures ); - - /** - * Retrieves whether this database supports subqueries in comparison expressions. - * - * @return true if so; false otherwise - */ - Boolean isSupportsSubqueriesInComparisons(); - - /** - * Retrieves whether this database supports subqueries in comparison expressions. - * - * @param supportsSubqueriesInComparisons true if so; false otherwise - */ - void setSupportsSubqueriesInComparisons( Boolean supportsSubqueriesInComparisons ); - - /** - * Retrieves whether this database supports subqueries in EXISTS expressions. - * - * @return true if so; false otherwise - */ - Boolean isSupportsSubqueriesInExists(); - - /** - * Sets whether this database supports subqueries in EXISTS expressions. - * - * @param supportsSubqueriesInExists true if so; false otherwise - */ - void setSupportsSubqueriesInExists( Boolean supportsSubqueriesInExists ); - - /** - * Retrieves whether this database supports subqueries in IN statements. - * - * @return true if so; false otherwise - */ - Boolean isSupportsSubqueriesInIns(); - - /** - * Sets whether this database supports subqueries in IN statements. - * - * @param supportsSubqueriesInIns true if so; false otherwise - */ - void setSupportsSubqueriesInIns( Boolean supportsSubqueriesInIns ); - - /** - * Retrieves whether this database supports subqueries in quantified expressions. - * - * @return true if so; false otherwise - */ - Boolean isSupportsSubqueriesInQuantifieds(); - - /** - * Sets whether this database supports subqueries in quantified expressions. - * - * @param supportsSubqueriesInQuantifieds true if so; false otherwise - */ - void setSupportsSubqueriesInQuantifieds( Boolean supportsSubqueriesInQuantifieds ); - - /** - * Retrieves whether this database supports correlated subqueries. - * - * @return true if so; false otherwise - */ - Boolean isSupportsCorrelatedSubqueries(); - - /** - * Sets whether this database supports correlated subqueries. - * - * @param supportsCorrelatedSubqueries true if so; false otherwise - */ - void setSupportsCorrelatedSubqueries( Boolean supportsCorrelatedSubqueries ); - - /** - * Retrieves whether this database supports SQL UNION. - * - * @return true if so; false otherwise - */ - Boolean isSupportsUnion(); - - /** - * Sets whether this database supports SQL UNION. - * - * @param supportsUnion true if so; false otherwise - */ - void setSupportsUnion( Boolean supportsUnion ); - - /** - * Retrieves whether this database supports SQL UNION ALL. - * - * @return true if so; false otherwise - */ - Boolean isSupportsUnionAll(); - - /** - * Sets whether this database supports SQL UNION ALL. - * - * @param supportsUnionAll true if so; false otherwise - */ - void setSupportsUnionAll( Boolean supportsUnionAll ); - - /** - * Retrieves whether this database supports keeping cursors open across commits. - * - * @return true if cursors always remain open; false if they might not remain open - */ - Boolean isSupportsOpenCursorsAcrossCommit(); - - /** - * Sets whether this database supports keeping cursors open across commits. - * - * @param supportsOpenCursorsAcrossCommit true if cursors always remain open; false if they might - * not remain open - */ - void setSupportsOpenCursorsAcrossCommit( Boolean supportsOpenCursorsAcrossCommit ); - - /** - * Retrieves whether this database supports keeping cursors open across rollbacks. - * - * @return true if cursors always remain open; false if they might not remain open - */ - Boolean isSupportsOpenCursorsAcrossRollback(); - - /** - * Sets whether this database supports keeping cursors open across rollbacks. - * - * @param supportsOpenCursorsAcrossRollback true if cursors always remain open; false if they might - * not remain open - */ - void setSupportsOpenCursorsAcrossRollback( Boolean supportsOpenCursorsAcrossRollback ); - - /** - * Retrieves whether this database supports keeping statements open across commits. - * - * @return true if statements always remain open; false if they might not remain open - */ - Boolean isSupportsOpenStatementsAcrossCommit(); - - /** - * sets whether this database supports keeping statements open across commits. - * - * @param supportsOpenStatementsAcrossCommit true if statements always remain open; false if they - * might not remain open - */ - void setSupportsOpenStatementsAcrossCommit( Boolean supportsOpenStatementsAcrossCommit ); - - /** - * Retrieves whether this database supports keeping statements open across rollbacks. - * - * @return true if statements always remain open; false if they might not remain open - */ - Boolean isSupportsOpenStatementsAcrossRollback(); - - /** - * Sets whether this database supports keeping statements open across rollbacks. - * - * @param supportsOpenStatementsAcrossRollback true if statements always remain open; false if they - * might not remain open - */ - void setSupportsOpenStatementsAcrossRollback( Boolean supportsOpenStatementsAcrossRollback ); - - // ---------------------------------------------------------------------- - // The following group of methods exposes various limitations based on the target - // database with the current driver. Unless otherwise specified, a result of zero - // means there is no limit, or the limit is not known. - // ---------------------------------------------------------------------- - - /** - * Retrieves the maximum number of hex characters this database allows in an inline binary literal. - * - * @return max the maximum length (in hex characters) for a binary literal; a result of zero means that there is no limit or - * the limit is not known - */ - Integer getMaxBinaryLiteralLength(); - - /** - * sets the maximum number of hex characters this database allows in an inline binary literal. - * - * @param maxBinaryLiteralLength max the maximum length (in hex characters) for a binary literal; a result of zero means that - * there is no limit or the limit is not known - */ - void setMaxBinaryLiteralLength( Integer maxBinaryLiteralLength ); - - /** - * Retrieves the maximum number of characters this database allows for a character literal. - * - * @return the maximum number of characters allowed for a character literal; a result of zero means that there is no limit or - * the limit is not known - */ - Integer getMaxCharLiteralLength(); - - /** - * Sets the maximum number of characters this database allows for a character literal. - * - * @param maxCharLiteralLength the maximum number of characters allowed for a character literal; a result of zero means that - * there is no limit or the limit is not known - */ - void setMaxCharLiteralLength( Integer maxCharLiteralLength ); - - /** - * Retrieves the maximum number of characters this database allows for a column name. - * - * @return the maximum number of characters allowed for a column name; a result of zero means that there is no limit or the - * limit is not known - */ - Integer getMaxColumnNameLength(); - - /** - * Sets the maximum number of characters this database allows for a column name. - * - * @param maxColumnNameLength the maximum number of characters allowed for a column name; a result of zero means that there is - * no limit or the limit is not known - */ - void setMaxColumnNameLength( Integer maxColumnNameLength ); - - /** - * Retrieves the maximum number of columns this database allows in a GROUP BY clause. - * - * @return the maximum number of columns allowed; a result of zero means that there is no limit or the limit is not known - */ - Integer getMaxColumnsInGroupBy(); - - /** - * Sets the maximum number of columns this database allows in a GROUP BY clause. - * - * @param maxColumnsInGroupBy the maximum number of columns allowed; a result of zero means that there is no limit or the - * limit is not known - */ - void setMaxColumnsInGroupBy( Integer maxColumnsInGroupBy ); - - /** - * Retrieves the maximum number of columns this database allows in an index. - * - * @return the maximum number of columns allowed; a result of zero means that there is no limit or the limit is not known - */ - Integer getMaxColumnsInIndex(); - - /** - * Sets the maximum number of columns this database allows in an index. - * - * @param maxColumnsInIndex the maximum number of columns allowed; a result of zero means that there is no limit or the limit - * is not known - */ - void setMaxColumnsInIndex( Integer maxColumnsInIndex ); - - /** - * Retrieves the maximum number of columns this database allows in an ORDER BY clause. - * - * @return the maximum number of columns allowed; a result of zero means that there is no limit or the limit is not known - */ - Integer getMaxColumnsInOrderBy(); - - /** - * Sets the maximum number of columns this database allows in an ORDER BY clause. - * - * @param maxColumnsInOrderBy the maximum number of columns allowed; a result of zero means that there is no limit or the - * limit is not known - */ - void setMaxColumnsInOrderBy( Integer maxColumnsInOrderBy ); - - /** - * Retrieves the maximum number of columns this database allows in a SELECT list. - * - * @return the maximum number of columns allowed; a result of zero means that there is no limit or the limit is not known - */ - Integer getMaxColumnsInSelect(); - - /** - * Sets the maximum number of columns this database allows in a SELECT list. - * - * @param maxColumnsInSelect the maximum number of columns allowed; a result of zero means that there is no limit or the limit - * is not known - */ - void setMaxColumnsInSelect( Integer maxColumnsInSelect ); - - /** - * Retrieves the maximum number of columns this database allows in a table. - * - * @return the maximum number of columns allowed; a result of zero means that there is no limit or the limit is not known - */ - Integer getMaxColumnsInTable(); - - /** - * Sets the maximum number of columns this database allows in a table. - * - * @param maxColumnsInTable the maximum number of columns allowed; a result of zero means that there is no limit or the limit - * is not known - */ - void setMaxColumnsInTable( Integer maxColumnsInTable ); - - /** - * Retrieves the maximum number of concurrent connections to this database that are possible. - * - * @return the maximum number of active connections possible at one time; a result of zero means that there is no limit or the - * limit is not known - */ - Integer getMaxConnections(); - - /** - * Sets the maximum number of concurrent connections to this database that are possible. - * - * @param maxConnections the maximum number of active connections possible at one time; a result of zero means that there is - * no limit or the limit is not known - */ - void setMaxConnections( Integer maxConnections ); - - /** - * Retrieves the maximum number of characters that this database allows in a cursor name. - * - * @return the maximum number of characters allowed in a cursor name; a result of zero means that there is no limit or the - * limit is not known - */ - Integer getMaxCursorNameLength(); - - /** - * Sets the maximum number of characters that this database allows in a cursor name. - * - * @param maxCursorNameLength the maximum number of characters allowed in a cursor name; a result of zero means that there is - * no limit or the limit is not known - */ - void setMaxCursorNameLength( Integer maxCursorNameLength ); - - /** - * Retrieves the maximum number of bytes this database allows for an index, including all of the parts of the index. - * - * @return the maximum number of bytes allowed; this limit includes the composite of all the constituent parts of the index; a - * result of zero means that there is no limit or the limit is not known - */ - Integer getMaxIndexLength(); - - /** - * Sets the maximum number of bytes this database allows for an index, including all of the parts of the index. - * - * @param maxIndexLength the maximum number of bytes allowed; this limit includes the composite of all the constituent parts - * of the index; a result of zero means that there is no limit or the limit is not known - */ - void setMaxIndexLength( Integer maxIndexLength ); - - /** - * Retrieves the maximum number of characters that this database allows in a schema name. - * - * @return the maximum number of characters allowed in a schema name; a result of zero means that there is no limit or the - * limit is not known - */ - Integer getMaxSchemaNameLength(); - - /** - * Sets the maximum number of characters that this database allows in a schema name. - * - * @param maxSchemaNameLength the maximum number of characters allowed in a schema name; a result of zero means that there is - * no limit or the limit is not known - */ - void setMaxSchemaNameLength( Integer maxSchemaNameLength ); - - /** - * Retrieves the maximum number of characters that this database allows in a procedure name. - * - * @return the maximum number of characters allowed in a procedure name; a result of zero means that there is no limit or the - * limit is not known - */ - Integer getMaxProcedureNameLength(); - - /** - * Sets the maximum number of characters that this database allows in a procedure name. - * - * @param maxProcedureNameLength the maximum number of characters allowed in a procedure name; a result of zero means that - * there is no limit or the limit is not known - */ - void setMaxProcedureNameLength( Integer maxProcedureNameLength ); - - /** - * Retrieves the maximum number of characters that this database allows in a catalog name. - * - * @return the maximum number of characters allowed in a catalog name; a result of zero means that there is no limit or the - * limit is not known - */ - Integer getMaxCatalogNameLength(); - - /** - * Sets the maximum number of characters that this database allows in a catalog name. - * - * @param maxCatalogNameLength the maximum number of characters allowed in a catalog name; a result of zero means that there - * is no limit or the limit is not known - */ - void setMaxCatalogNameLength( Integer maxCatalogNameLength ); - - /** - * Retrieves the maximum number of bytes this database allows in a single row. - * - * @return the maximum number of bytes allowed for a row; a result of zero means that there is no limit or the limit is not - * known - */ - Integer getMaxRowSize(); - - /** - * Sets the maximum number of bytes this database allows in a single row. - * - * @param maxRowSize the maximum number of bytes allowed for a row; a result of zero means that there is no limit or the limit - * is not known - */ - void setMaxRowSize( Integer maxRowSize ); - - /** - * Retrieves whether the return value for the method getMaxRowSize includes the SQL data types - * LONGVARCHAR and LONGVARBINARY. - * - * @return true if so; false otherwise - */ - Boolean isMaxRowSizeIncludeBlobs(); - - /** - * Sets whether the return value for the method getMaxRowSize includes the SQL data types - * LONGVARCHAR and LONGVARBINARY. - * - * @param maxRowSizeIncludeBlobs true if so; false otherwise - */ - void setMaxRowSizeIncludeBlobs( Boolean maxRowSizeIncludeBlobs ); - - /** - * Retrieves the maximum number of characters this database allows in an SQL statement. - * - * @return the maximum number of characters allowed for an SQL statement; a result of zero means that there is no limit or the - * limit is not known - */ - Integer getMaxStatementLength(); - - /** - * Sets the maximum number of characters this database allows in an SQL statement. - * - * @param maxStatementLength the maximum number of characters allowed for an SQL statement; a result of zero means that there - * is no limit or the limit is not known - */ - void setMaxStatementLength( Integer maxStatementLength ); - - /** - * Retrieves the maximum number of active statements to this database that can be open at the same time. - * - * @return the maximum number of statements that can be open at one time; a result of zero means that there is no limit or the - * limit is not known - */ - Integer getMaxStatements(); - - /** - * Sets the maximum number of active statements to this database that can be open at the same time. - * - * @param maxStatements the maximum number of statements that can be open at one time; a result of zero means that there is no - * limit or the limit is not known - */ - void setMaxStatements( Integer maxStatements ); - - /** - * Retrieves the maximum number of characters this database allows in a table name. - * - * @return the maximum number of characters allowed for a table name; a result of zero means that there is no limit or the - * limit is not known - */ - Integer getMaxTableNameLength(); - - /** - * Sets the maximum number of characters this database allows in a table name. - * - * @param maxTableNameLength the maximum number of characters allowed for a table name; a result of zero means that there is - * no limit or the limit is not known - */ - void setMaxTableNameLength( Integer maxTableNameLength ); - - /** - * Retrieves the maximum number of tables this database allows in a SELECT statement. - * - * @return the maximum number of tables allowed in a SELECT statement; a result of zero means that there is no - * limit or the limit is not known - */ - Integer getMaxTablesInSelect(); - - /** - * Sets the maximum number of tables this database allows in a SELECT statement. - * - * @param maxTablesInSelect the maximum number of tables allowed in a SELECT statement; a result of zero means - * that there is no limit or the limit is not known - */ - void setMaxTablesInSelect( Integer maxTablesInSelect ); - - /** - * Retrieves the maximum number of characters this database allows in a user name. - * - * @return the maximum number of characters allowed for a user name; a result of zero means that there is no limit or the - * limit is not known - */ - Integer getMaxUserNameLength(); - - /** - * Sets the maximum number of characters this database allows in a user name. - * - * @param maxUserNameLength the maximum number of characters allowed for a user name; a result of zero means that there is no - * limit or the limit is not known - */ - void setMaxUserNameLength( Integer maxUserNameLength ); - - /** - * Retrieves this database's default transaction isolation level. The possible values are defined in - * java.sql.Connection. - * - * @return the default isolation level - * @see java.sql.Connection - */ - Integer getDefaultTransactionIsolation(); - - /** - * Sets this database's default transaction isolation level. The possible values are defined in - * java.sql.Connection. - * - * @param defaultTransactionIsolation the default isolation level - * @see java.sql.Connection - */ - void setDefaultTransactionIsolation( Integer defaultTransactionIsolation ); - - /** - * Retrieves whether this database supports transactions. If not, invoking the method commit is a noop, and the - * isolation level is TRANSACTION_NONE. - * - * @return true if transactions are supported; false otherwise - */ - Boolean isSupportsTransactions(); - - /** - * Sets whether this database supports transactions. If not, invoking the method commit is a noop, and the - * isolation level is TRANSACTION_NONE. - * - * @param supportsTransactions true if transactions are supported; false otherwise - */ - void setSupportsTransactions( Boolean supportsTransactions ); - - /** - * Retrieves list of database supported transaction isolation levels. - * - * @return list of database supported transaction isolation levels. - * @see java.sql.Connection - */ - Set getSupportedTransactionIsolationLevels(); - - /** - * Adds TransactionIsolationLevelType - * - * @param transactionIsolationLevelType the Transaction Isolation Level Type - */ - void addSupportedTransactionIsolationLevelType( TransactionIsolationLevelType transactionIsolationLevelType ); - - /** - * Deletes TransactionIsolationLevelType - * - * @param transactionIsolationLevelType the Transaction Isolation Level Type - */ - void deleteSupportedTransactionIsolationLevelType( TransactionIsolationLevelType transactionIsolationLevelType ); - - /** - * Is supported TransactionIsolationLevelType - * - * @param transactionIsolationLevelType the Transaction Isolation Level Type - * @return true if supported - */ - Boolean isSupportedTransactionIsolationLevelType( TransactionIsolationLevelType transactionIsolationLevelType ); - - /** - * Retrieves whether this database supports both data definition and data manipulation statements within a transaction. - * - * @return true if so; false otherwise - */ - Boolean isSupportsDataDefinitionAndDataManipulationTransactions(); - - /** - * Sets whether this database supports both data definition and data manipulation statements within a transaction. - * - * @param supportsDataDefinitionAndDataManipulationTransactions true if so; false otherwise - */ - void setSupportsDataDefinitionAndDataManipulationTransactions( Boolean supportsDataDefinitionAndDataManipulationTransactions ); - - /** - * Retrieves whether this database supports only data manipulation statements within a transaction. - * - * @return true if so; false otherwise - */ - Boolean isSupportsDataManipulationTransactionsOnly(); - - /** - * Sets whether this database supports only data manipulation statements within a transaction. - * - * @param supportsDataManipulationTransactionsOnly true if so; false otherwise - */ - void setSupportsDataManipulationTransactionsOnly( Boolean supportsDataManipulationTransactionsOnly ); - - /** - * Retrieves whether a data definition statement within a transaction forces the transaction to commit. - * - * @return true if so; false otherwise - */ - Boolean isDataDefinitionCausesTransactionCommit(); - - /** - * Sets whether a data definition statement within a transaction forces the transaction to commit. - * - * @param dataDefinitionCausesTransactionCommit true if so; false otherwise - */ - void setDataDefinitionCausesTransactionCommit( Boolean dataDefinitionCausesTransactionCommit ); - - /** - * Retrieves whether this database ignores a data definition statement within a transaction. - * - * @return true if so; false otherwise - */ - Boolean isDataDefinitionIgnoredInTransactions(); - - /** - * Sets whether this database ignores a data definition statement within a transaction. - * - * @param dataDefinitionIgnoredInTransactions true if so; false otherwise - */ - void setDataDefinitionIgnoredInTransactions( Boolean dataDefinitionIgnoredInTransactions ); - - /** - * Retrieves a description of the stored procedures available in the given catalog. - * - * @return a set of stored procedures available - */ - Set getStoredProcedures(); - - /** - * Adds Stored Procedure - * - * @param storedProcedure the Stored Procedure - */ - void addStoredProcedure( StoredProcedure storedProcedure ); - - /** - * Deletes Stored Procedure - * - * @param storedProcedure the Stored Procedure - */ - void deleteStoredProcedure( StoredProcedure storedProcedure ); - - /** - * Finds stored procedute by its name. - * - * @param catalog a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a - * catalog; null means that the catalog name should not be used to narrow the search - * @param schema a schema name; must match the schema name as it is stored in the database; "" retrieves those without a - * schema; null means that the schema name should not be used to narrow the search - * @param procedureName a procedure name; must match the procedure name as it is stored in the database - * @return stored procedure or null if not found - */ - StoredProcedure findStoredProcedureByName( String catalog, - String schema, - String procedureName ); - - /** - * Retrieves a description of the tables available in the given catalog. - * - * @return a set of tables available - */ - Set getTables(); - - /** - * Adds Table - * - * @param table the table to add - */ - void addTable( Table table ); - - /** - * Deletes Table - * - * @param table the table to delete - */ - void deleteTable( Table table ); - - /** - * Finds table by its name. - * - * @param catalog a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a - * catalog; null means that the catalog name should not be used to narrow the search - * @param schema a schema name; must match the schema name as it is stored in the database; "" retrieves those without a - * schema; null means that the schema name should not be used to narrow the search - * @param tableName a table name; must match the table name as it is stored in the database - * @return table or null if not found - */ - Table findTableByName( String catalog, - String schema, - String tableName ); - - /** - * Retrieves the schemas available in this database. The results are ordered by schema name. - * - * @return schemas available in this database. - */ - Set getSchemas(); - - /** - * Adds Schema - * - * @param schema the Schema - */ - void addSchema( Schema schema ); - - /** - * Deletes Schema - * - * @param schema the Schema - */ - void deleteSchema( Schema schema ); - - /** - * Finds schema by its name. - * - * @param catalog a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a - * catalog; null means that the catalog name should not be used to narrow the search - * @param schemaName a schema name; must match the schema name as it is stored in the database; - * @return schema or null if not found - */ - Schema findSchemaByName( String catalog, - String schemaName ); - - /** - * Retrieves the catalogs available in this database - * - * @return catalogs available in this database - */ - Set getCatalogs(); - - /** - * Adds Catalog - * - * @param catalog the catalog to add - */ - void addCatalog( Catalog catalog ); - - /** - * Deletes Catalog - * - * @param catalog the catalog to delete - */ - void deleteCatalog( Catalog catalog ); - - /** - * Finds catalog by its name. - * - * @param catalogName a catalog name; must match the catalog name as it is stored in the database; - * @return catalog or null if not found - */ - Catalog findCatalogByName( String catalogName ); - - /** - * Retrieves the table types available in this database. The results are ordered by table type. - *

- * The table type is: - *

    - *
  1. TABLE_TYPE String => table type. Typical types are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", - * "LOCAL TEMPORARY", "ALIAS", "SYNONYM". - *
- * - * @return table types available in this database - */ - Set getTableTypes(); - - /** - * Adds TableType - * - * @param tableType the table type to add - */ - void addTableType( TableType tableType ); - - /** - * Deletes TableType - * - * @param tableType the table type to delete - */ - void deleteTableType( TableType tableType ); - - /** - * Finds table type by its name. - * - * @param typeName a table type name; must match the type name as it is stored in the database; - * @return table type or null if not found - */ - TableType findTableTypeByTypeName( String typeName ); - - /** - * Retrieves a description of all the standard SQL types supported by this database - * - * @return all the standard SQL types supported by this database - */ - Set getSqlTypeInfos(); - - /** - * Adds SqlTypeInfo - * - * @param sqlTypeInfo the SQL type to add - */ - void addSqlTypeInfo( SqlTypeInfo sqlTypeInfo ); - - /** - * Deletes SqlTypeInfo - * - * @param sqlTypeInfo the SQL type to delete - */ - void deleteSqlTypeInfo( SqlTypeInfo sqlTypeInfo ); - - /** - * Finds SQL type by its name. - * - * @param typeName a table type name; must match the type name as it is stored in the database; - * @return table type or null if not found - */ - SqlTypeInfo findSqlTypeInfoByTypeName( String typeName ); - - // =============================================================== - // --------------------------JDBC 2.0----------------------------- - // =============================================================== - - /** - * Retrieves database supported result set types. - * - * @return database supported result set types. - * @see java.sql.Connection - * @since 1.2 (JDBC 2.0) - */ - Set getSupportedResultSetTypes(); - - /** - * Adds supported ResultSetType - * - * @param resultSetType the ResultSetType - */ - void addSupportedResultSetType( ResultSetType resultSetType ); - - /** - * Deletes supported ResultSetType - * - * @param resultSetType the ResultSetType - */ - void deleteSupportedResultSetType( ResultSetType resultSetType ); - - /** - * Retrieves database supported concurrencies for the given result set type. - * - * @return database supported concurrencies for the given result set type. - * @see java.sql.Connection - * @since 1.2 (JDBC 2.0) - */ - Set getSupportedForwardOnlyResultSetConcurrencies(); - - /** - * Adds ResultSetConcurrencyType - * - * @param resultSetConcurrencyType the ResultSetConcurrencyType - */ - void addSupportedForwardOnlyResultSetConcurrency( ResultSetConcurrencyType resultSetConcurrencyType ); - - /** - * Deletes ResultSetConcurrencyType - * - * @param resultSetConcurrencyType the ResultSetConcurrencyType - */ - void deleteSupportedForwardOnlyResultSetConcurrency( ResultSetConcurrencyType resultSetConcurrencyType ); - - /** - * Retrieves database supported concurrencies for the given result set type. - * - * @return database supported concurrencies for the given result set type. - * @see java.sql.Connection - * @since 1.2 (JDBC 2.0) - */ - Set getSupportedScrollInsensitiveResultSetConcurrencies(); - - /** - * Adds ResultSetConcurrencyType - * - * @param resultSetConcurrencyType the ResultSetConcurrencyType - */ - void addSupportedScrollInsensitiveResultSetConcurrency( ResultSetConcurrencyType resultSetConcurrencyType ); - - /** - * Delete ResultSetConcurrencyType - * - * @param resultSetConcurrencyType the ResultSetConcurrencyType - */ - void deleteSupportedScrollInsensitiveResultSetConcurrency( ResultSetConcurrencyType resultSetConcurrencyType ); - - /** - * Retrieves database supported concurrencies for the given result set type. - * - * @return database supported concurrencies for the given result set type. - * @see java.sql.Connection - * @since 1.2 (JDBC 2.0) - */ - Set getSupportedScrollSensitiveResultSetConcurrencies(); - - /** - * Adds resultSetConcurrencyType - * - * @param resultSetConcurrencyType the ResultSetConcurrencyType - */ - void addSupportedScrollSensitiveResultSetConcurrency( ResultSetConcurrencyType resultSetConcurrencyType ); - - /** - * delete resultSetConcurrencyType - * - * @param resultSetConcurrencyType the ResultSetConcurrencyType - */ - void deleteSupportedScrollSensitiveResultSetConcurrency( ResultSetConcurrencyType resultSetConcurrencyType ); - - /** - * Retrieves whether for the given type of ResultSet object, the result set's own updates are visible. - * - * @return true if updates are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - Boolean isForwardOnlyResultSetOwnUpdatesAreVisible(); - - /** - * Sets whether for the given type of ResultSet object, the result set's own updates are visible. - * - * @param forwardOnlyResultSetOwnUpdatesAreVisible true if updates are visible for the given result set type; - * false otherwise - * @since 1.2 (JDBC 2.0) - */ - void setForwardOnlyResultSetOwnUpdatesAreVisible( Boolean forwardOnlyResultSetOwnUpdatesAreVisible ); - - /** - * Retrieves whether for the given type of ResultSet object, the result set's own updates are visible. - * - * @return true if updates are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - Boolean isScrollInsensitiveResultSetOwnUpdatesAreVisible(); - - /** - * Sets whether for the given type of ResultSet object, the result set's own updates are visible. - * - * @param scrollInsensitiveResultSetOwnUpdatesAreVisible true if updates are visible for the given result set - * type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - void setScrollInsensitiveResultSetOwnUpdatesAreVisible( Boolean scrollInsensitiveResultSetOwnUpdatesAreVisible ); - - /** - * Retrieves whether for the given type of ResultSet object, the result set's own updates are visible. - * - * @return true if updates are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - Boolean isScrollSensitiveResultSetOwnUpdatesAreVisible(); - - /** - * Sets whether for the given type of ResultSet object, the result set's own updates are visible. - * - * @param scrollSensitiveResultSetOwnUpdatesAreVisible true if updates are visible for the given result set type; - * false otherwise - * @since 1.2 (JDBC 2.0) - */ - void setScrollSensitiveResultSetOwnUpdatesAreVisible( Boolean scrollSensitiveResultSetOwnUpdatesAreVisible ); - - /** - * Retrieves whether a result set's own deletes are visible. - * - * @return true if deletes are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - Boolean isForwardOnlyResultSetOwnDeletesAreVisible(); - - /** - * Sets whether a result set's own deletes are visible. - * - * @param forwardOnlyResultSetOwnDeletesAreVisible true if deletes are visible for the given result set type; - * false otherwise - * @since 1.2 (JDBC 2.0) - */ - void setForwardOnlyResultSetOwnDeletesAreVisible( Boolean forwardOnlyResultSetOwnDeletesAreVisible ); - - /** - * Retrieves whether a result set's own deletes are visible. - * - * @return true if deletes are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - Boolean isScrollInsensitiveResultSetOwnDeletesAreVisible(); - - /** - * Sets whether a result set's own deletes are visible. - * - * @param scrollInsensitiveResultSetOwnDeletesAreVisible true if deletes are visible for the given result set - * type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - void setScrollInsensitiveResultSetOwnDeletesAreVisible( Boolean scrollInsensitiveResultSetOwnDeletesAreVisible ); - - /** - * Retrieves whether a result set's own deletes are visible. - * - * @return true if deletes are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - Boolean isScrollSensitiveResultSetOwnDeletesAreVisible(); - - /** - * Sets whether a result set's own deletes are visible. - * - * @param scrollSensitiveResultSetOwnDeletesAreVisible true if deletes are visible for the given result set type; - * false otherwise - * @since 1.2 (JDBC 2.0) - */ - void setScrollSensitiveResultSetOwnDeletesAreVisible( Boolean scrollSensitiveResultSetOwnDeletesAreVisible ); - - /** - * Retrieves whether a result set's own inserts are visible. - * - * @return true if inserts are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - Boolean isForwardOnlyResultSetOwnInsertsAreVisible(); - - /** - * Sets whether a result set's own inserts are visible. - * - * @param forwardOnlyResultSetOwnInsertsAreVisible true if inserts are visible for the given result set type; - * false otherwise - * @since 1.2 (JDBC 2.0) - */ - void setForwardOnlyResultSetOwnInsertsAreVisible( Boolean forwardOnlyResultSetOwnInsertsAreVisible ); - - /** - * Retrieves whether a result set's own inserts are visible. - * - * @return true if inserts are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - Boolean isScrollInsensitiveResultSetOwnInsertsAreVisible(); - - /** - * Sets whether a result set's own inserts are visible. - * - * @param scrollInsensitiveResultSetOwnInsertsAreVisible true if inserts are visible for the given result set - * type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - void setScrollInsensitiveResultSetOwnInsertsAreVisible( Boolean scrollInsensitiveResultSetOwnInsertsAreVisible ); - - /** - * Retrieves whether a result set's own inserts are visible. - * - * @return true if inserts are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - Boolean isScrollSensitiveResultSetOwnInsertsAreVisible(); - - /** - * Sets whether a result set's own inserts are visible. - * - * @param scrollSensitiveResultSetOwnInsertsAreVisible true if inserts are visible for the given result set type; - * false otherwise - * @since 1.2 (JDBC 2.0) - */ - void setScrollSensitiveResultSetOwnInsertsAreVisible( Boolean scrollSensitiveResultSetOwnInsertsAreVisible ); - - /** - * Retrieves whether updates made by others are visible. - * - * @return true if updates made by others are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - Boolean isForwardOnlyResultSetOthersUpdatesAreVisible(); - - /** - * Sets whether updates made by others are visible. - * - * @param forwardOnlyResultSetOthersUpdatesAreVisible true if updates made by others are visible for the given - * result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - void setForwardOnlyResultSetOthersUpdatesAreVisible( Boolean forwardOnlyResultSetOthersUpdatesAreVisible ); - - /** - * Retrieves whether updates made by others are visible. - * - * @return true if updates made by others are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - Boolean isScrollInsensitiveResultSetOthersUpdatesAreVisible(); - - /** - * Sets whether updates made by others are visible. - * - * @param scrollInsensitiveResultSetOthersUpdatesAreVisible true if updates made by others are visible for the - * given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - void setScrollInsensitiveResultSetOthersUpdatesAreVisible( Boolean scrollInsensitiveResultSetOthersUpdatesAreVisible ); - - /** - * Retrieves whether updates made by others are visible. - * - * @return true if updates made by others are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - Boolean isScrollSensitiveResultSetOthersUpdatesAreVisible(); - - /** - * Sets whether updates made by others are visible. - * - * @param scrollSensitiveResultSetOthersUpdatesAreVisible true if updates made by others are visible for the - * given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - void setScrollSensitiveResultSetOthersUpdatesAreVisible( Boolean scrollSensitiveResultSetOthersUpdatesAreVisible ); - - /** - * Retrieves whether deletes made by others are visible. - * - * @return true if deletes made by others are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - Boolean isForwardOnlyResultSetOthersDeletesAreVisible(); - - /** - * Sets whether deletes made by others are visible. - * - * @param forwardOnlyResultSetOthersDeletesAreVisible true if deletes made by others are visible for the given - * result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - void setForwardOnlyResultSetOthersDeletesAreVisible( Boolean forwardOnlyResultSetOthersDeletesAreVisible ); - - /** - * Retrieves whether deletes made by others are visible. - * - * @return true if deletes made by others are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - Boolean isScrollInsensitiveResultSetOthersDeletesAreVisible(); - - /** - * Sets whether deletes made by others are visible. - * - * @param scrollInsensitiveResultSetOthersDeletesAreVisible true if deletes made by others are visible for the - * given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - void setScrollInsensitiveResultSetOthersDeletesAreVisible( Boolean scrollInsensitiveResultSetOthersDeletesAreVisible ); - - /** - * Retrieves whether deletes made by others are visible. - * - * @return true if deletes made by others are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - Boolean isScrollSensitiveResultSetOthersDeletesAreVisible(); - - /** - * Sets whether deletes made by others are visible. - * - * @param scrollSensitiveResultSetOthersDeletesAreVisible true if deletes made by others are visible for the - * given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - void setScrollSensitiveResultSetOthersDeletesAreVisible( Boolean scrollSensitiveResultSetOthersDeletesAreVisible ); - - /** - * Retrieves whether inserts made by others are visible. - * - * @return true if inserts made by others are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - Boolean isForwardOnlyResultSetOthersInsertsAreVisible(); - - /** - * Sets whether inserts made by others are visible. - * - * @param forwardOnlyResultSetOthersInsertsAreVisible true if inserts made by others are visible for the given - * result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - void setForwardOnlyResultSetOthersInsertsAreVisible( Boolean forwardOnlyResultSetOthersInsertsAreVisible ); - - /** - * Retrieves whether inserts made by others are visible. - * - * @return true if inserts made by others are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - Boolean isScrollInsensitiveResultSetOthersInsertsAreVisible(); - - /** - * Sets whether inserts made by others are visible. - * - * @param scrollInsensitiveResultSetOthersInsertsAreVisible true if inserts made by others are visible for the - * given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - void setScrollInsensitiveResultSetOthersInsertsAreVisible( Boolean scrollInsensitiveResultSetOthersInsertsAreVisible ); - - /** - * Retrieves whether inserts made by others are visible. - * - * @return true if inserts made by others are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - Boolean isScrollSensitiveResultSetOthersInsertsAreVisible(); - - /** - * Sets whether inserts made by others are visible. - * - * @param scrollSensitiveResultSetOthersInsertsAreVisible true if inserts made by others are visible for the - * given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - void setScrollSensitiveResultSetOthersInsertsAreVisible( Boolean scrollSensitiveResultSetOthersInsertsAreVisible ); - - /** - * Retrieves whether or not a visible row update can be detected by calling the method ResultSet.rowUpdated. - * - * @return true if changes are detected by the result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - Boolean isForwardOnlyResultSetUpdatesAreDetected(); - - /** - * Sets whether or not a visible row update can be detected by calling the method ResultSet.rowUpdated. - * - * @param forwardOnlyResultSetUpdatesAreDetected true if changes are detected by the result set type; - * false otherwise - * @since 1.2 (JDBC 2.0) - */ - void setForwardOnlyResultSetUpdatesAreDetected( Boolean forwardOnlyResultSetUpdatesAreDetected ); - - /** - * Retrieves whether or not a visible row update can be detected by calling the method ResultSet.rowUpdated. - * - * @return true if changes are detected by the result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - Boolean isScrollInsensitiveResultSetUpdatesAreDetected(); - - /** - * Sets whether or not a visible row update can be detected by calling the method ResultSet.rowUpdated. - * - * @param scrollInsensitiveResultSetUpdatesAreDetected true if changes are detected by the result set type; - * false otherwise - * @since 1.2 (JDBC 2.0) - */ - void setScrollInsensitiveResultSetUpdatesAreDetected( Boolean scrollInsensitiveResultSetUpdatesAreDetected ); - - /** - * Retrieves whether or not a visible row update can be detected by calling the method ResultSet.rowUpdated. - * - * @return true if changes are detected by the result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - Boolean isScrollSensitiveResultSetUpdatesAreDetected(); - - /** - * Sets whether or not a visible row update can be detected by calling the method ResultSet.rowUpdated. - * - * @param scrollSensitiveResultSetUpdatesAreDetected true if changes are detected by the result set type; - * false otherwise - * @since 1.2 (JDBC 2.0) - */ - void setScrollSensitiveResultSetUpdatesAreDetected( Boolean scrollSensitiveResultSetUpdatesAreDetected ); - - /** - * Retrieves whether or not a visible row delete can be detected by calling the method ResultSet.rowDeleted. If - * the method deletesAreDetected returns false, it means that deleted rows are removed from the - * result set. - * - * @return true if deletes are detected by the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - Boolean isForwardOnlyResultSetDeletesAreDetected(); - - /** - * Sets whether or not a visible row delete can be detected by calling the method ResultSet.rowDeleted. If the - * method deletesAreDetected returns false, it means that deleted rows are removed from the result - * set. - * - * @param forwardOnlyResultSetDeletesAreDetected true if deletes are detected by the given result set type; - * false otherwise - * @since 1.2 (JDBC 2.0) - */ - void setForwardOnlyResultSetDeletesAreDetected( Boolean forwardOnlyResultSetDeletesAreDetected ); - - /** - * Retrieves whether or not a visible row delete can be detected by calling the method ResultSet.rowDeleted. If - * the method deletesAreDetected returns false, it means that deleted rows are removed from the - * result set. - * - * @return true if deletes are detected by the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - Boolean isScrollInsensitiveResultSetDeletesAreDetected(); - - /** - * Sets whether or not a visible row delete can be detected by calling the method ResultSet.rowDeleted. If the - * method deletesAreDetected returns false, it means that deleted rows are removed from the result - * set. - * - * @param scrollInsensitiveResultSetDeletesAreDetected true if deletes are detected by the given result set type; - * false otherwise - * @since 1.2 (JDBC 2.0) - */ - void setScrollInsensitiveResultSetDeletesAreDetected( Boolean scrollInsensitiveResultSetDeletesAreDetected ); - - /** - * Retrieves whether or not a visible row delete can be detected by calling the method ResultSet.rowDeleted. If - * the method deletesAreDetected returns false, it means that deleted rows are removed from the - * result set. - * - * @return true if deletes are detected by the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - Boolean isScrollSensitiveResultSetDeletesAreDetected(); - - /** - * Sets whether or not a visible row delete can be detected by calling the method ResultSet.rowDeleted. If the - * method deletesAreDetected returns false, it means that deleted rows are removed from the result - * set. - * - * @param scrollSensitiveResultSetDeletesAreDetected true if deletes are detected by the given result set type; - * false otherwise - * @since 1.2 (JDBC 2.0) - */ - void setScrollSensitiveResultSetDeletesAreDetected( Boolean scrollSensitiveResultSetDeletesAreDetected ); - - /** - * Retrieves whether or not a visible row insert can be detected by calling the method ResultSet.rowInserted. - * - * @return true if changes are detected by the specified result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - Boolean isForwardOnlyResultInsertsAreDetected(); - - /** - * Sets whether or not a visible row insert can be detected by calling the method ResultSet.rowInserted. - * - * @param forwardOnlyResultInsertsAreDetected true if changes are detected by the specified result set type; - * false otherwise - * @since 1.2 (JDBC 2.0) - */ - void setForwardOnlyResultInsertsAreDetected( Boolean forwardOnlyResultInsertsAreDetected ); - - /** - * Retrieves whether or not a visible row insert can be detected by calling the method ResultSet.rowInserted. - * - * @return true if changes are detected by the specified result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - Boolean isScrollInsensitiveResultInsertsAreDetected(); - - /** - * Sets whether or not a visible row insert can be detected by calling the method ResultSet.rowInserted. - * - * @param scrollInsensitiveResultInsertsAreDetected true if changes are detected by the specified result set - * type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - void setScrollInsensitiveResultInsertsAreDetected( Boolean scrollInsensitiveResultInsertsAreDetected ); - - /** - * Retrieves whether or not a visible row insert can be detected by calling the method ResultSet.rowInserted. - * - * @return true if changes are detected by the specified result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - Boolean isScrollSensitiveResultInsertsAreDetected(); - - /** - * Sets whether or not a visible row insert can be detected by calling the method ResultSet.rowInserted. - * - * @param scrollSensitiveResultInsertsAreDetected true if changes are detected by the specified result set type; - * false otherwise - * @since 1.2 (JDBC 2.0) - */ - void setScrollSensitiveResultInsertsAreDetected( Boolean scrollSensitiveResultInsertsAreDetected ); - - /** - * Retrieves whether this database supports batch updates. - * - * @return true if this database supports batch upcates; false otherwise - * @since 1.2 (JDBC 2.0) - */ - Boolean isSupportsBatchUpdates(); - - /** - * Sets whether this database supports batch updates. - * - * @param supportsBatchUpdates true if this database supports batch upcates; false otherwise - * @since 1.2 (JDBC 2.0) - */ - void setSupportsBatchUpdates( Boolean supportsBatchUpdates ); - - /** - * Retrieves a description of the UDT available in the given catalog. - * - * @return a set of UDT available - */ - Set getUserDefinedTypes(); - - /** - * Adds UDT - * - * @param udt the UDT to add - */ - void addUserDefinedType( UserDefinedType udt ); - - /** - * Deletes UDT - * - * @param udt the UDT to delete - */ - void deleteUserDefinedType( UserDefinedType udt ); - - /** - * Finds UDT by its name. - * - * @param catalog a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a - * catalog; null means that the catalog name should not be used to narrow the search - * @param schema a schema name; must match the schema name as it is stored in the database; "" retrieves those without a - * schema; null means that the schema name should not be used to narrow the search - * @param tableName a table name; must match the table name as it is stored in the database - * @return table or null if not found - */ - UserDefinedType findUserDefinedTypeByName( String catalog, - String schema, - String tableName ); - - // =============================================================== - // ------------------- JDBC 3.0 --------------------------------- - // =============================================================== - - /** - * Retrieves whether this database supports savepoints. - * - * @return true if savepoints are supported; false otherwise - * @since 1.4 (JDBC 3.0) - */ - Boolean isSupportsSavepoints(); - - /** - * Sets whether this database supports savepoints. - * - * @param supportsSavepoints true if savepoints are supported; false otherwise - * @since 1.4 (JDBC 3.0) - */ - void setSupportsSavepoints( Boolean supportsSavepoints ); - - /** - * Retrieves whether this database supports named parameters to callable statements. - * - * @return true if named parameters are supported; false otherwise - * @since 1.4 (JDBC 3.0) - */ - Boolean isSupportsNamedParameters(); - - /** - * Sets whether this database supports named parameters to callable statements. - * - * @param supportsNamedParameters true if named parameters are supported; false otherwise - * @since 1.4 (JDBC 3.0) - */ - void setSupportsNamedParameters( Boolean supportsNamedParameters ); - - /** - * Retrieves whether it is possible to have multiple ResultSet objects returned from a - * CallableStatement object simultaneously. - * - * @return true if a CallableStatement object can return multiple ResultSet objects - * simultaneously; false otherwise - * @since 1.4 (JDBC 3.0) - */ - Boolean isSupportsMultipleOpenResults(); - - /** - * Sets whether it is possible to have multiple ResultSet objects returned from a CallableStatement - * object simultaneously. - * - * @param supportsMultipleOpenResults true if a CallableStatement object can return multiple - * ResultSet objects simultaneously; false otherwise - * @since 1.4 (JDBC 3.0) - */ - void setSupportsMultipleOpenResults( Boolean supportsMultipleOpenResults ); - - /** - * Retrieves whether auto-generated keys can be retrieved after a statement has been executed. - * - * @return true if auto-generated keys can be retrieved after a statement has executed; false - * otherwise - * @since 1.4 (JDBC 3.0) - */ - Boolean isSupportsGetGeneratedKeys(); - - /** - * Sets whether auto-generated keys can be retrieved after a statement has been executed. - * - * @param supportsGetGeneratedKeys true if auto-generated keys can be retrieved after a statement has executed; - * false otherwise - * @since 1.4 (JDBC 3.0) - */ - void setSupportsGetGeneratedKeys( Boolean supportsGetGeneratedKeys ); - - /** - * Retrieves whether this database supports the given result set holdability. - * - * @return true if so; false otherwise - * @see java.sql.Connection - * @since 1.4 (JDBC 3.0) - */ - Boolean isSupportsResultSetHoldCurrorsOverCommitHoldability(); - - /** - * Sets whether this database supports the given result set holdability. - * - * @param supportsResultSetHoldCurrorsOverCommitHoldability true if so; false otherwise - * @see java.sql.Connection - * @since 1.4 (JDBC 3.0) - */ - void setSupportsResultSetHoldCurrorsOverCommitHoldability( Boolean supportsResultSetHoldCurrorsOverCommitHoldability ); - - /** - * Retrieves whether this database supports the given result set holdability. - * - * @return true if so; false otherwise - * @see java.sql.Connection - * @since 1.4 (JDBC 3.0) - */ - Boolean isSupportsResultSetCloseCurrorsAtCommitHoldability(); - - /** - * Sets whether this database supports the given result set holdability. - * - * @param supportsResultSetCloseCurrorsAtCommitHoldability true if so; false otherwise - * @see java.sql.Connection - * @since 1.4 (JDBC 3.0) - */ - void setSupportsResultSetCloseCurrorsAtCommitHoldability( Boolean supportsResultSetCloseCurrorsAtCommitHoldability ); - - /** - * Retrieves the default holdability of this ResultSet object. - * - * @return the default holdability; either ResultSet.HOLD_CURSORS_OVER_COMMIT or - * ResultSet.CLOSE_CURSORS_AT_COMMIT - * @since 1.4 - */ - ResultSetHoldabilityType getResultSetHoldabilityType(); - - /** - * Sets the default holdability of this ResultSet object. - * - * @param resultSetHoldabilityType the ResultSetHoldabilityType - * the default holdability; either ResultSet.HOLD_CURSORS_OVER_COMMIT or - * ResultSet.CLOSE_CURSORS_AT_COMMIT - * @since 1.4 - */ - void setResultSetHoldabilityType( ResultSetHoldabilityType resultSetHoldabilityType ); - - /** - * Retrieves the major version number of the underlying database. - * - * @return the underlying database's major version - * @since 1.4 (JDBC 3.0) - */ - Integer getDatabaseMajorVersion(); - - /** - * Sets the major version number of the underlying database. - * - * @param databaseMajorVersion the underlying database's major version - * @since 1.4 (JDBC 3.0) - */ - void setDatabaseMajorVersion( Integer databaseMajorVersion ); - - /** - * Retrieves the minor version number of the underlying database. - * - * @return underlying database's minor version - * @since 1.4 (JDBC 3.0) - */ - Integer getDatabaseMinorVersion(); - - /** - * Sets the minor version number of the underlying database. - * - * @param databaseMinorVersion underlying database's minor version - * @since 1.4 (JDBC 3.0) - */ - void setDatabaseMinorVersion( Integer databaseMinorVersion ); - - /** - * Retrieves the major JDBC version number for this driver. - * - * @return JDBC version major number - * @since 1.4 (JDBC 3.0) - */ - Integer getJDBCMajorVersion(); - - /** - * Sets the major JDBC version number for this driver. - * - * @param jdbcMajorVersion JDBC version major number - * @since 1.4 (JDBC 3.0) - */ - void setJDBCMajorVersion( Integer jdbcMajorVersion ); - - /** - * Retrieves the minor JDBC version number for this driver. - * - * @return JDBC version minor number - * @since 1.4 (JDBC 3.0) - */ - Integer getJDBCMinorVersion(); - - /** - * Sets the minor JDBC version number for this driver. - * - * @param jdbcMinorVersion JDBC version minor number - * @since 1.4 (JDBC 3.0) - */ - void setJDBCMinorVersion( Integer jdbcMinorVersion ); - - /** - * Indicates whether the SQLSTATE returned by SQLException.getSQLState is X/Open (now known as Open Group) SQL - * CLI or SQL99. - * - * @return the type of SQLSTATE; one of: sqlStateXOpen or sqlStateSQL99 - * @since 1.4 (JDBC 3.0) - */ - SQLStateType getSQLStateType(); - - /** - * Indicates whether the SQLSTATE returned by SQLException.getSQLState is X/Open (now known as Open Group) SQL - * CLI or SQL99. - * - * @param sqlStateType the type of SQLSTATE; one of: sqlStateXOpen or sqlStateSQL99 - * @since 1.4 (JDBC 3.0) - */ - void setSQLStateType( SQLStateType sqlStateType ); - - /** - * Indicates whether updates made to a LOB are made on a copy or directly to the LOB. - * - * @return true if updates are made to a copy of the LOB; false if updates are made directly to the - * LOB - * @since 1.4 (JDBC 3.0) - */ - Boolean isLocatorsUpdateCopy(); - - /** - * Indicates whether updates made to a LOB are made on a copy or directly to the LOB. - * - * @param locatorsUpdateCopy true if updates are made to a copy of the LOB; false if updates are - * made directly to the LOB - * @since 1.4 (JDBC 3.0) - */ - void setLocatorsUpdateCopy( Boolean locatorsUpdateCopy ); - - /** - * Retrieves whether this database supports statement pooling. - * - * @return true if so; false otherwise - * @since 1.4 (JDBC 3.0) - */ - Boolean isSupportsStatementPooling(); - - /** - * Sets whether this database supports statement pooling. - * - * @param supportsStatementPooling true if so; false otherwise - * @since 1.4 (JDBC 3.0) - */ - void setSupportsStatementPooling( Boolean supportsStatementPooling ); - -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/DatabaseMetaDataMethodException.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/DatabaseMetaDataMethodException.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/DatabaseMetaDataMethodException.java (working copy) @@ -1,104 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -/** - * Database metadata method call related exception - * - * @author Sergiy Litsenko - */ -public class DatabaseMetaDataMethodException extends Exception { - // ~ Instance fields ------------------------------------------------------------------ - private static final long serialVersionUID = 5001714254060693493L; - - public static final String METHOD_FAILED = "Database Metadata method failed"; - - /* database metadata method name that caused exception */ - private String methodName; - - // ~ Constructors --------------------------------------------------------------------- - - /** - * Default constructor - */ - public DatabaseMetaDataMethodException() { - this(METHOD_FAILED, null, null); - } - - /** - * Constructor - * - * @param message the explanation of exception - * @param methodName the name of method that caused exception - */ - public DatabaseMetaDataMethodException( String message, - String methodName ) { - this(message, methodName, null); - } - - /** - * Constructor - * - * @param message the explanation of exception - * @param methodName the name of method that caused exception - * @param ex the exception that causes problem - */ - public DatabaseMetaDataMethodException( String message, - String methodName, - Throwable ex ) { - super(message, ex); - - // set method name - setMethodName(methodName); - } - - /** - * Constructor - * - * @param ex the exception that causes problem - */ - public DatabaseMetaDataMethodException( Throwable ex ) { - this(METHOD_FAILED, null, ex); - } - - // ~ Methods -------------------------------------------------------------------------- - - /** - * Returns name of method that caused exception - * - * @return name of method that caused exception - */ - public String getMethodName() { - return methodName; - } - - /** - * Sets the name of method that caused exception - * - * @param methodName the name of method that caused exception - */ - public void setMethodName( String methodName ) { - this.methodName = methodName; - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/DatabaseNamedObject.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/DatabaseNamedObject.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/DatabaseNamedObject.java (working copy) @@ -1,93 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -import java.util.Map; - -/** - * Provides database named object specific metadata. - * - * @author Sergiy Litsenko - */ -public interface DatabaseNamedObject extends CoreMetaData { - - /** - * Gets database named object name - * - * @return database named object name - */ - String getName(); - - /** - * Sets database named object name - * - * @param name the database named object name - */ - void setName( String name ); - - /** - * Gets explanatory comment on the database named object - * - * @return explanatory comment on the database named object - */ - String getRemarks(); - - /** - * Sets explanatory comment on the database named object - * - * @param remarks the explanatory comment on the database named object - */ - void setRemarks( String remarks ); - - /** - * Gets extra (non standard) properties if provided by database. - * - * @return extra properties if provided by database - */ - Map getExtraProperties(); - - /** - * Gets extra (non standard) property if provided by database. - * - * @param key the key - * @return extra property if provided by database - */ - Object getExtraProperty( String key ); - - /** - * Adds extra property - * - * @param key the key - * @param value the value - */ - void addExtraProperty( String key, - Object value ); - - /** - * deletes extra property - * - * @param key the key - */ - void deleteExtraProperty( String key ); -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/ForeignKey.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/ForeignKey.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/ForeignKey.java (working copy) @@ -1,133 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -import java.util.Set; - -/** - * Provides database table's foreing key specific metadata. - * - * @author Sergiy Litsenko - */ -public interface ForeignKey extends SchemaObject { - - /** - * Retrieves foreign key columns - * - * @return foreign key columns - */ - Set getColumns(); - - /** - * Adds ForeignKeyColumn - * - * @param column the ForeignKeyColumn - */ - void addColumn( ForeignKeyColumn column ); - - /** - * deletes ForeignKeyColumn - * - * @param column the ForeignKeyColumn - */ - void deleteColumn( ForeignKeyColumn column ); - - /** - * Returns table column for specified column name or null - * - * @param columnName the name of column - * @return table column for specified column name or null. - */ - ForeignKeyColumn findColumnByName( String columnName ); - - /** - * Returns the scope table of a foreign key. - * - * @return the scope table of a foreign key. - */ - Table getSourceTable(); - - /** - * Sets the scope table of a foreign key. - * - * @param sourceTable the scope table of a foreign key. - */ - void setSourceTable( Table sourceTable ); - - /** - * Returns the PK of scope table. - * - * @return the PK of scope table. - */ - PrimaryKey getSourcePrimaryKey(); - - /** - * Sets the PK of scope table. - * - * @param primaryKey the PK of scope table. - */ - void setSourcePrimaryKey( PrimaryKey primaryKey ); - - /** - * What happens to a foreign key when the primary key is updated - * - * @return what happens to a foreign key when the primary key is updated - */ - KeyModifyRuleType getUpdateRule(); - - /** - * What happens to a foreign key when the primary key is updated - * - * @param updateRule what happens to a foreign key when the primary key is updated - */ - void setUpdateRule( KeyModifyRuleType updateRule ); - - /** - * What happens to a foreign key when the primary key is deleted - * - * @return what happens to a foreign key when the primary key is deleted - */ - KeyModifyRuleType getDeleteRule(); - - /** - * What happens to a foreign key when the primary key is deleted - * - * @param deleteRule what happens to a foreign key when the primary key is deleted - */ - void setDeleteRule( KeyModifyRuleType deleteRule ); - - /** - * Can the evaluation of foreign key constraints be deferred until commit - * - * @return the evaluation of foreign key constraints be deferred until commit - */ - KeyDeferrabilityType getDeferrability(); - - /** - * Can the evaluation of foreign key constraints be deferred until commit - * - * @param deferrability the evaluation of foreign key constraints be deferred until commit - */ - void setDeferrability( KeyDeferrabilityType deferrability ); -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/ForeignKeyColumn.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/ForeignKeyColumn.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/ForeignKeyColumn.java (working copy) @@ -1,46 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -/** - * Provides all database table foreign key column specific metadata. - * - * @author Sergiy Litsenko - */ -public interface ForeignKeyColumn extends KeyColumn { - - /** - * Returns mapped source column (in PK/source table) for this foreign key column - * - * @return mapped source column (in PK/source table) for this foreign key column - */ - TableColumn getSourceColumn(); - - /** - * Sets mapped source column (in PK/source table) for this foreign key column - * - * @param sourceColumn mapped source column (in PK/source table) for this foreign key column - */ - void setSourceColumn( TableColumn sourceColumn ); -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Index.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Index.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Index.java (working copy) @@ -1,140 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -import java.util.Set; - -/** - * Provides all database table's index specific metadata. - * - * @author Sergiy Litsenko - */ -public interface Index extends SchemaObject { - - /** - * Retrieves index columns - * - * @return index columns - */ - Set getColumns(); - - /** - * Adds IndexColumn - * - * @param indexColumn the IndexColumn - */ - void addColumn( IndexColumn indexColumn ); - - /** - * delete IndexColumn - * - * @param indexColumn the IndexColumn - */ - void deleteColumn( IndexColumn indexColumn ); - - /** - * Returns index column for specified column name or null - * - * @param columnName the name of column - * @return index column for specified column name or null. - */ - IndexColumn findColumnByName( String columnName ); - - /** - * Can index values be non-unique. false when TYPE is tableIndexStatistic. - * - * @return true if index values can be non-unique. - */ - Boolean isUnique(); - - /** - * Can index values be non-unique. false when TYPE is tableIndexStatistic. - * - * @param unique true if index values can be non-unique. - */ - void setUnique( Boolean unique ); - - /** - * Gets index type - * - * @return index type - */ - IndexType getIndexType(); - - /** - * Sets index type - * - * @param indexType index type - */ - void setIndexType( IndexType indexType ); - - /** - * When TYPE is tableIndexStatistic, then this is the number of rows in the table; otherwise, it is the number of unique - * values in the index. - * - * @return the number of rows in the table if index type is STATISTICS; otherwise, the number of unique values in the index. - */ - Integer getCardinality(); - - /** - * When TYPE is tableIndexStatistic, then this is the number of rows in the table; otherwise, it is the number of unique - * values in the index. - * - * @param cardinality the number of rows in the table if index type is STATISTICS; otherwise, the number of unique values in - * the index. - */ - void setCardinality( Integer cardinality ); - - /** - * When TYPE is tableIndexStatisic then this is the number of pages used for the table, otherwise it is the number of pages - * used for the current index. - * - * @return the number of pages used for the table if index type is STATISTICS; otherwise the number of pages used for the - * current index. - */ - Integer getPages(); - - /** - * When TYPE is tableIndexStatisic then this is the number of pages used for the table, otherwise it is the number of pages - * used for the current index. - * - * @param pages the number of pages used for the table if index type is STATISTICS; otherwise the number of pages used for the - * current index. - */ - void setPages( Integer pages ); - - /** - * Returns the filter condition, if any. (may be null) - * - * @return the filter condition, if any. (may be null) - */ - String getFilterCondition(); - - /** - * Sets the filter condition, if any. (may be null) - * - * @param filterCondition the filter condition, if any. (may be null) - */ - void setFilterCondition( String filterCondition ); -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/IndexColumn.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/IndexColumn.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/IndexColumn.java (working copy) @@ -1,46 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -/** - * Provides all database table index column specific metadata. - * - * @author Sergiy Litsenko - */ -public interface IndexColumn extends KeyColumn { - - /** - * Gets column sort sequence type - * - * @return column sort sequence type - */ - SortSequenceType getSortSequenceType(); - - /** - * Sets column sort sequence type - * - * @param sortSequenceType column sort sequence type - */ - void setSortSequenceType( SortSequenceType sortSequenceType ); -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/IndexType.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/IndexType.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/IndexType.java (working copy) @@ -1,55 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -import java.sql.DatabaseMetaData; - -/** - * Provides RDBMS supported standard index types as enumeration set. - * - * @author Sergiy Litsenko - */ -public enum IndexType { - - STATISTIC(DatabaseMetaData.tableIndexStatistic), // Indicates that this column contains table statistics that - // are returned in conjunction with a table's index descriptions. - CLUSTERED(DatabaseMetaData.tableIndexClustered), // Indicates that this table index is a clustered index. - HASHED(DatabaseMetaData.tableIndexHashed), // Indicates that this table index is a hashed index. - OTHER(DatabaseMetaData.tableIndexOther); // Indicates that this table index is not a clustered index, - // a hashed index, or table statistics; it is something other than these. - - private final int type; - - IndexType( int type ) { - this.type = type; - } - - public int getType() { - return type; - } - - public String getName() { - return name(); - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/KeyColumn.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/KeyColumn.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/KeyColumn.java (working copy) @@ -1,32 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -/** - * Provides all database table key column specific metadata. - * - * @author Sergiy Litsenko - */ -public interface KeyColumn extends TableColumn { -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/KeyDeferrabilityType.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/KeyDeferrabilityType.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/KeyDeferrabilityType.java (working copy) @@ -1,52 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -import java.sql.DatabaseMetaData; - -/** - * Provides RDBMS supported key deferrability types as enumeration set. - * - * @author Sergiy Litsenko - */ -public enum KeyDeferrabilityType { - - INITIALLY_DEFERRED(DatabaseMetaData.importedKeyInitiallyDeferred), // Indicates deferrability. See SQL-92 for a definition. - INTIALLY_IMMEDIATE(DatabaseMetaData.importedKeyInitiallyImmediate), // Indicates deferrability. See SQL-92 for a definition. - NOT_DEFERRABLE(DatabaseMetaData.importedKeyNotDeferrable); // Indicates deferrability. See SQL-92 for a definition. - - private final int deferrability; - - KeyDeferrabilityType( int deferrability ) { - this.deferrability = deferrability; - } - - public int getDeferrability() { - return deferrability; - } - - public String getName() { - return name(); - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/KeyModifyRuleType.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/KeyModifyRuleType.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/KeyModifyRuleType.java (working copy) @@ -1,58 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -import java.sql.DatabaseMetaData; - -/** - * Provides RDBMS supported keys update/delete rule types as enumeration set. - * - * @author Sergiy Litsenko - */ -public enum KeyModifyRuleType { - - CASCADE(DatabaseMetaData.importedKeyCascade), // when the primary key is updated/deleted, the foreign key (imported key) is - // changed/deleted to agree with it; - RESTRICT(DatabaseMetaData.importedKeyRestrict), // a primary key may not be updated/deleted if it has been imported by another - // table as a foreign key. - SET_NULL(DatabaseMetaData.importedKeySetNull), // when the primary key is updated or deleted, the foreign key (imported key) - // is changed to NULL. - NO_ACTION(DatabaseMetaData.importedKeyNoAction), // if the primary key has been imported, it cannot be updated or deleted. - SET_DEFAULT(DatabaseMetaData.importedKeySetDefault); // if the primary key is updated or deleted, the foreign key (imported - // key) is set to the default value. - - private final int rule; - - KeyModifyRuleType( int rule ) { - this.rule = rule; - } - - public int getRule() { - return rule; - } - - public String getName() { - return name(); - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/NullabilityType.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/NullabilityType.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/NullabilityType.java (working copy) @@ -1,50 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -/** - * Provides RDBMS supported nullability as enumeration set. - * - * @author Sergiy Litsenko - */ -public enum NullabilityType { - - NO_NULLS(0), // Indicates that NULL values are not allowed. - NULLABLE(1), // Indicates that NULL values are allowed. - UNKNOWN(2); // Indicates that whether NULL values are allowed is unknown. - - private final int nullability; - - NullabilityType( int nullability ) { - this.nullability = nullability; - } - - public int getNullability() { - return nullability; - } - - public String getName() { - return name(); - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Parameter.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Parameter.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Parameter.java (working copy) @@ -1,60 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -/** - * Provides all SP column specific metadata. - * - * @author Sergiy Litsenko - */ -public interface Parameter extends Column { - - /** - * Gets stored procedure parameter I/O type - * - * @return stored procedure parameter I/O type - */ - ParameterIoType getIoType(); - - /** - * Sets stored procedure parameter I/O type - * - * @param parameterIoType stored procedure parameter I/O type - */ - void setIoType( ParameterIoType parameterIoType ); - - /** - * Returns parameter scale if appropriate - * - * @return scale if appropriate - */ - Integer getScale(); - - /** - * Sets parameter scale if appropriate - * - * @param scale the scale if appropriate - */ - void setScale( Integer scale ); -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/ParameterIoType.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/ParameterIoType.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/ParameterIoType.java (working copy) @@ -1,55 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -import java.sql.DatabaseMetaData; - -/** - * Provides RDBMS supported stored procedure parameter types as enumeration set. - * - * @author Sergiy Litsenko - */ -public enum ParameterIoType { - - UNKNOWN(DatabaseMetaData.procedureColumnUnknown), // Indicates that type of the column is unknown. - IN(DatabaseMetaData.procedureColumnIn), // Indicates that the column stores IN parameters. - IN_OUT(DatabaseMetaData.procedureColumnInOut), // Indicates that the column stores INOUT parameters. - OUT(DatabaseMetaData.procedureColumnOut), // Indicates that the column stores OUT parameters. - RET(DatabaseMetaData.procedureColumnReturn), // Indicates that the column stores return values. - RESULT(DatabaseMetaData.procedureColumnResult); // Indicates that the column stores results. - - private final int type; - - ParameterIoType( int type ) { - this.type = type; - } - - public int getType() { - return type; - } - - public String getName() { - return name(); - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/PrimaryKey.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/PrimaryKey.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/PrimaryKey.java (working copy) @@ -1,64 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -import java.util.Set; - -/** - * Provides database table's primary key specific metadata. - * - * @author Sergiy Litsenko - */ -public interface PrimaryKey extends SchemaObject { - - /** - * Retrieves primary key columns - * - * @return primary key columns - */ - Set getColumns(); - - /** - * Adds PrimaryKeyColumn - * - * @param primaryKeyColumn the PrimaryKeyColumn - */ - void addColumn( PrimaryKeyColumn primaryKeyColumn ); - - /** - * deletes PrimaryKeyColumn - * - * @param primaryKeyColumn the PrimaryKeyColumn - */ - void deleteColumn( PrimaryKeyColumn primaryKeyColumn ); - - /** - * Returns table column for specified column name or null - * - * @param columnName the name of column - * @return table column for specified column name or null. - */ - PrimaryKeyColumn findColumnByName( String columnName ); - -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/PrimaryKeyColumn.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/PrimaryKeyColumn.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/PrimaryKeyColumn.java (working copy) @@ -1,33 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -/** - * Provides all database table primary key column specific metadata. - * - * @author Sergiy Litsenko - */ -public interface PrimaryKeyColumn extends KeyColumn { - -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Privilege.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Privilege.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Privilege.java (working copy) @@ -1,116 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -/** - * Provides all database privilege specific metadata. - * - * @author Sergiy Litsenko - */ -public interface Privilege extends CoreMetaData { - - /** - * Returns privilege type - * - * @return privilege type - */ - PrivilegeType getPrivilegeType(); - - /** - * Sets privilege type - * - * @param privilegeType the privilege type - */ - void setPrivilegeType( PrivilegeType privilegeType ); - - /** - * Return grantor of access (may be null) - * - * @return grantor of access (may be null) - */ - String getGrantor(); - - /** - * Sets grantor of access (may be null) - * - * @param grantor the grantor of access (may be null) - */ - void setGrantor( String grantor ); - - /** - * Return grantee of access (may be null) - * - * @return grantee of access (may be null) - */ - String getGrantee(); - - /** - * Sets grantee of access (may be null) - * - * @param grantee the grantee of access (may be null) - */ - void setGrantee( String grantee ); - - /** - * Return name of access allowed (SELECT, INSERT, UPDATE, REFRENCES, ...) - * - * @return name of access allowed (SELECT, INSERT, UPDATE, REFRENCES, ...) - */ - String getName(); - - /** - * Sets name of access allowed (SELECT, INSERT, UPDATE, REFRENCES, ...) - * - * @param name the name of access allowed (SELECT, INSERT, UPDATE, REFRENCES, ...) - */ - void setName( String name ); - - /** - * Return true if grantee is permitted to grant to others, false otherwise (even if unknown). - * - * @return true if grantee is permitted to grant to others, false otherwise (even if unknown). - */ - Boolean isGrantable(); - - /** - * Sets true if grantee is permitted to grant to others, false otherwise (even if unknown). - * - * @param grantable true if grantee is permitted to grant to others, false otherwise (even if unknown). - */ - void setGrantable( Boolean grantable ); - - /** - * Return true if it is unknown: grantee is permitted to grant to others or not - * - * @return true if it is unknown: grantee is permitted to grant to others or not - */ - Boolean isUnknownGrantable(); - - /** - * sets true if it is unknown: grantee is permitted to grant to others or not - * - * @param unknownGrantable true if it is unknown: grantee is permitted to grant to others or not - */ - void setUnknownGrantable( Boolean unknownGrantable ); -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/PrivilegeType.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/PrivilegeType.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/PrivilegeType.java (working copy) @@ -1,53 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - - -/** - * Provides RDBMS supported privilege types as enumeration set. - * - * @author Sergiy Litsenko - */ -public enum PrivilegeType { - INSERT("INSERT"), - SELECT("SELECT"), - UPDATE("UPDATE"), - DELETE("DELETE"), - REFERENCE("REFERENCE"), - OTHER("OTHER"); - - private final String type; - - PrivilegeType( String type ) { - this.type = type; - } - - public String getType() { - return type; - } - - public String getName() { - return name(); - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Reference.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Reference.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Reference.java (working copy) @@ -1,59 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -/** - * Provides all database table REF column specific metadata. - * - * @author Sergiy Litsenko - */ -public interface Reference extends CoreMetaData { - /** - * Returns table name that this the scope of a reference attribure - * - * @return table name that this the scope of a reference attribure - */ - Table getSourceTable(); - - /** - * Sets table name that this the scope of a reference attribure - * - * @param sourceTable table name that this the scope of a reference attribure - */ - void setSourceTable( Table sourceTable ); - - /** - * Returns source type of a distinct type or user-generated Ref type. - * - * @return source type of a distinct type or user-generated Ref type, - */ - SqlType getSourceDataType(); - - /** - * Sets source type of a distinct type or user-generated Ref type. - * - * @param sourceDataType source type of a distinct type or user-generated Ref type, - */ - void setSourceDataType( SqlType sourceDataType ); -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/ResultSetConcurrencyType.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/ResultSetConcurrencyType.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/ResultSetConcurrencyType.java (working copy) @@ -1,52 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -import java.sql.ResultSet; - -/** - * Provides all supported database result set types as enumeration set. - * - * @author Sergiy Litsenko - * @since 1.2 (JDBC 2.0) - */ -public enum ResultSetConcurrencyType { - - READ_ONLY(ResultSet.CONCUR_READ_ONLY), - UPDATABLE(ResultSet.CONCUR_UPDATABLE); - - private final int concurrency; - - ResultSetConcurrencyType( int concurrency ) { - this.concurrency = concurrency; - } - - public int getConcurrency() { - return concurrency; - } - - public String getName() { - return name(); - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/ResultSetHoldabilityType.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/ResultSetHoldabilityType.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/ResultSetHoldabilityType.java (working copy) @@ -1,52 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -import java.sql.ResultSet; - -/** - * Provides all supported database result set holdability types as enumeration set. - * - * @author Sergiy Litsenko - * @since 1.4 (JDBC 3.0) - */ -public enum ResultSetHoldabilityType { - - HOLD_CURSORS_OVER_COMMIT(ResultSet.HOLD_CURSORS_OVER_COMMIT), - CLOSE_CURSORS_AT_COMMIT(ResultSet.CLOSE_CURSORS_AT_COMMIT); - - private final int holdability; - - ResultSetHoldabilityType( int holdability ) { - this.holdability = holdability; - } - - public int getHoldability() { - return holdability; - } - - public String getName() { - return name(); - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/ResultSetType.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/ResultSetType.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/ResultSetType.java (working copy) @@ -1,53 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -import java.sql.ResultSet; - -/** - * Provides all supported database result set types as enumeration set. - * - * @author Sergiy Litsenko - * @since 1.2 (JDBC 2.0) - */ -public enum ResultSetType { - - FORWARD_ONLY(ResultSet.TYPE_FORWARD_ONLY), - SCROLL_INSENSITIVE(ResultSet.TYPE_SCROLL_INSENSITIVE), - SCROLL_SENSITIVE(ResultSet.TYPE_SCROLL_SENSITIVE); - - private final int type; - - ResultSetType( int type ) { - this.type = type; - } - - public int getType() { - return type; - } - - public String getName() { - return name(); - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Schema.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Schema.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Schema.java (working copy) @@ -1,45 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -/** - * Provides database schema specific metadata. - * - * @author Sergiy Litsenko - */ -public interface Schema extends DatabaseNamedObject { - /** - * Gets database catalog - * - * @return database catalog - */ - Catalog getCatalog(); - - /** - * Sets database catalog - * - * @param catalog the database catalog - */ - void setCatalog( Catalog catalog ); -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/SchemaObject.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/SchemaObject.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/SchemaObject.java (working copy) @@ -1,60 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -/** - * Provides database schema object specific metadata. - * - * @author Sergiy Litsenko - */ -public interface SchemaObject extends DatabaseNamedObject { - /** - * Gets database catalog - * - * @return database catalog - */ - Catalog getCatalog(); - - /** - * Sets database catalog - * - * @param catalog the database catalog - */ - void setCatalog( Catalog catalog ); - - /** - * Gets database schema - * - * @return database schema - */ - Schema getSchema(); - - /** - * Sets database schema - * - * @param schema the database schema - */ - void setSchema( Schema schema ); - -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/SearchabilityType.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/SearchabilityType.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/SearchabilityType.java (working copy) @@ -1,57 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -import java.sql.DatabaseMetaData; - -/** - * Provides RDBMS supported search ability as enumeration set. - * - * @author Sergiy Litsenko - */ -public enum SearchabilityType { - - NOT_SUPPORTED(DatabaseMetaData.typePredNone), // Indicates that WHERE search clauses are not supported for this - // type. - WHERE_LIKE(DatabaseMetaData.typePredChar), // Indicates that the only WHERE search clause that can be based on - // this type is WHERE . . . LIKE. - BASIC(DatabaseMetaData.typePredBasic), // Indicates that one can base all WHERE search clauses except WHERE - // . . . LIKE on this data type. - SEARCHABLE(DatabaseMetaData.typeSearchable); // Indicates that all WHERE search clauses can be based on this - // type. - - private final int searchability; - - SearchabilityType( int searchability ) { - this.searchability = searchability; - } - - public int getSearchability() { - return searchability; - } - - public String getName() { - return name(); - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/SortSequenceType.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/SortSequenceType.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/SortSequenceType.java (working copy) @@ -1,50 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - - -/** - * Provides RDBMS supported sort sequence types as enumeration set. - * - * @author Sergiy Litsenko - */ -public enum SortSequenceType { - ASCENDING("A"), // "A" => ascending - DESCENDING("D"), // "D" => descending - NOT_SUPPORTED(""); // not supported - - private final String type; - - SortSequenceType( String type ) { - this.type = type; - } - - public String getType() { - return type; - } - - public String getName() { - return name(); - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/SQLStateType.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/SQLStateType.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/SQLStateType.java (working copy) @@ -1,52 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -import java.sql.DatabaseMetaData; - -/** - * Provides all supported database SQL types as enumeration set. - * - * @author Sergiy Litsenko - * @since 1.4 (JDBC 3.0) - */ -public enum SQLStateType { - - XOPEN(DatabaseMetaData.sqlStateXOpen), - SQL99(DatabaseMetaData.sqlStateSQL99); - - private final int state; - - SQLStateType( int state ) { - this.state = state; - } - - public int getState() { - return state; - } - - public String getName() { - return name(); - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/SqlType.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/SqlType.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/SqlType.java (working copy) @@ -1,79 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -import java.sql.Types; - -/** - * Provides RDBMS supported standard SQL types as enumeration set. - * - * @author Sergiy Litsenko - */ -public enum SqlType { - - BIT(Types.BIT), - TINYINT(Types.TINYINT), - SMALLINT(Types.SMALLINT), - INTEGER(Types.INTEGER), - BIGINT(Types.BIGINT), - FLOAT(Types.FLOAT), - REAL(Types.REAL), - DOUBLE(Types.DOUBLE), - NUMERIC(Types.NUMERIC), - DECIMAL(Types.DECIMAL), - CHAR(Types.CHAR), - VARCHAR(Types.VARCHAR), - LONGVARCHAR(Types.LONGVARCHAR), - DATE(Types.DATE), - TIME(Types.TIME), - TIMESTAMP(Types.TIMESTAMP), - BINARY(Types.BINARY), - VARBINARY(Types.VARBINARY), - LONGVARBINARY(Types.LONGVARBINARY), - NULL(Types.NULL), - OTHER(Types.OTHER), - JAVA_OBJECT(Types.JAVA_OBJECT), - DISTINCT(Types.DISTINCT), - STRUCT(Types.STRUCT), - ARRAY(Types.ARRAY), - BLOB(Types.BLOB), - CLOB(Types.CLOB), - REF(Types.REF), - DATALINK(Types.DATALINK), - BOOLEAN(Types.BOOLEAN); - - private final int type; - - SqlType( int type ) { - this.type = type; - } - - public int getType() { - return type; - } - - public String getName() { - return name(); - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/SqlTypeConversionPair.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/SqlTypeConversionPair.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/SqlTypeConversionPair.java (working copy) @@ -1,60 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -/** - * Provides RDBMS supported SQL type valid conversion pair. - * - * @author Sergiy Litsenko - */ -public interface SqlTypeConversionPair extends CoreMetaData { - - /** - * Gets valid SQL Type - * - * @return valid SQL Type - */ - SqlType getSrcType(); - - /** - * Sets valid source SQL Type - * - * @param srcType the source SQL Type - */ - void setSrcType( SqlType srcType ); - - /** - * Gets valid destination SQL Type - * - * @return valid dewstination SQL Type - */ - SqlType getDestType(); - - /** - * Sets valid destination SQL Type - * - * @param destType the destination SQL Type - */ - void setDestType( SqlType destType ); -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/SqlTypeInfo.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/SqlTypeInfo.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/SqlTypeInfo.java (working copy) @@ -1,242 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -/** - * Provides RDBMS supported standatd SQL types info. - * - * @author Sergiy Litsenko - */ -public interface SqlTypeInfo extends DatabaseNamedObject { - - /** - * Returns localized version of type name (may be null). Type name is returned by DatabaseNamedObject.getName () method. - * - * @return localized version of type name (may be null) - */ - String getLocalizedTypeName(); - - /** - * Sets localized version of type name (may be null). Type name is returned by DatabaseNamedObject.getName () method. - * - * @param localizedTypeName localized version of type name (may be null) - */ - void setLocalizedTypeName( String localizedTypeName ); - - /** - * Gets SQL type nullability - * - * @return SQL type nullability - */ - NullabilityType getNullabilityType(); - - /** - * Sets SQL type nullability - * - * @param nullabilityType SQL type nullability - */ - void setNullabilityType( NullabilityType nullabilityType ); - - /** - * Gets SQL type from java.sql.Types - * - * @return SQL type from java.sql.Types - */ - SqlType getSqlType(); - - /** - * Sets SQL type from java.sql.Types - * - * @param sqlType the SQL type from java.sql.Types - */ - void setSqlType( SqlType sqlType ); - - /** - * Gets precision (number of fractional digits/scale) if applicable otherwise 0. - * - * @return precision if applicable otherwise 0 - */ - Long getPrecision(); - - /** - * Sets precision (number of fractional digits/scale) if applicable otherwise 0. - * - * @param precision precision if applicable otherwise 0 - */ - void setPrecision( Long precision ); - - /** - * Returns true if sql type can be a money value, for instance - * - * @return true if sql type can be a money value, for instance - */ - Boolean isFixedPrecisionScale(); - - /** - * Sets true if sql type can be a money value, for instance - * - * @param fixedPrecisionScale true if sql type can be a money value, for instance - */ - void setFixedPrecisionScale( Boolean fixedPrecisionScale ); - - /** - * Returns sql type precision radix (usually 2 or 10) - * - * @return sql type precision radix (usually 2 or 10) - */ - Integer getNumberPrecisionRadix(); - - /** - * sets sql type precision radix (usually 2 or 10) - * - * @param numberPrecisionRadix the sql type precision radix (usually 2 or 10) - */ - void setNumberPrecisionRadix( Integer numberPrecisionRadix ); - - /** - * Returns minimum scale supported - * - * @return minimum scale supported - */ - Integer getMinScale(); - - /** - * Sets minimum scale supported - * - * @param minScale minimum scale supported - */ - void setMinScale( Integer minScale ); - - /** - * Returns maximum scale supported - * - * @return maximum scale supported - */ - Integer getMaxScale(); - - /** - * Sets maximum scale supported - * - * @param maxScale the maximum scale supported - */ - void setMaxScale( Integer maxScale ); - - /** - * Returns prefix used to quote a literal (may be null) - * - * @return prefix used to quote a literal (may be null) - */ - String getLiteralPrefix(); - - /** - * Sets prefix used to quote a literal (may be null) - * - * @param literalPrefix the prefix used to quote a literal (may be null) - */ - void setLiteralPrefix( String literalPrefix ); - - /** - * Returns suffix used to quote a literal (may be null) - * - * @return suffix used to quote a literal (may be null) - */ - String getLiteralSuffix(); - - /** - * Sets suffix used to quote a literal (may be null) - * - * @param literalSuffix the suffix used to quote a literal (may be null) - */ - void setLiteralSuffix( String literalSuffix ); - - /** - * Returns parameters used in creating the type (may be null) - * - * @return parameters used in creating the type (may be null) - */ - String getCreateParams(); - - /** - * Sets parameters used in creating the type (may be null) - * - * @param createParams the parameters used in creating the type (may be null) - */ - void setCreateParams( String createParams ); - - /** - * Is sql type case sensitive - * - * @return true if sql type case sensitive - */ - Boolean isCaseSensitive(); - - /** - * Is sql type case sensitive - * - * @param caseSensitive the true if sql type case sensitive - */ - void setCaseSensitive( Boolean caseSensitive ); - - /** - * Returns sql type searchability - * - * @return sql type searchability - */ - SearchabilityType getSearchabilityType(); - - /** - * Sets sql type searchability - * - * @param searchabilityType the sql type searchability - */ - void setSearchabilityType( SearchabilityType searchabilityType ); - - /** - * Returns true if sql type is unsigned - * - * @return true if sql type is unsigned - */ - Boolean isUnsigned(); - - /** - * Sets true if sql type is unsigned - * - * @param unsigned true if sql type is unsigned - */ - void setUnsigned( Boolean unsigned ); - - /** - * Returns true if sql type can be used for an auto-increment value. - * - * @return true if sql type can be used for an auto-increment value. - */ - Boolean isAutoIncrement(); - - /** - * Sets true if sql type can be used for an auto-increment value. - * - * @param autoIncrement true if sql type can be used for an auto-increment value. - */ - void setAutoIncrement( Boolean autoIncrement ); -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/StoredProcedure.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/StoredProcedure.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/StoredProcedure.java (working copy) @@ -1,78 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -import java.util.Set; - -/** - * Provides all core database SPe specific metadata. - * - * @author Sergiy Litsenko - */ -public interface StoredProcedure extends SchemaObject { - - /** - * Gets stored procedure result type - * - * @return stored procedure result type - */ - StoredProcedureResultType getResultType(); - - /** - * Sets stored procedure result type - * - * @param resultType the stored procedure result type - */ - void setResultType( StoredProcedureResultType resultType ); - - /** - * Gets stored procedure columns - * - * @return a set of stored procedure columns. - */ - Set getParameters(); - - /** - * Adds Parameter - * - * @param parameter the Parameter - */ - void addParameter( Parameter parameter ); - - /** - * deletes Parameter - * - * @param parameter the Parameter - */ - void deleteParameter( Parameter parameter ); - - /** - * Returns stored procedure parameter for specified name or null - * - * @param parameterName the name of parameter - * @return stored procedure parameter for specified name or null. - */ - Parameter findParameterByName( String parameterName ); - -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/StoredProcedureResultType.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/StoredProcedureResultType.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/StoredProcedureResultType.java (working copy) @@ -1,52 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -import java.sql.DatabaseMetaData; - -/** - * Provides RDBMS supported stored procedure result types as enumeration set. - * - * @author Sergiy Litsenko - */ -public enum StoredProcedureResultType { - - UNKNOWN(DatabaseMetaData.procedureResultUnknown), // Indicates that it is not known whether the procedure returns a result - NO_RESULT(DatabaseMetaData.procedureNoResult), // Indicates that the procedure does not return a result. - RETURNS_RESULT(DatabaseMetaData.procedureReturnsResult); // Indicates that the procedure returns a result. - - private final int type; - - StoredProcedureResultType( int type ) { - this.type = type; - } - - public int getType() { - return type; - } - - public String getName() { - return name(); - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Table.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Table.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/Table.java (working copy) @@ -1,330 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -import java.util.Set; - -/** - * Provides all core database table specific metadata. - * - * @author Sergiy Litsenko - */ -public interface Table extends SchemaObject { - - /** - * Returns type of table such as: "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM". - * - * @return type of table. - */ - TableType getTableType(); - - /** - * Sets type of table such as: "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM". - * - * @param tableType the type of table. - */ - void setTableType( TableType tableType ); - - /** - * Gets type catalog - * - * @return types catalog (may be null) - */ - Catalog getTypeCatalog(); - - /** - * Sets type catalog - * - * @param typeCatalog the types catalog (may be null) - */ - void setTypeCatalog( Catalog typeCatalog ); - - /** - * Gets type schema - * - * @return types schema (may be null) - */ - Schema getTypeSchema(); - - /** - * Sets type schema - * - * @param typeSchema the types schema (may be null) - */ - void setTypeSchema( Schema typeSchema ); - - /** - * Gets type name - * - * @return types name (may be null) - */ - String getTypeName(); - - /** - * Sets type name - * - * @param typeName types name (may be null) - */ - void setTypeName( String typeName ); - - /** - * Gets name of the designated "identifier" column of a typed table (may be null) - * - * @return name of the designated "identifier" column of a typed table (may be null) - */ - String getSelfReferencingColumnName(); - - /** - * Sets name of the designated "identifier" column of a typed table (may be null) - * - * @param selfReferencingColumnName the name of the designated "identifier" column of a typed table (may be null) - */ - void setSelfReferencingColumnName( String selfReferencingColumnName ); - - /** - * specifies how values in getSelfReferencingColumnName () are created. Values are "SYSTEM", "USER", "DERIVED". (may be - * null) - * - * @return how values in getSelfReferencingColumnName () are created. - */ - String getReferenceGeneration(); - - /** - * specifies how values in getSelfReferencingColumnName () are created. Values are "SYSTEM", "USER", "DERIVED". (may be - * null) - * - * @param referenceGeneration how values in getSelfReferencingColumnName () are created. - */ - void setReferenceGeneration( String referenceGeneration ); - - /** - * Gets a set of table columns - * - * @return a set of table columns. - */ - Set getColumns(); - - /** - * Adds TableColumn - * - * @param column the TableColumn - */ - void addColumn( TableColumn column ); - - /** - * deletes TableColumn - * - * @param column the TableColumn - */ - void deleteColumn( TableColumn column ); - - /** - * Returns table column for specified column name or null - * - * @param columnName the name of column - * @return table column for specified column name or null. - */ - TableColumn findColumnByName( String columnName ); - - /** - * Gets a table primary key - * - * @return a table primary key. - */ - PrimaryKey getPrimaryKey(); - - /** - * Sets a table primary key - * - * @param primaryKey the table primary key. - */ - void setPrimaryKey( PrimaryKey primaryKey ); - - /** - * Gets a set of table foreign key columns - * - * @return a set of table foreign keys. - */ - Set getForeignKeys(); - - /** - * adds ForeignKey - * - * @param foreignKey the ForeignKey - */ - void addForeignKey( ForeignKey foreignKey ); - - /** - * deletes ForeignKey - * - * @param foreignKey the ForeignKey - */ - void deleteForeignKey( ForeignKey foreignKey ); - - /** - * Returns table foreign key for specified name or null - * - * @param fkName the name of foreign key - * @return table foreign key for specified name or null. - */ - ForeignKey findForeignKeyByName( String fkName ); - - /** - * Gets a set of table indexes - * - * @return a set of table indexes. - */ - Set getIndexes(); - - /** - * adds Index - * - * @param index the Index - */ - void addIndex( Index index ); - - /** - * deletes Index - * - * @param index the Index - */ - void deleteIndex( Index index ); - - /** - * Returns table index for specified name or null - * - * @param indexName the name of index - * @return table index for specified name or null. - */ - Index findIndexByName( String indexName ); - - /** - * Gets a set of table version columns - * - * @return a set of table version columns. - */ - Set getVersionColumns(); - - /** - * adds version column - * - * @param tableColumn the TableColumn - */ - void addVersionColumn( TableColumn tableColumn ); - - /** - * deletes version column - * - * @param tableColumn the version column - */ - void deleteVersionColumn( TableColumn tableColumn ); - - /** - * Returns table version column for specified name or null - * - * @param columnName the name of Version Column - * @return table Version Column for specified name or null. - */ - TableColumn findVersionColumnByName( String columnName ); - - /** - * Gets table privileges. - * - * @return set of table privileges - */ - Set getPrivileges(); - - /** - * Adds table priviledge - * - * @param privilege the table priviledge - */ - void addPrivilege( Privilege privilege ); - - /** - * Deletes table priviledge - * - * @param privilege the table priviledge - */ - void deletePrivilege( Privilege privilege ); - - /** - * Searches priviledge by name - * - * @param priviledgeName the priviledge name to search - * @return priviledge if found, otherwise return null - */ - Privilege findPriviledgeByName( String priviledgeName ); - - /** - * Retrieves a set of descriptions of a table's optimal set of columns that uniquely identifies a row in temporary scopes. - * - * @return BestRowIdentifier set that uniquely identifies a row in scopes. - */ - Set getBestRowIdentifiers(); - - /** - * Adds BestRowIdentifier - * - * @param bestRowIdentifier the BestRowIdentifier - */ - void addBestRowIdentifier( BestRowIdentifier bestRowIdentifier ); - - /** - * deletes BestRowIdentifier - * - * @param bestRowIdentifier the BestRowIdentifier - */ - void deleteBestRowIdentifier( BestRowIdentifier bestRowIdentifier ); - - /** - * Searches the BestRowIdentifier by scope - * - * @param scopeType the scope of best row identifier - * @return BestRowIdentifier if any - */ - BestRowIdentifier findBestRowIdentifierByScopeType( BestRowIdentifierScopeType scopeType ); - - // =============================================================== - // ------------------- JDBC 3.0 --------------------------------- - // =============================================================== - - /** - * Retrieves a description of the table hierarchies defined in a particular schema in this database. Only the immediate super - * type/ sub type relationship is modeled. - * - * @return super table for this table - * @since 1.4 (JDBC 3.0) - */ - Table getSuperTable(); - - /** - * Sets a description of the table hierarchies defined in a particular schema in this database. Only the immediate super type/ - * sub type relationship is modeled. - * - * @param superTable the super table for this table - * @since 1.4 (JDBC 3.0) - */ - void setSuperTable( Table superTable ); -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/TableColumn.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/TableColumn.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/TableColumn.java (working copy) @@ -1,133 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -/** - * Provides all database table column specific metadata. - * - * @author Sergiy Litsenko - */ -public interface TableColumn extends Column { - - /** - * Is this column the part of Best Row Identifier in any scope? - * - * @return true if this column is the part of Best Row Identifier in any scope, otherwise return false (even if unknown) - */ - Boolean isBestRowIdentifier(); - - /** - * Is this column the part of Best Row Identifier in any scope? - * - * @param bestRowIdentifier true if this column is the part of Best Row Identifier in any scope, otherwise return false (even - * if unknown) - */ - void setBestRowIdentifier( Boolean bestRowIdentifier ); - - /** - * Return column's pseudo type - * - * @return column's pseudo type - */ - ColumnPseudoType getPseudoType(); - - /** - * Sets column's pseudo type - * - * @param pseudoType the column's pseudo type - */ - void setPseudoType( ColumnPseudoType pseudoType ); - - /** - * Returns column reference if datatype is REF - * - * @return column reference if datatype is REF - */ - Reference getReference(); - - /** - * Sets column reference if datatype is REF - * - * @param reference the column reference if datatype is REF - */ - void setReference( Reference reference ); - - /** - * Retrieves true if column is automatically updated when any value in a row is updated. If it retrieves true then column can - * be cast to VersionColumn. - * - * @return true if column is automatically updated when any value in a row is updated, return false overwise. - */ - Boolean isVersionColumn(); - - /** - * Sets true if column is automatically updated when any value in a row is updated. If it retrieves true then column can be - * cast to VersionColumn. - * - * @param versionColumn true if column is automatically updated when any value in a row is updated, return false overwise. - */ - void setVersionColumn( Boolean versionColumn ); - - /** - * Retrieves true if column is part of primary key. - * - * @return true if column is part of primary key, return false overwise. - */ - Boolean isPrimaryKeyColumn(); - - /** - * Sets true if column is part of primary key. - * - * @param primaryKeyColumn true if column is part of primary key, return false overwise. - */ - void setPrimaryKeyColumn( Boolean primaryKeyColumn ); - - /** - * Retrieves true if column is part of foreign key. - * - * @return true if column is part of foreign key, return false overwise. - */ - Boolean isForeignKeyColumn(); - - /** - * Sets true if column is part of foreign key. - * - * @param foreignKeyColumn true if column is part of foreign key, return false overwise. - */ - void setForeignKeyColumn( Boolean foreignKeyColumn ); - - /** - * Retrieves true if column is part of any index. - * - * @return true if column is part of any index, return false overwise. - */ - Boolean isIndexColumn(); - - /** - * Sets true if column is part of any index. - * - * @param indexColumn true if column is part of any index, return false overwise. - */ - void setIndexColumn( Boolean indexColumn ); -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/TableType.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/TableType.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/TableType.java (working copy) @@ -1,150 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -/** - * Provides database table type specific metadata. - *

- * The table type is: - *

    - *
  1. TABLE_TYPE String => table type. Typical types are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", - * "LOCAL TEMPORARY", "ALIAS", "SYNONYM". - *
- * - * @author Sergiy Litsenko - */ -public interface TableType extends DatabaseNamedObject { - public static String DEF_TABLE_TYPE_TABLE = "TABLE"; - public static String DEF_TABLE_TYPE_VIEW = "VIEW"; - public static String DEF_TABLE_TYPE_SYS_TABLE = "SYSTEM TABLE"; - public static String DEF_TABLE_TYPE_GLOBAL_TEMP = "GLOBAL TEMPORARY"; - public static String DEF_TABLE_TYPE_LOCAL_TEMP = "LOCAL TEMPORARY"; - public static String DEF_TABLE_TYPE_ALIAS = "ALIAS"; - public static String DEF_TABLE_TYPE_SYNONYM = "SYNONYM"; - - /** - * Is table type represents TABLE - * - * @param tableTypeName the table type string - * @return true if table type represents TABLE - */ - Boolean isTable( String tableTypeName ); - - /** - * Is current table type represents TABLE - * - * @return true if current table type represents TABLE - */ - Boolean isTable(); - - /** - * Is table type represents VIEW - * - * @param tableTypeName the table type string - * @return true if table type represents VIEW - */ - Boolean isView( String tableTypeName ); - - /** - * Is current table type represents VIEW - * - * @return true if current table type represents VIEW - */ - Boolean isView(); - - /** - * Is table type represents SYSTEM TABLE - * - * @param tableTypeName the table type string - * @return true if table type represents SYSTEM TABLE - */ - Boolean isSystemTable( String tableTypeName ); - - /** - * Is current table type represents SYSTEM TABLE - * - * @return true if current table type represents SYSTEM TABLE - */ - Boolean isSystemTable(); - - /** - * Is current table type represents GLOBAL TEMPORARY - * - * @param tableTypeName the table type string - * @return true if current table type represents GLOBAL TEMPORARY - */ - Boolean isGlobalTemporary( String tableTypeName ); - - /** - * Is current table type represents GLOBAL TEMPORARY - * - * @return true if table type represents GLOBAL TEMPORARY - */ - Boolean isGlobalTemporary(); - - /** - * Is table type represents LOCAL TEMPORARY - * - * @param tableTypeName the table type string - * @return true if table type represents LOCAL TEMPORARY - */ - Boolean islocalTemporary( String tableTypeName ); - - /** - * Is current table type represents LOCAL TEMPORARY - * - * @return true if current table type represents LOCAL TEMPORARY - */ - Boolean isLocalTemporary(); - - /** - * Is table type represents ALIAS - * - * @param tableTypeName the table type string - * @return true if table type represents ALIAS - */ - Boolean isAlias( String tableTypeName ); - - /** - * Is current table type represents ALIAS - * - * @return true if current table type represents ALIAS - */ - Boolean isAlias(); - - /** - * Is table type represents SYNONYM - * - * @param tableTypeName the table type string - * @return true if table type represents SYNONYM - */ - Boolean isSynonym( String tableTypeName ); - - /** - * Is current table type represents SYNONYM - * - * @return true if current table type represents SYNONYM - */ - Boolean isSynonym(); -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/TransactionIsolationLevelType.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/TransactionIsolationLevelType.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/TransactionIsolationLevelType.java (working copy) @@ -1,54 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -import java.sql.Connection; - -/** - * Provides RDBMS supported transaction isolation levels as enumeration set. - * - * @author Sergiy Litsenko - */ -public enum TransactionIsolationLevelType { - - NONE(Connection.TRANSACTION_NONE), - READ_UNCOMMITTED(Connection.TRANSACTION_READ_UNCOMMITTED), - READ_COMMITTED(Connection.TRANSACTION_READ_COMMITTED), - REPEATABLE_READ(Connection.TRANSACTION_REPEATABLE_READ), - SERIALIZABLE(Connection.TRANSACTION_SERIALIZABLE); - - private final int level; - - TransactionIsolationLevelType( int level ) { - this.level = level; - } - - public int getLevel() { - return level; - } - - public String getName() { - return name(); - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/UserDefinedType.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/UserDefinedType.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/api/UserDefinedType.java (working copy) @@ -1,133 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.api; - -import java.util.Set; - -/** - * Provides User Defined Type (UDT) specific metadata. Retrieves a description of the user-defined types (UDTs) defined in a - * particular schema. Schema-specific UDTs may have type JAVA_OBJECT, STRUCT, or DISTINCT. - * - * @author Sergiy Litsenko - * @since 1.2 (JDBC 2.0) - */ -public interface UserDefinedType extends SchemaObject { - - /** - * Returns JAVA class name for UDT - * - * @return JAVA class name for UDT - */ - String getClassName(); - - /** - * Sets JAVA class name for UDT - * - * @param className JAVA class name for UDT - */ - void setClassName( String className ); - - /** - * Gets SQL type from java.sql.Types. One of JAVA_OBJECT, STRUCT, or DISTINCT - * - * @return SQL type from java.sql.Types. One of JAVA_OBJECT, STRUCT, or DISTINCT - */ - SqlType getSqlType(); - - /** - * Sets SQL type from java.sql.Types. One of JAVA_OBJECT, STRUCT, or DISTINCT - * - * @param sqlType the SQL type from java.sql.Types. One of JAVA_OBJECT, STRUCT, or DISTINCT - */ - void setSqlType( SqlType sqlType ); - - /** - * Gets SQL base type from java.sql.Types. Type code of the source type of a DISTINCT type or the type that implements the - * user-generated reference type of the SELF_REFERENCING_COLUMN of a structured type as defined in java.sql.Types (null if - * DATA_TYPE is not DISTINCT or not STRUCT with REFERENCE_GENERATION = USER_DEFINED) - * - * @return SQL base type from java.sql.Types. - */ - SqlType getBaseType(); - - /** - * Sets SQL base type from java.sql.Types. Type code of the source type of a DISTINCT type or the type that implements the - * user-generated reference type of the SELF_REFERENCING_COLUMN of a structured type as defined in java.sql.Types (null if - * DATA_TYPE is not DISTINCT or not STRUCT with REFERENCE_GENERATION = USER_DEFINED) - * - * @param baseType the SQL base type from java.sql.Types. - */ - void setBaseType( SqlType baseType ); - - /** - * Gets a set of UDT attributes - * - * @return a set of UDT attributes - */ - Set getAttributes(); - - /** - * adds Attribute - * - * @param attribute the Attribute - */ - void addAttribute( Attribute attribute ); - - /** - * deletes Attribute - * - * @param attribute the Attribute - */ - void deleteAttribute( Attribute attribute ); - - /** - * Returns UDT attribute for specified attribute name or null - * - * @param attributeName the name of attribute - * @return UDT attribute for specified attribute name or null. - */ - Attribute findAttributeByName( String attributeName ); - - // =============================================================== - // ------------------- JDBC 3.0 --------------------------------- - // =============================================================== - - /** - * Retrieves a description of the user-defined type (UDT) hierarchies defined in a particular schema in this database. Only - * the immediate super type/ sub type relationship is modeled. - * - * @return super type for this UDT if any - * @since 1.4 (JDBC 3.0) - */ - UserDefinedType getSuperType(); - - /** - * Sets a description of the user-defined type (UDT) hierarchies defined in a particular schema in this database. Only the - * immediate super type/ sub type relationship is modeled. - * - * @param superType the super type for this UDT if any - * @since 1.4 (JDBC 3.0) - */ - void setSuperType( UserDefinedType superType ); -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/DefaultModelFactory.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/DefaultModelFactory.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/DefaultModelFactory.java (working copy) @@ -1,234 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model; - -import org.jboss.dna.common.jdbc.model.api.*; -import org.jboss.dna.common.jdbc.model.spi.*; - -/** - * Database metadata objects creation factory - * - * @author Sergiy Litsenko - */ -public class DefaultModelFactory implements ModelFactory { - // ~ Constructors --------------------------------------------------------------------- - - /** - * Default constructor - */ - public DefaultModelFactory() { - } - - // ~ Methods -------------------------------------------------------------------------- - - /** - * Creates Attribute - * - * @return Attribute - */ - public Attribute createAttribute() { - return new AttributeBean(); - } - - /** - * Creates BestRowIdentifier - * - * @return BestRowIdentifier object - */ - public BestRowIdentifier createBestRowIdentifier() { - return new BestRowIdentifierBean(); - } - - /** - * Creates Catalog - * - * @return Catalog object - */ - public Catalog createCatalog() { - return new CatalogBean(); - } - - /** - * Creates Database - * - * @return Database object - */ - public Database createDatabase() { - return new DatabaseBean(); - } - - /** - * Creates ForeignKey - * - * @return ForeignKey object - */ - public ForeignKey createForeignKey() { - return new ForeignKeyBean(); - } - - /** - * Creates ForeignKeyColumn - * - * @return ForeignKeyColumn object - */ - public ForeignKeyColumn createForeignKeyColumn() { - return new ForeignKeyColumnBean(); - } - - /** - * Creates Index - * - * @return Index object - */ - public Index createIndex() { - return new IndexBean(); - } - - /** - * Creates IndexColumn - * - * @return IndexColumn object - */ - public IndexColumn createIndexColumn() { - return new IndexColumnBean(); - } - - /** - * Creates Parameter - * - * @return Parameter object - */ - public Parameter createParameter() { - return new ParameterBean(); - } - - /** - * Creates PrimaryKey - * - * @return PrimaryKey object - */ - public PrimaryKey createPrimaryKey() { - return new PrimaryKeyBean(); - } - - /** - * Creates PrimaryKeyColumn - * - * @return PrimaryKeyColumn object - */ - public PrimaryKeyColumn createPrimaryKeyColumn() { - return new PrimaryKeyColumnBean(); - } - - /** - * Creates Privilege - * - * @return Privilege object - */ - public Privilege createPrivilege() { - return new PrivilegeBean(); - } - - /** - * Creates Reference - * - * @return Reference object - */ - public Reference createReference() { - return new ReferenceBean(); - } - - /** - * Creates Schema - * - * @return Schema object - */ - public Schema createSchema() { - return new SchemaBean(); - } - - /** - * Creates SqlTypeConversionPair - * - * @return SqlTypeConversionPair object - */ - public SqlTypeConversionPair createSqlTypeConversionPair() { - return new SqlTypeConversionPairBean(); - } - - /** - * Creates SqlTypeInfo - * - * @return SqlTypeInfo object - */ - public SqlTypeInfo createSqlTypeInfo() { - return new SqlTypeInfoBean(); - } - - /** - * Creates StoredProcedure - * - * @return StoredProcedure object - */ - public StoredProcedure createStoredProcedure() { - return new StoredProcedureBean(); - } - - /** - * Creates Table - * - * @return Table object - */ - public Table createTable() { - return new TableBean(); - } - - /** - * Creates TableColumn - * - * @return TableColumn object - */ - public TableColumn createTableColumn() { - return new TableColumnBean(); - } - - /** - * Creates TableType - * - * @return TableType object - */ - public TableType createTableType() { - return new TableTypeBean(); - } - - /** - * Creates UserDefinedType - * - * @return UserDefinedType object - */ - public UserDefinedType createUserDefinedType() { - return new UserDefinedTypeBean(); - } - -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/ModelFactory.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/ModelFactory.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/ModelFactory.java (working copy) @@ -1,183 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model; - -import org.jboss.dna.common.jdbc.model.api.*; - -/** - * Database metadata objects creation factory - * - * @author Sergiy Litsenko - */ -public interface ModelFactory { - // ~ Methods -------------------------------------------------------------------------- - - /** - * Creates Attribute - * - * @return Attribute - */ - Attribute createAttribute(); - - /** - * Creates BestRowIdentifier - * - * @return BestRowIdentifier object - */ - BestRowIdentifier createBestRowIdentifier(); - - /** - * Creates Catalog - * - * @return Catalog object - */ - Catalog createCatalog(); - - /** - * Creates Database - * - * @return Database object - */ - Database createDatabase(); - - /** - * Creates ForeignKey - * - * @return ForeignKey object - */ - ForeignKey createForeignKey(); - - /** - * Creates ForeignKeyColumn - * - * @return ForeignKeyColumn object - */ - ForeignKeyColumn createForeignKeyColumn(); - - /** - * Creates Index - * - * @return Index object - */ - Index createIndex(); - - /** - * Creates IndexColumn - * - * @return IndexColumn object - */ - IndexColumn createIndexColumn(); - - /** - * Creates Parameter - * - * @return Parameter object - */ - Parameter createParameter(); - - /** - * Creates PrimaryKey - * - * @return PrimaryKey object - */ - PrimaryKey createPrimaryKey(); - - /** - * Creates PrimaryKeyColumn - * - * @return PrimaryKeyColumn object - */ - PrimaryKeyColumn createPrimaryKeyColumn(); - - /** - * Creates Privilege - * - * @return Privilege object - */ - Privilege createPrivilege(); - - /** - * Creates Reference - * - * @return Reference object - */ - Reference createReference(); - - /** - * Creates Schema - * - * @return Schema object - */ - Schema createSchema(); - - /** - * Creates SqlTypeConversionPair - * - * @return SqlTypeConversionPair object - */ - SqlTypeConversionPair createSqlTypeConversionPair(); - - /** - * Creates SqlTypeInfo - * - * @return SqlTypeInfo object - */ - SqlTypeInfo createSqlTypeInfo(); - - /** - * Creates StoredProcedure - * - * @return StoredProcedure object - */ - StoredProcedure createStoredProcedure(); - - /** - * Creates Table - * - * @return Table object - */ - Table createTable(); - - /** - * Creates TableColumn - * - * @return TableColumn object - */ - TableColumn createTableColumn(); - - /** - * Creates TableType - * - * @return TableType object - */ - TableType createTableType(); - - /** - * Creates UserDefinedType - * - * @return UserDefinedType object - */ - UserDefinedType createUserDefinedType(); - -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/AttributeBean.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/AttributeBean.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/AttributeBean.java (working copy) @@ -1,62 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import org.jboss.dna.common.jdbc.model.api.Attribute; -import org.jboss.dna.common.jdbc.model.api.Reference; - -/** - * Provides User Defined Type (UDT) attribute specific metadata. - * - * @author Sergiy Litsenko - * @since 1.4 (JDBC 3.0) - */ -public class AttributeBean extends ColumnBean implements Attribute { - private static final long serialVersionUID = -2822658260714209072L; - private Reference reference; - - /** - * Default constructor - */ - public AttributeBean() { - } - - /** - * Returns column reference if datatype is REF - * - * @return column reference if datatype is REF - */ - public Reference getReference() { - return reference; - } - - /** - * Sets reference - * - * @param reference the reference to set - */ - public void setReference( Reference reference ) { - this.reference = reference; - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/BestRowIdentifierBean.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/BestRowIdentifierBean.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/BestRowIdentifierBean.java (working copy) @@ -1,108 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import java.util.Set; -import java.util.HashSet; -import org.jboss.dna.common.jdbc.model.api.BestRowIdentifier; -import org.jboss.dna.common.jdbc.model.api.BestRowIdentifierScopeType; -import org.jboss.dna.common.jdbc.model.api.Column; - -/** - * Provides table's best row identifies specific metadata. - * - * @author Sergiy Litsenko - */ -public class BestRowIdentifierBean extends CoreMetaDataBean implements BestRowIdentifier { - private static final long serialVersionUID = -6031029115876541704L; - private BestRowIdentifierScopeType scopeType; - private Set columns = new HashSet(); - - /** - * Default constructor - */ - public BestRowIdentifierBean() { - } - - /** - * Return the scope of best row identifier - * - * @return the scope of best row identifier - */ - public BestRowIdentifierScopeType getScopeType() { - return scopeType; - } - - /** - * Sets the scope of best row identifier - * - * @param scopeType the scope of best row identifier - */ - public void setScopeType( BestRowIdentifierScopeType scopeType ) { - this.scopeType = scopeType; - } - - /** - * Retrieves best row identifier columns - * - * @return best row identifier columns - */ - public Set getColumns() { - return columns; - } - - /** - * Adds column to the best row identifier - * - * @param column the column that part of best row identifier - */ - public void addColumn( Column column ) { - columns.add(column); - } - - /** - * Deletes column from the best row identifier - * - * @param column the column that no longer part of best row identifier - */ - public void deleteColumn( Column column ) { - columns.remove(column); - } - - /** - * Searches column by name - * - * @param columnName the column name to search - * @return column if found, otherwise return null - */ - public Column findColumnByName( String columnName ) { - for (Column c : columns) { - if (c.getName().equals(columnName)) { - return c; - } - } - // return nothing - return null; - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/CatalogBean.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/CatalogBean.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/CatalogBean.java (working copy) @@ -1,41 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import org.jboss.dna.common.jdbc.model.api.Catalog; - -/** - * Provides all core database catalog specific metadata. - * - * @author Sergiy Litsenko - */ -public class CatalogBean extends DatabaseNamedObjectBean implements Catalog { - private static final long serialVersionUID = -4579895771907682612L; - - /** - * Default constructor - */ - public CatalogBean() { - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/ColumnBean.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/ColumnBean.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/ColumnBean.java (working copy) @@ -1,287 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import java.util.Set; -import java.util.HashSet; -import org.jboss.dna.common.jdbc.model.api.Column; -import org.jboss.dna.common.jdbc.model.api.NullabilityType; -import org.jboss.dna.common.jdbc.model.api.SqlType; -import org.jboss.dna.common.jdbc.model.api.Privilege; -import org.jboss.dna.common.jdbc.model.api.SchemaObject; - -/** - * Provides all column specific metadata. - * - * @author Sergiy Litsenko - */ -public class ColumnBean extends DatabaseNamedObjectBean implements Column { - private static final long serialVersionUID = 4797227922671541353L; - private SchemaObject owner; - private NullabilityType nullabilityType; - private SqlType sqlType; - private String typeName; - private Integer size; - private Integer precision; - private Integer radix; - private String defaultValue; - private Integer ordinalPosition; - private Integer charOctetLength; - private Set privileges = new HashSet(); - - /** - * Default constructor - */ - public ColumnBean() { - } - - /** - * Returns owner of ColumnMetaData such as Table, or Stored Procedure, UDT, PK, FK, Index, etc. May return NULL - * - * @return owner of ColumnMetaData such as Table, or Stored Procedure, or UDT, PK, FK, Index, etc. May return NULL - */ - public SchemaObject getOwner() { - return owner; - } - - /** - * Sets the owner of ColumnMetaData - * - * @param owner the owner of ColumnMetaData - */ - public void setOwner( SchemaObject owner ) { - this.owner = owner; - } - - /** - * Gets column nullability - * - * @return column nullability - */ - public NullabilityType getNullabilityType() { - return nullabilityType; - } - - /** - * Sets column nullability - * - * @param nullabilityType the column nullability - */ - public void setNullabilityType( NullabilityType nullabilityType ) { - this.nullabilityType = nullabilityType; - } - - /** - * Gets SQL type from java.sql.Types - * - * @return SQL type from java.sql.Types - */ - public SqlType getSqlType() { - return sqlType; - } - - /** - * Sets SQL type from java.sql.Types - * - * @param sqlType the SQL type from java.sql.Types - */ - public void setSqlType( SqlType sqlType ) { - this.sqlType = sqlType; - } - - /** - * Data source dependent type name. For a UDT, the type name is fully qualified. For a REF, the type name is fully qualified - * and represents the target type of the reference type. - * - * @return data source dependent type name - */ - public String getTypeName() { - return typeName; - } - - /** - * Data source dependent type name. For a UDT, the type name is fully qualified. For a REF, the type name is fully qualified - * and represents the target type of the reference type. - * - * @param typeName data source dependent type name - */ - public void setTypeName( String typeName ) { - this.typeName = typeName; - } - - /** - * Gets column size. For char or date types this is the maximum number of characters, for numeric or decimal types this is - * precision. For Stored procedure columns it is length in bytes of data - * - * @return column size - */ - public Integer getSize() { - return size; - } - - /** - * Sets column size. For char or date types this is the maximum number of characters, for numeric or decimal types this is - * precision. For Stored procedure columns it is length in bytes of data - * - * @param size the column size - */ - public void setSize( Integer size ) { - this.size = size; - } - - /** - * Gets precision if applicable otherwise 0. For table columns return the number of fractional digits; for stored procedure - * column - scale. - * - * @return precision if applicable otherwise 0 - */ - public Integer getPrecision() { - return precision; - } - - /** - * Sets precision if applicable otherwise 0. For table columns return the number of fractional digits; for stored procedure - * column - scale. - * - * @param precision the precision if applicable otherwise 0 - */ - public void setPrecision( Integer precision ) { - this.precision = precision; - } - - /** - * Gets radix if applicable - * - * @return radix if applicable - */ - public Integer getRadix() { - return radix; - } - - /** - * Sets radix if applicable - * - * @param radix if applicable - */ - public void setRadix( Integer radix ) { - this.radix = radix; - } - - /** - * Gets default value (may be null) - * - * @return default value (may be null) - */ - public String getDefaultValue() { - return defaultValue; - } - - /** - * Sets default value (may be null) - * - * @param defaultValue the default value (may be null) - */ - public void setDefaultValue( String defaultValue ) { - this.defaultValue = defaultValue; - } - - /** - * Returns index of column starting at 1 - if applicable. Otherwise returns -1. - * - * @return index of column starting at 1 - if applicable. Otherwise returns -1. - */ - public Integer getOrdinalPosition() { - return ordinalPosition; - } - - /** - * Sets index of column starting at 1 - if applicable. Otherwise returns -1. - * - * @param ordinalPosition the index of column starting at 1 - if applicable. Otherwise returns -1. - */ - public void setOrdinalPosition( Integer ordinalPosition ) { - this.ordinalPosition = ordinalPosition; - } - - /** - * For char types returns the maximum number of bytes in the column. Otherwise returns -1. - * - * @return For char types returns the maximum number of bytes in the column. Otherwise returns -1. - */ - public Integer getCharOctetLength() { - return charOctetLength; - } - - /** - * For char types sets the maximum number of bytes in the column. Otherwise -1. - * - * @param charOctetLength For char types sets the maximum number of bytes in the column. Otherwise -1. - */ - public void setCharOctetLength( Integer charOctetLength ) { - this.charOctetLength = charOctetLength; - } - - /** - * Gets table column privileges. - * - * @return set of table column privileges - */ - public Set getPrivileges() { - return privileges; - } - - /** - * Adds table column priviledge - * - * @param privilege the table column priviledge - */ - public void addPrivilege( Privilege privilege ) { - privileges.add(privilege); - } - - /** - * Deletes table column priviledge - * - * @param privilege the table column priviledge - */ - public void deletePrivilege( Privilege privilege ) { - privileges.remove(privilege); - } - - /** - * Searches priviledge by name - * - * @param priviledgeName the priviledge name to search - * @return priviledge if found, otherwise return null - */ - public Privilege findPriviledgeByName( String priviledgeName ) { - for (Privilege p : privileges) { - if (p.getName().equals(priviledgeName)) { - return p; - } - } - // return nothing - return null; - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/CoreMetaDataBean.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/CoreMetaDataBean.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/CoreMetaDataBean.java (working copy) @@ -1,45 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import org.jboss.dna.common.jdbc.model.api.CoreMetaData; - -/** - * Provides core metadata functionality - * - * @author Sergiy Litsenko - */ -public class CoreMetaDataBean implements CoreMetaData { - - /** - * Serializable version {@value} - */ - private static final long serialVersionUID = 1L; - - /** - * Default constructor - */ - public CoreMetaDataBean() { - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/DatabaseBean.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/DatabaseBean.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/DatabaseBean.java (working copy) @@ -1,4077 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import java.util.HashSet; -import org.jboss.dna.common.jdbc.model.api.*; - -/** - * Provides RDBMS wide meta data retrieved from java.sql.DatabaseMetaData. - * - * @author Sergiy Litsenko - */ -public class DatabaseBean extends CoreMetaDataBean implements Database { - private static final long serialVersionUID = 6634428066138252064L; - // database metadata provider exception list - private List exceptionList = new ArrayList(); - private String name; - private Boolean allProceduresAreCallable; - private Boolean allTablesAreSelectable; - private String url; - private String userName; - private Boolean readOnly; - private Boolean nullsAreSortedHigh; - private Boolean nullsAreSortedLow; - private Boolean nullsAreSortedAtStart; - private Boolean nullsAreSortedAtEnd; - private String databaseProductName; - private String databaseProductVersion; - private String driverName; - private String driverVersion; - private Integer driverMajorVersion; - private Integer driverMinorVersion; - private Boolean usesLocalFiles; - private Boolean usesLocalFilePerTable; - private Boolean supportsMixedCaseIdentifiers; - private Boolean storesUpperCaseIdentifiers; - private Boolean storesLowerCaseIdentifiers; - private Boolean storesMixedCaseIdentifiers; - private Boolean supportsMixedCaseQuotedIdentifiers; - private Boolean storesUpperCaseQuotedIdentifiers; - private Boolean storesLowerCaseQuotedIdentifiers; - private Boolean storesMixedCaseQuotedIdentifiers; - private String identifierQuoteString; - private Set sqlKeywords = new HashSet(); - private Set numericFunctions = new HashSet(); - private Set stringFunctions = new HashSet(); - private Set systemFunctions = new HashSet(); - private Set timeDateFunctions = new HashSet(); - private String searchStringEscape; - private String extraNameCharacters; - private Boolean supportsAlterTableWithAddColumn; - private Boolean supportsAlterTableWithDropColumn; - private Boolean supportsColumnAliasing; - private Boolean nullPlusNonNullIsNull; - private Boolean supportsConvert; - private Boolean supportsTableCorrelationNames; - private Boolean supportsDifferentTableCorrelationNames; - private Boolean supportsExpressionsInOrderBy; - private Boolean supportsOrderByUnrelated; - private Boolean supportsGroupBy; - private Boolean supportsGroupByUnrelated; - private Boolean supportsGroupByBeyondSelect; - private Boolean supportsLikeEscapeClause; - private Boolean supportsMultipleResultSets; - private Boolean supportsMultipleTransactions; - private Boolean supportsNonNullableColumns; - private Boolean supportsMinimumSQLGrammar; - private Boolean supportsCoreSQLGrammar; - private Boolean supportsExtendedSQLGrammar; - private Boolean supportsANSI92EntryLevelSQL; - private Boolean supportsANSI92IntermediateSQL; - private Boolean supportsANSI92FullSQL; - private Boolean supportsIntegrityEnhancementFacility; - private Boolean supportsOuterJoins; - private Boolean supportsFullOuterJoins; - private Boolean supportsLimitedOuterJoins; - private String schemaTerm; - private String procedureTerm; - private String catalogTerm; - private Boolean catalogAtStart; - private String catalogSeparator; - private Boolean supportsSchemasInDataManipulation; - private Boolean supportsSchemasInProcedureCalls; - private Boolean supportsSchemasInTableDefinitions; - private Boolean supportsSchemasInIndexDefinitions; - private Boolean supportsSchemasInPrivilegeDefinitions; - private Boolean supportsCatalogsInDataManipulation; - private Boolean supportsCatalogsInProcedureCalls; - private Boolean supportsCatalogsInTableDefinitions; - private Boolean supportsCatalogsInIndexDefinitions; - private Boolean supportsCatalogsInPrivilegeDefinitions; - private Boolean supportsPositionedDelete; - private Boolean supportsPositionedUpdate; - private Boolean supportsSelectForUpdate; - private Boolean supportsStoredProcedures; - private Boolean supportsSubqueriesInComparisons; - private Boolean supportsSubqueriesInExists; - private Boolean supportsSubqueriesInIns; - private Boolean supportsSubqueriesInQuantifieds; - private Boolean supportsCorrelatedSubqueries; - private Boolean supportsUnion; - private Boolean supportsUnionAll; - private Boolean supportsOpenCursorsAcrossCommit; - private Boolean supportsOpenCursorsAcrossRollback; - private Boolean supportsOpenStatementsAcrossCommit; - private Boolean supportsOpenStatementsAcrossRollback; - private Integer maxBinaryLiteralLength; - private Integer maxCharLiteralLength; - private Integer maxColumnNameLength; - private Integer maxColumnsInGroupBy; - private Integer maxColumnsInIndex; - private Integer maxColumnsInOrderBy; - private Integer maxColumnsInSelect; - private Integer maxColumnsInTable; - private Integer maxConnections; - private Integer maxCursorNameLength; - private Integer maxIndexLength; - private Integer maxSchemaNameLength; - private Integer maxProcedureNameLength; - private Integer maxCatalogNameLength; - private Integer maxRowSize; - private Boolean maxRowSizeIncludeBlobs; - private Integer maxStatementLength; - private Integer maxStatements; - private Integer maxTableNameLength; - private Integer maxTablesInSelect; - private Integer maxUserNameLength; - private Integer defaultTransactionIsolation; - private Boolean supportsTransactions; - private Set supportedTransactionIsolationLevels = new HashSet(); - private Boolean supportsDataDefinitionAndDataManipulationTransactions; - private Boolean supportsDataManipulationTransactionsOnly; - private Boolean dataDefinitionCausesTransactionCommit; - private Boolean dataDefinitionIgnoredInTransactions; - private Set storedProcedures = new HashSet(); - private Set
tables = new HashSet
(); - private Set schemas = new HashSet(); - private Set catalogs = new HashSet(); - private Set tableTypes = new HashSet(); - private Set sqlTypeInfos = new HashSet(); - private Set supportedResultSetTypes = new HashSet(); - private Set userDefinedTypes = new HashSet(); - private Set supportedConversions = new HashSet(); - private Set supportedForwardOnlyResultSetConcurrencies = new HashSet(); - private Set supportedScrollInsensitiveResultSetConcurrencies = new HashSet(); - private Set supportedScrollSensitiveResultSetConcurrencies = new HashSet(); - private Boolean forwardOnlyResultSetOwnUpdatesAreVisible; - private Boolean scrollInsensitiveResultSetOwnUpdatesAreVisible; - private Boolean scrollSensitiveResultSetOwnUpdatesAreVisible; - private Boolean forwardOnlyResultSetOwnDeletesAreVisible; - private Boolean scrollInsensitiveResultSetOwnDeletesAreVisible; - private Boolean scrollSensitiveResultSetOwnDeletesAreVisible; - private Boolean forwardOnlyResultSetOwnInsertsAreVisible; - private Boolean scrollInsensitiveResultSetOwnInsertsAreVisible; - private Boolean scrollSensitiveResultSetOwnInsertsAreVisible; - private Boolean forwardOnlyResultSetOthersUpdatesAreVisible; - private Boolean scrollInsensitiveResultSetOthersUpdatesAreVisible; - private Boolean scrollSensitiveResultSetOthersUpdatesAreVisible; - private Boolean forwardOnlyResultSetOthersDeletesAreVisible; - private Boolean scrollInsensitiveResultSetOthersDeletesAreVisible; - private Boolean scrollSensitiveResultSetOthersDeletesAreVisible; - private Boolean forwardOnlyResultSetOthersInsertsAreVisible; - private Boolean scrollInsensitiveResultSetOthersInsertsAreVisible; - private Boolean scrollSensitiveResultSetOthersInsertsAreVisible; - private Boolean forwardOnlyResultSetUpdatesAreDetected; - private Boolean scrollInsensitiveResultSetUpdatesAreDetected; - private Boolean scrollSensitiveResultSetUpdatesAreDetected; - private Boolean forwardOnlyResultSetDeletesAreDetected; - private Boolean scrollInsensitiveResultSetDeletesAreDetected; - private Boolean scrollSensitiveResultSetDeletesAreDetected; - private Boolean forwardOnlyResultInsertsAreDetected; - private Boolean scrollInsensitiveResultInsertsAreDetected; - private Boolean scrollSensitiveResultInsertsAreDetected; - private Boolean supportsBatchUpdates; - private Boolean supportsSavepoints; - private Boolean supportsNamedParameters; - private Boolean supportsMultipleOpenResults; - private Boolean supportsGetGeneratedKeys; - private Boolean supportsResultSetHoldCurrorsOverCommitHoldability; - private Boolean supportsResultSetCloseCurrorsAtCommitHoldability; - private ResultSetHoldabilityType resultSetHoldabilityType; - private Integer databaseMajorVersion; - private Integer databaseMinorVersion; - private Integer jdbcMajorVersion; - private Integer jdbcMinorVersion; - private SQLStateType sqlStateType; - private Boolean locatorsUpdateCopy; - private Boolean supportsStatementPooling; - - /** - * Default constructor - */ - public DatabaseBean() { - } - - /** - * Returns list of failed database metadata methods through the DatabaseMetaDataMethodExceptions - * - * @return list of failed database metadata methods through the DatabaseMetaDataMethodExceptions - */ - public List getExceptionList() { - return exceptionList; - } - - /** - * Adds the DatabaseMetaDataMethodException to the DatabaseMetadataProvider exception list - * - * @param exception the DatabaseMetaDataMethodException - */ - public void addException( DatabaseMetaDataMethodException exception ) { - exceptionList.add(exception); - } - - /** - * Searches the DatabaseMetaDataMethodException by method name - * - * @param methodName the name of method that caused exception - * @return the DatabaseMetaDataMethodException if found, otherwise returns null - */ - public DatabaseMetaDataMethodException findException( String methodName ) { - // trying to find exception - for (DatabaseMetaDataMethodException exception : exceptionList) { - if (exception.getMethodName().equals(methodName)) { - return exception; - } - } - return null; - } - - /** - * Checks that specified database metadata method of provider is failed or not - * - * @param methodName the name of method that caused exception - * @return true if method failed; false otherwise - */ - public boolean isDatabaseMetaDataMethodFailed( String methodName ) { - return (findException(methodName) != null); - } - - /** - * Gets database name - * - * @return database name - */ - public String getName() { - return name; - } - - /** - * Sets database name - * - * @param name the database name - */ - public void setName( String name ) { - this.name = name; - } - - // ---------------------------------------------------------------------- - // A variety of minor information about the target database. - // ---------------------------------------------------------------------- - - /** - * Retrieves whether the current user can call all the procedures returned by the method - * DatabaseMetaData.getProcedures. - * - * @return true if so; false otherwise - */ - public Boolean isAllProceduresAreCallable() { - return allProceduresAreCallable; - } - - /** - * sets whether the current user can call all the procedures returned by the method - * DatabaseMetaData.getProcedures. - * - * @param allProceduresAreCallable true if so; false otherwise - */ - public void setAllProceduresAreCallable( Boolean allProceduresAreCallable ) { - this.allProceduresAreCallable = allProceduresAreCallable; - } - - /** - * Retrieves whether the current user can use all the tables returned by the method DatabaseMetaData.getTables in - * a SELECT statement. - * - * @return true if so; false otherwise - */ - public Boolean isAllTablesAreSelectable() { - return allTablesAreSelectable; - } - - /** - * Sets whether the current user can use all the tables returned by the method DatabaseMetaData.getTables in a - * SELECT statement. - * - * @param allTablesAreSelectable true if so; false otherwise - */ - public void setAllTablesAreSelectable( Boolean allTablesAreSelectable ) { - this.allTablesAreSelectable = allTablesAreSelectable; - } - - /** - * Retrieves the URL for this DBMS. - * - * @return the URL for this DBMS or null if it cannot be generated - */ - public String getURL() { - return url; - } - - /** - * Sets the URL for this DBMS. - * - * @param url the URL for this DBMS or null if it cannot be generated - */ - public void setURL( String url ) { - this.url = url; - } - - /** - * Retrieves the user name as known to this database. - * - * @return the database user name - */ - public String getUserName() { - return userName; - } - - /** - * Sets the user name as known to this database. - * - * @param userName the database user name - */ - public void setUserName( String userName ) { - this.userName = userName; - } - - /** - * Retrieves whether this database is in read-only mode. - * - * @return true if so; false otherwise - */ - public Boolean isReadOnly() { - return readOnly; - } - - /** - * Sets whether this database is in read-only mode. - * - * @param readOnly true if so; false otherwise - */ - public void setReadOnly( Boolean readOnly ) { - this.readOnly = readOnly; - } - - /** - * Retrieves whether NULL values are sorted high. Sorted high means that NULL values sort higher - * than any other value in a domain. In an ascending order, if this method returns true, NULL values - * will appear at the end. By contrast, the method DatabaseMetaData.nullsAreSortedAtEnd indicates whether - * NULL values are sorted at the end regardless of sort order. - * - * @return true if so; false otherwise - */ - public Boolean isNullsAreSortedHigh() { - return nullsAreSortedHigh; - } - - /** - * Sets whether NULL values are sorted high. Sorted high means that NULL values sort higher than any - * other value in a domain. In an ascending order, if this method returns true, NULL values will - * appear at the end. By contrast, the method DatabaseMetaData.nullsAreSortedAtEnd indicates whether - * NULL values are sorted at the end regardless of sort order. - * - * @param nullsAreSortedHigh true if so; false otherwise - */ - public void setNullsAreSortedHigh( Boolean nullsAreSortedHigh ) { - this.nullsAreSortedHigh = nullsAreSortedHigh; - } - - /** - * Retrieves whether NULL values are sorted low. Sorted low means that NULL values sort lower than - * any other value in a domain. In an ascending order, if this method returns true, NULL values will - * appear at the beginning. By contrast, the method DatabaseMetaData.nullsAreSortedAtStart indicates whether - * NULL values are sorted at the beginning regardless of sort order. - * - * @return true if so; false otherwise - */ - public Boolean isNullsAreSortedLow() { - return nullsAreSortedLow; - } - - /** - * Sets whether NULL values are sorted low. Sorted low means that NULL values sort lower than any - * other value in a domain. In an ascending order, if this method returns true, NULL values will - * appear at the beginning. By contrast, the method DatabaseMetaData.nullsAreSortedAtStart indicates whether - * NULL values are sorted at the beginning regardless of sort order. - * - * @param nullsAreSortedLow true if so; false otherwise - */ - public void setNullsAreSortedLow( Boolean nullsAreSortedLow ) { - this.nullsAreSortedLow = nullsAreSortedLow; - } - - /** - * Retrieves whether NULL values are sorted at the start regardless of sort order. - * - * @return true if so; false otherwise - */ - public Boolean isNullsAreSortedAtStart() { - return nullsAreSortedAtStart; - } - - /** - * Sets whether NULL values are sorted at the start regardless of sort order. - * - * @param nullsAreSortedAtStart true if so; false otherwise - */ - public void setNullsAreSortedAtStart( Boolean nullsAreSortedAtStart ) { - this.nullsAreSortedAtStart = nullsAreSortedAtStart; - } - - /** - * Retrieves whether NULL values are sorted at the end regardless of sort order. - * - * @return true if so; false otherwise - */ - public Boolean isNullsAreSortedAtEnd() { - return nullsAreSortedAtEnd; - } - - /** - * Sets whether NULL values are sorted at the end regardless of sort order. - * - * @param nullsAreSortedAtEnd true if so; false otherwise - */ - public void setNullsAreSortedAtEnd( Boolean nullsAreSortedAtEnd ) { - this.nullsAreSortedAtEnd = nullsAreSortedAtEnd; - } - - /** - * Retrieves the name of this database product. - * - * @return database product name - */ - public String getDatabaseProductName() { - return databaseProductName; - } - - /** - * Sets the name of this database product. - * - * @param databaseProductName database product name - */ - public void setDatabaseProductName( String databaseProductName ) { - this.databaseProductName = databaseProductName; - } - - /** - * Retrieves the version number of this database product. - * - * @return database version number - */ - public String getDatabaseProductVersion() { - return databaseProductVersion; - } - - /** - * Sets the version number of this database product. - * - * @param databaseProductVersion database version number - */ - public void setDatabaseProductVersion( String databaseProductVersion ) { - this.databaseProductVersion = databaseProductVersion; - } - - /** - * Retrieves the name of this JDBC driver. - * - * @return JDBC driver name - */ - public String getDriverName() { - return driverName; - } - - /** - * Sets the name of this JDBC driver. - * - * @param driverName JDBC driver name - */ - public void setDriverName( String driverName ) { - this.driverName = driverName; - } - - /** - * Retrieves the version number of this JDBC driver as a String. - * - * @return JDBC driver version - */ - public String getDriverVersion() { - return driverVersion; - } - - /** - * Sets the version number of this JDBC driver as a String. - * - * @param driverVersion the JDBC driver version - */ - public void setDriverVersion( String driverVersion ) { - this.driverVersion = driverVersion; - } - - /** - * Retrieves this JDBC driver's minor version number. - * - * @return JDBC driver minor version number - */ - public Integer getDriverMajorVersion() { - return driverMajorVersion; - } - - /** - * Sets this JDBC driver's major version number. - * - * @param driverMajorVersion the JDBC driver major version - */ - public void setDriverMajorVersion( Integer driverMajorVersion ) { - this.driverMajorVersion = driverMajorVersion; - } - - /** - * Retrieves this JDBC driver's minor version number. - * - * @return JDBC driver minor version number - */ - public Integer getDriverMinorVersion() { - return driverMinorVersion; - } - - /** - * Sets this JDBC driver's minor version number. - * - * @param driverMinorVersion the JDBC driver minor version number - */ - public void setDriverMinorVersion( Integer driverMinorVersion ) { - this.driverMinorVersion = driverMinorVersion; - } - - /** - * Retrieves whether this database stores tables in a local file. - * - * @return true if so; false otherwise - */ - public Boolean isUsesLocalFiles() { - return usesLocalFiles; - } - - /** - * Sets whether this database stores tables in a local file. - * - * @param usesLocalFiles true if so; false otherwise - */ - public void setUsesLocalFiles( Boolean usesLocalFiles ) { - this.usesLocalFiles = usesLocalFiles; - } - - /** - * Retrieves whether this database uses a file for each table. - * - * @return true if this database uses a local file for each table; false otherwise - */ - public Boolean isUsesLocalFilePerTable() { - return usesLocalFilePerTable; - } - - /** - * Sets whether this database uses a file for each table. - * - * @param usesLocalFilePerTable true if this database uses a local file for each table; false - * otherwise - */ - public void setUsesLocalFilePerTable( Boolean usesLocalFilePerTable ) { - this.usesLocalFilePerTable = usesLocalFilePerTable; - } - - /** - * Retrieves whether this database treats mixed case unquoted SQL identifiers as case sensitive and as a result stores them in - * mixed case. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsMixedCaseIdentifiers() { - return supportsMixedCaseIdentifiers; - } - - /** - * Sets whether this database treats mixed case unquoted SQL identifiers as case sensitive and as a result stores them in - * mixed case. - * - * @param supportsMixedCaseIdentifiers true if so; false otherwise - */ - public void setSupportsMixedCaseIdentifiers( Boolean supportsMixedCaseIdentifiers ) { - this.supportsMixedCaseIdentifiers = supportsMixedCaseIdentifiers; - } - - /** - * Retrieves whether this database treats mixed case unquoted SQL identifiers as case insensitive and stores them in upper - * case. - * - * @return true if so; false otherwise - */ - public Boolean isStoresUpperCaseIdentifiers() { - return storesUpperCaseIdentifiers; - } - - /** - * Sets whether this database treats mixed case unquoted SQL identifiers as case insensitive and stores them in upper case. - * - * @param storesUpperCaseIdentifiers true if so; false otherwise - */ - public void setStoresUpperCaseIdentifiers( Boolean storesUpperCaseIdentifiers ) { - this.storesUpperCaseIdentifiers = storesUpperCaseIdentifiers; - } - - /** - * Retrieves whether this database treats mixed case unquoted SQL identifiers as case insensitive and stores them in lower - * case. - * - * @return true if so; false otherwise - */ - public Boolean isStoresLowerCaseIdentifiers() { - return storesLowerCaseIdentifiers; - } - - /** - * sets whether this database treats mixed case unquoted SQL identifiers as case insensitive and stores them in lower case. - * - * @param storesLowerCaseIdentifiers true if so; false otherwise - */ - public void setStoresLowerCaseIdentifiers( Boolean storesLowerCaseIdentifiers ) { - this.storesLowerCaseIdentifiers = storesLowerCaseIdentifiers; - } - - /** - * Retrieves whether this database treats mixed case unquoted SQL identifiers as case insensitive and stores them in mixed - * case. - * - * @return true if so; false otherwise - */ - public Boolean isStoresMixedCaseIdentifiers() { - return storesMixedCaseIdentifiers; - } - - /** - * Sets whether this database treats mixed case unquoted SQL identifiers as case insensitive and stores them in mixed case. - * - * @param storesMixedCaseIdentifiers true if so; false otherwise - */ - public void setStoresMixedCaseIdentifiers( Boolean storesMixedCaseIdentifiers ) { - this.storesMixedCaseIdentifiers = storesMixedCaseIdentifiers; - } - - /** - * Retrieves whether this database treats mixed case quoted SQL identifiers as case sensitive and as a result stores them in - * mixed case. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsMixedCaseQuotedIdentifiers() { - return supportsMixedCaseQuotedIdentifiers; - } - - /** - * Sets whether this database treats mixed case quoted SQL identifiers as case sensitive and as a result stores them in mixed - * case. - * - * @param supportsMixedCaseQuotedIdentifiers true if so; false otherwise - */ - public void setSupportsMixedCaseQuotedIdentifiers( Boolean supportsMixedCaseQuotedIdentifiers ) { - this.supportsMixedCaseQuotedIdentifiers = supportsMixedCaseQuotedIdentifiers; - } - - /** - * Retrieves whether this database treats mixed case quoted SQL identifiers as case insensitive and stores them in upper case. - * - * @return true if so; false otherwise - */ - public Boolean isStoresUpperCaseQuotedIdentifiers() { - return storesUpperCaseQuotedIdentifiers; - } - - /** - * Sets whether this database treats mixed case quoted SQL identifiers as case insensitive and stores them in upper case. - * - * @param storesUpperCaseQuotedIdentifiers true if so; false otherwise - */ - public void setStoresUpperCaseQuotedIdentifiers( Boolean storesUpperCaseQuotedIdentifiers ) { - this.storesUpperCaseQuotedIdentifiers = storesUpperCaseQuotedIdentifiers; - } - - /** - * Retrieves whether this database treats mixed case quoted SQL identifiers as case insensitive and stores them in lower case. - * - * @return true if so; false otherwise - */ - public Boolean isStoresLowerCaseQuotedIdentifiers() { - return storesLowerCaseQuotedIdentifiers; - } - - /** - * Sets whether this database treats mixed case quoted SQL identifiers as case insensitive and stores them in lower case. - * - * @param storesLowerCaseQuotedIdentifiers true if so; false otherwise - */ - public void setStoresLowerCaseQuotedIdentifiers( Boolean storesLowerCaseQuotedIdentifiers ) { - this.storesLowerCaseQuotedIdentifiers = storesLowerCaseQuotedIdentifiers; - } - - /** - * Retrieves whether this database treats mixed case quoted SQL identifiers as case insensitive and stores them in mixed case. - * - * @return true if so; false otherwise - */ - public Boolean isStoresMixedCaseQuotedIdentifiers() { - return storesMixedCaseQuotedIdentifiers; - } - - /** - * Sets whether this database treats mixed case quoted SQL identifiers as case insensitive and stores them in mixed case. - * - * @param storesMixedCaseQuotedIdentifiers true if so; false otherwise - */ - public void setStoresMixedCaseQuotedIdentifiers( Boolean storesMixedCaseQuotedIdentifiers ) { - this.storesMixedCaseQuotedIdentifiers = storesMixedCaseQuotedIdentifiers; - } - - /** - * Retrieves the string used to quote SQL identifiers. This method returns a space " " if identifier quoting is not supported. - * - * @return the quoting string or a space if quoting is not supported - */ - public String getIdentifierQuoteString() { - return identifierQuoteString; - } - - /** - * Sets the string used to quote SQL identifiers. This method returns a space " " if identifier quoting is not supported. - * - * @param identifierQuoteString the quoting string or a space if quoting is not supported - */ - public void setIdentifierQuoteString( String identifierQuoteString ) { - this.identifierQuoteString = identifierQuoteString; - } - - /** - * Retrieves a list of all of this database's SQL keywords that are NOT also SQL92 keywords. - * - * @return the list of this database's keywords that are not also SQL92 keywords - */ - public Set getSQLKeywords() { - return sqlKeywords; - } - - /** - * Adds SQL keyword - * - * @param sqlKeyword the SQL keyword to add - */ - public void addSQLKeyword( String sqlKeyword ) { - sqlKeywords.add(sqlKeyword); - } - - /** - * Deletes SQL keyword - * - * @param sqlKeyword the SQL keyword to delete - */ - public void deleteSQLKeyword( String sqlKeyword ) { - sqlKeywords.remove(sqlKeyword); - } - - /** - * Is SQL keyword supported - * - * @param sqlKeyword the SQL keyword to search - * @return true if supported; false otherwiose - */ - public Boolean isSQLKeywordSupported( String sqlKeyword ) { - for (String s : sqlKeywords) { - if (s.equals(sqlKeyword)) { - return Boolean.TRUE; - } - } - // return false - return Boolean.FALSE; - } - - /** - * Retrieves a list of math functions available with this database. These are the Open /Open CLI math function names used in - * the JDBC function escape clause. - * - * @return the list of math functions supported by this database - */ - public Set getNumericFunctions() { - return numericFunctions; - } - - /** - * Adds numeric function - * - * @param functionName the name of numeric function to add - */ - public void addNumericFunction( String functionName ) { - numericFunctions.add(functionName); - } - - /** - * Deletes numeric function - * - * @param functionName the name of numeric function to delete - */ - public void deleteNumericFunction( String functionName ) { - numericFunctions.remove(functionName); - } - - /** - * Is Numeric function supported - * - * @param functionName the name of numeric function - * @return true is supported; false otherwise - */ - public Boolean isNumericFunctionSupported( String functionName ) { - for (String s : numericFunctions) { - if (s.equals(functionName)) { - return Boolean.TRUE; - } - } - // return false - return Boolean.FALSE; - } - - /** - * Retrieves a list of string functions available with this database. These are the Open Group CLI string function names used - * in the JDBC function escape clause. - * - * @return the list of string functions supported by this database - */ - public Set getStringFunctions() { - return stringFunctions; - } - - /** - * Adds String function - * - * @param functionName the name of String function to add - */ - public void addStringFunction( String functionName ) { - stringFunctions.add(functionName); - } - - /** - * Deletes String function - * - * @param functionName the name of String function to delete - */ - public void deleteStringFunction( String functionName ) { - stringFunctions.remove(functionName); - } - - /** - * Is String function supported - * - * @param functionName the name of String function - * @return true is supported; false otherwise - */ - public Boolean isStringFunctionSupported( String functionName ) { - for (String s : stringFunctions) { - if (s.equals(functionName)) { - return Boolean.TRUE; - } - } - // return false - return Boolean.FALSE; - } - - /** - * Retrieves a list of system functions available with this database. These are the Open Group CLI system function names used - * in the JDBC function escape clause. - * - * @return a list of system functions supported by this database - */ - public Set getSystemFunctions() { - return systemFunctions; - } - - /** - * Adds System function - * - * @param functionName the name of System function to add - */ - public void addSystemFunction( String functionName ) { - systemFunctions.add(functionName); - } - - /** - * deletes System function - * - * @param functionName the name of System function to delete - */ - public void deleteSystemFunction( String functionName ) { - systemFunctions.remove(functionName); - } - - /** - * Is System function supported - * - * @param functionName the name of System function - * @return true is supported; false otherwise - */ - public Boolean isSystemFunctionSupported( String functionName ) { - for (String s : systemFunctions) { - if (s.equals(functionName)) { - return Boolean.TRUE; - } - } - // return false - return Boolean.FALSE; - } - - /** - * Retrieves a list of the time and date functions available with this database. - * - * @return the list of time and date functions supported by this database - */ - public Set getTimeDateFunctions() { - return timeDateFunctions; - } - - /** - * Adds Time/Date function - * - * @param functionName the name of Time/Date function to add - */ - public void addTimeDateFunction( String functionName ) { - timeDateFunctions.add(functionName); - } - - /** - * deletes Time/Date function - * - * @param functionName the name of Time/Date function to delete - */ - public void deleteTimeDateFunction( String functionName ) { - timeDateFunctions.remove(functionName); - } - - /** - * Is Time/Date function supported - * - * @param functionName the name of Time/Date function - * @return true is supported; false otherwise - */ - public Boolean isTimeDateFunctionSupported( String functionName ) { - for (String s : timeDateFunctions) { - if (s.equals(functionName)) { - return Boolean.TRUE; - } - } - // return false - return Boolean.FALSE; - } - - /** - * Retrieves the string that can be used to escape wildcard characters. This is the string that can be used to escape '_' or - * '%' in the catalog search parameters that are a pattern (and therefore use one of the wildcard characters). - *

- * The '_' character represents any single character; the '%' character represents any sequence of zero or more characters. - * - * @return the string used to escape wildcard characters - */ - public String getSearchStringEscape() { - return searchStringEscape; - } - - /** - * Sets the string that can be used to escape wildcard characters. This is the string that can be used to escape '_' or '%' in - * the catalog search parameters that are a pattern (and therefore use one of the wildcard characters). - *

- * The '_' character represents any single character; the '%' character represents any sequence of zero or more characters. - * - * @param searchStringEscape the string used to escape wildcard characters - */ - public void setSearchStringEscape( String searchStringEscape ) { - this.searchStringEscape = searchStringEscape; - } - - /** - * Retrieves all the "extra" characters that can be used in unquoted identifier names (those beyond a-z, A-Z, 0-9 and _). - * - * @return the string containing the extra characters - */ - public String getExtraNameCharacters() { - return extraNameCharacters; - } - - /** - * Sets all the "extra" characters that can be used in unquoted identifier names (those beyond a-z, A-Z, 0-9 and _). - * - * @param extraNameCharacters the string containing the extra characters - */ - public void setExtraNameCharacters( String extraNameCharacters ) { - this.extraNameCharacters = extraNameCharacters; - } - - // -------------------------------------------------------------------- - // Functions describing which features are supported. - // -------------------------------------------------------------------- - - /** - * Retrieves whether this database supports ALTER TABLE with add column. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsAlterTableWithAddColumn() { - return supportsAlterTableWithAddColumn; - } - - /** - * Sets whether this database supports ALTER TABLE with add column. - * - * @param supportsAlterTableWithAddColumn true if so; false otherwise - */ - public void setSupportsAlterTableWithAddColumn( Boolean supportsAlterTableWithAddColumn ) { - this.supportsAlterTableWithAddColumn = supportsAlterTableWithAddColumn; - } - - /** - * Retrieves whether this database supports ALTER TABLE with drop column. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsAlterTableWithDropColumn() { - return supportsAlterTableWithDropColumn; - } - - /** - * Sets whether this database supports ALTER TABLE with drop column. - * - * @param supportsAlterTableWithDropColumn true if so; false otherwise - */ - public void setSupportsAlterTableWithDropColumn( Boolean supportsAlterTableWithDropColumn ) { - this.supportsAlterTableWithDropColumn = supportsAlterTableWithDropColumn; - } - - /** - * Retrieves whether this database supports column aliasing. - *

- * If so, the SQL AS clause can be used to provide names for computed columns or to provide alias names for columns as - * required. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsColumnAliasing() { - return supportsColumnAliasing; - } - - /** - * Sets whether this database supports column aliasing. - *

- * If so, the SQL AS clause can be used to provide names for computed columns or to provide alias names for columns as - * required. - * - * @param supportsColumnAliasing true if so; false otherwise - */ - public void setSupportsColumnAliasing( Boolean supportsColumnAliasing ) { - this.supportsColumnAliasing = supportsColumnAliasing; - } - - /** - * Retrieves whether this database supports concatenations between NULL and non-NULL values being - * NULL. - * - * @return true if so; false otherwise - */ - public Boolean isNullPlusNonNullIsNull() { - return nullPlusNonNullIsNull; - } - - /** - * Sets whether this database supports concatenations between NULL and non-NULL values being - * NULL. - * @param nullPlusNonNullIsNull true if so - * - */ - public void setNullPlusNonNullIsNull( Boolean nullPlusNonNullIsNull ) { - this.nullPlusNonNullIsNull = nullPlusNonNullIsNull; - } - - /** - * Retrieves whether this database supports the CONVERT function between SQL types. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsConvert() { - return supportsConvert; - } - - /** - * Sets whether this database supports the CONVERT function between SQL types. - * - * @param supportsConvert true if so; false otherwise - */ - public void setSupportsConvert( Boolean supportsConvert ) { - this.supportsConvert = supportsConvert; - } - - /** - * Retrieves whether this database supports the CONVERT for given SQL types. It uses original - * DatabaseMetaData.supportsConvert to check common (NOT ALL POSSIBLE) conversions. - * - * @return list of common (NOT ALL POSSIBLE) conversions. - * @see java.sql.Types - */ - public Set getSupportedConversions() { - return supportedConversions; - } - - /** - * Adds SqlTypeConversionPair - * - * @param sqlTypeConversionPair the SqlTypeConversionPair - */ - public void addSqlTypeConversionPair( SqlTypeConversionPair sqlTypeConversionPair ) { - supportedConversions.add(sqlTypeConversionPair); - } - - /** - * deletes SqlTypeConversionPair - * - * @param sqlTypeConversionPair the SqlTypeConversionPair - */ - public void deleteSqlTypeConversionPair( SqlTypeConversionPair sqlTypeConversionPair ) { - supportedConversions.remove(sqlTypeConversionPair); - } - - /** - * Searches set of SqlTypeConversionPair by SrcType - * @param srcType - * - * @return set of SqlTypeConversionPair - */ - public Set findSqlTypeConversionPairBySrcType( String srcType ) { - // create set holder - Set set = new HashSet(); - // if found - for (SqlTypeConversionPair c : supportedConversions) { - if (c.getSrcType().toString().equals(srcType)) { - set.add(c); - } - } - // return nothing - return set; - } - - /** - * Retrieves whether this database supports table correlation names. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsTableCorrelationNames() { - return supportsTableCorrelationNames; - } - - /** - * Sets whether this database supports table correlation names. - * - * @param supportsTableCorrelationNames true if so; false otherwise - */ - public void setSupportsTableCorrelationNames( Boolean supportsTableCorrelationNames ) { - this.supportsTableCorrelationNames = supportsTableCorrelationNames; - } - - /** - * Retrieves whether, when table correlation names are supported, they are restricted to being different from the names of the - * tables. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsDifferentTableCorrelationNames() { - return supportsDifferentTableCorrelationNames; - } - - /** - * Sets whether, when table correlation names are supported, they are restricted to being different from the names of the - * tables. - * - * @param supportsDifferentTableCorrelationNames true if so; false otherwise - */ - public void setSupportsDifferentTableCorrelationNames( Boolean supportsDifferentTableCorrelationNames ) { - this.supportsDifferentTableCorrelationNames = supportsDifferentTableCorrelationNames; - } - - /** - * Retrieves whether this database supports expressions in ORDER BY lists. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsExpressionsInOrderBy() { - return supportsExpressionsInOrderBy; - } - - /** - * Sets whether this database supports expressions in ORDER BY lists. - * - * @param supportsExpressionsInOrderBy true if so; false otherwise - */ - public void setSupportsExpressionsInOrderBy( Boolean supportsExpressionsInOrderBy ) { - this.supportsExpressionsInOrderBy = supportsExpressionsInOrderBy; - } - - /** - * Retrieves whether this database supports using a column that is not in the SELECT statement in an - * ORDER BY clause. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsOrderByUnrelated() { - return supportsOrderByUnrelated; - } - - /** - * Sets whether this database supports using a column that is not in the SELECT statement in an - * ORDER BY clause. - * @param supportsOrderByUnrelated true if so - * - */ - public void setSupportsOrderByUnrelated( Boolean supportsOrderByUnrelated ) { - this.supportsOrderByUnrelated = supportsOrderByUnrelated; - } - - /** - * Retrieves whether this database supports some form of GROUP BY clause. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsGroupBy() { - return supportsGroupBy; - } - - /** - * Sets whether this database supports some form of GROUP BY clause. - * - * @param supportsGroupBy true if so; false otherwise - */ - public void setSupportsGroupBy( Boolean supportsGroupBy ) { - this.supportsGroupBy = supportsGroupBy; - } - - /** - * Retrieves whether this database supports using a column that is not in the SELECT statement in a - * GROUP BY clause. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsGroupByUnrelated() { - return supportsGroupByUnrelated; - } - - /** - * Sets whether this database supports using a column that is not in the SELECT statement in a - * GROUP BY clause. - * - * @param supportsGroupByUnrelated true if so; false otherwise - */ - public void setSupportsGroupByUnrelated( Boolean supportsGroupByUnrelated ) { - this.supportsGroupByUnrelated = supportsGroupByUnrelated; - } - - /** - * Retrieves whether this database supports using columns not included in the SELECT statement in a - * GROUP BY clause provided that all of the columns in the SELECT statement are included in the - * GROUP BY clause. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsGroupByBeyondSelect() { - return supportsGroupByBeyondSelect; - } - - /** - * Sets whether this database supports using columns not included in the SELECT statement in a - * GROUP BY clause provided that all of the columns in the SELECT statement are included in the - * GROUP BY clause. - * - * @param supportsGroupByBeyondSelect true if so; false otherwise - */ - public void setSupportsGroupByBeyondSelect( Boolean supportsGroupByBeyondSelect ) { - this.supportsGroupByBeyondSelect = supportsGroupByBeyondSelect; - } - - /** - * Retrieves whether this database supports specifying a LIKE escape clause. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsLikeEscapeClause() { - return supportsLikeEscapeClause; - } - - /** - * Sets whether this database supports specifying a LIKE escape clause. - * - * @param supportsLikeEscapeClause true if so; false otherwise - */ - public void setSupportsLikeEscapeClause( Boolean supportsLikeEscapeClause ) { - this.supportsLikeEscapeClause = supportsLikeEscapeClause; - } - - /** - * Retrieves whether this database supports getting multiple ResultSet objects from a single call to the method - * execute. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsMultipleResultSets() { - return supportsMultipleResultSets; - } - - /** - * Sets whether this database supports getting multiple ResultSet objects from a single call to the method - * execute. - * - * @param supportsMultipleResultSets true if so; false otherwise - */ - public void setSupportsMultipleResultSets( Boolean supportsMultipleResultSets ) { - this.supportsMultipleResultSets = supportsMultipleResultSets; - } - - /** - * Retrieves whether this database allows having multiple transactions open at once (on different connections). - * - * @return true if so; false otherwise - */ - public Boolean isSupportsMultipleTransactions() { - return supportsMultipleTransactions; - } - - /** - * Sets whether this database allows having multiple transactions open at once (on different connections). - * - * @param supportsMultipleTransactions true if so; false otherwise - */ - public void setSupportsMultipleTransactions( Boolean supportsMultipleTransactions ) { - this.supportsMultipleTransactions = supportsMultipleTransactions; - } - - /** - * Retrieves whether columns in this database may be defined as non-nullable. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsNonNullableColumns() { - return supportsNonNullableColumns; - } - - /** - * Sets whether columns in this database may be defined as non-nullable. - * - * @param supportsNonNullableColumns true if so; false otherwise - */ - public void setSupportsNonNullableColumns( Boolean supportsNonNullableColumns ) { - this.supportsNonNullableColumns = supportsNonNullableColumns; - } - - /** - * Retrieves whether this database supports the ODBC Minimum SQL grammar. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsMinimumSQLGrammar() { - return supportsMinimumSQLGrammar; - } - - /** - * Sets whether this database supports the ODBC Minimum SQL grammar. - * - * @param supportsMinimumSQLGrammar true if so; false otherwise - */ - public void setSupportsMinimumSQLGrammar( Boolean supportsMinimumSQLGrammar ) { - this.supportsMinimumSQLGrammar = supportsMinimumSQLGrammar; - } - - /** - * Retrieves whether this database supports the ODBC Core SQL grammar. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsCoreSQLGrammar() { - return supportsCoreSQLGrammar; - } - - /** - * Sets whether this database supports the ODBC Core SQL grammar. - * - * @param supportsCoreSQLGrammar true if so; false otherwise - */ - public void setSupportsCoreSQLGrammar( Boolean supportsCoreSQLGrammar ) { - this.supportsCoreSQLGrammar = supportsCoreSQLGrammar; - } - - /** - * Retrieves whether this database supports the ODBC Extended SQL grammar. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsExtendedSQLGrammar() { - return supportsExtendedSQLGrammar; - } - - /** - * Sets whether this database supports the ODBC Extended SQL grammar. - * - * @param supportsExtendedSQLGrammar true if so; false otherwise - */ - public void setSupportsExtendedSQLGrammar( Boolean supportsExtendedSQLGrammar ) { - this.supportsExtendedSQLGrammar = supportsExtendedSQLGrammar; - } - - /** - * Retrieves whether this database supports the ANSI92 entry level SQL grammar. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsANSI92EntryLevelSQL() { - return supportsANSI92EntryLevelSQL; - } - - /** - * Sets whether this database supports the ANSI92 entry level SQL grammar. - * - * @param supportsANSI92EntryLevelSQL true if so; false otherwise - */ - public void setSupportsANSI92EntryLevelSQL( Boolean supportsANSI92EntryLevelSQL ) { - this.supportsANSI92EntryLevelSQL = supportsANSI92EntryLevelSQL; - } - - /** - * Retrieves whether this database supports the ANSI92 intermediate SQL grammar supported. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsANSI92IntermediateSQL() { - return supportsANSI92IntermediateSQL; - } - - /** - * Sets whether this database supports the ANSI92 intermediate SQL grammar supported. - * - * @param supportsANSI92IntermediateSQL true if so; false otherwise - */ - public void setSupportsANSI92IntermediateSQL( Boolean supportsANSI92IntermediateSQL ) { - this.supportsANSI92IntermediateSQL = supportsANSI92IntermediateSQL; - } - - /** - * Retrieves whether this database supports the ANSI92 full SQL grammar supported. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsANSI92FullSQL() { - return supportsANSI92FullSQL; - } - - /** - * Sets whether this database supports the ANSI92 full SQL grammar supported. - * - * @param supportsANSI92FullSQL true if so; false otherwise - */ - public void setSupportsANSI92FullSQL( Boolean supportsANSI92FullSQL ) { - this.supportsANSI92FullSQL = supportsANSI92FullSQL; - } - - /** - * Retrieves whether this database supports the SQL Integrity Enhancement Facility. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsIntegrityEnhancementFacility() { - return supportsIntegrityEnhancementFacility; - } - - /** - * Sets whether this database supports the SQL Integrity Enhancement Facility. - * - * @param supportsIntegrityEnhancementFacility true if so; false otherwise - */ - public void setSupportsIntegrityEnhancementFacility( Boolean supportsIntegrityEnhancementFacility ) { - this.supportsIntegrityEnhancementFacility = supportsIntegrityEnhancementFacility; - } - - /** - * Retrieves whether this database supports some form of outer join. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsOuterJoins() { - return supportsOuterJoins; - } - - /** - * Sets whether this database supports some form of outer join. - * - * @param supportsOuterJoins true if so; false otherwise - */ - public void setSupportsOuterJoins( Boolean supportsOuterJoins ) { - this.supportsOuterJoins = supportsOuterJoins; - } - - /** - * Retrieves whether this database supports full nested outer joins. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsFullOuterJoins() { - return supportsFullOuterJoins; - } - - /** - * Sets whether this database supports full nested outer joins. - * - * @param supportsFullOuterJoins true if so; false otherwise - */ - public void setSupportsFullOuterJoins( Boolean supportsFullOuterJoins ) { - this.supportsFullOuterJoins = supportsFullOuterJoins; - } - - /** - * Retrieves whether this database provides limited support for outer joins. (This will be true if the method - * DatabaseMetaData.supportsFullOuterJoins returns true). - * - * @return true if so; false otherwise - */ - public Boolean isSupportsLimitedOuterJoins() { - return supportsLimitedOuterJoins; - } - - /** - * Sets whether this database provides limited support for outer joins. (This will be true if the method - * DatabaseMetaData.supportsFullOuterJoins returns true). - * - * @param supportsLimitedOuterJoins true if so; false otherwise - */ - public void setSupportsLimitedOuterJoins( Boolean supportsLimitedOuterJoins ) { - this.supportsLimitedOuterJoins = supportsLimitedOuterJoins; - } - - /** - * Retrieves the database vendor's preferred term for "schema". - * - * @return the vendor term for "schema" - */ - public String getSchemaTerm() { - return schemaTerm; - } - - /** - * Sets the database vendor's preferred term for "schema". - * - * @param schemaTerm the vendor term for "schema" - */ - public void setSchemaTerm( String schemaTerm ) { - this.schemaTerm = schemaTerm; - } - - /** - * Retrieves the database vendor's preferred term for "procedure". - * - * @return the vendor term for "procedure" - */ - public String getProcedureTerm() { - return procedureTerm; - } - - /** - * Sets the database vendor's preferred term for "procedure". - * - * @param procedureTerm the vendor term for "procedure" - */ - public void setProcedureTerm( String procedureTerm ) { - this.procedureTerm = procedureTerm; - } - - /** - * Retrieves the database vendor's preferred term for "catalog". - * - * @return the vendor term for "catalog" - */ - public String getCatalogTerm() { - return catalogTerm; - } - - /** - * Sets the database vendor's preferred term for "catalog". - * - * @param catalogTerm the vendor term for "catalog" - */ - public void setCatalogTerm( String catalogTerm ) { - this.catalogTerm = catalogTerm; - } - - /** - * Retrieves whether a catalog appears at the start of a fully qualified table name. If not, the catalog appears at the end. - * - * @return true if the catalog name appears at the beginning of a fully qualified table name; false - * otherwise - */ - public Boolean isCatalogAtStart() { - return catalogAtStart; - } - - /** - * Sets whether a catalog appears at the start of a fully qualified table name. If not, the catalog appears at the end. - * - * @param catalogAtStart true if the catalog name appears at the beginning of a fully qualified table name; - * false otherwise - */ - public void setCatalogAtStart( Boolean catalogAtStart ) { - this.catalogAtStart = catalogAtStart; - } - - /** - * Retrieves the String that this database uses as the separator between a catalog and table name. - * - * @return the separator string - */ - public String getCatalogSeparator() { - return catalogSeparator; - } - - /** - * Sets the String that this database uses as the separator between a catalog and table name. - * - * @param catalogSeparator the separator string - */ - public void setCatalogSeparator( String catalogSeparator ) { - this.catalogSeparator = catalogSeparator; - } - - /** - * Retrieves whether a schema name can be used in a data manipulation statement. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsSchemasInDataManipulation() { - return supportsSchemasInDataManipulation; - } - - /** - * Sets whether a schema name can be used in a data manipulation statement. - * - * @param supportsSchemasInDataManipulation true if so; false otherwise - */ - public void setSupportsSchemasInDataManipulation( Boolean supportsSchemasInDataManipulation ) { - this.supportsSchemasInDataManipulation = supportsSchemasInDataManipulation; - } - - /** - * Retrieves whether a schema name can be used in a procedure call statement. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsSchemasInProcedureCalls() { - return supportsSchemasInProcedureCalls; - } - - /** - * Sets whether a schema name can be used in a procedure call statement. - * - * @param supportsSchemasInProcedureCalls true if so; false otherwise - */ - public void setSupportsSchemasInProcedureCalls( Boolean supportsSchemasInProcedureCalls ) { - this.supportsSchemasInProcedureCalls = supportsSchemasInProcedureCalls; - } - - /** - * Retrieves whether a schema name can be used in a table definition statement. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsSchemasInTableDefinitions() { - return supportsSchemasInTableDefinitions; - } - - /** - * Sets whether a schema name can be used in a table definition statement. - * - * @param supportsSchemasInTableDefinitions true if so; false otherwise - */ - public void setSupportsSchemasInTableDefinitions( Boolean supportsSchemasInTableDefinitions ) { - this.supportsSchemasInTableDefinitions = supportsSchemasInTableDefinitions; - } - - /** - * Retrieves whether a schema name can be used in an index definition statement. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsSchemasInIndexDefinitions() { - return supportsSchemasInIndexDefinitions; - } - - /** - * Sets whether a schema name can be used in an index definition statement. - * - * @param supportsSchemasInIndexDefinitions true if so; false otherwise - */ - public void setSupportsSchemasInIndexDefinitions( Boolean supportsSchemasInIndexDefinitions ) { - this.supportsSchemasInIndexDefinitions = supportsSchemasInIndexDefinitions; - } - - /** - * Retrieves whether a schema name can be used in a privilege definition statement. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsSchemasInPrivilegeDefinitions() { - return supportsSchemasInPrivilegeDefinitions; - } - - /** - * Sets whether a schema name can be used in a privilege definition statement. - * - * @param supportsSchemasInPrivilegeDefinitions true if so; false otherwise - */ - public void setSupportsSchemasInPrivilegeDefinitions( Boolean supportsSchemasInPrivilegeDefinitions ) { - this.supportsSchemasInPrivilegeDefinitions = supportsSchemasInPrivilegeDefinitions; - } - - /** - * Retrieves whether a catalog name can be used in a data manipulation statement. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsCatalogsInDataManipulation() { - return supportsCatalogsInDataManipulation; - } - - /** - * Sets whether a catalog name can be used in a data manipulation statement. - * - * @param supportsCatalogsInDataManipulation true if so; false otherwise - */ - public void setSupportsCatalogsInDataManipulation( Boolean supportsCatalogsInDataManipulation ) { - this.supportsCatalogsInDataManipulation = supportsCatalogsInDataManipulation; - } - - /** - * Retrieves whether a catalog name can be used in a procedure call statement. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsCatalogsInProcedureCalls() { - return supportsCatalogsInProcedureCalls; - } - - /** - * Sets whether a catalog name can be used in a procedure call statement. - * - * @param supportsCatalogsInProcedureCalls true if so; false otherwise - */ - public void setSupportsCatalogsInProcedureCalls( Boolean supportsCatalogsInProcedureCalls ) { - this.supportsCatalogsInProcedureCalls = supportsCatalogsInProcedureCalls; - } - - /** - * Retrieves whether a catalog name can be used in a table definition statement. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsCatalogsInTableDefinitions() { - return supportsCatalogsInTableDefinitions; - } - - /** - * Sets whether a catalog name can be used in a table definition statement. - * - * @param supportsCatalogsInTableDefinitions true if so; false otherwise - */ - public void setSupportsCatalogsInTableDefinitions( Boolean supportsCatalogsInTableDefinitions ) { - this.supportsCatalogsInTableDefinitions = supportsCatalogsInTableDefinitions; - } - - /** - * Retrieves whether a catalog name can be used in an index definition statement. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsCatalogsInIndexDefinitions() { - return supportsCatalogsInIndexDefinitions; - } - - /** - * Sets whether a catalog name can be used in an index definition statement. - * - * @param supportsCatalogsInIndexDefinitions true if so; false otherwise - * - */ - public void setSupportsCatalogsInIndexDefinitions( Boolean supportsCatalogsInIndexDefinitions ) { - this.supportsCatalogsInIndexDefinitions = supportsCatalogsInIndexDefinitions; - } - - /** - * Retrieves whether a catalog name can be used in a privilege definition statement. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsCatalogsInPrivilegeDefinitions() { - return supportsCatalogsInPrivilegeDefinitions; - } - - /** - * Sets whether a catalog name can be used in a privilege definition statement. - * - * @param supportsCatalogsInPrivilegeDefinitions true if so; false otherwise - */ - public void setSupportsCatalogsInPrivilegeDefinitions( Boolean supportsCatalogsInPrivilegeDefinitions ) { - this.supportsCatalogsInPrivilegeDefinitions = supportsCatalogsInPrivilegeDefinitions; - } - - /** - * Retrieves whether this database supports positioned DELETE statements. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsPositionedDelete() { - return supportsPositionedDelete; - } - - /** - * Sets whether this database supports positioned DELETE statements. - * - * @param supportsPositionedDelete true if so; false otherwise - */ - public void setSupportsPositionedDelete( Boolean supportsPositionedDelete ) { - this.supportsPositionedDelete = supportsPositionedDelete; - } - - /** - * Retrieves whether this database supports positioned UPDATE statements. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsPositionedUpdate() { - return supportsPositionedUpdate; - } - - /** - * Sets whether this database supports positioned UPDATE statements. - * - * @param supportsPositionedUpdate true if so; false otherwise - */ - public void setSupportsPositionedUpdate( Boolean supportsPositionedUpdate ) { - this.supportsPositionedUpdate = supportsPositionedUpdate; - } - - /** - * Retrieves whether this database supports SELECT FOR UPDATE statements. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsSelectForUpdate() { - return supportsSelectForUpdate; - } - - /** - * Sets whether this database supports SELECT FOR UPDATE statements. - * - * @param supportsSelectForUpdate true if so; false otherwise - */ - public void setSupportsSelectForUpdate( Boolean supportsSelectForUpdate ) { - this.supportsSelectForUpdate = supportsSelectForUpdate; - } - - /** - * Retrieves whether this database supports stored procedure calls that use the stored procedure escape syntax. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsStoredProcedures() { - return supportsStoredProcedures; - } - - /** - * Sets whether this database supports stored procedure calls that use the stored procedure escape syntax. - * - * @param supportsStoredProcedures true if so; false otherwise - */ - public void setSupportsStoredProcedures( Boolean supportsStoredProcedures ) { - this.supportsStoredProcedures = supportsStoredProcedures; - } - - /** - * Retrieves whether this database supports subqueries in comparison expressions. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsSubqueriesInComparisons() { - return supportsSubqueriesInComparisons; - } - - /** - * Retrieves whether this database supports subqueries in comparison expressions. - * - * @param supportsSubqueriesInComparisons true if so; false otherwise - */ - public void setSupportsSubqueriesInComparisons( Boolean supportsSubqueriesInComparisons ) { - this.supportsSubqueriesInComparisons = supportsSubqueriesInComparisons; - } - - /** - * Retrieves whether this database supports subqueries in EXISTS expressions. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsSubqueriesInExists() { - return supportsSubqueriesInExists; - } - - /** - * Sets whether this database supports subqueries in EXISTS expressions. - * - * @param supportsSubqueriesInExists true if so; false otherwise - */ - public void setSupportsSubqueriesInExists( Boolean supportsSubqueriesInExists ) { - this.supportsSubqueriesInExists = supportsSubqueriesInExists; - } - - /** - * Retrieves whether this database supports subqueries in IN statements. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsSubqueriesInIns() { - return supportsSubqueriesInIns; - } - - /** - * Sets whether this database supports subqueries in IN statements. - * - * @param supportsSubqueriesInIns true if so; false otherwise - */ - public void setSupportsSubqueriesInIns( Boolean supportsSubqueriesInIns ) { - this.supportsSubqueriesInIns = supportsSubqueriesInIns; - } - - /** - * Retrieves whether this database supports subqueries in quantified expressions. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsSubqueriesInQuantifieds() { - return supportsSubqueriesInQuantifieds; - } - - /** - * Sets whether this database supports subqueries in quantified expressions. - * - * @param supportsSubqueriesInQuantifieds true if so; false otherwise - */ - public void setSupportsSubqueriesInQuantifieds( Boolean supportsSubqueriesInQuantifieds ) { - this.supportsSubqueriesInQuantifieds = supportsSubqueriesInQuantifieds; - } - - /** - * Retrieves whether this database supports correlated subqueries. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsCorrelatedSubqueries() { - return supportsCorrelatedSubqueries; - } - - /** - * Sets whether this database supports correlated subqueries. - * - * @param supportsCorrelatedSubqueries true if so; false otherwise - */ - public void setSupportsCorrelatedSubqueries( Boolean supportsCorrelatedSubqueries ) { - this.supportsCorrelatedSubqueries = supportsCorrelatedSubqueries; - } - - /** - * Retrieves whether this database supports SQL UNION. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsUnion() { - return supportsUnion; - } - - /** - * Sets whether this database supports SQL UNION. - * - * @param supportsUnion true if so; false otherwise - */ - public void setSupportsUnion( Boolean supportsUnion ) { - this.supportsUnion = supportsUnion; - } - - /** - * Retrieves whether this database supports SQL UNION ALL. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsUnionAll() { - return supportsUnionAll; - } - - /** - * Sets whether this database supports SQL UNION ALL. - * - * @param supportsUnionAll true if so; false otherwise - */ - public void setSupportsUnionAll( Boolean supportsUnionAll ) { - this.supportsUnionAll = supportsUnionAll; - } - - /** - * Retrieves whether this database supports keeping cursors open across commits. - * - * @return true if cursors always remain open; false if they might not remain open - */ - public Boolean isSupportsOpenCursorsAcrossCommit() { - return supportsOpenCursorsAcrossCommit; - } - - /** - * Sets whether this database supports keeping cursors open across commits. - * - * @param supportsOpenCursorsAcrossCommit true if cursors always remain open; false if they might - * not remain open - */ - public void setSupportsOpenCursorsAcrossCommit( Boolean supportsOpenCursorsAcrossCommit ) { - this.supportsOpenCursorsAcrossCommit = supportsOpenCursorsAcrossCommit; - } - - /** - * Retrieves whether this database supports keeping cursors open across rollbacks. - * - * @return true if cursors always remain open; false if they might not remain open - */ - public Boolean isSupportsOpenCursorsAcrossRollback() { - return supportsOpenCursorsAcrossRollback; - } - - /** - * Sets whether this database supports keeping cursors open across rollbacks. - * - * @param supportsOpenCursorsAcrossRollback true if cursors always remain open; false if they might - * not remain open - */ - public void setSupportsOpenCursorsAcrossRollback( Boolean supportsOpenCursorsAcrossRollback ) { - this.supportsOpenCursorsAcrossRollback = supportsOpenCursorsAcrossRollback; - } - - /** - * Retrieves whether this database supports keeping statements open across commits. - * - * @return true if statements always remain open; false if they might not remain open - */ - public Boolean isSupportsOpenStatementsAcrossCommit() { - return supportsOpenStatementsAcrossCommit; - } - - /** - * sets whether this database supports keeping statements open across commits. - * - * @param supportsOpenStatementsAcrossCommit true if statements always remain open; false if they - * might not remain open - */ - public void setSupportsOpenStatementsAcrossCommit( Boolean supportsOpenStatementsAcrossCommit ) { - this.supportsOpenStatementsAcrossCommit = supportsOpenStatementsAcrossCommit; - } - - /** - * Retrieves whether this database supports keeping statements open across rollbacks. - * - * @return true if statements always remain open; false if they might not remain open - */ - public Boolean isSupportsOpenStatementsAcrossRollback() { - return supportsOpenStatementsAcrossRollback; - } - - /** - * Sets whether this database supports keeping statements open across rollbacks. - * - * @param supportsOpenStatementsAcrossRollback true if statements always remain open; false if they - * might not remain open - */ - public void setSupportsOpenStatementsAcrossRollback( Boolean supportsOpenStatementsAcrossRollback ) { - this.supportsOpenStatementsAcrossRollback = supportsOpenStatementsAcrossRollback; - } - - // ---------------------------------------------------------------------- - // The following group of methods exposes various limitations based on the target - // database with the current driver. Unless otherwise specified, a result of zero - // means there is no limit, or the limit is not known. - // ---------------------------------------------------------------------- - - /** - * Retrieves the maximum number of hex characters this database allows in an inline binary literal. - * - * @return max the maximum length (in hex characters) for a binary literal; a result of zero means that there is no limit or - * the limit is not known - */ - public Integer getMaxBinaryLiteralLength() { - return maxBinaryLiteralLength; - } - - /** - * sets the maximum number of hex characters this database allows in an inline binary literal. - * - * @param maxBinaryLiteralLength max the maximum length (in hex characters) for a binary literal; a result of zero means that - * there is no limit or the limit is not known - */ - public void setMaxBinaryLiteralLength( Integer maxBinaryLiteralLength ) { - this.maxBinaryLiteralLength = maxBinaryLiteralLength; - } - - /** - * Retrieves the maximum number of characters this database allows for a character literal. - * - * @return the maximum number of characters allowed for a character literal; a result of zero means that there is no limit or - * the limit is not known - */ - public Integer getMaxCharLiteralLength() { - return maxCharLiteralLength; - } - - /** - * Sets the maximum number of characters this database allows for a character literal. - * - * @param maxCharLiteralLength the maximum number of characters allowed for a character literal; a result of zero means that - * there is no limit or the limit is not known - */ - public void setMaxCharLiteralLength( Integer maxCharLiteralLength ) { - this.maxCharLiteralLength = maxCharLiteralLength; - } - - /** - * Retrieves the maximum number of characters this database allows for a column name. - * - * @return the maximum number of characters allowed for a column name; a result of zero means that there is no limit or the - * limit is not known - */ - public Integer getMaxColumnNameLength() { - return maxColumnNameLength; - } - - /** - * Sets the maximum number of characters this database allows for a column name. - * - * @param maxColumnNameLength the maximum number of characters allowed for a column name; a result of zero means that there is - * no limit or the limit is not known - */ - public void setMaxColumnNameLength( Integer maxColumnNameLength ) { - this.maxColumnNameLength = maxColumnNameLength; - } - - /** - * Retrieves the maximum number of columns this database allows in a GROUP BY clause. - * - * @return the maximum number of columns allowed; a result of zero means that there is no limit or the limit is not known - */ - public Integer getMaxColumnsInGroupBy() { - return maxColumnsInGroupBy; - } - - /** - * Sets the maximum number of columns this database allows in a GROUP BY clause. - * - * @param maxColumnsInGroupBy the maximum number of columns allowed; a result of zero means that there is no limit or the - * limit is not known - */ - public void setMaxColumnsInGroupBy( Integer maxColumnsInGroupBy ) { - this.maxColumnsInGroupBy = maxColumnsInGroupBy; - } - - /** - * Retrieves the maximum number of columns this database allows in an index. - * - * @return the maximum number of columns allowed; a result of zero means that there is no limit or the limit is not known - */ - public Integer getMaxColumnsInIndex() { - return maxColumnsInIndex; - } - - /** - * Sets the maximum number of columns this database allows in an index. - * - * @param maxColumnsInIndex the maximum number of columns allowed; a result of zero means that there is no limit or the limit - * is not known - */ - public void setMaxColumnsInIndex( Integer maxColumnsInIndex ) { - this.maxColumnsInIndex = maxColumnsInIndex; - } - - /** - * Retrieves the maximum number of columns this database allows in an ORDER BY clause. - * - * @return the maximum number of columns allowed; a result of zero means that there is no limit or the limit is not known - */ - public Integer getMaxColumnsInOrderBy() { - return maxColumnsInOrderBy; - } - - /** - * Sets the maximum number of columns this database allows in an ORDER BY clause. - * - * @param maxColumnsInOrderBy the maximum number of columns allowed; a result of zero means that there is no limit or the - * limit is not known - */ - public void setMaxColumnsInOrderBy( Integer maxColumnsInOrderBy ) { - this.maxColumnsInOrderBy = maxColumnsInOrderBy; - } - - /** - * Retrieves the maximum number of columns this database allows in a SELECT list. - * - * @return the maximum number of columns allowed; a result of zero means that there is no limit or the limit is not known - */ - public Integer getMaxColumnsInSelect() { - return maxColumnsInSelect; - } - - /** - * Sets the maximum number of columns this database allows in a SELECT list. - * - * @param maxColumnsInSelect the maximum number of columns allowed; a result of zero means that there is no limit or the limit - * is not known - */ - public void setMaxColumnsInSelect( Integer maxColumnsInSelect ) { - this.maxColumnsInSelect = maxColumnsInSelect; - } - - /** - * Retrieves the maximum number of columns this database allows in a table. - * - * @return the maximum number of columns allowed; a result of zero means that there is no limit or the limit is not known - */ - public Integer getMaxColumnsInTable() { - return maxColumnsInTable; - } - - /** - * Sets the maximum number of columns this database allows in a table. - * - * @param maxColumnsInTable the maximum number of columns allowed; a result of zero means that there is no limit or the limit - * is not known - */ - public void setMaxColumnsInTable( Integer maxColumnsInTable ) { - this.maxColumnsInTable = maxColumnsInTable; - } - - /** - * Retrieves the maximum number of concurrent connections to this database that are possible. - * - * @return the maximum number of active connections possible at one time; a result of zero means that there is no limit or the - * limit is not known - */ - public Integer getMaxConnections() { - return maxConnections; - } - - /** - * Sets the maximum number of concurrent connections to this database that are possible. - * - * @param maxConnections the maximum number of active connections possible at one time; a result of zero means that there is - * no limit or the limit is not known - */ - public void setMaxConnections( Integer maxConnections ) { - this.maxConnections = maxConnections; - } - - /** - * Retrieves the maximum number of characters that this database allows in a cursor name. - * - * @return the maximum number of characters allowed in a cursor name; a result of zero means that there is no limit or the - * limit is not known - */ - public Integer getMaxCursorNameLength() { - return maxCursorNameLength; - } - - /** - * Sets the maximum number of characters that this database allows in a cursor name. - * - * @param maxCursorNameLength the maximum number of characters allowed in a cursor name; a result of zero means that there is - * no limit or the limit is not known - */ - public void setMaxCursorNameLength( Integer maxCursorNameLength ) { - this.maxCursorNameLength = maxCursorNameLength; - } - - /** - * Retrieves the maximum number of bytes this database allows for an index, including all of the parts of the index. - * - * @return the maximum number of bytes allowed; this limit includes the composite of all the constituent parts of the index; a - * result of zero means that there is no limit or the limit is not known - */ - public Integer getMaxIndexLength() { - return maxIndexLength; - } - - /** - * Sets the maximum number of bytes this database allows for an index, including all of the parts of the index. - * - * @param maxIndexLength the maximum number of bytes allowed; this limit includes the composite of all the constituent parts - * of the index; a result of zero means that there is no limit or the limit is not known - */ - public void setMaxIndexLength( Integer maxIndexLength ) { - this.maxIndexLength = maxIndexLength; - } - - /** - * Retrieves the maximum number of characters that this database allows in a schema name. - * - * @return the maximum number of characters allowed in a schema name; a result of zero means that there is no limit or the - * limit is not known - */ - public Integer getMaxSchemaNameLength() { - return maxSchemaNameLength; - } - - /** - * Sets the maximum number of characters that this database allows in a schema name. - * - * @param maxSchemaNameLength the maximum number of characters allowed in a schema name; a result of zero means that there is - * no limit or the limit is not known - */ - public void setMaxSchemaNameLength( Integer maxSchemaNameLength ) { - this.maxSchemaNameLength = maxSchemaNameLength; - } - - /** - * Retrieves the maximum number of characters that this database allows in a procedure name. - * - * @return the maximum number of characters allowed in a procedure name; a result of zero means that there is no limit or the - * limit is not known - */ - public Integer getMaxProcedureNameLength() { - return maxProcedureNameLength; - } - - /** - * Sets the maximum number of characters that this database allows in a procedure name. - * - * @param maxProcedureNameLength the maximum number of characters allowed in a procedure name; a result of zero means that - * there is no limit or the limit is not known - */ - public void setMaxProcedureNameLength( Integer maxProcedureNameLength ) { - this.maxProcedureNameLength = maxProcedureNameLength; - } - - /** - * Retrieves the maximum number of characters that this database allows in a catalog name. - * - * @return the maximum number of characters allowed in a catalog name; a result of zero means that there is no limit or the - * limit is not known - */ - public Integer getMaxCatalogNameLength() { - return maxCatalogNameLength; - } - - /** - * Sets the maximum number of characters that this database allows in a catalog name. - * - * @param maxCatalogNameLength the maximum number of characters allowed in a catalog name; a result of zero means that there - * is no limit or the limit is not known - */ - public void setMaxCatalogNameLength( Integer maxCatalogNameLength ) { - this.maxCatalogNameLength = maxCatalogNameLength; - } - - /** - * Retrieves the maximum number of bytes this database allows in a single row. - * - * @return the maximum number of bytes allowed for a row; a result of zero means that there is no limit or the limit is not - * known - */ - public Integer getMaxRowSize() { - return maxRowSize; - } - - /** - * Sets the maximum number of bytes this database allows in a single row. - * - * @param maxRowSize the maximum number of bytes allowed for a row; a result of zero means that there is no limit or the limit - * is not known - */ - public void setMaxRowSize( Integer maxRowSize ) { - this.maxRowSize = maxRowSize; - } - - /** - * Retrieves whether the return value for the method getMaxRowSize includes the SQL data types - * LONGVARCHAR and LONGVARBINARY. - * - * @return true if so; false otherwise - */ - public Boolean isMaxRowSizeIncludeBlobs() { - return maxRowSizeIncludeBlobs; - } - - /** - * Sets whether the return value for the method getMaxRowSize includes the SQL data types - * LONGVARCHAR and LONGVARBINARY. - * - * @param maxRowSizeIncludeBlobs true if so; false otherwise - */ - public void setMaxRowSizeIncludeBlobs( Boolean maxRowSizeIncludeBlobs ) { - this.maxRowSizeIncludeBlobs = maxRowSizeIncludeBlobs; - } - - /** - * Retrieves the maximum number of characters this database allows in an SQL statement. - * - * @return the maximum number of characters allowed for an SQL statement; a result of zero means that there is no limit or the - * limit is not known - */ - public Integer getMaxStatementLength() { - return maxStatementLength; - } - - /** - * Sets the maximum number of characters this database allows in an SQL statement. - * - * @param maxStatementLength the maximum number of characters allowed for an SQL statement; a result of zero means that there - * is no limit or the limit is not known - */ - public void setMaxStatementLength( Integer maxStatementLength ) { - this.maxStatementLength = maxStatementLength; - } - - /** - * Retrieves the maximum number of active statements to this database that can be open at the same time. - * - * @return the maximum number of statements that can be open at one time; a result of zero means that there is no limit or the - * limit is not known - */ - public Integer getMaxStatements() { - return maxStatements; - } - - /** - * Sets the maximum number of active statements to this database that can be open at the same time. - * - * @param maxStatements the maximum number of statements that can be open at one time; a result of zero means that there is no - * limit or the limit is not known - */ - public void setMaxStatements( Integer maxStatements ) { - this.maxStatements = maxStatements; - } - - /** - * Retrieves the maximum number of characters this database allows in a table name. - * - * @return the maximum number of characters allowed for a table name; a result of zero means that there is no limit or the - * limit is not known - */ - public Integer getMaxTableNameLength() { - return maxTableNameLength; - } - - /** - * Sets the maximum number of characters this database allows in a table name. - * - * @param maxTableNameLength the maximum number of characters allowed for a table name; a result of zero means that there is - * no limit or the limit is not known - */ - public void setMaxTableNameLength( Integer maxTableNameLength ) { - this.maxTableNameLength = maxTableNameLength; - } - - /** - * Retrieves the maximum number of tables this database allows in a SELECT statement. - * - * @return the maximum number of tables allowed in a SELECT statement; a result of zero means that there is no - * limit or the limit is not known - */ - public Integer getMaxTablesInSelect() { - return maxTablesInSelect; - } - - /** - * Sets the maximum number of tables this database allows in a SELECT statement. - * - * @param maxTablesInSelect the maximum number of tables allowed in a SELECT statement; a result of zero means - * that there is no limit or the limit is not known - */ - public void setMaxTablesInSelect( Integer maxTablesInSelect ) { - this.maxTablesInSelect = maxTablesInSelect; - } - - /** - * Retrieves the maximum number of characters this database allows in a user name. - * - * @return the maximum number of characters allowed for a user name; a result of zero means that there is no limit or the - * limit is not known - */ - public Integer getMaxUserNameLength() { - return maxUserNameLength; - } - - /** - * Sets the maximum number of characters this database allows in a user name. - * - * @param maxUserNameLength the maximum number of characters allowed for a user name; a result of zero means that there is no - * limit or the limit is not known - */ - public void setMaxUserNameLength( Integer maxUserNameLength ) { - this.maxUserNameLength = maxUserNameLength; - } - - /** - * Retrieves this database's default transaction isolation level. The possible values are defined in - * java.sql.Connection. - * - * @return the default isolation level - * @see java.sql.Connection - */ - public Integer getDefaultTransactionIsolation() { - return defaultTransactionIsolation; - } - - /** - * Sets this database's default transaction isolation level. The possible values are defined in - * java.sql.Connection. - * - * @param defaultTransactionIsolation the default isolation level - * @see java.sql.Connection - */ - public void setDefaultTransactionIsolation( Integer defaultTransactionIsolation ) { - this.defaultTransactionIsolation = defaultTransactionIsolation; - } - - /** - * Retrieves whether this database supports transactions. If not, invoking the method commit is a noop, and the - * isolation level is TRANSACTION_NONE. - * - * @return true if transactions are supported; false otherwise - */ - public Boolean isSupportsTransactions() { - return supportsTransactions; - } - - /** - * Sets whether this database supports transactions. If not, invoking the method commit is a noop, and the - * isolation level is TRANSACTION_NONE. - * - * @param supportsTransactions true if transactions are supported; false otherwise - */ - public void setSupportsTransactions( Boolean supportsTransactions ) { - this.supportsTransactions = supportsTransactions; - } - - /** - * Retrieves list of database supported transaction isolation levels. - * - * @return list of database supported transaction isolation levels. - * @see java.sql.Connection - */ - public Set getSupportedTransactionIsolationLevels() { - return supportedTransactionIsolationLevels; - } - - /** - * Adds TransactionIsolationLevelType - * - * @param transactionIsolationLevelType the Transaction Isolation Level Type - */ - public void addSupportedTransactionIsolationLevelType( TransactionIsolationLevelType transactionIsolationLevelType ) { - supportedTransactionIsolationLevels.add(transactionIsolationLevelType); - } - - /** - * Deletes TransactionIsolationLevelType - * - * @param transactionIsolationLevelType the Transaction Isolation Level Type - */ - public void deleteSupportedTransactionIsolationLevelType( TransactionIsolationLevelType transactionIsolationLevelType ) { - supportedTransactionIsolationLevels.remove(transactionIsolationLevelType); - } - - /** - * Is supported TransactionIsolationLevelType - * - * @param transactionIsolationLevelType the Transaction Isolation Level Type - * @return true if supported - */ - public Boolean isSupportedTransactionIsolationLevelType( TransactionIsolationLevelType transactionIsolationLevelType ) { - for (TransactionIsolationLevelType t : supportedTransactionIsolationLevels) { - if (t.equals(transactionIsolationLevelType)) { - return Boolean.TRUE; - } - } - // return false - return Boolean.FALSE; - } - - /** - * Retrieves whether this database supports both data definition and data manipulation statements within a transaction. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsDataDefinitionAndDataManipulationTransactions() { - return supportsDataDefinitionAndDataManipulationTransactions; - } - - /** - * Sets whether this database supports both data definition and data manipulation statements within a transaction. - * - * @param supportsDataDefinitionAndDataManipulationTransactions true if so; false otherwise - */ - public void setSupportsDataDefinitionAndDataManipulationTransactions( Boolean supportsDataDefinitionAndDataManipulationTransactions ) { - this.supportsDataDefinitionAndDataManipulationTransactions = supportsDataDefinitionAndDataManipulationTransactions; - } - - /** - * Retrieves whether this database supports only data manipulation statements within a transaction. - * - * @return true if so; false otherwise - */ - public Boolean isSupportsDataManipulationTransactionsOnly() { - return supportsDataManipulationTransactionsOnly; - } - - /** - * Sets whether this database supports only data manipulation statements within a transaction. - * - * @param supportsDataManipulationTransactionsOnly true if so; false otherwise - */ - public void setSupportsDataManipulationTransactionsOnly( Boolean supportsDataManipulationTransactionsOnly ) { - this.supportsDataManipulationTransactionsOnly = supportsDataManipulationTransactionsOnly; - } - - /** - * Retrieves whether a data definition statement within a transaction forces the transaction to commit. - * - * @return true if so; false otherwise - */ - public Boolean isDataDefinitionCausesTransactionCommit() { - return dataDefinitionCausesTransactionCommit; - } - - /** - * Sets whether a data definition statement within a transaction forces the transaction to commit. - * - * @param dataDefinitionCausesTransactionCommit true if so; false otherwise - */ - public void setDataDefinitionCausesTransactionCommit( Boolean dataDefinitionCausesTransactionCommit ) { - this.dataDefinitionCausesTransactionCommit = dataDefinitionCausesTransactionCommit; - } - - /** - * Retrieves whether this database ignores a data definition statement within a transaction. - * - * @return true if so; false otherwise - */ - public Boolean isDataDefinitionIgnoredInTransactions() { - return dataDefinitionIgnoredInTransactions; - } - - /** - * Sets whether this database ignores a data definition statement within a transaction. - * - * @param dataDefinitionIgnoredInTransactions true if so; false otherwise - */ - public void setDataDefinitionIgnoredInTransactions( Boolean dataDefinitionIgnoredInTransactions ) { - this.dataDefinitionIgnoredInTransactions = dataDefinitionIgnoredInTransactions; - } - - /** - * Retrieves a description of the stored procedures available in the given catalog. - * - * @return a set of stored procedures available - */ - public Set getStoredProcedures() { - return storedProcedures; - } - - /** - * Adds Stored Procedure - * - * @param storedProcedure the Stored Procedure - */ - public void addStoredProcedure( StoredProcedure storedProcedure ) { - storedProcedures.add(storedProcedure); - } - - /** - * Deletes Stored Procedure - * - * @param storedProcedure the Stored Procedure - */ - public void deleteStoredProcedure( StoredProcedure storedProcedure ) { - storedProcedures.remove(storedProcedure); - } - - /** - * Finds stored procedute by its name. - * - * @param catalog a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a - * catalog; null means that the catalog name should not be used to narrow the search - * @param schema a schema name; must match the schema name as it is stored in the database; "" retrieves those without a - * schema; null means that the schema name should not be used to narrow the search - * @param procedureName a procedure name; must match the procedure name as it is stored in the database - * @return stored procedure or null if not found - */ - public StoredProcedure findStoredProcedureByName( String catalog, - String schema, - String procedureName ) { - for (StoredProcedure sp : storedProcedures) { - // if name equals then trying to match catalog and schema - if (sp.getName().equals(procedureName)) { - boolean catalogNameEquals = (sp.getCatalog() != null) ? sp.getCatalog().getName().equals(catalog) : catalog == null; - boolean schemaNameEquals = (sp.getSchema() != null) ? sp.getSchema().getName().equals(schema) : schema == null; - if (catalogNameEquals && schemaNameEquals) { - return sp; - } - } - } - // return nothing - return null; - } - - /** - * Retrieves a description of the tables available in the given catalog. - * - * @return a set of tables available - */ - public Set

getTables() { - return tables; - } - - /** - * Adds Table - * - * @param table the table to add - */ - public void addTable( Table table ) { - tables.add(table); - } - - /** - * Deletes Table - * - * @param table the table to delete - */ - public void deleteTable( Table table ) { - tables.remove(table); - } - - /** - * Finds table by its name. - * - * @param catalog a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a - * catalog; null means that the catalog name should not be used to narrow the search - * @param schema a schema name; must match the schema name as it is stored in the database; "" retrieves those without a - * schema; null means that the schema name should not be used to narrow the search - * @param tableName a table name; must match the table name as it is stored in the database - * @return table or null if not found - */ - public Table findTableByName( String catalog, - String schema, - String tableName ) { - for (Table t : tables) { - // if name equals then trying to match catalog and schema - if (t.getName().equals(tableName)) { - boolean catalogNameEquals = (t.getCatalog() != null) ? t.getCatalog().getName().equals(catalog) : catalog == null; - boolean schemaNameEquals = (t.getSchema() != null) ? t.getSchema().getName().equals(schema) : schema == null; - if (catalogNameEquals && schemaNameEquals) { - return t; - } - } - } - // return nothing - return null; - } - - /** - * Retrieves the schemas available in this database. The results are ordered by schema name. - * - * @return schemas available in this database. - */ - public Set getSchemas() { - return schemas; - } - - /** - * Adds Schema - * - * @param schema the Schema - */ - public void addSchema( Schema schema ) { - schemas.add(schema); - } - - /** - * Deletes Schema - * - * @param schema the Schema - */ - public void deleteSchema( Schema schema ) { - schemas.remove(schema); - } - - /** - * Finds schema by its name. - * - * @param catalog a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a - * catalog; null means that the catalog name should not be used to narrow the search - * @param schemaName a schema name; must match the schema name as it is stored in the database; - * @return schema or null if not found - */ - public Schema findSchemaByName( String catalog, - String schemaName ) { - for (Schema s : schemas) { - // if name equals then trying to match catalog and schema - if (s.getName().equals(schemaName)) { - boolean catalogNameEquals = (s.getCatalog() != null) ? s.getCatalog().getName().equals(catalog) : catalog == null; - if (catalogNameEquals) { - return s; - } - } - } - // return nothing - return null; - } - - /** - * Retrieves the catalogs available in this database - * - * @return catalogs available in this database - */ - public Set getCatalogs() { - return catalogs; - } - - /** - * Adds Catalog - * - * @param catalog the catalog to add - */ - public void addCatalog( Catalog catalog ) { - catalogs.add(catalog); - } - - /** - * Deletes Catalog - * - * @param catalog the catalog to delete - */ - public void deleteCatalog( Catalog catalog ) { - catalogs.remove(catalog); - } - - /** - * Finds catalog by its name. - * - * @param catalogName a catalog name; must match the catalog name as it is stored in the database; - * @return catalog or null if not found - */ - public Catalog findCatalogByName( String catalogName ) { - for (Catalog c : catalogs) { - // if name equals then return - if (c.getName().equals(catalogName)) { - return c; - } - } - // return nothing - return null; - } - - /** - * Retrieves the table types available in this database. The results are ordered by table type. - *

- * The table type is: - *

    - *
  1. TABLE_TYPE String => table type. Typical types are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", - * "LOCAL TEMPORARY", "ALIAS", "SYNONYM". - *
- * - * @return table types available in this database - */ - public Set getTableTypes() { - return tableTypes; - } - - /** - * Adds TableType - * - * @param tableType the table type to add - */ - public void addTableType( TableType tableType ) { - tableTypes.add(tableType); - } - - /** - * Deletes TableType - * - * @param tableType the table type to delete - */ - public void deleteTableType( TableType tableType ) { - tableTypes.remove(tableType); - } - - /** - * Finds table type by its name. - * - * @param typeName a table type name; must match the type name as it is stored in the database; - * @return table type or null if not found - */ - public TableType findTableTypeByTypeName( String typeName ) { - for (TableType tt : tableTypes) { - // if name equals then return - if (tt.getName().equals(typeName)) { - return tt; - } - } - // return nothing - return null; - } - - /** - * Retrieves a description of all the standard SQL types supported by this database - * - * @return all the standard SQL types supported by this database - */ - public Set getSqlTypeInfos() { - return sqlTypeInfos; - } - - /** - * Adds SqlTypeInfo - * - * @param sqlTypeInfo the SQL type to add - */ - public void addSqlTypeInfo( SqlTypeInfo sqlTypeInfo ) { - sqlTypeInfos.add(sqlTypeInfo); - } - - /** - * Deletes SqlTypeInfo - * - * @param sqlTypeInfo the SQL type to delete - */ - public void deleteSqlTypeInfo( SqlTypeInfo sqlTypeInfo ) { - sqlTypeInfos.remove(sqlTypeInfo); - } - - /** - * Finds SQL type by its name. - * - * @param typeName a table type name; must match the type name as it is stored in the database; - * @return table type or null if not found - */ - public SqlTypeInfo findSqlTypeInfoByTypeName( String typeName ) { - for (SqlTypeInfo sti : sqlTypeInfos) { - // if name equals then return - if (sti.getName().equals(typeName)) { - return sti; - } - } - // return nothing - return null; - } - - // =============================================================== - // --------------------------JDBC 2.0----------------------------- - // =============================================================== - - /** - * Retrieves database supported result set types. - * - * @return database supported result set types. - * @see java.sql.Connection - * @since 1.2 (JDBC 2.0) - */ - public Set getSupportedResultSetTypes() { - return supportedResultSetTypes; - } - - /** - * Adds supported ResultSetType - * - * @param resultSetType the ResultSetType - */ - public void addSupportedResultSetType( ResultSetType resultSetType ) { - supportedResultSetTypes.add(resultSetType); - } - - /** - * Deletes supported ResultSetType - * - * @param resultSetType the ResultSetType - */ - public void deleteSupportedResultSetType( ResultSetType resultSetType ) { - supportedResultSetTypes.remove(resultSetType); - } - - /** - * Retrieves database supported concurrencies for the given result set type. - * - * @return database supported concurrencies for the given result set type. - * @see java.sql.Connection - * @since 1.2 (JDBC 2.0) - */ - public Set getSupportedForwardOnlyResultSetConcurrencies() { - return supportedForwardOnlyResultSetConcurrencies; - } - - /** - * Adds ResultSetConcurrencyType - * - * @param resultSetConcurrencyType the ResultSetConcurrencyType - */ - public void addSupportedForwardOnlyResultSetConcurrency( ResultSetConcurrencyType resultSetConcurrencyType ) { - supportedForwardOnlyResultSetConcurrencies.add(resultSetConcurrencyType); - } - - /** - * Deletes ResultSetConcurrencyType - * - * @param resultSetConcurrencyType the ResultSetConcurrencyType - */ - public void deleteSupportedForwardOnlyResultSetConcurrency( ResultSetConcurrencyType resultSetConcurrencyType ) { - supportedForwardOnlyResultSetConcurrencies.remove(resultSetConcurrencyType); - } - - /** - * Retrieves database supported concurrencies for the given result set type. - * - * @return database supported concurrencies for the given result set type. - * @see java.sql.Connection - * @since 1.2 (JDBC 2.0) - */ - public Set getSupportedScrollInsensitiveResultSetConcurrencies() { - return supportedScrollInsensitiveResultSetConcurrencies; - } - - /** - * Adds ResultSetConcurrencyType - * - * @param resultSetConcurrencyType the ResultSetConcurrencyType - */ - public void addSupportedScrollInsensitiveResultSetConcurrency( ResultSetConcurrencyType resultSetConcurrencyType ) { - supportedScrollInsensitiveResultSetConcurrencies.add(resultSetConcurrencyType); - } - - /** - * Delete ResultSetConcurrencyType - * - * @param resultSetConcurrencyType the ResultSetConcurrencyType - */ - public void deleteSupportedScrollInsensitiveResultSetConcurrency( ResultSetConcurrencyType resultSetConcurrencyType ) { - supportedScrollInsensitiveResultSetConcurrencies.remove(resultSetConcurrencyType); - } - - /** - * Retrieves database supported concurrencies for the given result set type. - * - * @return database supported concurrencies for the given result set type. - * @see java.sql.Connection - * @since 1.2 (JDBC 2.0) - */ - public Set getSupportedScrollSensitiveResultSetConcurrencies() { - return supportedScrollSensitiveResultSetConcurrencies; - } - - /** - * Adds resultSetConcurrencyType - * - * @param resultSetConcurrencyType the ResultSetConcurrencyType - */ - public void addSupportedScrollSensitiveResultSetConcurrency( ResultSetConcurrencyType resultSetConcurrencyType ) { - supportedScrollSensitiveResultSetConcurrencies.add(resultSetConcurrencyType); - } - - /** - * deletes resultSetConcurrencyType - * - * @param resultSetConcurrencyType the ResultSetConcurrencyType - */ - public void deleteSupportedScrollSensitiveResultSetConcurrency( ResultSetConcurrencyType resultSetConcurrencyType ) { - supportedScrollSensitiveResultSetConcurrencies.remove(resultSetConcurrencyType); - } - - /** - * Retrieves whether for the given type of ResultSet object, the result set's own updates are visible. - * - * @return true if updates are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public Boolean isForwardOnlyResultSetOwnUpdatesAreVisible() { - return forwardOnlyResultSetOwnUpdatesAreVisible; - } - - /** - * Sets whether for the given type of ResultSet object, the result set's own updates are visible. - * - * @param forwardOnlyResultSetOwnUpdatesAreVisible true if updates are visible for the given result set type; - * false otherwise - * @since 1.2 (JDBC 2.0) - */ - public void setForwardOnlyResultSetOwnUpdatesAreVisible( Boolean forwardOnlyResultSetOwnUpdatesAreVisible ) { - this.forwardOnlyResultSetOwnUpdatesAreVisible = forwardOnlyResultSetOwnUpdatesAreVisible; - } - - /** - * Retrieves whether for the given type of ResultSet object, the result set's own updates are visible. - * - * @return true if updates are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public Boolean isScrollInsensitiveResultSetOwnUpdatesAreVisible() { - return scrollInsensitiveResultSetOwnUpdatesAreVisible; - } - - /** - * Sets whether for the given type of ResultSet object, the result set's own updates are visible. - * - * @param scrollInsensitiveResultSetOwnUpdatesAreVisible true if updates are visible for the given result set - * type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public void setScrollInsensitiveResultSetOwnUpdatesAreVisible( Boolean scrollInsensitiveResultSetOwnUpdatesAreVisible ) { - this.scrollInsensitiveResultSetOwnUpdatesAreVisible = scrollInsensitiveResultSetOwnUpdatesAreVisible; - } - - /** - * Retrieves whether for the given type of ResultSet object, the result set's own updates are visible. - * - * @return true if updates are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public Boolean isScrollSensitiveResultSetOwnUpdatesAreVisible() { - return scrollSensitiveResultSetOwnUpdatesAreVisible; - } - - /** - * Sets whether for the given type of ResultSet object, the result set's own updates are visible. - * - * @param scrollSensitiveResultSetOwnUpdatesAreVisible true if updates are visible for the given result set type; - * false otherwise - * @since 1.2 (JDBC 2.0) - */ - public void setScrollSensitiveResultSetOwnUpdatesAreVisible( Boolean scrollSensitiveResultSetOwnUpdatesAreVisible ) { - this.scrollSensitiveResultSetOwnUpdatesAreVisible = scrollSensitiveResultSetOwnUpdatesAreVisible; - } - - /** - * Retrieves whether a result set's own deletes are visible. - * - * @return true if deletes are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public Boolean isForwardOnlyResultSetOwnDeletesAreVisible() { - return forwardOnlyResultSetOwnDeletesAreVisible; - } - - /** - * Sets whether a result set's own deletes are visible. - * - * @param forwardOnlyResultSetOwnDeletesAreVisible true if deletes are visible for the given result set type; - * false otherwise - * @since 1.2 (JDBC 2.0) - */ - public void setForwardOnlyResultSetOwnDeletesAreVisible( Boolean forwardOnlyResultSetOwnDeletesAreVisible ) { - this.forwardOnlyResultSetOwnDeletesAreVisible = forwardOnlyResultSetOwnDeletesAreVisible; - } - - /** - * Retrieves whether a result set's own deletes are visible. - * - * @return true if deletes are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public Boolean isScrollInsensitiveResultSetOwnDeletesAreVisible() { - return scrollInsensitiveResultSetOwnDeletesAreVisible; - } - - /** - * Sets whether a result set's own deletes are visible. - * - * @param scrollInsensitiveResultSetOwnDeletesAreVisible true if deletes are visible for the given result set - * type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public void setScrollInsensitiveResultSetOwnDeletesAreVisible( Boolean scrollInsensitiveResultSetOwnDeletesAreVisible ) { - this.scrollInsensitiveResultSetOwnDeletesAreVisible = scrollInsensitiveResultSetOwnDeletesAreVisible; - } - - /** - * Retrieves whether a result set's own deletes are visible. - * - * @return true if deletes are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public Boolean isScrollSensitiveResultSetOwnDeletesAreVisible() { - return scrollSensitiveResultSetOwnDeletesAreVisible; - } - - /** - * Sets whether a result set's own deletes are visible. - * - * @param scrollSensitiveResultSetOwnDeletesAreVisible true if deletes are visible for the given result set type; - * false otherwise - * @since 1.2 (JDBC 2.0) - */ - public void setScrollSensitiveResultSetOwnDeletesAreVisible( Boolean scrollSensitiveResultSetOwnDeletesAreVisible ) { - this.scrollSensitiveResultSetOwnDeletesAreVisible = scrollSensitiveResultSetOwnDeletesAreVisible; - } - - /** - * Retrieves whether a result set's own inserts are visible. - * - * @return true if inserts are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public Boolean isForwardOnlyResultSetOwnInsertsAreVisible() { - return forwardOnlyResultSetOwnInsertsAreVisible; - } - - /** - * Sets whether a result set's own inserts are visible. - * - * @param forwardOnlyResultSetOwnInsertsAreVisible true if inserts are visible for the given result set type; - * false otherwise - * @since 1.2 (JDBC 2.0) - */ - public void setForwardOnlyResultSetOwnInsertsAreVisible( Boolean forwardOnlyResultSetOwnInsertsAreVisible ) { - this.forwardOnlyResultSetOwnInsertsAreVisible = forwardOnlyResultSetOwnInsertsAreVisible; - } - - /** - * Retrieves whether a result set's own inserts are visible. - * - * @return true if inserts are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public Boolean isScrollInsensitiveResultSetOwnInsertsAreVisible() { - return scrollInsensitiveResultSetOwnInsertsAreVisible; - } - - /** - * Sets whether a result set's own inserts are visible. - * - * @param scrollInsensitiveResultSetOwnInsertsAreVisible true if inserts are visible for the given result set - * type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public void setScrollInsensitiveResultSetOwnInsertsAreVisible( Boolean scrollInsensitiveResultSetOwnInsertsAreVisible ) { - this.scrollInsensitiveResultSetOwnInsertsAreVisible = scrollInsensitiveResultSetOwnInsertsAreVisible; - } - - /** - * Retrieves whether a result set's own inserts are visible. - * - * @return true if inserts are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public Boolean isScrollSensitiveResultSetOwnInsertsAreVisible() { - return scrollSensitiveResultSetOwnInsertsAreVisible; - } - - /** - * Sets whether a result set's own inserts are visible. - * - * @param scrollSensitiveResultSetOwnInsertsAreVisible true if inserts are visible for the given result set type; - * false otherwise - * @since 1.2 (JDBC 2.0) - */ - public void setScrollSensitiveResultSetOwnInsertsAreVisible( Boolean scrollSensitiveResultSetOwnInsertsAreVisible ) { - this.scrollSensitiveResultSetOwnInsertsAreVisible = scrollSensitiveResultSetOwnInsertsAreVisible; - } - - /** - * Retrieves whether updates made by others are visible. - * - * @return true if updates made by others are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public Boolean isForwardOnlyResultSetOthersUpdatesAreVisible() { - return forwardOnlyResultSetOthersUpdatesAreVisible; - } - - /** - * Sets whether updates made by others are visible. - * - * @param forwardOnlyResultSetOthersUpdatesAreVisible true if updates made by others are visible for the given - * result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public void setForwardOnlyResultSetOthersUpdatesAreVisible( Boolean forwardOnlyResultSetOthersUpdatesAreVisible ) { - this.forwardOnlyResultSetOthersUpdatesAreVisible = forwardOnlyResultSetOthersUpdatesAreVisible; - } - - /** - * Retrieves whether updates made by others are visible. - * - * @return true if updates made by others are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public Boolean isScrollInsensitiveResultSetOthersUpdatesAreVisible() { - return scrollInsensitiveResultSetOthersUpdatesAreVisible; - } - - /** - * Sets whether updates made by others are visible. - * - * @param scrollInsensitiveResultSetOthersUpdatesAreVisible true if updates made by others are visible for the - * given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public void setScrollInsensitiveResultSetOthersUpdatesAreVisible( Boolean scrollInsensitiveResultSetOthersUpdatesAreVisible ) { - this.scrollInsensitiveResultSetOthersUpdatesAreVisible = scrollInsensitiveResultSetOthersUpdatesAreVisible; - } - - /** - * Retrieves whether updates made by others are visible. - * - * @return true if updates made by others are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public Boolean isScrollSensitiveResultSetOthersUpdatesAreVisible() { - return scrollSensitiveResultSetOthersUpdatesAreVisible; - } - - /** - * Sets whether updates made by others are visible. - * - * @param scrollSensitiveResultSetOthersUpdatesAreVisible true if updates made by others are visible for the - * given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public void setScrollSensitiveResultSetOthersUpdatesAreVisible( Boolean scrollSensitiveResultSetOthersUpdatesAreVisible ) { - this.scrollSensitiveResultSetOthersUpdatesAreVisible = scrollSensitiveResultSetOthersUpdatesAreVisible; - } - - /** - * Retrieves whether deletes made by others are visible. - * - * @return true if deletes made by others are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public Boolean isForwardOnlyResultSetOthersDeletesAreVisible() { - return forwardOnlyResultSetOthersDeletesAreVisible; - } - - /** - * Sets whether deletes made by others are visible. - * - * @param forwardOnlyResultSetOthersDeletesAreVisible true if deletes made by others are visible for the given - * result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public void setForwardOnlyResultSetOthersDeletesAreVisible( Boolean forwardOnlyResultSetOthersDeletesAreVisible ) { - this.forwardOnlyResultSetOthersDeletesAreVisible = forwardOnlyResultSetOthersDeletesAreVisible; - } - - /** - * Retrieves whether deletes made by others are visible. - * - * @return true if deletes made by others are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public Boolean isScrollInsensitiveResultSetOthersDeletesAreVisible() { - return scrollInsensitiveResultSetOthersDeletesAreVisible; - } - - /** - * Sets whether deletes made by others are visible. - * - * @param scrollInsensitiveResultSetOthersDeletesAreVisible true if deletes made by others are visible for the - * given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public void setScrollInsensitiveResultSetOthersDeletesAreVisible( Boolean scrollInsensitiveResultSetOthersDeletesAreVisible ) { - this.scrollInsensitiveResultSetOthersDeletesAreVisible = scrollInsensitiveResultSetOthersDeletesAreVisible; - } - - /** - * Retrieves whether deletes made by others are visible. - * - * @return true if deletes made by others are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public Boolean isScrollSensitiveResultSetOthersDeletesAreVisible() { - return scrollSensitiveResultSetOthersDeletesAreVisible; - } - - /** - * Sets whether deletes made by others are visible. - * - * @param scrollSensitiveResultSetOthersDeletesAreVisible true if deletes made by others are visible for the - * given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public void setScrollSensitiveResultSetOthersDeletesAreVisible( Boolean scrollSensitiveResultSetOthersDeletesAreVisible ) { - this.scrollSensitiveResultSetOthersDeletesAreVisible = scrollSensitiveResultSetOthersDeletesAreVisible; - } - - /** - * Retrieves whether inserts made by others are visible. - * - * @return true if inserts made by others are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public Boolean isForwardOnlyResultSetOthersInsertsAreVisible() { - return forwardOnlyResultSetOthersInsertsAreVisible; - } - - /** - * Sets whether inserts made by others are visible. - * - * @param forwardOnlyResultSetOthersInsertsAreVisible true if inserts made by others are visible for the given - * result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public void setForwardOnlyResultSetOthersInsertsAreVisible( Boolean forwardOnlyResultSetOthersInsertsAreVisible ) { - this.forwardOnlyResultSetOthersInsertsAreVisible = forwardOnlyResultSetOthersInsertsAreVisible; - } - - /** - * Retrieves whether inserts made by others are visible. - * - * @return true if inserts made by others are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public Boolean isScrollInsensitiveResultSetOthersInsertsAreVisible() { - return scrollInsensitiveResultSetOthersInsertsAreVisible; - } - - /** - * Sets whether inserts made by others are visible. - * - * @param scrollInsensitiveResultSetOthersInsertsAreVisible true if inserts made by others are visible for the - * given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public void setScrollInsensitiveResultSetOthersInsertsAreVisible( Boolean scrollInsensitiveResultSetOthersInsertsAreVisible ) { - this.scrollInsensitiveResultSetOthersInsertsAreVisible = scrollInsensitiveResultSetOthersInsertsAreVisible; - } - - /** - * Retrieves whether inserts made by others are visible. - * - * @return true if inserts made by others are visible for the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public Boolean isScrollSensitiveResultSetOthersInsertsAreVisible() { - return scrollSensitiveResultSetOthersInsertsAreVisible; - } - - /** - * Sets whether inserts made by others are visible. - * - * @param scrollSensitiveResultSetOthersInsertsAreVisible true if inserts made by others are visible for the - * given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public void setScrollSensitiveResultSetOthersInsertsAreVisible( Boolean scrollSensitiveResultSetOthersInsertsAreVisible ) { - this.scrollSensitiveResultSetOthersInsertsAreVisible = scrollSensitiveResultSetOthersInsertsAreVisible; - } - - /** - * Retrieves whether or not a visible row update can be detected by calling the method ResultSet.rowUpdated. - * - * @return true if changes are detected by the result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public Boolean isForwardOnlyResultSetUpdatesAreDetected() { - return forwardOnlyResultSetUpdatesAreDetected; - } - - /** - * Sets whether or not a visible row update can be detected by calling the method ResultSet.rowUpdated. - * - * @param forwardOnlyResultSetUpdatesAreDetected true if changes are detected by the result set type; - * false otherwise - * @since 1.2 (JDBC 2.0) - */ - public void setForwardOnlyResultSetUpdatesAreDetected( Boolean forwardOnlyResultSetUpdatesAreDetected ) { - this.forwardOnlyResultSetUpdatesAreDetected = forwardOnlyResultSetUpdatesAreDetected; - } - - /** - * Retrieves whether or not a visible row update can be detected by calling the method ResultSet.rowUpdated. - * - * @return true if changes are detected by the result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public Boolean isScrollInsensitiveResultSetUpdatesAreDetected() { - return scrollInsensitiveResultSetUpdatesAreDetected; - } - - /** - * Sets whether or not a visible row update can be detected by calling the method ResultSet.rowUpdated. - * - * @param scrollInsensitiveResultSetUpdatesAreDetected true if changes are detected by the result set type; - * false otherwise - * @since 1.2 (JDBC 2.0) - */ - public void setScrollInsensitiveResultSetUpdatesAreDetected( Boolean scrollInsensitiveResultSetUpdatesAreDetected ) { - this.scrollInsensitiveResultSetUpdatesAreDetected = scrollInsensitiveResultSetUpdatesAreDetected; - } - - /** - * Retrieves whether or not a visible row update can be detected by calling the method ResultSet.rowUpdated. - * - * @return true if changes are detected by the result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public Boolean isScrollSensitiveResultSetUpdatesAreDetected() { - return scrollSensitiveResultSetUpdatesAreDetected; - } - - /** - * Sets whether or not a visible row update can be detected by calling the method ResultSet.rowUpdated. - * - * @param scrollSensitiveResultSetUpdatesAreDetected true if changes are detected by the result set type; - * false otherwise - * @since 1.2 (JDBC 2.0) - */ - public void setScrollSensitiveResultSetUpdatesAreDetected( Boolean scrollSensitiveResultSetUpdatesAreDetected ) { - this.scrollSensitiveResultSetUpdatesAreDetected = scrollSensitiveResultSetUpdatesAreDetected; - } - - /** - * Retrieves whether or not a visible row delete can be detected by calling the method ResultSet.rowDeleted. If - * the method deletesAreDetected returns false, it means that deleted rows are removed from the - * result set. - * - * @return true if deletes are detected by the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public Boolean isForwardOnlyResultSetDeletesAreDetected() { - return forwardOnlyResultSetDeletesAreDetected; - } - - /** - * Sets whether or not a visible row delete can be detected by calling the method ResultSet.rowDeleted. If the - * method deletesAreDetected returns false, it means that deleted rows are removed from the result - * set. - * - * @param forwardOnlyResultSetDeletesAreDetected true if deletes are detected by the given result set type; - * false otherwise - * @since 1.2 (JDBC 2.0) - */ - public void setForwardOnlyResultSetDeletesAreDetected( Boolean forwardOnlyResultSetDeletesAreDetected ) { - this.forwardOnlyResultSetDeletesAreDetected = forwardOnlyResultSetDeletesAreDetected; - } - - /** - * Retrieves whether or not a visible row delete can be detected by calling the method ResultSet.rowDeleted. If - * the method deletesAreDetected returns false, it means that deleted rows are removed from the - * result set. - * - * @return true if deletes are detected by the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public Boolean isScrollInsensitiveResultSetDeletesAreDetected() { - return scrollInsensitiveResultSetDeletesAreDetected; - } - - /** - * Sets whether or not a visible row delete can be detected by calling the method ResultSet.rowDeleted. If the - * method deletesAreDetected returns false, it means that deleted rows are removed from the result - * set. - * - * @param scrollInsensitiveResultSetDeletesAreDetected true if deletes are detected by the given result set type; - * false otherwise - * @since 1.2 (JDBC 2.0) - */ - public void setScrollInsensitiveResultSetDeletesAreDetected( Boolean scrollInsensitiveResultSetDeletesAreDetected ) { - this.scrollInsensitiveResultSetDeletesAreDetected = scrollInsensitiveResultSetDeletesAreDetected; - } - - /** - * Retrieves whether or not a visible row delete can be detected by calling the method ResultSet.rowDeleted. If - * the method deletesAreDetected returns false, it means that deleted rows are removed from the - * result set. - * - * @return true if deletes are detected by the given result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public Boolean isScrollSensitiveResultSetDeletesAreDetected() { - return scrollSensitiveResultSetDeletesAreDetected; - } - - /** - * Sets whether or not a visible row delete can be detected by calling the method ResultSet.rowDeleted. If the - * method deletesAreDetected returns false, it means that deleted rows are removed from the result - * set. - * - * @param scrollSensitiveResultSetDeletesAreDetected true if deletes are detected by the given result set type; - * false otherwise - * @since 1.2 (JDBC 2.0) - */ - public void setScrollSensitiveResultSetDeletesAreDetected( Boolean scrollSensitiveResultSetDeletesAreDetected ) { - this.scrollSensitiveResultSetDeletesAreDetected = scrollSensitiveResultSetDeletesAreDetected; - } - - /** - * Retrieves whether or not a visible row insert can be detected by calling the method ResultSet.rowInserted. - * - * @return true if changes are detected by the specified result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public Boolean isForwardOnlyResultInsertsAreDetected() { - return forwardOnlyResultInsertsAreDetected; - } - - /** - * Sets whether or not a visible row insert can be detected by calling the method ResultSet.rowInserted. - * - * @param forwardOnlyResultInsertsAreDetected true if changes are detected by the specified result set type; - * false otherwise - * @since 1.2 (JDBC 2.0) - */ - public void setForwardOnlyResultInsertsAreDetected( Boolean forwardOnlyResultInsertsAreDetected ) { - this.forwardOnlyResultInsertsAreDetected = forwardOnlyResultInsertsAreDetected; - } - - /** - * Retrieves whether or not a visible row insert can be detected by calling the method ResultSet.rowInserted. - * - * @return true if changes are detected by the specified result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public Boolean isScrollInsensitiveResultInsertsAreDetected() { - return scrollInsensitiveResultInsertsAreDetected; - } - - /** - * Sets whether or not a visible row insert can be detected by calling the method ResultSet.rowInserted. - * - * @param scrollInsensitiveResultInsertsAreDetected true if changes are detected by the specified result set - * type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public void setScrollInsensitiveResultInsertsAreDetected( Boolean scrollInsensitiveResultInsertsAreDetected ) { - this.scrollInsensitiveResultInsertsAreDetected = scrollInsensitiveResultInsertsAreDetected; - } - - /** - * Retrieves whether or not a visible row insert can be detected by calling the method ResultSet.rowInserted. - * - * @return true if changes are detected by the specified result set type; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public Boolean isScrollSensitiveResultInsertsAreDetected() { - return scrollSensitiveResultInsertsAreDetected; - } - - /** - * Sets whether or not a visible row insert can be detected by calling the method ResultSet.rowInserted. - * - * @param scrollSensitiveResultInsertsAreDetected true if changes are detected by the specified result set type; - * false otherwise - * @since 1.2 (JDBC 2.0) - */ - public void setScrollSensitiveResultInsertsAreDetected( Boolean scrollSensitiveResultInsertsAreDetected ) { - this.scrollSensitiveResultInsertsAreDetected = scrollSensitiveResultInsertsAreDetected; - } - - /** - * Retrieves whether this database supports batch updates. - * - * @return true if this database supports batch upcates; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public Boolean isSupportsBatchUpdates() { - return supportsBatchUpdates; - } - - /** - * Sets whether this database supports batch updates. - * - * @param supportsBatchUpdates true if this database supports batch upcates; false otherwise - * @since 1.2 (JDBC 2.0) - */ - public void setSupportsBatchUpdates( Boolean supportsBatchUpdates ) { - this.supportsBatchUpdates = supportsBatchUpdates; - } - - /** - * Retrieves a description of the UDT available in the given catalog. - * - * @return a set of UDT available - */ - public Set getUserDefinedTypes() { - return userDefinedTypes; - } - - /** - * Adds UDT - * - * @param udt the UDT to add - */ - public void addUserDefinedType( UserDefinedType udt ) { - userDefinedTypes.add(udt); - } - - /** - * Deletes UDT - * - * @param udt the UDT to delete - */ - public void deleteUserDefinedType( UserDefinedType udt ) { - userDefinedTypes.remove(udt); - } - - /** - * Finds UDT by its name. - * - * @param catalog a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a - * catalog; null means that the catalog name should not be used to narrow the search - * @param schema a schema name; must match the schema name as it is stored in the database; "" retrieves those without a - * schema; null means that the schema name should not be used to narrow the search - * @param tableName a table name; must match the table name as it is stored in the database - * @return table or null if not found - */ - public UserDefinedType findUserDefinedTypeByName( String catalog, - String schema, - String tableName ) { - for (UserDefinedType udt : userDefinedTypes) { - if (udt.getName().equals(tableName)) { - boolean catalogNameEquals = (udt.getCatalog() != null) ? udt.getCatalog().getName().equals(catalog) : catalog == null; - boolean schemaNameEquals = (udt.getSchema() != null) ? udt.getSchema().getName().equals(schema) : schema == null; - if (catalogNameEquals && schemaNameEquals) { - return udt; - } - } - } - // return nothing - return null; - } - - // =============================================================== - // ------------------- JDBC 3.0 --------------------------------- - // =============================================================== - - /** - * Retrieves whether this database supports savepoints. - * - * @return true if savepoints are supported; false otherwise - * @since 1.4 (JDBC 3.0) - */ - public Boolean isSupportsSavepoints() { - return supportsSavepoints; - } - - /** - * Sets whether this database supports savepoints. - * - * @param supportsSavepoints true if savepoints are supported; false otherwise - * @since 1.4 (JDBC 3.0) - */ - public void setSupportsSavepoints( Boolean supportsSavepoints ) { - this.supportsSavepoints = supportsSavepoints; - } - - /** - * Retrieves whether this database supports named parameters to callable statements. - * - * @return true if named parameters are supported; false otherwise - * @since 1.4 (JDBC 3.0) - */ - public Boolean isSupportsNamedParameters() { - return supportsNamedParameters; - } - - /** - * Sets whether this database supports named parameters to callable statements. - * - * @param supportsNamedParameters true if named parameters are supported; false otherwise - * @since 1.4 (JDBC 3.0) - */ - public void setSupportsNamedParameters( Boolean supportsNamedParameters ) { - this.supportsNamedParameters = supportsNamedParameters; - } - - /** - * Retrieves whether it is possible to have multiple ResultSet objects returned from a - * CallableStatement object simultaneously. - * - * @return true if a CallableStatement object can return multiple ResultSet objects - * simultaneously; false otherwise - * @since 1.4 (JDBC 3.0) - */ - public Boolean isSupportsMultipleOpenResults() { - return supportsMultipleOpenResults; - } - - /** - * Sets whether it is possible to have multiple ResultSet objects returned from a CallableStatement - * object simultaneously. - * - * @param supportsMultipleOpenResults true if a CallableStatement object can return multiple - * ResultSet objects simultaneously; false otherwise - * @since 1.4 (JDBC 3.0) - */ - public void setSupportsMultipleOpenResults( Boolean supportsMultipleOpenResults ) { - this.supportsMultipleOpenResults = supportsMultipleOpenResults; - } - - /** - * Retrieves whether auto-generated keys can be retrieved after a statement has been executed. - * - * @return true if auto-generated keys can be retrieved after a statement has executed; false - * otherwise - * @since 1.4 (JDBC 3.0) - */ - public Boolean isSupportsGetGeneratedKeys() { - return supportsGetGeneratedKeys; - } - - /** - * Sets whether auto-generated keys can be retrieved after a statement has been executed. - * - * @param supportsGetGeneratedKeys true if auto-generated keys can be retrieved after a statement has executed; - * false otherwise - * @since 1.4 (JDBC 3.0) - */ - public void setSupportsGetGeneratedKeys( Boolean supportsGetGeneratedKeys ) { - this.supportsGetGeneratedKeys = supportsGetGeneratedKeys; - } - - /** - * Retrieves whether this database supports the given result set holdability. - * - * @return true if so; false otherwise - * @see java.sql.Connection - * @since 1.4 (JDBC 3.0) - */ - public Boolean isSupportsResultSetHoldCurrorsOverCommitHoldability() { - return supportsResultSetHoldCurrorsOverCommitHoldability; - } - - /** - * Sets whether this database supports the given result set holdability. - * - * @param supportsResultSetHoldCurrorsOverCommitHoldability true if so; false otherwise - * @see java.sql.Connection - * @since 1.4 (JDBC 3.0) - */ - public void setSupportsResultSetHoldCurrorsOverCommitHoldability( Boolean supportsResultSetHoldCurrorsOverCommitHoldability ) { - this.supportsResultSetHoldCurrorsOverCommitHoldability = supportsResultSetHoldCurrorsOverCommitHoldability; - } - - /** - * Retrieves whether this database supports the given result set holdability. - * - * @return true if so; false otherwise - * @see java.sql.Connection - * @since 1.4 (JDBC 3.0) - */ - public Boolean isSupportsResultSetCloseCurrorsAtCommitHoldability() { - return supportsResultSetCloseCurrorsAtCommitHoldability; - } - - /** - * Sets whether this database supports the given result set holdability. - * - * @param supportsResultSetCloseCurrorsAtCommitHoldability true if so; false otherwise - * @see java.sql.Connection - * @since 1.4 (JDBC 3.0) - */ - public void setSupportsResultSetCloseCurrorsAtCommitHoldability( Boolean supportsResultSetCloseCurrorsAtCommitHoldability ) { - this.supportsResultSetCloseCurrorsAtCommitHoldability = supportsResultSetCloseCurrorsAtCommitHoldability; - } - - /** - * Retrieves the default holdability of this ResultSet object. - * - * @return the default holdability; either ResultSet.HOLD_CURSORS_OVER_COMMIT or - * ResultSet.CLOSE_CURSORS_AT_COMMIT - * - * @since 1.4 - */ - public ResultSetHoldabilityType getResultSetHoldabilityType() { - return resultSetHoldabilityType; - } - - /** - * Sets the default holdability of this ResultSet object. - * - * @param resultSetHoldabilityType the ResultSetHoldabilityType - * the default holdability; either ResultSet.HOLD_CURSORS_OVER_COMMIT or - * ResultSet.CLOSE_CURSORS_AT_COMMIT - * - * @since 1.4 - */ - public void setResultSetHoldabilityType( ResultSetHoldabilityType resultSetHoldabilityType ) { - this.resultSetHoldabilityType = resultSetHoldabilityType; - } - - /** - * Retrieves the major version number of the underlying database. - * - * @return the underlying database's major version - * @since 1.4 (JDBC 3.0) - */ - public Integer getDatabaseMajorVersion() { - return databaseMajorVersion; - } - - /** - * Sets the major version number of the underlying database. - * - * @param databaseMajorVersion the underlying database's major version - * @since 1.4 (JDBC 3.0) - */ - public void setDatabaseMajorVersion( Integer databaseMajorVersion ) { - this.databaseMajorVersion = databaseMajorVersion; - } - - /** - * Retrieves the minor version number of the underlying database. - * - * @return underlying database's minor version - * @since 1.4 (JDBC 3.0) - */ - public Integer getDatabaseMinorVersion() { - return databaseMinorVersion; - } - - /** - * Sets the minor version number of the underlying database. - * - * @param databaseMinorVersion underlying database's minor version - * @since 1.4 (JDBC 3.0) - */ - public void setDatabaseMinorVersion( Integer databaseMinorVersion ) { - this.databaseMinorVersion = databaseMinorVersion; - } - - /** - * Retrieves the major JDBC version number for this driver. - * - * @return JDBC version major number - * @since 1.4 (JDBC 3.0) - */ - public Integer getJDBCMajorVersion() { - return jdbcMajorVersion; - } - - /** - * Sets the major JDBC version number for this driver. - * - * @param jdbcMajorVersion JDBC version major number - * @since 1.4 (JDBC 3.0) - */ - public void setJDBCMajorVersion( Integer jdbcMajorVersion ) { - this.jdbcMajorVersion = jdbcMajorVersion; - } - - /** - * Retrieves the minor JDBC version number for this driver. - * - * @return JDBC version minor number - * @since 1.4 (JDBC 3.0) - */ - public Integer getJDBCMinorVersion() { - return jdbcMinorVersion; - } - - /** - * Sets the minor JDBC version number for this driver. - * - * @param jdbcMinorVersion JDBC version minor number - * @since 1.4 (JDBC 3.0) - */ - public void setJDBCMinorVersion( Integer jdbcMinorVersion ) { - this.jdbcMinorVersion = jdbcMinorVersion; - } - - /** - * Indicates whether the SQLSTATE returned by SQLException.getSQLState is X/Open (now known as Open Group) SQL - * CLI or SQL99. - * - * @return the type of SQLSTATE; one of: sqlStateXOpen or sqlStateSQL99 - * @since 1.4 (JDBC 3.0) - */ - public SQLStateType getSQLStateType() { - return sqlStateType; - } - - /** - * Indicates whether the SQLSTATE returned by SQLException.getSQLState is X/Open (now known as Open Group) SQL - * CLI or SQL99. - * - * @param sqlStateType the type of SQLSTATE; one of: sqlStateXOpen or sqlStateSQL99 - * @since 1.4 (JDBC 3.0) - */ - public void setSQLStateType( SQLStateType sqlStateType ) { - this.sqlStateType = sqlStateType; - } - - /** - * Indicates whether updates made to a LOB are made on a copy or directly to the LOB. - * - * @return true if updates are made to a copy of the LOB; false if updates are made directly to the - * LOB - * @since 1.4 (JDBC 3.0) - */ - public Boolean isLocatorsUpdateCopy() { - return locatorsUpdateCopy; - } - - /** - * Indicates whether updates made to a LOB are made on a copy or directly to the LOB. - * - * @param locatorsUpdateCopy true if updates are made to a copy of the LOB; false if updates are - * made directly to the LOB - * @since 1.4 (JDBC 3.0) - */ - public void setLocatorsUpdateCopy( Boolean locatorsUpdateCopy ) { - this.locatorsUpdateCopy = locatorsUpdateCopy; - } - - /** - * Retrieves whether this database supports statement pooling. - * - * @return true if so; false otherwise - * @since 1.4 (JDBC 3.0) - */ - public Boolean isSupportsStatementPooling() { - return supportsStatementPooling; - } - - /** - * Sets whether this database supports statement pooling. - * - * @param supportsStatementPooling true if so; false otherwise - * @since 1.4 (JDBC 3.0) - */ - public void setSupportsStatementPooling( Boolean supportsStatementPooling ) { - this.supportsStatementPooling = supportsStatementPooling; - } - -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/DatabaseNamedObjectBean.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/DatabaseNamedObjectBean.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/DatabaseNamedObjectBean.java (working copy) @@ -1,122 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import java.util.Map; -import java.util.HashMap; -import org.jboss.dna.common.jdbc.model.api.DatabaseNamedObject; - -/** - * Provides database named object specific metadata. - * - * @author Sergiy Litsenko - */ -public class DatabaseNamedObjectBean extends CoreMetaDataBean implements DatabaseNamedObject { - private static final long serialVersionUID = 5784316298846262968L; - private String name; - private String remarks; - private Map extraProperties = new HashMap(); - - /** - * Default constructor - */ - public DatabaseNamedObjectBean() { - } - - /** - * Gets database named object name - * - * @return database named object name - */ - public String getName() { - return name; - } - - /** - * Sets database named object name - * - * @param name the database named object name - */ - public void setName( String name ) { - this.name = name; - } - - /** - * Gets explanatory comment on the database named object - * - * @return explanatory comment on the database named object - */ - public String getRemarks() { - return remarks; - } - - /** - * Sets explanatory comment on the database named object - * - * @param remarks the explanatory comment on the database named object - */ - public void setRemarks( String remarks ) { - this.remarks = remarks; - } - - /** - * Gets extra (non standard) properties if provided by database. - * - * @return extra properties if provided by database - */ - public Map getExtraProperties() { - return extraProperties; - } - - /** - * Gets extra (non standard) property if provided by database. - * - * @param key the key - * @return extra property if provided by database - */ - public Object getExtraProperty( String key ) { - return extraProperties.get(key); - } - - /** - * Adds extra property - * - * @param key the key - * @param value the value - */ - public void addExtraProperty( String key, - Object value ) { - extraProperties.put(key, value); - } - - /** - * deletes extra property - * - * @param key the key - * - */ - public void deleteExtraProperty( String key ) { - extraProperties.remove(key); - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/ForeignKeyBean.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/ForeignKeyBean.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/ForeignKeyBean.java (working copy) @@ -1,187 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import java.util.Set; -import java.util.HashSet; -import org.jboss.dna.common.jdbc.model.api.ForeignKey; -import org.jboss.dna.common.jdbc.model.api.ForeignKeyColumn; -import org.jboss.dna.common.jdbc.model.api.KeyDeferrabilityType; -import org.jboss.dna.common.jdbc.model.api.KeyModifyRuleType; -import org.jboss.dna.common.jdbc.model.api.PrimaryKey; -import org.jboss.dna.common.jdbc.model.api.Table; - -/** - * Provides database table's foreing key specific metadata. - * - * @author Sergiy Litsenko - */ -public class ForeignKeyBean extends SchemaObjectBean implements ForeignKey { - private static final long serialVersionUID = 3481927472605189902L; - private Set columns = new HashSet(); - private Table sourceTable; - private PrimaryKey sourcePrimaryKey; - private KeyModifyRuleType updateRule; - private KeyModifyRuleType deleteRule; - private KeyDeferrabilityType deferrability; - - /** - * Default constructor - */ - public ForeignKeyBean() { - } - - /** - * Retrieves foreign key columns - * - * @return foreign key columns - */ - public Set getColumns() { - return columns; - } - - /** - * Adds ForeignKeyColumn - * - * @param column the ForeignKeyColumn - */ - public void addColumn( ForeignKeyColumn column ) { - columns.add(column); - } - - /** - * Removes ForeignKeyColumn - * - * @param column the ForeignKeyColumn - */ - public void deleteColumn( ForeignKeyColumn column ) { - columns.remove(column); - } - - /** - * Returns table column for specified column name or null - * - * @param columnName the name of column - * @return table column for specified column name or null. - */ - public ForeignKeyColumn findColumnByName( String columnName ) { - for (ForeignKeyColumn fkc : columns) { - if (fkc.getName().equals(columnName)) { - return fkc; - } - } - // return nothing - return null; - } - - /** - * Returns the scope table of a foreign key. - * - * @return the scope table of a foreign key. - */ - public Table getSourceTable() { - return sourceTable; - } - - /** - * Sets the scope table of a foreign key. - * - * @param sourceTable the scope table of a foreign key. - */ - public void setSourceTable( Table sourceTable ) { - this.sourceTable = sourceTable; - } - - /** - * Returns the PK of scope table. - * - * @return the PK of scope table. - */ - public PrimaryKey getSourcePrimaryKey() { - return sourcePrimaryKey; - } - - /** - * Sets the PK of scope table. - * - * @param primaryKey the PK of scope table. - */ - public void setSourcePrimaryKey( PrimaryKey primaryKey ) { - this.sourcePrimaryKey = primaryKey; - } - - /** - * What happens to a foreign key when the primary key is updated - * - * @return what happens to a foreign key when the primary key is updated - */ - public KeyModifyRuleType getUpdateRule() { - return updateRule; - } - - /** - * What happens to a foreign key when the primary key is updated - * - * @param updateRule what happens to a foreign key when the primary key is updated - */ - public void setUpdateRule( KeyModifyRuleType updateRule ) { - this.updateRule = updateRule; - } - - /** - * What happens to a foreign key when the primary key is deleted - * - * @return what happens to a foreign key when the primary key is deleted - */ - public KeyModifyRuleType getDeleteRule() { - return deleteRule; - } - - /** - * What happens to a foreign key when the primary key is deleted - * - * @param deleteRule what happens to a foreign key when the primary key is deleted - */ - public void setDeleteRule( KeyModifyRuleType deleteRule ) { - this.deleteRule = deleteRule; - } - - /** - * Can the evaluation of foreign key constraints be deferred until commit - * - * @return the evaluation of foreign key constraints be deferred until commit - */ - public KeyDeferrabilityType getDeferrability() { - return deferrability; - } - - /** - * Can the evaluation of foreign key constraints be deferred until commit - * - * @param deferrability the evaluation of foreign key constraints be deferred until commit - */ - public void setDeferrability( KeyDeferrabilityType deferrability ) { - this.deferrability = deferrability; - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/ForeignKeyColumnBean.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/ForeignKeyColumnBean.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/ForeignKeyColumnBean.java (working copy) @@ -1,61 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import org.jboss.dna.common.jdbc.model.api.ForeignKeyColumn; -import org.jboss.dna.common.jdbc.model.api.TableColumn; - -/** - * Provides all database table foreign key column specific metadata. - * - * @author Sergiy Litsenko - */ -public class ForeignKeyColumnBean extends KeyColumnBean implements ForeignKeyColumn { - private static final long serialVersionUID = 2513136344022312413L; - private TableColumn sourceColumn; - - /** - * Default constructor - */ - public ForeignKeyColumnBean() { - } - - /** - * Returns mapped source column (in PK/source table) for this foreign key column - * - * @return mapped source column (in PK/source table) for this foreign key column - */ - public TableColumn getSourceColumn() { - return sourceColumn; - } - - /** - * Sets mapped source column (in PK/source table) for this foreign key column - * - * @param sourceColumn mapped source column (in PK/source table) for this foreign key column - */ - public void setSourceColumn( TableColumn sourceColumn ) { - this.sourceColumn = sourceColumn; - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/IndexBean.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/IndexBean.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/IndexBean.java (working copy) @@ -1,191 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import java.util.Set; -import java.util.HashSet; -import org.jboss.dna.common.jdbc.model.api.Index; -import org.jboss.dna.common.jdbc.model.api.IndexColumn; -import org.jboss.dna.common.jdbc.model.api.IndexType; - -/** - * Provides all database table's index specific metadata. - * - * @author Sergiy Litsenko - */ -public class IndexBean extends SchemaObjectBean implements Index { - private static final long serialVersionUID = -1217601426100735909L; - private Set columns = new HashSet(); - private Boolean unique; - private IndexType indexType; - private Integer cardinality; - private Integer pages; - private String filterCondition; - - /** - * Default constructor - */ - public IndexBean() { - } - - /** - * Retrieves index columns - * - * @return index columns - */ - public Set getColumns() { - return columns; - } - - /** - * Adds IndexColumn - * - * @param indexColumn the IndexColumn - */ - public void addColumn( IndexColumn indexColumn ) { - columns.add(indexColumn); - } - - /** - * delete IndexColumn - * - * @param indexColumn the IndexColumn - */ - public void deleteColumn( IndexColumn indexColumn ) { - columns.remove(indexColumn); - } - - /** - * Returns index column for specified column name or null - * - * @param columnName the name of column - * @return index column for specified column name or null. - */ - public IndexColumn findColumnByName( String columnName ) { - for (IndexColumn ic : columns) { - if (ic.getName().equals(columnName)) { - return ic; - } - } - // return nothing - return null; - } - - /** - * Can index values be non-unique. false when TYPE is tableIndexStatistic. - * - * @return true if index values can be non-unique. - */ - public Boolean isUnique() { - return unique; - } - - /** - * Can index values be non-unique. false when TYPE is tableIndexStatistic. - * - * @param unique true if index values can be non-unique. - */ - public void setUnique( Boolean unique ) { - this.unique = unique; - } - - /** - * Gets index type - * - * @return index type - */ - public IndexType getIndexType() { - return indexType; - } - - /** - * Sets index type - * - * @param indexType index type - */ - public void setIndexType( IndexType indexType ) { - this.indexType = indexType; - } - - /** - * When TYPE is tableIndexStatistic, then this is the number of rows in the table; otherwise, it is the number of unique - * values in the index. - * - * @return the number of rows in the table if index type is STATISTICS; otherwise, the number of unique values in the index. - */ - public Integer getCardinality() { - return cardinality; - } - - /** - * When TYPE is tableIndexStatistic, then this is the number of rows in the table; otherwise, it is the number of unique - * values in the index. - * - * @param cardinality the number of rows in the table if index type is STATISTICS; otherwise, the number of unique values in - * the index. - */ - public void setCardinality( Integer cardinality ) { - this.cardinality = cardinality; - } - - /** - * When TYPE is tableIndexStatisic then this is the number of pages used for the table, otherwise it is the number of pages - * used for the current index. - * - * @return the number of pages used for the table if index type is STATISTICS; otherwise the number of pages used for the - * current index. - */ - public Integer getPages() { - return pages; - } - - /** - * When TYPE is tableIndexStatisic then this is the number of pages used for the table, otherwise it is the number of pages - * used for the current index. - * - * @param pages the number of pages used for the table if index type is STATISTICS; otherwise the number of pages used for the - * current index. - */ - public void setPages( Integer pages ) { - this.pages = pages; - } - - /** - * Returns the filter condition, if any. (may be null) - * - * @return the filter condition, if any. (may be null) - */ - public String getFilterCondition() { - return filterCondition; - } - - /** - * Sets the filter condition, if any. (may be null) - * - * @param filterCondition the filter condition, if any. (may be null) - */ - public void setFilterCondition( String filterCondition ) { - this.filterCondition = filterCondition; - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/IndexColumnBean.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/IndexColumnBean.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/IndexColumnBean.java (working copy) @@ -1,61 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import org.jboss.dna.common.jdbc.model.api.IndexColumn; -import org.jboss.dna.common.jdbc.model.api.SortSequenceType; - -/** - * Provides all database table index column specific metadata. - * - * @author Sergiy Litsenko - */ -public class IndexColumnBean extends KeyColumnBean implements IndexColumn { - private static final long serialVersionUID = 6858478735473652523L; - private SortSequenceType sortSequenceType; - - /** - * Default constructor - */ - public IndexColumnBean() { - } - - /** - * Gets column sort sequence type - * - * @return column sort sequence type - */ - public SortSequenceType getSortSequenceType() { - return sortSequenceType; - } - - /** - * Sets column sort sequence type - * - * @param sortSequenceType column sort sequence type - */ - public void setSortSequenceType( SortSequenceType sortSequenceType ) { - this.sortSequenceType = sortSequenceType; - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/KeyColumnBean.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/KeyColumnBean.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/KeyColumnBean.java (working copy) @@ -1,41 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import org.jboss.dna.common.jdbc.model.api.KeyColumn; - -/** - * Provides all database table key column specific metadata. - * - * @author Sergiy Litsenko - */ -public class KeyColumnBean extends TableColumnBean implements KeyColumn { - private static final long serialVersionUID = -554546774511936892L; - - /** - * Default constructor - */ - public KeyColumnBean() { - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/ParameterBean.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/ParameterBean.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/ParameterBean.java (working copy) @@ -1,80 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import org.jboss.dna.common.jdbc.model.api.Parameter; -import org.jboss.dna.common.jdbc.model.api.ParameterIoType; - -/** - * Provides all SP column specific metadata. - * - * @author Sergiy Litsenko - */ -public class ParameterBean extends ColumnBean implements Parameter { - private static final long serialVersionUID = -154398910715869384L; - private ParameterIoType parameterIoType; - private Integer scale; - - /** - * Default constructor - */ - public ParameterBean() { - } - - /** - * Gets stored procedure parameter I/O type - * - * @return stored procedure parameter I/O type - */ - public ParameterIoType getIoType() { - return parameterIoType; - } - - /** - * Sets stored procedure parameter I/O type - * - * @param parameterIoType stored procedure parameter I/O type - */ - public void setIoType( ParameterIoType parameterIoType ) { - this.parameterIoType = parameterIoType; - } - - /** - * Returns parameter scale if appropriate - * - * @return scale if appropriate - */ - public Integer getScale() { - return scale; - } - - /** - * Sets parameter scale if appropriate - * - * @param scale the scale if appropriate - */ - public void setScale( Integer scale ) { - this.scale = scale; - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/PrimaryKeyBean.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/PrimaryKeyBean.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/PrimaryKeyBean.java (working copy) @@ -1,89 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import java.util.Set; -import java.util.HashSet; -import org.jboss.dna.common.jdbc.model.api.PrimaryKey; -import org.jboss.dna.common.jdbc.model.api.PrimaryKeyColumn; - -/** - * Provides database table's primary key specific metadata. - * - * @author Sergiy Litsenko - */ -public class PrimaryKeyBean extends SchemaObjectBean implements PrimaryKey { - private static final long serialVersionUID = -6620964715120791723L; - private Set columns = new HashSet(); - - /** - * Default constructor - */ - public PrimaryKeyBean() { - } - - /** - * Retrieves primary key columns - * - * @return primary key columns - */ - public Set getColumns() { - return columns; - } - - /** - * Adds PrimaryKeyColumn - * - * @param primaryKeyColumn the PrimaryKeyColumn - */ - public void addColumn( PrimaryKeyColumn primaryKeyColumn ) { - columns.add(primaryKeyColumn); - } - - /** - * deletes PrimaryKeyColumn - * - * @param primaryKeyColumn the PrimaryKeyColumn - */ - public void deleteColumn( PrimaryKeyColumn primaryKeyColumn ) { - columns.remove(primaryKeyColumn); - } - - /** - * Returns table column for specified column name or null - * - * @param columnName the name of column - * @return table column for specified column name or null. - */ - public PrimaryKeyColumn findColumnByName( String columnName ) { - for (PrimaryKeyColumn pkc : columns) { - if (pkc.getName().equals(columnName)) { - return pkc; - } - } - // return nothing - return null; - } - -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/PrimaryKeyColumnBean.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/PrimaryKeyColumnBean.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/PrimaryKeyColumnBean.java (working copy) @@ -1,41 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import org.jboss.dna.common.jdbc.model.api.PrimaryKeyColumn; - -/** - * Provides all database table primary key column specific metadata. - * - * @author Sergiy Litsenko - */ -public class PrimaryKeyColumnBean extends KeyColumnBean implements PrimaryKeyColumn { - private static final long serialVersionUID = -4638854444046770534L; - - /** - * Default constructor - */ - public PrimaryKeyColumnBean() { - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/PrivilegeBean.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/PrivilegeBean.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/PrivilegeBean.java (working copy) @@ -1,156 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import org.jboss.dna.common.jdbc.model.api.Privilege; -import org.jboss.dna.common.jdbc.model.api.PrivilegeType; - -/** - * Provides all database privilege specific metadata. - * - * @author Sergiy Litsenko - */ -public class PrivilegeBean extends CoreMetaDataBean implements Privilege { - private static final long serialVersionUID = -163129768802977718L; - private PrivilegeType privilegeType; - private String grantor; - private String grantee; - private String name; - private Boolean grantable; - private Boolean unknownGrantable; - - /** - * Default constructor - */ - public PrivilegeBean() { - } - - /** - * Returns privilege type - * - * @return privilege type - */ - public PrivilegeType getPrivilegeType() { - return privilegeType; - } - - /** - * Sets privilege type - * - * @param privilegeType the privilege type - */ - public void setPrivilegeType( PrivilegeType privilegeType ) { - this.privilegeType = privilegeType; - } - - /** - * Return grantor of access (may be null) - * - * @return grantor of access (may be null) - */ - public String getGrantor() { - return grantor; - } - - /** - * Sets grantor of access (may be null) - * - * @param grantor the grantor of access (may be null) - */ - public void setGrantor( String grantor ) { - this.grantor = grantor; - } - - /** - * Return grantee of access (may be null) - * - * @return grantee of access (may be null) - */ - public String getGrantee() { - return grantee; - } - - /** - * Sets grantee of access (may be null) - * - * @param grantee the grantee of access (may be null) - */ - public void setGrantee( String grantee ) { - this.grantee = grantee; - } - - /** - * Return name of access allowed (SELECT, INSERT, UPDATE, REFRENCES, ...) - * - * @return name of access allowed (SELECT, INSERT, UPDATE, REFRENCES, ...) - */ - public String getName() { - return name; - } - - /** - * Sets name of access allowed (SELECT, INSERT, UPDATE, REFRENCES, ...) - * - * @param name the name of access allowed (SELECT, INSERT, UPDATE, REFRENCES, ...) - */ - public void setName( String name ) { - this.name = name; - } - - /** - * Return true if grantee is permitted to grant to others, false otherwise (even if unknown). - * - * @return true if grantee is permitted to grant to others, false otherwise (even if unknown). - */ - public Boolean isGrantable() { - return grantable; - } - - /** - * Sets true if grantee is permitted to grant to others, false otherwise (even if unknown). - * - * @param grantable true if grantee is permitted to grant to others, false otherwise (even if unknown). - */ - public void setGrantable( Boolean grantable ) { - this.grantable = grantable; - } - - /** - * Return true if it is unknown: grantee is permitted to grant to others or not - * - * @return true if it is unknown: grantee is permitted to grant to others or not - */ - public Boolean isUnknownGrantable() { - return unknownGrantable; - } - - /** - * sets true if it is unknown: grantee is permitted to grant to others or not - * - * @param unknownGrantable true if it is unknown: grantee is permitted to grant to others or not - */ - public void setUnknownGrantable( Boolean unknownGrantable ) { - this.unknownGrantable = unknownGrantable; - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/ReferenceBean.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/ReferenceBean.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/ReferenceBean.java (working copy) @@ -1,81 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import org.jboss.dna.common.jdbc.model.api.Reference; -import org.jboss.dna.common.jdbc.model.api.SqlType; -import org.jboss.dna.common.jdbc.model.api.Table; - -/** - * Provides all database table REF column specific metadata. - * - * @author Sergiy Litsenko - */ -public class ReferenceBean extends CoreMetaDataBean implements Reference { - private static final long serialVersionUID = -4520163631157669283L; - private Table sourceTable; - private SqlType sourceDataType; - - /** - * Default constructor - */ - public ReferenceBean() { - } - - /** - * Returns table name that this the scope of a reference attribure - * - * @return table name that this the scope of a reference attribure - */ - public Table getSourceTable() { - return sourceTable; - } - - /** - * Sets table name that this the scope of a reference attribure - * - * @param sourceTable table name that this the scope of a reference attribure - */ - public void setSourceTable( Table sourceTable ) { - this.sourceTable = sourceTable; - } - - /** - * Returns source type of a distinct type or user-generated Ref type. - * - * @return source type of a distinct type or user-generated Ref type, - */ - public SqlType getSourceDataType() { - return sourceDataType; - } - - /** - * Sets source type of a distinct type or user-generated Ref type. - * - * @param sourceDataType source type of a distinct type or user-generated Ref type, - */ - public void setSourceDataType( SqlType sourceDataType ) { - this.sourceDataType = sourceDataType; - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/SchemaBean.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/SchemaBean.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/SchemaBean.java (working copy) @@ -1,61 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import org.jboss.dna.common.jdbc.model.api.Catalog; -import org.jboss.dna.common.jdbc.model.api.Schema; - -/** - * Provides database schema specific metadata. - * - * @author Sergiy Litsenko - */ -public class SchemaBean extends DatabaseNamedObjectBean implements Schema { - private static final long serialVersionUID = -3277162949797951267L; - private Catalog catalog; - - /** - * Default constructor - */ - public SchemaBean() { - } - - /** - * Gets database catalog - * - * @return database catalog - */ - public Catalog getCatalog() { - return catalog; - } - - /** - * Sets database catalog - * - * @param catalog the database catalog - */ - public void setCatalog( Catalog catalog ) { - this.catalog = catalog; - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/SchemaObjectBean.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/SchemaObjectBean.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/SchemaObjectBean.java (working copy) @@ -1,81 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import org.jboss.dna.common.jdbc.model.api.Catalog; -import org.jboss.dna.common.jdbc.model.api.Schema; -import org.jboss.dna.common.jdbc.model.api.SchemaObject; - -/** - * Provides database schema object specific metadata. - * - * @author Sergiy Litsenko - */ -public class SchemaObjectBean extends DatabaseNamedObjectBean implements SchemaObject { - private static final long serialVersionUID = -2361937039721273606L; - private Catalog catalog; - private Schema schema; - - /** - * Default constructor - */ - public SchemaObjectBean() { - } - - /** - * Gets database catalog - * - * @return database catalog - */ - public Catalog getCatalog() { - return catalog; - } - - /** - * Sets database catalog - * - * @param catalog the database catalog - */ - public void setCatalog( Catalog catalog ) { - this.catalog = catalog; - } - - /** - * Gets database schema - * - * @return database schema - */ - public Schema getSchema() { - return schema; - } - - /** - * Sets database schema - * - * @param schema the database schema - */ - public void setSchema( Schema schema ) { - this.schema = schema; - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/SqlTypeConversionPairBean.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/SqlTypeConversionPairBean.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/SqlTypeConversionPairBean.java (working copy) @@ -1,80 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import org.jboss.dna.common.jdbc.model.api.SqlType; -import org.jboss.dna.common.jdbc.model.api.SqlTypeConversionPair; - -/** - * Provides RDBMS supported SQL type valid conversion pair. - * - * @author Sergiy Litsenko - */ -public class SqlTypeConversionPairBean extends CoreMetaDataBean implements SqlTypeConversionPair { - private static final long serialVersionUID = -2111832789576864971L; - private SqlType srcType; - private SqlType destType; - - /** - * Default constructor - */ - public SqlTypeConversionPairBean() { - } - - /** - * Gets valid SQL Type - * - * @return valid SQL Type - */ - public SqlType getSrcType() { - return srcType; - } - - /** - * Sets valid source SQL Type - * - * @param srcType the source SQL Type - */ - public void setSrcType( SqlType srcType ) { - this.srcType = srcType; - } - - /** - * Gets valid destination SQL Type - * - * @return valid dewstination SQL Type - */ - public SqlType getDestType() { - return destType; - } - - /** - * Sets valid destination SQL Type - * - * @param destType the destination SQL Type - */ - public void setDestType( SqlType destType ) { - this.destType = destType; - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/SqlTypeInfoBean.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/SqlTypeInfoBean.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/SqlTypeInfoBean.java (working copy) @@ -1,329 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import org.jboss.dna.common.jdbc.model.api.NullabilityType; -import org.jboss.dna.common.jdbc.model.api.SearchabilityType; -import org.jboss.dna.common.jdbc.model.api.SqlType; -import org.jboss.dna.common.jdbc.model.api.SqlTypeInfo; - -/** - * Provides RDBMS supported standatd SQL types info. - * - * @author Sergiy Litsenko - */ -public class SqlTypeInfoBean extends DatabaseNamedObjectBean implements SqlTypeInfo { - private static final long serialVersionUID = -3336885010975318256L; - private String localizedTypeName; - private NullabilityType nullabilityType; - private SqlType sqlType; - private Long precision; - private Boolean fixedPrecisionScale; - private Integer numberPrecisionRadix; - private Integer minScale; - private Integer maxScale; - private String literalPrefix; - private String literalSuffix; - private String createParams; - private Boolean caseSensitive; - private SearchabilityType searchabilityType; - private Boolean unsigned; - private Boolean autoIncrement; - - /** - * Default constructor - */ - public SqlTypeInfoBean() { - } - - /** - * Returns localized version of type name (may be null). Type name is returned by DatabaseNamedObject.getName () method. - * - * @return localized version of type name (may be null) - */ - public String getLocalizedTypeName() { - return localizedTypeName; - } - - /** - * Sets localized version of type name (may be null). Type name is returned by DatabaseNamedObject.getName () method. - * - * @param localizedTypeName localized version of type name (may be null) - */ - public void setLocalizedTypeName( String localizedTypeName ) { - this.localizedTypeName = localizedTypeName; - } - - /** - * Gets SQL type nullability - * - * @return SQL type nullability - */ - public NullabilityType getNullabilityType() { - return nullabilityType; - } - - /** - * Sets SQL type nullability - * - * @param nullabilityType SQL type nullability - */ - public void setNullabilityType( NullabilityType nullabilityType ) { - this.nullabilityType = nullabilityType; - } - - /** - * Gets SQL type from java.sql.Types - * - * @return SQL type from java.sql.Types - */ - public SqlType getSqlType() { - return sqlType; - } - - /** - * Sets SQL type from java.sql.Types - * - * @param sqlType the SQL type from java.sql.Types - */ - public void setSqlType( SqlType sqlType ) { - this.sqlType = sqlType; - } - - /** - * Gets precision (number of fractional digits/scale) if applicable otherwise 0. - * - * @return precision if applicable otherwise 0 - */ - public Long getPrecision() { - return precision; - } - - /** - * Sets precision (number of fractional digits/scale) if applicable otherwise 0. - * - * @param precision precision if applicable otherwise 0 - */ - public void setPrecision( Long precision ) { - this.precision = precision; - } - - /** - * Returns true if sql type can be a money value, for instance - * - * @return true if sql type can be a money value, for instance - */ - public Boolean isFixedPrecisionScale() { - return fixedPrecisionScale; - } - - /** - * Sets true if sql type can be a money value, for instance - * - * @param fixedPrecisionScale true if sql type can be a money value, for instance - */ - public void setFixedPrecisionScale( Boolean fixedPrecisionScale ) { - this.fixedPrecisionScale = fixedPrecisionScale; - } - - /** - * Returns sql type precision radix (usually 2 or 10) - * - * @return sql type precision radix (usually 2 or 10) - */ - public Integer getNumberPrecisionRadix() { - return numberPrecisionRadix; - } - - /** - * sets sql type precision radix (usually 2 or 10) - * - * @param numberPrecisionRadix the sql type precision radix (usually 2 or 10) - */ - public void setNumberPrecisionRadix( Integer numberPrecisionRadix ) { - this.numberPrecisionRadix = numberPrecisionRadix; - } - - /** - * Returns minimum scale supported - * - * @return minimum scale supported - */ - public Integer getMinScale() { - return minScale; - } - - /** - * Sets minimum scale supported - * - * @param minScale minimum scale supported - */ - public void setMinScale( Integer minScale ) { - this.minScale = minScale; - } - - /** - * Returns maximum scale supported - * - * @return maximum scale supported - */ - public Integer getMaxScale() { - return maxScale; - } - - /** - * Sets maximum scale supported - * - * @param maxScale the maximum scale supported - */ - public void setMaxScale( Integer maxScale ) { - this.maxScale = maxScale; - } - - /** - * Returns prefix used to quote a literal (may be null) - * - * @return prefix used to quote a literal (may be null) - */ - public String getLiteralPrefix() { - return literalPrefix; - } - - /** - * Sets prefix used to quote a literal (may be null) - * - * @param literalPrefix the prefix used to quote a literal (may be null) - */ - public void setLiteralPrefix( String literalPrefix ) { - this.literalPrefix = literalPrefix; - } - - /** - * Returns suffix used to quote a literal (may be null) - * - * @return suffix used to quote a literal (may be null) - */ - public String getLiteralSuffix() { - return literalSuffix; - } - - /** - * Sets suffix used to quote a literal (may be null) - * - * @param literalSuffix the suffix used to quote a literal (may be null) - */ - public void setLiteralSuffix( String literalSuffix ) { - this.literalSuffix = literalSuffix; - } - - /** - * Returns parameters used in creating the type (may be null) - * - * @return parameters used in creating the type (may be null) - */ - public String getCreateParams() { - return createParams; - } - - /** - * Sets parameters used in creating the type (may be null) - * - * @param createParams the parameters used in creating the type (may be null) - */ - public void setCreateParams( String createParams ) { - this.createParams = createParams; - } - - /** - * Is sql type case sensitive - * - * @return true if sql type case sensitive - */ - public Boolean isCaseSensitive() { - return caseSensitive; - } - - /** - * Is sql type case sensitive - * - * @param caseSensitive the true if sql type case sensitive - */ - public void setCaseSensitive( Boolean caseSensitive ) { - this.caseSensitive = caseSensitive; - } - - /** - * Returns sql type searchability - * - * @return sql type searchability - */ - public SearchabilityType getSearchabilityType() { - return searchabilityType; - } - - /** - * Sets sql type searchability - * - * @param searchabilityType the sql type searchability - */ - public void setSearchabilityType( SearchabilityType searchabilityType ) { - this.searchabilityType = searchabilityType; - } - - /** - * Returns true if sql type is unsigned - * - * @return true if sql type is unsigned - */ - public Boolean isUnsigned() { - return unsigned; - } - - /** - * Sets true if sql type is unsigned - * - * @param unsigned true if sql type is unsigned - */ - public void setUnsigned( Boolean unsigned ) { - this.unsigned = unsigned; - } - - /** - * Returns true if sql type can be used for an auto-increment value. - * - * @return true if sql type can be used for an auto-increment value. - */ - public Boolean isAutoIncrement() { - return autoIncrement; - } - - /** - * Sets true if sql type can be used for an auto-increment value. - * - * @param autoIncrement true if sql type can be used for an auto-increment value. - */ - public void setAutoIncrement( Boolean autoIncrement ) { - this.autoIncrement = autoIncrement; - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/StoredProcedureBean.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/StoredProcedureBean.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/StoredProcedureBean.java (working copy) @@ -1,109 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import java.util.Set; -import java.util.HashSet; -import org.jboss.dna.common.jdbc.model.api.Parameter; -import org.jboss.dna.common.jdbc.model.api.StoredProcedure; -import org.jboss.dna.common.jdbc.model.api.StoredProcedureResultType; - -/** - * Provides all core database SPe specific metadata. - * - * @author Sergiy Litsenko - */ -public class StoredProcedureBean extends SchemaObjectBean implements StoredProcedure { - private static final long serialVersionUID = 8530431073036932292L; - private Set columns = new HashSet(); - private StoredProcedureResultType resultType; - - /** - * Default constructor - */ - public StoredProcedureBean() { - } - - /** - * Gets stored procedure result type - * - * @return stored procedure result type - */ - public StoredProcedureResultType getResultType() { - return resultType; - } - - /** - * Sets stored procedure result type - * - * @param resultType the stored procedure result type - */ - public void setResultType( StoredProcedureResultType resultType ) { - this.resultType = resultType; - } - - /** - * Gets stored procedure columns - * - * @return a set of stored procedure columns. - */ - public Set getParameters() { - return columns; - } - - /** - * Adds Parameter - * - * @param parameter the Parameter - */ - public void addParameter( Parameter parameter ) { - columns.add(parameter); - } - - /** - * deletes Parameter - * - * @param parameter the Parameter - */ - public void deleteParameter( Parameter parameter ) { - columns.remove(parameter); - } - - /** - * Returns stored procedure parameter for specified name or null - * - * @param parameterName the name of parameter - * @return stored procedure parameter for specified name or null. - */ - public Parameter findParameterByName( String parameterName ) { - for (Parameter p : columns) { - if (p.getName().equals(parameterName)) { - return p; - } - } - // return nothing - return null; - } - -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/TableBean.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/TableBean.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/TableBean.java (working copy) @@ -1,479 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import java.util.Set; -import java.util.HashSet; -import org.jboss.dna.common.jdbc.model.api.BestRowIdentifier; -import org.jboss.dna.common.jdbc.model.api.BestRowIdentifierScopeType; -import org.jboss.dna.common.jdbc.model.api.Catalog; -import org.jboss.dna.common.jdbc.model.api.ForeignKey; -import org.jboss.dna.common.jdbc.model.api.Index; -import org.jboss.dna.common.jdbc.model.api.PrimaryKey; -import org.jboss.dna.common.jdbc.model.api.Privilege; -import org.jboss.dna.common.jdbc.model.api.Schema; -import org.jboss.dna.common.jdbc.model.api.Table; -import org.jboss.dna.common.jdbc.model.api.TableColumn; -import org.jboss.dna.common.jdbc.model.api.TableType; - -/** - * Provides all core database table specific metadata. - * - * @author Sergiy Litsenko - */ -public class TableBean extends SchemaObjectBean implements Table { - private static final long serialVersionUID = -1315274844163173964L; - private Set columns = new HashSet(); - private Set foreignKeys = new HashSet(); - private Set indexes = new HashSet(); - private Set versionColumns = new HashSet(); - private Set privileges = new HashSet(); - private Set bestRowIdentifiers = new HashSet(); - private TableType tableType; - private Catalog typeCatalog; - private Schema typeSchema; - private String typeName; - private String selfReferencingColumnName; - private String referenceGeneration; - private PrimaryKey primaryKey; - private Table superTable; - - /** - * Default constructor - */ - public TableBean() { - } - - /** - * Returns type of table such as: "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM". - * - * @return type of table. - */ - public TableType getTableType() { - return tableType; - } - - /** - * Sets type of table such as: "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM". - * - * @param tableType the type of table. - */ - public void setTableType( TableType tableType ) { - this.tableType = tableType; - } - - /** - * Gets type catalog - * - * @return types catalog (may be null) - */ - public Catalog getTypeCatalog() { - return typeCatalog; - } - - /** - * Sets type catalog - * - * @param typeCatalog the types catalog (may be null) - */ - public void setTypeCatalog( Catalog typeCatalog ) { - this.typeCatalog = typeCatalog; - } - - /** - * Gets type schema - * - * @return types schema (may be null) - */ - public Schema getTypeSchema() { - return typeSchema; - } - - /** - * Sets type schema - * - * @param typeSchema the types schema (may be null) - */ - public void setTypeSchema( Schema typeSchema ) { - this.typeSchema = typeSchema; - } - - /** - * Gets type name - * - * @return types name (may be null) - */ - public String getTypeName() { - return typeName; - } - - /** - * Sets type name - * - * @param typeName types name (may be null) - */ - public void setTypeName( String typeName ) { - this.typeName = typeName; - } - - /** - * Gets name of the designated "identifier" column of a typed table (may be null) - * - * @return name of the designated "identifier" column of a typed table (may be null) - */ - public String getSelfReferencingColumnName() { - return selfReferencingColumnName; - } - - /** - * Sets name of the designated "identifier" column of a typed table (may be null) - * - * @param selfReferencingColumnName the name of the designated "identifier" column of a typed table (may be null) - */ - public void setSelfReferencingColumnName( String selfReferencingColumnName ) { - this.selfReferencingColumnName = selfReferencingColumnName; - } - - /** - * specifies how values in getSelfReferencingColumnName () are created. Values are "SYSTEM", "USER", "DERIVED". (may be - * null) - * - * @return how values in getSelfReferencingColumnName () are created. - */ - public String getReferenceGeneration() { - return referenceGeneration; - } - - /** - * specifies how values in getSelfReferencingColumnName () are created. Values are "SYSTEM", "USER", "DERIVED". (may be - * null) - * - * @param referenceGeneration how values in getSelfReferencingColumnName () are created. - */ - public void setReferenceGeneration( String referenceGeneration ) { - this.referenceGeneration = referenceGeneration; - } - - /** - * Gets a set of table columns - * - * @return a set of table columns. - */ - public Set getColumns() { - return columns; - } - - /** - * Adds TableColumn - * - * @param column the TableColumn - */ - public void addColumn( TableColumn column ) { - columns.add(column); - } - - /** - * deletes TableColumn - * - * @param column the TableColumn - */ - public void deleteColumn( TableColumn column ) { - columns.remove(column); - } - - /** - * Returns table column for specified column name or null - * - * @param columnName the name of column - * @return table column for specified column name or null. - */ - public TableColumn findColumnByName( String columnName ) { - for (TableColumn c : columns) { - if (c.getName().equals(columnName)) { - return c; - } - } - // return nothing - return null; - } - - /** - * Gets a table primary key - * - * @return a table primary key. - */ - public PrimaryKey getPrimaryKey() { - return primaryKey; - } - - /** - * Sets a table primary key - * - * @param primaryKey the table primary key. - */ - public void setPrimaryKey( PrimaryKey primaryKey ) { - this.primaryKey = primaryKey; - } - - /** - * Gets a set of table foreign key columns - * - * @return a set of table foreign keys. - */ - public Set getForeignKeys() { - return foreignKeys; - } - - /** - * adds ForeignKey - * - * @param foreignKey the ForeignKey - */ - public void addForeignKey( ForeignKey foreignKey ) { - foreignKeys.add(foreignKey); - } - - /** - * deletes ForeignKey - * - * @param foreignKey the ForeignKey - */ - public void deleteForeignKey( ForeignKey foreignKey ) { - foreignKeys.remove(foreignKey); - } - - /** - * Returns table foreign key for specified name or null - * - * @param fkName the name of foreign key - * @return table foreign key for specified name or null. - */ - public ForeignKey findForeignKeyByName( String fkName ) { - for (ForeignKey fk : foreignKeys) { - if (fk.getName().equals(fkName)) { - return fk; - } - } - // return nothing - return null; - } - - /** - * Gets a set of table indexes - * - * @return a set of table indexes. - */ - public Set getIndexes() { - return indexes; - } - - /** - * adds Index - * - * @param index the Index - */ - public void addIndex( Index index ) { - indexes.add(index); - } - - /** - * deletes Index - * - * @param index the Index - */ - public void deleteIndex( Index index ) { - indexes.remove(index); - } - - /** - * Returns table index for specified name or null - * - * @param indexName the name of index - * @return table index for specified name or null. - */ - public Index findIndexByName( String indexName ) { - for (Index i : indexes) { - if (i.getName().equals(indexName)) { - return i; - } - } - // return nothing - return null; - } - - /** - * Gets a set of table version columns - * - * @return a set of table version columns. - */ - public Set getVersionColumns() { - return versionColumns; - } - - /** - * adds version column - * - * @param tableColumn the TableColumn - */ - public void addVersionColumn( TableColumn tableColumn ) { - versionColumns.add(tableColumn); - } - - /** - * deletes version column - * - * @param tableColumn the version column - */ - public void deleteVersionColumn( TableColumn tableColumn ) { - versionColumns.remove(tableColumn); - } - - /** - * Returns table version column for specified name or null - * - * @param columnName the name of Version Column - * @return table Version Column for specified name or null. - */ - public TableColumn findVersionColumnByName( String columnName ) { - for (TableColumn c : versionColumns) { - if (c.getName().equals(columnName)) { - return c; - } - } - // return nothing - return null; - } - - /** - * Gets table privileges. - * - * @return set of table privileges - */ - public Set getPrivileges() { - return privileges; - } - - /** - * Adds table priviledge - * - * @param privilege the table priviledge - */ - public void addPrivilege( Privilege privilege ) { - privileges.add(privilege); - } - - /** - * Deletes table priviledge - * - * @param privilege the table priviledge - */ - public void deletePrivilege( Privilege privilege ) { - privileges.remove(privilege); - } - - /** - * Searches priviledge by name - * - * @param priviledgeName the priviledge name to search - * @return priviledge if found, otherwise return null - */ - public Privilege findPriviledgeByName( String priviledgeName ) { - for (Privilege p : privileges) { - if (p.getName().equals(priviledgeName)) { - return p; - } - } - // return nothing - return null; - } - - /** - * Retrieves a set of descriptions of a table's optimal set of columns that uniquely identifies a row in temporary scopes. - * - * @return BestRowIdentifier set that uniquely identifies a row in scopes. - */ - public Set getBestRowIdentifiers() { - return bestRowIdentifiers; - } - - /** - * Adds BestRowIdentifier - * - * @param bestRowIdentifier the BestRowIdentifier - */ - public void addBestRowIdentifier( BestRowIdentifier bestRowIdentifier ) { - bestRowIdentifiers.add(bestRowIdentifier); - } - - /** - * deletes BestRowIdentifier - * - * @param bestRowIdentifier the BestRowIdentifier - */ - public void deleteBestRowIdentifier( BestRowIdentifier bestRowIdentifier ) { - bestRowIdentifiers.remove(bestRowIdentifier); - } - - /** - * Searches the BestRowIdentifier by scope - * - * @param scopeType the scope of best row identifier - * @return BestRowIdentifier if any - */ - public BestRowIdentifier findBestRowIdentifierByScopeType( BestRowIdentifierScopeType scopeType ) { - for (BestRowIdentifier bri : bestRowIdentifiers) { - if (bri.getScopeType().equals(scopeType)) { - return bri; - } - } - // return nothing - return null; - } - - // =============================================================== - // ------------------- JDBC 3.0 --------------------------------- - // =============================================================== - - /** - * Retrieves a description of the table hierarchies defined in a particular schema in this database. Only the immediate super - * type/ sub type relationship is modeled. - * - * @return super table for this table - * @since 1.4 (JDBC 3.0) - */ - public Table getSuperTable() { - return superTable; - } - - /** - * Sets a description of the table hierarchies defined in a particular schema in this database. Only the immediate super type/ - * sub type relationship is modeled. - * - * @param superTable the super table for this table - * @since 1.4 (JDBC 3.0) - */ - public void setSuperTable( Table superTable ) { - this.superTable = superTable; - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/TableColumnBean.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/TableColumnBean.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/TableColumnBean.java (working copy) @@ -1,179 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import org.jboss.dna.common.jdbc.model.api.ColumnPseudoType; -import org.jboss.dna.common.jdbc.model.api.TableColumn; -import org.jboss.dna.common.jdbc.model.api.Reference; - -/** - * Provides all database table column specific metadata. - * - * @author Sergiy Litsenko - */ -public class TableColumnBean extends ColumnBean implements TableColumn { - private static final long serialVersionUID = -1719977563697808831L; - private Boolean bestRowIdentifier; - private ColumnPseudoType pseudoType; - private Reference reference; - private Boolean versionColumn; - private Boolean primaryKeyColumn; - private Boolean foreignKeyColumn; - private Boolean indexColumn; - - /** - * Default constructor - */ - public TableColumnBean() { - } - - /** - * Is this column the part of Best Row Identifier in any scope? - * - * @return true if this column is the part of Best Row Identifier in any scope, otherwise return false (even if unknown) - */ - public Boolean isBestRowIdentifier() { - return bestRowIdentifier; - } - - /** - * Is this column the part of Best Row Identifier in any scope? - * - * @param bestRowIdentifier true if this column is the part of Best Row Identifier in any scope, otherwise return false (even - * if unknown) - */ - public void setBestRowIdentifier( Boolean bestRowIdentifier ) { - this.bestRowIdentifier = bestRowIdentifier; - } - - /** - * Return column's pseudo type - * - * @return column's pseudo type - */ - public ColumnPseudoType getPseudoType() { - return pseudoType; - } - - /** - * Sets column's pseudo type - * - * @param pseudoType the column's pseudo type - */ - public void setPseudoType( ColumnPseudoType pseudoType ) { - this.pseudoType = pseudoType; - } - - /** - * Returns column reference if datatype is REF - * - * @return column reference if datatype is REF - */ - public Reference getReference() { - return reference; - } - - /** - * Sets column reference if datatype is REF - * - * @param reference the column reference if datatype is REF - */ - public void setReference( Reference reference ) { - this.reference = reference; - } - - /** - * Retrieves true if column is automatically updated when any value in a row is updated. If it retrieves true then column can - * be cast to VersionColumn. - * - * @return true if column is automatically updated when any value in a row is updated, return false overwise. - */ - public Boolean isVersionColumn() { - return versionColumn; - } - - /** - * Sets true if column is automatically updated when any value in a row is updated. If it retrieves true then column can be - * cast to VersionColumn. - * - * @param versionColumn true if column is automatically updated when any value in a row is updated, return false overwise. - */ - public void setVersionColumn( Boolean versionColumn ) { - this.versionColumn = versionColumn; - } - - /** - * Retrieves true if column is part of primary key. - * - * @return true if column is part of primary key, return false overwise. - */ - public Boolean isPrimaryKeyColumn() { - return primaryKeyColumn; - } - - /** - * Sets true if column is part of primary key. - * - * @param primaryKeyColumn true if column is part of primary key, return false overwise. - */ - public void setPrimaryKeyColumn( Boolean primaryKeyColumn ) { - this.primaryKeyColumn = primaryKeyColumn; - } - - /** - * Retrieves true if column is part of foreign key. - * - * @return true if column is part of foreign key, return false overwise. - */ - public Boolean isForeignKeyColumn() { - return foreignKeyColumn; - } - - /** - * Sets true if column is part of foreign key. - * - * @param foreignKeyColumn true if column is part of foreign key, return false overwise. - */ - public void setForeignKeyColumn( Boolean foreignKeyColumn ) { - this.foreignKeyColumn = foreignKeyColumn; - } - - /** - * Retrieves true if column is part of any index. - * - * @return true if column is part of any index, return false overwise. - */ - public Boolean isIndexColumn() { - return indexColumn; - } - - /** - * Sets true if column is part of any index. - * - * @param indexColumn true if column is part of any index, return false overwise. - */ - public void setIndexColumn( Boolean indexColumn ) { - this.indexColumn = indexColumn; - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/TableTypeBean.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/TableTypeBean.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/TableTypeBean.java (working copy) @@ -1,178 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import org.jboss.dna.common.jdbc.model.api.TableType; - -/** - * Provides database table type specific metadata. - *

- * The table type is: - *

    - *
  1. TABLE_TYPE String => table type. Typical types are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", - * "LOCAL TEMPORARY", "ALIAS", "SYNONYM". - *
- * @author Sergiy Litsenko - */ -public class TableTypeBean extends DatabaseNamedObjectBean implements TableType { - private static final long serialVersionUID = -5095835769360603900L; - - /** - * Default constructor - */ - public TableTypeBean() { - } - - /** - * Is table type represents TABLE - * - * @param tableTypeName the table type string - * @return true if table type represents TABLE - */ - public Boolean isTable( String tableTypeName ) { - return DEF_TABLE_TYPE_TABLE.equals(tableTypeName); - } - - /** - * Is current table type represents TABLE - * - * @return true if current table type represents TABLE - */ - public Boolean isTable() { - return isTable(getName()); - } - - /** - * Is table type represents VIEW - * - * @param tableTypeName the table type string - * @return true if table type represents VIEW - */ - public Boolean isView( String tableTypeName ) { - return DEF_TABLE_TYPE_VIEW.equals(tableTypeName); - } - - /** - * Is current table type represents VIEW - * - * @return true if current table type represents VIEW - */ - public Boolean isView() { - return isView(getName()); - } - - /** - * Is table type represents SYSTEM TABLE - * - * @param tableTypeName the table type string - * @return true if table type represents SYSTEM TABLE - */ - public Boolean isSystemTable( String tableTypeName ) { - return DEF_TABLE_TYPE_SYS_TABLE.equals(tableTypeName); - } - - /** - * Is current table type represents SYSTEM TABLE - * - * @return true if current table type represents SYSTEM TABLE - */ - public Boolean isSystemTable() { - return isSystemTable(getName()); - } - - /** - * Is current table type represents GLOBAL TEMPORARY - * - * @param tableTypeName the table type string - * @return true if current table type represents GLOBAL TEMPORARY - */ - public Boolean isGlobalTemporary( String tableTypeName ) { - return DEF_TABLE_TYPE_GLOBAL_TEMP.equals(tableTypeName); - } - - /** - * Is current table type represents GLOBAL TEMPORARY - * - * @return true if table type represents GLOBAL TEMPORARY - */ - public Boolean isGlobalTemporary() { - return isGlobalTemporary(getName()); - } - - /** - * Is table type represents LOCAL TEMPORARY - * - * @param tableTypeName the table type string - * @return true if table type represents LOCAL TEMPORARY - */ - public Boolean islocalTemporary( String tableTypeName ) { - return DEF_TABLE_TYPE_LOCAL_TEMP.equals(tableTypeName); - } - - /** - * Is current table type represents LOCAL TEMPORARY - * - * @return true if current table type represents LOCAL TEMPORARY - */ - public Boolean isLocalTemporary() { - return islocalTemporary(getName()); - } - - /** - * Is table type represents ALIAS - * - * @param tableTypeName the table type string - * @return true if table type represents ALIAS - */ - public Boolean isAlias( String tableTypeName ) { - return DEF_TABLE_TYPE_ALIAS.equals(tableTypeName); - } - - /** - * Is current table type represents ALIAS - * - * @return true if current table type represents ALIAS - */ - public Boolean isAlias() { - return isAlias(getName()); - } - - /** - * Is table type represents SYNONYM - * - * @param tableTypeName the table type string - * @return true if table type represents SYNONYM - */ - public Boolean isSynonym( String tableTypeName ) { - return DEF_TABLE_TYPE_SYNONYM.equals(tableTypeName); - } - - /** - * Is current table type represents SYNONYM - * @return true if current table type represents SYNONYM - */ - public Boolean isSynonym() { - return isSynonym(getName()); - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/UserDefinedTypeBean.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/UserDefinedTypeBean.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/model/spi/UserDefinedTypeBean.java (working copy) @@ -1,179 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import java.util.Set; -import java.util.HashSet; -import org.jboss.dna.common.jdbc.model.api.Attribute; -import org.jboss.dna.common.jdbc.model.api.UserDefinedType; -import org.jboss.dna.common.jdbc.model.api.SqlType; - -/** - * Provides User Defined Type (UDT) specific metadata. Retrieves a description of the user-defined types (UDTs) defined in a - * particular schema. Schema-specific UDTs may have type JAVA_OBJECT, STRUCT, or DISTINCT. - * - * @author Sergiy Litsenko - * @since 1.2 (JDBC 2.0) - */ -public class UserDefinedTypeBean extends SchemaObjectBean implements UserDefinedType { - private static final long serialVersionUID = -7493272131759308580L; - private Set columns = new HashSet(); - private String className; - private SqlType sqlType; - private SqlType baseType; - private UserDefinedType superType; - - /** - * Default constructor - */ - public UserDefinedTypeBean() { - } - - /** - * Returns JAVA class name for UDT - * - * @return JAVA class name for UDT - */ - public String getClassName() { - return className; - } - - /** - * Sets JAVA class name for UDT - * - * @param className JAVA class name for UDT - */ - public void setClassName( String className ) { - this.className = className; - } - - /** - * Gets SQL type from java.sql.Types. One of JAVA_OBJECT, STRUCT, or DISTINCT - * - * @return SQL type from java.sql.Types. One of JAVA_OBJECT, STRUCT, or DISTINCT - */ - public SqlType getSqlType() { - return sqlType; - } - - /** - * Sets SQL type from java.sql.Types. One of JAVA_OBJECT, STRUCT, or DISTINCT - * - * @param sqlType the SQL type from java.sql.Types. One of JAVA_OBJECT, STRUCT, or DISTINCT - */ - public void setSqlType( SqlType sqlType ) { - this.sqlType = sqlType; - } - - /** - * Gets SQL base type from java.sql.Types. Type code of the source type of a DISTINCT type or the type that implements the - * user-generated reference type of the SELF_REFERENCING_COLUMN of a structured type as defined in java.sql.Types (null if - * DATA_TYPE is not DISTINCT or not STRUCT with REFERENCE_GENERATION = USER_DEFINED) - * - * @return SQL base type from java.sql.Types. - */ - public SqlType getBaseType() { - return baseType; - } - - /** - * Sets SQL base type from java.sql.Types. Type code of the source type of a DISTINCT type or the type that implements the - * user-generated reference type of the SELF_REFERENCING_COLUMN of a structured type as defined in java.sql.Types (null if - * DATA_TYPE is not DISTINCT or not STRUCT with REFERENCE_GENERATION = USER_DEFINED) - * - * @param baseType the SQL base type from java.sql.Types. - */ - public void setBaseType( SqlType baseType ) { - this.baseType = baseType; - } - - /** - * Gets a set of UDT attributes - * - * @return a set of UDT attributes - */ - public Set getAttributes() { - return columns; - } - - /** - * adds Attribute - * - * @param attribute the Attribute - */ - public void addAttribute( Attribute attribute ) { - columns.add(attribute); - } - - /** - * deletes Attribute - * - * @param attribute the Attribute - */ - public void deleteAttribute( Attribute attribute ) { - columns.remove(attribute); - } - - /** - * Returns UDT attribute for specified attribute name or null - * - * @param attributeName the name of attribute - * @return UDT attribute for specified attribute name or null. - */ - public Attribute findAttributeByName( String attributeName ) { - for (Attribute a : columns) { - if (a.getName().equals(attributeName)) { - return a; - } - } - // return nothing - return null; - } - - // =============================================================== - // ------------------- JDBC 3.0 --------------------------------- - // =============================================================== - - /** - * Retrieves a description of the user-defined type (UDT) hierarchies defined in a particular schema in this database. Only - * the immediate super type/ sub type relationship is modeled. - * - * @return super type for this UDT if any - * @since 1.4 (JDBC 3.0) - */ - public UserDefinedType getSuperType() { - return superType; - } - - /** - * Sets a description of the user-defined type (UDT) hierarchies defined in a particular schema in this database. Only the - * immediate super type/ sub type relationship is modeled. - * - * @param superType the super type for this UDT if any - * @since 1.4 (JDBC 3.0) - */ - public void setSuperType( UserDefinedType superType ) { - this.superType = superType; - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/provider/DatabaseMetadataProvider.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/provider/DatabaseMetadataProvider.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/provider/DatabaseMetadataProvider.java (working copy) @@ -1,117 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.provider; - -import java.io.Serializable; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.util.Properties; - -/** - * Database Meta data provider - * - * @author Sergiy Litsenko - */ -public interface DatabaseMetadataProvider extends Serializable { - // ~ Methods -------------------------------------------------------------------------- - - /** - * Releases database resources - * - * @param silently if true never generates Exception; otherwise mage rethrow RunTimeException - */ - void release( boolean silently ); - - /** - * Returns database metadata - * - * @return database metadata - * @throws Exception - */ - DatabaseMetaData getDatabaseMetaData() throws Exception; - - /** - * Returns database connection - * - * @return database connection - * @throws Exception - */ - Connection getConnection() throws Exception; - - /** - * Returns DatabaseMetadataProvider logical name - * - * @return the DatabaseMetadataProvider logical name - */ - String getName(); - - /** - * Sets the DatabaseMetadataProvider logical name - * - * @param name the DatabaseMetadataProvider logical name - */ - void setName( String name ); - - /** - * Get provider's notation for empty string - * - * @return provider's notation for empty string - */ - String getEmptyStringNotation(); - - /** - * Set provider's notation for empty string - * - * @param emptyStringNotation the provider's notation for empty string - */ - void setEmptyStringNotation( String emptyStringNotation ); - - /** - * Get provider's notation for NULL string - * - * @return provider's notation for NULL string - */ - String getNullStringNotation(); - - /** - * Set provider's notation for NULL string - * - * @param nullStringNotation the provider's notation for NULL string - */ - void setNullStringNotation( String nullStringNotation ); - - /** - * Returns provider properties - * - * @return provider properties - */ - Properties getProperties(); - - /** - * Sets the provider properties - * - * @param properties the provider properties - */ - void setProperties( Properties properties ); -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/provider/DataSourceDatabaseMetadataProvider.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/provider/DataSourceDatabaseMetadataProvider.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/provider/DataSourceDatabaseMetadataProvider.java (working copy) @@ -1,57 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.provider; - -import javax.sql.DataSource; - -/** - * DataSource based Database Metadata Provider (such as JEE App container based) - * - * @author Sergiy Litsenko - */ -public interface DataSourceDatabaseMetadataProvider extends DatabaseMetadataProvider { - // ~ Methods -------------------------------------------------------------------------- - - /** - * Returns DataSource - * - * @return DataSource - * @throws Exception - */ - DataSource getDataSource() throws Exception; - - /** - * Gets data source JNDI name - * - * @return data source JNDI name - */ - String getDataSourceName(); - - /** - * Sets data source JNDI name - * - * @param dataSourceName the data source JNDI name - */ - void setDataSourceName( String dataSourceName ); -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/provider/DefaultDatabaseMetadataProvider.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/provider/DefaultDatabaseMetadataProvider.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/provider/DefaultDatabaseMetadataProvider.java (working copy) @@ -1,236 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.provider; - -import org.jboss.dna.common.util.Logger; -import org.jboss.dna.common.jdbc.JdbcMetadataI18n; - -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.util.Properties; - -/** - * Default DatabaseMetadataProvider - * - * @author Sergiy Litsenko - */ -public abstract class DefaultDatabaseMetadataProvider implements DatabaseMetadataProvider { - // ~ Instance fields ------------------------------------------------------------------ - private static final long serialVersionUID = -4164910060171439260L; - private String name; - private Properties properties; - private String emptyStringNotation; - private String nullStringNotation; - - /** - * Logging for this instance - */ - protected Logger log = Logger.getLogger(getClass()); - - /** - * Database metadata - */ - protected DatabaseMetaData databaseMetaData; - - /** - * Datbase connection - */ - protected Connection connection; - - // ~ Constructors --------------------------------------------------------------------- - - /** - * Default Constructor - */ - public DefaultDatabaseMetadataProvider() { - } - - /** - * Constructor - * - * @param name the DatabaseMetadataProvider logical name - */ - public DefaultDatabaseMetadataProvider( String name ) { - this(); - setName(name); - } - - // ~ Methods -------------------------------------------------------------------------- - - /** - * Opens new database connection based on supplied parameters - * - * @return new database connection based on supplied parameters - * @throws Exception - */ - protected abstract Connection openConnection() throws Exception; - - /** - * Releases database resources - * - * @param silently if true never generates Exception; otherwise mage rethrow RunTimeException - */ - public void release( boolean silently ) { - // releases databaseMetaData - if (databaseMetaData != null) { - databaseMetaData = null; - } - - // releases connection - if (connection != null) { - try { - // close connection - connection.close(); - - log.debug (JdbcMetadataI18n.databaseConnectionHasBeenReleased.text(getName())); - } catch (Exception ex) { - log.error(JdbcMetadataI18n.errorClosingDatabaseConnection, ex); - - if (!silently) { - throw new RuntimeException( - JdbcMetadataI18n.errorClosingDatabaseConnection.text(getName()), ex); - } - } - } - } - - /** - * Returns database metadata - * - * @return database metadata - * @throws Exception - */ - public DatabaseMetaData getDatabaseMetaData() throws Exception { - // lazy load of database metadata - if (databaseMetaData == null) { - // log debug info - if (log.isDebugEnabled()) { - log.debug(String.format("Getting Database metadata for a provider %1$s", getName())); - } - - // obtains metadata from connection - databaseMetaData = getConnection().getMetaData(); - // log debug info - if (log.isDebugEnabled()) { - log.debug(String.format("Database metadata received for a provider %1$s", getName())); - } - } - - // return - return databaseMetaData; - } - - /** - * Returns database connection - * - * @return database connection - * @throws Exception - */ - public Connection getConnection() throws Exception { - // lazy open of connection - if (connection == null) { - // opens new connectection - connection = openConnection(); - - // log debug info - log.info(JdbcMetadataI18n.databaseConnectionHasBeenEstablished, getName()); - } - - // return - return connection; - } - - /** - * Returns DatabaseMetadataProvider logical name - * - * @return the DatabaseMetadataProvider logical name - */ - public String getName() { - // return - return name; - } - - /** - * Sets the DatabaseMetadataProvider logical name - * - * @param name the DatabaseMetadataProvider logical name - */ - public void setName( String name ) { - this.name = name; - } - - /** - * Get provider's notation for empty string - * - * @return provider's notation for empty string - */ - public String getEmptyStringNotation() { - return emptyStringNotation; - } - - /** - * Set provider's notation for empty string - * - * @param emptyStringNotation the provider's notation for empty string - */ - public void setEmptyStringNotation( String emptyStringNotation ) { - this.emptyStringNotation = emptyStringNotation; - } - - /** - * Get provider's notation for NULL string - * - * @return provider's notation for NULL string - */ - public String getNullStringNotation() { - return nullStringNotation; - } - - /** - * Set provider's notation for NULL string - * - * @param nullStringNotation the provider's notation for NULL string - */ - public void setNullStringNotation( String nullStringNotation ) { - this.nullStringNotation = nullStringNotation; - } - - /** - * Returns provider properties - * - * @return provider properties - */ - public Properties getProperties() { - return properties; - } - - /** - * Sets the provider properties - * - * @param properties the provider properties - */ - public void setProperties( Properties properties ) { - this.properties = properties; - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/provider/DefaultDataSourceDatabaseMetadataProvider.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/provider/DefaultDataSourceDatabaseMetadataProvider.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/provider/DefaultDataSourceDatabaseMetadataProvider.java (working copy) @@ -1,132 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.provider; - -import java.sql.Connection; -import javax.naming.InitialContext; -import javax.sql.DataSource; - -/** - * Default DataSource based DatabaseMetadataProvider - * - * @author Sergiy Litsenko - */ -public class DefaultDataSourceDatabaseMetadataProvider extends DefaultDatabaseMetadataProvider - implements DataSourceDatabaseMetadataProvider { - // ~ Instance fields ------------------------------------------------------------------ - - private static final long serialVersionUID = -405855619877872933L; - private String dataSourceName; - private DataSource dataSource; - - // ~ Constructors --------------------------------------------------------------------- - - /** - * Default Constructor - */ - public DefaultDataSourceDatabaseMetadataProvider() { - } - - /** - * Constructor - * - * @param name the DatabaseMetadataProvider logical name - */ - public DefaultDataSourceDatabaseMetadataProvider( String name ) { - super(name); - } - - // ~ Methods -------------------------------------------------------------------------- - - /** - * Opens new database connection based on suppied parameters - * - * @return new database connection based on suppied parameters - * @throws Exception - */ - @Override - protected Connection openConnection() throws Exception { - // log debug info - if (log.isDebugEnabled()) { - log.debug("Opening database connection from data source " + getDataSourceName()); - } - - // loads connection from data source - return getDataSource().getConnection(); - } - - /** - * Returns DataSource - * - * @return DataSource - * @throws Exception - */ - public DataSource getDataSource() throws Exception { - // lazy load data source - if (dataSource == null) { - // log debug info - if (log.isDebugEnabled()) { - log.debug("Creating JNDI initial context with following properties: " + getProperties()); - } - - // create initial context using properties if any - InitialContext initialContext = new InitialContext(getProperties()); - - try { - // log debug info - if (log.isDebugEnabled()) { - log.debug("Performing JNDI lookup for data source " + getDataSourceName()); - } - - // lookups datasource - dataSource = (DataSource)initialContext.lookup(getDataSourceName()); - } finally { - // close context - initialContext.close(); - } - } - - // return - return dataSource; - } - - /** - * Sets data source JNDI name - * - * @return data source JNDI name - */ - public String getDataSourceName() { - // return - return dataSourceName; - } - - /** - * Sets data source JNDI name - * - * @param dataSourceName the data source JNDI name - */ - public void setDataSourceName( String dataSourceName ) { - this.dataSourceName = dataSourceName; - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/provider/DefaultDriverDatabaseMetadataProvider.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/provider/DefaultDriverDatabaseMetadataProvider.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/provider/DefaultDriverDatabaseMetadataProvider.java (working copy) @@ -1,164 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.provider; - -import java.sql.Connection; -import java.sql.DriverManager; - -/** - * Default DatabaseMetadataProvider based on driver - * - * @author Sergiy Litsenko - */ -public class DefaultDriverDatabaseMetadataProvider extends DefaultDatabaseMetadataProvider - implements DriverDatabaseMetadataProvider { - // ~ Instance fields ------------------------------------------------------------------ - - private static final long serialVersionUID = -3616979905696406464L; - private String driverClassName; - private String databaseUrl; - private String userName; - private String password; - - // ~ Constructors --------------------------------------------------------------------- - - /** - * Default constructor - */ - public DefaultDriverDatabaseMetadataProvider() { - } - - /** - * Constructor - * - * @param name the DatabaseMetadataProvider logical name - */ - public DefaultDriverDatabaseMetadataProvider( String name ) { - super(name); - } - - // ~ Methods -------------------------------------------------------------------------- - - /** - * Opens new database connection based on suppied parameters - * - * @return new database connection based on suppied parameters - * @throws Exception - */ - @Override - protected Connection openConnection() throws Exception { - // log debug info - if (log.isDebugEnabled()) { - log.debug("Loading JDBC driver class: " + getDriverClassName()); - } - - // trying to load database driver by name - Class.forName(getDriverClassName()); - - // log debug info - if (log.isDebugEnabled()) { - log.debug("Opening database connection by using driver manager. The URL: " + getDatabaseUrl() + ". The user: " - + getUserName()); - } - - // opening connection by using Driver manager - return DriverManager.getConnection(getDatabaseUrl(), getUserName(), getPassword()); - } - - /** - * Gets JDBC driver class name - * - * @return the JDBC driver class name - */ - public String getDriverClassName() { - // return - return driverClassName; - } - - /** - * Sets JDBC driver class name - * - * @param driverClassName the JDBC driver class name - */ - public void setDriverClassName( String driverClassName ) { - this.driverClassName = driverClassName; - } - - /** - * Gets database URL as string - * - * @return database URL as string - */ - public String getDatabaseUrl() { - // return - return databaseUrl; - } - - /** - * Sets the database URL as string - * - * @param databaseUrl the database URL as string - */ - public void setDatabaseUrl( String databaseUrl ) { - this.databaseUrl = databaseUrl; - } - - /** - * Gets the user name - * - * @return the user name - */ - public String getUserName() { - // return - return userName; - } - - /** - * Sets the user name - * - * @param userName the user name - */ - public void setUserName( String userName ) { - this.userName = userName; - } - - /** - * Get user's password - * - * @return user's password - */ - public String getPassword() { - // return - return password; - } - - /** - * Sets the user's password - * - * @param password the user's password - */ - public void setPassword( String password ) { - this.password = password; - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/provider/DriverDatabaseMetadataProvider.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/provider/DriverDatabaseMetadataProvider.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/provider/DriverDatabaseMetadataProvider.java (working copy) @@ -1,89 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.provider; - -/** - * DatabaseMetadataProvider based on simple driver/connection - * - * @author Sergiy Litsenko - */ -public interface DriverDatabaseMetadataProvider extends DatabaseMetadataProvider { - // ~ Methods -------------------------------------------------------------------------- - - /** - * Gets JDBC driver class name - * - * @return the JDBC driver class name - */ - String getDriverClassName(); - - /** - * Sets JDBC driver class name - * - * @param driverClassName the JDBC driver class name - */ - void setDriverClassName( String driverClassName ); - - /** - * Gets database URL as string - * - * @return database URL as string - */ - String getDatabaseUrl(); - - /** - * Sets the database URL as string - * - * @param databaseUrl the database URL as string - */ - void setDatabaseUrl( String databaseUrl ); - - /** - * Gets the user name - * - * @return the user name - */ - String getUserName(); - - /** - * Sets the user name - * - * @param userName the user name - */ - void setUserName( String userName ); - - /** - * Get user's password - * - * @return user's password - */ - String getPassword(); - - /** - * Sets the user's password - * - * @param password the user's password - */ - void setPassword( String password ); -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/util/DatabaseUtil.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/util/DatabaseUtil.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/common/jdbc/util/DatabaseUtil.java (working copy) @@ -1,3494 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.util; - -import java.lang.reflect.Method; -import java.sql.DatabaseMetaData; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Types; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import org.apache.commons.beanutils.PropertyUtils; -import org.jboss.dna.common.jdbc.JdbcMetadataI18n; -import org.jboss.dna.common.jdbc.model.ModelFactory; -import org.jboss.dna.common.jdbc.model.api.Attribute; -import org.jboss.dna.common.jdbc.model.api.BestRowIdentifier; -import org.jboss.dna.common.jdbc.model.api.BestRowIdentifierScopeType; -import org.jboss.dna.common.jdbc.model.api.Catalog; -import org.jboss.dna.common.jdbc.model.api.ColumnPseudoType; -import org.jboss.dna.common.jdbc.model.api.Database; -import org.jboss.dna.common.jdbc.model.api.DatabaseMetaDataMethodException; -import org.jboss.dna.common.jdbc.model.api.ForeignKey; -import org.jboss.dna.common.jdbc.model.api.ForeignKeyColumn; -import org.jboss.dna.common.jdbc.model.api.Index; -import org.jboss.dna.common.jdbc.model.api.IndexColumn; -import org.jboss.dna.common.jdbc.model.api.IndexType; -import org.jboss.dna.common.jdbc.model.api.KeyDeferrabilityType; -import org.jboss.dna.common.jdbc.model.api.KeyModifyRuleType; -import org.jboss.dna.common.jdbc.model.api.NullabilityType; -import org.jboss.dna.common.jdbc.model.api.Parameter; -import org.jboss.dna.common.jdbc.model.api.ParameterIoType; -import org.jboss.dna.common.jdbc.model.api.PrimaryKey; -import org.jboss.dna.common.jdbc.model.api.PrimaryKeyColumn; -import org.jboss.dna.common.jdbc.model.api.Privilege; -import org.jboss.dna.common.jdbc.model.api.PrivilegeType; -import org.jboss.dna.common.jdbc.model.api.Reference; -import org.jboss.dna.common.jdbc.model.api.ResultSetConcurrencyType; -import org.jboss.dna.common.jdbc.model.api.ResultSetHoldabilityType; -import org.jboss.dna.common.jdbc.model.api.ResultSetType; -import org.jboss.dna.common.jdbc.model.api.SQLStateType; -import org.jboss.dna.common.jdbc.model.api.Schema; -import org.jboss.dna.common.jdbc.model.api.SearchabilityType; -import org.jboss.dna.common.jdbc.model.api.SortSequenceType; -import org.jboss.dna.common.jdbc.model.api.SqlType; -import org.jboss.dna.common.jdbc.model.api.SqlTypeInfo; -import org.jboss.dna.common.jdbc.model.api.StoredProcedure; -import org.jboss.dna.common.jdbc.model.api.StoredProcedureResultType; -import org.jboss.dna.common.jdbc.model.api.Table; -import org.jboss.dna.common.jdbc.model.api.TableColumn; -import org.jboss.dna.common.jdbc.model.api.TableType; -import org.jboss.dna.common.jdbc.model.api.TransactionIsolationLevelType; -import org.jboss.dna.common.jdbc.model.api.UserDefinedType; -import org.jboss.dna.common.util.Logger; - -/** - * Database related utilities - * - * @author Sergiy Litsenko - */ -public class DatabaseUtil { - /** - * Logging for this instance - */ - private static Logger log = Logger.getLogger(DatabaseUtil.class); - - /** - * Standard UDT types as string - */ - private static String standardUserDefinedTypes = "JAVA_OBJECT,STRUCT,DISTINCT"; - - private static Map standardUserDefinedTypesMapping = new HashMap(); - - static { - standardUserDefinedTypesMapping.put("JAVA_OBJECT", new Integer(SqlType.JAVA_OBJECT.getType())); - standardUserDefinedTypesMapping.put("STRUCT", new Integer(SqlType.STRUCT.getType())); - standardUserDefinedTypesMapping.put("DISTINCT", new Integer(SqlType.DISTINCT.getType())); - } - - // ~ Constructors --------------------------------------------------------------------- - - /** - * Constructor - */ - private DatabaseUtil() { - } - - // ~ Methods -------------------------------------------------------------------------- - - /** - * Returns Standard UDT types as string - * - * @return Standard UDT types as string - */ - public static String getStandardUserDefinedTypes() { - return standardUserDefinedTypes; - } - - /** - * Converts string array of UDT names to appropriate int array of UDT types specified in java.sql.Types - * - * @param userDefinedTypes the string array of UDT names - * @return int array of user defined types specified in java.sql.Types - */ - public static int[] getUserDefinedTypes( String userDefinedTypes ) { - // convert comma separated list of user defined types to array - String[] userDefinedTypesStringArray = (userDefinedTypes == null) ? null : userDefinedTypes.split(","); - // create UDT int array - int[] userDefinedTypesArray = new int[userDefinedTypesStringArray.length]; - // fill array - for (int i = 0; i < userDefinedTypesStringArray.length; i++) { - // get value from map - Integer udtType = standardUserDefinedTypesMapping.get(userDefinedTypesStringArray[i]); - // set int value - userDefinedTypesArray[i] = (udtType == null) ? Types.NULL : udtType.intValue(); - } - return userDefinedTypesArray; - } - - /** - * Returns boolean with respect to NULL values (ResultSet.wasNull()) - * - * @param resultSet the result set to fetch from - * @param columnName the name of column - * @return boolean with respect to NULL values (could be null) - * @throws SQLException - */ - public static Boolean getBoolean( ResultSet resultSet, - String columnName ) throws SQLException { - // check result set - if (resultSet == null) { - return null; - } - // get boolean - boolean value = resultSet.getBoolean(columnName); - // return - return (resultSet.wasNull()) ? null : (value == true) ? Boolean.TRUE : Boolean.FALSE; - } - - /** - * Returns boolean with respect to NULL values (ResultSet.wasNull()) - * - * @param resultSet the result set to fetch from - * @param columnName the name of column - * @param failOnError if true raises exception - * @return boolean with respect to NULL values (could be null) - * @throws SQLException - */ - public static Boolean getBoolean( ResultSet resultSet, - String columnName, - boolean failOnError ) throws SQLException { - // check result set - if (resultSet == null) { - return null; - } - // get boolean - boolean value = false; - try { - value = resultSet.getBoolean(columnName); - // return - return (resultSet.wasNull()) ? null : (value == true) ? Boolean.TRUE : Boolean.FALSE; - } catch (SQLException e) { - if (failOnError) { - throw e; - } - log.error(JdbcMetadataI18n.unableToGetValueFromColumn, columnName, e.getMessage()); - return null; - } - } - - /** - * Returns boolean with respect to NULL values (ResultSet.wasNull()) - * - * @param resultSet the result set to fetch from - * @param columnIndex the index of column - * @return boolean with respect to NULL values (could be null) - * @throws SQLException - */ - public static Boolean getBoolean( ResultSet resultSet, - int columnIndex ) throws SQLException { - // check result set - if (resultSet == null) { - return null; - } - // get boolean - boolean value = resultSet.getBoolean(columnIndex); - // return - return (resultSet.wasNull()) ? null : (value == true) ? Boolean.TRUE : Boolean.FALSE; - } - - /** - * Returns boolean with respect to NULL values (ResultSet.wasNull()) - * - * @param resultSet the result set to fetch from - * @param columnIndex the index of column - * @param failOnError if true raises exception - * @return boolean with respect to NULL values (could be null) - * @throws SQLException - */ - public static Boolean getBoolean( ResultSet resultSet, - int columnIndex, - boolean failOnError ) throws SQLException { - // check result set - if (resultSet == null) { - return null; - } - // get boolean - boolean value = false; - try { - value = resultSet.getBoolean(columnIndex); - // return - return (resultSet.wasNull()) ? null : (value == true) ? Boolean.TRUE : Boolean.FALSE; - } catch (SQLException e) { - if (failOnError) { - throw e; - } - log.error(JdbcMetadataI18n.unableToGetValueFromColumn, columnIndex, e.getMessage()); - return null; - } - } - - /** - * Returns integer with respect to NULL values (ResultSet.wasNull()) - * - * @param resultSet the result set to fetch from - * @param columnName the name of column - * @return integer with respect to NULL values (could be null) - * @throws SQLException - */ - public static Integer getInteger( ResultSet resultSet, - String columnName ) throws SQLException { - // check result set - if (resultSet == null) { - return null; - } - // get integer - int value = resultSet.getInt(columnName); - // return - return (resultSet.wasNull()) ? null : new Integer(value); - } - - /** - * Returns integer with respect to NULL values (ResultSet.wasNull()) - * - * @param resultSet the result set to fetch from - * @param columnName the name of column - * @param failOnError if true raises exception - * @return integer with respect to NULL values (could be null) - * @throws SQLException - */ - public static Integer getInteger( ResultSet resultSet, - String columnName, - boolean failOnError ) throws SQLException { - // check result set - if (resultSet == null) { - return null; - } - // get - int value = 0; - try { - value = resultSet.getInt(columnName); - // return - return (resultSet.wasNull()) ? null : new Integer(value); - - } catch (SQLException e) { - if (failOnError) { - throw e; - } - log.error(JdbcMetadataI18n.unableToGetValueFromColumn, columnName, e.getMessage()); - return null; - } - } - - /** - * Returns integer with respect to NULL values (ResultSet.wasNull()) - * - * @param resultSet the result set to fetch from - * @param columnIndex the index of column - * @return integer with respect to NULL values (could be null) - * @throws SQLException - */ - public static Integer getInteger( ResultSet resultSet, - int columnIndex ) throws SQLException { - // check result set - if (resultSet == null) { - return null; - } - // get integer - int value = resultSet.getInt(columnIndex); - // return - return (resultSet.wasNull()) ? null : new Integer(value); - } - - /** - * Returns integer with respect to NULL values (ResultSet.wasNull()) - * - * @param resultSet the result set to fetch from - * @param columnIndex the index of column - * @param failOnError if true raises exception - * @return integer with respect to NULL values (could be null) - * @throws SQLException - */ - public static Integer getInteger( ResultSet resultSet, - int columnIndex, - boolean failOnError ) throws SQLException { - // check result set - if (resultSet == null) { - return null; - } - // get - int value = 0; - try { - value = resultSet.getInt(columnIndex); - // return - return (resultSet.wasNull()) ? null : new Integer(value); - - } catch (SQLException e) { - if (failOnError) { - throw e; - } - log.error(JdbcMetadataI18n.unableToGetValueFromColumn, columnIndex, e.getMessage()); - return null; - } - } - - /** - * Returns long with respect to NULL values (ResultSet.wasNull()) - * - * @param resultSet the result set to fetch from - * @param columnName the name of column - * @return long with respect to NULL values (could be null) - * @throws SQLException - */ - public static Long getLong( ResultSet resultSet, - String columnName ) throws SQLException { - // check result set - if (resultSet == null) { - return null; - } - // get integer - long value = resultSet.getLong(columnName); - // return - return (resultSet.wasNull()) ? null : new Long(value); - } - - /** - * Returns long with respect to NULL values (ResultSet.wasNull()) - * - * @param resultSet the result set to fetch from - * @param columnName the name of column - * @param failOnError if true raises exception - * @return long with respect to NULL values (could be null) - * @throws SQLException - */ - public static Long getLong( ResultSet resultSet, - String columnName, - boolean failOnError ) throws SQLException { - // check result set - if (resultSet == null) { - return null; - } - // get - long value = 0; - try { - value = resultSet.getLong(columnName); - // return - return (resultSet.wasNull()) ? null : new Long(value); - - } catch (SQLException e) { - if (failOnError) { - throw e; - } - log.error(JdbcMetadataI18n.unableToGetValueFromColumn, columnName, e.getMessage()); - return null; - } - } - - /** - * Returns long with respect to NULL values (ResultSet.wasNull()) - * - * @param resultSet the result set to fetch from - * @param columnIndex the index of column - * @return long with respect to NULL values (could be null) - * @throws SQLException - */ - public static Long getLong( ResultSet resultSet, - int columnIndex ) throws SQLException { - // check result set - if (resultSet == null) { - return null; - } - // get integer - long value = resultSet.getLong(columnIndex); - // return - return (resultSet.wasNull()) ? null : new Long(value); - } - - /** - * Returns long with respect to NULL values (ResultSet.wasNull()) - * - * @param resultSet the result set to fetch from - * @param columnIndex the index of column - * @param failOnError if true raises exception - * @return long with respect to NULL values (could be null) - * @throws SQLException - */ - public static Long getLong( ResultSet resultSet, - int columnIndex, - boolean failOnError ) throws SQLException { - // check result set - if (resultSet == null) { - return null; - } - // get - long value = 0; - try { - value = resultSet.getLong(columnIndex); - // return - return (resultSet.wasNull()) ? null : new Long(value); - - } catch (SQLException e) { - if (failOnError) { - throw e; - } - log.error(JdbcMetadataI18n.unableToGetValueFromColumn, columnIndex, e.getMessage()); - return null; - } - } - - /** - * Returns double with respect to NULL values (ResultSet.wasNull()) - * - * @param resultSet the result set to fetch from - * @param columnName the name of column - * @return double with respect to NULL values (could be null) - * @throws SQLException - */ - public static Double getDouble( ResultSet resultSet, - String columnName ) throws SQLException { - // check result set - if (resultSet == null) { - return null; - } - // get integer - double value = resultSet.getDouble(columnName); - // return - return (resultSet.wasNull()) ? null : new Double(value); - } - - /** - * Returns double with respect to NULL values (ResultSet.wasNull()) - * - * @param resultSet the result set to fetch from - * @param columnName the name of column - * @param failOnError if true raises exception - * @return double with respect to NULL values (could be null) - * @throws SQLException - */ - public static Double getDouble( ResultSet resultSet, - String columnName, - boolean failOnError ) throws SQLException { - // check result set - if (resultSet == null) { - return null; - } - // get - double value = 0.0; - try { - value = resultSet.getLong(columnName); - // return - return (resultSet.wasNull()) ? null : new Double(value); - - } catch (SQLException e) { - if (failOnError) { - throw e; - } - log.error(JdbcMetadataI18n.unableToGetValueFromColumn, columnName, e.getMessage()); - return null; - } - } - - /** - * Returns double with respect to NULL values (ResultSet.wasNull()) - * - * @param resultSet the result set to fetch from - * @param columnIndex the index of column - * @return double with respect to NULL values (could be null) - * @throws SQLException - */ - public static Double getDouble( ResultSet resultSet, - int columnIndex ) throws SQLException { - // check result set - if (resultSet == null) { - return null; - } - // get integer - double value = resultSet.getDouble(columnIndex); - // return - return (resultSet.wasNull()) ? null : new Double(value); - } - - /** - * Returns double with respect to NULL values (ResultSet.wasNull()) - * - * @param resultSet the result set to fetch from - * @param columnIndex the index of column - * @param failOnError if true raises exception - * @return double with respect to NULL values (could be null) - * @throws SQLException - */ - public static Double getDouble( ResultSet resultSet, - int columnIndex, - boolean failOnError ) throws SQLException { - // check result set - if (resultSet == null) { - return null; - } - // get - double value = 0.0; - try { - value = resultSet.getLong(columnIndex); - // return - return (resultSet.wasNull()) ? null : new Double(value); - - } catch (SQLException e) { - if (failOnError) { - throw e; - } - log.error(JdbcMetadataI18n.unableToGetValueFromColumn, columnIndex, e.getMessage()); - return null; - } - } - - /** - * Returns String with respect to NULL values (ResultSet.wasNull()) - * - * @param resultSet the result set to fetch from - * @param columnName the name of column - * @return double with respect to NULL values (could be null) - * @throws SQLException - */ - public static String getString( ResultSet resultSet, - String columnName ) throws SQLException { - // check result set - if (resultSet == null) { - return null; - } - // get integer - String value = resultSet.getString(columnName); - // return - return (resultSet.wasNull()) ? null : value; - } - - /** - * Returns String with respect to NULL values (ResultSet.wasNull()) - * - * @param resultSet the result set to fetch from - * @param columnName the name of column - * @param failOnError if true raises exception - * @return double with respect to NULL values (could be null) - * @throws SQLException - */ - public static String getString( ResultSet resultSet, - String columnName, - boolean failOnError ) throws SQLException { - // check result set - if (resultSet == null) { - return null; - } - // get - String value = null; - try { - value = resultSet.getString(columnName); - // return - return (resultSet.wasNull()) ? null : value; - - } catch (SQLException e) { - if (failOnError) { - throw e; - } - log.error(JdbcMetadataI18n.unableToGetValueFromColumn, columnName, e.getMessage()); - return null; - } - } - - /** - * Returns String with respect to NULL values (ResultSet.wasNull()) - * - * @param resultSet the result set to fetch from - * @param columnIndex the index of column - * @return double with respect to NULL values (could be null) - * @throws SQLException - */ - public static String getString( ResultSet resultSet, - int columnIndex ) throws SQLException { - // check result set - if (resultSet == null) { - return null; - } - // get integer - String value = resultSet.getString(columnIndex); - // return - return (resultSet.wasNull()) ? null : value; - } - - /** - * Returns String with respect to NULL values (ResultSet.wasNull()) - * - * @param resultSet the result set to fetch from - * @param columnIndex the index of column - * @param failOnError if true raises exception - * @return double with respect to NULL values (could be null) - * @throws SQLException - */ - public static String getString( ResultSet resultSet, - int columnIndex, - boolean failOnError ) throws SQLException { - // check result set - if (resultSet == null) { - return null; - } - String value = null; - try { - value = resultSet.getString(columnIndex); - // return - return (resultSet.wasNull()) ? null : value; - - } catch (SQLException e) { - if (failOnError) { - throw e; - } - log.error(JdbcMetadataI18n.unableToGetValueFromColumn, columnIndex, e.getMessage()); - return null; - } - } - - /** - * Returns BestRowIdentifierScopeType or null - * - * @param type the best row identifier - * @return BestRowIdentifierScopeType or null - */ - public static BestRowIdentifierScopeType getBestRowIdentifierScopeType( Integer type ) { - // check input - if (type == null) { - return null; - } - // check for values - for (BestRowIdentifierScopeType sType : BestRowIdentifierScopeType.values()) { - if (sType.getScope() == type.intValue()) { - return sType; - } - } - // log only if not found - log.debug(String.format("[%s] Unknown best row identifier scope type %d", "getBestRowIdentifierScopeType", type)); - - return null; - } - - /** - * Returns ColumnPseudoType or null - * - * @param type the column pseudo type - * @return ColumnPseudoType or null - */ - public static ColumnPseudoType getColumnPseudoType( Integer type ) { - // check input - if (type == null) { - return null; - } - // check for values - for (ColumnPseudoType pType : ColumnPseudoType.values()) { - if (pType.getType() == type.intValue()) { - return pType; - } - } - // log only if not found - log.debug(String.format("[%s] Unknown column pseudo type %d", "getColumnPseudoType", type)); - - return null; - } - - /** - * Returns IndexType or null - * - * @param type the index type - * @return IndexType or null - */ - public static IndexType getIndexType( Integer type ) { - // check input - if (type == null) { - return null; - } - // check for values - for (IndexType iType : IndexType.values()) { - if (iType.getType() == type.intValue()) { - return iType; - } - } - // log only if not found - log.debug(String.format("[%s] Unknown index type %d", "getKeyDeferrabilityType", type)); - - return null; - } - - /** - * Returns KeyDeferrabilityType or null - * - * @param type the key defferability type - * @return KeyDeferrabilityType or null - */ - public static KeyDeferrabilityType getKeyDeferrabilityType( Integer type ) { - // check input - if (type == null) { - return null; - } - // check for values - for (KeyDeferrabilityType dType : KeyDeferrabilityType.values()) { - if (dType.getDeferrability() == type.intValue()) { - return dType; - } - } - // log only if not found - log.debug(String.format("[%s] Unknown key deferrability type %d", "getKeyDeferrabilityType", type)); - - return null; - } - - /** - * Returns KeyModifyRuleType or null - * - * @param type the key modify rule type - * @return KeyModifyRuleType or null - */ - public static KeyModifyRuleType getKeyModifyRuleType( Integer type ) { - // check input - if (type == null) { - return null; - } - // check for values - for (KeyModifyRuleType rType : KeyModifyRuleType.values()) { - if (rType.getRule() == type.intValue()) { - return rType; - } - } - // log only if not found - log.debug(String.format("[%s] Unknown key modify rule type %d", "getKeyModifyRuleType", type)); - - return null; - } - - /** - * Returns column nullability, or null - * - * @param type - * @return NullabilityType - */ - public static NullabilityType getNullabilityType( Integer type ) { - // check input - if (type == null) { - return null; - } - // check for values - for (NullabilityType nType : NullabilityType.values()) { - if (nType.getNullability() == type.intValue()) { - return nType; - } - } - // log only if not found - log.debug(String.format("[%s] Unknown nullability type %d", "getNullabilityType", type)); - - return null; - } - - /** - * Returns ParameterIoType based on type, or null - * - * @param type i/o type - * @return ParameterIoType based on type, or null - */ - public static ParameterIoType getParameterIoType( Integer type ) { - // check input - if (type == null) { - return null; - } - // check for values - for (ParameterIoType ioType : ParameterIoType.values()) { - if (ioType.getType() == type.intValue()) { - return ioType; - } - } - // log only if not found - log.debug(String.format("[%s] Unknown parameter I/O type %d", "getParameterIoType", type)); - - return null; - } - - /** - * Returns PrivilegeType or null - * - * @param type the privilege type - * @return PrivilegeType or null - */ - public static PrivilegeType getPrivilegeType( String type ) { - // check input - if (type == null) { - return null; - } - // check for values - for (PrivilegeType pType : PrivilegeType.values()) { - if (pType.getType().equals(type)) { - return pType; - } - } - // log only if not found - log.debug(String.format("[%s] Unknown privilege type %s", "getPrivilegeType", type)); - - return null; - } - - /** - * Returns ResultSetConcurrencyType or null - * - * @param type the concurrency - * @return ResultSetConcurrencyType or null - */ - public static ResultSetConcurrencyType getResultSetConcurrencyType( Integer type ) { - // check input - if (type == null) { - return null; - } - // check for values - for (ResultSetConcurrencyType cType : ResultSetConcurrencyType.values()) { - if (cType.getConcurrency() == type.intValue()) { - return cType; - } - } - // log only if not found - log.debug(String.format("[%s] Unknown result set concurrency type %d", "getResultSetConcurrencyType", type)); - - return null; - } - - /** - * Returns ResultSetHoldabilityType or null - * - * @param type the holdability - * @return ResultSetHoldabilityType or null - */ - public static ResultSetHoldabilityType getResultSetHoldabilityType( Integer type ) { - // check input - if (type == null) { - return null; - } - // check for values - for (ResultSetHoldabilityType hType : ResultSetHoldabilityType.values()) { - if (hType.getHoldability() == type.intValue()) { - return hType; - } - } - // log only if not found - log.debug(String.format("[%s] Unknown result set holdability type %d", "getResultSetHoldabilityType", type)); - - return null; - } - - /** - * Returns ResultSetType or null - * - * @param type the result set type - * @return ResultSetType or null - */ - public static ResultSetType getResultSetType( Integer type ) { - // check input - if (type == null) { - return null; - } - // check for values - for (ResultSetType rsType : ResultSetType.values()) { - if (rsType.getType() == type.intValue()) { - return rsType; - } - } - // log only if not found - log.debug(String.format("[%s] Unknown result set type %d", "getResultSetType", type)); - - return null; - } - - /** - * Returns SearchabilityType or null - * - * @param type the searchability - * @return SearchabilityType or null - */ - public static SearchabilityType getSearchabilityType( Integer type ) { - // check input - if (type == null) { - return null; - } - // check for values - for (SearchabilityType sType : SearchabilityType.values()) { - if (sType.getSearchability() == type.intValue()) { - return sType; - } - } - // log only if not found - log.debug(String.format("[%s] Unknown serachability type %d", "getSearchabilityType", type)); - - return null; - } - - /** - * Returns SortSequenceType or null - * - * @param type the sort sequence - * @return SortSequenceType or null - */ - public static SortSequenceType getSortSequenceType( String type ) { - // check input - if (type == null) { - return null; - } - // check for values - for (SortSequenceType sType : SortSequenceType.values()) { - if ((sType.getType() != null) && (sType.getType().equals(type))) { - return sType; - } - } - // log only if not found - log.debug(String.format("[%s] Unknown sort sequence type %s", "getSortSequenceType", type)); - - return null; - } - - /** - * Returns SqlStateType based on type, or null - * - * @param type the SQL state type - * @return SqlStateType based on type, or null - */ - public static SQLStateType getSqlStateType( Integer type ) { - // check input - if (type == null) { - return null; - } - // check for Type values - for (SQLStateType stateType : SQLStateType.values()) { - if (stateType.getState() == type.intValue()) { - return stateType; - } - } - // log only if not found - log.debug(String.format("[%s] Unknown SQL state type %d", "getSqlStateType", type)); - - return null; - } - - /** - * Returns SqlType based on data type, or null - * - * @param type the SQL type - * @return SqlType based on data type, or null - */ - public static SqlType getSqlType( Integer type ) { - // check input - if (type == null) { - return null; - } - // check for SqlType values - for (SqlType sqlType : SqlType.values()) { - if (sqlType.getType() == type.intValue()) { - return sqlType; - } - } - // log only if not found - log.debug(String.format("[%s] Unknown SQL Type %d", "getSqlType", type)); - - return null; - } - - /** - * Returns SP result type based on PROCEDURE_TYPE - * - * @param type the stored procedure result type - * @return SP result type based on PROCEDURE_TYPE, or null - */ - public static StoredProcedureResultType getStoredProcedureResultType( Integer type ) { - // check input - if (type == null) { - return null; - } - // check for SqlType values - for (StoredProcedureResultType spResultType : StoredProcedureResultType.values()) { - if (spResultType.getType() == type.intValue()) { - return spResultType; - } - } - // log only if not found - log.debug(String.format("[%s] Unknown stored procedure result type %d", "getStoredProcedureResultType", type)); - - return null; - } - - /** - * Returns transaction isolation level, or null - * - * @param type the level type - * @return transaction isolation level, or null - */ - public static TransactionIsolationLevelType getTransactionIsolationLevelType( Integer type ) { - // check input - if (type == null) { - return null; - } - // check for Type values - for (TransactionIsolationLevelType txType : TransactionIsolationLevelType.values()) { - if (txType.getLevel() == type.intValue()) { - return txType; - } - } - // log only if not found - log.debug(String.format("[%s] Unknown transaction isolation level type %d", "getTransactionIsolationLevelType", type)); - - return null; - } - - /** - * Creates catalog based on current record in result set; adds catalog to the database - * - * @param factory the model factory to create table - * @param resultSet the table result set from DatabaseMetadata - * @param traceLog the log to write if any - * @param failOnError - * @param database the owner database - * @return created catalog - * @throws Exception if any error occurs and failOnError is true then generates exception - */ - public static Catalog populateCatalog( ModelFactory factory, - ResultSet resultSet, - Logger traceLog, - boolean failOnError, - Database database ) throws Exception { - // check for null - if (factory == null) { - throw new IllegalArgumentException("factory"); - } - - // check for null - if (database == null) { - throw new IllegalArgumentException("database"); - } - - // check for null - if (resultSet == null) { - throw new IllegalArgumentException("resultSet"); - } - - // set trace log - if (traceLog == null) { - traceLog = log; - } - - // get type catalog - String catalogName = getString(resultSet, "TABLE_CAT", false); - - // create catalog object - Catalog catalog = factory.createCatalog(); - - // *************************** - // *** DatabaseNamedObject *** - // *************************** - - // set name - catalog.setName(catalogName); - // set remarks - // catalog.setRemarks (remarks); // N/A - // TODO set extra properties - // catalog.addExtraProperty (String key, Object value); - - // *************** - // *** Catalog *** - // *************** - - // add catalog to the list - database.addCatalog(catalog); - - // log - if (traceLog.isDebugEnabled()) { - traceLog.debug(String.format("[Database %s] The catalog '%s' has been added.", database.getName(), catalogName)); - } - - return catalog; - } - - /** - * Creates schema based on current record in result set; adds schema to the database - * - * @param factory the model factory to create table - * @param resultSet the table result set from DatabaseMetadata - * @param traceLog the log to write if any - * @param failOnError - * @param database the owner database - * @return created schema - * @throws Exception if any error occurs and failOnError is true then generates exception - */ - public static Schema populateSchema( ModelFactory factory, - ResultSet resultSet, - Logger traceLog, - boolean failOnError, - Database database ) throws Exception { - // check for null - if (factory == null) { - throw new IllegalArgumentException("factory"); - } - - // check for null - if (database == null) { - throw new IllegalArgumentException("database"); - } - - // check for null - if (resultSet == null) { - throw new IllegalArgumentException("resultSet"); - } - - // set trace log - if (traceLog == null) { - traceLog = log; - } - - // get schema name - String schemaName = getString(resultSet, "TABLE_SCHEM", false); - - // get catalog name - String catalogName = getString(resultSet, "TABLE_CATALOG", false); - - // create schema object - Schema schema = factory.createSchema(); - - // *************************** - // *** DatabaseNamedObject *** - // *************************** - - // set name - schema.setName(schemaName); - // set remarks - // schema.setRemarks (remarks); // N/A - // TODO set extra properties - // schema.addExtraProperty (String key, Object value); - - // *************** - // *** Schema *** - // *************** - - // check catalog name - if (catalogName != null) { - Catalog catalog = database.findCatalogByName(catalogName); - schema.setCatalog(catalog); - } - - // add schema to the list - database.addSchema(schema); - - // log - if (traceLog.isDebugEnabled()) { - traceLog.debug(String.format("[Database %s] The schema '%s' has been added.", database.getName(), schemaName)); - } - - return schema; - } - - /** - * Creates table types based on current record in result set; adds table types to the database - * - * @param factory the model factory to create table - * @param resultSet the table result set from DatabaseMetadata - * @param traceLog the log to write if any - * @param failOnError - * @param database the owner database - * @return created schema - * @throws Exception if any error occurs and failOnError is true then generates exception - */ - - public static TableType populateTableType( ModelFactory factory, - ResultSet resultSet, - Logger traceLog, - boolean failOnError, - Database database ) throws Exception { - // check for null - if (factory == null) { - throw new IllegalArgumentException("factory"); - } - - // check for null - if (database == null) { - throw new IllegalArgumentException("database"); - } - - // check for null - if (resultSet == null) { - throw new IllegalArgumentException("resultSet"); - } - - // set trace log - if (traceLog == null) { - traceLog = log; - } - - // get table type - String tableTypeName = getString(resultSet, "TABLE_TYPE", false); - - // create table type object - TableType tableType = factory.createTableType(); - - // *************************** - // *** DatabaseNamedObject *** - // *************************** - - // set name - tableType.setName(tableTypeName); - // set remarks - // schema.setRemarks (remarks); // N/A - // TODO set extra properties - // schema.addExtraProperty (String key, Object value); - - // *************** - // *** Table Type *** - // *************** - - // add table type to the list - database.addTableType(tableType); - - // log - if (traceLog.isDebugEnabled()) { - traceLog.debug(String.format("[Database %s] The table type '%s' has been added.", database.getName(), tableType)); - } - - return tableType; - } - - /** - * Creates stored procedure based on current record in result set; adds SP to the database - * - * @param factory the model factory to create SP - * @param resultSet the stored procedure result set from DatabaseMetadata - * @param traceLog the log to write if any - * @param failOnError - * @param database the owner database - * @return created SP - * @throws Exception if any error occurs and failOnError is true then generates exception - */ - public static StoredProcedure populateStoredProcedure( ModelFactory factory, - ResultSet resultSet, - Logger traceLog, - boolean failOnError, - Database database ) throws Exception { - // check for null - if (factory == null) { - throw new IllegalArgumentException("factory"); - } - - // check for null - if (database == null) { - throw new IllegalArgumentException("database"); - } - - // check for null - if (resultSet == null) { - throw new IllegalArgumentException("resultSet"); - } - - // set trace log - if (traceLog == null) { - traceLog = log; - } - - // get procedure catalog - String procedureCatalog = getString(resultSet, "PROCEDURE_CAT", false); - // get procedure schema - String procedureSchema = getString(resultSet, "PROCEDURE_SCHEM", false); - // get procedure name - String procedureName = getString(resultSet, "PROCEDURE_NAME", false); - // get remarks - String remarks = getString(resultSet, "REMARKS", false); - // get kind of procedure - Integer procedureType = getInteger(resultSet, "PROCEDURE_TYPE", false); - - // create Stored Procedure object - StoredProcedure sp = factory.createStoredProcedure(); - - // *************************** - // *** DatabaseNamedObject *** - // *************************** - - // set name - sp.setName(procedureName); - // set remarks - sp.setRemarks(remarks); - // TODO set extra properties - // sp.addExtraProperty (String key, Object value); - - // ******************** - // *** SchemaObject *** - // ******************** - - // set catalog - if ((procedureCatalog != null) && (procedureCatalog.trim().length() != 0)) { - // find catalog - Catalog catalog = database.findCatalogByName(procedureCatalog); - // set catalog - sp.setCatalog(catalog); - // warn if null - if (catalog == null) { - traceLog.debug(String.format("[Database %s] Unable to find catalog '%4$s' for the procedure %s (schema %s, catalog %s)", - database.getName(), - procedureName, - procedureSchema, - procedureCatalog)); - } - // if fail is enabled - if (failOnError && (catalog == null)) { - throw new DatabaseMetaDataMethodException("Catalog name shall be provided", "populateStoredProcedure"); - } - } - - // set schema - if ((procedureSchema != null) && (procedureSchema.trim().length() != 0)) { - // find schema - Schema schema = database.findSchemaByName(procedureCatalog, procedureSchema); - // set schema - sp.setSchema(schema); - // warn if null - if (schema == null) { - traceLog.debug(String.format("[Database %s] Unable to find schema '%3$s' for the procedure %s (schema %s, catalog %s)", - database.getName(), - procedureName, - procedureSchema, - procedureCatalog)); - } - // if fail is enabled - if (failOnError && (schema == null)) { - throw new DatabaseMetaDataMethodException("Schema name shall be provided", "populateStoredProcedure"); - } - } - - // *********************** - // *** StoredProcedure *** - // *********************** - - // set sp result type - sp.setResultType(getStoredProcedureResultType(procedureType)); - - // add SP to the list - database.addStoredProcedure(sp); - - // log - if (traceLog.isDebugEnabled()) { - traceLog.debug(String.format("[Database %s] The Stored procedure '%s' (schema %s, catalog %s) has been added.", - database.getName(), - procedureName, - procedureSchema, - procedureCatalog)); - } - - return sp; - } - - /** - * Creates stored procedure parameter based on current record in result set; adds SP parameter to the SP - * - * @param factory the model factory to create SP parameter - * @param resultSet the stored procedure parameter result set from DatabaseMetadata - * @param traceLog the log to write if any - * @param failOnError - * @param database the owner database - * @param storedProcedure the owner stored procedure - * @param ordinalPosition the parameter ordinal position - * @return created SP parameter - * @throws Exception if any error occurs and failOnError is true then generates exception - */ - public static Parameter populateStoredProcedureParameter( ModelFactory factory, - ResultSet resultSet, - Logger traceLog, - boolean failOnError, - Database database, - StoredProcedure storedProcedure, - int ordinalPosition ) throws Exception { - // check for null - if (factory == null) { - throw new IllegalArgumentException("factory"); - } - - // check for null - if (database == null) { - throw new IllegalArgumentException("database"); - } - - // check for null - if (resultSet == null) { - throw new IllegalArgumentException("resultSet"); - } - - // set trace log - if (traceLog == null) { - traceLog = log; - } - - // check for null - if (storedProcedure == null) { - throw new IllegalArgumentException("storedProcedure"); - } - // get procedure catalog - String procedureCatalog = (storedProcedure.getCatalog() == null) ? null : storedProcedure.getCatalog().getName(); - // get procedure schema - String procedureSchema = (storedProcedure.getSchema() == null) ? null : storedProcedure.getSchema().getName(); - // get procedure name - String procedureName = storedProcedure.getName(); - - // parameter name - String parameterName = getString(resultSet, "COLUMN_NAME", false); - // parameter i/o type - Integer parameterType = getInteger(resultSet, "COLUMN_TYPE", false); - // data type - Integer dataType = getInteger(resultSet, "DATA_TYPE", false); - // type name - String typeName = getString(resultSet, "TYPE_NAME", false); - // precision - Integer precision = getInteger(resultSet, "PRECISION", false); - // length - Integer length = getInteger(resultSet, "LENGTH", false); - // scale - Integer scale = getInteger(resultSet, "SCALE", false); - // radix - Integer radix = getInteger(resultSet, "RADIX", false); - // nullable - Integer nullableType = getInteger(resultSet, "NULLABLE", false); - // remarks - String remarks = getString(resultSet, "REMARKS", false); - - // create Stored Procedure Parameter object - Parameter parameter = factory.createParameter(); - - // *************************************** - // *** DatabaseNamedObject properties *** - // *************************************** - - // name - parameter.setName(parameterName); - // remarks - parameter.setRemarks(remarks); - // TODO set extra properties - // parameter.addExtraProperty (String key, Object value); - - // *************** - // *** Column *** - // *************** - - // owner - parameter.setOwner(storedProcedure); - // nullability - parameter.setNullabilityType(getNullabilityType(nullableType)); - // SQL type - parameter.setSqlType(getSqlType(dataType)); - // type name - parameter.setTypeName(typeName); - // Size - parameter.setSize(length); - // precision - parameter.setPrecision(precision); - // Radix - parameter.setRadix(radix); - // DefaultValue - parameter.setDefaultValue(null); // not defined among standard columns - // OrdinalPosition - parameter.setOrdinalPosition(ordinalPosition); - // CharOctetLength - parameter.setCharOctetLength(null); // N/A - // addPrivilege - // parameter.addPrivilege (privilege); // N/A - - // ***************** - // *** Parameter *** - // ***************** - - // i/o type - parameter.setIoType(getParameterIoType(parameterType)); - // scale - parameter.setScale(scale); - - // add parameter to the SP - storedProcedure.addParameter(parameter); - - // log - if (traceLog.isDebugEnabled()) { - traceLog.debug(String.format("[Database %s] The Stored procedure '%s' (schema %s, catalog %s) parameter %s has been added.", - database.getName(), - procedureName, - procedureSchema, - procedureCatalog, - parameterName)); - } - - return parameter; - } - - /** - * Creates table based on current record in result set; adds table to the database - * - * @param factory the model factory to create table - * @param resultSet the table result set from DatabaseMetadata - * @param traceLog the log to write if any - * @param failOnError - * @param database the owner database - * @return created table - * @throws Exception if any error occurs and failOnError is true then generates exception - */ - public static Table populateTable( ModelFactory factory, - ResultSet resultSet, - Logger traceLog, - boolean failOnError, - Database database ) throws Exception { - // check for null - if (factory == null) { - throw new IllegalArgumentException("factory"); - } - - // check for null - if (database == null) { - throw new IllegalArgumentException("database"); - } - - // check for null - if (resultSet == null) { - throw new IllegalArgumentException("resultSet"); - } - - // set trace log - if (traceLog == null) { - traceLog = log; - } - - // get catalog - String tableCatalog = getString(resultSet, "TABLE_CAT", false); - - // get schema - String tableSchema = getString(resultSet, "TABLE_SCHEM", false); - - // get name - String tableName = getString(resultSet, "TABLE_NAME", false); - // get type - String tableTypeName = getString(resultSet, "TABLE_TYPE", false); - // get remarks - String remarks = getString(resultSet, "REMARKS", false); - // get type catalog - String typeCatalogName = getString(resultSet, "TYPE_CAT", false); - - // get type schema - String typeSchemaName = getString(resultSet, "TYPE_SCHEM", false); - // get type name - String typeName = getString(resultSet, "TYPE_NAME", false); - // get self reeferencing column name - String selfRefColumnName = getString(resultSet, "SELF_REFERENCING_COL_NAME", false); - // get ref generation - String refGeneration = getString(resultSet, "REF_GENERATION", false); - - // create Table object - Table table = factory.createTable(); - - // *************************** - // *** DatabaseNamedObject *** - // *************************** - - // set name - table.setName(tableName); - // set remarks - table.setRemarks(remarks); - // TODO set extra properties - // table.addExtraProperty (String key, Object value); - - // ******************** - // *** SchemaObject *** - // ******************** - - // set catalog - if ((tableCatalog != null) && (tableCatalog.trim().length() != 0)) { - // find catalog - Catalog catalog = database.findCatalogByName(tableCatalog); - // set catalog - table.setCatalog(catalog); - // warn if null - if (catalog == null) { - traceLog.debug(String.format("[Database %s] Unable to find catalog '%4$s' for the table %s (schema %s, catalog %s)", - database.getName(), - tableName, - tableSchema, - tableCatalog)); - } - // if fail is enabled - if (failOnError) { - throw new DatabaseMetaDataMethodException("Catalog name shall be provided", "populateTable"); - - } - } - - // set schema - if ((tableSchema != null) && (tableSchema.trim().length() != 0)) { - // find schema - Schema schema = database.findSchemaByName(tableCatalog, tableSchema); - // set schema - table.setSchema(schema); - // warn if null - if (schema == null) { - traceLog.debug(String.format("[Database %s] Unable to find schema '%3$s' for the table %s (schema %s, catalog %s)", - database.getName(), - tableName, - tableSchema, - tableCatalog)); - } - // if fail is enabled - if (failOnError) { - throw new DatabaseMetaDataMethodException("Table name shall be provided", "populateTable"); - } - } - - // ************** - // *** Table *** - // ************** - - // set table type - if (tableTypeName != null) { - // create - TableType tableType = factory.createTableType(); - // fill - tableType.setName(tableTypeName); - // set type - table.setTableType(tableType); - } - - // set catalog - if ((typeCatalogName != null) && (typeCatalogName.trim().length() != 0)) { - // find catalog - Catalog typeCatalog = database.findCatalogByName(typeCatalogName); - // set type catalog - table.setTypeCatalog(typeCatalog); - // warn if null - if (typeCatalog == null) { - traceLog.debug(String.format("[Database %s] Unable to find catalog '%4$s' for the table %s (schema %s, catalog %s)", - database.getName(), - tableName, - tableSchema, - typeCatalogName)); - } - } - - // set schema - if ((typeSchemaName != null) && (typeSchemaName.trim().length() != 0)) { - // find schema - Schema typeSchema = database.findSchemaByName(typeCatalogName, typeSchemaName); - // set schema - table.setTypeSchema(typeSchema); - // warn if null - if (typeSchema == null) { - traceLog.debug(String.format("[Database %s] Unable to find schema '%3$s' for the table %s (schema %s, catalog %s)", - database.getName(), - tableName, - typeSchemaName, - typeCatalogName)); - } - // if fail is enabled - if (failOnError && (typeSchema == null)) { - throw new DatabaseMetaDataMethodException("Schema name shall be provided", "populateTable"); - } - } - - // set type name - table.setTypeName(typeName); - // set self referencing column name - table.setSelfReferencingColumnName(selfRefColumnName); - // set reference generation - table.setReferenceGeneration(refGeneration); - - // add table to the list - database.addTable(table); - - // log - if (traceLog.isDebugEnabled()) { - traceLog.debug(String.format("[Database %s] The table '%s' (schema %s, catalog %s) has been added.", - database.getName(), - tableName, - tableSchema, - tableCatalog)); - } - - return table; - } - - /** - * Creates table column based on current record in result set; adds column to the table - * - * @param factory the model factory to create SP parameter - * @param resultSet the stored procedure parameter result set from DatabaseMetadata - * @param traceLog the log to write if any - * @param failOnError - * @param database the owner database - * @param table the owner table - * @return created table column - * @throws Exception if any error occurs and failOnError is true then generates exception - */ - public static TableColumn populateTableColumn( ModelFactory factory, - ResultSet resultSet, - Logger traceLog, - boolean failOnError, - Database database, - Table table ) throws Exception { - // check for null - if (factory == null) { - throw new IllegalArgumentException("factory"); - } - - // check for null - if (database == null) { - throw new IllegalArgumentException("database"); - } - - // check for null - if (resultSet == null) { - throw new IllegalArgumentException("resultSet"); - } - - // set trace log - if (traceLog == null) { - traceLog = log; - } - - // check for null - if (table == null) { - throw new IllegalArgumentException("table"); - } - // get catalog name - String catalogName = (table.getCatalog() == null) ? null : table.getCatalog().getName(); - // get schema name - String schemaName = (table.getSchema() == null) ? null : table.getSchema().getName(); - // get table name - String tableName = table.getName(); - - // column name - String columnName = getString(resultSet, "COLUMN_NAME", false); - // data type - Integer dataType = getInteger(resultSet, "DATA_TYPE", false); - // type name - String typeName = getString(resultSet, "TYPE_NAME", false); - // size - Integer size = getInteger(resultSet, "COLUMN_SIZE", false); - // precision - Integer precision = getInteger(resultSet, "DECIMAL_DIGITS", false); - // radix - Integer radix = getInteger(resultSet, "NUM_PREC_RADIX", false); - // nullable - Integer nullableType = getInteger(resultSet, "NULLABLE", false); - // remarks - String remarks = getString(resultSet, "REMARKS", false); - // default value - String defaultValue = getString(resultSet, "COLUMN_DEF", false); - // character Octet Length - Integer charOctetLength = getInteger(resultSet, "CHAR_OCTET_LENGTH", false); - // ordinal position - Integer ordinalPosition = getInteger(resultSet, "ORDINAL_POSITION", false); - // is nullable string - // String isNullableString = getString(resultSet, "IS_NULLABLE", false); - // scope catalog - String scopeCatalog = getString(resultSet, "SCOPE_CATLOG", false); - // scope schema - String scopeSchema = getString(resultSet, "SCOPE_SCHEMA", false); - // scope table - String scopeTable = getString(resultSet, "SCOPE_TABLE", false); - // sourceDataType - Integer sourceDataType = getInteger(resultSet, "SOURCE_DATA_TYPE", false); - - // create table column object - TableColumn column = factory.createTableColumn(); - - // *************************************** - // *** DatabaseNamedObject properties *** - // *************************************** - - // name - column.setName(columnName); - // remarks - column.setRemarks(remarks); - // TODO set extra properties - // column.addExtraProperty (String key, Object value); - - // *************** - // *** Column *** - // *************** - - // owner - column.setOwner(table); - // nullability. The isNullableString is not used so far - column.setNullabilityType(getNullabilityType(nullableType)); - // SQL type - column.setSqlType(getSqlType(dataType)); - // type name - column.setTypeName(typeName); - // Size - column.setSize(size); - // precision - column.setPrecision(precision); - // Radix - column.setRadix(radix); - // DefaultValue - column.setDefaultValue(defaultValue); - // OrdinalPosition - column.setOrdinalPosition(ordinalPosition); - // CharOctetLength - column.setCharOctetLength(charOctetLength); - // addPrivilege - // column.addPrivilege (privilege); // - - // ******************** - // *** Table Column *** - // ******************** - - // pseudo type - column.setPseudoType(ColumnPseudoType.NOT_PSEUDO); - - // set reference - if ((scopeCatalog != null) || (scopeSchema != null) || (scopeTable != null) || (sourceDataType != null)) { - // create reference - Reference reference = factory.createReference(); - // set Source Data Type - reference.setSourceDataType(getSqlType(sourceDataType)); - // find table and set as source - reference.setSourceTable(database.findTableByName(scopeCatalog, scopeSchema, scopeTable)); - - // set reference - column.setReference(reference); - } - - // add column to the table - table.addColumn(column); - - // log - if (traceLog.isDebugEnabled()) { - traceLog.debug(String.format("[Database %s] The table '%s' (schema %s, catalog %s) column %s has been added.", - database.getName(), - tableName, - schemaName, - catalogName, - columnName)); - } - - return column; - } - - /** - * Creates table best row identifier based on current record in result set; adds best row identifier to the table - * - * @param factory the model factory to create SP parameter - * @param resultSet the stored procedure parameter result set from DatabaseMetadata - * @param traceLog the log to write if any - * @param failOnError - * @param database the owner database - * @param table the owner table - * @return created table best row identifier - * @throws Exception if any error occurs and failOnError is true then generates exception - */ - public static BestRowIdentifier populateBestRowIdentifier( ModelFactory factory, - ResultSet resultSet, - Logger traceLog, - boolean failOnError, - Database database, - Table table ) throws Exception { - // check for null - if (factory == null) { - throw new IllegalArgumentException("factory"); - } - - // check for null - if (database == null) { - throw new IllegalArgumentException("database"); - } - - // check for null - if (resultSet == null) { - throw new IllegalArgumentException("resultSet"); - } - - // set trace log - if (traceLog == null) { - traceLog = log; - } - - // check for null - if (table == null) { - throw new IllegalArgumentException("table"); - } - // get catalog name - String catalogName = (table.getCatalog() == null) ? null : table.getCatalog().getName(); - // get schema name - String schemaName = (table.getSchema() == null) ? null : table.getSchema().getName(); - // get table name - String tableName = table.getName(); - - // scope type - Integer scope = getInteger(resultSet, "SCOPE", false); - // column name - String columnName = getString(resultSet, "COLUMN_NAME", false); - // data type - Integer dataType = getInteger(resultSet, "DATA_TYPE", false); - // type name - String typeName = getString(resultSet, "TYPE_NAME", false); - // precision - Integer precision = getInteger(resultSet, "COLUMN_SIZE", false); - // scale - Integer scale = getInteger(resultSet, "DECIMAL_DIGITS", false); - // pseudoColumn - Integer pseudoColumn = getInteger(resultSet, "PSEUDO_COLUMN", false); - - // ************************************* - // *** BestRowIdentifier properties *** - // ************************************* - - // get scope type - BestRowIdentifierScopeType scopeType = getBestRowIdentifierScopeType(scope); - - // check not null - if (scopeType == null) { - // if exception generation is enabled then raise exception - invalid scope - if (failOnError == true) { - throw new IllegalArgumentException("scopeType"); - } - return null; - } - - // find table best row identifier object - BestRowIdentifier brId = table.findBestRowIdentifierByScopeType(scopeType); - // check if null - if (brId == null) { - // create - brId = factory.createBestRowIdentifier(); - } - - // set scope type - brId.setScopeType(scopeType); - - // determine if current record shows pseudo column - boolean isPseudoColumn = ((getColumnPseudoType(pseudoColumn) != null) && (getColumnPseudoType(pseudoColumn) == ColumnPseudoType.PSEUDO)); - - TableColumn column = null; - - if (isPseudoColumn) { - // create - column = factory.createTableColumn(); - - // *************************************** - // *** DatabaseNamedObject properties *** - // *************************************** - - // name - column.setName(columnName); - // remarks - // column.setRemarks (remarks); // N/A - // TODO set extra properties - // column.addExtraProperty (String key, Object value); - - // *************** - // *** Column *** - // *************** - - // owner - column.setOwner(table); - // SQL type - column.setSqlType(getSqlType(dataType)); - // type name - column.setTypeName(typeName); - // precision - column.setPrecision(precision); - // size - column.setSize(precision); - // scale - column.setRadix(scale); - // pseudo type - column.setPseudoType(getColumnPseudoType(pseudoColumn)); - // add to the table - table.addColumn(column); - } else { - // trying to find column - column = table.findColumnByName(columnName); - - // if column exists - if (column != null) { - // pseudo type - column.setPseudoType(getColumnPseudoType(pseudoColumn)); - } - } - - // if column exists - if (column != null) { - // add to the best row identifier - brId.addColumn(column); - } - - // add best row identifier to the table - table.addBestRowIdentifier(brId); - - // get scope type string - String scopeName = (brId.getScopeType() == null) ? null : brId.getScopeType().getName(); - - // log - if (traceLog.isDebugEnabled()) { - traceLog.debug(String.format("[Database %s] The table '%s' (schema %s, catalog %s) best row identifier with scope %s has been added.", - database.getName(), - tableName, - schemaName, - catalogName, - scopeName)); - } - - return brId; - } - - /** - * Creates table's primary key based on ALL records in result set; adds pk columns to the table's primary key - * - * @param factory the model factory to create SP parameter - * @param resultSet the stored procedure parameter result set from DatabaseMetadata - * @param traceLog the log to write if any - * @param failOnError - * @param database the owner database - * @param table the owner table - * @return created primary key - * @throws Exception if any error occurs and failOnError is true then generates exception - */ - public static PrimaryKey populatePrimaryKey( ModelFactory factory, - ResultSet resultSet, - Logger traceLog, - boolean failOnError, - Database database, - Table table ) throws Exception { - // check for null - if (factory == null) { - throw new IllegalArgumentException("factory"); - } - - // check for null - if (database == null) { - throw new IllegalArgumentException("database"); - } - - // check for null - if (resultSet == null) { - throw new IllegalArgumentException("resultSet"); - } - - // set trace log - if (traceLog == null) { - traceLog = log; - } - - // check for null - if (table == null) { - throw new IllegalArgumentException("table"); - } - // get catalog name - String catalogName = (table.getCatalog() == null) ? null : table.getCatalog().getName(); - // get schema name - String schemaName = (table.getSchema() == null) ? null : table.getSchema().getName(); - // get table name - String tableName = table.getName(); - // pk name - String primaryKeyName = null; // initially null - - // create table's primary key - PrimaryKey pk = factory.createPrimaryKey(); - - // *************************** - // *** DatabaseNamedObject *** - // *************************** - - // set name - // pk.setName (primaryKeyName); // it will be overriden later in this code - // set remarks - // pk.setRemarks (remarks); // N/A - - // TODO set extra properties - // table.addExtraProperty (String key, Object value); - - // ******************** - // *** SchemaObject *** - // ******************** - - // set catalog - pk.setCatalog(table.getCatalog()); - // set schema - pk.setSchema(table.getSchema()); - - // process all columns included into primary key - while (resultSet.next()) { - // get PK name - if (primaryKeyName == null) { - primaryKeyName = getString(resultSet, "PK_NAME", false); - // set name - pk.setName(primaryKeyName); - } - - // column name - String columnName = getString(resultSet, "COLUMN_NAME", false); - // sequence number within primary key - Integer ordinalPosition = getInteger(resultSet, "KEY_SEQ", false); - - // trying to find table column with specified name - TableColumn tableColumn = table.findColumnByName(columnName); - - String errMessage = null; - // warn if null - if (tableColumn == null) { - errMessage = String.format("[Database %s] Unable to find table column '%5$s' for the table %s (schema %s, catalog %s)", - database.getName(), - tableName, - schemaName, - catalogName, - columnName); - traceLog.debug(errMessage); - } - // if fail is enabled - if (failOnError && (tableColumn == null)) { - throw new DatabaseMetaDataMethodException(errMessage, "populatePrimaryKey"); - } - - // create PK column - PrimaryKeyColumn pkColumn = factory.createPrimaryKeyColumn(); - // check if we found the original table column - if (tableColumn != null) { - // mark original table column as part of PK - tableColumn.setPrimaryKeyColumn(Boolean.TRUE); - // clone properties from original table column to the pkcolumn - PropertyUtils.copyProperties(pkColumn, tableColumn); - } else { // recovery if table column is not found but we still want to create pk column - // set name at least - pkColumn.setName(columnName); - } - // modify ordinal position that correspond to the position in PK - pkColumn.setOrdinalPosition(ordinalPosition); - - // add PK column to the primary key - pk.addColumn(pkColumn); - } - - // set table primary key - table.setPrimaryKey(pk); - - // log - if (traceLog.isDebugEnabled()) { - traceLog.debug(String.format("[Database %s] The table '%s' (schema %s, catalog %s) primary key %s has been added.", - database.getName(), - tableName, - schemaName, - catalogName, - primaryKeyName)); - } - - return pk; - } - - /** - * Creates table's foreign keys based on ALL records in result set; adds fk columns to the table's foreing key - * - * @param factory the model factory to create SP parameter - * @param resultSet the stored procedure parameter result set from DatabaseMetadata - * @param traceLog the log to write if any - * @param failOnError - * @param database the owner database - * @param table the owner table - * @return created list of foreign keys - * @throws Exception if any error occurs and failOnError is true then generates exception - */ - public static Set populateForeignKeys( ModelFactory factory, - ResultSet resultSet, - Logger traceLog, - boolean failOnError, - Database database, - Table table ) throws Exception { - // check for null - if (factory == null) { - throw new IllegalArgumentException("factory"); - } - - // check for null - if (database == null) { - throw new IllegalArgumentException("database"); - } - - // check for null - if (resultSet == null) { - throw new IllegalArgumentException("resultSet"); - } - - // set trace log - if (traceLog == null) { - traceLog = log; - } - - // check for null - if (table == null) { - throw new IllegalArgumentException("table"); - } - // get catalog name - String catalogName = (table.getCatalog() == null) ? null : table.getCatalog().getName(); - // get schema name - String schemaName = (table.getSchema() == null) ? null : table.getSchema().getName(); - // get table name - String tableName = table.getName(); - - // create table's foreign key - ForeignKey fk = factory.createForeignKey(); - - // process all columns included into foreign key - while (resultSet.next()) { - // primary key table catalog being imported - String pkTableCatalogName = getString(resultSet, "PKTABLE_CAT", false); - // primary key table schema being imported - String pkTableSchemaName = getString(resultSet, "PKTABLE_SCHEM", false); - // primary key table name being imported - String pkTableName = getString(resultSet, "PKTABLE_NAME", false); - // primary key column name being imported - String pkColumnName = getString(resultSet, "PKCOLUMN_NAME", false); - - // FK table name, schema and catalog are already known, so it is useless to fetch - - // foreign key column name - String fkColumnName = getString(resultSet, "FKCOLUMN_NAME", false); - // sequence number within foreign key - Integer ordinalPosition = getInteger(resultSet, "KEY_SEQ", false); - // update rule - What happens to a foreign key when the primary key is updated - Integer updateRule = getInteger(resultSet, "UPDATE_RULE", false); - // delete rule - What happens to the foreign key when primary is deleted - Integer deleteRule = getInteger(resultSet, "DELETE_RULE", false); - // foreign key name - String foreignKeyName = getString(resultSet, "FK_NAME", false); - // primary key name - //String primaryKeyName = getString(resultSet, "PK_NAME", false); - // can the evaluation of foreign key constraints be deferred until commit - Integer defferability = getInteger(resultSet, "DEFERRABILITY", false); - - // - // check if FK name has been set earlier and current record shows different FK - - // so we need to add FK (previous) to the table - // - if ((fk.getName() != null) && (!fk.getName().equals(foreignKeyName))) { - // add previous FK to the table - table.addForeignKey(fk); - - // log - if (traceLog.isTraceEnabled()) { - traceLog.trace(String.format("[Database %s] The table '%s' (schema %s, catalog %s) foreign key %s has been added.", - database.getName(), - tableName, - schemaName, - catalogName, - foreignKeyName)); - } - - // create new FK if a record is not last - fk = factory.createForeignKey(); - } else { - - // *************************** - // *** DatabaseNamedObject *** - // *************************** - - // set FK name - fk.setName(foreignKeyName); - // set remarks - // fk.setRemarks (remarks); // N/A - - // TODO set extra properties - // fk.addExtraProperty (String key, Object value); - - // ******************** - // *** SchemaObject *** - // ******************** - - // set catalog - fk.setCatalog(table.getCatalog()); - // set schema - fk.setSchema(table.getSchema()); - - // *************************** - // *** ForeignKey *** - // *************************** - - // trying to find table column with specified name - TableColumn tableColumn = table.findColumnByName(fkColumnName); - - String errMessage = null; - // warn if null - if (tableColumn == null) { - errMessage = String.format("[Database %s] Unable to find table column '%5$s' for the table %s (schema %s, catalog %s)", - database.getName(), - tableName, - schemaName, - catalogName, - fkColumnName); - traceLog.debug(errMessage); - } - // if fail is enabled - if (failOnError && (tableColumn == null)) { - throw new DatabaseMetaDataMethodException(errMessage, "populateForeignKeys"); - } - - // create FK column - ForeignKeyColumn fkColumn = factory.createForeignKeyColumn(); - - // check if we found the original table column - if (tableColumn != null) { - // mark original table column as part of FK - tableColumn.setForeignKeyColumn(Boolean.TRUE); - // clone properties from original table column to the fkcolumn - PropertyUtils.copyProperties(fkColumn, tableColumn); - } else { // recovery if table column is not found but we still want to create fk column - // set name at least - fkColumn.setName(fkColumnName); - } - // modify ordinal position that correspond to the position in FK - fkColumn.setOrdinalPosition(ordinalPosition); - - // check for PK table and corresponding PK column - Table pkTable = database.findTableByName(pkTableCatalogName, pkTableSchemaName, pkTableName); - // sets the scope table of a foreign key. - fk.setSourceTable(pkTable); - // find PK - PrimaryKey pk = (pkTable == null) ? null : pkTable.getPrimaryKey(); - // set - fk.setSourcePrimaryKey(pk); - - // What happens to a foreign key when the primary key is updated - fk.setUpdateRule(getKeyModifyRuleType(updateRule)); - // What happens to a foreign key when the primary key is deleted - fk.setDeleteRule(getKeyModifyRuleType(deleteRule)); - // Can the evaluation of foreign key constraints be deferred until commit - fk.setDeferrability(getKeyDeferrabilityType(defferability)); - - // find PK table column - TableColumn pkColumn = (pkTable == null) ? null : pkTable.findColumnByName(pkColumnName); - // Sets mapped source column (in PK/source table) for this foreign key column - fkColumn.setSourceColumn(pkColumn); - - // add FK column to the foreign key - fk.addColumn(fkColumn); - } - } - - // add FK to the table - table.addForeignKey(fk); - // log - if (traceLog.isDebugEnabled()) { - traceLog.debug(String.format("[Database %s] The table '%s' (schema %s, catalog %s) foreign key %s has been added.", - database.getName(), - tableName, - schemaName, - catalogName, - fk.getName())); - } - - // return set of created FK - return table.getForeignKeys(); - } - - /** - * Creates table's indexes based on ALL records in result set; adds columns to the table's index - * - * @param factory the model factory to create SP parameter - * @param resultSet the stored procedure parameter result set from DatabaseMetadata - * @param traceLog the log to write if any - * @param failOnError - * @param database the owner database - * @param table the owner table - * @return created list of index - * @throws Exception if any error occurs and failOnError is true then generates exception - */ - public static Set populateIndexes( ModelFactory factory, - ResultSet resultSet, - Logger traceLog, - boolean failOnError, - Database database, - Table table ) throws Exception { - // check for null - if (factory == null) { - throw new IllegalArgumentException("factory"); - } - - // check for null - if (database == null) { - throw new IllegalArgumentException("database"); - } - - // check for null - if (resultSet == null) { - throw new IllegalArgumentException("resultSet"); - } - - // set trace log - if (traceLog == null) { - traceLog = log; - } - - // check for null - if (table == null) { - throw new IllegalArgumentException("table"); - } - // get catalog name - String catalogName = (table.getCatalog() == null) ? null : table.getCatalog().getName(); - // get schema name - String schemaName = (table.getSchema() == null) ? null : table.getSchema().getName(); - // get table name - String tableName = table.getName(); - - // create table's index - Index index = factory.createIndex(); - - // process all columns included into index - while (resultSet.next()) { - // table name, schema and catalog are already known, so it is useless to fetch - - // Can index values be non-unique - Boolean nonUnique = getBoolean(resultSet, "NON_UNIQUE", false); - // index catalog - String indexQualifier = getString(resultSet, "INDEX_QUALIFIER", false); - // index name ; null when TYPE is tableIndexStatistic - String indexName = getString(resultSet, "INDEX_NAME", false); - // index type - Integer indexType = getInteger(resultSet, "TYPE", false); - // sequence number within index - Integer ordinalPosition = getInteger(resultSet, "ORDINAL_POSITION", false); - // index column name - String indexColumnName = getString(resultSet, "COLUMN_NAME", false); - // column sort sequence, "A" => ascending, "D" => descending, may be null if sort sequence is not supported; - // null when TYPE is tableIndexStatistic - String ascOrDesc = getString(resultSet, "ASC_OR_DESC", false); - // cardinality; When TYPE is tableIndexStatistic, then this is the number of rows in the table; - // otherwise, it is the number of unique values in the index. - Integer cardinality = getInteger(resultSet, "CARDINALITY", false); - // pages; When TYPE is tableIndexStatisic then this is the number of pages used for the table, - // otherwise it is the number of pages used for the current index. - Integer pages = getInteger(resultSet, "PAGES", false); - // filter condition if any (may be null) - String filterCondition = getString(resultSet, "FILTER_CONDITION", false); - - // - // check if index name has been set earlier and current record shows different index - - // so we need to add index (previous) to the table - // - if ((index.getName() != null) && (!index.getName().equals(indexName))) { - // add previous FK to the table - table.addIndex(index); - - // log - if (traceLog.isDebugEnabled()) { - traceLog.debug(String.format("[Database %s] The table '%s' (schema %s, catalog %s) index %s has been added.", - database.getName(), - tableName, - schemaName, - catalogName, - indexName)); - } - - // create new index if a record is not last - index = factory.createIndex(); - } else { - - // *************************** - // *** DatabaseNamedObject *** - // *************************** - - // set name - index.setName(indexName); - // set remarks - // index.setRemarks (remarks); // N/A - - // TODO set extra properties - // index.addExtraProperty (String key, Object value); - - // ******************** - // *** SchemaObject *** - // ******************** - - // set catalog; index catalog me be defined by indexQualifier - index.setCatalog((indexQualifier == null) ? table.getCatalog() : database.findCatalogByName(indexQualifier)); - // set schema - index.setSchema(table.getSchema()); - - // *************************** - // *** Index *** - // *************************** - - // set unique as inversion of non unique - index.setUnique(nonUnique == null ? null : (nonUnique.booleanValue() == true) ? Boolean.FALSE : Boolean.TRUE); - // set Index Type - index.setIndexType(getIndexType(indexType)); - // set Cardinality - index.setCardinality(cardinality); - // set Pages - index.setPages(pages); - // set filter condition - index.setFilterCondition(filterCondition); - - // trying to find table column with specified name - TableColumn tableColumn = table.findColumnByName(indexColumnName); - - String errMessage = null; - // warn if null - if (tableColumn == null) { - errMessage = String.format("[Database %s] Unable to find table column '%5$s' for the table %s (schema %s, catalog %s)", - database.getName(), - tableName, - schemaName, - catalogName, - indexColumnName); - traceLog.debug(errMessage); - } - // if fail is enabled - if (failOnError && (tableColumn == null)) { - throw new DatabaseMetaDataMethodException(errMessage, "populateIndexes"); - - } - - // create index column - IndexColumn indexColumn = factory.createIndexColumn(); - - // check if we found the original table column - if (tableColumn != null) { - // mark original table column as part of index - tableColumn.setIndexColumn(Boolean.TRUE); - // clone properties from original table column to the index column - PropertyUtils.copyProperties(indexColumn, tableColumn); - } else { // recovery if table column is not found but we still want to create index column - // set name at least - indexColumn.setName(indexColumnName); - } - // modify ordinal position that correspond to the position in index - indexColumn.setOrdinalPosition(ordinalPosition); - // sort sequence type - indexColumn.setSortSequenceType(getSortSequenceType(ascOrDesc)); - - // add index column to the index - index.addColumn(indexColumn); - } - - } - - // add index to the table - table.addIndex(index); - // log - if (traceLog.isDebugEnabled()) { - traceLog.debug(String.format("[Database %s] The table '%s' (schema %s, catalog %s) index %s has been added.", - database.getName(), - tableName, - schemaName, - catalogName, - index.getName())); - } - - // return set of created indexes - return table.getIndexes(); - } - - /** - * Creates table's version column (if pseudo) based on current record in result set; adds column to the table - * - * @param factory the model factory to create SP parameter - * @param resultSet the stored procedure parameter result set from DatabaseMetadata - * @param traceLog the log to write if any - * @param failOnError - * @param database the owner database - * @param table the owner table - * @return created/updated version table column - * @throws Exception if any error occurs and failOnError is true then generates exception - */ - public static TableColumn populateVersionColumn( ModelFactory factory, - ResultSet resultSet, - Logger traceLog, - boolean failOnError, - Database database, - Table table ) throws Exception { - // check for null - if (factory == null) { - throw new IllegalArgumentException("factory"); - } - - // check for null - if (database == null) { - throw new IllegalArgumentException("database"); - } - - // check for null - if (resultSet == null) { - throw new IllegalArgumentException("resultSet"); - } - - // set trace log - if (traceLog == null) { - traceLog = log; - } - - // check for null - if (table == null) { - throw new IllegalArgumentException("table"); - } - - // get catalog name - String catalogName = (table.getCatalog() == null) ? null : table.getCatalog().getName(); - // get schema name - String schemaName = (table.getSchema() == null) ? null : table.getSchema().getName(); - // get table name - String tableName = table.getName(); - - // column name - String columnName = getString(resultSet, "COLUMN_NAME", false); - // data type - Integer dataType = getInteger(resultSet, "DATA_TYPE", false); - // type name - String typeName = getString(resultSet, "TYPE_NAME", false); - // size - Integer size = getInteger(resultSet, "COLUMN_SIZE", false); - // column length in bytes - // Integer bufferLength = getInteger(resultSet, "BUFFER_LENGTH", false); - // precision - Integer precision = getInteger(resultSet, "DECIMAL_DIGITS", false); - - // pseudo Column Type - Integer columnPseudoType = getInteger(resultSet, "PSEUDO_COLUMN", false); - - // find table column object - TableColumn column = table.findColumnByName(columnName); - - // create new - if (column == null) { - // creating column if not found (it is pseudo) - column = factory.createTableColumn(); - - // *************************************** - // *** DatabaseNamedObject properties *** - // *************************************** - - // name - column.setName(columnName); - - // *************** - // *** Column *** - // *************** - - // owner - column.setOwner(table); - // SQL type - column.setSqlType(getSqlType(dataType)); - // type name - column.setTypeName(typeName); - // Size - column.setSize(size); - // precision - column.setPrecision(precision); - // OrdinalPosition - column.setOrdinalPosition(null); // N/A - - // ******************** - // *** Table Column *** - // ******************** - - // add column to the table - table.addColumn(column); - } - - // set pseudo type - column.setPseudoType(getColumnPseudoType(columnPseudoType)); - - // log - if (traceLog.isDebugEnabled()) { - traceLog.debug(String.format("[Database %s] The table '%s' (schema %s, catalog %s) column %s has been updated or added.", - database.getName(), - tableName, - schemaName, - catalogName, - columnName)); - } - - return column; - } - - /** - * Creates table's privileges based on ALL records in result set; - * - * @param factory the model factory to create SP parameter - * @param resultSet the stored procedure parameter result set from DatabaseMetadata - * @param traceLog the log to write if any - * @param failOnError - * @param database the owner database - * @param table the owner table - * @return created list of privileges - * @throws Exception if any error occurs and failOnError is true then generates exception - */ - public static Set populateTablePrivileges( ModelFactory factory, - ResultSet resultSet, - Logger traceLog, - boolean failOnError, - Database database, - Table table ) throws Exception { - // check for null - if (factory == null) { - throw new IllegalArgumentException("factory"); - } - - // check for null - if (database == null) { - throw new IllegalArgumentException("database"); - } - - // check for null - if (resultSet == null) { - throw new IllegalArgumentException("resultSet"); - } - - // set trace log - if (traceLog == null) { - traceLog = log; - } - - // check for null - if (table == null) { - throw new IllegalArgumentException("table"); - } - // get catalog name - String catalogName = (table.getCatalog() == null) ? null : table.getCatalog().getName(); - // get schema name - String schemaName = (table.getSchema() == null) ? null : table.getSchema().getName(); - // get table name - String tableName = table.getName(); - - // process all privileges - while (resultSet.next()) { - // grantor of access (may be null) - String grantor = getString(resultSet, "GRANTOR", false); - // grantee of access - String grantee = getString(resultSet, "GRANTEE", false); - // name of access (SELECT, INSERT, UPDATE, REFRENCES, ...) - String privilegeName = getString(resultSet, "PRIVILEGE", false); - // grantable string; "YES" if grantee is permitted to grant to others; "NO" if not; null if unknown - String isGrantableStr = getString(resultSet, "IS_GRANTABLE", false); - - // create table's privilege - Privilege privilege = factory.createPrivilege(); - // set name - privilege.setName(privilegeName); - // set PrivilegeType - privilege.setPrivilegeType(getPrivilegeType(privilegeName)); - // set Grantor - privilege.setGrantor(grantor); - // set Grantee - privilege.setGrantee(grantee); - // set Grantable - privilege.setGrantable("YES".equals(isGrantableStr) == true ? Boolean.TRUE : ("NO".equals(isGrantableStr) == true ? Boolean.FALSE : null)); - - // add privilege - table.addPrivilege(privilege); - // log - if (traceLog.isDebugEnabled()) { - traceLog.debug(String.format("[Database %s] The table '%s' (schema %s, catalog %s) privilege %s has been added.", - database.getName(), - tableName, - schemaName, - catalogName, - privilegeName)); - } - } - - // return - return table.getPrivileges(); - } - - /** - * Creates table's column privileges based on ALL records in result set; - * - * @param factory the model factory to create SP parameter - * @param resultSet the stored procedure parameter result set from DatabaseMetadata - * @param traceLog the log to write if any - * @param failOnError - * @param database the owner database - * @param table the owner table - * @param column the table column - * @return created list of privileges - * @throws Exception if any error occurs and failOnError is true then generates exception - */ - public static Set populateTableColumnPrivileges( ModelFactory factory, - ResultSet resultSet, - Logger traceLog, - boolean failOnError, - Database database, - Table table, - TableColumn column ) throws Exception { - // check for null - if (factory == null) { - throw new IllegalArgumentException("factory"); - } - - // check for null - if (database == null) { - throw new IllegalArgumentException("database"); - } - - // check for null - if (resultSet == null) { - throw new IllegalArgumentException("resultSet"); - } - - // set trace log - if (traceLog == null) { - traceLog = log; - } - - // check for null - if (table == null) { - throw new IllegalArgumentException("table"); - } - - // check for null - if (column == null) { - throw new IllegalArgumentException("column"); - } - - // get catalog name - String catalogName = (table.getCatalog() == null) ? null : table.getCatalog().getName(); - // get schema name - String schemaName = (table.getSchema() == null) ? null : table.getSchema().getName(); - // get table name - String tableName = table.getName(); - - // process all privileges - while (resultSet.next()) { - // grantor of access (may be null) - String grantor = getString(resultSet, "GRANTOR", false); - // grantee of access - String grantee = getString(resultSet, "GRANTEE", false); - // name of access (SELECT, INSERT, UPDATE, REFRENCES, ...) - String privilegeName = getString(resultSet, "PRIVILEGE", false); - // grantable string; "YES" if grantee is permitted to grant to others; "NO" if not; null if unknown - String isGrantableStr = getString(resultSet, "IS_GRANTABLE", false); - - // create table's privilege - Privilege privilege = factory.createPrivilege(); - // set name - privilege.setName(privilegeName); - // set PrivilegeType - privilege.setPrivilegeType(getPrivilegeType(privilegeName)); - // set Grantor - privilege.setGrantor(grantor); - // set Grantee - privilege.setGrantee(grantee); - // set Grantable - privilege.setGrantable("YES".equals(isGrantableStr) == true ? Boolean.TRUE : ("NO".equals(isGrantableStr) == true ? Boolean.FALSE : null)); - - // add privilege - column.addPrivilege(privilege); - // log - if (traceLog.isDebugEnabled()) { - traceLog.debug(String.format("[Database %s] The table '%s' (schema %s, catalog %s) column %s privilege %s has been added.", - database.getName(), - tableName, - schemaName, - catalogName, - column.getName(), - privilegeName)); - } - } - - // return - return column.getPrivileges(); - } - - /** - * Creates SQL type info based on current record in result set; adds SQL type info to the database - * - * @param factory the model factory to create table - * @param resultSet the table result set from DatabaseMetadata - * @param traceLog the log to write if any - * @param failOnError - * @param database the owner database - * @return created SQL type info - * @throws Exception if any error occurs and failOnError is true then generates exception - */ - public static SqlTypeInfo populateSqlTypeInfo( ModelFactory factory, - ResultSet resultSet, - Logger traceLog, - boolean failOnError, - Database database ) throws Exception { - // check for null - if (factory == null) { - throw new IllegalArgumentException("factory"); - } - - // check for null - if (database == null) { - throw new IllegalArgumentException("database"); - } - - // check for null - if (resultSet == null) { - throw new IllegalArgumentException("resultSet"); - } - - // set trace log - if (traceLog == null) { - traceLog = log; - } - - // get type name - String typeName = getString(resultSet, "TYPE_NAME", false); - // data type - Integer dataType = getInteger(resultSet, "DATA_TYPE", false); - // precision - Long precision = getLong(resultSet, "PRECISION", false); - // literal prefix - String literalPrefix = getString(resultSet, "LITERAL_PREFIX", false); - // literal suffix - String literalSuffix = getString(resultSet, "LITERAL_SUFFIX", false); - // create params - String createParams = getString(resultSet, "CREATE_PARAMS", false); - // nullable - Integer nullableType = getInteger(resultSet, "NULLABLE", false); - // case sensitive - Boolean caseSensitive = getBoolean(resultSet, "CASE_SENSITIVE", false); - // searchable - Integer searchableType = getInteger(resultSet, "SEARCHABLE", false); - // is it unsigned - Boolean unsignedAttribute = getBoolean(resultSet, "UNSIGNED_ATTRIBUTE", false); - // is it fixed precision scale (can it be a money value) - Boolean fixedPrecisionScale = getBoolean(resultSet, "FIXED_PREC_SCALE", false); - // can it be used for an auto-increment value - Boolean autoIncrement = getBoolean(resultSet, "AUTO_INCREMENT", false); - // get local type name - String localTypeName = getString(resultSet, "LOCAL_TYPE_NAME", false); - // min scale supported - Integer minScale = getInteger(resultSet, "MINIMUM_SCALE", false); - // max scale supported - Integer maxScale = getInteger(resultSet, "MAXIMUM_SCALE", false); - // radix - Integer radix = getInteger(resultSet, "NUM_PREC_RADIX", false); - - // create SQL type info object - SqlTypeInfo typeInfo = factory.createSqlTypeInfo(); - - // *************************** - // *** DatabaseNamedObject *** - // *************************** - - // set name - typeInfo.setName(typeName); - // set remarks - // typeInfo.setRemarks (remarks); // N/A - // TODO set extra properties - // typeInfo.addExtraProperty (String key, Object value); - - // ******************* - // *** SqlTypeInfo *** - // ******************* - - // Localized type name - typeInfo.setLocalizedTypeName(localTypeName); - // SQL type nullability - typeInfo.setNullabilityType(getNullabilityType(nullableType)); - // SQL type from java.sql.Types - typeInfo.setSqlType(getSqlType(dataType)); - // precision - typeInfo.setPrecision(precision); - // fixed precision scale - typeInfo.setFixedPrecisionScale(fixedPrecisionScale); - // number precision radix - typeInfo.setNumberPrecisionRadix(radix); - // minimum scale supported - typeInfo.setMinScale(minScale); - // maximum scale supported - typeInfo.setMaxScale(maxScale); - // literal prefix - typeInfo.setLiteralPrefix(literalPrefix); - // literal suffix - typeInfo.setLiteralSuffix(literalSuffix); - // parameters used in creating the type (may be null) - typeInfo.setCreateParams(createParams); - // Case Sensitive - typeInfo.setCaseSensitive(caseSensitive); - // searchability type - typeInfo.setSearchabilityType(getSearchabilityType(searchableType)); - // Unsigned - typeInfo.setUnsigned(unsignedAttribute); - // Auto Increment - typeInfo.setAutoIncrement(autoIncrement); - - // add SQL type info to the list - database.addSqlTypeInfo(typeInfo); - - // log - if (traceLog.isDebugEnabled()) { - traceLog.debug(String.format("[Database %s] The SQL type '%s' has been added.", database.getName(), typeName)); - } - - return typeInfo; - } - - /** - * Creates UDT based on current record in result set; adds UDT to the database - * - * @param factory the model factory to create table - * @param resultSet the table result set from DatabaseMetadata - * @param traceLog the log to write if any - * @param failOnError - * @param database the owner database - * @return created UDT - * @throws Exception if any error occurs and failOnError is true then generates exception - */ - public static UserDefinedType populateUDT( ModelFactory factory, - ResultSet resultSet, - Logger traceLog, - boolean failOnError, - Database database ) throws Exception { - // check for null - if (factory == null) { - throw new IllegalArgumentException("factory"); - } - - // check for null - if (database == null) { - throw new IllegalArgumentException("database"); - } - - // check for null - if (resultSet == null) { - throw new IllegalArgumentException("resultSet"); - } - - // set trace log - if (traceLog == null) { - traceLog = log; - } - - // get type catalog - String udtCatalog = getString(resultSet, "TYPE_CAT", false); - // get type schema - String udtSchema = getString(resultSet, "TYPE_SCHEM", false); - // get type name - String udtName = getString(resultSet, "TYPE_NAME", false); - // get class name - String className = getString(resultSet, "CLASS_NAME", false); - // get data type - Integer dataType = getInteger(resultSet, "DATA_TYPE", false); - // get remarks - String remarks = getString(resultSet, "REMARKS", false); - // get base type - Integer baseType = getInteger(resultSet, "BASE_TYPE", false); - - // create UDT object - UserDefinedType udt = factory.createUserDefinedType(); - - // *************************** - // *** DatabaseNamedObject *** - // *************************** - - // set name - udt.setName(udtName); - // set remarks - udt.setRemarks(remarks); - // TODO set extra properties - // udt.addExtraProperty (String key, Object value); - - // ******************** - // *** SchemaObject *** - // ******************** - - // set catalog - if ((udtCatalog != null) && (udtCatalog.trim().length() != 0)) { - // find catalog - Catalog catalog = database.findCatalogByName(udtCatalog); - // set catalog - udt.setCatalog(catalog); - - String errMessage = null; - // warn if null - if (catalog == null) { - errMessage = String.format("[Database %s] Unable to find catalog '%4$s' for the UDT %s (schema %s, catalog %s)", - database.getName(), - udtName, - udtSchema, - udtCatalog); - traceLog.debug(errMessage); - } - // if fail is enabled - if (failOnError) { - throw new DatabaseMetaDataMethodException(errMessage, "populateUDT"); - } - } - - // set schema - if ((udtSchema != null) && (udtSchema.trim().length() != 0)) { - // find schema - Schema schema = database.findSchemaByName(udtCatalog, udtSchema); - // set schema - udt.setSchema(schema); - - String errMessage = null; - // warn if null - if (schema == null) { - errMessage = String.format("[Database %s] Unable to find schema '%3$s' for the UDT %s (schema %s, catalog %s)", - database.getName(), - udtName, - udtSchema, - udtCatalog); - traceLog.debug(errMessage); - } - // if fail is enabled - if (failOnError) { - throw new DatabaseMetaDataMethodException(errMessage, "populateUTD"); - - } - } - - // ************** - // *** UDT *** - // ************** - - // class name - udt.setClassName(className); - // SQL type - udt.setSqlType(getSqlType(dataType)); - // base type - udt.setBaseType(getSqlType(baseType)); - - // add UDT to the list - database.addUserDefinedType(udt); - - // log - if (traceLog.isDebugEnabled()) { - traceLog.debug(String.format("[Database %s] The UDT '%s' (schema %s, catalog %s) has been added.", - database.getName(), - udtName, - udtSchema, - udtCatalog)); - } - - return udt; - } - - /** - * Creates UDT attribute based on current record in result set; adds attribute to the UDT - * - * @param factory the model factory to create SP parameter - * @param resultSet the stored procedure parameter result set from DatabaseMetadata - * @param traceLog the log to write if any - * @param failOnError - * @param database the owner database - * @param udt the owner UDT - * @return created UDT attribute - * @throws Exception if any error occurs and failOnError is true then generates exception - */ - public static Attribute populateUDTAttribute( ModelFactory factory, - ResultSet resultSet, - Logger traceLog, - boolean failOnError, - Database database, - UserDefinedType udt ) throws Exception { - // check for null - if (factory == null) { - throw new IllegalArgumentException("factory"); - } - - // check for null - if (database == null) { - throw new IllegalArgumentException("database"); - } - - // check for null - if (resultSet == null) { - throw new IllegalArgumentException("resultSet"); - } - - // set trace log - if (traceLog == null) { - traceLog = log; - } - - // check for null - if (udt == null) { - throw new IllegalArgumentException("udt"); - } - // get catalog name - String catalogName = (udt.getCatalog() == null) ? null : udt.getCatalog().getName(); - // get schema name - String schemaName = (udt.getSchema() == null) ? null : udt.getSchema().getName(); - // get UDT name - String udtName = udt.getName(); - - // column name - String columnName = getString(resultSet, "ATTR_NAME", false); - // data type - Integer dataType = getInteger(resultSet, "DATA_TYPE", false); - // type name - String typeName = getString(resultSet, "ATTR_TYPE_NAME", false); - // size - Integer size = getInteger(resultSet, "ATTR_SIZE", false); - // precision - Integer precision = getInteger(resultSet, "DECIMAL_DIGITS", false); - // radix - Integer radix = getInteger(resultSet, "NUM_PREC_RADIX", false); - // nullable - Integer nullableType = getInteger(resultSet, "NULLABLE", false); - // remarks - String remarks = getString(resultSet, "REMARKS", false); - // default value - String defaultValue = getString(resultSet, "ATTR_DEF", false); - // character Octet Length - Integer charOctetLength = getInteger(resultSet, "CHAR_OCTET_LENGTH", false); - // ordinal position - Integer ordinalPosition = getInteger(resultSet, "ORDINAL_POSITION", false); - // is nullable string - // String isNullableString = getString(resultSet, "IS_NULLABLE", false); - // scope catalog - String scopeCatalog = getString(resultSet, "SCOPE_CATLOG", false); - // scope schema - String scopeSchema = getString(resultSet, "SCOPE_SCHEMA", false); - // scope table - String scopeTable = getString(resultSet, "SCOPE_TABLE", false); - // sourceDataType - Integer sourceDataType = getInteger(resultSet, "SOURCE_DATA_TYPE", false); - - // create UDT attribute object - Attribute column = factory.createAttribute(); - - // *************************************** - // *** DatabaseNamedObject properties *** - // *************************************** - - // name - column.setName(columnName); - // remarks - column.setRemarks(remarks); - // TODO set extra properties - // column.addExtraProperty (String key, Object value); - - // *************** - // *** Column *** - // *************** - - // owner - column.setOwner(udt); - // nullability. The isNullableString is not used so far - column.setNullabilityType(getNullabilityType(nullableType)); - // SQL type - column.setSqlType(getSqlType(dataType)); - // type name - column.setTypeName(typeName); - // Size - column.setSize(size); - // precision - column.setPrecision(precision); - // Radix - column.setRadix(radix); - // DefaultValue - column.setDefaultValue(defaultValue); - // OrdinalPosition - column.setOrdinalPosition(ordinalPosition); - // CharOctetLength - column.setCharOctetLength(charOctetLength); - // addPrivilege - // column.addPrivilege (privilege); // - - // ******************** - // *** Attribute *** - // ******************** - - // set reference - if ((scopeCatalog != null) || (scopeSchema != null) || (scopeTable != null) || (sourceDataType != null)) { - // create reference - Reference reference = factory.createReference(); - // set Source Data Type - reference.setSourceDataType(getSqlType(sourceDataType)); - // find table and set as source - reference.setSourceTable(database.findTableByName(scopeCatalog, scopeSchema, scopeTable)); - - // set reference - column.setReference(reference); - } - - // add attribute to the UDT - udt.addAttribute(column); - - // log - if (traceLog.isDebugEnabled()) { - traceLog.debug(String.format("[Database %s] The UDT '%s' (schema %s, catalog %s) attribute %s has been added.", - database.getName(), - udtName, - schemaName, - catalogName, - columnName)); - } - - return column; - } - - /** - * Updates UDT super type info based on current record in result set - * - * @param factory the model factory to create SP parameter - * @param resultSet the stored procedure parameter result set from DatabaseMetadata - * @param traceLog the log to write if any - * @param failOnError - * @param database the owner database - * @param udt the UDT to update - * @throws Exception if any error occurs and failOnError is true then generates exception - */ - public static void updateUDTSuperType( ModelFactory factory, - ResultSet resultSet, - Logger traceLog, - boolean failOnError, - Database database, - UserDefinedType udt ) throws Exception { - // check for null - if (factory == null) { - throw new IllegalArgumentException("factory"); - } - - // check for null - if (database == null) { - throw new IllegalArgumentException("database"); - } - - // check for null - if (resultSet == null) { - throw new IllegalArgumentException("resultSet"); - } - - // set trace log - if (traceLog == null) { - traceLog = log; - } - - // check for null - if (udt == null) { - throw new IllegalArgumentException("udt"); - } - // get catalog name - String catalogName = (udt.getCatalog() == null) ? null : udt.getCatalog().getName(); - // get schema name - String schemaName = (udt.getSchema() == null) ? null : udt.getSchema().getName(); - // get UDT name - String udtName = udt.getName(); - - // super type catalog - String superTypeCatalog = getString(resultSet, "SUPERTYPE_CAT", false); - // super type schema - String superTypeSchema = getString(resultSet, "SUPERTYPE_SCHEM", false); - // super type - String superTypeName = getString(resultSet, "SUPERTYPE_NAME", false); - - // *********************** - // *** UserDefinedType *** - // *********************** - - // set super type if found in database - udt.setSuperType(database.findUserDefinedTypeByName(superTypeCatalog, superTypeSchema, superTypeName)); - - // log - if (udt.getSuperType() != null) { - traceLog.debug(String.format("[Database %s] The UDT '%s' (schema %s, catalog %s) has super type %s (schema %s, catalog %s).", - database.getName(), - udtName, - schemaName, - catalogName, - superTypeName, - superTypeSchema, - superTypeCatalog)); - } - } - - /** - * Updates table super table info based on current record in result set - * - * @param factory the model factory to create SP parameter - * @param resultSet the stored procedure parameter result set from DatabaseMetadata - * @param traceLog the log to write if any - * @param failOnError - * @param database the owner database - * @param table the table to update - * @throws Exception if any error occurs and failOnError is true then generates exception - */ - public static void updateTableSuperTable( ModelFactory factory, - ResultSet resultSet, - Logger traceLog, - boolean failOnError, - Database database, - Table table ) throws Exception { - // check for null - if (factory == null) { - throw new IllegalArgumentException("factory"); - } - - // check for null - if (database == null) { - throw new IllegalArgumentException("database"); - } - - // check for null - if (resultSet == null) { - throw new IllegalArgumentException("resultSet"); - } - - // set trace log - if (traceLog == null) { - traceLog = log; - } - - // check for null - if (table == null) { - throw new IllegalArgumentException("table"); - } - // get catalog name - String catalogName = (table.getCatalog() == null) ? null : table.getCatalog().getName(); - // get schema name - String schemaName = (table.getSchema() == null) ? null : table.getSchema().getName(); - // get table name - String tableName = table.getName(); - - // super table name - String superTableName = getString(resultSet, "SUPERTABLE_NAME", false); - - // ************* - // *** Table *** - // ************* - - // set super table if found in database - table.setSuperTable(database.findTableByName(catalogName, schemaName, tableName)); - - // log - if (table.getSuperTable() != null) { - traceLog.debug(String.format("[Database %s] The table '%s' (schema %s, catalog %s) has super table %s.", - database.getName(), - tableName, - schemaName, - catalogName, - superTableName)); - } - } - - /** - * Get simple database metadata for the getter method (no input parameters) - * @param the return type - * @param instance the instance of database metadata implementation - * @param methodName the full name of a getter method to execute - * @param traceLog the log - * @return simple database metadata for the getter method - */ - @SuppressWarnings("unchecked") - public static T getDatabaseMetadataProperty (DatabaseMetaData instance, String methodName, Logger traceLog) { - try { - // acces to the instance's RTTI - Method m = instance.getClass().getDeclaredMethod (methodName); - // trying to execute method without parameters - return (T) m.invoke(instance); - } catch (Exception e) { - traceLog.debug(String.format ("Unable to execute getDatabaseMetadata for the '%1$s' method - %2$s: %3$s", - methodName, e.getClass().getName(), e.getMessage())); - // default is null - return null; - } - } -} Index: extensions/dna-common-jdbc/src/main/java/org/jboss/dna/graph/sequencers/JdbcSequencer.java =================================================================== --- extensions/dna-common-jdbc/src/main/java/org/jboss/dna/graph/sequencers/JdbcSequencer.java (revision 1450) +++ extensions/dna-common-jdbc/src/main/java/org/jboss/dna/graph/sequencers/JdbcSequencer.java (working copy) @@ -1,50 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. -* See the AUTHORS.txt file in the distribution for a full listing of -* individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.graph.sequencers; - -import java.sql.Connection; -import org.jboss.dna.graph.sequencer.StreamSequencerContext; -import org.jboss.dna.graph.sequencer.SequencerOutput; - -/** - * The interface for a DNA sequencer that processes a JDBC connection (for instance, JDBC Metadata) and stores in the repository. - *

- * Implementations must provide a no-argument constructor. - *

- * - * @author Sergiy Litsenko - */ -public interface JdbcSequencer { - - /** - * Sequence the data found in the a JDBC connection (for instance, JDBC Metadata). - * - * @param connection the JDBC connection to be sequenced; never null - * @param output the output from the sequencing operation; never null - * @param context the context for the sequencing operation; never null - */ - void sequence( Connection connection, - SequencerOutput output, - StreamSequencerContext context ); -} Index: extensions/dna-common-jdbc/src/main/resources/org/jboss/dna/common/jdbc/JdbcMetadataI18n.properties =================================================================== --- extensions/dna-common-jdbc/src/main/resources/org/jboss/dna/common/jdbc/JdbcMetadataI18n.properties (revision 1450) +++ extensions/dna-common-jdbc/src/main/resources/org/jboss/dna/common/jdbc/JdbcMetadataI18n.properties (working copy) @@ -1,27 +0,0 @@ -# -# JBoss DNA (http://www.jboss.org/dna) -# See the COPYRIGHT.txt file distributed with this work for information -# regarding copyright ownership. Some portions may be licensed -# to Red Hat, Inc. under one or more contributor license agreements. -# See the AUTHORS.txt file in the distribution for a full listing of -# individual contributors. -# -# JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA -# is licensed to you under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# JBoss DNA is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# -databaseConnectionHasBeenReleased=Database connection has been released for a provider {0} -errorClosingDatabaseConnection=Error closing database connection for a provider {0} -databaseConnectionHasBeenEstablished=Database connection has been established for a provider {0} -unableToGetValueFromColumn=Unable to get value from a column with name {0}: {1} \ No newline at end of file Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/ModelFactoryTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/ModelFactoryTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/ModelFactoryTest.java (working copy) @@ -1,229 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model; - -import junit.framework.TestCase; - -/** - * Model factory test - * - * @author Sergiy Litsenko - */ -public class ModelFactoryTest extends TestCase { - // ~ Instance fields ------------------------------------------------------------------ - - private DefaultModelFactory modelFactory; - - // ~ Methods -------------------------------------------------------------------------- - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - - // create - modelFactory = new DefaultModelFactory(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - // release - modelFactory = null; - super.tearDown(); - } - - /** - * COMMENT - */ - public void testCreateAttribute() { - // check that we're really create database model object - assertNotNull("Unable to create Attribute", modelFactory.createAttribute()); - } - - /** - * COMMENT - */ - public void testCreateBestRowIdentifier() { - // check that we're really create database model object - assertNotNull("Unable to create BestRowIdentifier", modelFactory.createBestRowIdentifier()); - } - - /** - * COMMENT - */ - public void testCreateCatalog() { - // check that we're really create database model object - assertNotNull("Unable to create Catalog", modelFactory.createCatalog()); - } - - /** - * COMMENT - */ - public void testCreateDatabase() { - // check that we're really create database model object - assertNotNull("Unable to create Database", modelFactory.createDatabase()); - } - - /** - * COMMENT - */ - public void testCreateForeignKey() { - // check that we're really create database model object - assertNotNull("Unable to create ForeignKey", modelFactory.createForeignKey()); - } - - /** - * COMMENT - */ - public void testCreateForeignKeyColumn() { - // check that we're really create database model object - assertNotNull("Unable to create ForeignKeyColumn", modelFactory.createForeignKeyColumn()); - } - - /** - * COMMENT - */ - public void testCreateIndex() { - // check that we're really create database model object - assertNotNull("Unable to create Index", modelFactory.createIndex()); - } - - /** - * COMMENT - */ - public void testCreateIndexColumn() { - // check that we're really create database model object - assertNotNull("Unable to create IndexColumn", modelFactory.createIndexColumn()); - } - - /** - * COMMENT - */ - public void testCreateParameter() { - // check that we're really create database model object - assertNotNull("Unable to create Parameter", modelFactory.createParameter()); - } - - /** - * COMMENT - */ - public void testCreatePrimaryKey() { - // check that we're really create database model object - assertNotNull("Unable to create PrimaryKey", modelFactory.createPrimaryKey()); - } - - /** - * COMMENT - */ - public void testCreatePrimaryKeyColumn() { - // check that we're really create database model object - assertNotNull("Unable to create PrimaryKeyColumn", modelFactory.createPrimaryKeyColumn()); - } - - /** - * COMMENT - */ - public void testCreatePrivilege() { - // check that we're really create database model object - assertNotNull("Unable to create Privilege", modelFactory.createPrivilege()); - } - - /** - * COMMENT - */ - public void testCreateReference() { - // check that we're really create database model object - assertNotNull("Unable to create Reference", modelFactory.createReference()); - } - - /** - * COMMENT - */ - public void testCreateSchema() { - // check that we're really create database model object - assertNotNull("Unable to create Schema", modelFactory.createSchema()); - } - - /** - * COMMENT - */ - public void testCreateSqlTypeConversionPair() { - // check that we're really create database model object - assertNotNull("Unable to create SqlTypeConversionPair", modelFactory.createSqlTypeConversionPair()); - } - - /** - * COMMENT - */ - public void testCreateSqlTypeInfo() { - // check that we're really create database model object - assertNotNull("Unable to create SqlTypeInfo", modelFactory.createSqlTypeInfo()); - } - - /** - * COMMENT - */ - public void testCreateStoredProcedure() { - // check that we're really create database model object - assertNotNull("Unable to create StoredProcedure", modelFactory.createStoredProcedure()); - } - - /** - * COMMENT - */ - public void testCreateTable() { - // check that we're really create database model object - assertNotNull("Unable to create Table", modelFactory.createTable()); - } - - /** - * COMMENT - */ - public void testCreateTableColumn() { - // check that we're really create database model object - assertNotNull("Unable to create TableColumn", modelFactory.createTableColumn()); - } - - /** - * COMMENT - */ - public void testCreateTableType() { - // check that we're really create database model object - assertNotNull("Unable to create TableType", modelFactory.createTableType()); - } - - /** - * COMMENT - */ - public void testCreateUserDefinedType() { - // check that we're really create database model object - assertNotNull("Unable to create UserDefinedType", modelFactory.createUserDefinedType()); - } - -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/AttributeBeanTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/AttributeBeanTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/AttributeBeanTest.java (working copy) @@ -1,69 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import junit.framework.TestCase; -import org.jboss.dna.common.jdbc.model.DefaultModelFactory; -import org.jboss.dna.common.jdbc.model.api.Attribute; -import org.jboss.dna.common.jdbc.model.api.Reference; - -/** - * AttributeBean test - * - * @author Sergiy Litsenko - */ -public class AttributeBeanTest extends TestCase { - - private Attribute bean; - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - // create - bean = new AttributeBean(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - // release - bean = null; - super.tearDown(); - } - - public void testSetReference() { - // create reference - Reference reference = new DefaultModelFactory().createReference(); - // set - bean.setReference(reference); - // check - assertSame("Unable to set reference", reference, bean.getReference()); - } - -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/BestRowIdentifierBeanTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/BestRowIdentifierBeanTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/BestRowIdentifierBeanTest.java (working copy) @@ -1,120 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import java.util.Set; -import junit.framework.TestCase; -import org.jboss.dna.common.jdbc.model.DefaultModelFactory; -import org.jboss.dna.common.jdbc.model.api.BestRowIdentifier; -import org.jboss.dna.common.jdbc.model.api.BestRowIdentifierScopeType; -import org.jboss.dna.common.jdbc.model.api.Column; - -/** - * BestRowIdentifierBean test - * - * @author Sergiy Litsenko - */ -public class BestRowIdentifierBeanTest extends TestCase { - - BestRowIdentifier bean; - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - - // create - bean = new BestRowIdentifierBean(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - // release - bean = null; - - super.tearDown(); - } - - public void testSetScopeType() { - // set - bean.setScopeType(BestRowIdentifierScopeType.SESSION); - // check - assertSame("Unable to set scope type", BestRowIdentifierScopeType.SESSION, bean.getScopeType()); - } - - public void testGetColumns() { - // get - Set columnSet = bean.getColumns(); - // check - assertNotNull("Unable to get columns", columnSet); - assertTrue("Column set should be empty by default", columnSet.isEmpty()); - } - - public void testAddColumn() { - String COLUMN_NAME = "My column"; - // create column - Column column = new DefaultModelFactory().createTableColumn(); - // set name - column.setName(COLUMN_NAME); - // add column - bean.addColumn(column); - // check - assertFalse("Column set should not be empty", bean.getColumns().isEmpty()); - } - - public void testDeleteColumn() { - String COLUMN_NAME = "My column"; - // create column - Column column = new DefaultModelFactory().createTableColumn(); - // set name - column.setName(COLUMN_NAME); - // add column - bean.addColumn(column); - // check - assertFalse("Column set should not be empty", bean.getColumns().isEmpty()); - - // delete - bean.deleteColumn(column); - // check - assertTrue("Column set should be empty", bean.getColumns().isEmpty()); - } - - public void testFindColumnByName() { - String COLUMN_NAME = "My column"; - // create column - Column column = new DefaultModelFactory().createTableColumn(); - // set name - column.setName(COLUMN_NAME); - // add column - bean.addColumn(column); - // check - assertSame("Unable to find column", column, bean.findColumnByName(COLUMN_NAME)); - } - -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/CatalogBeanTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/CatalogBeanTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/CatalogBeanTest.java (working copy) @@ -1,64 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import junit.framework.TestCase; -import org.jboss.dna.common.jdbc.model.api.Catalog; - -/** - * CatalogBean test - * - * @author Sergiy Litsenko - */ -public class CatalogBeanTest extends TestCase { - - private Catalog bean; - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - // create - bean = new CatalogBean(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - // release - bean = null; - - super.tearDown(); - } - - public void testCatalogBean() { - // check - assertNotNull("Unable to create catalog bean", bean); - } - -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/ColumnBeanTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/ColumnBeanTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/ColumnBeanTest.java (working copy) @@ -1,192 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import java.util.Set; -import junit.framework.TestCase; -import org.jboss.dna.common.jdbc.model.DefaultModelFactory; -import org.jboss.dna.common.jdbc.model.api.Column; -import org.jboss.dna.common.jdbc.model.api.NullabilityType; -import org.jboss.dna.common.jdbc.model.api.Privilege; -import org.jboss.dna.common.jdbc.model.api.SqlType; -import org.jboss.dna.common.jdbc.model.api.Table; - -/** - * ColumnBean test - * - * @author Sergiy Litsenko - */ -public class ColumnBeanTest extends TestCase { - - private Column bean; - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - // create - bean = new ColumnBean(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - // release - bean = null; - - super.tearDown(); - } - - public void testSetOwner() { - // create table - Table table = new DefaultModelFactory().createTable(); - // set - bean.setOwner(table); - // check - assertSame("Unable to set owner", table, bean.getOwner()); - } - - public void testSetNullabilityType() { - // set - bean.setNullabilityType(NullabilityType.NULLABLE); - // check - assertSame("Unable to set nullability type", NullabilityType.NULLABLE, bean.getNullabilityType()); - } - - public void testSetSqlType() { - // set - bean.setSqlType(SqlType.VARCHAR); - // check - assertSame("Unable to set SQL type", SqlType.VARCHAR, bean.getSqlType()); - } - - public void testSetTypeName() { - String TYPE_NAME = "My Type"; - // set - bean.setTypeName(TYPE_NAME); - // check - assertEquals("Unable to set type name", TYPE_NAME, bean.getTypeName()); - } - - public void testSetSize() { - Integer size = new Integer(255); - // set - bean.setSize(size); - // check - assertSame("Unable to set size", size, bean.getSize()); - } - - public void testSetPrecision() { - Integer precision = new Integer(5); - // set - bean.setPrecision(precision); - // check - assertSame("Unable to set precision", precision, bean.getPrecision()); - } - - public void testSetRadix() { - Integer radix = new Integer(2); - // set - bean.setRadix(radix); - // check - assertSame("Unable to set radix", radix, bean.getRadix()); - } - - public void testSetDefaultValue() { - String defaultValue = "Hello"; - // set - bean.setDefaultValue(defaultValue); - // check - assertEquals("Unable to set default value", defaultValue, bean.getDefaultValue()); - } - - public void testSetOrdinalPosition() { - Integer ordinalPosition = new Integer(1); - // set - bean.setOrdinalPosition(ordinalPosition); - // check - assertSame("Unable to set ordinalPosition", ordinalPosition, bean.getOrdinalPosition()); - } - - public void testSetCharOctetLength() { - Integer charOctetLength = new Integer(2); - // set - bean.setCharOctetLength(charOctetLength); - // check - assertSame("Unable to set char octet length", charOctetLength, bean.getCharOctetLength()); - } - - public void testGetPrivileges() { - Set privilegeSet = bean.getPrivileges(); - // check - assertNotNull("Unable to get privileges", privilegeSet); - assertTrue("Privilege set should be empty by default", privilegeSet.isEmpty()); - } - - public void testAddPrivilege() { - String PRIVILEGE_NAME = "SELECT"; - // create - Privilege privilege = new DefaultModelFactory().createPrivilege(); - // set name - privilege.setName(PRIVILEGE_NAME); - // add - bean.addPrivilege(privilege); - // check - assertFalse("Privilege set should not be empty", bean.getPrivileges().isEmpty()); - } - - public void testDeletePrivilege() { - String PRIVILEGE_NAME = "SELECT"; - // create - Privilege privilege = new DefaultModelFactory().createPrivilege(); - // set name - privilege.setName(PRIVILEGE_NAME); - // add - bean.addPrivilege(privilege); - // check - assertFalse("Privilege set should not be empty", bean.getPrivileges().isEmpty()); - - // delete - bean.deletePrivilege(privilege); - // check - assertTrue("Privilege set should not be empty", bean.getPrivileges().isEmpty()); - } - - public void testFindPriviledgeByName() { - String PRIVILEGE_NAME = "SELECT"; - // create - Privilege privilege = new DefaultModelFactory().createPrivilege(); - // set name - privilege.setName(PRIVILEGE_NAME); - // add - bean.addPrivilege(privilege); - // check - assertSame("Unable to find privilege", privilege, bean.findPriviledgeByName(PRIVILEGE_NAME)); - } - -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/CoreMetaDataBeanTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/CoreMetaDataBeanTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/CoreMetaDataBeanTest.java (working copy) @@ -1,63 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import junit.framework.TestCase; -import org.jboss.dna.common.jdbc.model.api.CoreMetaData; - -/** - * CoreMetaDataBean test - * - * @author Sergiy Litsenko - */ -public class CoreMetaDataBeanTest extends TestCase { - - private CoreMetaData bean; - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - // create - bean = new CoreMetaDataBean(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - // release - bean = null; - - super.tearDown(); - } - - public void testCoreMetaDataBean() { - assertNotNull("Unable to create CoreMetaData", bean); - } - -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/DatabaseBeanTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/DatabaseBeanTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/DatabaseBeanTest.java (working copy) @@ -1,2104 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import java.util.List; -import java.util.Set; -import junit.framework.TestCase; -import org.jboss.dna.common.jdbc.model.DefaultModelFactory; -import org.jboss.dna.common.jdbc.model.ModelFactory; -import org.jboss.dna.common.jdbc.model.api.Catalog; -import org.jboss.dna.common.jdbc.model.api.Database; -import org.jboss.dna.common.jdbc.model.api.DatabaseMetaDataMethodException; -import org.jboss.dna.common.jdbc.model.api.ResultSetConcurrencyType; -import org.jboss.dna.common.jdbc.model.api.ResultSetHoldabilityType; -import org.jboss.dna.common.jdbc.model.api.ResultSetType; -import org.jboss.dna.common.jdbc.model.api.SQLStateType; -import org.jboss.dna.common.jdbc.model.api.Schema; -import org.jboss.dna.common.jdbc.model.api.SqlType; -import org.jboss.dna.common.jdbc.model.api.SqlTypeConversionPair; -import org.jboss.dna.common.jdbc.model.api.SqlTypeInfo; -import org.jboss.dna.common.jdbc.model.api.StoredProcedure; -import org.jboss.dna.common.jdbc.model.api.Table; -import org.jboss.dna.common.jdbc.model.api.TableType; -import org.jboss.dna.common.jdbc.model.api.TransactionIsolationLevelType; -import org.jboss.dna.common.jdbc.model.api.UserDefinedType; - -/** - * DatabaseBean test - * - * @author Sergiy Litsenko - */ -public class DatabaseBeanTest extends TestCase { - - private Database bean; - private ModelFactory factory; - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - // create - bean = new DatabaseBean(); - factory = new DefaultModelFactory(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - // release - bean = null; - factory = null; - super.tearDown(); - } - - /** - * testDatabaseMetadataExceptions - */ - public void testModelFactoryIsNotNull() { - assertNotNull("Default model factory shall be set", factory); - } - - /** - * testDatabaseMetadataExceptions - */ - public void testGetExceptions() { - // get list of exceptions - List exceptionList = bean.getExceptionList(); - - // check that the exception list in not null - assertNotNull("Database Metadata Method Exception List should not be null", exceptionList); - - // check that exception list is empty - assertTrue("Database Metadata Method Exception List should be empty", exceptionList.isEmpty()); - - } - - /** - * addDatabaseMetaDataMethodException - */ - public void testAddException() { - String MESSAGE = "Database MetaData Method Exception"; - String METHOD_NAME = "myMethod"; - - // create DatabaseMetaDataMethodException - DatabaseMetaDataMethodException exception = new DatabaseMetaDataMethodException(MESSAGE, METHOD_NAME, null); - // add Exception to error list - bean.addException(exception); - - // get list of exceptions - List exceptionList = bean.getExceptionList(); - // check that the exception added to the list - assertTrue("Unable to add DatabaseMetaDataMethodException to the error list for provider ", - exceptionList.contains(exception)); - } - - /** - * findDatabaseMetaDataMethodException - */ - public void testFindException() { - String MESSAGE = "Database MetaData Method Exception"; - String METHOD_NAME = "myMethod"; - - // create DatabaseMetaDataMethodException - DatabaseMetaDataMethodException exception = new DatabaseMetaDataMethodException(MESSAGE, METHOD_NAME, null); - // add Exception to error list - bean.addException(exception); - - // check that the exception found - assertSame("Unable to find database metadata method exception", exception, bean.findException(METHOD_NAME)); - } - - /** - * isDatabaseMetaDataMethodFailed - */ - public void testDatabaseMetaDataMethodFailed() { - String MESSAGE = "Database MetaData Method Exception"; - String METHOD_NAME = "myMethod"; - - // create DatabaseMetaDataMethodException - DatabaseMetaDataMethodException exception = new DatabaseMetaDataMethodException(MESSAGE, METHOD_NAME, null); - // add Exception to error list - bean.addException(exception); - - // check that the exception found - assertTrue("The database metadata method " + METHOD_NAME + " should be failed", - bean.isDatabaseMetaDataMethodFailed(METHOD_NAME)); - - } - - public void testSetName() { - String VALUE = "My name"; - // set - bean.setName(VALUE); - // check - assertSame(VALUE, bean.getName()); - } - - public void testSetAllProceduresAreCallable() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setAllProceduresAreCallable(VALUE); - // check - assertSame(VALUE, bean.isAllProceduresAreCallable()); - } - - public void testSetAllTablesAreSelectable() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setAllTablesAreSelectable(VALUE); - // check - assertSame(VALUE, bean.isAllTablesAreSelectable()); - } - - public void testSetURL() { - String VALUE = "My URL"; - // set - bean.setURL(VALUE); - // check - assertSame(VALUE, bean.getURL()); - } - - public void testSetUserName() { - String VALUE = "My name"; - // set - bean.setUserName(VALUE); - // check - assertSame(VALUE, bean.getUserName()); - } - - public void testSetReadOnly() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setReadOnly(VALUE); - // check - assertSame(VALUE, bean.isReadOnly()); - } - - public void testSetNullsAreSortedHigh() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setNullsAreSortedHigh(VALUE); - // check - assertSame(VALUE, bean.isNullsAreSortedHigh()); - } - - public void testSetNullsAreSortedLow() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setNullsAreSortedLow(VALUE); - // check - assertSame(VALUE, bean.isNullsAreSortedLow()); - } - - public void testSetNullsAreSortedAtStart() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setNullsAreSortedAtStart(VALUE); - // check - assertSame(VALUE, bean.isNullsAreSortedAtStart()); - } - - public void testSetNullsAreSortedAtEnd() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setNullsAreSortedAtEnd(VALUE); - // check - assertSame(VALUE, bean.isNullsAreSortedAtEnd()); - } - - public void testSetDatabaseProductName() { - String VALUE = "My product name"; - // set - bean.setDatabaseProductName(VALUE); - // check - assertSame(VALUE, bean.getDatabaseProductName()); - } - - public void testSetDatabaseProductVersion() { - String VALUE = "My version"; - // set - bean.setDatabaseProductVersion(VALUE); - // check - assertSame(VALUE, bean.getDatabaseProductVersion()); - } - - public void testSetDriverName() { - String VALUE = "My driver name"; - // set - bean.setDriverName(VALUE); - // check - assertSame(VALUE, bean.getDriverName()); - } - - public void testSetDriverVersion() { - String VALUE = "My driver version"; - // set - bean.setDriverVersion(VALUE); - // check - assertSame(VALUE, bean.getDriverVersion()); - } - - public void testSetDriverMajorVersion() { - Integer VALUE = new Integer(1); - // set - bean.setDriverMajorVersion(VALUE); - // check - assertSame(VALUE, bean.getDriverMajorVersion()); - } - - public void testSetDriverMinorVersion() { - Integer VALUE = new Integer(1); - // set - bean.setDriverMinorVersion(VALUE); - // check - assertSame(VALUE, bean.getDriverMinorVersion()); - } - - public void testSetUsesLocalFiles() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setUsesLocalFiles(VALUE); - // check - assertSame(VALUE, bean.isUsesLocalFiles()); - } - - public void testSetUsesLocalFilePerTable() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setUsesLocalFilePerTable(VALUE); - // check - assertSame(VALUE, bean.isUsesLocalFilePerTable()); - } - - public void testSetSupportsMixedCaseIdentifiers() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsMixedCaseIdentifiers(VALUE); - // check - assertSame(VALUE, bean.isSupportsMixedCaseIdentifiers()); - } - - public void testSetStoresUpperCaseIdentifiers() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setStoresUpperCaseIdentifiers(VALUE); - // check - assertSame(VALUE, bean.isStoresUpperCaseIdentifiers()); - } - - public void testSetStoresLowerCaseIdentifiers() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setStoresLowerCaseIdentifiers(VALUE); - // check - assertSame(VALUE, bean.isStoresLowerCaseIdentifiers()); - } - - public void testSetStoresMixedCaseIdentifiers() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setStoresMixedCaseIdentifiers(VALUE); - // check - assertSame(VALUE, bean.isStoresMixedCaseIdentifiers()); - } - - public void testSetSupportsMixedCaseQuotedIdentifiers() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsMixedCaseQuotedIdentifiers(VALUE); - // check - assertSame(VALUE, bean.isSupportsMixedCaseQuotedIdentifiers()); - } - - public void testSetStoresUpperCaseQuotedIdentifiers() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setStoresUpperCaseQuotedIdentifiers(VALUE); - // check - assertSame(VALUE, bean.isStoresUpperCaseQuotedIdentifiers()); - } - - public void testSetStoresLowerCaseQuotedIdentifiers() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setStoresLowerCaseQuotedIdentifiers(VALUE); - // check - assertSame(VALUE, bean.isStoresLowerCaseQuotedIdentifiers()); - } - - public void testSetStoresMixedCaseQuotedIdentifiers() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setStoresMixedCaseQuotedIdentifiers(VALUE); - // check - assertSame(VALUE, bean.isStoresMixedCaseQuotedIdentifiers()); - } - - public void testSetIdentifierQuoteString() { - String VALUE = "My id"; - // set - bean.setIdentifierQuoteString(VALUE); - // check - assertSame(VALUE, bean.getIdentifierQuoteString()); - } - - public void testGetSQLKeywords() { - Set set = bean.getSQLKeywords(); - // check - assertNotNull(set); - assertTrue(set.isEmpty()); - } - - public void testAddSQLKeyword() { - String NAME = "My name"; - // add - bean.addSQLKeyword(NAME); - // check - assertFalse(bean.getSQLKeywords().isEmpty()); - } - - public void testDeleteSQLKeyword() { - String NAME = "My name"; - // add - bean.addSQLKeyword(NAME); - // check - assertFalse(bean.getSQLKeywords().isEmpty()); - - // delete - bean.deleteSQLKeyword(NAME); - // check - assertTrue(bean.getSQLKeywords().isEmpty()); - } - - public void testIsSQLKeywordSupported() { - String NAME = "My name"; - // add - bean.addSQLKeyword(NAME); - - // check - assertSame(Boolean.TRUE, bean.isSQLKeywordSupported(NAME)); - } - - public void testGetNumericFunctions() { - // get - Set set = bean.getNumericFunctions(); - // check - assertNotNull(set); - assertTrue(set.isEmpty()); - } - - public void testAddNumericFunction() { - String NAME = "My name"; - // add - bean.addNumericFunction(NAME); - // check - assertFalse(bean.getNumericFunctions().isEmpty()); - } - - public void testDeleteNumericFunction() { - String NAME = "My name"; - // add - bean.addNumericFunction(NAME); - // check - assertFalse(bean.getNumericFunctions().isEmpty()); - - // delete - bean.deleteNumericFunction(NAME); - // check - assertTrue(bean.getNumericFunctions().isEmpty()); - } - - public void testIsNumericFunctionSupported() { - String NAME = "My name"; - // add - bean.addNumericFunction(NAME); - - // check - assertSame(Boolean.TRUE, bean.isNumericFunctionSupported(NAME)); - } - - public void testGetStringFunctions() { - // get - Set set = bean.getStringFunctions(); - // check - assertNotNull(set); - assertTrue(set.isEmpty()); - } - - public void testAddStringFunction() { - String NAME = "My name"; - // add - bean.addStringFunction(NAME); - // check - assertFalse(bean.getStringFunctions().isEmpty()); - } - - public void testDeleteStringFunction() { - String NAME = "My name"; - // add - bean.addStringFunction(NAME); - // check - assertFalse(bean.getStringFunctions().isEmpty()); - - // delete - bean.deleteStringFunction(NAME); - // check - assertTrue(bean.getStringFunctions().isEmpty()); - } - - public void testIsStringFunctionSupported() { - String NAME = "My name"; - // add - bean.addStringFunction(NAME); - - // check - assertSame(Boolean.TRUE, bean.isStringFunctionSupported(NAME)); - } - - public void testGetSystemFunctions() { - // get - Set set = bean.getSystemFunctions(); - // check - assertNotNull(set); - assertTrue(set.isEmpty()); - } - - public void testAddSystemFunction() { - String NAME = "My name"; - // add - bean.addSystemFunction(NAME); - // check - assertFalse(bean.getSystemFunctions().isEmpty()); - } - - public void testDeleteSystemFunction() { - String NAME = "My name"; - // add - bean.addSystemFunction(NAME); - // check - assertFalse(bean.getSystemFunctions().isEmpty()); - - // delete - bean.deleteSystemFunction(NAME); - // check - assertTrue(bean.getSystemFunctions().isEmpty()); - } - - public void testIsSystemFunctionSupported() { - String NAME = "My name"; - // add - bean.addSystemFunction(NAME); - - // check - assertSame(Boolean.TRUE, bean.isSystemFunctionSupported(NAME)); - } - - public void testGetTimeDateFunctions() { - // get - Set set = bean.getTimeDateFunctions(); - // check - assertNotNull(set); - assertTrue(set.isEmpty()); - } - - public void testAddTimeDateFunction() { - String NAME = "My name"; - // add - bean.addTimeDateFunction(NAME); - // check - assertFalse(bean.getTimeDateFunctions().isEmpty()); - } - - public void testDeleteTimeDateFunction() { - String NAME = "My name"; - // add - bean.addTimeDateFunction(NAME); - // check - assertFalse(bean.getTimeDateFunctions().isEmpty()); - - // delete - bean.deleteTimeDateFunction(NAME); - // check - assertTrue(bean.getTimeDateFunctions().isEmpty()); - } - - public void testIsTimeDateFunctionSupported() { - String NAME = "My name"; - // add - bean.addTimeDateFunction(NAME); - - // check - assertSame(Boolean.TRUE, bean.isTimeDateFunctionSupported(NAME)); - } - - public void testSetSearchStringEscape() { - String VALUE = "My search"; - // set - bean.setSearchStringEscape(VALUE); - // check - assertSame(VALUE, bean.getSearchStringEscape()); - } - - public void testSetExtraNameCharacters() { - String VALUE = "My characters"; - // set - bean.setExtraNameCharacters(VALUE); - // check - assertSame(VALUE, bean.getExtraNameCharacters()); - } - - public void testSetSupportsAlterTableWithAddColumn() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsAlterTableWithAddColumn(VALUE); - // check - assertSame(VALUE, bean.isSupportsAlterTableWithAddColumn()); - } - - public void testSetSupportsAlterTableWithDropColumn() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsAlterTableWithDropColumn(VALUE); - // check - assertSame(VALUE, bean.isSupportsAlterTableWithDropColumn()); - } - - public void testSetSupportsColumnAliasing() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsColumnAliasing(VALUE); - // check - assertSame(VALUE, bean.isSupportsColumnAliasing()); - } - - public void testSetNullPlusNonNullIsNull() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setNullPlusNonNullIsNull(VALUE); - // check - assertSame(VALUE, bean.isNullPlusNonNullIsNull()); - } - - public void testSetSupportsConvert() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsConvert(VALUE); - // check - assertSame(VALUE, bean.isSupportsConvert()); - } - - public void testGetSupportedConversions() { - // get - Set set = bean.getSupportedConversions(); - // check - assertNotNull(set); - assertTrue(set.isEmpty()); - } - - public void testAddSqlTypeConversionPair() { - // create - SqlTypeConversionPair object = new DefaultModelFactory().createSqlTypeConversionPair(); - // set - object.setSrcType(SqlType.INTEGER); - object.setDestType(SqlType.VARCHAR); - - // add - bean.addSqlTypeConversionPair(object); - // check - assertFalse(bean.getSupportedConversions().isEmpty()); - } - - public void testDeleteSqlTypeConversionPair() { - // create - SqlTypeConversionPair object = new DefaultModelFactory().createSqlTypeConversionPair(); - // set - object.setSrcType(SqlType.INTEGER); - object.setDestType(SqlType.VARCHAR); - - // add - bean.addSqlTypeConversionPair(object); - // check - assertFalse(bean.getSupportedConversions().isEmpty()); - - // delete - bean.deleteSqlTypeConversionPair(object); - // check - assertTrue(bean.getSupportedConversions().isEmpty()); - } - - public void testFindSqlTypeConversionPair() { - // create - SqlTypeConversionPair object = new DefaultModelFactory().createSqlTypeConversionPair(); - // set - object.setSrcType(SqlType.INTEGER); - object.setDestType(SqlType.VARCHAR); - - // add - bean.addSqlTypeConversionPair(object); - // check - assertFalse(bean.findSqlTypeConversionPairBySrcType(object.getSrcType().toString()).isEmpty()); - } - - public void testSetSupportsTableCorrelationNames() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsTableCorrelationNames(VALUE); - // check - assertSame(VALUE, bean.isSupportsTableCorrelationNames()); - } - - public void testSetSupportsDifferentTableCorrelationNames() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsDifferentTableCorrelationNames(VALUE); - // check - assertSame(VALUE, bean.isSupportsDifferentTableCorrelationNames()); - } - - public void testSetSupportsExpressionsInOrderBy() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsExpressionsInOrderBy(VALUE); - // check - assertSame(VALUE, bean.isSupportsExpressionsInOrderBy()); - } - - public void testSetSupportsOrderByUnrelated() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsOrderByUnrelated(VALUE); - // check - assertSame(VALUE, bean.isSupportsOrderByUnrelated()); - } - - public void testSetSupportsGroupBy() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsGroupBy(VALUE); - // check - assertSame(VALUE, bean.isSupportsGroupBy()); - } - - public void testSetSupportsGroupByUnrelated() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsGroupByUnrelated(VALUE); - // check - assertSame(VALUE, bean.isSupportsGroupByUnrelated()); - } - - public void testSetSupportsGroupByBeyondSelect() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsGroupByBeyondSelect(VALUE); - // check - assertSame(VALUE, bean.isSupportsGroupByBeyondSelect()); - } - - public void testSetSupportsLikeEscapeClause() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsLikeEscapeClause(VALUE); - // check - assertSame(VALUE, bean.isSupportsLikeEscapeClause()); - } - - public void testSetSupportsMultipleResultSets() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsMultipleResultSets(VALUE); - // check - assertSame(VALUE, bean.isSupportsMultipleResultSets()); - } - - public void testSetSupportsMultipleTransactions() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsMultipleTransactions(VALUE); - // check - assertSame(VALUE, bean.isSupportsMultipleTransactions()); - } - - public void testSetSupportsNonNullableColumns() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsNonNullableColumns(VALUE); - // check - assertSame(VALUE, bean.isSupportsNonNullableColumns()); - } - - public void testSetSupportsMinimumSQLGrammar() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsMinimumSQLGrammar(VALUE); - // check - assertSame(VALUE, bean.isSupportsMinimumSQLGrammar()); - } - - public void testSetSupportsCoreSQLGrammar() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsCoreSQLGrammar(VALUE); - // check - assertSame(VALUE, bean.isSupportsCoreSQLGrammar()); - } - - public void testSetSupportsExtendedSQLGrammar() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsExtendedSQLGrammar(VALUE); - // check - assertSame(VALUE, bean.isSupportsExtendedSQLGrammar()); - } - - public void testSetSupportsANSI92EntryLevelSQL() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsANSI92EntryLevelSQL(VALUE); - // check - assertSame(VALUE, bean.isSupportsANSI92EntryLevelSQL()); - } - - public void testSetSupportsANSI92IntermediateSQL() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsANSI92IntermediateSQL(VALUE); - // check - assertSame(VALUE, bean.isSupportsANSI92IntermediateSQL()); - } - - public void testSetSupportsANSI92FullSQL() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsANSI92FullSQL(VALUE); - // check - assertSame(VALUE, bean.isSupportsANSI92FullSQL()); - } - - public void testSetSupportsIntegrityEnhancementFacility() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsIntegrityEnhancementFacility(VALUE); - // check - assertSame(VALUE, bean.isSupportsIntegrityEnhancementFacility()); - } - - public void testSetSupportsOuterJoins() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsOuterJoins(VALUE); - // check - assertSame(VALUE, bean.isSupportsOuterJoins()); - } - - public void testSetSupportsFullOuterJoins() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsFullOuterJoins(VALUE); - // check - assertSame(VALUE, bean.isSupportsFullOuterJoins()); - } - - public void testSetSupportsLimitedOuterJoins() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsLimitedOuterJoins(VALUE); - // check - assertSame(VALUE, bean.isSupportsLimitedOuterJoins()); - } - - public void testSetSchemaTerm() { - String VALUE = "My value"; - // set - bean.setSchemaTerm(VALUE); - // check - assertSame(VALUE, bean.getSchemaTerm()); - } - - public void testSetProcedureTerm() { - String VALUE = "My value"; - // set - bean.setProcedureTerm(VALUE); - // check - assertSame(VALUE, bean.getProcedureTerm()); - } - - public void testSetCatalogTerm() { - String VALUE = "My value"; - // set - bean.setCatalogTerm(VALUE); - // check - assertSame(VALUE, bean.getCatalogTerm()); - } - - public void testSetCatalogAtStart() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setCatalogAtStart(VALUE); - // check - assertSame(VALUE, bean.isCatalogAtStart()); - } - - public void testSetCatalogSeparator() { - String VALUE = "My value"; - // set - bean.setCatalogSeparator(VALUE); - // check - assertSame(VALUE, bean.getCatalogSeparator()); - } - - public void testSetSupportsSchemasInDataManipulation() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsSchemasInDataManipulation(VALUE); - // check - assertSame(VALUE, bean.isSupportsSchemasInDataManipulation()); - } - - public void testSetSupportsSchemasInProcedureCalls() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsSchemasInProcedureCalls(VALUE); - // check - assertSame(VALUE, bean.isSupportsSchemasInProcedureCalls()); - } - - public void testSetSupportsSchemasInTableDefinitions() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsSchemasInTableDefinitions(VALUE); - // check - assertSame(VALUE, bean.isSupportsSchemasInTableDefinitions()); - } - - public void testSetSupportsSchemasInIndexDefinitions() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsSchemasInIndexDefinitions(VALUE); - // check - assertSame(VALUE, bean.isSupportsSchemasInIndexDefinitions()); - } - - public void testSetSupportsSchemasInPrivilegeDefinitions() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsSchemasInPrivilegeDefinitions(VALUE); - // check - assertSame(VALUE, bean.isSupportsSchemasInPrivilegeDefinitions()); - } - - public void testSetSupportsCatalogsInDataManipulation() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsCatalogsInDataManipulation(VALUE); - // check - assertSame(VALUE, bean.isSupportsCatalogsInDataManipulation()); - } - - public void testSetSupportsCatalogsInProcedureCalls() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsCatalogsInProcedureCalls(VALUE); - // check - assertSame(VALUE, bean.isSupportsCatalogsInProcedureCalls()); - } - - public void testSetSupportsCatalogsInTableDefinitions() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsCatalogsInTableDefinitions(VALUE); - // check - assertSame(VALUE, bean.isSupportsCatalogsInTableDefinitions()); - } - - public void testSetSupportsCatalogsInIndexDefinitions() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsCatalogsInIndexDefinitions(VALUE); - // check - assertSame(VALUE, bean.isSupportsCatalogsInIndexDefinitions()); - } - - public void testSetSupportsCatalogsInPrivilegeDefinitions() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsCatalogsInPrivilegeDefinitions(VALUE); - // check - assertSame(VALUE, bean.isSupportsCatalogsInPrivilegeDefinitions()); - } - - public void testSetSupportsPositionedDelete() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsPositionedDelete(VALUE); - // check - assertSame(VALUE, bean.isSupportsPositionedDelete()); - } - - public void testSetSupportsPositionedUpdate() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsPositionedUpdate(VALUE); - // check - assertSame(VALUE, bean.isSupportsPositionedUpdate()); - } - - public void testSetSupportsSelectForUpdate() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsSelectForUpdate(VALUE); - // check - assertSame(VALUE, bean.isSupportsSelectForUpdate()); - } - - public void testSetSupportsStoredProcedures() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsStoredProcedures(VALUE); - // check - assertSame(VALUE, bean.isSupportsStoredProcedures()); - } - - public void testSetSupportsSubqueriesInComparisons() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsSubqueriesInComparisons(VALUE); - // check - assertSame(VALUE, bean.isSupportsSubqueriesInComparisons()); - } - - public void testSetSupportsSubqueriesInExists() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsSubqueriesInExists(VALUE); - // check - assertSame(VALUE, bean.isSupportsSubqueriesInExists()); - } - - public void testSetSupportsSubqueriesInIns() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsSubqueriesInIns(VALUE); - // check - assertSame(VALUE, bean.isSupportsSubqueriesInIns()); - } - - public void testSetSupportsSubqueriesInQuantifieds() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsSubqueriesInQuantifieds(VALUE); - // check - assertSame(VALUE, bean.isSupportsSubqueriesInQuantifieds()); - } - - public void testSetSupportsCorrelatedSubqueries() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsCorrelatedSubqueries(VALUE); - // check - assertSame(VALUE, bean.isSupportsCorrelatedSubqueries()); - } - - public void testSetSupportsUnion() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsUnion(VALUE); - // check - assertSame(VALUE, bean.isSupportsUnion()); - } - - public void testSetSupportsUnionAll() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsUnionAll(VALUE); - // check - assertSame(VALUE, bean.isSupportsUnionAll()); - } - - public void testSetSupportsOpenCursorsAcrossCommit() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsOpenCursorsAcrossCommit(VALUE); - // check - assertSame(VALUE, bean.isSupportsOpenCursorsAcrossCommit()); - } - - public void testSetSupportsOpenCursorsAcrossRollback() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsOpenCursorsAcrossRollback(VALUE); - // check - assertSame(VALUE, bean.isSupportsOpenCursorsAcrossRollback()); - } - - public void testSetSupportsOpenStatementsAcrossCommit() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsOpenStatementsAcrossCommit(VALUE); - // check - assertSame(VALUE, bean.isSupportsOpenStatementsAcrossCommit()); - } - - public void testSetSupportsOpenStatementsAcrossRollback() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsOpenStatementsAcrossRollback(VALUE); - // check - assertSame(VALUE, bean.isSupportsOpenStatementsAcrossRollback()); - } - - public void testSetMaxBinaryLiteralLength() { - Integer VALUE = new Integer(1); - // set - bean.setMaxBinaryLiteralLength(VALUE); - // check - assertSame(VALUE, bean.getMaxBinaryLiteralLength()); - } - - public void testSetMaxCharLiteralLength() { - Integer VALUE = new Integer(1); - // set - bean.setMaxCharLiteralLength(VALUE); - // check - assertSame(VALUE, bean.getMaxCharLiteralLength()); - } - - public void testSetMaxColumnNameLength() { - Integer VALUE = new Integer(1); - // set - bean.setMaxColumnNameLength(VALUE); - // check - assertSame(VALUE, bean.getMaxColumnNameLength()); - } - - public void testSetMaxColumnsInGroupBy() { - Integer VALUE = new Integer(1); - // set - bean.setMaxColumnsInGroupBy(VALUE); - // check - assertSame(VALUE, bean.getMaxColumnsInGroupBy()); - } - - public void testSetMaxColumnsInIndex() { - Integer VALUE = new Integer(1); - // set - bean.setMaxColumnsInIndex(VALUE); - // check - assertSame(VALUE, bean.getMaxColumnsInIndex()); - } - - public void testSetMaxColumnsInOrderBy() { - Integer VALUE = new Integer(1); - // set - bean.setMaxColumnsInOrderBy(VALUE); - // check - assertSame(VALUE, bean.getMaxColumnsInOrderBy()); - } - - public void testSetMaxColumnsInSelect() { - Integer VALUE = new Integer(1); - // set - bean.setMaxColumnsInSelect(VALUE); - // check - assertSame(VALUE, bean.getMaxColumnsInSelect()); - } - - public void testSetMaxColumnsInTable() { - Integer VALUE = new Integer(1); - // set - bean.setMaxColumnsInTable(VALUE); - // check - assertSame(VALUE, bean.getMaxColumnsInTable()); - } - - public void testSetMaxConnections() { - Integer VALUE = new Integer(1); - // set - bean.setMaxConnections(VALUE); - // check - assertSame(VALUE, bean.getMaxConnections()); - } - - public void testSetMaxCursorNameLength() { - Integer VALUE = new Integer(1); - // set - bean.setMaxCursorNameLength(VALUE); - // check - assertSame(VALUE, bean.getMaxCursorNameLength()); - } - - public void testSetMaxIndexLength() { - Integer VALUE = new Integer(1); - // set - bean.setMaxIndexLength(VALUE); - // check - assertSame(VALUE, bean.getMaxIndexLength()); - } - - public void testSetMaxSchemaNameLength() { - Integer VALUE = new Integer(1); - // set - bean.setMaxSchemaNameLength(VALUE); - // check - assertSame(VALUE, bean.getMaxSchemaNameLength()); - } - - public void testSetMaxProcedureNameLength() { - Integer VALUE = new Integer(1); - // set - bean.setMaxProcedureNameLength(VALUE); - // check - assertSame(VALUE, bean.getMaxProcedureNameLength()); - } - - public void testSetMaxCatalogNameLength() { - Integer VALUE = new Integer(1); - // set - bean.setMaxCatalogNameLength(VALUE); - // check - assertSame(VALUE, bean.getMaxCatalogNameLength()); - } - - public void testSetMaxRowSize() { - Integer VALUE = new Integer(1); - // set - bean.setMaxRowSize(VALUE); - // check - assertSame(VALUE, bean.getMaxRowSize()); - } - - public void testSetMaxRowSizeIncludeBlobs() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setMaxRowSizeIncludeBlobs(VALUE); - // check - assertSame(VALUE, bean.isMaxRowSizeIncludeBlobs()); - } - - public void testSetMaxStatementLength() { - Integer VALUE = new Integer(1); - // set - bean.setMaxStatementLength(VALUE); - // check - assertSame(VALUE, bean.getMaxStatementLength()); - } - - public void testSetMaxStatements() { - Integer VALUE = new Integer(1); - // set - bean.setMaxStatements(VALUE); - // check - assertSame(VALUE, bean.getMaxStatements()); - } - - public void testSetMaxTableNameLength() { - Integer VALUE = new Integer(1); - // set - bean.setMaxTableNameLength(VALUE); - // check - assertSame(VALUE, bean.getMaxTableNameLength()); - } - - public void testSetMaxTablesInSelect() { - Integer VALUE = new Integer(1); - // set - bean.setMaxTablesInSelect(VALUE); - // check - assertSame(VALUE, bean.getMaxTablesInSelect()); - } - - public void testSetMaxUserNameLength() { - Integer VALUE = new Integer(1); - // set - bean.setMaxUserNameLength(VALUE); - // check - assertSame(VALUE, bean.getMaxUserNameLength()); - } - - public void testSetDefaultTransactionIsolation() { - Integer VALUE = new Integer(1); - // set - bean.setDefaultTransactionIsolation(VALUE); - // check - assertSame(VALUE, bean.getDefaultTransactionIsolation()); - } - - public void testSetSupportsTransactions() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsTransactions(VALUE); - // check - assertSame(VALUE, bean.isSupportsTransactions()); - } - - public void testGetSupportedTransactionIsolationLevels() { - // get - Set set = bean.getSupportedTransactionIsolationLevels(); - // check - assertNotNull(set); - assertTrue(set.isEmpty()); - } - - public void testAddSupportedTransactionIsolationLevelType() { - // get - TransactionIsolationLevelType object = TransactionIsolationLevelType.READ_COMMITTED; - // add - bean.addSupportedTransactionIsolationLevelType(object); - // check - assertFalse(bean.getSupportedTransactionIsolationLevels().isEmpty()); - } - - public void testDeleteSupportedTransactionIsolationLevelType() { - // get - TransactionIsolationLevelType object = TransactionIsolationLevelType.READ_COMMITTED; - // add - bean.addSupportedTransactionIsolationLevelType(object); - // check - assertFalse(bean.getSupportedTransactionIsolationLevels().isEmpty()); - - // delete - bean.deleteSupportedTransactionIsolationLevelType(object); - // check - assertTrue(bean.getSupportedTransactionIsolationLevels().isEmpty()); - } - - public void testIsSupportedTransactionIsolationLevelType() { - // get - TransactionIsolationLevelType object = TransactionIsolationLevelType.READ_COMMITTED; - // add - bean.addSupportedTransactionIsolationLevelType(object); - // check - assertSame(Boolean.TRUE, bean.isSupportedTransactionIsolationLevelType(object)); - } - - public void testSetSupportsDataDefinitionAndDataManipulationTransactions() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsDataDefinitionAndDataManipulationTransactions(VALUE); - // check - assertSame(VALUE, bean.isSupportsDataDefinitionAndDataManipulationTransactions()); - } - - public void testSetSupportsDataManipulationTransactionsOnly() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsDataManipulationTransactionsOnly(VALUE); - // check - assertSame(VALUE, bean.isSupportsDataManipulationTransactionsOnly()); - } - - public void testSetDataDefinitionCausesTransactionCommit() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setDataDefinitionCausesTransactionCommit(VALUE); - // check - assertSame(VALUE, bean.isDataDefinitionCausesTransactionCommit()); - } - - public void testSetDataDefinitionIgnoredInTransactions() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setDataDefinitionIgnoredInTransactions(VALUE); - // check - assertSame(VALUE, bean.isDataDefinitionIgnoredInTransactions()); - } - - public void testGetStoredProcedures() { - // get - Set set = bean.getStoredProcedures(); - // check - assertNotNull(set); - assertTrue(set.isEmpty()); - } - - public void testAddStoredProcedure() { - String NAME = "My Name"; - // create - StoredProcedure object = new DefaultModelFactory().createStoredProcedure(); - // set - object.setName(NAME); - // add - bean.addStoredProcedure(object); - // check - assertFalse(bean.getStoredProcedures().isEmpty()); - } - - public void testDeleteStoredProcedure() { - String NAME = "My Name"; - // create - StoredProcedure object = new DefaultModelFactory().createStoredProcedure(); - // set - object.setName(NAME); - // add - bean.addStoredProcedure(object); - // check - assertFalse(bean.getStoredProcedures().isEmpty()); - - // delete - bean.deleteStoredProcedure(object); - // check - assertTrue(bean.getStoredProcedures().isEmpty()); - } - - public void testFindStoredProcedureByName() { - String NAME = "My Name"; - // create - StoredProcedure object = new DefaultModelFactory().createStoredProcedure(); - // set - object.setName(NAME); - // add - bean.addStoredProcedure(object); - // check - assertSame(object, bean.findStoredProcedureByName(null, null, object.getName())); - } - - public void testGetTables() { - // get - Set
set = bean.getTables(); - // check - assertNotNull(set); - assertTrue(set.isEmpty()); - } - - public void testAddTable() { - String NAME = "My Name"; - // create - Table object = new DefaultModelFactory().createTable(); - // set - object.setName(NAME); - // add - bean.addTable(object); - // check - assertFalse(bean.getTables().isEmpty()); - } - - public void testDeleteTable() { - String NAME = "My Name"; - // create - Table object = new DefaultModelFactory().createTable(); - // set - object.setName(NAME); - // add - bean.addTable(object); - // check - assertFalse(bean.getTables().isEmpty()); - - // delete - bean.deleteTable(object); - // check - assertTrue(bean.getTables().isEmpty()); - } - - public void testFindTableByName() { - String NAME = "My Name"; - // create - Table object = new DefaultModelFactory().createTable(); - // set - object.setName(NAME); - // add - bean.addTable(object); - // check - assertSame(object, bean.findTableByName(null, null, object.getName())); - } - - public void testGetSchemas() { - // get - Set set = bean.getSchemas(); - // check - assertNotNull(set); - assertTrue(set.isEmpty()); - } - - public void testAddSchema() { - String NAME = "My Name"; - // create - Schema object = new DefaultModelFactory().createSchema(); - // set - object.setName(NAME); - // add - bean.addSchema(object); - // check - assertFalse(bean.getSchemas().isEmpty()); - } - - public void testDeleteSchema() { - String NAME = "My Name"; - // create - Schema object = new DefaultModelFactory().createSchema(); - // set - object.setName(NAME); - // add - bean.addSchema(object); - // check - assertFalse(bean.getSchemas().isEmpty()); - - // delete - bean.deleteSchema(object); - // check - assertTrue(bean.getSchemas().isEmpty()); - } - - public void testFindSchemaByName() { - String NAME = "My Name"; - // create - Schema object = new DefaultModelFactory().createSchema(); - // set - object.setName(NAME); - // add - bean.addSchema(object); - // check - assertSame(object, bean.findSchemaByName(null, object.getName())); - } - - public void testGetCatalogs() { - // get - Set set = bean.getCatalogs(); - // check - assertNotNull(set); - assertTrue(set.isEmpty()); - } - - public void testAddCatalog() { - String NAME = "My Name"; - // create - Catalog object = new DefaultModelFactory().createCatalog(); - // set - object.setName(NAME); - // add - bean.addCatalog(object); - // check - assertFalse(bean.getCatalogs().isEmpty()); - } - - public void testDeleteCatalog() { - String NAME = "My Name"; - // create - Catalog object = new DefaultModelFactory().createCatalog(); - // set - object.setName(NAME); - // add - bean.addCatalog(object); - // check - assertFalse(bean.getCatalogs().isEmpty()); - - // delete - bean.deleteCatalog(object); - // check - assertTrue(bean.getCatalogs().isEmpty()); - } - - public void testFindCatalogByName() { - String NAME = "My Name"; - // create - Catalog object = new DefaultModelFactory().createCatalog(); - // set - object.setName(NAME); - // add - bean.addCatalog(object); - // check - assertSame(object, bean.findCatalogByName(object.getName())); - } - - public void testGetTableTypes() { - // get - Set set = bean.getTableTypes(); - // check - assertNotNull(set); - assertTrue(set.isEmpty()); - } - - public void testAddTableType() { - String NAME = "My Name"; - // create - TableType object = new DefaultModelFactory().createTableType(); - // set - object.setName(NAME); - // add - bean.addTableType(object); - // check - assertFalse(bean.getTableTypes().isEmpty()); - } - - public void testDeleteTableType() { - String NAME = "My Name"; - // create - TableType object = new DefaultModelFactory().createTableType(); - // set - object.setName(NAME); - // add - bean.addTableType(object); - // check - assertFalse(bean.getTableTypes().isEmpty()); - - // delete - bean.deleteTableType(object); - // check - assertTrue(bean.getTableTypes().isEmpty()); - } - - public void testFindTableTypeByTypeName() { - String NAME = "My Name"; - // create - TableType object = new DefaultModelFactory().createTableType(); - // set - object.setName(NAME); - // add - bean.addTableType(object); - // check - assertSame(object, bean.findTableTypeByTypeName(object.getName())); - } - - public void testGetSqlTypeInfos() { - // get - Set set = bean.getSqlTypeInfos(); - // check - assertNotNull(set); - assertTrue(set.isEmpty()); - } - - public void testAddSqlTypeInfo() { - String NAME = "My Name"; - // create - SqlTypeInfo object = new DefaultModelFactory().createSqlTypeInfo(); - // set - object.setName(NAME); - // add - bean.addSqlTypeInfo(object); - // check - assertFalse(bean.getSqlTypeInfos().isEmpty()); - } - - public void testDeleteSqlTypeInfo() { - String NAME = "My Name"; - // create - SqlTypeInfo object = new DefaultModelFactory().createSqlTypeInfo(); - // set - object.setName(NAME); - // add - bean.addSqlTypeInfo(object); - // check - assertFalse(bean.getSqlTypeInfos().isEmpty()); - // delete - bean.deleteSqlTypeInfo(object); - // check - assertTrue(bean.getSqlTypeInfos().isEmpty()); - } - - public void testFindSqlTypeInfoByTypeName() { - String NAME = "My Name"; - // create - SqlTypeInfo object = new DefaultModelFactory().createSqlTypeInfo(); - // set - object.setName(NAME); - // add - bean.addSqlTypeInfo(object); - // check - assertSame(object, bean.findSqlTypeInfoByTypeName(object.getName())); - } - - public void testGetSupportedResultSetTypes() { - // get - Set set = bean.getSupportedResultSetTypes(); - // check - assertNotNull(set); - assertTrue(set.isEmpty()); - } - - public void testAddSupportedResultSetType() { - // add - bean.addSupportedResultSetType(ResultSetType.SCROLL_INSENSITIVE); - // check - assertFalse(bean.getSupportedResultSetTypes().isEmpty()); - } - - public void testDeleteSupportedResultSetType() { - // add - bean.addSupportedResultSetType(ResultSetType.SCROLL_INSENSITIVE); - // check - assertFalse(bean.getSupportedResultSetTypes().isEmpty()); - - // delete - bean.deleteSupportedResultSetType(ResultSetType.SCROLL_INSENSITIVE); - // check - assertTrue(bean.getSupportedResultSetTypes().isEmpty()); - } - - public void testGetSupportedForwardOnlyResultSetConcurrencies() { - // get - Set set = bean.getSupportedForwardOnlyResultSetConcurrencies(); - // check - assertNotNull(set); - assertTrue(set.isEmpty()); - } - - public void testAddSupportedForwardOnlyResultSetConcurrency() { - // add - bean.addSupportedForwardOnlyResultSetConcurrency(ResultSetConcurrencyType.UPDATABLE); - // check - assertFalse(bean.getSupportedForwardOnlyResultSetConcurrencies().isEmpty()); - } - - public void testDeleteSupportedForwardOnlyResultSetConcurrency() { - // add - bean.addSupportedForwardOnlyResultSetConcurrency(ResultSetConcurrencyType.UPDATABLE); - // check - assertFalse(bean.getSupportedForwardOnlyResultSetConcurrencies().isEmpty()); - // delete - bean.deleteSupportedForwardOnlyResultSetConcurrency(ResultSetConcurrencyType.UPDATABLE); - // check - assertTrue(bean.getSupportedForwardOnlyResultSetConcurrencies().isEmpty()); - } - - public void testGetSupportedScrollInsensitiveResultSetConcurrencies() { - // get - Set set = bean.getSupportedScrollInsensitiveResultSetConcurrencies(); - // check - assertNotNull(set); - assertTrue(set.isEmpty()); - } - - public void testAddSupportedScrollInsensitiveResultSetConcurrency() { - // add - bean.addSupportedScrollInsensitiveResultSetConcurrency(ResultSetConcurrencyType.UPDATABLE); - // check - assertFalse(bean.getSupportedScrollInsensitiveResultSetConcurrencies().isEmpty()); - } - - public void testDeleteSupportedScrollInsensitiveResultSetConcurrency() { - // add - bean.addSupportedScrollInsensitiveResultSetConcurrency(ResultSetConcurrencyType.UPDATABLE); - // check - assertFalse(bean.getSupportedScrollInsensitiveResultSetConcurrencies().isEmpty()); - // delete - bean.deleteSupportedScrollInsensitiveResultSetConcurrency(ResultSetConcurrencyType.UPDATABLE); - // check - assertTrue(bean.getSupportedScrollInsensitiveResultSetConcurrencies().isEmpty()); - } - - public void testGetSupportedScrollSensitiveResultSetConcurrencies() { - // get - Set set = bean.getSupportedScrollSensitiveResultSetConcurrencies(); - // check - assertNotNull(set); - assertTrue(set.isEmpty()); - } - - public void testAddSupportedScrollSensitiveResultSetConcurrency() { - // add - bean.addSupportedScrollSensitiveResultSetConcurrency(ResultSetConcurrencyType.UPDATABLE); - // check - assertFalse(bean.getSupportedScrollSensitiveResultSetConcurrencies().isEmpty()); - } - - public void testDeleteSupportedScrollSensitiveResultSetConcurrency() { - // add - bean.addSupportedScrollSensitiveResultSetConcurrency(ResultSetConcurrencyType.UPDATABLE); - // check - assertFalse(bean.getSupportedScrollSensitiveResultSetConcurrencies().isEmpty()); - // delete - bean.deleteSupportedScrollSensitiveResultSetConcurrency(ResultSetConcurrencyType.UPDATABLE); - // check - assertTrue(bean.getSupportedScrollSensitiveResultSetConcurrencies().isEmpty()); - } - - public void testSetForwardOnlyResultSetOwnUpdatesAreVisible() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setForwardOnlyResultSetOwnUpdatesAreVisible(VALUE); - // check - assertSame(VALUE, bean.isForwardOnlyResultSetOwnUpdatesAreVisible()); - } - - public void testSetScrollInsensitiveResultSetOwnUpdatesAreVisible() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setScrollInsensitiveResultSetOwnUpdatesAreVisible(VALUE); - // check - assertSame(VALUE, bean.isScrollInsensitiveResultSetOwnUpdatesAreVisible()); - } - - public void testSetScrollSensitiveResultSetOwnUpdatesAreVisible() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setScrollSensitiveResultSetOwnUpdatesAreVisible(VALUE); - // check - assertSame(VALUE, bean.isScrollSensitiveResultSetOwnUpdatesAreVisible()); - } - - public void testSetForwardOnlyResultSetOwnDeletesAreVisible() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setForwardOnlyResultSetOwnDeletesAreVisible(VALUE); - // check - assertSame(VALUE, bean.isForwardOnlyResultSetOwnDeletesAreVisible()); - } - - public void testSetScrollInsensitiveResultSetOwnDeletesAreVisible() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setScrollInsensitiveResultSetOwnDeletesAreVisible(VALUE); - // check - assertSame(VALUE, bean.isScrollInsensitiveResultSetOwnDeletesAreVisible()); - } - - public void testSetScrollSensitiveResultSetOwnDeletesAreVisible() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setScrollSensitiveResultSetOwnDeletesAreVisible(VALUE); - // check - assertSame(VALUE, bean.isScrollSensitiveResultSetOwnDeletesAreVisible()); - } - - public void testSetScrollInsensitiveResultSetOwnInsertsAreVisible() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setScrollInsensitiveResultSetOwnInsertsAreVisible(VALUE); - // check - assertSame(VALUE, bean.isScrollInsensitiveResultSetOwnInsertsAreVisible()); - } - - public void testSetScrollSensitiveResultSetOwnInsertsAreVisible() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setScrollSensitiveResultSetOwnInsertsAreVisible(VALUE); - // check - assertSame(VALUE, bean.isScrollSensitiveResultSetOwnInsertsAreVisible()); - } - - public void testSetForwardOnlyResultSetOthersUpdatesAreVisible() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setForwardOnlyResultSetOthersUpdatesAreVisible(VALUE); - // check - assertSame(VALUE, bean.isForwardOnlyResultSetOthersUpdatesAreVisible()); - } - - public void testSetScrollInsensitiveResultSetOthersUpdatesAreVisible() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setScrollInsensitiveResultSetOthersUpdatesAreVisible(VALUE); - // check - assertSame(VALUE, bean.isScrollInsensitiveResultSetOthersUpdatesAreVisible()); - } - - public void testSetScrollSensitiveResultSetOthersUpdatesAreVisible() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setScrollSensitiveResultSetOthersUpdatesAreVisible(VALUE); - // check - assertSame(VALUE, bean.isScrollSensitiveResultSetOthersUpdatesAreVisible()); - } - - public void testSetForwardOnlyResultSetOthersDeletesAreVisible() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setForwardOnlyResultSetOthersDeletesAreVisible(VALUE); - // check - assertSame(VALUE, bean.isForwardOnlyResultSetOthersDeletesAreVisible()); - } - - public void testSetScrollInsensitiveResultSetOthersDeletesAreVisible() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setScrollInsensitiveResultSetOthersDeletesAreVisible(VALUE); - // check - assertSame(VALUE, bean.isScrollInsensitiveResultSetOthersDeletesAreVisible()); - } - - public void testSetScrollSensitiveResultSetOthersDeletesAreVisible() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setScrollSensitiveResultSetOthersDeletesAreVisible(VALUE); - // check - assertSame(VALUE, bean.isScrollSensitiveResultSetOthersDeletesAreVisible()); - } - - public void testSetForwardOnlyResultSetOthersInsertsAreVisible() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setForwardOnlyResultSetOthersInsertsAreVisible(VALUE); - // check - assertSame(VALUE, bean.isForwardOnlyResultSetOthersInsertsAreVisible()); - } - - public void testSetScrollInsensitiveResultSetOthersInsertsAreVisible() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setScrollInsensitiveResultSetOthersInsertsAreVisible(VALUE); - // check - assertSame(VALUE, bean.isScrollInsensitiveResultSetOthersInsertsAreVisible()); - } - - public void testSetScrollSensitiveResultSetOthersInsertsAreVisible() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setScrollSensitiveResultSetOthersInsertsAreVisible(VALUE); - // check - assertSame(VALUE, bean.isScrollSensitiveResultSetOthersInsertsAreVisible()); - } - - public void testSetForwardOnlyResultSetUpdatesAreDetected() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setForwardOnlyResultSetUpdatesAreDetected(VALUE); - // check - assertSame(VALUE, bean.isForwardOnlyResultSetUpdatesAreDetected()); - } - - public void testSetScrollInsensitiveResultSetUpdatesAreDetected() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setScrollInsensitiveResultSetUpdatesAreDetected(VALUE); - // check - assertSame(VALUE, bean.isScrollInsensitiveResultSetUpdatesAreDetected()); - } - - public void testSetScrollSensitiveResultSetUpdatesAreDetected() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setScrollSensitiveResultSetUpdatesAreDetected(VALUE); - // check - assertSame(VALUE, bean.isScrollSensitiveResultSetUpdatesAreDetected()); - } - - public void testSetForwardOnlyResultSetDeletesAreDetected() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setForwardOnlyResultSetDeletesAreDetected(VALUE); - // check - assertSame(VALUE, bean.isForwardOnlyResultSetDeletesAreDetected()); - } - - public void testSetScrollInsensitiveResultSetDeletesAreDetected() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setScrollInsensitiveResultSetDeletesAreDetected(VALUE); - // check - assertSame(VALUE, bean.isScrollInsensitiveResultSetDeletesAreDetected()); - } - - public void testSetScrollSensitiveResultSetDeletesAreDetected() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setScrollSensitiveResultSetDeletesAreDetected(VALUE); - // check - assertSame(VALUE, bean.isScrollSensitiveResultSetDeletesAreDetected()); - } - - public void testSetForwardOnlyResultInsertsAreDetected() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setForwardOnlyResultInsertsAreDetected(VALUE); - // check - assertSame(VALUE, bean.isForwardOnlyResultInsertsAreDetected()); - } - - public void testSetScrollInsensitiveResultInsertsAreDetected() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setScrollInsensitiveResultInsertsAreDetected(VALUE); - // check - assertSame(VALUE, bean.isScrollInsensitiveResultInsertsAreDetected()); - } - - public void testSetScrollSensitiveResultInsertsAreDetected() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setScrollSensitiveResultInsertsAreDetected(VALUE); - // check - assertSame(VALUE, bean.isScrollSensitiveResultInsertsAreDetected()); - } - - public void testSetSupportsBatchUpdates() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsBatchUpdates(VALUE); - // check - assertSame(VALUE, bean.isSupportsBatchUpdates()); - } - - public void testGetUserDefinedTypes() { - // get - Set set = bean.getUserDefinedTypes(); - // check - assertNotNull(set); - assertTrue(set.isEmpty()); - } - - public void testAddUserDefinedType() { - String NAME = "My name"; - // create - UserDefinedType object = new DefaultModelFactory().createUserDefinedType(); - // set name - object.setName(NAME); - // add - bean.addUserDefinedType(object); - // check - assertFalse(bean.getUserDefinedTypes().isEmpty()); - } - - public void testDeleteUserDefinedType() { - String NAME = "My name"; - // create - UserDefinedType object = new DefaultModelFactory().createUserDefinedType(); - // set name - object.setName(NAME); - // add - bean.addUserDefinedType(object); - // check - assertFalse(bean.getUserDefinedTypes().isEmpty()); - // delete - bean.deleteUserDefinedType(object); - // check - assertTrue(bean.getUserDefinedTypes().isEmpty()); - } - - public void testFindUserDefinedTypeByName() { - String NAME = "My name"; - // create - UserDefinedType object = new DefaultModelFactory().createUserDefinedType(); - // set name - object.setName(NAME); - // add - bean.addUserDefinedType(object); - // check - assertSame(object, bean.findUserDefinedTypeByName(null, null, object.getName())); - } - - public void testSetSupportsSavepoints() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsSavepoints(VALUE); - // check - assertSame(VALUE, bean.isSupportsSavepoints()); - } - - public void testSetSupportsNamedParameters() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsNamedParameters(VALUE); - // check - assertSame(VALUE, bean.isSupportsNamedParameters()); - } - - public void testSetSupportsMultipleOpenResults() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsMultipleOpenResults(VALUE); - // check - assertSame(VALUE, bean.isSupportsMultipleOpenResults()); - } - - public void testSetSupportsGetGeneratedKeys() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsGetGeneratedKeys(VALUE); - // check - assertSame(VALUE, bean.isSupportsGetGeneratedKeys()); - } - - public void testSetSupportsResultSetHoldCurrorsOverCommitHoldability() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsResultSetHoldCurrorsOverCommitHoldability(VALUE); - // check - assertSame(VALUE, bean.isSupportsResultSetHoldCurrorsOverCommitHoldability()); - } - - public void testSetSupportsResultSetCloseCurrorsAtCommitHoldability() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsResultSetCloseCurrorsAtCommitHoldability(VALUE); - // check - assertSame(VALUE, bean.isSupportsResultSetCloseCurrorsAtCommitHoldability()); - } - - public void testSetResultSetHoldabilityType() { - // set - bean.setResultSetHoldabilityType(ResultSetHoldabilityType.HOLD_CURSORS_OVER_COMMIT); - // check - assertSame(ResultSetHoldabilityType.HOLD_CURSORS_OVER_COMMIT, bean.getResultSetHoldabilityType()); - } - - public void testSetDatabaseMajorVersion() { - Integer VALUE = new Integer(1); - // set - bean.setDatabaseMajorVersion(VALUE); - // check - assertSame(VALUE, bean.getDatabaseMajorVersion()); - } - - public void testSetDatabaseMinorVersion() { - Integer VALUE = new Integer(1); - // set - bean.setDatabaseMinorVersion(VALUE); - // check - assertSame(VALUE, bean.getDatabaseMinorVersion()); - } - - public void testSetJDBCMajorVersion() { - Integer VALUE = new Integer(1); - // set - bean.setJDBCMajorVersion(VALUE); - // check - assertSame(VALUE, bean.getJDBCMajorVersion()); - } - - public void testSetJDBCMinorVersion() { - Integer VALUE = new Integer(1); - // set - bean.setJDBCMinorVersion(VALUE); - // check - assertSame(VALUE, bean.getJDBCMinorVersion()); - } - - public void testSetSQLStateType() { - // set - bean.setSQLStateType(SQLStateType.SQL99); - // check - assertSame(SQLStateType.SQL99, bean.getSQLStateType()); - } - - public void testSetLocatorsUpdateCopy() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setLocatorsUpdateCopy(VALUE); - // check - assertSame(VALUE, bean.isLocatorsUpdateCopy()); - } - - public void testSetSupportsStatementPooling() { - Boolean VALUE = Boolean.TRUE; - // set - bean.setSupportsStatementPooling(VALUE); - // check - assertSame(VALUE, bean.isSupportsStatementPooling()); - } - -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/DatabaseNamedObjectBeanTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/DatabaseNamedObjectBeanTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/DatabaseNamedObjectBeanTest.java (working copy) @@ -1,108 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import java.util.Map; -import junit.framework.TestCase; -import org.jboss.dna.common.jdbc.model.api.DatabaseNamedObject; - -/** - * DatabaseNamedObjectBean test - * - * @author Sergiy Litsenko - */ -public class DatabaseNamedObjectBeanTest extends TestCase { - - private DatabaseNamedObject bean; - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - // create - bean = new DatabaseNamedObjectBean(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - // release - bean = null; - - super.tearDown(); - } - - public void testSetName() { - String name = "My Name"; - // set - bean.setName(name); - // check - assertSame("Unable to set name", name, bean.getName()); - } - - public void testSetRemarks() { - String remarks = "My remarks"; - // set - bean.setRemarks(remarks); - // check - assertSame("Unable to set remarks", remarks, bean.getRemarks()); - } - - public void testGetExtraProperties() { - // get - Map properties = bean.getExtraProperties(); - // check - assertNotNull("ExtraProperties should not be null by default", properties); - // check - assertTrue("ExtraProperties should be empty", properties.isEmpty()); - } - - public void testAddExtraProperty() { - String key = "My key"; - String value = "My Value"; - // set - bean.addExtraProperty(key, value); - // check - assertSame("Unable to set extra property", value, bean.getExtraProperty(key)); - } - - public void testDeleteExtraProperty() { - String key = "My key"; - String value = "My Value"; - // set - bean.addExtraProperty(key, value); - // check - assertFalse("ExtraProperties should not be empty", bean.getExtraProperties().isEmpty()); - - // delete - bean.deleteExtraProperty(key); - // check - assertTrue("ExtraProperties should be empty", bean.getExtraProperties().isEmpty()); - } - -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/ForeignKeyBeanTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/ForeignKeyBeanTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/ForeignKeyBeanTest.java (working copy) @@ -1,154 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import java.util.Set; -import junit.framework.TestCase; -import org.jboss.dna.common.jdbc.model.DefaultModelFactory; -import org.jboss.dna.common.jdbc.model.api.ForeignKey; -import org.jboss.dna.common.jdbc.model.api.ForeignKeyColumn; -import org.jboss.dna.common.jdbc.model.api.KeyDeferrabilityType; -import org.jboss.dna.common.jdbc.model.api.KeyModifyRuleType; -import org.jboss.dna.common.jdbc.model.api.PrimaryKey; -import org.jboss.dna.common.jdbc.model.api.Table; - -/** - * ForeignKeyBean test - * - * @author Sergiy Litsenko - */ -public class ForeignKeyBeanTest extends TestCase { - - private ForeignKey bean; - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - // create - bean = new ForeignKeyBean(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - // release - bean = null; - - super.tearDown(); - } - - public void testGetColumns() { - Set columns = bean.getColumns(); - // check - assertNotNull("Unable to get columns", columns); - assertTrue("Column set should be empty by default", columns.isEmpty()); - } - - public void testAddColumn() { - String COLUMN_NAME = "My column"; - // create column - ForeignKeyColumn column = new DefaultModelFactory().createForeignKeyColumn(); - // set name - column.setName(COLUMN_NAME); - // add column - bean.addColumn(column); - // check - assertFalse("Column set should not be empty", bean.getColumns().isEmpty()); - } - - public void testDeleteColumn() { - String COLUMN_NAME = "My column"; - // create column - ForeignKeyColumn column = new DefaultModelFactory().createForeignKeyColumn(); - // set name - column.setName(COLUMN_NAME); - // add column - bean.addColumn(column); - // check - assertFalse("Column set should not be empty", bean.getColumns().isEmpty()); - - // delete - bean.deleteColumn(column); - // check - assertTrue("Column set should be empty", bean.getColumns().isEmpty()); - } - - public void testFindColumnByName() { - String COLUMN_NAME = "My column"; - // create column - ForeignKeyColumn column = new DefaultModelFactory().createForeignKeyColumn(); - // set name - column.setName(COLUMN_NAME); - // add column - bean.addColumn(column); - // check - assertSame("Unable to find column", column, bean.findColumnByName(COLUMN_NAME)); - } - - public void testSetSourceTable() { - // create - Table sourceTable = new DefaultModelFactory().createTable(); - // set - bean.setSourceTable(sourceTable); - // check - assertSame("Unable to set source table", sourceTable, bean.getSourceTable()); - } - - public void testSetSourcePrimaryKey() { - // create - PrimaryKey primaryKey = new DefaultModelFactory().createPrimaryKey(); - // set - bean.setSourcePrimaryKey(primaryKey); - // check - assertSame("Unable to set source primary key", primaryKey, bean.getSourcePrimaryKey()); - } - - public void testSetUpdateRule() { - // set - bean.setUpdateRule(KeyModifyRuleType.CASCADE); - // check - assertSame("unable to set update rule", KeyModifyRuleType.CASCADE, bean.getUpdateRule()); - } - - public void testSetDeleteRule() { - // set - bean.setDeleteRule(KeyModifyRuleType.SET_NULL); - // check - assertSame("unable to set delete rule", KeyModifyRuleType.SET_NULL, bean.getDeleteRule()); - } - - public void testSetDeferrability() { - // set - bean.setDeferrability(KeyDeferrabilityType.INITIALLY_DEFERRED); - // check - assertSame("unable to set deferrability", KeyDeferrabilityType.INITIALLY_DEFERRED, bean.getDeferrability()); - - } - -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/ForeignKeyColumnBeanTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/ForeignKeyColumnBeanTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/ForeignKeyColumnBeanTest.java (working copy) @@ -1,73 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import junit.framework.TestCase; -import org.jboss.dna.common.jdbc.model.DefaultModelFactory; -import org.jboss.dna.common.jdbc.model.api.ForeignKeyColumn; -import org.jboss.dna.common.jdbc.model.api.TableColumn; - -/** - * ForeignKeyColumnBean test - * - * @author Sergiy Litsenko - */ -public class ForeignKeyColumnBeanTest extends TestCase { - - private ForeignKeyColumn bean; - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - // create - bean = new ForeignKeyColumnBean(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - // release - bean = null; - - super.tearDown(); - } - - /** - * test SetSourceColumn - */ - public void testSetSourceColumn() { - // create source column - TableColumn sourceColumn = new DefaultModelFactory().createTableColumn(); - // set - bean.setSourceColumn(sourceColumn); - // check that it was really set - assertSame("Unable to set source column", sourceColumn, bean.getSourceColumn()); - } - -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/IndexBeanTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/IndexBeanTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/IndexBeanTest.java (working copy) @@ -1,151 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import java.util.Set; -import junit.framework.TestCase; -import org.jboss.dna.common.jdbc.model.DefaultModelFactory; -import org.jboss.dna.common.jdbc.model.api.Index; -import org.jboss.dna.common.jdbc.model.api.IndexColumn; -import org.jboss.dna.common.jdbc.model.api.IndexType; - -/** - * IndexBean test - * - * @author Sergiy Litsenko - */ -public class IndexBeanTest extends TestCase { - private Index bean; - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - // create - bean = new IndexBean(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - // release - bean = null; - - super.tearDown(); - } - - public void testGetColumns() { - // get columns - Set columns = bean.getColumns(); - // check - assertNotNull("Unable to get columns", columns); - assertTrue("Column set should be empty by default", columns.isEmpty()); - } - - public void testAddColumn() { - String COLUMN_NAME = "My column"; - // create column - IndexColumn column = new DefaultModelFactory().createIndexColumn(); - // set name - column.setName(COLUMN_NAME); - // add column - bean.addColumn(column); - // check - assertFalse("Column set should not be empty", bean.getColumns().isEmpty()); - } - - public void testDeleteColumn() { - String COLUMN_NAME = "My column"; - // create column - IndexColumn column = new DefaultModelFactory().createIndexColumn(); - // set name - column.setName(COLUMN_NAME); - // add column - bean.addColumn(column); - // check - assertFalse("Column set should not be empty", bean.getColumns().isEmpty()); - - // delete - bean.deleteColumn(column); - // check - assertTrue("Column set should be empty", bean.getColumns().isEmpty()); - } - - public void testFindColumnByName() { - String COLUMN_NAME = "My column"; - // create column - IndexColumn column = new DefaultModelFactory().createIndexColumn(); - // set name - column.setName(COLUMN_NAME); - // add column - bean.addColumn(column); - // check - assertSame("Unable to find column", column, bean.findColumnByName(COLUMN_NAME)); - } - - public void testSetUnique() { - Boolean unique = Boolean.TRUE; - // set - bean.setUnique(unique); - // check that it was set - assertSame("Unable to set unique", unique, bean.isUnique()); - } - - public void testSetIndexType() { - // set - bean.setIndexType(IndexType.CLUSTERED); - // check - assertSame("Unable to set index type", IndexType.CLUSTERED, bean.getIndexType()); - } - - public void testSetCardinality() { - Integer cardinality = new Integer(1); - // set - bean.setCardinality(cardinality); - // check - assertSame("Unable to set cardinality", cardinality, bean.getCardinality()); - } - - public void testSetPages() { - Integer pages = new Integer(1); - // set - bean.setPages(pages); - // check - assertSame("Unable to set pages", pages, bean.getPages()); - } - - public void testSetFilterCondition() { - String filterCondition = "IS NOT NULL"; - // set - bean.setFilterCondition(filterCondition); - - // check - assertSame("Unable to set filter condition", filterCondition, bean.getFilterCondition()); - } - -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/IndexColumnBeanTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/IndexColumnBeanTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/IndexColumnBeanTest.java (working copy) @@ -1,67 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import junit.framework.TestCase; -import org.jboss.dna.common.jdbc.model.api.IndexColumn; -import org.jboss.dna.common.jdbc.model.api.SortSequenceType; - -/** - * IndexColumnBean test - * - * @author Sergiy Litsenko - */ -public class IndexColumnBeanTest extends TestCase { - private IndexColumn bean; - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - // create - bean = new IndexColumnBean(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - // release - bean = null; - - super.tearDown(); - } - - public void testSetSortSequenceType() { - // set - bean.setSortSequenceType(SortSequenceType.DESCENDING); - // check - assertSame("Unable to set sort sequence type", SortSequenceType.DESCENDING, bean.getSortSequenceType()); - - } - -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/KeyColumnBeanTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/KeyColumnBeanTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/KeyColumnBeanTest.java (working copy) @@ -1,61 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import junit.framework.TestCase; -import org.jboss.dna.common.jdbc.model.api.KeyColumn; - -/** - * KeyColumnBean test - */ -public class KeyColumnBeanTest extends TestCase { - - private KeyColumn bean; - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - // create - bean = new KeyColumnBean(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - // release - bean = null; - - super.tearDown(); - } - - public void testKeyColumnBean() { - assertNotNull("Unable to create KeyColumn", bean); - } - -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/ParameterBeanTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/ParameterBeanTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/ParameterBeanTest.java (working copy) @@ -1,74 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import junit.framework.TestCase; -import org.jboss.dna.common.jdbc.model.api.Parameter; -import org.jboss.dna.common.jdbc.model.api.ParameterIoType; - -/** - * ParameterBean test - * - * @author Sergiy Litsenko - */ -public class ParameterBeanTest extends TestCase { - private Parameter bean; - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - // create - bean = new ParameterBean(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - // release - bean = null; - - super.tearDown(); - } - - public void testSetIoType() { - // set - bean.setIoType(ParameterIoType.IN_OUT); - // check - assertSame("Unable to set I/O type", ParameterIoType.IN_OUT, bean.getIoType()); - } - - public void testSetScale() { - Integer scale = new Integer(3); - // set - bean.setScale(scale); - // check - assertSame("Unable to set scale", scale, bean.getScale()); - } - -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/PrimaryKeyBeanTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/PrimaryKeyBeanTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/PrimaryKeyBeanTest.java (working copy) @@ -1,111 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import java.util.Set; -import junit.framework.TestCase; -import org.jboss.dna.common.jdbc.model.DefaultModelFactory; -import org.jboss.dna.common.jdbc.model.api.PrimaryKey; -import org.jboss.dna.common.jdbc.model.api.PrimaryKeyColumn; - -/** - * PrimaryKeyBean test - * - * @author Sergiy Litsenko - */ -public class PrimaryKeyBeanTest extends TestCase { - - private PrimaryKey bean; - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - // create - bean = new PrimaryKeyBean(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - // release - bean = null; - - super.tearDown(); - } - - public void testGetColumns() { - Set columns = bean.getColumns(); - // check - assertNotNull("Unable to get columns", columns); - assertTrue("Column set should be empty by default", columns.isEmpty()); - } - - public void testAddColumn() { - String COLUMN_NAME = "My column"; - // create column - PrimaryKeyColumn column = new DefaultModelFactory().createPrimaryKeyColumn(); - // set name - column.setName(COLUMN_NAME); - // add column - bean.addColumn(column); - // check - assertFalse("Column set should not be empty", bean.getColumns().isEmpty()); - } - - public void testDeleteColumn() { - String COLUMN_NAME = "My column"; - // create column - PrimaryKeyColumn column = new DefaultModelFactory().createPrimaryKeyColumn(); - // set name - column.setName(COLUMN_NAME); - // add column - bean.addColumn(column); - // check - assertFalse("Column set should not be empty", bean.getColumns().isEmpty()); - - // delete - bean.deleteColumn(column); - // check - assertTrue("Column set should be empty", bean.getColumns().isEmpty()); - } - - public void testFindColumnByName() { - String COLUMN_NAME = "My column"; - // create column - PrimaryKeyColumn column = new DefaultModelFactory().createPrimaryKeyColumn(); - // set name - column.setName(COLUMN_NAME); - // add column - bean.addColumn(column); - - // check - assertSame("Unable to find column", column, bean.findColumnByName(COLUMN_NAME)); - } - -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/PrimaryKeyColumnBeanTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/PrimaryKeyColumnBeanTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/PrimaryKeyColumnBeanTest.java (working copy) @@ -1,63 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import junit.framework.TestCase; -import org.jboss.dna.common.jdbc.model.api.PrimaryKeyColumn; - -/** - * PrimaryKeyColumnBean test - * - * @author Sergiy Litsenko - */ -public class PrimaryKeyColumnBeanTest extends TestCase { - - private PrimaryKeyColumn bean; - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - // create - bean = new PrimaryKeyColumnBean(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - // release - bean = null; - - super.tearDown(); - } - - public void testPrimaryKeyColumnBean() { - assertNotNull("Unable to create PrimaryKeyColumn", bean); - } - -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/PrivilegeBeanTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/PrivilegeBeanTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/PrivilegeBeanTest.java (working copy) @@ -1,106 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import junit.framework.TestCase; -import org.jboss.dna.common.jdbc.model.api.Privilege; -import org.jboss.dna.common.jdbc.model.api.PrivilegeType; - -/** - * PrivilegeBean test - * - * @author Sergiy Litsenko - */ -public class PrivilegeBeanTest extends TestCase { - - private Privilege bean; - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - // create - bean = new PrivilegeBean(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - bean = null; - - super.tearDown(); - } - - public void testSetPrivilegeType() { - // set - bean.setPrivilegeType(PrivilegeType.UPDATE); - // check - assertSame("Unable to set priviledge", PrivilegeType.UPDATE, bean.getPrivilegeType()); - } - - public void testSetGrantor() { - String grantor = "Me"; - // set - bean.setGrantor(grantor); - // check - assertEquals("Unable to set grantor", grantor, bean.getGrantor()); - } - - public void testSetGrantee() { - String grantee = "You"; - // set - bean.setGrantee(grantee); - // check - assertEquals("Unable to set grantee", grantee, bean.getGrantee()); - } - - public void testSetName() { - String name = "The name"; - // set - bean.setName(name); - // check - assertEquals("Unable to set name", name, bean.getName()); - } - - public void testSetGrantable() { - Boolean grantable = Boolean.TRUE; - // set - bean.setGrantable(grantable); - // check - assertSame("Unable to set grantable", grantable, bean.isGrantable()); - } - - public void testSetUnknownGrantable() { - Boolean unknownGrantable = Boolean.TRUE; - // set - bean.setUnknownGrantable(unknownGrantable); - // check - assertSame("Unable to set unknown grantable", unknownGrantable, bean.isUnknownGrantable()); - } - -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/ReferenceBeanTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/ReferenceBeanTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/ReferenceBeanTest.java (working copy) @@ -1,77 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import junit.framework.TestCase; -import org.jboss.dna.common.jdbc.model.DefaultModelFactory; -import org.jboss.dna.common.jdbc.model.api.Reference; -import org.jboss.dna.common.jdbc.model.api.SqlType; -import org.jboss.dna.common.jdbc.model.api.Table; - -/** - * ReferenceBean test - * - * @author Sergiy Litsenko - */ -public class ReferenceBeanTest extends TestCase { - - private Reference bean; - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - // create - bean = new ReferenceBean(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - // release - bean = null; - - super.tearDown(); - } - - public void testSetSourceTable() { - Table sourceTable = new DefaultModelFactory().createTable(); - // set - bean.setSourceTable(sourceTable); - // check - assertSame("Unable to set source table", sourceTable, bean.getSourceTable()); - } - - public void testSetSourceDataType() { - // set - bean.setSourceDataType(SqlType.VARCHAR); - // check - assertSame("Unable to set source data type", SqlType.VARCHAR, bean.getSourceDataType()); - } - -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/SchemaBeanTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/SchemaBeanTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/SchemaBeanTest.java (working copy) @@ -1,69 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import junit.framework.TestCase; -import org.jboss.dna.common.jdbc.model.DefaultModelFactory; -import org.jboss.dna.common.jdbc.model.api.Catalog; -import org.jboss.dna.common.jdbc.model.api.Schema; - -/** - * SchemaBean test - * - * @author Sergiy Litsenko - */ -public class SchemaBeanTest extends TestCase { - - private Schema bean; - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - // create - bean = new SchemaBean(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - // release - bean = null; - - super.tearDown(); - } - - public void testSetCatalog() { - Catalog catalog = new DefaultModelFactory().createCatalog(); - // set - bean.setCatalog(catalog); - // check - assertSame("Unable to set catalog", catalog, bean.getCatalog()); - } - -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/SchemaObjectBeanTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/SchemaObjectBeanTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/SchemaObjectBeanTest.java (working copy) @@ -1,77 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import junit.framework.TestCase; -import org.jboss.dna.common.jdbc.model.DefaultModelFactory; -import org.jboss.dna.common.jdbc.model.api.Catalog; -import org.jboss.dna.common.jdbc.model.api.Schema; -import org.jboss.dna.common.jdbc.model.api.SchemaObject; - -/** - * SchemaObjectBean test - * - * @author Sergiy Litsenko - */ -public class SchemaObjectBeanTest extends TestCase { - - private SchemaObject bean; - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - // create - bean = new SchemaObjectBean(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - // release - bean = null; - - super.tearDown(); - } - - public void testSetCatalog() { - Catalog catalog = new DefaultModelFactory().createCatalog(); - // set - bean.setCatalog(catalog); - // check - assertSame("Unable to set catalog", catalog, bean.getCatalog()); - } - - public void testSetSchema() { - Schema schema = new DefaultModelFactory().createSchema(); - // set - bean.setSchema(schema); - // check - assertSame("Unable to set schema", schema, bean.getSchema()); - } -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/SqlTypeConversionPairBeanTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/SqlTypeConversionPairBeanTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/SqlTypeConversionPairBeanTest.java (working copy) @@ -1,74 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import junit.framework.TestCase; -import org.jboss.dna.common.jdbc.model.api.SqlType; -import org.jboss.dna.common.jdbc.model.api.SqlTypeConversionPair; - -/** - * SqlTypeConversionPairBean test - * - * @author Sergiy Litsenko - */ -public class SqlTypeConversionPairBeanTest extends TestCase { - - private SqlTypeConversionPair bean; - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - // create - bean = new SqlTypeConversionPairBean(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - // release - bean = null; - - super.tearDown(); - } - - public void testSetSrcType() { - // set - bean.setSrcType(SqlType.VARCHAR); - // check - assertSame("Unable to set source type", SqlType.VARCHAR, bean.getSrcType()); - } - - public void testSetDestType() { - // set - bean.setDestType(SqlType.VARCHAR); - // check - assertSame("Unable to set destination type", SqlType.VARCHAR, bean.getDestType()); - } - -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/SqlTypeInfoBeanTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/SqlTypeInfoBeanTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/SqlTypeInfoBeanTest.java (working copy) @@ -1,180 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import junit.framework.TestCase; -import org.jboss.dna.common.jdbc.model.api.NullabilityType; -import org.jboss.dna.common.jdbc.model.api.SearchabilityType; -import org.jboss.dna.common.jdbc.model.api.SqlType; -import org.jboss.dna.common.jdbc.model.api.SqlTypeInfo; - -/** - * SqlTypeInfoBean test - * - * @author Sergiy Litsenko - */ -public class SqlTypeInfoBeanTest extends TestCase { - - private SqlTypeInfo bean; - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - // create - bean = new SqlTypeInfoBean(); - - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - // release - bean = null; - - super.tearDown(); - } - - public void testSetLocalizedTypeName() { - String localizedTypeName = "Localized"; - // set - bean.setLocalizedTypeName(localizedTypeName); - // check - assertEquals("Unable to set localized Type Name", localizedTypeName, bean.getLocalizedTypeName()); - } - - public void testSetNullabilityType() { - // set - bean.setNullabilityType(NullabilityType.NULLABLE); - // check - assertSame("Unable to set nullability type", NullabilityType.NULLABLE, bean.getNullabilityType()); - } - - public void testSetSqlType() { - // set - bean.setSqlType(SqlType.VARCHAR); - // check - assertSame("Unable to set SQL type", SqlType.VARCHAR, bean.getSqlType()); - } - - public void testSetPrecision() { - Long precision = new Long(5); - // set - bean.setPrecision(precision); - // check - assertSame("Unable to set precision", precision, bean.getPrecision()); - } - - public void testSetFixedPrecisionScale() { - Boolean fixedPrecisionScale = Boolean.TRUE; - // set - bean.setFixedPrecisionScale(fixedPrecisionScale); - // check - assertSame("Unable to set fixed precision scale", fixedPrecisionScale, bean.isFixedPrecisionScale()); - } - - public void testSetNumberPrecisionRadix() { - Integer numberPrecisionRadix = new Integer(10); - // set - bean.setNumberPrecisionRadix(numberPrecisionRadix); - // check - assertSame("Unable to set number precision radix", numberPrecisionRadix, bean.getNumberPrecisionRadix()); - } - - public void testSetMinScale() { - Integer minScale = new Integer(1); - // set - bean.setMinScale(minScale); - // check - assertSame("Unable to set min scale", minScale, bean.getMinScale()); - } - - public void testSetMaxScale() { - Integer maxScale = new Integer(10); - // set - bean.setMaxScale(maxScale); - // check - assertSame("Unable to set max scale", maxScale, bean.getMaxScale()); - } - - public void testSetLiteralPrefix() { - String literalPrefix = "Prefix"; - // set - bean.setLiteralPrefix(literalPrefix); - // check - assertEquals("Unable to set literal prefix", literalPrefix, bean.getLiteralPrefix()); - } - - public void testSetLiteralSuffix() { - String literalSuffix = "Suffix"; - // set - bean.setLiteralSuffix(literalSuffix); - // check - assertEquals("Unable to set literal suffix", literalSuffix, bean.getLiteralSuffix()); - } - - public void testSetCreateParams() { - String createParams = "My params"; - // set - bean.setCreateParams(createParams); - // check - assertEquals("Unable to set create params", createParams, bean.getCreateParams()); - } - - public void testSetCaseSensitive() { - Boolean caseSensitive = Boolean.TRUE; - // set - bean.setCaseSensitive(caseSensitive); - // check - assertSame("Unable to set case sensitive", caseSensitive, bean.isCaseSensitive()); - } - - public void testSetSearchabilityType() { - // set - bean.setSearchabilityType(SearchabilityType.BASIC); - // check - assertSame("Unable to set searchability type", SearchabilityType.BASIC, bean.getSearchabilityType()); - } - - public void testSetUnsigned() { - Boolean unsigned = Boolean.TRUE; - // set - bean.setUnsigned(unsigned); - // check - assertSame("Unable to set unsigned", unsigned, bean.isUnsigned()); - } - - public void testSetAutoIncrement() { - Boolean autoIncrement = Boolean.TRUE; - // set - bean.setAutoIncrement(autoIncrement); - // check - assertSame("Unable to set auto increment", autoIncrement, bean.isAutoIncrement()); - } - -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/StoredProcedureBeanTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/StoredProcedureBeanTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/StoredProcedureBeanTest.java (working copy) @@ -1,118 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import java.util.Set; -import junit.framework.TestCase; -import org.jboss.dna.common.jdbc.model.DefaultModelFactory; -import org.jboss.dna.common.jdbc.model.api.Parameter; -import org.jboss.dna.common.jdbc.model.api.StoredProcedure; -import org.jboss.dna.common.jdbc.model.api.StoredProcedureResultType; - -/** - * StoredProcedureBean test - * - * @author Sergiy Litsenko - */ -public class StoredProcedureBeanTest extends TestCase { - - private StoredProcedure bean; - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - // create - bean = new StoredProcedureBean(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - // release - bean = null; - - super.tearDown(); - } - - public void testSetResultType() { - // set - bean.setResultType(StoredProcedureResultType.RETURNS_RESULT); - // check - assertSame("Unable to set result type", StoredProcedureResultType.RETURNS_RESULT, bean.getResultType()); - } - - public void testGetParameters() { - Set parameters = bean.getParameters(); - // check - assertNotNull("Unable to get parameters", parameters); - assertTrue("Parameter set should be empty by default", parameters.isEmpty()); - } - - public void testAddParameter() { - String PARAMETER_NAME = "My parameter"; - // create parameter - Parameter parameter = new DefaultModelFactory().createParameter(); - // set name - parameter.setName(PARAMETER_NAME); - // add - bean.addParameter(parameter); - // check - assertFalse("Parameter set should not be empty", bean.getParameters().isEmpty()); - } - - public void testDeleteParameter() { - String PARAMETER_NAME = "My parameter"; - // create parameter - Parameter parameter = new DefaultModelFactory().createParameter(); - // set name - parameter.setName(PARAMETER_NAME); - // add - bean.addParameter(parameter); - // check - assertFalse("Parameter set should not be empty", bean.getParameters().isEmpty()); - - // delete - bean.deleteParameter(parameter); - // check - assertTrue("Parameter set should be empty", bean.getParameters().isEmpty()); - } - - public void testFindParameterByName() { - String PARAMETER_NAME = "My parameter"; - // create parameter - Parameter parameter = new DefaultModelFactory().createParameter(); - // set name - parameter.setName(PARAMETER_NAME); - // add - bean.addParameter(parameter); - // check - assertSame("Unable to find parameter", parameter, bean.findParameterByName(PARAMETER_NAME)); - } - -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/TableBeanTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/TableBeanTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/TableBeanTest.java (working copy) @@ -1,436 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import java.util.Set; -import junit.framework.TestCase; -import org.jboss.dna.common.jdbc.model.DefaultModelFactory; -import org.jboss.dna.common.jdbc.model.ModelFactory; -import org.jboss.dna.common.jdbc.model.api.BestRowIdentifier; -import org.jboss.dna.common.jdbc.model.api.BestRowIdentifierScopeType; -import org.jboss.dna.common.jdbc.model.api.Catalog; -import org.jboss.dna.common.jdbc.model.api.ForeignKey; -import org.jboss.dna.common.jdbc.model.api.Index; -import org.jboss.dna.common.jdbc.model.api.PrimaryKey; -import org.jboss.dna.common.jdbc.model.api.Privilege; -import org.jboss.dna.common.jdbc.model.api.Schema; -import org.jboss.dna.common.jdbc.model.api.Table; -import org.jboss.dna.common.jdbc.model.api.TableColumn; -import org.jboss.dna.common.jdbc.model.api.TableType; - -/** - * TableBean test - * - * @author Sergiy Litsenko - */ -public class TableBeanTest extends TestCase { - - private Table bean; - private ModelFactory factory; - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - // create - bean = new TableBean(); - factory = new DefaultModelFactory(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - // release - bean = null; - factory = null; - super.tearDown(); - } - - public void testSetTableType() { - TableType tableType = factory.createTableType(); - // set - bean.setTableType(tableType); - - // check - assertSame("Unable to set table type", tableType, bean.getTableType()); - } - - public void testSetTypeCatalog() { - Catalog typeCatalog = factory.createCatalog(); - // set - bean.setTypeCatalog(typeCatalog); - // check - assertSame("Unable to set type catalog", typeCatalog, bean.getTypeCatalog()); - } - - public void testSetTypeSchema() { - Schema typeSchema = factory.createSchema(); - // set - bean.setTypeSchema(typeSchema); - // check - assertSame("Unable to set type schema", typeSchema, bean.getTypeSchema()); - } - - public void testSetTypeName() { - String typeName = "My type"; - // set - bean.setTypeName(typeName); - // check - assertSame("Unable to set type name", typeName, bean.getTypeName()); - } - - public void testSetSelfReferencingColumnName() { - String selfReferencingColumnName = "Self-Ref column name"; - // set - bean.setSelfReferencingColumnName(selfReferencingColumnName); - // check - assertSame("Unable to set self referencing column name", selfReferencingColumnName, bean.getSelfReferencingColumnName()); - } - - public void testSetReferenceGeneration() { - String referenceGeneration = "Reference generation"; - // set - bean.setReferenceGeneration(referenceGeneration); - // check - assertSame("Unable to set reference generation", referenceGeneration, bean.getReferenceGeneration()); - } - - public void testGetColumns() { - Set columns = bean.getColumns(); - // check - assertNotNull("Unable to get columns", columns); - assertTrue("Column set should be empty by default", columns.isEmpty()); - } - - public void testAddColumn() { - String COLUMN_NAME = "My column"; - // create column - TableColumn column = factory.createTableColumn(); - // set name - column.setName(COLUMN_NAME); - // add - bean.addColumn(column); - // check - assertFalse("column set should not be empty", bean.getColumns().isEmpty()); - } - - public void testDeleteColumn() { - String COLUMN_NAME = "My column"; - // create column - TableColumn column = factory.createTableColumn(); - // set name - column.setName(COLUMN_NAME); - // add - bean.addColumn(column); - // check - assertFalse("column set should not be empty", bean.getColumns().isEmpty()); - - // delete - bean.deleteColumn(column); - // check - assertTrue("Parameter set should be empty", bean.getColumns().isEmpty()); - } - - public void testFindColumnByName() { - String COLUMN_NAME = "My column"; - // create column - TableColumn column = factory.createTableColumn(); - // set name - column.setName(COLUMN_NAME); - // add - bean.addColumn(column); - // check - assertFalse("column set should not be empty", bean.getColumns().isEmpty()); - // check - assertSame("Unable to find column", column, bean.findColumnByName(COLUMN_NAME)); - } - - public void testSetPrimaryKey() { - PrimaryKey primaryKey = factory.createPrimaryKey(); - // set - bean.setPrimaryKey(primaryKey); - // check - assertSame("Unable to set primary key", primaryKey, bean.getPrimaryKey()); - } - - public void testGetForeignKeys() { - Set foreignKeys = bean.getForeignKeys(); - // check - assertNotNull("Unable to get FK list", foreignKeys); - assertTrue("FK set should be empty by default", foreignKeys.isEmpty()); - } - - public void testAddForeignKey() { - String NAME = "My FK"; - // create FK - ForeignKey fk = factory.createForeignKey(); - // set name - fk.setName(NAME); - // add - bean.addForeignKey(fk); - // check - assertFalse("FK set should not be empty", bean.getForeignKeys().isEmpty()); - } - - public void testDeleteForeignKey() { - String NAME = "My FK"; - // create FK - ForeignKey fk = factory.createForeignKey(); - // set name - fk.setName(NAME); - // add - bean.addForeignKey(fk); - // check - assertFalse("FK set should not be empty", bean.getForeignKeys().isEmpty()); - - // delete - bean.deleteForeignKey(fk); - // check - assertTrue("FK set should be empty", bean.getForeignKeys().isEmpty()); - } - - public void testFindForeignKeyByName() { - String NAME = "My FK"; - // create FK - ForeignKey fk = factory.createForeignKey(); - // set name - fk.setName(NAME); - // add - bean.addForeignKey(fk); - // check - assertFalse("FK set should not be empty", bean.getForeignKeys().isEmpty()); - // check - assertSame("Unable to find FK", fk, bean.findForeignKeyByName(NAME)); - } - - public void testGetIndexes() { - Set indexes = bean.getIndexes(); - // check - assertNotNull("Unable to get Indexes", indexes); - assertTrue("Index set should be empty by default", indexes.isEmpty()); - } - - public void testAddIndex() { - String NAME = "My Index"; - // create FK - Index i = factory.createIndex(); - // set name - i.setName(NAME); - // add - bean.addIndex(i); - // check - assertFalse("Index set should not be empty", bean.getIndexes().isEmpty()); - } - - public void testDeleteIndex() { - String NAME = "My Index"; - // create FK - Index i = factory.createIndex(); - // set name - i.setName(NAME); - // add - bean.addIndex(i); - // check - assertFalse("Index set should not be empty", bean.getIndexes().isEmpty()); - - // delete - bean.deleteIndex(i); - // check - assertTrue("*Index set should be empty", bean.getIndexes().isEmpty()); - } - - public void testFindIndexByName() { - String NAME = "My Index"; - // create FK - Index i = factory.createIndex(); - // set name - i.setName(NAME); - // add - bean.addIndex(i); - // check - assertFalse("Index set should not be empty", bean.getIndexes().isEmpty()); - // check - assertSame("Unable to find Index", i, bean.findIndexByName(NAME)); - } - - public void testGetVersionColumns() { - Set columns = bean.getVersionColumns(); - // check - assertNotNull("Unable to get version columns", columns); - assertTrue("Version column set should be empty by default", columns.isEmpty()); - } - - public void testAddVersionColumn() { - String COLUMN_NAME = "My column"; - // create column - TableColumn column = factory.createTableColumn(); - // set name - column.setName(COLUMN_NAME); - // add - bean.addVersionColumn(column); - // check - assertFalse("column set should not be empty", bean.getVersionColumns().isEmpty()); - } - - public void testDeleteVersionColumn() { - String COLUMN_NAME = "My column"; - // create column - TableColumn column = factory.createTableColumn(); - // set name - column.setName(COLUMN_NAME); - // add - bean.addVersionColumn(column); - // check - assertFalse("column set should not be empty", bean.getVersionColumns().isEmpty()); - - // delete - bean.deleteVersionColumn(column); - // check - assertTrue("Version Column set should be empty", bean.getVersionColumns().isEmpty()); - } - - public void testFindVersionColumnByName() { - String COLUMN_NAME = "My column"; - // create column - TableColumn column = factory.createTableColumn(); - // set name - column.setName(COLUMN_NAME); - // add - bean.addVersionColumn(column); - // check - assertFalse("column set should not be empty", bean.getVersionColumns().isEmpty()); - // check - assertSame("Unable to find column", column, bean.findVersionColumnByName(COLUMN_NAME)); - } - - public void testGetPrivileges() { - Set privileges = bean.getPrivileges(); - // check - assertNotNull("Unable to get privileges", privileges); - assertTrue("Privilege set should be empty by default", privileges.isEmpty()); - } - - public void testAddPrivilege() { - String NAME = "My privilege"; - // create privilege - Privilege privilege = factory.createPrivilege(); - // set name - privilege.setName(NAME); - // add - bean.addPrivilege(privilege); - // check - assertFalse("Privilege set should not be empty", bean.getPrivileges().isEmpty()); - } - - public void testDeletePrivilege() { - String NAME = "My privilege"; - // create privilege - Privilege privilege = factory.createPrivilege(); - // set name - privilege.setName(NAME); - // add - bean.addPrivilege(privilege); - // check - assertFalse("Privilege set should not be empty", bean.getPrivileges().isEmpty()); - // delete - bean.deletePrivilege(privilege); - // check - assertTrue("Privilege set should be empty", bean.getPrivileges().isEmpty()); - } - - public void testFindPriviledgeByName() { - String NAME = "My privilege"; - // create privilege - Privilege privilege = factory.createPrivilege(); - // set name - privilege.setName(NAME); - // add - bean.addPrivilege(privilege); - // check - assertFalse("Privilege set should not be empty", bean.getPrivileges().isEmpty()); - // check - assertSame("Unable to find privilege", privilege, bean.findPriviledgeByName(NAME)); - } - - public void testGetBestRowIdentifiers() { - Set bris = bean.getBestRowIdentifiers(); - // check - assertNotNull("Unable to get BestRowIdentifiers", bris); - assertTrue("BestRowIdentifier set should be empty by default", bris.isEmpty()); - } - - public void testAddBestRowIdentifier() { - // create - BestRowIdentifier id = factory.createBestRowIdentifier(); - // set scope - id.setScopeType(BestRowIdentifierScopeType.SESSION); - // add - bean.addBestRowIdentifier(id); - // check - assertFalse("BestRowIdentifier set should not be empty", bean.getBestRowIdentifiers().isEmpty()); - } - - public void testDeleteBestRowIdentifier() { - // create privilege - BestRowIdentifier id = factory.createBestRowIdentifier(); - // set scope - id.setScopeType(BestRowIdentifierScopeType.SESSION); - // add - bean.addBestRowIdentifier(id); - // check - assertFalse("BestRowIdentifier set should not be empty", bean.getBestRowIdentifiers().isEmpty()); - // delete - bean.deleteBestRowIdentifier(id); - // check - assertTrue("BestRowIdentifier set should be empty", bean.getBestRowIdentifiers().isEmpty()); - } - - public void testFindBestRowIdentifierByScopeType() { - // create privilege - BestRowIdentifier id = factory.createBestRowIdentifier(); - // set scope - id.setScopeType(BestRowIdentifierScopeType.SESSION); - // add - bean.addBestRowIdentifier(id); - // check - assertFalse("BestRowIdentifier set should not be empty", bean.getBestRowIdentifiers().isEmpty()); - // check - assertSame("Unable to find BestRowIdentifier", - id, - bean.findBestRowIdentifierByScopeType(BestRowIdentifierScopeType.SESSION)); - } - - public void testSetSuperTable() { - Table superTable = factory.createTable(); - // set - bean.setSuperTable(superTable); - // check - assertSame("Unable to set super table", superTable, bean.getSuperTable()); - } - -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/TableColumnBeanTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/TableColumnBeanTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/TableColumnBeanTest.java (working copy) @@ -1,111 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import junit.framework.TestCase; -import org.jboss.dna.common.jdbc.model.DefaultModelFactory; -import org.jboss.dna.common.jdbc.model.api.ColumnPseudoType; -import org.jboss.dna.common.jdbc.model.api.Reference; -import org.jboss.dna.common.jdbc.model.api.TableColumn; - -/** - * TableColumnBean test - * - * @author Sergiy Litsenko - */ -public class TableColumnBeanTest extends TestCase { - - private TableColumn bean; - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - // create - bean = new TableColumnBean(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - // release - bean = null; - super.tearDown(); - } - - public void testSetBestRowIdentifier() { - // set - bean.setBestRowIdentifier(Boolean.TRUE); - // check - assertSame("Unable to set BestRowIdentifier", Boolean.TRUE, bean.isBestRowIdentifier()); - } - - public void testSetPseudoType() { - // set - bean.setPseudoType(ColumnPseudoType.NOT_PSEUDO); - // check - assertSame("Unable to set column pseudo type", ColumnPseudoType.NOT_PSEUDO, bean.getPseudoType()); - } - - public void testSetReference() { - Reference reference = new DefaultModelFactory().createReference(); - // set - bean.setReference(reference); - // check - assertSame("Unable to set reference", reference, bean.getReference()); - } - - public void testSetVersionColumn() { - // set - bean.setVersionColumn(Boolean.TRUE); - // check - assertSame("Unable to set VersionColumn", Boolean.TRUE, bean.isVersionColumn()); - } - - public void testSetPrimaryKeyColumn() { - // set - bean.setPrimaryKeyColumn(Boolean.TRUE); - // check - assertSame("Unable to set PrimaryKeyColumn", Boolean.TRUE, bean.isPrimaryKeyColumn()); - } - - public void testSetForeignKeyColumn() { - // set - bean.setForeignKeyColumn(Boolean.TRUE); - // check - assertSame("Unable to set ForeignKeyColumn", Boolean.TRUE, bean.isForeignKeyColumn()); - } - - public void testSetIndexColumn() { - // set - bean.setIndexColumn(Boolean.TRUE); - // check - assertSame("Unable to set IndexColumn", Boolean.TRUE, bean.isIndexColumn()); - } - -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/TableTypeBeanTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/TableTypeBeanTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/TableTypeBeanTest.java (working copy) @@ -1,133 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import junit.framework.TestCase; -import org.jboss.dna.common.jdbc.model.api.TableType; - -/** - * TableTypeBean test - * - * @author Sergiy Litsenko - */ -public class TableTypeBeanTest extends TestCase { - - private TableType bean; - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - // create - bean = new TableTypeBean(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - // release - bean = null; - super.tearDown(); - } - - public void testSetName() { - String tableTypeName = "My type name"; - // set - bean.setName(tableTypeName); - // check - assertSame("Unable to set table type name", tableTypeName, bean.getName()); - } - - /* - * Class under test for Boolean isTable() - */ - public void testIsTable() { - // set - bean.setName(TableType.DEF_TABLE_TYPE_TABLE); - // check - assertTrue("Unable to set table type to table", bean.isTable()); - } - - /* - * Class under test for Boolean isView() - */ - public void testIsView() { - // set - bean.setName(TableType.DEF_TABLE_TYPE_VIEW); - // check - assertTrue("Unable to set table type to view", bean.isView()); - } - - /* - * Class under test for Boolean isSystemTable() - */ - public void testIsSystemTable() { - // set - bean.setName(TableType.DEF_TABLE_TYPE_SYS_TABLE); - // check - assertTrue("Unable to set table type to system table", bean.isSystemTable()); - } - - /* - * Class under test for Boolean isGlobalTemporary() - */ - public void testIsGlobalTemporary() { - // set - bean.setName(TableType.DEF_TABLE_TYPE_GLOBAL_TEMP); - // check - assertTrue("Unable to set table type to global temporary", bean.isGlobalTemporary()); - } - - public void testIsLocalTemporary() { - // set - bean.setName(TableType.DEF_TABLE_TYPE_LOCAL_TEMP); - // check - assertTrue("Unable to set table type to local temporary", bean.isLocalTemporary()); - } - - /* - * Class under test for Boolean isAlias() - */ - public void testIsAlias() { - // set - bean.setName(TableType.DEF_TABLE_TYPE_ALIAS); - // check - assertTrue("Unable to set table type to alias", bean.isAlias()); - } - - /* - * Class under test for Boolean isSynonym() - */ - public void testIsSynonym() { - // set - bean.setName(TableType.DEF_TABLE_TYPE_SYNONYM); - // check - assertTrue("Unable to set table type to synonym", bean.isSynonym()); - } - -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/UserDefinedTypeBeanTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/UserDefinedTypeBeanTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/model/spi/UserDefinedTypeBeanTest.java (working copy) @@ -1,137 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.model.spi; - -import java.util.Set; -import junit.framework.TestCase; -import org.jboss.dna.common.jdbc.model.DefaultModelFactory; -import org.jboss.dna.common.jdbc.model.api.Attribute; -import org.jboss.dna.common.jdbc.model.api.SqlType; -import org.jboss.dna.common.jdbc.model.api.UserDefinedType; - -/** - * UserDefinedTypeBean test - * - * @author Sergiy Litsenko - */ -public class UserDefinedTypeBeanTest extends TestCase { - - private UserDefinedType bean; - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - // create - bean = new UserDefinedTypeBean(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - // release - bean = null; - - super.tearDown(); - } - - public void testSetClassName() { - String className = "My class"; - // set - bean.setClassName(className); - // check - assertSame("Unable to set class name", className, bean.getClassName()); - } - - public void testSetSqlType() { - // set - bean.setSqlType(SqlType.VARCHAR); - // check - assertSame("Unable to set SQL type", SqlType.VARCHAR, bean.getSqlType()); - } - - public void testSetBaseType() { - // set - bean.setBaseType(SqlType.VARCHAR); - // check - assertSame("Unable to set base type", SqlType.VARCHAR, bean.getBaseType()); - } - - public void testGetAttributes() { - Set attributes = bean.getAttributes(); - // check - assertNotNull("Unable to get attributes", attributes); - assertTrue("Attribute set should be empty by default", attributes.isEmpty()); - } - - public void testAddAttribute() { - String NAME = "My name"; - Attribute a = new DefaultModelFactory().createAttribute(); - // set name - a.setName(NAME); - // add - bean.addAttribute(a); - // check - assertFalse("Attribute set should not be empty", bean.getAttributes().isEmpty()); - } - - public void testDeleteAttribute() { - String NAME = "My name"; - Attribute a = new DefaultModelFactory().createAttribute(); - // set name - a.setName(NAME); - // add - bean.addAttribute(a); - // check - assertFalse("Attribute set should not be empty", bean.getAttributes().isEmpty()); - // delete - bean.deleteAttribute(a); - // check - assertTrue("Attribute set should be empty", bean.getAttributes().isEmpty()); - } - - public void testFindAttributeByName() { - String NAME = "My name"; - Attribute a = new DefaultModelFactory().createAttribute(); - // set name - a.setName(NAME); - // add - bean.addAttribute(a); - // check - assertSame("Unable to find attribute", a, bean.findAttributeByName(NAME)); - } - - public void testSetSuperType() { - UserDefinedType st = new DefaultModelFactory().createUserDefinedType(); - // set - bean.setSuperType(st); - // check - assertSame("Unable to set super type", st, bean.getSuperType()); - } - -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/provider/DataSourceDatabaseMetadataProviderTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/provider/DataSourceDatabaseMetadataProviderTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/provider/DataSourceDatabaseMetadataProviderTest.java (working copy) @@ -1,241 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.provider; - -import java.util.Properties; -import junit.framework.TestCase; - -/** - * Data Source Database Metadata Provider Test - * - * @author Sergiy Litsenko - */ -public class DataSourceDatabaseMetadataProviderTest extends TestCase { - // ~ Static fields/initializers ------------------------------------------------------- - - private static final String PROVIDER_NAME = "TestProvider"; - private static final String DATA_SOURCE_NAME = "java:comp/env/jdbc/TestDataSource"; - private static final String INITIAL_CONTEXT_FACTORY = "org.jnp.interfaces.NamingContextFactory"; - private static final String PROVIDER_URL = "jnp://localhost:1099/"; - private final static String EMPTY_STRING_NOTATION = ""; - private final static String NULL_STRING_NOTATION = ""; - - // ~ Instance fields ------------------------------------------------------------------ - - private DataSourceDatabaseMetadataProvider dataSourceProvider; - - // ~ Methods -------------------------------------------------------------------------- - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - - // create provider - dataSourceProvider = new DefaultDataSourceDatabaseMetadataProvider(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - // release - dataSourceProvider = null; - super.tearDown(); - } - - /** - * Test get data source - * - * @throws Exception - */ - public void testGetDataSource() throws Exception { - // set provider name - dataSourceProvider.setName(PROVIDER_NAME); - - // set data source name - dataSourceProvider.setDataSourceName(DATA_SOURCE_NAME); - - // create properties - Properties properties = new Properties(); - - // set initial context factory - properties.put("java.naming.factory.initial", INITIAL_CONTEXT_FACTORY); - - // set provider URL - properties.put("java.naming.provider.url", PROVIDER_URL); - - // trying to set properties - dataSourceProvider.setProperties(properties); - - // TODO: validate the testGetDataSource - try { - // trying to get data source - dataSourceProvider.getDataSource(); - fail("DataSource provider should raise an exception when app server is not running"); - } catch (Exception e) { - // we're should be here because app server is not running so far - } - } - - /** - * test set data source name - */ - public void testSetDataSourceName() { - // set data source name - dataSourceProvider.setDataSourceName(DATA_SOURCE_NAME); - - // check that we really set the name - assertEquals("Unable to set the data source name", DATA_SOURCE_NAME, dataSourceProvider.getDataSourceName()); - } - - /** - * test release resources - */ - public void testRelease() { - dataSourceProvider.release(true); - } - - /** - * test get database meta data - */ - public void testGetDatabaseMetaData() { - // set provider name - dataSourceProvider.setName(PROVIDER_NAME); - - // set data source name - dataSourceProvider.setDataSourceName(DATA_SOURCE_NAME); - - // create properties - Properties properties = new Properties(); - - // set initial context factory - properties.put("java.naming.factory.initial", INITIAL_CONTEXT_FACTORY); - - // set provider URL - properties.put("java.naming.provider.url", PROVIDER_URL); - - // trying to set properties - dataSourceProvider.setProperties(properties); - - // TODO: validate the testGetDatabaseMetaData - try { - // trying to get connection - dataSourceProvider.getDatabaseMetaData(); - fail("DataSource provider should raise an exception when app server is not running"); - } catch (Exception e) { - // we're should be here because app server is not running so far - } - } - - /** - * Test get connection - * - * @throws Exception - */ - public void testGetConnection() throws Exception { - // set provider name - dataSourceProvider.setName(PROVIDER_NAME); - - // set data source name - dataSourceProvider.setDataSourceName(DATA_SOURCE_NAME); - - // create properties - Properties properties = new Properties(); - - // set initial context factory - properties.put("java.naming.factory.initial", INITIAL_CONTEXT_FACTORY); - - // set provider URL - properties.put("java.naming.provider.url", PROVIDER_URL); - - // trying to set properties - dataSourceProvider.setProperties(properties); - - // TODO: validate the testGetConnection - try { - // trying to get connection - dataSourceProvider.getConnection(); - fail("DataSource provider should raise an exception when app server is not running"); - } catch (Exception e) { - // we're should be here because app server is not running so far - } - } - - /** - * Test set name - */ - public void testSetName() { - // set provider name - dataSourceProvider.setName(PROVIDER_NAME); - - // check that we really set the name - assertEquals("Unable to set the data source provider name", PROVIDER_NAME, dataSourceProvider.getName()); - } - - /** - * Test set properties - */ - public void testSetProperties() { - // create properties - Properties properties = new Properties(); - - // set initial context factory - properties.put("java.naming.factory.initial", INITIAL_CONTEXT_FACTORY); - - // set provider URL - properties.put("java.naming.provider.url", PROVIDER_URL); - - // trying to set properties - dataSourceProvider.setProperties(properties); - - // check that we're really set the properties - assertSame("Unable to set the data source provider properties", properties, dataSourceProvider.getProperties()); - } - - /** - * Test set string notation - */ - public void testSetEmptyStringNotation() { - // trying to set empty string notation - dataSourceProvider.setEmptyStringNotation(EMPTY_STRING_NOTATION); - - // check that we're really set the empty string notation - assertSame("Unable to set the empty string notation", EMPTY_STRING_NOTATION, dataSourceProvider.getEmptyStringNotation()); - } - - /** - * Test set null string notation - */ - public void testSetNullStringNotation() { - // trying to set NULL string notation - dataSourceProvider.setNullStringNotation(NULL_STRING_NOTATION); - - // check that we're really set the empty string notation - assertSame("Unable to set the NULL string notation", NULL_STRING_NOTATION, dataSourceProvider.getNullStringNotation()); - } -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/provider/DriverDatabaseMetadataProviderTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/provider/DriverDatabaseMetadataProviderTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/provider/DriverDatabaseMetadataProviderTest.java (working copy) @@ -1,245 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.provider; - -import junit.framework.TestCase; - -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.util.Properties; - -/** - * Driver Database Metadata Provider Test - * - * @author Sergiy Litsenko - */ -public class DriverDatabaseMetadataProviderTest extends TestCase { - // ~ Static fields/initializers ------------------------------------------------------- - - private static final String PROVIDER_NAME = "TestProvider"; - private final static String DRIVER_CLASS_NAME = "org.hsqldb.jdbcDriver"; - private final static String DATABASE_URL = "jdbc:hsqldb:mem:test"; - private final static String USER_NAME = "sa"; - private final static String PASSWORD = ""; - private final static String EMPTY_STRING_NOTATION = ""; - private final static String NULL_STRING_NOTATION = ""; - - // ~ Instance fields ------------------------------------------------------------------ - - private DriverDatabaseMetadataProvider driverProvider; - - // ~ Methods -------------------------------------------------------------------------- - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - - // create provider - driverProvider = new DefaultDriverDatabaseMetadataProvider(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - // release - driverProvider = null; - super.tearDown(); - } - - /** - * COMMENT - */ - public void testSetDriverClassName() { - // set the driver class name - driverProvider.setDriverClassName(DRIVER_CLASS_NAME); - - // check that we're really set the driver class name - assertEquals("Unable to set the driver class name", DRIVER_CLASS_NAME, driverProvider.getDriverClassName()); - } - - /** - * COMMENT - */ - public void testSetDatabaseUrl() { - // set the database URL - driverProvider.setDatabaseUrl(DATABASE_URL); - - // check that we're really set the database URL - assertEquals("Unable to set the database URL", DATABASE_URL, driverProvider.getDatabaseUrl()); - } - - /** - * COMMENT - */ - public void testSetUserName() { - // set the user name - driverProvider.setUserName(USER_NAME); - - // check that we're really set the user name - assertEquals("Unable to set the user name", USER_NAME, driverProvider.getUserName()); - } - - /** - * COMMENT - */ - public void testSetPassword() { - // set the password - driverProvider.setPassword(PASSWORD); - - // check that we're really set the password - assertEquals("Unable to set the password", PASSWORD, driverProvider.getPassword()); - } - - /** - * COMMENT - */ - public void testRelease() { - driverProvider.release(true); - } - - /** - * COMMENT - * - * @throws Exception COMMENT - */ - public void testGetDatabaseMetaData() throws Exception { - // set provider name - driverProvider.setName(PROVIDER_NAME); - - // set the driver class name - driverProvider.setDriverClassName(DRIVER_CLASS_NAME); - - // set the database URL - driverProvider.setDatabaseUrl(DATABASE_URL); - - // set the user name - driverProvider.setUserName(USER_NAME); - - // set the password - driverProvider.setPassword(PASSWORD); - - // validate the testGetDatabaseMetaData - try { - // trying to get connection - DatabaseMetaData databaseMetaData = driverProvider.getDatabaseMetaData(); - // check - assertNotNull("Database metadata shall be provided", databaseMetaData); - // fail ("Driver provider should raise an exception when DB server is not running"); - // } catch (Exception e) { - // we're should be here because DB server is not running so far - // } - } finally { - // release resource - driverProvider.release(true); - } - } - - /** - * COMMENT - * - * @throws Exception COMMENT - */ - public void testGetConnection() throws Exception { - // set provider name - driverProvider.setName(PROVIDER_NAME); - - // set the driver class name - driverProvider.setDriverClassName(DRIVER_CLASS_NAME); - - // set the database URL - driverProvider.setDatabaseUrl(DATABASE_URL); - - // set the user name - driverProvider.setUserName(USER_NAME); - - // set the password - driverProvider.setPassword(PASSWORD); - - // validate the testGetConnection - try { - // trying to get connection - Connection connection = driverProvider.getConnection(); - assertNotNull("Database connection shall be provided", connection); - // fail ("Driver provider should raise an exception when DB server is not running"); - // } catch (Exception e) { - // we're should be here because DB server is not running so far - // } - } finally { - // release resource - driverProvider.release(true); - } - } - - /** - * COMMENT - */ - public void testSetName() { - // set provider name - driverProvider.setName(PROVIDER_NAME); - - // check that we really set the name - assertEquals("Unable to set the driver provider name", PROVIDER_NAME, driverProvider.getName()); - } - - /** - * COMMENT - */ - public void testSetProperties() { - // create properties - Properties properties = new Properties(); - - // trying to set properties - driverProvider.setProperties(properties); - - // check that we're really set the properties - assertSame("Unable to set the driver provider properties", properties, driverProvider.getProperties()); - } - - /** - * COMMENT - */ - public void testSetEmptyStringNotation() { - // trying to set empty string notation - driverProvider.setEmptyStringNotation(EMPTY_STRING_NOTATION); - - // check that we're really set the empty string notation - assertSame("Unable to set the empty string notation", EMPTY_STRING_NOTATION, driverProvider.getEmptyStringNotation()); - } - - /** - * COMMENT - */ - public void testSetNullStringNotation() { - // trying to set NULL string notation - driverProvider.setNullStringNotation(NULL_STRING_NOTATION); - - // check that we're really set the empty string notation - assertSame("Unable to set the NULL string notation", NULL_STRING_NOTATION, driverProvider.getNullStringNotation()); - } -} Index: extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/util/DatabaseUtilTest.java =================================================================== --- extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/util/DatabaseUtilTest.java (revision 1450) +++ extensions/dna-common-jdbc/src/test/java/org/jboss/dna/common/jdbc/util/DatabaseUtilTest.java (working copy) @@ -1,532 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.common.jdbc.util; - -import junit.framework.TestCase; -import java.sql.Types; -import org.jboss.dna.common.jdbc.model.api.*; - -/** - * DatabaseUtil test - * - * @author Sergiy Litsenko - */ -public class DatabaseUtilTest extends TestCase { - - /* - * @see TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - } - - /* - * @see TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception { - super.tearDown(); - } - - /* - * Class under test for Boolean getBoolean(ResultSet, String) - */ - public void testGetBoolean() throws Exception { - // check - assertNull("getBoolean(null, 0) should return null", DatabaseUtil.getBoolean(null, 0)); - // check - assertNull("getBoolean(null, 'myColumn') should return null", DatabaseUtil.getBoolean(null, "myColumn")); - } - - /* - * Class under test for Integer getInteger(ResultSet, String) - */ - public void testGetInteger() throws Exception { - // check - assertNull("getInteger(null, 0) should return null", DatabaseUtil.getInteger(null, 0)); - // check - assertNull("getInteger(null, 'myColumn') should return null", DatabaseUtil.getInteger(null, "myColumn")); - } - - /* - * Class under test for Double getDouble(ResultSet, String) - */ - public void testGetDouble() throws Exception { - // check - assertNull("getDouble(null, 0) should return null", DatabaseUtil.getDouble(null, 0)); - // check - assertNull("getDouble(null, 'myColumn') should return null", DatabaseUtil.getDouble(null, "myColumn")); - } - - /* - * Class under test for String getString(ResultSet, String) - */ - public void testGetString() throws Exception { - // check - assertNull("getString(null, 0) should return null", DatabaseUtil.getString(null, 0)); - // check - assertNull("getString(null, 'myColumn') should return null", DatabaseUtil.getString(null, "myColumn")); - } - - public void testGetBestRowIdentifierScopeType() { - // check - assertNull("getBestRowIdentifierScopeType (null) should return null ", DatabaseUtil.getBestRowIdentifierScopeType(null)); - // check - assertSame("getBestRowIdentifierScopeType () should return BestRowIdentifierScopeType.TEMPORARY", - BestRowIdentifierScopeType.TEMPORARY, - DatabaseUtil.getBestRowIdentifierScopeType(BestRowIdentifierScopeType.TEMPORARY.getScope())); - // check - assertSame("getBestRowIdentifierScopeType () should return BestRowIdentifierScopeType.TRANSACTION", - BestRowIdentifierScopeType.TRANSACTION, - DatabaseUtil.getBestRowIdentifierScopeType(BestRowIdentifierScopeType.TRANSACTION.getScope())); - // check - assertSame("getBestRowIdentifierScopeType () should return BestRowIdentifierScopeType.SESSION", - BestRowIdentifierScopeType.SESSION, - DatabaseUtil.getBestRowIdentifierScopeType(BestRowIdentifierScopeType.SESSION.getScope())); - } - - public void testGetColumnPseudoType() { - // check - assertNull("getColumnPseudoType (null) should return null ", DatabaseUtil.getColumnPseudoType(null)); - // check - assertSame("getColumnPseudoType () should return ColumnPseudoType.UNKNOWN", - ColumnPseudoType.UNKNOWN, - DatabaseUtil.getColumnPseudoType(ColumnPseudoType.UNKNOWN.getType())); - // check - assertSame("getColumnPseudoType () should return ColumnPseudoType.NOT_PSEUDO", - ColumnPseudoType.NOT_PSEUDO, - DatabaseUtil.getColumnPseudoType(ColumnPseudoType.NOT_PSEUDO.getType())); - // check - assertSame("getColumnPseudoType () should return ColumnPseudoType.PSEUDO", - ColumnPseudoType.PSEUDO, - DatabaseUtil.getColumnPseudoType(ColumnPseudoType.PSEUDO.getType())); - } - - public void testGetIndexType() { - // check - assertNull("getIndexType (null) should return null ", DatabaseUtil.getIndexType(null)); - // check - assertSame("getIndexType () should return IndexType.STATISTIC", - IndexType.STATISTIC, - DatabaseUtil.getIndexType(IndexType.STATISTIC.getType())); - // check - assertSame("getIndexType () should return IndexType.CLUSTERED", - IndexType.CLUSTERED, - DatabaseUtil.getIndexType(IndexType.CLUSTERED.getType())); - // check - assertSame("getIndexType () should return IndexType.HASHED", - IndexType.HASHED, - DatabaseUtil.getIndexType(IndexType.HASHED.getType())); - // check - assertSame("getIndexType () should return IndexType.OTHER", - IndexType.OTHER, - DatabaseUtil.getIndexType(IndexType.OTHER.getType())); - } - - public void testGetKeyDeferrabilityType() { - // check - assertNull("getKeyDeferrabilityType (null) should return null ", DatabaseUtil.getKeyDeferrabilityType(null)); - // check - assertSame("getKeyDeferrabilityType () should return KeyDeferrabilityType.INITIALLY_DEFERRED", - KeyDeferrabilityType.INITIALLY_DEFERRED, - DatabaseUtil.getKeyDeferrabilityType(KeyDeferrabilityType.INITIALLY_DEFERRED.getDeferrability())); - // check - assertSame("getKeyDeferrabilityType () should return KeyDeferrabilityType.INTIALLY_IMMEDIATE", - KeyDeferrabilityType.INTIALLY_IMMEDIATE, - DatabaseUtil.getKeyDeferrabilityType(KeyDeferrabilityType.INTIALLY_IMMEDIATE.getDeferrability())); - // check - assertSame("getKeyDeferrabilityType () should return KeyDeferrabilityType.NOT_DEFERRABLE", - KeyDeferrabilityType.NOT_DEFERRABLE, - DatabaseUtil.getKeyDeferrabilityType(KeyDeferrabilityType.NOT_DEFERRABLE.getDeferrability())); - } - - public void testGetKeyModifyRuleType() { - // check - assertNull("getKeyModifyRuleType (null) should return null ", DatabaseUtil.getKeyModifyRuleType(null)); - // check - assertSame("getKeyModifyRuleType () should return KeyModifyRuleType.CASCADE", - KeyModifyRuleType.CASCADE, - DatabaseUtil.getKeyModifyRuleType(KeyModifyRuleType.CASCADE.getRule())); - // check - assertSame("getKeyModifyRuleType () should return KeyModifyRuleType.RESTRICT", - KeyModifyRuleType.RESTRICT, - DatabaseUtil.getKeyModifyRuleType(KeyModifyRuleType.RESTRICT.getRule())); - // check - assertSame("getKeyModifyRuleType () should return KeyModifyRuleType.SET_NULL", - KeyModifyRuleType.SET_NULL, - DatabaseUtil.getKeyModifyRuleType(KeyModifyRuleType.SET_NULL.getRule())); - // check - assertSame("getKeyModifyRuleType () should return KeyModifyRuleType.NO_ACTION", - KeyModifyRuleType.NO_ACTION, - DatabaseUtil.getKeyModifyRuleType(KeyModifyRuleType.NO_ACTION.getRule())); - // check - assertSame("getKeyModifyRuleType () should return KeyModifyRuleType.SET_DEFAULT", - KeyModifyRuleType.SET_DEFAULT, - DatabaseUtil.getKeyModifyRuleType(KeyModifyRuleType.SET_DEFAULT.getRule())); - } - - public void testGetNullabilityType() { - // check - assertNull("getNullabilityType (null) should return null ", DatabaseUtil.getNullabilityType(null)); - // check - assertSame("getNullabilityType () should return NullabilityType.UNKNOWN", - NullabilityType.UNKNOWN, - DatabaseUtil.getNullabilityType(NullabilityType.UNKNOWN.getNullability())); - // check - assertSame("getNullabilityType () should return NullabilityType.NO_NULLS", - NullabilityType.NO_NULLS, - DatabaseUtil.getNullabilityType(NullabilityType.NO_NULLS.getNullability())); - // check - assertSame("getNullabilityType () should return NullabilityType.NULLABLE", - NullabilityType.NULLABLE, - DatabaseUtil.getNullabilityType(NullabilityType.NULLABLE.getNullability())); - } - - public void testGetParameterIoType() { - // check - assertNull("getParameterIoType (null) should return null ", DatabaseUtil.getParameterIoType(null)); - // check - assertSame("getParameterIoType () should return ParameterIoType.UNKNOWN", - ParameterIoType.UNKNOWN, - DatabaseUtil.getParameterIoType(ParameterIoType.UNKNOWN.getType())); - // check - assertSame("getParameterIoType () should return ParameterIoType.IN", - ParameterIoType.IN, - DatabaseUtil.getParameterIoType(ParameterIoType.IN.getType())); - // check - assertSame("getParameterIoType () should return ParameterIoType.IN_OUT", - ParameterIoType.IN_OUT, - DatabaseUtil.getParameterIoType(ParameterIoType.IN_OUT.getType())); - // check - assertSame("getParameterIoType () should return ParameterIoType.OUT", - ParameterIoType.OUT, - DatabaseUtil.getParameterIoType(ParameterIoType.OUT.getType())); - // check - assertSame("getParameterIoType () should return ParameterIoType.RET", - ParameterIoType.RET, - DatabaseUtil.getParameterIoType(ParameterIoType.RET.getType())); - // check - assertSame("getParameterIoType () should return ParameterIoType.RESULT", - ParameterIoType.RESULT, - DatabaseUtil.getParameterIoType(ParameterIoType.RESULT.getType())); - } - - public void testGetPrivilegeType() { - // check - assertNull("getPrivilegeType (null) should return null ", DatabaseUtil.getPrivilegeType(null)); - // check - assertSame("getPrivilegeType () should return PrivilegeType.INSERT", - PrivilegeType.INSERT, - DatabaseUtil.getPrivilegeType(PrivilegeType.INSERT.getType())); - // check - assertSame("getPrivilegeType () should return PrivilegeType.SELECT", - PrivilegeType.SELECT, - DatabaseUtil.getPrivilegeType(PrivilegeType.SELECT.getType())); - // check - assertSame("getPrivilegeType () should return PrivilegeType.UPDATE", - PrivilegeType.UPDATE, - DatabaseUtil.getPrivilegeType(PrivilegeType.UPDATE.getType())); - // check - assertSame("getPrivilegeType () should return PrivilegeType.DELETE", - PrivilegeType.DELETE, - DatabaseUtil.getPrivilegeType(PrivilegeType.DELETE.getType())); - // check - assertSame("getPrivilegeType () should return PrivilegeType.REFERENCE", - PrivilegeType.REFERENCE, - DatabaseUtil.getPrivilegeType(PrivilegeType.REFERENCE.getType())); - // check - assertSame("getPrivilegeType () should return PrivilegeType.OTHER", - PrivilegeType.OTHER, - DatabaseUtil.getPrivilegeType(PrivilegeType.OTHER.getType())); - } - - public void testGetResultSetConcurrencyType() { - // check - assertNull("getResultSetConcurrencyType (null) should return null ", DatabaseUtil.getResultSetConcurrencyType(null)); - // check - assertSame("getResultSetConcurrencyType () should return ResultSetConcurrencyType.READ_ONLY", - ResultSetConcurrencyType.READ_ONLY, - DatabaseUtil.getResultSetConcurrencyType(ResultSetConcurrencyType.READ_ONLY.getConcurrency())); - // check - assertSame("getResultSetConcurrencyType () should return ResultSetConcurrencyType.UPDATABLE", - ResultSetConcurrencyType.UPDATABLE, - DatabaseUtil.getResultSetConcurrencyType(ResultSetConcurrencyType.UPDATABLE.getConcurrency())); - } - - public void testGetResultSetHoldabilityType() { - // check - assertNull("getResultSetHoldabilityType (null) should return null ", DatabaseUtil.getResultSetHoldabilityType(null)); - // check - assertSame("getResultSetHoldabilityType () should return ResultSetHoldabilityType.HOLD_CURSORS_OVER_COMMIT", - ResultSetHoldabilityType.HOLD_CURSORS_OVER_COMMIT, - DatabaseUtil.getResultSetHoldabilityType(ResultSetHoldabilityType.HOLD_CURSORS_OVER_COMMIT.getHoldability())); - // check - assertSame("getResultSetHoldabilityType () should return ResultSetHoldabilityType.CLOSE_CURSORS_AT_COMMIT", - ResultSetHoldabilityType.CLOSE_CURSORS_AT_COMMIT, - DatabaseUtil.getResultSetHoldabilityType(ResultSetHoldabilityType.CLOSE_CURSORS_AT_COMMIT.getHoldability())); - } - - public void testGetResultSetType() { - // check - assertNull("getResultSetType (null) should return null ", DatabaseUtil.getResultSetType(null)); - // check - assertSame("getResultSetType () should return ResultSetType.FORWARD_ONLY ", - ResultSetType.FORWARD_ONLY, - DatabaseUtil.getResultSetType(ResultSetType.FORWARD_ONLY.getType())); - // check - assertSame("getResultSetType () should return ResultSetType.SCROLL_INSENSITIVE ", - ResultSetType.SCROLL_INSENSITIVE, - DatabaseUtil.getResultSetType(ResultSetType.SCROLL_INSENSITIVE.getType())); - // check - assertSame("getResultSetType () should return ResultSetType.SCROLL_SENSITIVE ", - ResultSetType.SCROLL_SENSITIVE, - DatabaseUtil.getResultSetType(ResultSetType.SCROLL_SENSITIVE.getType())); - } - - public void testGetSearchabilityType() { - // check - assertNull("getSearchabilityType (null) should return null ", DatabaseUtil.getSearchabilityType(null)); - // check - assertSame("getSearchabilityType () should return SearchabilityType.NOT_SUPPORTED ", - SearchabilityType.NOT_SUPPORTED, - DatabaseUtil.getSearchabilityType(SearchabilityType.NOT_SUPPORTED.getSearchability())); - // check - assertSame("getSearchabilityType () should return SearchabilityType.WHERE_LIKE ", - SearchabilityType.WHERE_LIKE, - DatabaseUtil.getSearchabilityType(SearchabilityType.WHERE_LIKE.getSearchability())); - // check - assertSame("getSearchabilityType () should return SearchabilityType.BASIC ", - SearchabilityType.BASIC, - DatabaseUtil.getSearchabilityType(SearchabilityType.BASIC.getSearchability())); - // check - assertSame("getSearchabilityType () should return SearchabilityType.SEARCHABLE ", - SearchabilityType.SEARCHABLE, - DatabaseUtil.getSearchabilityType(SearchabilityType.SEARCHABLE.getSearchability())); - } - - public void testGetSortSequenceType() { - // check - assertNull("getSortSequenceType (null) should return null ", DatabaseUtil.getSortSequenceType(null)); - // check - assertSame("getSortSequenceType () should return SortSequenceType.ASCENDING ", - SortSequenceType.ASCENDING, - DatabaseUtil.getSortSequenceType(SortSequenceType.ASCENDING.getType())); - // check - assertSame("getSortSequenceType () should return SortSequenceType.DESCENDING ", - SortSequenceType.DESCENDING, - DatabaseUtil.getSortSequenceType(SortSequenceType.DESCENDING.getType())); - // check - assertSame("getSortSequenceType () should return SortSequenceType.NOT_SUPPORTED ", - SortSequenceType.NOT_SUPPORTED, - DatabaseUtil.getSortSequenceType(SortSequenceType.NOT_SUPPORTED.getType())); - } - - public void testGetSqlStateType() { - // check - assertNull("getSqlStateType (null) should return null ", DatabaseUtil.getSqlStateType(null)); - // check - assertSame("getSqlStateType () should return SqlStateType.XOPEN ", - SQLStateType.XOPEN, - DatabaseUtil.getSqlStateType(SQLStateType.XOPEN.getState())); - // check - assertSame("getSqlStateType () should return SqlStateType.SQL99 ", - SQLStateType.SQL99, - DatabaseUtil.getSqlStateType(SQLStateType.SQL99.getState())); - } - - public void testGetSqlType() { - // check - assertNull("getSqlType (null) should return null ", DatabaseUtil.getSqlType(null)); - // check - assertSame("getSqlType () should return SqlType.BIT ", SqlType.BIT, DatabaseUtil.getSqlType(SqlType.BIT.getType())); - // check - assertSame("getSqlType () should return SqlType.TINYINT ", - SqlType.TINYINT, - DatabaseUtil.getSqlType(SqlType.TINYINT.getType())); - // check - assertSame("getSqlType () should return SqlType.SMALLINT ", - SqlType.SMALLINT, - DatabaseUtil.getSqlType(SqlType.SMALLINT.getType())); - // check - assertSame("getSqlType () should return SqlType.INTEGER ", - SqlType.INTEGER, - DatabaseUtil.getSqlType(SqlType.INTEGER.getType())); - // check - assertSame("getSqlType () should return SqlType.BIGINT ", - SqlType.BIGINT, - DatabaseUtil.getSqlType(SqlType.BIGINT.getType())); - // check - assertSame("getSqlType () should return SqlType.FLOAT ", SqlType.FLOAT, DatabaseUtil.getSqlType(SqlType.FLOAT.getType())); - // check - assertSame("getSqlType () should return SqlType.REAL ", SqlType.REAL, DatabaseUtil.getSqlType(SqlType.REAL.getType())); - // check - assertSame("getSqlType () should return SqlType.DOUBLE ", - SqlType.DOUBLE, - DatabaseUtil.getSqlType(SqlType.DOUBLE.getType())); - // check - assertSame("getSqlType () should return SqlType.NUMERIC ", - SqlType.NUMERIC, - DatabaseUtil.getSqlType(SqlType.NUMERIC.getType())); - // check - assertSame("getSqlType () should return SqlType.DECIMAL ", - SqlType.DECIMAL, - DatabaseUtil.getSqlType(SqlType.DECIMAL.getType())); - // check - assertSame("getSqlType () should return SqlType.CHAR ", SqlType.CHAR, DatabaseUtil.getSqlType(SqlType.CHAR.getType())); - // check - assertSame("getSqlType () should return SqlType.VARCHAR ", - SqlType.VARCHAR, - DatabaseUtil.getSqlType(SqlType.VARCHAR.getType())); - // check - assertSame("getSqlType () should return SqlType.LONGVARCHAR ", - SqlType.LONGVARCHAR, - DatabaseUtil.getSqlType(SqlType.LONGVARCHAR.getType())); - // check - assertSame("getSqlType () should return SqlType.DATE ", SqlType.DATE, DatabaseUtil.getSqlType(SqlType.DATE.getType())); - // check - assertSame("getSqlType () should return SqlType.TIME ", SqlType.TIME, DatabaseUtil.getSqlType(SqlType.TIME.getType())); - // check - assertSame("getSqlType () should return SqlType.TIMESTAMP ", - SqlType.TIMESTAMP, - DatabaseUtil.getSqlType(SqlType.TIMESTAMP.getType())); - // check - assertSame("getSqlType () should return SqlType.BINARY ", - SqlType.BINARY, - DatabaseUtil.getSqlType(SqlType.BINARY.getType())); - // check - assertSame("getSqlType () should return SqlType.VARBINARY ", - SqlType.VARBINARY, - DatabaseUtil.getSqlType(SqlType.VARBINARY.getType())); - // check - assertSame("getSqlType () should return SqlType.LONGVARBINARY ", - SqlType.LONGVARBINARY, - DatabaseUtil.getSqlType(SqlType.LONGVARBINARY.getType())); - // check - assertSame("getSqlType () should return SqlType.NULL ", SqlType.NULL, DatabaseUtil.getSqlType(SqlType.NULL.getType())); - // check - assertSame("getSqlType () should return SqlType.OTHER ", SqlType.OTHER, DatabaseUtil.getSqlType(SqlType.OTHER.getType())); - // check - assertSame("getSqlType () should return SqlType.JAVA_OBJECT ", - SqlType.JAVA_OBJECT, - DatabaseUtil.getSqlType(SqlType.JAVA_OBJECT.getType())); - // check - assertSame("getSqlType () should return SqlType.DISTINCT ", - SqlType.DISTINCT, - DatabaseUtil.getSqlType(SqlType.DISTINCT.getType())); - // check - assertSame("getSqlType () should return SqlType.STRUCT ", - SqlType.STRUCT, - DatabaseUtil.getSqlType(SqlType.STRUCT.getType())); - // check - assertSame("getSqlType () should return SqlType.ARRAY ", SqlType.ARRAY, DatabaseUtil.getSqlType(SqlType.ARRAY.getType())); - // check - assertSame("getSqlType () should return SqlType.BLOB ", SqlType.BLOB, DatabaseUtil.getSqlType(SqlType.BLOB.getType())); - // check - assertSame("getSqlType () should return SqlType.CLOB ", SqlType.CLOB, DatabaseUtil.getSqlType(SqlType.CLOB.getType())); - // check - assertSame("getSqlType () should return SqlType.REF ", SqlType.REF, DatabaseUtil.getSqlType(SqlType.REF.getType())); - // check - assertSame("getSqlType () should return SqlType.DATALINK ", - SqlType.DATALINK, - DatabaseUtil.getSqlType(SqlType.DATALINK.getType())); - // check - assertSame("getSqlType () should return SqlType.BOOLEAN ", - SqlType.BOOLEAN, - DatabaseUtil.getSqlType(SqlType.BOOLEAN.getType())); - } - - public void testGetStoredProcedureResultType() { - // check - assertNull("getStoredProcedureResultType (null) should return null ", DatabaseUtil.getStoredProcedureResultType(null)); - // check - assertSame("getStoredProcedureResultType () should return StoredProcedureResultType.NO_RESULT ", - StoredProcedureResultType.NO_RESULT, - DatabaseUtil.getStoredProcedureResultType(StoredProcedureResultType.NO_RESULT.getType())); - // check - assertSame("getStoredProcedureResultType () should return StoredProcedureResultType.RETURNS_RESULT ", - StoredProcedureResultType.RETURNS_RESULT, - DatabaseUtil.getStoredProcedureResultType(StoredProcedureResultType.RETURNS_RESULT.getType())); - // check - assertSame("getStoredProcedureResultType () should return StoredProcedureResultType.UNKNOWN ", - StoredProcedureResultType.UNKNOWN, - DatabaseUtil.getStoredProcedureResultType(StoredProcedureResultType.UNKNOWN.getType())); - } - - public void testGetTransactionIsolationLevelType() { - // check - assertNull("getTransactionIsolationLevelType (null) should return null ", - DatabaseUtil.getTransactionIsolationLevelType(null)); - // check - assertSame("getTransactionIsolationLevelType () should return TransactionIsolationLevelType.NONE", - TransactionIsolationLevelType.NONE, - DatabaseUtil.getTransactionIsolationLevelType(TransactionIsolationLevelType.NONE.getLevel())); - // check - assertSame("getTransactionIsolationLevelType () should return TransactionIsolationLevelType.READ_UNCOMMITTED", - TransactionIsolationLevelType.READ_UNCOMMITTED, - DatabaseUtil.getTransactionIsolationLevelType(TransactionIsolationLevelType.READ_UNCOMMITTED.getLevel())); - // check - assertSame("getTransactionIsolationLevelType () should return TransactionIsolationLevelType.READ_COMMITTED", - TransactionIsolationLevelType.READ_COMMITTED, - DatabaseUtil.getTransactionIsolationLevelType(TransactionIsolationLevelType.READ_COMMITTED.getLevel())); - // check - assertSame("getTransactionIsolationLevelType () should return TransactionIsolationLevelType.REPEATABLE_READ", - TransactionIsolationLevelType.REPEATABLE_READ, - DatabaseUtil.getTransactionIsolationLevelType(TransactionIsolationLevelType.REPEATABLE_READ.getLevel())); - // check - assertSame("getTransactionIsolationLevelType () should return TransactionIsolationLevelType.SERIALIZABLE", - TransactionIsolationLevelType.SERIALIZABLE, - DatabaseUtil.getTransactionIsolationLevelType(TransactionIsolationLevelType.SERIALIZABLE.getLevel())); - } - - public void testGetStandardUserDefinedTypes() { - // get string array - String udtTypes = DatabaseUtil.getStandardUserDefinedTypes(); - // check not null - assertNotNull("DatabaseUtil.getStandardUserDefinedTypes should return not empty list", udtTypes); - // check that JAVA_OBJECT present - assertTrue("JAVA_OBJECT should be specified among standard UDT", udtTypes.contains("JAVA_OBJECT")); - // check that STRUCT present - assertTrue("STRUCT should be specified among standard UDT", udtTypes.contains("STRUCT")); - // check that DISTINCT present - assertTrue("DISTINCT should be specified among standard UDT", udtTypes.contains("DISTINCT")); - } - - public void testGetUserDefinedTypes() { - // UDT string array - String udtTypes = "DISTINCT,JAVA_OBJECT,STRUCT"; - // get int array - int[] udtIntTypes = DatabaseUtil.getUserDefinedTypes(udtTypes); - // check not null - assertNotNull("UDT int array should be not null", udtIntTypes); - // check size - assertEquals("The size of UDT int array is expected to be three", 3, udtIntTypes.length); - // check first element - assertEquals("The udtIntTypes[0] should be equal to Types.DISTINCT", Types.DISTINCT, udtIntTypes[0]); - // check second element - assertEquals("The udtIntTypes[1] should be equal to Types.JAVA_OBJECT", Types.JAVA_OBJECT, udtIntTypes[1]); - // check third element - assertEquals("The udtIntTypes[2] should be equal to Types.STRUCT", Types.STRUCT, udtIntTypes[2]); - } -} Index: extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/jdbc/JdbcConnection.java =================================================================== --- extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/jdbc/JdbcConnection.java (revision 1450) +++ extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/jdbc/JdbcConnection.java (working copy) @@ -1,163 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.connector.jdbc; - -import java.sql.Connection; -import java.sql.SQLException; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import javax.sql.XAConnection; -import javax.transaction.xa.XAResource; -import org.jboss.dna.common.util.Logger; -import org.jboss.dna.graph.ExecutionContext; -import org.jboss.dna.graph.cache.CachePolicy; -import org.jboss.dna.graph.connector.RepositoryConnection; -import org.jboss.dna.graph.connector.RepositorySourceException; -import org.jboss.dna.graph.request.Request; -import org.jboss.dna.graph.request.processor.RequestProcessor; - -/** - * JDBC connection wrapper - * - * @author Sergiy Litsenko - */ -public class JdbcConnection implements RepositoryConnection { - /** - * Logging for this instance - */ - protected Logger log = Logger.getLogger(getClass()); - - private final String name; - private final CachePolicy cachePolicy; - private final Connection connection; - private final UUID rootNodeUuid; - - /*package*/JdbcConnection( String sourceName, - CachePolicy cachePolicy, - Connection connection, - UUID rootNodeUuid ) { - assert sourceName != null; - assert connection != null; - assert rootNodeUuid != null; - this.name = sourceName; - this.cachePolicy = cachePolicy; // may be null - this.connection = connection; - this.rootNodeUuid = rootNodeUuid; - } - - /** - * {@inheritDoc} - * - * @see org.jboss.dna.graph.connector.RepositoryConnection#getSourceName() - */ - public String getSourceName() { - return name; - } - - /** - * {@inheritDoc} - * - * @see org.jboss.dna.graph.connector.RepositoryConnection#getDefaultCachePolicy() - */ - public CachePolicy getDefaultCachePolicy() { - return cachePolicy; - } - - /** - * {@inheritDoc} - * - * @see org.jboss.dna.graph.connector.RepositoryConnection#getXAResource() - */ - public XAResource getXAResource() { - // if implemented by JDBC driver - if (connection instanceof XAConnection) { - try { - return ((XAConnection)connection).getXAResource(); - } catch (SQLException e) { - // handle an exception silently so far and write it to the log - log.error(e, JdbcMetadataI18n.unableToGetXAResource, getSourceName()); - return null; - } - } - // default - return null; - } - - /** - * {@inheritDoc} - * - * @see org.jboss.dna.graph.connector.RepositoryConnection#ping(long, java.util.concurrent.TimeUnit) - */ - public boolean ping( long time, - TimeUnit unit ) { - try { - // JDBC 4 has a method to check validity of a connection (connection.isValid(timeout)) - // but many drivers didn't get updated with latest spec - return connection != null && !connection.isClosed(); - } catch (SQLException e) { - // debug - if (log.isDebugEnabled()) { - log.debug(e, "{0}: Unable to check database connection due to error.", getSourceName()); - } - return false; - } - } - - /** - * {@inheritDoc} - * - * @see org.jboss.dna.graph.connector.RepositoryConnection#execute(org.jboss.dna.graph.ExecutionContext, - * org.jboss.dna.graph.request.Request) - */ - public void execute( ExecutionContext context, - Request request ) throws RepositorySourceException { - // create processor and delegate handling - RequestProcessor proc = new JdbcRequestProcesor(getSourceName(), context, connection, rootNodeUuid); - try { - proc.process(request); - } finally { - proc.close(); - } - } - - /** - * {@inheritDoc} - * - * @see org.jboss.dna.graph.connector.RepositoryConnection#close() - */ - public void close() { - try { - // release the JDBC connection resource - if (connection != null && !connection.isClosed()) { - connection.close(); - } - } catch (Exception e) { - // handle exception silently so far - if (log.isDebugEnabled()) { - log.debug(e, "{0}: Unable to close database connection due to error.", getSourceName()); - } - } - } - -} Index: extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/jdbc/JdbcMetadataI18n.java =================================================================== --- extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/jdbc/JdbcMetadataI18n.java (revision 1450) +++ extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/jdbc/JdbcMetadataI18n.java (working copy) @@ -1,66 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.connector.jdbc; - -import java.util.Locale; -import java.util.Set; -import org.jboss.dna.common.i18n.I18n; - -/** - * The internationalized string constants for the org.jboss.dna.connector.jdbc* packages. - */ -public class JdbcMetadataI18n { - public static I18n connectorName; - public static I18n nodeDoesNotExist; - public static I18n nodeTypeIsNotSupported; - public static I18n propertyIsRequired; - public static I18n oneOfPropertiesIsRequired; - public static I18n errorSerializingCachePolicyInSource; - public static I18n locationInRequestMustHavePath; - public static I18n sourceIsReadOnly; - public static I18n unableToGetConnectionUsingDriver; - public static I18n unableToGetConnectionUsingDataSource; - public static I18n unableToGetXAResource; - - static { - try { - I18n.initialize(JdbcMetadataI18n.class); - } catch (final Exception err) { - System.err.println(err); - } - } - - public static Set getLocalizationProblemLocales() { - return I18n.getLocalizationProblemLocales(JdbcMetadataI18n.class); - } - - public static Set getLocalizationProblems() { - return I18n.getLocalizationProblems(JdbcMetadataI18n.class); - } - - public static Set getLocalizationProblems( Locale locale ) { - return I18n.getLocalizationProblems(JdbcMetadataI18n.class, locale); - } - -} Index: extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/jdbc/JdbcRepositoryLexicon.java =================================================================== --- extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/jdbc/JdbcRepositoryLexicon.java (revision 1450) +++ extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/jdbc/JdbcRepositoryLexicon.java (working copy) @@ -1,44 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.connector.jdbc; - -import org.jboss.dna.graph.property.Name; -import org.jboss.dna.graph.property.basic.BasicName; - - -/** - * The namespace and property names used within a {@link JdbcRepositorySource} to store internal information. - * - * @author Sergiy Litsenko - */ -public class JdbcRepositoryLexicon { - - public static class Namespace { - public static final String URI = "http://www.jboss.org/dna/connector/jdbc"; - public static final String PREFIX = "dnajdbc"; - } - - public static final Name CHILD_PATH_SEGMENT_LIST = new BasicName(Namespace.URI, "orderedChildNames"); - public static final Name UUID = new BasicName(Namespace.URI, "uuid"); -} Index: extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/jdbc/JdbcRepositorySource.java =================================================================== --- extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/jdbc/JdbcRepositorySource.java (revision 1450) +++ extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/jdbc/JdbcRepositorySource.java (working copy) @@ -1,580 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.connector.jdbc; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Hashtable; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; -import javax.naming.BinaryRefAddr; -import javax.naming.Context; -import javax.naming.Name; -import javax.naming.RefAddr; -import javax.naming.Reference; -import javax.naming.StringRefAddr; -import javax.naming.spi.ObjectFactory; -import net.jcip.annotations.ThreadSafe; -import org.jboss.dna.common.i18n.I18n; -import org.jboss.dna.common.jdbc.provider.DataSourceDatabaseMetadataProvider; -import org.jboss.dna.common.jdbc.provider.DefaultDataSourceDatabaseMetadataProvider; -import org.jboss.dna.common.jdbc.provider.DefaultDriverDatabaseMetadataProvider; -import org.jboss.dna.common.jdbc.provider.DriverDatabaseMetadataProvider; -import org.jboss.dna.graph.cache.CachePolicy; -import org.jboss.dna.graph.connector.RepositoryConnection; -import org.jboss.dna.graph.connector.RepositoryContext; -import org.jboss.dna.graph.connector.RepositorySource; -import org.jboss.dna.graph.connector.RepositorySourceCapabilities; -import org.jboss.dna.graph.connector.RepositorySourceException; - -/** - * A description of a JDBC resource that can be used to access database information. - * - * @author Sergiy Litsenko - */ -public class JdbcRepositorySource implements RepositorySource, ObjectFactory { - private static final long serialVersionUID = 3380130639143030018L; - - /** - * The default limit is {@value} for retrying {@link RepositoryConnection connection} calls to the underlying source. - */ - public static final int DEFAULT_RETRY_LIMIT = 0; - - /** - * This source supports updates by default, but each instance may be configured to {@link #setSupportsUpdates(boolean) be - * read-only or updateable}. - */ - public static final boolean DEFAULT_SUPPORTS_UPDATES = true; - /** - * The default UUID that is used for root nodes in a JDBC connector. - */ - public static final String DEFAULT_ROOT_NODE_UUID = "9f9a52c8-0a4d-40d0-ac58-7c77b24b3155"; - - /** - * This source supports events. - */ - protected static final boolean SUPPORTS_EVENTS = true; - /** - * This source does not support same-name-siblings. - */ - protected static final boolean SUPPORTS_SAME_NAME_SIBLINGS = false; - - private final AtomicInteger retryLimit = new AtomicInteger(DEFAULT_RETRY_LIMIT); - protected String name; - protected final Capabilities capabilities = new Capabilities(); - protected transient RepositoryContext repositoryContext; - protected CachePolicy defaultCachePolicy; - protected transient DriverDatabaseMetadataProvider driverProvider; - protected transient DataSourceDatabaseMetadataProvider dataSourceProvider; - protected transient UUID rootUuid = UUID.fromString(DEFAULT_ROOT_NODE_UUID); - - protected static final String SOURCE_NAME = "sourceName"; - protected static final String ROOT_NODE_UUID = "rootNodeUuid"; - protected static final String DEFAULT_CACHE_POLICY = "defaultCachePolicy"; - protected static final String DATA_SOURCE_JNDI_NAME = "dataSourceJndiName"; - protected static final String USERNAME = "username"; - protected static final String PASSWORD = "password"; - protected static final String URL = "url"; - protected static final String DRIVER_CLASS_NAME = "driverClassName"; - protected static final String RETRY_LIMIT = "retryLimit"; - - /** - * Get and optionally create driver based provider - * - * @param create create provider - * @return driverProvider - */ - protected DriverDatabaseMetadataProvider getDriverProvider( boolean create ) { - // lazy creation - if (driverProvider == null) { - driverProvider = new DefaultDriverDatabaseMetadataProvider(); - } - return driverProvider; - } - - /** - * Get and optionally create data source based provider - * - * @param create create provider - * @return dataSourceProvider - */ - protected DataSourceDatabaseMetadataProvider getDataSourceProvider( boolean create ) { - // lazy creation - if (dataSourceProvider == null && create) { - dataSourceProvider = new DefaultDataSourceDatabaseMetadataProvider(); - } - return dataSourceProvider; - } - - /** - * default constructor - */ - public JdbcRepositorySource() { - } - - /** - * {@inheritDoc} - * - * @see org.jboss.dna.graph.connector.RepositorySource#getCapabilities() - */ - public RepositorySourceCapabilities getCapabilities() { - return capabilities; - } - - /** - * {@inheritDoc} - * - * @see org.jboss.dna.graph.connector.RepositorySource#getConnection() - */ - public synchronized RepositoryConnection getConnection() throws RepositorySourceException { - String errMsg = null; - // check name - if (getName() == null) { - errMsg = JdbcMetadataI18n.propertyIsRequired.text("name"); - throw new RepositorySourceException(errMsg); - } - - // create Jdbc connection using data source first - try { - if (dataSourceProvider != null) { - // create wrapper for Jdbc connection - return new JdbcConnection(getName(), getDefaultCachePolicy(), dataSourceProvider.getConnection(), rootUuid); - } - } catch (Exception e) { - errMsg = JdbcMetadataI18n.unableToGetConnectionUsingDriver.text(getName(), getDriverClassName(), getDatabaseUrl()); - throw new RepositorySourceException(errMsg, e); - } - - // create Jdbc connection using driver and database URL - try { - if (driverProvider != null) { - // create wrapper for Jdbc connection - return new JdbcConnection(getName(), getDefaultCachePolicy(), driverProvider.getConnection(), rootUuid); - } - } catch (Exception e) { - errMsg = JdbcMetadataI18n.unableToGetConnectionUsingDataSource.text(getName(), getDataSourceName()); - throw new RepositorySourceException(errMsg, e); - } - - // Either data source name or JDBC driver connection properties must be defined - errMsg = JdbcMetadataI18n.oneOfPropertiesIsRequired.text(getName()); - throw new RepositorySourceException(errMsg); - } - - /** - * {@inheritDoc} - * - * @see org.jboss.dna.graph.connector.RepositorySource#close() - */ - public synchronized void close() { - } - - /** - * {@inheritDoc} - * - * @see org.jboss.dna.graph.connector.RepositorySource#getName() - */ - public String getName() { - return name; - } - - /** - * Set the name of this source - * - * @param name the name for this source - */ - public void setName( String name ) { - this.name = name; - } - - /** - * {@inheritDoc} - * - * @see org.jboss.dna.graph.connector.RepositorySource#getRetryLimit() - */ - public int getRetryLimit() { - return retryLimit.get(); - } - - /** - * {@inheritDoc} - * - * @see org.jboss.dna.graph.connector.RepositorySource#initialize(org.jboss.dna.graph.connector.RepositoryContext) - */ - public void initialize( RepositoryContext context ) throws RepositorySourceException { - this.repositoryContext = context; - } - - /** - * {@inheritDoc} - * - * @see org.jboss.dna.graph.connector.RepositorySource#setRetryLimit(int) - */ - public void setRetryLimit( int limit ) { - retryLimit.set(limit < 0 ? 0 : limit); - } - - /** - * Get whether this source supports updates. - * - * @return true if this source supports updates, or false if this source only supports reading content. - */ - public boolean getSupportsUpdates() { - return capabilities.supportsUpdates(); - } - - /** - * Set whether this source supports updates. - * - * @param supportsUpdates true if this source supports updating content, or false if this source only supports reading - * content. - */ - public synchronized void setSupportsUpdates( boolean supportsUpdates ) { - capabilities.setSupportsUpdates(supportsUpdates); - } - - /** - * Get the default cache policy for this source, or null if the global default cache policy should be used - * - * @return the default cache policy, or null if this source has no explicit default cache policy - */ - public CachePolicy getDefaultCachePolicy() { - return defaultCachePolicy; - } - - /** - * @param defaultCachePolicy Sets defaultCachePolicy to the specified value. - */ - public synchronized void setDefaultCachePolicy( CachePolicy defaultCachePolicy ) { - this.defaultCachePolicy = defaultCachePolicy; - } - - /** - * @return rootNodeUuid - */ - public String getRootNodeUuid() { - return rootUuid != null ? rootUuid.toString() : null; - } - - /** - * @param rootNodeUuid Sets rootNodeUuid to the specified value. - * @throws IllegalArgumentException if the string value cannot be converted to UUID - */ - public void setRootNodeUuid( String rootNodeUuid ) { - if (rootNodeUuid != null && rootNodeUuid.trim().length() == 0) rootNodeUuid = DEFAULT_ROOT_NODE_UUID; - this.rootUuid = UUID.fromString(rootNodeUuid); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean equals( Object obj ) { - if (obj == this) return true; - if (obj instanceof JdbcRepositorySource) { - JdbcRepositorySource that = (JdbcRepositorySource)obj; - if (this.getName() == null) { - if (that.getName() != null) return false; - } else { - if (!this.getName().equals(that.getName())) return false; - } - return true; - } - return false; - } - - /** - * Gets JDBC driver class name - * - * @return the JDBC driver class name if any - */ - public String getDriverClassName() { - // get provider - DriverDatabaseMetadataProvider provider = getDriverProvider(false); - // return - return (provider != null) ? provider.getDriverClassName() : null; - } - - /** - * Sets JDBC driver class name - * - * @param driverClassName the JDBC driver class name - */ - public void setDriverClassName( String driverClassName ) { - if (driverClassName == null) { - driverProvider = null; - } else { - // get/create provider - DriverDatabaseMetadataProvider provider = getDriverProvider(true); - // set - provider.setDriverClassName(driverClassName); - } - } - - /** - * Gets database URL as string - * - * @return database URL as string - */ - public String getDatabaseUrl() { - // get provider - DriverDatabaseMetadataProvider provider = getDriverProvider(false); - // return - return (provider != null) ? provider.getDatabaseUrl() : null; - } - - /** - * Sets the database URL as string - * - * @param databaseUrl the database URL as string - */ - public void setDatabaseUrl( String databaseUrl ) { - if (databaseUrl == null) { - driverProvider = null; - } else { - // get/create provider - DriverDatabaseMetadataProvider provider = getDriverProvider(true); - // set - provider.setDatabaseUrl(databaseUrl); - } - } - - /** - * Gets the user name - * - * @return the user name - */ - public String getUserName() { - // get provider - DriverDatabaseMetadataProvider provider = getDriverProvider(false); - return (provider != null) ? provider.getUserName() : null; - } - - /** - * Sets the user name - * - * @param userName the user name - */ - public void setUserName( String userName ) { - if (userName == null) { - driverProvider = null; - } else { - // get provider - DriverDatabaseMetadataProvider provider = getDriverProvider(true); - provider.setUserName(userName); - } - } - - /** - * Get user's password - * - * @return user's password - */ - public String getPassword() { - // get provider - DriverDatabaseMetadataProvider provider = getDriverProvider(false); - return (provider != null) ? provider.getPassword() : null; - } - - /** - * Sets the user's password - * - * @param password the user's password - */ - public void setPassword( String password ) { - if (password == null) { - driverProvider = null; - } else { - // get provider - DriverDatabaseMetadataProvider provider = getDriverProvider(true); - provider.setPassword(password); - } - } - - /** - * Sets data source JNDI name - * - * @return data source JNDI name - */ - public String getDataSourceName() { - // get provider - DataSourceDatabaseMetadataProvider provider = getDataSourceProvider(false); - return (provider != null) ? provider.getDataSourceName() : null; - } - - /** - * Sets data source JNDI name - * - * @param dataSourceName the data source JNDI name - */ - public void setDataSourceName( String dataSourceName ) { - if (dataSourceName == null) { - dataSourceProvider = null; - } else { - // get provider - DataSourceDatabaseMetadataProvider provider = getDataSourceProvider(true); - provider.setDataSourceName(dataSourceName); - } - } - - /** - * {@inheritDoc} - * - * @see javax.naming.Referenceable#getReference() - */ - public Reference getReference() { - String className = getClass().getName(); - String factoryClassName = this.getClass().getName(); - Reference ref = new Reference(className, factoryClassName, null); - - if (getName() != null) { - ref.add(new StringRefAddr(SOURCE_NAME, getName())); - } - - if (getRootNodeUuid() != null) { - ref.add(new StringRefAddr(ROOT_NODE_UUID, getRootNodeUuid())); - } - if (getDataSourceName() != null) { - ref.add(new StringRefAddr(DATA_SOURCE_JNDI_NAME, getDataSourceName())); - } - - if (getUserName() != null) { - ref.add(new StringRefAddr(USERNAME, getUserName())); - } - - if (getPassword() != null) { - ref.add(new StringRefAddr(PASSWORD, getPassword())); - } - - if (getDatabaseUrl() != null) { - ref.add(new StringRefAddr(URL, getDatabaseUrl())); - } - if (getDriverClassName() != null) { - ref.add(new StringRefAddr(DRIVER_CLASS_NAME, getDriverClassName())); - } - - if (getDefaultCachePolicy() != null) { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - CachePolicy policy = getDefaultCachePolicy(); - try { - ObjectOutputStream oos = new ObjectOutputStream(baos); - oos.writeObject(policy); - ref.add(new BinaryRefAddr(DEFAULT_CACHE_POLICY, baos.toByteArray())); - } catch (IOException e) { - I18n msg = JdbcMetadataI18n.errorSerializingCachePolicyInSource; - throw new RepositorySourceException(getName(), msg.text(policy.getClass().getName(), getName()), e); - } - } - ref.add(new StringRefAddr(RETRY_LIMIT, Integer.toString(getRetryLimit()))); - // return it - return ref; - } - - /** - * {@inheritDoc} - * - * @see javax.naming.spi.ObjectFactory#getObjectInstance(java.lang.Object, javax.naming.Name, javax.naming.Context, - * java.util.Hashtable) - */ - public Object getObjectInstance( Object obj, - Name name, - Context nameCtx, - Hashtable environment ) throws Exception { - if (obj instanceof Reference) { - Map values = new HashMap(); - Reference ref = (Reference)obj; - Enumeration en = ref.getAll(); - while (en.hasMoreElements()) { - RefAddr subref = (RefAddr)en.nextElement(); - if (subref instanceof StringRefAddr) { - String key = subref.getType(); - Object value = subref.getContent(); - if (value != null) values.put(key, value.toString()); - } else if (subref instanceof BinaryRefAddr) { - String key = subref.getType(); - Object value = subref.getContent(); - if (value instanceof byte[]) { - // Deserialize ... - ByteArrayInputStream bais = new ByteArrayInputStream((byte[])value); - ObjectInputStream ois = new ObjectInputStream(bais); - value = ois.readObject(); - values.put(key, value); - } - } - } - // get individual properties - String sourceName = (String)values.get(SOURCE_NAME); - String rootNodeUuid = (String)values.get(ROOT_NODE_UUID); - String dataSourceJndiName = (String)values.get(DATA_SOURCE_JNDI_NAME); - String userName = (String)values.get(USERNAME); - String password = (String)values.get(PASSWORD); - String url = (String)values.get(URL); - String driverClassName = (String)values.get(DRIVER_CLASS_NAME); - - Object defaultCachePolicy = values.get(DEFAULT_CACHE_POLICY); - String retryLimit = (String)values.get(RETRY_LIMIT); - - // Create the source instance ... - JdbcRepositorySource source = new JdbcRepositorySource(); - if (sourceName != null) source.setName(sourceName); - if (rootNodeUuid != null) source.setRootNodeUuid(rootNodeUuid); - if (dataSourceJndiName != null) source.setDataSourceName(dataSourceJndiName); - if (userName != null) source.setUserName(userName); - if (password != null) source.setPassword(password); - if (url != null) source.setDatabaseUrl(url); - if (driverClassName != null) source.setDriverClassName(driverClassName); - if (defaultCachePolicy instanceof CachePolicy) { - source.setDefaultCachePolicy((CachePolicy)defaultCachePolicy); - } - if (retryLimit != null) source.setRetryLimit(Integer.parseInt(retryLimit)); - return source; - } - return null; - } - - @ThreadSafe - protected class Capabilities extends RepositorySourceCapabilities { - private final AtomicBoolean supportsUpdates = new AtomicBoolean(DEFAULT_SUPPORTS_UPDATES); - - /*package*/Capabilities() { - super(DEFAULT_SUPPORTS_UPDATES, SUPPORTS_EVENTS); - } - - /*package*/void setSupportsUpdates( boolean supportsUpdates ) { - this.supportsUpdates.set(supportsUpdates); - } - - @Override - public boolean supportsUpdates() { - return this.supportsUpdates.get(); - } - } -} Index: extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/jdbc/JdbcRequestProcesor.java =================================================================== --- extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/jdbc/JdbcRequestProcesor.java (revision 1450) +++ extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/jdbc/JdbcRequestProcesor.java (working copy) @@ -1,208 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.connector.jdbc; - -import java.sql.Connection; -import java.util.UUID; -import org.jboss.dna.common.util.Logger; -import org.jboss.dna.graph.ExecutionContext; -import org.jboss.dna.graph.property.DateTime; -import org.jboss.dna.graph.request.CloneBranchRequest; -import org.jboss.dna.graph.request.CloneWorkspaceRequest; -import org.jboss.dna.graph.request.CopyBranchRequest; -import org.jboss.dna.graph.request.CreateNodeRequest; -import org.jboss.dna.graph.request.CreateWorkspaceRequest; -import org.jboss.dna.graph.request.DeleteBranchRequest; -import org.jboss.dna.graph.request.DestroyWorkspaceRequest; -import org.jboss.dna.graph.request.GetWorkspacesRequest; -import org.jboss.dna.graph.request.MoveBranchRequest; -import org.jboss.dna.graph.request.ReadAllChildrenRequest; -import org.jboss.dna.graph.request.ReadAllPropertiesRequest; -import org.jboss.dna.graph.request.UpdatePropertiesRequest; -import org.jboss.dna.graph.request.VerifyWorkspaceRequest; -import org.jboss.dna.graph.request.processor.RequestProcessor; - -/** - * JDBC request processor - * - * @author Sergiy Litsenko - */ -public class JdbcRequestProcesor extends RequestProcessor { - protected Connection connection; - protected UUID rootNodeUuid; - - /** - * Logging for this instance - */ - protected Logger log = Logger.getLogger(getClass()); - - /** - * @param sourceName - * @param context - * @param connection - * @param rootNodeUuid - */ - public JdbcRequestProcesor( String sourceName, - ExecutionContext context, - Connection connection, - UUID rootNodeUuid ) { - super(sourceName, context, null); - this.connection = connection; - this.rootNodeUuid = rootNodeUuid; - } - - /** - * @param sourceName - * @param context - * @param connection - * @param rootNodeUuid - * @param now - */ - public JdbcRequestProcesor( String sourceName, - ExecutionContext context, - Connection connection, - UUID rootNodeUuid, - DateTime now ) { - super(sourceName, context, null, now); - this.connection = connection; - this.rootNodeUuid = rootNodeUuid; - } - - /** - * {@inheritDoc} - * - * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.CopyBranchRequest) - */ - @Override - public void process( CopyBranchRequest request ) { - } - - /** - * {@inheritDoc} - * - * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.CloneBranchRequest) - */ - @Override - public void process( CloneBranchRequest request ) { - } - - /** - * {@inheritDoc} - * - * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.CreateNodeRequest) - */ - @Override - public void process( CreateNodeRequest request ) { - } - - /** - * {@inheritDoc} - * - * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.DeleteBranchRequest) - */ - @Override - public void process( DeleteBranchRequest request ) { - } - - /** - * {@inheritDoc} - * - * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.MoveBranchRequest) - */ - @Override - public void process( MoveBranchRequest request ) { - } - - /** - * {@inheritDoc} - * - * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.ReadAllChildrenRequest) - */ - @Override - public void process( ReadAllChildrenRequest request ) { - } - - /** - * {@inheritDoc} - * - * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.ReadAllPropertiesRequest) - */ - @Override - public void process( ReadAllPropertiesRequest request ) { - } - - /** - * {@inheritDoc} - * - * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.UpdatePropertiesRequest) - */ - @Override - public void process( UpdatePropertiesRequest request ) { - } - - /** - * {@inheritDoc} - * - * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.VerifyWorkspaceRequest) - */ - @Override - public void process( VerifyWorkspaceRequest request ) { - } - - /** - * {@inheritDoc} - * - * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.GetWorkspacesRequest) - */ - @Override - public void process( GetWorkspacesRequest request ) { - } - - /** - * {@inheritDoc} - * - * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.CreateWorkspaceRequest) - */ - @Override - public void process( CreateWorkspaceRequest request ) { - } - - /** - * {@inheritDoc} - * - * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.CloneWorkspaceRequest) - */ - @Override - public void process( CloneWorkspaceRequest request ) { - } - - /** - * {@inheritDoc} - * - * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.DestroyWorkspaceRequest) - */ - @Override - public void process( DestroyWorkspaceRequest request ) { - } -} Index: extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/jdbc/package-info.java =================================================================== --- extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/jdbc/package-info.java (revision 1450) +++ extensions/dna-connector-jdbc-metadata/src/main/java/org/jboss/dna/connector/jdbc/package-info.java (working copy) @@ -1,29 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -/** - * The classes that make up the connector that accesses schema and database metadata from JDBC databases, exposing that as content in a repository. - */ - -package org.jboss.dna.connector.jdbc; - Index: extensions/dna-connector-jdbc-metadata/src/main/resources/org/jboss/dna/connector/jdbc/JdbcMetadataI18n.properties =================================================================== --- extensions/dna-connector-jdbc-metadata/src/main/resources/org/jboss/dna/connector/jdbc/JdbcMetadataI18n.properties (revision 1450) +++ extensions/dna-connector-jdbc-metadata/src/main/resources/org/jboss/dna/connector/jdbc/JdbcMetadataI18n.properties (working copy) @@ -1,35 +0,0 @@ -# -# JBoss DNA (http://www.jboss.org/dna) -# See the COPYRIGHT.txt file distributed with this work for information -# regarding copyright ownership. Some portions may be licensed -# to Red Hat, Inc. under one or more contributor license agreements. -# See the AUTHORS.txt file in the distribution for a full listing of -# individual contributors. -# -# JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA -# is licensed to you under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation; either version 2.1 of -# the License, or (at your option) any later version. -# -# JBoss DNA is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this software; if not, write to the Free -# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA, or see the FSF site: http://www.fsf.org. -# - -connectorName = JDBC Connector -nodeDoesNotExist = This node kind is missing at {0} -nodeTypeIsNotSupported= The {0} node type is not supported -locationInRequestMustHavePath = Location must have a path {0} -propertyIsRequired = The {0} property is required but has no value -oneOfPropertiesIsRequired={0}: Either data source name or JDBC driver connection properties must be defined -errorSerializingCachePolicyInSource = Error serializing a {0} instance owned by the {1} JdbcRepositorySource -sourceIsReadOnly = {0} is a read-only source; no updates are allowed -unableToGetConnectionUsingDriver = {0}: Unable to get connection using following driver: {1} ; and URL: {2} -unableToGetConnectionUsingDataSource = {0}: Unable to get connection using following data source: {1} -unableToGetXAResource = {0}: Unable to get XA Resource for JDBC connection \ No newline at end of file Index: extensions/dna-connector-jdbc-metadata/src/test/data/insert.xml =================================================================== --- extensions/dna-connector-jdbc-metadata/src/test/data/insert.xml (revision 1450) +++ extensions/dna-connector-jdbc-metadata/src/test/data/insert.xml (working copy) @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Index: extensions/dna-connector-jdbc-metadata/src/test/data/testdb/db.properties =================================================================== --- extensions/dna-connector-jdbc-metadata/src/test/data/testdb/db.properties (revision 1450) +++ extensions/dna-connector-jdbc-metadata/src/test/data/testdb/db.properties (working copy) @@ -1,15 +0,0 @@ -hsqldb.script_format=0 -runtime.gc_interval=0 -sql.enforce_strict_size=false -hsqldb.cache_size_scale=8 -readonly=false -hsqldb.nio_data_file=true -hsqldb.cache_scale=14 -version=1.8.0 -hsqldb.default_table_type=memory -hsqldb.cache_file_scale=1 -hsqldb.log_size=200 -modified=yes -hsqldb.cache_version=1.7.0 -hsqldb.original_version=1.8.0 -hsqldb.compatible_version=1.8.0 Index: extensions/dna-connector-jdbc-metadata/src/test/data/testdb/db.script =================================================================== --- extensions/dna-connector-jdbc-metadata/src/test/data/testdb/db.script (revision 1450) +++ extensions/dna-connector-jdbc-metadata/src/test/data/testdb/db.script (working copy) @@ -1,17 +0,0 @@ -CREATE SCHEMA PUBLIC AUTHORIZATION DBA -CREATE USER SA PASSWORD "" -GRANT DBA TO SA -SET WRITE_DELAY 10 -CREATE TABLE TEST (ID NUMERIC NOT NULL PRIMARY KEY, NAME VARCHAR(30) NOT NULL, DESCRIPTION VARCHAR(255)) -CREATE TABLE BONUS (ENAME VARCHAR(10) NULL, JOB VARCHAR(9) NULL, SAL NUMERIC NULL, COMM NUMERIC NULL) -CREATE TABLE DEPT (DEPTNO NUMERIC(2,0) NOT NULL, DNAME VARCHAR(14) NULL, LOC VARCHAR(13) NULL) -ALTER TABLE DEPT ADD CONSTRAINT PK_DEPT PRIMARY KEY (DEPTNO) -CREATE TABLE EMP (EMPNO NUMERIC(4,0) NOT NULL, ENAME VARCHAR(10) NULL, JOB VARCHAR(9) NULL, MGR NUMERIC(4,0) NULL, HIREDATE DATE NULL, SAL NUMERIC(7,2) NULL, COMM NUMERIC(7,2) NULL, DEPTNO NUMERIC(2,0) NULL) -ALTER TABLE EMP ADD CONSTRAINT PK_EMP PRIMARY KEY (EMPNO) -ALTER TABLE EMP ADD CONSTRAINT FK_DEPTNO FOREIGN KEY(DEPTNO) REFERENCES DEPT(DEPTNO) ON DELETE CASCADE -CREATE TABLE SALGRADE (GRADE NUMERIC NULL, LOSAL NUMERIC NULL, HISAL NUMERIC NULL) -CREATE UNIQUE INDEX PK_DEPT ON DEPT(DEPTNO) -CREATE UNIQUE INDEX PK_EMP ON EMP(EMPNO); - - - Index: extensions/dna-connector-jdbc-metadata/src/test/java/org/jboss/dna/connector/jdbc/DatabaseBasicTest.java =================================================================== --- extensions/dna-connector-jdbc-metadata/src/test/java/org/jboss/dna/connector/jdbc/DatabaseBasicTest.java (revision 1450) +++ extensions/dna-connector-jdbc-metadata/src/test/java/org/jboss/dna/connector/jdbc/DatabaseBasicTest.java (working copy) @@ -1,143 +0,0 @@ -/* - * JBoss DNA (http://www.jboss.org/dna) - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. Some portions may be licensed - * to Red Hat, Inc. under one or more contributor license agreements. - * See the AUTHORS.txt file in the distribution for a full listing of - * individual contributors. - * - * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA - * is licensed to you under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * JBoss DNA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.dna.connector.jdbc; - -import java.io.File; -import java.io.IOException; -import java.math.BigDecimal; -import org.dbunit.IDatabaseTester; -import org.dbunit.Assertion; -import org.dbunit.JdbcDatabaseTester; -import org.dbunit.dataset.DataSetException; -import org.dbunit.dataset.IDataSet; -import org.dbunit.dataset.ITable; -import org.dbunit.dataset.xml.FlatXmlDataSet; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -/** - * Basic test of the HSQLDB database with simple schema - * - * @author Sergiy Litsenko - */ -public class DatabaseBasicTest { - private IDatabaseTester dbTester; - - private IDataSet getDataSet() throws IOException, DataSetException { - return new FlatXmlDataSet(new File("src/test/data/insert.xml")); - } - - @Before - public void beforeEach() throws Exception { - dbTester = new JdbcDatabaseTester("org.hsqldb.jdbcDriver", "jdbc:hsqldb:file:target/testdb/db", "sa", ""); - dbTester.setDataSet(getDataSet()); - dbTester.onSetup(); - } - - @After - public void afterEach() throws Exception { - dbTester.onTearDown(); - } - - @Test - public void testTableShallBeLoaded() throws Exception { - // Fetch live database data - IDataSet databaseDataSet = dbTester.getConnection().createDataSet(); - ITable actualTable = databaseDataSet.getTable("TEST"); - ITable expectedTable = getDataSet().getTable("TEST"); - Assertion.assertEquals(expectedTable, actualTable); - } - - @Test - public void testTableRecordsLoaded() throws Exception { - // Fetch live database data - Assert.assertEquals(10, dbTester.getConnection().getRowCount("TEST")); - } - - @Test - public void testTableRandomRowColumnId() throws Exception { - // Fetch live database data - IDataSet databaseDataSet = dbTester.getConnection().createDataSet(); - ITable actualTable = databaseDataSet.getTable("TEST"); - // get 5th row, column: id - Object actualId = actualTable.getValue(4, "ID"); - Assert.assertNotNull(actualId); - - BigDecimal expectedId = new BigDecimal(5); - Assert.assertTrue(expectedId.equals(actualId)); - } - - @Test - public void testTableRandomRowColumnName() throws Exception { - // Fetch live database data - IDataSet databaseDataSet = dbTester.getConnection().createDataSet(); - ITable actualTable = databaseDataSet.getTable("TEST"); - // get 6th row, column: name - Assert.assertEquals("6@hotmail.com", actualTable.getValue(5, "NAME")); - } - - @Test - public void testTableRandomRowColumnDescription() throws Exception { - // Fetch live database data - IDataSet databaseDataSet = dbTester.getConnection().createDataSet(); - ITable actualTable = databaseDataSet.getTable("TEST"); - // get 7th row, column: description - Assert.assertEquals("This is 7", actualTable.getValue(6, "DESCRIPTION")); - } - - @Test - public void testDefaultDatabaseSchemaNameIsEmpty() throws Exception { - Assert.assertNull(dbTester.getConnection().getSchema()); - } - - @Test - public void salGradeTableShallBeLoaded() throws Exception { - // Fetch live database data - IDataSet databaseDataSet = dbTester.getConnection().createDataSet(); - ITable actualTable = databaseDataSet.getTable("SALGRADE"); - ITable expectedTable = getDataSet().getTable("SALGRADE"); - Assertion.assertEquals(expectedTable, actualTable); - } - - @Test - public void deptTableShallBeLoaded() throws Exception { - // Fetch live database data - IDataSet databaseDataSet = dbTester.getConnection().createDataSet(); - ITable actualTable = databaseDataSet.getTable("DEPT"); - ITable expectedTable = getDataSet().getTable("DEPT"); - Assertion.assertEquals(expectedTable, actualTable); - } - - @Test - public void empTableShallBeLoaded() throws Exception { - // Fetch live database data - IDataSet databaseDataSet = dbTester.getConnection().createDataSet(); - ITable actualTable = databaseDataSet.getTable("EMP"); - ITable expectedTable = getDataSet().getTable("EMP"); - // Assertion.assertEquals(expectedTable, actualTable); - Assert.assertEquals(actualTable.getRowCount(), expectedTable.getRowCount()); - } -} Index: pom.xml =================================================================== --- pom.xml (revision 1450) +++ pom.xml (working copy) @@ -129,7 +129,7 @@ extensions/dna-sequencer-jbpm-jpdl extensions/dna-sequencer-cnd - extensions/dna-sequencer-java + extensions/dna-sequencer-msoffice extensions/dna-sequencer-xml extensions/dna-sequencer-zip @@ -140,8 +140,7 @@ extensions/dna-connector-svn extensions/dna-connector-store-jpa extensions/dna-mimetype-detector-aperture - - + extensions/dna-connector-jdbc-metadata web/dna-web-jcr-rest web/dna-web-jcr-rest-client web/dna-web-jcr-rest-war @@ -374,6 +373,7 @@ hsqldb hsqldb 1.8.0.2 + test @@ -400,6 +400,7 @@ hsqldb hsqldb 1.8.0.2 + test @@ -427,6 +428,7 @@ org.h2database h2database 1.0.20061217 + test @@ -452,6 +454,7 @@ postgresql postgresql 8.4-701.jdbc3 + test @@ -484,6 +487,7 @@ mysql mysql-connector-java 5.0.5 + test @@ -509,6 +513,7 @@ postgresql postgresql 8.4-701.jdbc3 + test @@ -545,6 +550,7 @@ com.ibm db2jcc_license_cu 3.8.47 + test @@ -571,6 +577,7 @@ ojdbc14 10.0.2.0 + test @@ -596,6 +603,7 @@ com.oracle ojdbc6 11.1.0.7.0 + test @@ -621,6 +629,7 @@ com.sybase jconnect 6.0.5 + test @@ -647,6 +656,7 @@ msjdbc 2.0.1008.2 4 + test