assertIsUninitialized();
IdentifierFactory idFactory = storeMgr.getIdentifierFactory();
MappingManager mgr = getStoreManager().getMappingManager();
classMapping = dba.getMapping(String.class, storeMgr);
Column class_column=(Column) addDatastoreField(String.class.getName(),
idFactory.newDatastoreFieldIdentifier("CLASS_NAME"), classMapping, null);
mgr.createDatastoreMapping(classMapping, storeMgr, class_column, String.class.getName());
class_column.getColumnMetaData().setLength(128);
class_column.getColumnMetaData().setJdbcType("VARCHAR");
class_column.setAsPrimaryKey();
tableMapping = dba.getMapping(String.class, storeMgr);
Column table_column=(Column) addDatastoreField(String.class.getName(),
idFactory.newDatastoreFieldIdentifier("TABLE_NAME"), tableMapping, null);
mgr.createDatastoreMapping(tableMapping, storeMgr, table_column, String.class.getName());
table_column.getColumnMetaData().setLength(128);
table_column.getColumnMetaData().setJdbcType("VARCHAR");
typeMapping = dba.getMapping(String.class, storeMgr);
Column type_column=(Column) addDatastoreField(String.class.getName(),
idFactory.newDatastoreFieldIdentifier("TYPE"), typeMapping, null);
mgr.createDatastoreMapping(typeMapping, storeMgr, type_column, String.class.getName());
type_column.getColumnMetaData().setLength(4);
type_column.getColumnMetaData().setJdbcType("VARCHAR");
// TODO Change type to SMALLINT/BIT
ownerMapping = dba.getMapping(String.class, storeMgr);
Column owner_column=(Column) addDatastoreField(String.class.getName(),
idFactory.newDatastoreFieldIdentifier("OWNER"), ownerMapping, null);
mgr.createDatastoreMapping(ownerMapping, storeMgr, owner_column, String.class.getName());
owner_column.getColumnMetaData().setLength(2);
owner_column.getColumnMetaData().setJdbcType("VARCHAR");
versionMapping = dba.getMapping(String.class, storeMgr);
Column version_column=(Column) addDatastoreField(String.class.getName(),
idFactory.newDatastoreFieldIdentifier("VERSION"), versionMapping, null);
mgr.createDatastoreMapping(versionMapping, storeMgr, version_column, String.class.getName());
version_column.getColumnMetaData().setLength(20);
version_column.getColumnMetaData().setJdbcType("VARCHAR");
interfaceNameMapping = dba.getMapping(String.class, storeMgr);
Column interfaceName_column=(Column) addDatastoreField(String.class.getName(),
idFactory.newDatastoreFieldIdentifier("INTERFACE_NAME"), interfaceNameMapping, null);
mgr.createDatastoreMapping(interfaceNameMapping, storeMgr, interfaceName_column, String.class.getName());
interfaceName_column.getColumnMetaData().setLength(255);
interfaceName_column.getColumnMetaData().setJdbcType("VARCHAR");
interfaceName_column.setNullable();
// Set up JDBC statements for supported operations
insertStmt = "INSERT INTO " + identifier.getFullyQualifiedName(false) + " (" + class_column.getIdentifier() + "," + table_column.getIdentifier() + "," + type_column.getIdentifier() + "," +
owner_column.getIdentifier() + "," + version_column.getIdentifier() + "," + interfaceName_column.getIdentifier() + ") VALUES (?,?,?,?,?,?)";
deleteStmt = "DELETE FROM " + identifier.getFullyQualifiedName(false) + " WHERE " + idFactory.getIdentifierInAdapterCase("CLASS_NAME") + "=?";
deleteAllStmt = "DELETE FROM " + identifier.getFullyQualifiedName(false);
fetchAllStmt = "SELECT " + class_column.getIdentifier() + "," + table_column.getIdentifier() + "," + type_column.getIdentifier() + "," +
owner_column.getIdentifier() + "," + version_column.getIdentifier() + "," + interfaceName_column.getIdentifier() + " FROM " + identifier.getFullyQualifiedName(false) + " ORDER BY " + table_column.getIdentifier();
fetchStmt = "SELECT 1 FROM " + identifier.getFullyQualifiedName(false) + " WHERE " + idFactory.getIdentifierInAdapterCase("CLASS_NAME") + " = ? ";
state = TABLE_STATE_INITIALIZED;
}