|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.farrago.plugin.FarragoAbstractPluginBase net.sf.farrago.namespace.impl.MedAbstractBase net.sf.farrago.namespace.impl.MedAbstractNameDirectory net.sf.farrago.namespace.jdbc.MedJdbcNameDirectory
public class MedJdbcNameDirectory
MedJdbcNameDirectory implements the FarragoMedNameDirectory interface by mapping the metadata provided by any JDBC driver.
Field Summary | |
---|---|
(package private) String |
schemaName
|
(package private) MedJdbcDataServer |
server
|
(package private) boolean |
shouldSubstituteTypes
|
(package private) Properties |
typeMapping
|
Fields inherited from class net.sf.farrago.plugin.FarragoAbstractPluginBase |
---|
BOOLEAN_CHOICES_DEFAULT_FALSE, BOOLEAN_CHOICES_DEFAULT_TRUE, EMPTY_DRIVER_PROPERTIES |
Constructor Summary | |
---|---|
MedJdbcNameDirectory(MedJdbcDataServer server)
|
|
MedJdbcNameDirectory(MedJdbcDataServer server,
String schemaName)
|
Method Summary | |
---|---|
private void |
addTypeMapping(String s)
|
private String |
getFilterPattern(FarragoMedMetadataQuery query,
String typeName)
|
private String |
getMappedTableName(String schema,
String table,
String origSchema)
Convert the foreign database's schema and table into the "foreign" name used locally by Farrago in origSchema . |
private String[] |
getSchemaPattern()
|
MedJdbcDataServer |
getServer()
|
private String[] |
getTablePattern(FarragoMedMetadataQuery query,
String typeName,
String schema)
|
protected boolean |
isRemoteSqlValid(SqlNode sqlNode)
Tests whether a remote SQL query is valid by attempting to prepare it. |
FarragoMedColumnSet |
lookupColumnSet(FarragoTypeFactory typeFactory,
String foreignName,
String[] localName)
Looks up a FarragoMedColumnSet by name. |
(package private) FarragoMedColumnSet |
lookupColumnSetAndImposeType(FarragoTypeFactory typeFactory,
String foreignName,
String[] localName,
RelDataType rowType,
boolean tableAlreadyMapped)
Looks up the FarragoMedColumnSet for the given table. |
FarragoMedNameDirectory |
lookupSubdirectory(String foreignName)
Looks up an immediate subdirectory by name. |
private boolean |
matchSchema(String s1,
String s2)
|
(package private) String |
normalizeQueryString(String sql)
|
private boolean |
queryColumns(FarragoMedMetadataQuery query,
FarragoMedMetadataSink sink,
List<String> tableListActual,
List<String> schemaListActual,
List<String> tableListOptimized)
|
private boolean |
queryColumnsImpl(FarragoMedMetadataQuery query,
FarragoMedMetadataSink sink,
String tableName,
String actualSchemaName,
Set<String> tableSet)
|
boolean |
queryMetadata(FarragoMedMetadataQuery query,
FarragoMedMetadataSink sink)
Executes a query against the metadata contained by this directory. |
private boolean |
querySchemas(FarragoMedMetadataQuery query,
FarragoMedMetadataSink sink)
|
private boolean |
queryTables(FarragoMedMetadataQuery query,
FarragoMedMetadataSink sink,
List<String> tableListActual,
List<String> schemaListActual,
List<String> tableListOptimized)
|
private RelDataType |
updateRowType(FarragoTypeFactory typeFactory,
RelDataType currRowType,
RelDataType srcRowType)
|
private void |
validateRowType(RelDataType rowType,
RelDataType srcRowType)
|
Methods inherited from class net.sf.farrago.namespace.impl.MedAbstractNameDirectory |
---|
newImportedColumnSet |
Methods inherited from class net.sf.farrago.plugin.FarragoAbstractPluginBase |
---|
getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getLongProperty, getShortProperty, requireProperty |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
final MedJdbcDataServer server
String schemaName
final boolean shouldSubstituteTypes
final Properties typeMapping
Constructor Detail |
---|
public MedJdbcNameDirectory(MedJdbcDataServer server)
public MedJdbcNameDirectory(MedJdbcDataServer server, String schemaName)
Method Detail |
---|
public MedJdbcDataServer getServer()
public FarragoMedColumnSet lookupColumnSet(FarragoTypeFactory typeFactory, String foreignName, String[] localName) throws SQLException
FarragoMedNameDirectory
typeFactory
- FarragoTypeFactory to use for defining typesforeignName
- simple name of foreign ColumnSet to lookup as a direct
child of this directorylocalName
- compound identifier by which FarragoMedColumnSet will be
referenced locally
SQLException
- if metadata access is unsuccessfulFarragoMedColumnSet lookupColumnSetAndImposeType(FarragoTypeFactory typeFactory, String foreignName, String[] localName, RelDataType rowType, boolean tableAlreadyMapped) throws SQLException
typeFactory
- typeFactory to use for type mappingforeignName
- foreign table namelocalName
- fully qualified local table namerowType
- expected row typetableAlreadyMapped
- if true, foreignName has already been mapped to
the foreign database name; if false the mapping has not yet been applied
SQLException
- if there is an error querying metadata in the
underlying databaseString normalizeQueryString(String sql)
public FarragoMedNameDirectory lookupSubdirectory(String foreignName) throws SQLException
FarragoMedNameDirectory
lookupSubdirectory
in interface FarragoMedNameDirectory
lookupSubdirectory
in class MedAbstractNameDirectory
foreignName
- identifier for subdirectory
SQLException
- if metadata access is unsuccessfulpublic boolean queryMetadata(FarragoMedMetadataQuery query, FarragoMedMetadataSink sink) throws SQLException
FarragoMedNameDirectory
NOTE: the supplied sink may be used to implement passive aborts by throwing an unchecked exception when an abort request is detected.
queryMetadata
in interface FarragoMedNameDirectory
queryMetadata
in class MedAbstractNameDirectory
query
- the query to executesink
- target which receives the query results
SQLException
- if metadata access is unsuccessful (but not if
query is unsupported)private boolean querySchemas(FarragoMedMetadataQuery query, FarragoMedMetadataSink sink) throws SQLException
SQLException
private boolean queryTables(FarragoMedMetadataQuery query, FarragoMedMetadataSink sink, List<String> tableListActual, List<String> schemaListActual, List<String> tableListOptimized) throws SQLException
SQLException
private boolean queryColumns(FarragoMedMetadataQuery query, FarragoMedMetadataSink sink, List<String> tableListActual, List<String> schemaListActual, List<String> tableListOptimized) throws SQLException
SQLException
private boolean queryColumnsImpl(FarragoMedMetadataQuery query, FarragoMedMetadataSink sink, String tableName, String actualSchemaName, Set<String> tableSet) throws SQLException
SQLException
private String[] getSchemaPattern()
private String[] getTablePattern(FarragoMedMetadataQuery query, String typeName, String schema)
private String getFilterPattern(FarragoMedMetadataQuery query, String typeName)
private String getMappedTableName(String schema, String table, String origSchema)
origSchema
.
schema
- foreign database's schematable
- foreign database's tableorigSchema
- Farrago schema to which the table is mapped
table
if no mapping is foundprivate boolean matchSchema(String s1, String s2)
private void addTypeMapping(String s)
private RelDataType updateRowType(FarragoTypeFactory typeFactory, RelDataType currRowType, RelDataType srcRowType)
private void validateRowType(RelDataType rowType, RelDataType srcRowType)
protected boolean isRemoteSqlValid(SqlNode sqlNode)
sqlNode
- SQL query to be tested
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |