public class SQLListener extends SQLBase implements MappingListener
| Modifier and Type | Field and Description |
|---|---|
protected String |
autoIncrement |
protected static int |
FULLNAME_LENGTH |
static String |
ID_COLUMN_NAME |
protected static int |
ID_LENGTH |
static String |
MAPPING_SET_ID_COLUMN_NAME |
static String |
MAPPING_SET_TABLE_NAME |
protected static int |
MAPPING_URI_LENGTH |
protected static String |
SOURCE_DATASOURCE_COLUMN_NAME |
static int |
SQL_COMPAT_VERSION |
protected static int |
SYSCODE_LENGTH |
protected static String |
TARGET_DATASOURCE_COLUMN_NAME |
possibleOpenConnection, sqlAccess| Constructor and Description |
|---|
SQLListener(boolean dropTables) |
| Modifier and Type | Method and Description |
|---|---|
void |
closeInput()
Closes the input, flushing any links into storage.
|
protected void |
createMappingSetTable() |
protected void |
createSQLTables()
Excecutes several SQL statements to create the tables and indexes in the database.
|
protected void |
dropSQLTables()
Excecutes several SQL statements to drop the tables
|
protected void |
dropTable(String name)
Drops a single table if it exists.
|
protected int |
getAutoInc() |
protected String |
getDataSourceKey(DataSource dataSource) |
void |
insertLink(String sourceId,
String targetId,
int mappingSet,
boolean symetric)
Inserts a mapping into the system.
|
void |
putProperty(String key,
String value) |
int |
registerMappingSet(DataSource source,
DataSource target,
boolean symetric)
Loads all the meta data for a Mapping Set.
|
close, closeConnection, commitTransaction, createPreparedStatement, createStatement, insertEscpaeCharacters, rollbackTransaction, startTransactionpublic static final int SQL_COMPAT_VERSION
protected static final int SYSCODE_LENGTH
protected static final int FULLNAME_LENGTH
protected static final int ID_LENGTH
protected static final int MAPPING_URI_LENGTH
public static final String MAPPING_SET_TABLE_NAME
public static final String ID_COLUMN_NAME
public static final String MAPPING_SET_ID_COLUMN_NAME
protected static final String SOURCE_DATASOURCE_COLUMN_NAME
protected static final String TARGET_DATASOURCE_COLUMN_NAME
protected final String autoIncrement
public SQLListener(boolean dropTables)
throws BridgeDBException
BridgeDBExceptionpublic int registerMappingSet(DataSource source, DataSource target, boolean symetric) throws BridgeDBException
MappingListenerregisterMappingSet in interface MappingListenersource - The SysCode of DataSource part of the source xref/urltarget - The SysCode of DataSource part of the target xref/urlsymetric - Flag to say if mapping should be loaded one way of both ways.
Creates two mapping sets this one and the inverse with one number higher.BridgeDBException - If something goes wrong.
Always thrown by the URI based version as it requires extra parameters to register a mapping Set.protected final String getDataSourceKey(DataSource dataSource)
protected final int getAutoInc()
throws BridgeDBException
BridgeDBExceptionpublic void closeInput()
throws BridgeDBException
MappingListenerMay also update any cashed counts ext.
This method and URLListener method are intended to be duplicates of each other.
closeInput in interface MappingListenerBridgeDBExceptionpublic void insertLink(String sourceId, String targetId, int mappingSet, boolean symetric) throws BridgeDBException
MappingListenerImplementatins may buffer the inserts, so closeInput must be called after the last insert or inserts may be lost.
No checking can be done that the DataSource part of the Xrefs match the declaration.
For speed, the implemented methods is also not required to check that the MappingsSet exists nor that the mapping Set's semantic setting matches that in the insert call.
insertLink in interface MappingListenersourceId - ID of the source xreftargetId - ID of the target xrefmappingSet - The ID of the mapping set to be inserted into.symetric - If true the inverse mapping will be inserted into the mapping set one number higher.BridgeDBExceptionprotected void dropSQLTables()
throws BridgeDBException
BridgeDBExceptionprotected void dropTable(String name) throws BridgeDBException
Virtuosos appears not to have the if exists syntax so errors are assumed to be table not found.
name - BridgeDBExceptionprotected void createSQLTables()
throws BridgeDBException
Table "info" is a control table used by all database version of BridgeDB, inlcuing none OPS ones. If verifies that database is called with the code that matches the schema version.
Table DataSource holds the org.bridgedb.DataSource registry between deployments of the service. The whole table is loaded into the DataSource.class regisrty in the constructor.
BridgeDBExceptionprotected void createMappingSetTable()
throws BridgeDBException
BridgeDBExceptionpublic void putProperty(String key, String value) throws BridgeDBException
BridgeDBExceptionCopyright © 2006–2017 BridgeDb project. All rights reserved.