ReportMill 10 API

com.reportmill.datasource
Class RMJDBCDataSourceBasic

java.lang.Object
  extended by com.reportmill.datasource.RMDataSource
      extended by com.reportmill.datasource.RMJDBCDataSourceBasic
All Implemented Interfaces:
RMBindSource, java.lang.Cloneable
Direct Known Subclasses:
RMJDBCDataSource

public class RMJDBCDataSourceBasic
extends RMDataSource

This class provides a datasource representing a JDBC database fetch.


Field Summary
 java.sql.Statement _statement
           
 
Constructor Summary
RMJDBCDataSourceBasic()
          Creates a new RMDataSource JDBC.
 
Method Summary
 void cancelStatement()
          Interrupt the currently executing statement.
 void close()
          Call this to explicitly close the database connection.
 RMResource createResource(java.lang.String aName, java.lang.Object theBytes)
          Creates a new resource for given name and bytes.
 boolean equals(java.lang.Object anObj)
          Standard equals implementation.
 java.sql.ResultSet executeQuery(java.lang.String aQuery)
          Returns the dataset for this datasource.
 java.lang.Object fromXML(com.reportmill.archiver.RXArchiver anArchiver, com.reportmill.archiver.RXElement anElement)
          XML unarchival.
 java.sql.Connection getConnection()
          Returns a database connection for this datasource.
 java.lang.String getConnectionURL()
          Returns the connection info URL.
 RMSchema getDatabaseSchema()
          Returns a schema for this datasource's database.
 RMSchema getDatabaseSchema(java.lang.String catalogName, java.lang.String dbSchemaName)
          Returns the database metadata for a particular catalog & schema as an RMSchema.
 java.util.Map getDataset()
          Returns the dataset for this datasource.
 java.lang.String getDefaultDatasetName()
          Returns the default dataset name.
 java.lang.String getDriverClassName()
          Returns the driver class name.
 java.lang.String getError()
          Returns any error string from datasource reload.
 int getFetchLimit()
          Returns the limit on the number of objects to fetch.
 java.lang.String getPassword()
          Returns the password.
 java.lang.String getQuery()
          Returns the query string.
 RMResource getResource(java.lang.String aName)
          Returns the resource for a given name.
 java.lang.String[] getResourceNames(java.lang.String aType)
          Returns the resource names for a given type (extension).
 RMSchema getSchema()
          Returns the schema for this datasource's dataset.
 RMEntity getTableSchema(java.sql.DatabaseMetaData dbMetaData, java.lang.String aTableName)
          Returns a schema for a table name in this database.
 java.lang.String getUserName()
          Returns the user name.
 boolean isConnected()
          Returns whether datasource is currently connected to db.
 boolean isReadOnly()
          Returns whether database is in read-only mode.
 void refresh()
          Refreshes datatset (just by clearing it to force a refetch).
 void setConnectionURL(java.lang.String aURL)
          Sets the connection info URL.
 void setDefaultDatasetName(java.lang.String aName)
          Sets the default dataset name.
 void setDriverClassName(java.lang.String aName)
          Sets the driver class name.
 void setError(java.lang.String anError)
          Sets any error string from datasource reload.
 void setFetchLimit(int aValue)
          Sets the limit on the number of objects to fetch.
 void setLogging(boolean on)
          For debugging.
 void setPassword(java.lang.String aPassword)
          Sets the password.
 void setQuery(java.lang.String aString)
          Sets the query string.
 void setUserName(java.lang.String aName)
          Sets the user name.
 com.reportmill.archiver.RXElement toXML(com.reportmill.archiver.RXArchiver anArchiver)
          XML archival.
 
Methods inherited from class com.reportmill.datasource.RMDataSource
clone, createDatum, dataAdd, dataChange, dataRemove, getData, getDataSet, getDataSet, getEntity, getName, getRelation, hasChanges, initFromDataSource, saveChanges, setName, setSchema, toString
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_statement

public java.sql.Statement _statement
Constructor Detail

RMJDBCDataSourceBasic

public RMJDBCDataSourceBasic()
Creates a new RMDataSource JDBC.

Method Detail

getDriverClassName

public java.lang.String getDriverClassName()
Returns the driver class name.


setDriverClassName

public void setDriverClassName(java.lang.String aName)
Sets the driver class name.


getConnectionURL

public java.lang.String getConnectionURL()
Returns the connection info URL.


setConnectionURL

public void setConnectionURL(java.lang.String aURL)
Sets the connection info URL.


getUserName

public java.lang.String getUserName()
Returns the user name.


setUserName

public void setUserName(java.lang.String aName)
Sets the user name.


getPassword

public java.lang.String getPassword()
Returns the password.


setPassword

public void setPassword(java.lang.String aPassword)
Sets the password.


getQuery

public java.lang.String getQuery()
Returns the query string.


setQuery

public void setQuery(java.lang.String aString)
Sets the query string.


getFetchLimit

public int getFetchLimit()
Returns the limit on the number of objects to fetch.


setFetchLimit

public void setFetchLimit(int aValue)
Sets the limit on the number of objects to fetch.


getDefaultDatasetName

public java.lang.String getDefaultDatasetName()
Returns the default dataset name.


setDefaultDatasetName

public void setDefaultDatasetName(java.lang.String aName)
Sets the default dataset name.


getSchema

public RMSchema getSchema()
Returns the schema for this datasource's dataset.

Overrides:
getSchema in class RMDataSource

getDataset

public java.util.Map getDataset()
Returns the dataset for this datasource.

Overrides:
getDataset in class RMDataSource

refresh

public void refresh()
Refreshes datatset (just by clearing it to force a refetch).

Overrides:
refresh in class RMDataSource

getError

public java.lang.String getError()
Returns any error string from datasource reload.

Overrides:
getError in class RMDataSource

setError

public void setError(java.lang.String anError)
Sets any error string from datasource reload.


isConnected

public boolean isConnected()
Returns whether datasource is currently connected to db.


close

public void close()
Call this to explicitly close the database connection.


getConnection

public java.sql.Connection getConnection()
Returns a database connection for this datasource.


executeQuery

public java.sql.ResultSet executeQuery(java.lang.String aQuery)
Returns the dataset for this datasource.


cancelStatement

public void cancelStatement()
Interrupt the currently executing statement. (Let's hope the database supports it)


setLogging

public void setLogging(boolean on)
For debugging. Enables/disables logging to System.err


getDatabaseSchema

public RMSchema getDatabaseSchema()
Returns a schema for this datasource's database.


getDatabaseSchema

public RMSchema getDatabaseSchema(java.lang.String catalogName,
                                  java.lang.String dbSchemaName)
Returns the database metadata for a particular catalog & schema as an RMSchema.


getTableSchema

public RMEntity getTableSchema(java.sql.DatabaseMetaData dbMetaData,
                               java.lang.String aTableName)
Returns a schema for a table name in this database.


getResourceNames

public java.lang.String[] getResourceNames(java.lang.String aType)
Returns the resource names for a given type (extension). Resources are stored in the RMINFO.RESOURCES table, which is created by RMSchema.

Overrides:
getResourceNames in class RMDataSource

createResource

public RMResource createResource(java.lang.String aName,
                                 java.lang.Object theBytes)
Creates a new resource for given name and bytes.

Overrides:
createResource in class RMDataSource

getResource

public RMResource getResource(java.lang.String aName)
Returns the resource for a given name.

Overrides:
getResource in class RMDataSource

isReadOnly

public boolean isReadOnly()
Returns whether database is in read-only mode. This tests if the entire db is read-only. We might want to check permissions of the various tables for this user at some point.

Overrides:
isReadOnly in class RMDataSource

equals

public boolean equals(java.lang.Object anObj)
Standard equals implementation.

Overrides:
equals in class RMDataSource

toXML

public com.reportmill.archiver.RXElement toXML(com.reportmill.archiver.RXArchiver anArchiver)
XML archival.

Overrides:
toXML in class RMDataSource

fromXML

public java.lang.Object fromXML(com.reportmill.archiver.RXArchiver anArchiver,
                                com.reportmill.archiver.RXElement anElement)
XML unarchival.

Overrides:
fromXML in class RMDataSource

ReportMill 10 API