|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectplanetj.database.DataEngine
The DataEngine provides a framework which can abstractly read, update, and display data from a database. A typical application will access its data with the
DataEngine, perform some business logic, and then use the DataEngine to display data in a GUI. You can use one of the getRows()
methods to obtain a RowCollection containing data from the database.
Field Summary | |
static java.lang.String |
DEFAULT_LOGGING_PATH
Default path of the logging configuration file. |
static java.lang.String |
LIBRARY_PLACEHOLDER_SYSTEM
Hardcoded library which represents the WOW system library |
static java.lang.String |
LIBRARY_PLACEHOLDER_USER
Hardcoded library which represents the WOW user library |
Fields inherited from interface planetj.dataengine.IServletParameters |
ALL, AUTO_RUN, BASE_URL, CACHE_TRACK_ON, CACHE_TRACK_WRITE_TO_FILE, CLEAN_UP_TIME, DATA_ACCESS_TRACKING, DATABASE, DRIVER, ENVIRONMENT_MODE, JDBC_OPTIMIZATIONS, LIBRARY_LIST, MAX_CONNECTIONS, METADATA_LIBRARY, METADATA_USER_LIBRARY, MIN_CONNECTIONS, ORPHAN_TIMEOUT, PASSWORD, PORT, REPLACEMENT_LIBRARIES, SYSTEM_ALIAS, SYSTEM_ALIAS_PARAM, SYSTEM_URL, USER_ID, USER_PASSWORD |
Fields inherited from interface planetj.dataengine.application.IApplicationJSPs |
APPLICATION_ADD_JSP, APPLICATION_DETAILS_JSP, APPLICATION_EDIT_JSP, APPLICATION_ERROR_JSP, APPLICATION_HEADER_JSP, APPLICATION_INVALID_LICENSE_JSP, APPLICATION_JSP, APPLICATION_MESSAGE_JSP, APPLICATION_OPERATIONS_TOC, APPLICATION_RESULTS_JSP, APPLICATION_SIGN_ON_JSP, APPLICATION_TEMPLATE_JSP, APPLICATION_TOC_JSP, APPLICATION_VIEW_JSP |
Fields inherited from interface planetj.dataengine.application.IWOWJSPs |
WOW_MAIN_EXCEPTION_JSP, WOW_MANAGE_OPERATIONS_JSP, WOW_STEPS_JSP, WOW_TOC, WOW_VIEW_APPLICATIONS_JSP, WOW_VIEW_CONNECTIONS_JSP |
Constructor Summary | |
DataEngine()
|
Method Summary | |
static void |
autoStartConnection(SQLContext context)
This will ensure that a WOW connection is started. |
static void |
configureLogging(java.lang.String pPath)
This will configure the logging for Log4J This method must be called before Log4J will begin logging. |
static void |
configureLogging(java.lang.String pPath,
java.lang.String pSystemName,
java.lang.String pUserId,
java.lang.String pPassword)
Use this method if you are running this java code on a Server that you must signon to. |
static int |
copyRowCollectionToTable(java.sql.Connection connection,
Table copyToTable,
RowCollection rc)
This method copies a row collection to the specified table. |
static int |
copyRowCollectionToTable(Table pCopyToTable,
RowCollection pRC)
This method copies a row collection to the specified table. |
static boolean |
createTable(java.sql.Connection pConnection,
Table pTable,
java.lang.String pCreateTableSQL)
Creates a database table using the specified information. |
static boolean |
createTable(Table pTable)
Creates a database table from the specified Table. |
static boolean |
createTable(Table pTable,
java.lang.String pCreateTableSQL)
Creates a database table using the specified information. |
static boolean |
doesTableExist(java.sql.Connection pConnection,
Table pTable)
Returns whether or not a table exists in a database using the specified information. |
static boolean |
doesTableExist(java.sql.Connection pConnection,
Table pTable,
boolean pUseCaching)
Returns whether or not a table exists in a database using the specified information. |
static boolean |
doesTableExist(Table pTable)
Returns whether or not a table exists in a database using the specified information. |
static boolean |
doesTableExist(Table pTable,
boolean pUseCaching)
Returns whether or not a table exists in a database using the specified information. |
static void |
dropTable(java.sql.Connection pConnection,
Table pTable)
Deletes a the given Table from the database. |
static void |
dropTable(Table pTable)
Deletes a the given Table from the database. |
static void |
execute(SQLContext context)
Executes an SQL statement, based on a SQLContext . |
protected static boolean |
executeInternal(SQLContext context)
Executes an SQL statement, based on a SQLContext . |
static java.sql.ResultSet |
executeMetadataQuery(SQLContext context)
Returns a Result set from metadata. |
static java.sql.ResultSet |
executeQuery(SQLContext context)
Returns a Result set from executing a query based on the information in the SQLContext. |
static int |
executeUpdate(java.sql.Connection conn,
java.lang.String sqlString)
Returns the number of rows changed from executing the update (of the given sql string) on a Statement from the given Connection. |
static int |
executeUpdate(SQLContext context)
Updates the database, based on a SQLContext. |
static int |
executeUpdate(java.lang.String pSystemAlias,
java.lang.String pSQLString)
Returns the number of rows changed from executing the update (of the given sql string) on a Statement from the connection created from the given system alias. |
protected static int |
executeUpdateInternal(SQLContext context)
Updates the database, based on a SQLContext. |
static java.lang.String |
fixSQLMetadataLibrary(java.lang.String sql)
Deprecated. The SQLContext is now required |
static java.lang.String |
fixSQLMetadataLibrary(java.lang.String sql,
SQLContext context)
Temporary fix so hardcoded queries to the PLANETJ library goto the actual metadata library |
static java.util.Map |
getAllLibraries(DBSystem pSystem)
Returns a Map of all the Libraries for the specified system alias. |
static java.util.Map |
getAllLibraries(java.lang.String pSystemAlias)
Deprecated. |
static java.util.Map |
getAllTables(Library pLibrary)
Returns a Map of all the Tables for the Library. |
static ConnectionRow |
getDataEngineDefaultConnectionInfo()
Get a Row containing information for connecting to the DEFAULT connection which can be used to restart the default connection pool. |
static java.lang.String |
getDataEngineKey()
Returns a key that uniquely identifies this DataEngine. |
static java.lang.String |
getDataEngineLibraryName()
Gets the library containing DataEngine files |
static java.lang.String |
getDataEngineUserLibraryName()
Gets the user library containing DataEngine files |
static java.lang.String |
getDefaultMetaDataAlias()
Gets the default alias of system containing Meta Data (FD's, PV's ect) for DBSystems. |
static java.lang.String |
getEnvironmentMode()
|
static ILicense |
getLicense()
Get the license DataEngine is running with. |
static ILicense |
getLicense(boolean checkDefault)
Get the license DataEngine is running with. |
static int |
getMajorVersion()
|
static int |
getMaxPreparedStatements()
Gets the maximum number of prepared statements a single connection can support. |
static int |
getMinorVersion()
|
static java.lang.String |
getModificationLevel()
|
static int |
getOperationCount()
|
static java.lang.String |
getReleaseLevel()
|
static java.util.Map |
getReplacementLibraries()
|
static java.lang.String |
getReplacementLibrary(java.lang.String libName)
Check to see if there is a replacement library for the given library. |
static Row |
getRow(SQLContext context)
Retrieves the first row from the database based on the criteria in the SQLContext. |
static RowCollection |
getRows(java.sql.Connection conn,
java.lang.String sqlString)
Return a RowCollection using the given Connection and sql String. |
static RowCollection |
getRows(java.sql.Connection conn,
java.lang.String sqlString,
java.lang.Class rowSubClass)
Return a RowCollection using the default system Connection. |
static RowCollection |
getRows(SQLContext context)
Retrieves rows from the database based on the criteria in the SQLContext. |
static RowCollection |
getRows(java.lang.String systemURL,
java.lang.String sqlString)
Return a RowCollection using the default system Connection. |
static RowCollection |
getRows(java.lang.String systemURL,
java.lang.String sqlString,
java.lang.Class rowSubClass)
Return a RowCollection using a connection from the specified system url. |
protected static RowCollection |
getRowsInternal(SQLContext context)
Retrieves rows from the database based on the criteria in the SQLContext. |
static int |
getServicePackLevel()
|
static TaskScheduler |
getTaskScheduler()
Returns the TaskScheduler (for the DataEngine) used for scheduling tasks and creating timers. |
static java.util.Map |
getUserLibraryOperationCountMap()
|
static boolean |
isDataEngineUsingMultiLibraries()
Return true if multi libraries are being used such as PJSYS60 and PJUSR60. |
static boolean |
isDevelopmentMode()
|
static boolean |
isLicenseValid()
Check to see if the current license is valid. |
static boolean |
isMonitoringUsage()
Insert the method's description here. |
static boolean |
isTrackDataAccess(Table t)
|
static boolean |
isTrackOperationCount()
|
static void |
recountOperationsForUserLibrary(java.lang.String userLibrary,
java.lang.String system)
|
static java.math.BigDecimal |
selectColumnSum(Table pTable,
java.lang.String pColumnName,
java.lang.String pWhereClause)
This will return a BigDecimal with a value of the total sum of the column specified in pColumnName Creation date: (4/2/2002 1:12:36 PM) |
static java.lang.Integer |
selectRowCount(Table pTable,
java.lang.String pWhereClause)
This will return an Integer with a value of the total number of rows in pTable Creation date: (4/2/2002 1:12:36 PM) |
static void |
setDataEngineDefaultConnectionInfo(ConnectionRow connInfoRow)
Set a Row containing information for connecting to the DEFAULT connection which can later be used to restart the default connection pool. |
static void |
setDataEngineLibraryName(java.lang.String libName)
Sets the library containing DataEngine files |
static void |
setDataEngineUserLibraryName(java.lang.String libName)
Sets the user library containing DataEngine files |
static void |
setDefaultMetaDataAlias(java.lang.String pDefaultMetaDataAlias)
Sets the default alias of system containing Meta Data (FD's, PV's ect) for DBSystems. |
static void |
setEnvironmentMode(java.lang.String mode)
|
static void |
setLicense(ILicense license)
Set the license DataEngine should use when running |
static void |
setMaxPreparedStatements(int newMaxPreparedStatements)
Sets the maximum number of prepared statements a single connection can support. |
static void |
setMonitoringUsage(boolean newMonitoringUsage)
Insert the method's description here. |
static void |
setReplacementLibraries(java.util.Map replacements)
|
static void |
setTrackDataAccessOff()
|
static void |
setTrackDataAccessOn()
|
static void |
setTrackOperationCount(boolean turnOn)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String LIBRARY_PLACEHOLDER_SYSTEM
public static final java.lang.String LIBRARY_PLACEHOLDER_USER
public static final java.lang.String DEFAULT_LOGGING_PATH
Constructor Detail |
public DataEngine()
Method Detail |
public static void autoStartConnection(SQLContext context)
public static void configureLogging(java.lang.String pPath)
public static void configureLogging(java.lang.String pPath, java.lang.String pSystemName, java.lang.String pUserId, java.lang.String pPassword)
public static int copyRowCollectionToTable(java.sql.Connection connection, Table copyToTable, RowCollection rc) throws CMException
CMException
public static int copyRowCollectionToTable(Table pCopyToTable, RowCollection pRC) throws CMException
pCopyToTable
- TablepRC
- RowCollection
CMException
public static boolean createTable(java.sql.Connection pConnection, Table pTable, java.lang.String pCreateTableSQL) throws CMException
pConnection
- connection to create the table using
CMException
public static boolean createTable(Table pTable) throws CMException
pTable
- Table to create database table from.
CMException
public static boolean createTable(Table pTable, java.lang.String pCreateTableSQL) throws CMException
pTable
- Table
CMException
public static boolean doesTableExist(java.sql.Connection pConnection, Table pTable) throws CMException
********************** **NOTE** This method is expensive to call. Please ensure it is never called in a loop or when not necessary, JProbe results found these poor results about this method: Cumulative Time: 13 seconds **********************
pTable
- Table
CMException
public static boolean doesTableExist(java.sql.Connection pConnection, Table pTable, boolean pUseCaching) throws CMException
********************** **NOTE** This method is expensive to call. Please ensure it is never called in a loop or when not necessary, JProbe results found these poor results about this method: Cumulative Time: 13 seconds **********************
pConnection
- ConnectionpTable
- TablepUseCaching
- boolean
CMException
public static boolean doesTableExist(Table pTable) throws CMException
pTable
- Table
CMException
public static boolean doesTableExist(Table pTable, boolean pUseCaching) throws CMException
pTable
- TablepUseCaching
- boolean
CMException
public static void dropTable(java.sql.Connection pConnection, Table pTable) throws CMException
pConnection
- connection to the databasepTable
- Table to delete from database
CMException
public static void dropTable(Table pTable) throws CMException
pTable
- Table to delete from database
CMException
public static void execute(SQLContext context) throws CMException
SQLContext
. The SQL statement cannot return any information.
CMException
protected static boolean executeInternal(SQLContext context) throws CMException
SQLContext
. The SQL statement cannot return any data.
CMException
public static java.sql.ResultSet executeMetadataQuery(SQLContext context) throws CMException
CMException
public static java.sql.ResultSet executeQuery(SQLContext context) throws DataEngineException
getRows()
method instead. If this method is invoked directly, many of the DataEngine options (such as the
cache system and notifying the SQLListeners) are ignored.
DataEngineException
public static int executeUpdate(java.lang.String pSystemAlias, java.lang.String pSQLString) throws CMException
pSystemAlias
- StringpSQLString
- String
CMException
public static int executeUpdate(java.sql.Connection conn, java.lang.String sqlString) throws CMException
sqlString
- Stringconn
- Connection
CMException
public static int executeUpdate(SQLContext context) throws CMException
CMException
protected static int executeUpdateInternal(SQLContext context) throws CMException
CMException
public static final java.lang.String fixSQLMetadataLibrary(java.lang.String sql)
public static final java.lang.String fixSQLMetadataLibrary(java.lang.String sql, SQLContext context)
public static final java.lang.String getReplacementLibrary(java.lang.String libName)
public static java.util.Map getAllLibraries(java.lang.String pSystemAlias) throws DataEngineException
getAllLibraries()
method of DBSystem will only goto the database the first time, and will return all the cached
libraries from subsequent invocations.
pSystemAlias
- The alias of the DBSystem whose libraries will be retrieved
DataEngineException
public static java.util.Map getAllLibraries(DBSystem pSystem) throws DataEngineException
getAllLibraries()
method of DBSystem will only goto the database the first time, and will return all the cached
libraries from subsequent invocations.
DataEngineException
public static java.util.Map getAllTables(Library pLibrary) throws DataEngineException
pLibrary
- Library
DataEngineException
public static final java.lang.String getDataEngineKey()
public static final ConnectionRow getDataEngineDefaultConnectionInfo()
public static final java.lang.String getDataEngineLibraryName()
public static final java.lang.String getDataEngineUserLibraryName()
public static java.lang.String getDefaultMetaDataAlias()
public static ILicense getLicense() throws CMException
CMException
public static ILicense getLicense(boolean checkDefault) throws CMException
CMException
public static void setLicense(ILicense license)
license
- new license to run withpublic static int getMaxPreparedStatements()
public static int getMajorVersion()
public static int getMinorVersion()
public static int getServicePackLevel()
public static java.lang.String getModificationLevel()
public static java.lang.String getReleaseLevel()
public static java.util.Map getReplacementLibraries()
public static boolean isTrackOperationCount()
public static java.util.Map getUserLibraryOperationCountMap()
public static int getOperationCount()
public static void recountOperationsForUserLibrary(java.lang.String userLibrary, java.lang.String system)
public static Row getRow(SQLContext context) throws CMException
context
- A SQLContext containing information necessary to retrieve rows from a database.
CMException
public static RowCollection getRows(java.lang.String systemURL, java.lang.String sqlString) throws CMException
sqlString
- String
CMException
public static RowCollection getRows(java.lang.String systemURL, java.lang.String sqlString, java.lang.Class rowSubClass) throws CMException
systemURL
- StringsqlString
- StringrowSubClass
- Class
CMException
public static RowCollection getRows(java.sql.Connection conn, java.lang.String sqlString) throws CMException
conn
- ConnectionsqlString
- String
CMException
public static RowCollection getRows(java.sql.Connection conn, java.lang.String sqlString, java.lang.Class rowSubClass) throws CMException
conn
- ConnectionsqlString
- StringrowSubClass
- Class
CMException
public static RowCollection getRows(SQLContext context) throws CMException
background
, then this method will return null immediately. Otherwise, it won't return until a result is
obtained.
context
- A SQLContext containing information necessary to retrieve rows from a database.
CMException
protected static RowCollection getRowsInternal(SQLContext context) throws CMException
context
- A SQLContext containing information necessary to retrieve rows from a database.
CMException
public static TaskScheduler getTaskScheduler()
public static final boolean isDataEngineUsingMultiLibraries()
public static boolean isLicenseValid()
public static boolean isMonitoringUsage()
public static boolean isTrackDataAccess(Table t)
public static java.math.BigDecimal selectColumnSum(Table pTable, java.lang.String pColumnName, java.lang.String pWhereClause)
public static java.lang.Integer selectRowCount(Table pTable, java.lang.String pWhereClause)
public static final void setDataEngineDefaultConnectionInfo(ConnectionRow connInfoRow)
public static final void setDataEngineLibraryName(java.lang.String libName)
public static final void setDataEngineUserLibraryName(java.lang.String libName)
public static void setDefaultMetaDataAlias(java.lang.String pDefaultMetaDataAlias)
pDefaultMetaDataAlias
- Stringpublic static void setMaxPreparedStatements(int newMaxPreparedStatements)
public static void setMonitoringUsage(boolean newMonitoringUsage)
newMonitoringUsage
- booleanpublic static void setReplacementLibraries(java.util.Map replacements)
public static void setTrackDataAccessOff()
public static void setTrackDataAccessOn()
public static void setTrackOperationCount(boolean turnOn)
public static boolean isDevelopmentMode()
public static java.lang.String getEnvironmentMode()
public static void setEnvironmentMode(java.lang.String mode)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |