public class GenericDatabaseExtractor extends AbstractWandoraTool
Modifier and Type | Class and Description |
---|---|
static class |
GenericDatabaseExtractor.DatabaseSchema
Data structure containing information about database schema.
|
static class |
GenericDatabaseExtractor.DBColumn
Datastructure containing information about a single column in a database schema.
|
Modifier and Type | Field and Description |
---|---|
java.util.HashMap<java.lang.String,Topic> |
topicCache |
Constructor and Description |
---|
GenericDatabaseExtractor()
Creates a new instance of GenericDatabaseExtractor
|
Modifier and Type | Method and Description |
---|---|
private boolean |
configureSchema(Wandora admin,
GenericDatabaseExtractor.DatabaseSchema schema) |
static java.lang.String |
cropBaseName(java.lang.String value,
java.lang.String postfix) |
void |
execute(Wandora admin,
Context context)
Runs the tool.
|
static GenericDatabaseExtractor.DBColumn |
findColumn(java.util.Collection<GenericDatabaseExtractor.DBColumn> columns,
java.lang.String name) |
static GenericDatabaseExtractor.DatabaseSchema |
getDatabaseSchema(java.sql.DatabaseMetaData metadata,
java.lang.String catalog,
java.lang.String schema)
Gets a database schema based on DatabaseMetaData.
|
java.lang.String |
getDescription()
AdminToolManager views tool descriptions while user browses available
tools and build user customizable GUI elements such as Tools menu.
|
javax.swing.Icon |
getIcon()
All tools may have identifying graphic icon used within tool GUI elements.
|
java.lang.String |
getName()
Tools name represent the tool in UI unless the tool has been given
explicitly another GUI name.
|
Topic |
getOrCreateCached(TopicMap tm,
java.lang.String s) |
static GenericDatabaseExtractor.DBColumn |
getOrCreateColumn(java.util.HashMap<Tuples.T2<java.lang.String,java.lang.String>,GenericDatabaseExtractor.DBColumn> columns,
java.lang.String table,
java.lang.String column) |
static Topic |
getOrCreateTopic(TopicMap tm,
java.lang.String s) |
WandoraToolType |
getType()
Tool type is used to categorize tools.
|
static java.lang.String |
makeIdentifier(java.lang.String[] row,
GenericDatabaseExtractor.DBColumn[] columns,
java.lang.String table) |
void |
makeTopicMap(TopicMap tm,
java.sql.Connection con,
GenericDatabaseExtractor.DatabaseSchema schema) |
static void |
printResultSet(java.sql.ResultSet rs) |
static void |
setDefaultBaseNameColumns(GenericDatabaseExtractor.DatabaseSchema schema)
Sets the baseName attribute to true in one column of each table.
|
addUndoMarker, addUndoMarker, allowMultipleInvocations, clearAllThreads, clearThreads, clearThreads, clearToolLock, clearToolLock, clearToolLocks, configure, execute, execute, forceStop, forceStop, getContext, getCurrentLogger, getDefaultLogger, getHistory, getLastLogger, getState, getThreads, getThreads, getToolMenuItem, getToolMenuItem, getTopicName, hlog, initialize, interruptAllThreads, interruptThreads, interruptThreads, isConfigurable, isRunning, isRunning, lockLog, log, log, log, log, requiresRefresh, run, runInOwnThread, setContext, setDefaultLogger, setLogTitle, setProgress, setProgressMax, setState, setToolLogger, singleLog, singleLog, singleLog, solveContextTopicMap, solveNameForTopicMap, writeOptions
public java.util.HashMap<java.lang.String,Topic> topicCache
public GenericDatabaseExtractor()
public java.lang.String getName()
AbstractWandoraTool
getName
in interface WandoraTool
getName
in class AbstractWandoraTool
public java.lang.String getDescription()
AbstractWandoraTool
getDescription
in interface WandoraTool
getDescription
in class AbstractWandoraTool
public WandoraToolType getType()
AbstractWandoraTool
Tool type is used to categorize tools. Tool type has no real effect today, it is merely an informative property of a tool.
getType
in interface WandoraTool
getType
in class AbstractWandoraTool
public javax.swing.Icon getIcon()
AbstractWandoraTool
getIcon
should return Icon
object of
the tool.getIcon
in interface WandoraTool
getIcon
in class AbstractWandoraTool
public void execute(Wandora admin, Context context) throws TopicMapException
WandoraTool
TopicMapException
private boolean configureSchema(Wandora admin, GenericDatabaseExtractor.DatabaseSchema schema)
public static void printResultSet(java.sql.ResultSet rs) throws java.sql.SQLException
java.sql.SQLException
public static java.lang.String makeIdentifier(java.lang.String[] row, GenericDatabaseExtractor.DBColumn[] columns, java.lang.String table) throws java.sql.SQLException
java.sql.SQLException
public static Topic getOrCreateTopic(TopicMap tm, java.lang.String s) throws TopicMapException
TopicMapException
public Topic getOrCreateCached(TopicMap tm, java.lang.String s) throws TopicMapException
TopicMapException
public static GenericDatabaseExtractor.DBColumn findColumn(java.util.Collection<GenericDatabaseExtractor.DBColumn> columns, java.lang.String name)
public static java.lang.String cropBaseName(java.lang.String value, java.lang.String postfix)
public void makeTopicMap(TopicMap tm, java.sql.Connection con, GenericDatabaseExtractor.DatabaseSchema schema) throws java.sql.SQLException, TopicMapException
java.sql.SQLException
TopicMapException
public static GenericDatabaseExtractor.DBColumn getOrCreateColumn(java.util.HashMap<Tuples.T2<java.lang.String,java.lang.String>,GenericDatabaseExtractor.DBColumn> columns, java.lang.String table, java.lang.String column)
public static void setDefaultBaseNameColumns(GenericDatabaseExtractor.DatabaseSchema schema)
public static GenericDatabaseExtractor.DatabaseSchema getDatabaseSchema(java.sql.DatabaseMetaData metadata, java.lang.String catalog, java.lang.String schema) throws java.sql.SQLException
Gets a database schema based on DatabaseMetaData. Catalog and schema parameters are descibed in java.sql.DatabaseMetaData.getCrossReference. Practically, catalog is usually null and schema is the database user name. Thus you will usually do something like this:
Connection con=DriverManager.getConnection(conString,user,pass); DatabaseMetaData metadata=con.getMetaData(); DatabaseSchema schema=getDatabaseSchema(metadata,null,user);
java.sql.SQLException
Copyright 2004-2015 Wandora Team