|
i-net Clear Reports | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.inet.report.config.datasource.DataSourceConfiguration
public class DataSourceConfiguration
A DataSourceConfiguration is a description for a data source, that can be used by an
i-net Clear Reports report.
We differentiate between a data source use a JDBC driver and a data source use a
com.inet.report.Database extended class.
In last case the report data will be set directly by Database class. In first case
i-net Clear Reports use the settings of this data source configuration to establish a
JDBC connection to a database server.
Then it requests the data via SQL statements.
At execution time of the report, i-net Clear Reports creates the connection to the
database, based on this settings.
If i-net Clear Reports runs inside of an application server, it will try to find a
connection via JNDI.
The path to receive the DataSource from application server is :
"java:comp/env/jdbc/"+DataSourceConfiguration.
If no data source was found, i-net Clear Reports creates the connection by itself.
Typical a DataSourceConfiguration will be created with the GUI but you can also create it via API.
Example for a DataSourceConfiguration based on a Database class:
DataSourceConfiguration dsc = DataSourceConfigurationManager.createDataSourceConfiguration( "myFirstDSC", DataSourceConfigurationManager.TEMPORARY_PREFERENCES );
dsc.setDatabaseClassname( "com.company.DatabaseImpl" );
dsc.setDriverLibrary( "c:/lib/reportclasses.jar" );//you can also set an URL
dsc.save( DataSourceConfigurationManager.TEMPORARY_PREFERENCES ); //-> manager->store
Samples for own Database classes can be found in sample library at:
DataSourceConfiguration dsc = DataSourceConfigurationManager.createDataSourceConfiguration( "myFirstDSC", DataSourceConfigurationManager.TEMPORARY_PREFERENCES );
dsc.addProperty( DataSourceConfiguration.PROPERTY_DRIVER_CLASSNAME, "com.inet.tds.TdsDriver" );//MS SQL Server driver from i-net software
dsc.addProperty( DataSourceConfiguration.PROPERTY_URL, "jdbc:inetdae7" );
dsc.addProperty( DataSourceConfiguration.PROPERTY_USER, "sa" );
dsc.addProperty( DataSourceConfiguration.PROPERTY_PASSWORD, "xxxx" );
dsc.addProperty( "host", "localhost"); //a driver specific property
dsc.addProperty( "database", "northwind" ); //a driver specific property
dsc.save( DataSourceConfigurationManager.TEMPORARY_PREFERENCES ); //-> manager->store
...
create a new report based on this datasource configuration
Engine e = RDC.createEmptyEngine();
Datasource ds = e.getDatabaseTables().createDatasource("myFirstDSC");
TableSource ts = ds.create...
switch an existing Datasource to a DataSourceConfiguration
Engine eng = new Engine();
eng.setReportFile("c:/sample.rpt");
Datasource ds = eng.getDatabaseTables().getDatasource(0);
ds.setup("myFirstDSC");
DataSourceConfigurationManager,
Datasource,
Serialized Form| Field Summary | |
|---|---|
static java.lang.String |
PROPERTY_ALIASTOKEN
The property that stores the "aliasToken" flag. |
static java.lang.String |
PROPERTY_CATALOG
The property that stores the catalog. |
static java.lang.String |
PROPERTY_DATABASE_CLASSNAME
The property that stores the com.inet.report.Database |
static java.lang.String |
PROPERTY_DRIVER_CLASSNAME
The property that stores the full qualified class name of JDBC Driver. |
static java.lang.String |
PROPERTY_DRIVER_LIBRARY
The property that stores the JDBC Driver library. |
static java.lang.String |
PROPERTY_ESCAPE_EVERYTHING
The property that stores the "escapeEverything" flag. |
static java.lang.String |
PROPERTY_IDENTIFIER_QUOTE_STRING
The property that stores the "identifierQuoteString" flag. |
static java.lang.String |
PROPERTY_INITSQL
The property defining the sql statement which should be executed after the JDBC connection has been established. |
static java.lang.String |
PROPERTY_PASSWORD
The property that stores the user password. |
static java.lang.String |
PROPERTY_QUOTES_LOWER_CASE
The property that stores the "quotesLowerCase" flag. |
static java.lang.String |
PROPERTY_SAVE_PASSWORD
The property that stores the "savePassword" flag. |
static java.lang.String |
PROPERTY_SUPPORTS_ORDERBY
The property that stores the "supportsOrderBy" flag. |
static java.lang.String |
PROPERTY_SUPPORTS_SQL92
The property that stores the "supportsSQL92" flag. |
static java.lang.String |
PROPERTY_SUPPORTS_WHERE
The property that stores the "supportsWhere" flag. |
static java.lang.String |
PROPERTY_URL
The property that stores the JDBC URL. |
static java.lang.String |
PROPERTY_USER
The property that stores the user. |
static java.lang.String |
PROPERTY_USE_PARENTHESES_FOR_JOIN
The property that stores the "supportsParenthesesForJoin" flag. |
static java.lang.String |
PROPERTY_VALIDATION_QUERY
The property that stored the validation query. |
| Method Summary | |
|---|---|
static java.lang.String |
adaptUrl(java.lang.String url,
java.util.Properties driverProps)
Adapts the provided URL by replacing placeholders of format {propertyname} with the value of the regarding property in the provided Properties object. |
void |
addProperties(java.util.Properties properties)
Adds all properties by forward to function DataSourceConfiguration.addProperty(String, String). |
void |
addProperty(java.lang.String key,
java.lang.String value)
Add properties here to configure used JDBC driver. |
java.lang.String |
checkConnection()
Deprecated. As of i-net Crystal-Clear 10.0, replaced by validate() |
int |
compareTo(java.lang.Object o)
Order this class by name. |
java.lang.String |
getAliasToken()
Returns the SQL keyword that is required to define an alias name in a SQL statement. |
java.lang.String |
getCatalog()
Returns the set database catalog. |
java.lang.String |
getConfigurationName()
Returns the name of this DataSourceConfiguration. |
java.lang.String |
getDatabaseClassname()
Returns com.inet.report.Database class name or an empty String. |
java.lang.String |
getDriverClassname()
Returns the name of the java.sql.Driver that will be used to establish the Connection to database. |
java.lang.String |
getDriverLibrary()
Returns the path of the JDBC Driver jar file. |
java.lang.String |
getIdentifierQuoteString()
Returns the string used to quote SQL identifiers. |
java.lang.String |
getPassword()
Returns the password of the database user used to create database Connection. |
java.util.Properties |
getProperties()
Returns all properties stored in this DataSourceConfiguration. |
java.lang.String |
getProperty(java.lang.String key)
Returns the value for passed property. |
java.lang.String |
getUrl()
Returns the set JDBC url that will be used to create the Connection. |
java.lang.String |
getUser()
Returns the set database user. |
java.lang.String |
getValidationQuery()
Returns the set SQL validation query which should be used to check if the database connection is valid or not. |
int |
hashCode()
|
boolean |
isLayoutDataSource()
Returns if this datasource is a source for creating ad hoc reporting layouts. |
boolean |
isNeedPassword()
Returns false if the current driver does not need a password. |
boolean |
isSavePassword()
Returns if the password should be saved. |
boolean |
isUseEscapeEverything()
Returns the value of the flag escapeEverything. |
boolean |
isUseOrderBy()
Indicates whether an ORDER BY clause is allowed for the sql statement. |
boolean |
isUseParenthesiseForJoin()
Indicates whether parentheses are allowed in FROM clause os the sql statement. |
boolean |
isUseQuoteLowerCase()
Indicates whether table names and column names have to be quoted. |
boolean |
isUseSQL92syntax()
Indicates whether the SQL statement can contain the join condition in SQL92 syntax or not. |
boolean |
isUseWhereClause()
Indicates whether the SQL statement can contain the WHERE clause or not. |
void |
save(int preferenceScope)
Saves the settings of this DataSourceConfiguration to the underlying store (XML file). |
void |
setAliasToken(java.lang.String aliasToken)
Sets the SQL keyword that will be put between table name and table alias. |
void |
setCatalog(java.lang.String catalog)
Sets the database catalog used to create database Connection. |
void |
setDatabaseClassname(java.lang.String classname)
Sets the class name of a class extended from com.inet.report.Database. |
void |
setDriverClassname(java.lang.String classname)
Sets the class name of a java.sql.Driver implementation. |
void |
setDriverLibrary(java.lang.String libraryPath)
Set the path to the library files that will be loaded before using the set JDBC Driver. |
void |
setIdentifierQuoteString(java.lang.String identifierQuoteString)
Sets the string used to quote SQL identifiers. |
void |
setPassword(java.lang.String password)
Sets the password of the database user used to create database Connection. |
void |
setSavePassword(boolean savePassword)
Sets whether the passwort should be saved or not. |
void |
setUrl(java.lang.String url)
Sets JDBC url that will be used to create the Connection. |
void |
setUseEscapeEverything(boolean escapeEverything)
This method is for adapt the sql statement for a specific database. |
void |
setUseOrderBy(boolean useOrderBy)
Set here whether the sql statement can have an ORDER BY clause or not. |
void |
setUseParenthesiseForJoin(boolean useParenthesiseForJoin)
Set here whether the sql statement can have parentheses in FROM clause or not. |
void |
setUseQuoteLowerCase(boolean useQuoteLowerCase)
Set here whether table names and column names have to be quoted. |
void |
setUseSQL92syntax(boolean useSQL92syntax)
Set here whether the SQL statement can contain the join condition in SQL92 syntax or not. |
void |
setUseWhereClause(boolean useWhereClause)
Indicates whether the SQL statement can contain the WHERE clause or not. |
void |
setUser(java.lang.String user)
Sets the database user used to create database Connection. |
void |
setValidationQuery(java.lang.String validationQuery)
Sets the SQL query which should be executed to validate the connection defined by this DataSourceConfiguration. |
java.lang.String |
toString()
Returns the name of this DataSourceConfiguration. |
void |
validate()
Checks if it is possible to get a connection based on this DataSourceConfiguration. |
| Field Detail |
|---|
public static final java.lang.String PROPERTY_CATALOG
setCatalog(String),
getCatalog(),
addProperty(String, String),
getProperty(String),
Constant Field Valuespublic static final java.lang.String PROPERTY_USER
setUser(String),
getUser(),
addProperty(String, String),
getProperty(String),
Constant Field Valuespublic static final java.lang.String PROPERTY_PASSWORD
setPassword(String),
getPassword(),
addProperty(String, String),
getProperty(String),
Constant Field Valuespublic static final java.lang.String PROPERTY_SAVE_PASSWORD
setSavePassword(boolean),
isSavePassword(),
addProperty(String, String),
getProperty(String),
Constant Field Valuespublic static final java.lang.String PROPERTY_URL
setUrl(String),
getUrl(),
addProperty(String, String),
getProperty(String),
Constant Field Valuespublic static final java.lang.String PROPERTY_SUPPORTS_SQL92
setUseSQL92syntax(boolean),
isUseSQL92syntax(),
addProperty(String, String),
getProperty(String),
Constant Field Valuespublic static final java.lang.String PROPERTY_SUPPORTS_ORDERBY
setUseOrderBy(boolean),
isUseOrderBy(),
addProperty(String, String),
getProperty(String),
Constant Field Valuespublic static final java.lang.String PROPERTY_SUPPORTS_WHERE
setUseWhereClause(boolean),
isUseWhereClause(),
addProperty(String, String),
getProperty(String),
Constant Field Valuespublic static final java.lang.String PROPERTY_DRIVER_LIBRARY
setDriverLibrary(String),
getDriverLibrary(),
addProperty(String, String),
getProperty(String),
Constant Field Valuespublic static final java.lang.String PROPERTY_DRIVER_CLASSNAME
setDriverLibrary(String),
getDriverClassname(),
addProperty(String, String),
getProperty(String),
Constant Field Valuespublic static final java.lang.String PROPERTY_DATABASE_CLASSNAME
com.inet.report.Database
setDatabaseClassname(String),
getDatabaseClassname(),
addProperty(String, String),
getProperty(String),
Constant Field Valuespublic static final java.lang.String PROPERTY_QUOTES_LOWER_CASE
setUseQuoteLowerCase(boolean),
isUseQuoteLowerCase(),
addProperty(String, String),
getProperty(String),
Constant Field Valuespublic static final java.lang.String PROPERTY_USE_PARENTHESES_FOR_JOIN
setUseParenthesiseForJoin(boolean),
isUseParenthesiseForJoin(),
addProperty(String, String),
getProperty(String),
Constant Field Valuespublic static final java.lang.String PROPERTY_IDENTIFIER_QUOTE_STRING
setIdentifierQuoteString(String),
getIdentifierQuoteString(),
addProperty(String, String),
getProperty(String),
Constant Field Valuespublic static final java.lang.String PROPERTY_ALIASTOKEN
setAliasToken(String),
getAliasToken(),
addProperty(String, String),
getProperty(String),
Constant Field Valuespublic static final java.lang.String PROPERTY_ESCAPE_EVERYTHING
setAliasToken(String),
getAliasToken(),
addProperty(String, String),
getProperty(String),
Constant Field Valuespublic static final java.lang.String PROPERTY_VALIDATION_QUERY
setValidationQuery(String),
getValidationQuery(),
Constant Field Valuespublic static final java.lang.String PROPERTY_INITSQL
getProperty(String),
addProperty(String, String),
Constant Field Values| Method Detail |
|---|
public int hashCode()
hashCode in class java.lang.Object
public void addProperty(java.lang.String key,
java.lang.String value)
key - the property.value - the property value.
java.lang.NullPointerException - If the property key was null.
java.lang.IllegalArgumentException - If the property key was empty.getProperties(),
getProperty(String),
addProperties(Properties)public void addProperties(java.util.Properties properties)
DataSourceConfiguration.addProperty(String, String).
properties - A Properties object containing all properties which
should be set for this DataSourceConfiguration.addProperty(String, String)public boolean isUseOrderBy()
true if the SQL statement can have an ORDER BY clause; otherwise false.setUseOrderBy(boolean)public void setUseOrderBy(boolean useOrderBy)
useOrderBy - Whether the sql statement can have an ORDER BY clause or not.isUseOrderBy()public boolean isUseParenthesiseForJoin()
true if the sql statement can have parentheses in FROM clause; otherwise false.setUseParenthesiseForJoin(boolean)public void setUseParenthesiseForJoin(boolean useParenthesiseForJoin)
useParenthesiseForJoin - Whether the sql statement can have parentheses in FROM clause or not.isUseParenthesiseForJoin()public boolean isUseQuoteLowerCase()
true if table names and column names have to be quoted; otherwise false.setUseQuoteLowerCase(boolean)public void setUseQuoteLowerCase(boolean useQuoteLowerCase)
useQuoteLowerCase - Whether table names and column names have to be quoted.isUseParenthesiseForJoin()public boolean isUseSQL92syntax()
true if the SQL statement can contain the join condition in
SQL92 syntax; otherwise false.setUseSQL92syntax(boolean)public void setUseSQL92syntax(boolean useSQL92syntax)
useSQL92syntax - Whether the SQL statement can contain the join condition in SQL92 syntax or not.isUseSQL92syntax()public boolean isUseWhereClause()
true if the SQL statement can contain the WHERE clause; otherwise false.setUseWhereClause(boolean)public void setUseWhereClause(boolean useWhereClause)
useWhereClause - Whether the SQL statement can contain the WHERE clause or not.isUseWhereClause()public java.lang.String getAliasToken()
String the SQL keywordsetAliasToken(String)public void setAliasToken(java.lang.String aliasToken)
aliasToken - the SQL keyword.getAliasToken()public boolean isUseEscapeEverything()
true if the complete table identifier will enclosed
with quotes; otherwise false.setUseEscapeEverything(boolean)public void setUseEscapeEverything(boolean escapeEverything)
"atable" in catalog "aCatalog".select ... from "aCatalog.aTable"
escapeEverything - True if the whole table identifier should
be quoted false(default) otherwise.isUseEscapeEverything()public java.lang.String getIdentifierQuoteString()
String used to quote SQL identifiers.setIdentifierQuoteString(String)public void setIdentifierQuoteString(java.lang.String identifierQuoteString)
identifierQuoteString - The string which should be used to quote SQL identifiers. Usually
this should be a single or double quote.getIdentifierQuoteString()public java.lang.String getDriverClassname()
java.sql.Driver that will be used to establish the Connection to database.
String the driver class namepublic java.lang.String getDatabaseClassname()
com.inet.report.Database class name or an empty String.
String Database class name or an empty String.public void setDriverClassname(java.lang.String classname)
java.sql.Driver implementation.
classname - The package qualified name of the JDBC Driver class.setDriverLibrary(String)public void setDatabaseClassname(java.lang.String classname)
com.inet.report.Database.
Instead of using a JDBC Connection to fetch data for the report,
a com.inet.report.Database can be used to set the data via java code directly.
classname - the full qualified classname of a com.inet.report.Database class.public java.lang.String getConfigurationName()
DataSourceConfiguration.
String - the name of this DataSourceConfiguration.DataSourceConfiguration(String),
DataSourceConfiguration(String, String)public java.lang.String toString()
DataSourceConfiguration.
toString in class java.lang.ObjectString - the name of this DataSourceConfiguration.getConfigurationName()public java.lang.String getUrl()
public void setUrl(java.lang.String url)
url - the JDBC url that will be used to create the Connection.public java.util.Properties getProperties()
Properties object.
public java.lang.String getProperty(java.lang.String key)
key - the value for set property.
String - The property value or an empty string.public java.lang.String getCatalog()
String - the database catalog or an empty String.public void setCatalog(java.lang.String catalog)
catalog - -
the database catalog used to create database Connection.public java.lang.String getUser()
String - the database user or an empty String.public void setUser(java.lang.String user)
user - - the database user used to create database Connection.public java.lang.String getPassword()
String - the password of the database user used to create database Connection or an empty string.public void setPassword(java.lang.String password)
password - the password of the database user used to create database Connection.public void setSavePassword(boolean savePassword)
savePassword - true for saving passwordisSavePassword()public boolean isSavePassword()
true if the password should be savedsetSavePassword(boolean)public boolean isNeedPassword()
public java.lang.String getDriverLibrary()
String - the path of the JDBC Driver jar file.public void setDriverLibrary(java.lang.String libraryPath)
libraryPath - path to the library files which are to be set on the class path prior
to using the set JDBC driver.setDriverClassname(String)
public void save(int preferenceScope)
throws java.lang.SecurityException
preferenceScope - - Possible values:
java.lang.SecurityException - if there is no write access to the given Java Preferences
@Deprecated
public java.lang.String checkConnection()
throws java.lang.Throwable
validate()
DataSourceConfiguration. Throw an
exception if the connection can't be established. The exception includes details of the problem.
java.lang.Throwable - If an error occurred during connection check, it is thrown to be handle by the caller
public void validate()
throws java.lang.ClassNotFoundException,
java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.sql.SQLException,
ReportException
DataSourceConfiguration. Throw an
exception if the connection can't be established. The exception include details of the problem.
java.lang.ClassNotFoundException - If the class could not be found in the current class path nor the lib directory of i-net Clear Reports.
java.lang.InstantiationException - if the driver class represents an abstract class, an interface, an array class, a primitive type, or
void; or if the class has no nullary constructor; or if the instantiation fails for some other
reason.
java.lang.IllegalAccessException - if the driver class or its nullary constructor is not accessible.
java.sql.SQLException - if a database access error occurs
ReportException - If the JDBC URL is not valid for the given driver.
java.lang.ClassCastException - If the database class name is not an instance of com.inet.report.Database
public static java.lang.String adaptUrl(java.lang.String url,
java.util.Properties driverProps)
url - The URL to adapt.driverProps - The driver properties to be inserted into the URL.
public void setValidationQuery(java.lang.String validationQuery)
Connection.isClosed()
will be called to check if the connection is still valid. In some
circumstances it is possible that this returns true although the
connection is invalid. (e.g. the network connection to the database is
still established but the database server does not accept any further
query). In this case the connection can be checked with a simple SQL
query. If this query can be executed without any error the connection
should be valid.
validationQuery - The SQL query which should be executed for validation
of the database connection.getValidationQuery()public java.lang.String getValidationQuery()
setValidationQuery(String)public int compareTo(java.lang.Object o)
o - DatasourceConfiguration to be compared with
getConfigurationName()public boolean isLayoutDataSource()
|
i-net Clear Reports | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||