|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectthinkmap.datasource.util.AbstractDataSource
thinkmap.datasource.database.DatabaseDataSource
public class DatabaseDataSource
A datasource that answers requests by querying a SQL database. It uses a number of QueryDataSources, each one of which responds in specific circumstances.
| Nested Class Summary | |
|---|---|
class |
DatabaseDataSource.DBEdgeEntityModel
Define an edge entity. |
class |
DatabaseDataSource.DBNodeEntityModel
Define a node entity. |
| Field Summary | |
|---|---|
protected IThinkmapContext |
context
|
protected String |
databaseVendor
|
protected DataSource |
db
|
protected boolean |
debug
|
protected Vector |
models
|
protected Vector |
queryDataSources
|
| Constructor Summary | |
|---|---|
DatabaseDataSource()
Creates a new DatabaseDataSource object. |
|
| Method Summary | |
|---|---|
void |
addCall(ProcedureCallDataSource source)
|
void |
addQuery(QueryDataSource source)
|
protected void |
broadcastRequest(Message message,
IEntityHandler callback)
|
void |
contextDestroyed(IThinkmapContext itc)
Called when the given context has been destroyed. |
void |
contextInitializing(IThinkmapContext context)
Called when the given context is initializing. |
void |
contextStarting(IThinkmapContext itc)
Called when the given context is starting. |
void |
contextStopping(IThinkmapContext itc)
Called when the given context is stopping. |
QueryDataSource |
createCall()
|
EdgeEntityModel |
createEdge()
|
protected QueryDataSource |
createListDataSource(NodeEntityModel nodeModel,
Binding[] idKeyBindings,
Binding[] propertyBindings)
|
NodeEntityModel |
createNode()
|
protected StringBuffer |
createNodeSelect(NodeEntityModel nodeModel)
|
QueryDataSource |
createQuery()
|
protected Connection |
getConnection(Message message)
This method returns a connection to a database. |
IThinkmapContext |
getContext()
|
protected String |
getDatabaseDriverVendor()
|
DataSource |
getDataSource()
Get the SQL datasource this uses. |
EntityModel |
getEntityModel(String name)
|
protected NodeColumnModel |
getForeignColumn(EdgeColumnModel ecm)
|
protected static int |
getIdKeyIndex(EntityModel nodeModel,
ColumnModel column)
|
QueryDataSource[] |
getQueryDataSources()
Get the QueryDataSources for this DatabaseDataSource |
protected QueryDataSource |
makeEdgeNodeDataSource(EdgeEntityModel edgeEntity,
NodeEntityModel fromNodeEntity,
NodeEntityModel toNodeEntity,
boolean isInverse)
|
protected QueryDataSource |
makeEntityDataSource(NodeEntityModel nodeModel,
int[] idKeyColumns,
Binding[] idKeyBindings,
Binding[] propertyBindings)
|
protected void |
makeNodeDataSources(NodeEntityModel nodeModel)
|
protected Binding[] |
makeWhereClause(ColumnModel[] edgeCols,
ColumnModel[] toNodeCols,
String edgeTableName,
String toNodeTableName,
NodeEntityModel toNodeEntity,
NodeEntityModel fromNodeEntity,
StringBuffer query,
boolean isInverse)
|
protected void |
processCustomRequest(Message message,
IEntityHandler callback)
Handle a custom request. |
protected void |
processEntityRequest(Message message,
IEntityHandler callback)
Handle an Entity request. |
protected void |
processIdRequest(Message message,
IEntityHandler callback)
Handle an ID request. |
protected void |
processMetadataRequest(Message message,
IEntityHandler callback)
Handle a metadata request. |
protected void |
processRelatedRequest(Message message,
IEntityHandler callback)
Handle a related request. |
void |
setConfig(ThinkmapConfig config)
|
void |
setDataSource(DataSource db)
Set the SQL datasource this uses. |
void |
setDebug(boolean b)
Set to true to enable debug output. |
| Methods inherited from class thinkmap.datasource.util.AbstractDataSource |
|---|
createRequest, processRequest |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected boolean debug
protected DataSource db
protected Vector queryDataSources
protected Vector models
protected String databaseVendor
protected IThinkmapContext context
| Constructor Detail |
|---|
public DatabaseDataSource()
| Method Detail |
|---|
public void setConfig(ThinkmapConfig config)
public void contextInitializing(IThinkmapContext context)
throws Exception
IContextListener
contextInitializing in interface IContextListenercontext - the context that is initializing
Exception - if an error occurs while processing this event.public void contextStarting(IThinkmapContext itc)
IContextListener
contextStarting in interface IContextListeneritc - the context that is startingpublic void contextStopping(IThinkmapContext itc)
IContextListener
contextStopping in interface IContextListeneritc - the context that is startingpublic void contextDestroyed(IThinkmapContext itc)
IContextListener
contextDestroyed in interface IContextListeneritc - the context that is being destroyedpublic void setDebug(boolean b)
b - true to enable debug outputpublic IThinkmapContext getContext()
public QueryDataSource createQuery()
public void addQuery(QueryDataSource source)
public QueryDataSource[] getQueryDataSources()
public QueryDataSource createCall()
public void addCall(ProcedureCallDataSource source)
public void setDataSource(DataSource db)
db - SQL datasourcepublic DataSource getDataSource()
protected void processMetadataRequest(Message message,
IEntityHandler callback)
AbstractDataSource
processMetadataRequest in class AbstractDataSourcemessage - The incoming request, packaged into a handy object.callback - The IEntityHandler which will receive the response.
protected void processIdRequest(Message message,
IEntityHandler callback)
AbstractDataSource
processIdRequest in class AbstractDataSourcemessage - The incoming request, packaged into a handy object.callback - The IEntityHandler which will receive the response.
protected void processEntityRequest(Message message,
IEntityHandler callback)
AbstractDataSource
processEntityRequest in class AbstractDataSourcemessage - The incoming request, packaged into a handy object.callback - The IEntityHandler which will receive the response.
protected void processRelatedRequest(Message message,
IEntityHandler callback)
AbstractDataSource
processRelatedRequest in class AbstractDataSourcemessage - The incoming request, packaged into a handy object.callback - The IEntityHandler which will receive the response.
protected void processCustomRequest(Message message,
IEntityHandler callback)
AbstractDataSource
processCustomRequest in class AbstractDataSourcemessage - The incoming request, packaged into a handy object.callback - The IEntityHandler which will receive the response.
protected void broadcastRequest(Message message,
IEntityHandler callback)
protected Connection getConnection(Message message)
throws SQLException
message - A request message from the client side
SQLExceptionpublic NodeEntityModel createNode()
public EdgeEntityModel createEdge()
public EntityModel getEntityModel(String name)
protected void makeNodeDataSources(NodeEntityModel nodeModel)
protected QueryDataSource makeEntityDataSource(NodeEntityModel nodeModel,
int[] idKeyColumns,
Binding[] idKeyBindings,
Binding[] propertyBindings)
protected StringBuffer createNodeSelect(NodeEntityModel nodeModel)
protected QueryDataSource createListDataSource(NodeEntityModel nodeModel,
Binding[] idKeyBindings,
Binding[] propertyBindings)
protected QueryDataSource makeEdgeNodeDataSource(EdgeEntityModel edgeEntity,
NodeEntityModel fromNodeEntity,
NodeEntityModel toNodeEntity,
boolean isInverse)
throws BindingException
BindingException
protected Binding[] makeWhereClause(ColumnModel[] edgeCols,
ColumnModel[] toNodeCols,
String edgeTableName,
String toNodeTableName,
NodeEntityModel toNodeEntity,
NodeEntityModel fromNodeEntity,
StringBuffer query,
boolean isInverse)
throws BindingException
BindingException
protected static int getIdKeyIndex(EntityModel nodeModel,
ColumnModel column)
protected NodeColumnModel getForeignColumn(EdgeColumnModel ecm)
throws BindingException
BindingExceptionprotected String getDatabaseDriverVendor()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||