| java.lang.Object org.griphyn.vdl.dbschema.DatabaseSchema
All known Subclasses: org.griphyn.vdl.dbschema.WorkflowSchema, org.griphyn.vdl.dbschema.InvocationSchema, org.griphyn.vdl.dbschema.NXDSchema, org.griphyn.vdl.dbschema.ChunkSchema, org.griphyn.vdl.dbschema.NXDInvSchema, org.griphyn.common.catalog.transformation.Database, org.griphyn.vdl.dbschema.InMemorySchema, org.griphyn.vdl.dbschema.AnnotationSchema,
DatabaseSchema | abstract public class DatabaseSchema implements Catalog(Code) | | This common schema interface defines the schemas in which the
abstraction layers access any given database. It is independent
of the implementing database, and does so by going via the
database driver class API.
The separation of database driver and schema lowers the implementation
cost, as only N driver and M schemas need to be implemented, instead
of N x M schema-specific database-specific drivers.
author: Jens-S. Vöckler author: Yong Zhao version: $Revision: 365 $ See Also: org.griphyn.vdl.dbdriver |
Constructor Summary | |
protected | DatabaseSchema() Minimalistic default ctor. | public | DatabaseSchema(String dbDriverName, String url, Properties dbDriverProperties, Properties dbSchemaProperties) Connects to the database, this method does not rely on global
property values, instead, each property has to be provided
explicitly.
Parameters: dbDriverName - is the name of the class that conforms tothe DatabaseDriver API. | public | DatabaseSchema(String dbDriverName, String propertyPrefix) Connects to the database as specified by the properties, and
checks the schema implementation. | public | DatabaseSchema(DatabaseDriver driver, String propertyPrefix) Associates a schema with a given database driver. |
Method Summary | |
public boolean | cachingMakesSense() pass-thru to driver.
true, if it is feasible to cache results from the driverfalse, if requerying the driver is sufficiently fast (e.g. | public void | close() Disassociate from the database driver before finishing. | protected void | finalize() Disassociate the database driver cleanly. | public static DatabaseSchema | loadSchema(String dbSchemaName, String propertyPrefix, Object[] arguments) Instantiates the appropriate leaf schema according to property values.
This method is a factory.
Parameters: dbSchemaName - is the name of the class that conforms tothe DatabaseSchema API. | public static DatabaseSchema | loadSchema(String propertyPrefix) Convenience method instantiates the appropriate child according to
property values. | protected void | longOrNull(PreparedStatement ps, int pos, long l) Adds a BIGINT or a SQL-NULL at the current prepared statement
position, depending if the value is -1 or not. | protected String | makeNotNull(String s) Converts any given string into a guaranteed non-null value.
Especially the definition triples use empty strings instead of
null values.
Parameters: s - is the string object to look at, which may be null. | protected void | stringOrNull(PreparedStatement ps, int pos, String s) Adds a string or a SQL-NULL at the current prepared statement
position, depending if the String value is null or not. |
m_dbdriver | protected DatabaseDriver m_dbdriver(Code) | | This is the variable that connect to the lower level database driver.
|
m_dbschemaprops | protected Properties m_dbschemaprops(Code) | | This stores properties specific to the schema. Currently unused.
|
DatabaseSchema | protected DatabaseSchema()(Code) | | Minimalistic default ctor. This constructor does nothing,
and loads nothing. But it initializes the empty schema props.
|
DatabaseSchema | public DatabaseSchema(String dbDriverName, String url, Properties dbDriverProperties, Properties dbSchemaProperties) throws ClassNotFoundException, IOException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException, SQLException(Code) | | Connects to the database, this method does not rely on global
property values, instead, each property has to be provided
explicitly.
Parameters: dbDriverName - is the name of the class that conforms tothe DatabaseDriver API. This class will be dynamically loaded. Parameters: url - is the database url Parameters: dbDriverProperties - holds properties specific to thedatabase driver. Parameters: dbSchemaProperties - holds properties specific to thedatabase schema. exception: ClassNotFoundException - if the driver for the databasecannot be loaded. You might want to check your CLASSPATH, too. exception: NoSuchMethodException - if the driver's constructor interfacedoes not comply with the database driver API. exception: InstantiationException - if the driver class is an abstractclass instead of a concrete implementation. exception: IllegalAccessException - if the constructor for the driverclass it not publicly accessible to this package. exception: InvocationTargetException - if the constructor of the driverthrows an exception while being dynamically loaded. exception: SQLException - if the driver for the database can beloaded, but faults when initially accessing the database |
DatabaseSchema | public DatabaseSchema(String dbDriverName, String propertyPrefix) throws ClassNotFoundException, IOException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException, SQLException(Code) | | Connects to the database as specified by the properties, and
checks the schema implementation. Makes heavy use of global
property values.
Parameters: dbDriverName - is the name of the class that conforms tothe DatabaseDriver API. This class will be dynamically loaded.If the passed value is null , which should be thedefault, the value of property vds.db.*.driver is taken. Parameters: propertyPrefix - is the property prefix string to use. exception: ClassNotFoundException - if the driver for the databasecannot be loaded. You might want to check your CLASSPATH, too. exception: NoSuchMethodException - if the driver's constructor interfacedoes not comply with the database driver API. exception: InstantiationException - if the driver class is an abstractclass instead of a concrete implementation. exception: IllegalAccessException - if the constructor for the driverclass it not publicly accessible to this package. exception: InvocationTargetException - if the constructor of the driverthrows an exception while being dynamically loaded. exception: SQLException - if the driver for the database can beloaded, but faults when initially accessing the database |
DatabaseSchema | public DatabaseSchema(DatabaseDriver driver, String propertyPrefix) throws SQLException, ClassNotFoundException, IOException(Code) | | Associates a schema with a given database driver.
Parameters: driver - is an instance conforming to the DatabaseDriver API. Parameters: propertyPrefix - is the property prefix string to use. exception: SQLException - if the driver for the database can beloaded, but faults when initially accessing the database |
cachingMakesSense | public boolean cachingMakesSense()(Code) | | pass-thru to driver.
true, if it is feasible to cache results from the driverfalse, if requerying the driver is sufficiently fast (e.g. driveris in main memory, or driver does caching itself). |
close | public void close() throws SQLException(Code) | | Disassociate from the database driver before finishing.
Mind that performing this action may throw NullPointerException
in later stages!
|
finalize | protected void finalize() throws Throwable(Code) | | Disassociate the database driver cleanly.
|
loadSchema | public static DatabaseSchema loadSchema(String dbSchemaName, String propertyPrefix, Object[] arguments) throws ClassNotFoundException, IOException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException(Code) | | Instantiates the appropriate leaf schema according to property values.
This method is a factory.
Parameters: dbSchemaName - is the name of the class that conforms tothe DatabaseSchema API. This class will be dynamically loaded.If the passed value is null , which should be thedefault, the value of property vds.db.schema is taken. Parameters: propertyPrefix - is the property prefix string to use. Parameters: arguments - are arguments to the constructor of the driverto load. Please use "new Object[0]" for the default constructor. exception: ClassNotFoundException - if the schema for the databasecannot be loaded. You might want to check your CLASSPATH, too. exception: NoSuchMethodException - if the schema's constructor interfacedoes not comply with the database driver API. exception: InstantiationException - if the schema class is an abstractclass instead of a concrete implementation. exception: IllegalAccessException - if the constructor for the schemaclass it not publicly accessible to this package. exception: InvocationTargetException - if the constructor of the schemathrows an exception while being dynamically loaded. See Also: org.griphyn.vdl.util.ChimeraProperties |
loadSchema | public static DatabaseSchema loadSchema(String propertyPrefix) throws ClassNotFoundException, IOException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException(Code) | | Convenience method instantiates the appropriate child according to
property values. Effectively, the following is being called:
loadSchema( null, propertyPrefix, new Object[0] );
Parameters: propertyPrefix - is the property prefix string to use. exception: ClassNotFoundException - if the schema for the databasecannot be loaded. You might want to check your CLASSPATH, too. exception: NoSuchMethodException - if the schema's constructor interfacedoes not comply with the database driver API. exception: InstantiationException - if the schema class is an abstractclass instead of a concrete implementation. exception: IllegalAccessException - if the constructor for the schemaclass it not publicly accessible to this package. exception: InvocationTargetException - if the constructor of the schemathrows an exception while being dynamically loaded. See Also: DatabaseSchema.loadSchema(String,String,Object[]) See Also: org.griphyn.vdl.util.ChimeraProperties |
longOrNull | protected void longOrNull(PreparedStatement ps, int pos, long l) throws SQLException(Code) | | Adds a BIGINT or a SQL-NULL at the current prepared statement
position, depending if the value is -1 or not. A value of -1
will lead to SQL-NULL.
Parameters: ps - is the prepared statement to extend Parameters: pos - is the position at which to insert the value Parameters: l - is the long to use, which may be null. |
makeNotNull | protected String makeNotNull(String s)(Code) | | Converts any given string into a guaranteed non-null value.
Especially the definition triples use empty strings instead of
null values.
Parameters: s - is the string object to look at, which may be null. a string that may be empty, but is not null. |
stringOrNull | protected void stringOrNull(PreparedStatement ps, int pos, String s) throws SQLException(Code) | | Adds a string or a SQL-NULL at the current prepared statement
position, depending if the String value is null or not.
Parameters: ps - is the prepared statement to extend Parameters: pos - is the position at which to insert the value Parameters: s - is the String to use, which may be null. |
|
|