Author: shawkins
Date: 2009-10-24 14:05:58 -0400 (Sat, 24 Oct 2009)
New Revision: 1535
Modified:
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCMetdataProcessor.java
trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestTextConnector.java
trunk/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestCriteriaDesc.java
Log:
TEIID-871 TEIID-792 TEIID-102 TEIID-254 TEIID-869 TEIID-875 further clean up of metadata
related logic. The index connector has been removed and the system virtual views promoted
to physical tables. some of the tables/procedures have been removed. and minor changes
have been made to MMDatabaseMetadata queries.
Modified:
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCMetdataProcessor.java
===================================================================
---
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCMetdataProcessor.java 2009-10-24
18:00:19 UTC (rev 1534)
+++
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCMetdataProcessor.java 2009-10-24
18:05:58 UTC (rev 1535)
@@ -40,7 +40,8 @@
import org.teiid.connector.metadata.runtime.MetadataFactory;
import org.teiid.connector.metadata.runtime.ProcedureRecordImpl;
import org.teiid.connector.metadata.runtime.TableRecordImpl;
-import org.teiid.connector.metadata.runtime.MetadataConstants.PARAMETER_TYPES;
+import org.teiid.connector.metadata.runtime.BaseColumn.NullType;
+import org.teiid.connector.metadata.runtime.ProcedureParameterRecordImpl.Type;
/**
* Reads from {@link DatabaseMetaData} and creates metadata through the {@link
MetadataFactory}.
@@ -101,6 +102,7 @@
if (importProcedures) {
getProcedures(metadataFactory, metadata);
}
+
}
private void getProcedures(MetadataFactory metadataFactory,
@@ -128,36 +130,19 @@
record = column;
column.setNativeType(columns.getString(7));
} else {
- record = metadataFactory.addProcedureParameter(columnName,
TypeFacility.getDataTypeNameFromSQLType(sqlType), getParameterType(columnType),
procedure);
+ record = metadataFactory.addProcedureParameter(columnName,
TypeFacility.getDataTypeNameFromSQLType(sqlType), Type.values()[columnType], procedure);
}
record.setPrecision(columns.getInt(8));
record.setLength(columns.getInt(9));
record.setScale(columns.getInt(10));
record.setRadix(columns.getInt(11));
- record.setNullType(columns.getShort(12));
- String remarks = columns.getString(13);
- if (remarks != null) {
- metadataFactory.addAnnotation(remarks, record);
- }
+ record.setNullType(NullType.values()[columns.getShort(12)]);
+ record.setAnnotation(columns.getString(13));
}
}
procedures.close();
}
- private static short getParameterType(short type) {
- switch (type) {
- case DatabaseMetaData.procedureColumnIn:
- return PARAMETER_TYPES.IN_PARM;
- case DatabaseMetaData.procedureColumnInOut:
- return PARAMETER_TYPES.INOUT_PARM;
- case DatabaseMetaData.procedureColumnOut:
- return PARAMETER_TYPES.OUT_PARM;
- case DatabaseMetaData.procedureColumnReturn:
- return PARAMETER_TYPES.RETURN_VALUE;
- }
- throw new AssertionError();
- }
-
private Map<String, TableInfo> getTables(MetadataFactory metadataFactory,
DatabaseMetaData metadata) throws SQLException, ConnectorException {
logger.logDetail("JDBCMetadataProcessor - Importing tables"); //$NON-NLS-1$
@@ -172,9 +157,7 @@
table.setNameInSource(fullName);
table.setSupportsUpdate(true);
String remarks = tables.getString(5);
- if (remarks != null) {
- metadataFactory.addAnnotation(remarks, table);
- }
+ table.setAnnotation(remarks);
tableMap.put(fullName, new TableInfo(tableCatalog, tableSchema, tableName, table));
}
tables.close();
@@ -204,12 +187,10 @@
ColumnRecordImpl column = metadataFactory.addColumn(columnName,
TypeFacility.getDataTypeNameFromSQLType(type), tableInfo.table);
column.setNativeType(columns.getString(6));
column.setRadix(columns.getInt(10));
- column.setNullType(columns.getInt(11));
+ column.setNullType(NullType.values()[columns.getShort(11)]);
column.setUpdatable(true);
String remarks = columns.getString(12);
- if (remarks != null) {
- metadataFactory.addAnnotation(remarks, column);
- }
+ column.setAnnotation(remarks);
column.setCharOctetLength(columns.getInt(16));
if (rsColumns >= 23) {
column.setAutoIncrementable("YES".equalsIgnoreCase(columns.getString(23)));
//$NON-NLS-1$
@@ -378,5 +359,9 @@
public void setImportProcedures(boolean importProcedures) {
this.importProcedures = importProcedures;
}
-
+
+ public void setImportApproximateIndexes(boolean importApproximateIndexes) {
+ this.importApproximateIndexes = importApproximateIndexes;
+ }
+
}
Modified:
trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestTextConnector.java
===================================================================
---
trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestTextConnector.java 2009-10-24
18:00:19 UTC (rev 1534)
+++
trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestTextConnector.java 2009-10-24
18:05:58 UTC (rev 1535)
@@ -25,7 +25,6 @@
import static org.junit.Assert.*;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
@@ -71,9 +70,8 @@
datatypes.put(DataTypeManager.DefaultDataTypes.TIMESTAMP, new
DatatypeRecordImpl());
MetadataFactory metadata = new MetadataFactory("SummitData", datatypes,
new Properties()); //$NON-NLS-1$
connector.getConnectorMetadata(metadata);
- assertFalse(metadata.getProcedures().iterator().hasNext());
- Iterator<TableRecordImpl> tableIter = metadata.getTables().iterator();
- TableRecordImpl group = tableIter.next();
+ assertEquals(0, metadata.getMetadataStore().getProcedures().size());
+ TableRecordImpl group =
metadata.getMetadataStore().getTables().get("summitdata.summitdata");
//$NON-NLS-1$
assertEquals("SUMMITDATA", group.getName()); //$NON-NLS-1$
assertEquals("SummitData.SUMMITDATA", group.getFullName());
//$NON-NLS-1$
assertEquals(14, group.getColumns().size());
Modified:
trunk/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestCriteriaDesc.java
===================================================================
---
trunk/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestCriteriaDesc.java 2009-10-24
18:00:19 UTC (rev 1534)
+++
trunk/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestCriteriaDesc.java 2009-10-24
18:05:58 UTC (rev 1535)
@@ -58,20 +58,6 @@
vdbPath = ProxyObjectFactory.getStateCollegeVDBLocation();
}
- public TestCriteriaDesc() {
- super();
- System.setProperty("metamatrix.config.none", "true");
- }
-
- /**
- * Constructor for CriteriaDescTest.
- * @param arg0
- */
- public TestCriteriaDesc(String arg0) {
- super(arg0);
- System.setProperty("metamatrix.config.none", "true");
- }
-
public void testGetCriteriaDescForColumn() throws Exception {
//case 1: values provided
assertNotNull("vdb path is null", vdbPath);