001    package mondrian.gui.validate.impl;
002    
003    import mondrian.gui.JDBCMetaData;
004    import mondrian.gui.validate.JDBCValidator;
005    
006    /**
007     * Implementation of <code>JDBCValidator</code> for Workbench.
008     *
009     * @author mlowery
010     */
011    public class WorkbenchJDBCValidator implements JDBCValidator {
012    
013        private JDBCMetaData jdbcMetadata;
014    
015        public WorkbenchJDBCValidator(JDBCMetaData jdbcMetadata) {
016            super();
017            this.jdbcMetadata = jdbcMetadata;
018        }
019    
020        public int getColumnDataType(String schemaName, String tableName,
021                        String colName) {
022            return jdbcMetadata.getColumnDataType(schemaName, tableName, colName);
023        }
024    
025        public boolean isColExists(String schemaName, String tableName,
026                        String colName) {
027            return jdbcMetadata.isColExists(schemaName, tableName, colName);
028        }
029    
030        public boolean isInitialized() {
031            return jdbcMetadata.getErrMsg() == null;
032        }
033    
034        public boolean isTableExists(String schemaName, String tableName) {
035            return jdbcMetadata.isTableExists(schemaName, tableName);
036        }
037    
038    }
039    
040    // End WorkbenchJDBCValidator.java