ThinkUI SQL Client 1.1.3 API

thinkui.sqlclient
Class SQLClient

java.lang.Object
  extended bythinkui.db.AbstractDataObject
      extended bythinkui.component.AbstractComponent
          extended bythinkui.component.AbstractApplication
              extended bythinkui.desktop.AbstractSwingApplication
                  extended bythinkui.sqlclient.SQLClient
All Implemented Interfaces:
thinkui.component.Application, thinkui.common.CaptionSupport, thinkui.common.ClassNameSupport, java.lang.Cloneable, java.lang.Comparable, thinkui.component.Component, thinkui.db.DataClassSupport, DataObject, java.lang.Runnable, java.io.Serializable

public class SQLClient
extends thinkui.desktop.AbstractSwingApplication

Extends AbstractApplication to implement the SQLClient application.

See Also:
Serialized Form

Field Summary
static java.lang.String DESCRIPTION
           
static java.lang.String LABEL
           
static java.lang.String NAME
           
static java.lang.String VERSION
           
static java.lang.String WEBSITE_URL
           
 
Fields inherited from class thinkui.component.AbstractComponent
attrs, DATA_CLASS
 
Fields inherited from interface thinkui.component.Application
LICENSE_KEY_PROPERTY, LICENSE_OWNER_PROPERTY
 
Fields inherited from interface thinkui.component.Component
COMPONENT_DESCRIPTION, COMPONENT_LABEL, COMPONENT_NAME, COMPONENT_VERSION
 
Fields inherited from interface thinkui.db.DataObject
INDEX_SEPARATOR, NAME_SEPARATOR
 
Constructor Summary
SQLClient()
          SQLClient constructor.
 
Method Summary
 void addDataObjectManager(thinkui.db.jdbc.JDBCDataObjectManager dataObjectMgr)
          Helper method to add the given data object manager to the list of all data object managers.
 void cacheDataObjectFilters(thinkui.desktop.SwingCommandContext ctx, java.lang.Integer dbConnectionId)
          Lookup all the filters for a given database connection and cache them.
 void exit()
          Exit the application.
static thinkui.sqlclient.business.SQLClientBusinessObject getApplicationBusinessObject(thinkui.desktop.SwingCommandContext ctx)
          Return the application business object.
static thinkui.db.jdbc.JDBCDataObjectManager getApplicationDataObjectManager(thinkui.desktop.SwingCommandContext ctx)
          Return the SQL client application data object manager.
static thinkui.db.jdbc.JDBCMetaDataManager getApplicationMetaDataManager(thinkui.desktop.SwingCommandContext ctx)
          Return the SQL client application meta data manager.
 thinkui.desktop.SwingCommandContext getCommandContext()
           
static thinkui.sqlclient.SQLClientConnectionFactory getConnectionFactory(thinkui.desktop.SwingCommandContext ctx)
          Helper method to return the connection factory or null.
 thinkui.db.jdbc.JDBCConnectionManager getConnectionManager()
           
 thinkui.db.jdbc.JDBCDataObjectManager getDataObjectManager()
           
 thinkui.db.jdbc.JDBCDataObjectManager getDataObjectManagerByName(java.lang.String connectionName)
          Helper method to return the named connection or return null.
 java.io.File getInstalledDir()
           
static thinkui.db.jdbc.JDBCDataObjectManager getRequestDataObjectManager(thinkui.desktop.SwingCommandContext ctx, boolean connectAsRequired)
          Helper method to retrieve the data object manager from the configured connection factory.
static DbConnection getRequestDbConnection(thinkui.desktop.SwingCommandContext ctx)
          Helper method to retrieve the DB connection from the configured connection factory.
static thinkui.db.jdbc.JDBCMetaDataManager getRequestMetaDataManager(thinkui.desktop.SwingCommandContext ctx, boolean connectAsRequired)
          Helper method to retrieve the meta data manager from the configured connection factory.
 SQLClientPreferences getSQLClientPreferences()
          Convenience method to get the SQLClientPreferences.
 java.lang.String getWebsiteURL()
           
 java.util.List lookupDataClassList(java.lang.Object dbConnectionId)
          Helper method to lookup the list of data classes for the given DB connection Id.
 thinkui.sqlclient.DataObjectFilter lookupDataObjectFilter(java.lang.Integer dbConnectionId, java.lang.String filterClassName)
          Helper method to lookup the data object filter for given filter class class.
static thinkui.sqlclient.SQLClientConnectionFactory overrideDatabaseConnection(thinkui.desktop.SwingCommandContext ctx, thinkui.db.ConnectionData connectionData, boolean manageConnection)
          Helper method for use by the batch Ant GenerateTask.
static thinkui.sqlclient.SQLClientConnectionFactory overrideDatabaseConnection(thinkui.desktop.SwingCommandContext ctx, DbConnection dbConnection, boolean manageConnection)
          Create the SQLClientConnectionFactory for the given database connection and configure it in the swing command context request value.
static thinkui.sqlclient.SQLClientConnectionFactory overrideDatabaseConnection(thinkui.desktop.SwingCommandContext ctx, java.lang.String dbConnectionName)
          Looks up the database connection information by the given dbConnectionName and invokes overrideDatabaseConnection() method to create the SQLClientConnectionFactory for the given database connection and configure it in the swing command context request value.
 void removeDataClassList(java.lang.Object dbConnectionId)
          Helper method to remove the list of data classes (if any) currently cached for the given DB connection Id.
 void removeDataObjectManager(thinkui.db.jdbc.JDBCDataObjectManager dataObjectMgr)
          Helper method to remove the given data object manager to the list of all data object managers.
 void run()
          Run the application.
static void setConnectionFactory(thinkui.desktop.SwingCommandContext ctx, thinkui.sqlclient.SQLClientConnectionFactory connectionFactory)
          Helper method to set the connection factory in the given command context.
 void setConnectionManager(thinkui.db.jdbc.JDBCConnectionManager connectionMgr)
           
 void setupAttributeMetaDataManager(thinkui.desktop.SwingCommandContext ctx, DbConnection dbConnection)
          Helper method to setup the attribute meta data manager for the given database connection on the command context.
 
Methods inherited from class thinkui.desktop.AbstractSwingApplication
getPreferences, setPreferences
 
Methods inherited from class thinkui.component.AbstractApplication
addComponent, configureLogger, getArgs, getComponent, getComponents, getSecurityManager, getUserAuthenticator, initComponent, removeComponent, setArgs, setSecurityManager, setUserAuthenticator
 
Methods inherited from class thinkui.component.AbstractComponent
destroyComponent, getCache, getCommand, getCommands, getConfig, getDataClass, getDefaultCommand, getDescription, getLabel, getLogger, getName, getParentComponent, getVersion, isInitialized, setCache, setConfig, setDescription, setInitialized, setLabel, setLogger, setName, setVersion
 
Methods inherited from class thinkui.db.AbstractDataObject
clearValue, clearValues, compareTo, copy, copyFrom, copyFrom, copyFrom, copyNonEmptyValuesFrom, equals, getAsString, getAttribute, getBigDecimal, getBigInteger, getBoolean, getCaption, getCharacter, getDate, getInteger, getLong, getModifiedAttrNames, getNumber, getObjectClassName, getPersistentState, getPrimaryKey, getShort, getString, getTimestamp, getValue, getValuesMap, hashCode, initFrom, initFrom, initFrom, initValue, isAttribute, isModified, isModified, isNew, isOverridden, isReadOnly, isReadOnly, isValueEmpty, isValueSet, override, setModifiedAttrNames, setPersistentState, setReadOnly, setValue, setValuesMap, toString, validate
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface thinkui.component.Component
destroyComponent, getCache, getCommands, getConfig, getDefaultCommand, getDescription, getLabel, getLogger, getVersion, isInitialized, setCache, setDescription, setInitialized, setLabel, setVersion
 
Methods inherited from interface thinkui.db.DataObject
clearValue, clearValues, copy, copyFrom, copyFrom, copyFrom, equals, getAsString, getAttribute, getBigDecimal, getBigInteger, getBoolean, getCharacter, getDate, getInteger, getLong, getModifiedAttrNames, getName, getPersistentState, getPrimaryKey, getShort, getString, getTimestamp, getValue, getValuesMap, hashCode, initFrom, initFrom, initFrom, initValue, isAttribute, isModified, isModified, isNew, isOverridden, isReadOnly, isReadOnly, isValueEmpty, isValueSet, override, setModifiedAttrNames, setName, setPersistentState, setReadOnly, setValue, setValuesMap, toString, validate
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface thinkui.common.CaptionSupport
getCaption
 
Methods inherited from interface thinkui.db.DataClassSupport
getDataClass
 
Methods inherited from interface thinkui.common.ClassNameSupport
getObjectClassName
 

Field Detail

DESCRIPTION

public static final java.lang.String DESCRIPTION
See Also:
Constant Field Values

LABEL

public static final java.lang.String LABEL
See Also:
Constant Field Values

NAME

public static final java.lang.String NAME
See Also:
Constant Field Values

VERSION

public static final java.lang.String VERSION
See Also:
Constant Field Values

WEBSITE_URL

public static final java.lang.String WEBSITE_URL
See Also:
Constant Field Values
Constructor Detail

SQLClient

public SQLClient()
SQLClient constructor.

Method Detail

addDataObjectManager

public final void addDataObjectManager(thinkui.db.jdbc.JDBCDataObjectManager dataObjectMgr)
Helper method to add the given data object manager to the list of all data object managers.


cacheDataObjectFilters

public final void cacheDataObjectFilters(thinkui.desktop.SwingCommandContext ctx,
                                         java.lang.Integer dbConnectionId)
                                  throws java.lang.Exception
Lookup all the filters for a given database connection and cache them. The previously cached filters (if any) will be removed and the filter information will be queried again. If dbConnectionId is null, then -1 will be used (internally) as the filter map key.

Throws:
java.lang.Exception

exit

public final void exit()
Exit the application.


getApplicationBusinessObject

public static final thinkui.sqlclient.business.SQLClientBusinessObject getApplicationBusinessObject(thinkui.desktop.SwingCommandContext ctx)
                                                                                             throws java.lang.Exception
Return the application business object.

Returns:
the application business object in the given swing command context.
Throws:
java.lang.Exception

getApplicationDataObjectManager

public static final thinkui.db.jdbc.JDBCDataObjectManager getApplicationDataObjectManager(thinkui.desktop.SwingCommandContext ctx)
                                                                                   throws java.lang.Exception
Return the SQL client application data object manager.

Returns:
the application data object manager in the given swing command context.
Throws:
java.lang.Exception

getApplicationMetaDataManager

public static final thinkui.db.jdbc.JDBCMetaDataManager getApplicationMetaDataManager(thinkui.desktop.SwingCommandContext ctx)
                                                                               throws java.lang.Exception
Return the SQL client application meta data manager.

Returns:
the application meta data manager in the given swing command context.
Throws:
java.lang.Exception

getCommandContext

public final thinkui.desktop.SwingCommandContext getCommandContext()

getConnectionFactory

public static final thinkui.sqlclient.SQLClientConnectionFactory getConnectionFactory(thinkui.desktop.SwingCommandContext ctx)
Helper method to return the connection factory or null.


getConnectionManager

public final thinkui.db.jdbc.JDBCConnectionManager getConnectionManager()

getDataObjectManager

public final thinkui.db.jdbc.JDBCDataObjectManager getDataObjectManager()
                                                                 throws java.lang.Exception
Throws:
java.lang.Exception

getDataObjectManagerByName

public final thinkui.db.jdbc.JDBCDataObjectManager getDataObjectManagerByName(java.lang.String connectionName)
Helper method to return the named connection or return null.


getInstalledDir

public final java.io.File getInstalledDir()

getRequestDataObjectManager

public static final thinkui.db.jdbc.JDBCDataObjectManager getRequestDataObjectManager(thinkui.desktop.SwingCommandContext ctx,
                                                                                      boolean connectAsRequired)
Helper method to retrieve the data object manager from the configured connection factory. It is assumed that overrideDatabaseConnection() has been called previously to configure the connection factory in the context. Otherwise, if no connection factory is found, null is returned.

Parameters:
ctx - the command context to lookup the connection factory.
connectAsRequired - whether or not to auto connect if the connection is closed.
Returns:
the data object manager configured in the given swing command context or null.

getRequestDbConnection

public static final DbConnection getRequestDbConnection(thinkui.desktop.SwingCommandContext ctx)
Helper method to retrieve the DB connection from the configured connection factory. It is assumed that overrideDatabaseConnection() has been called previously to configure the connection factory in the context. Otherwise, if no connection factory is found, null is returned.

Returns:
the DB connection configured in the given swing command context or null.

getRequestMetaDataManager

public static final thinkui.db.jdbc.JDBCMetaDataManager getRequestMetaDataManager(thinkui.desktop.SwingCommandContext ctx,
                                                                                  boolean connectAsRequired)
Helper method to retrieve the meta data manager from the configured connection factory. It is assumed that overrideDatabaseConnection() has been called previously to configure the connection factory in the context. Otherwise, if no connection factory is found, null is returned.

Parameters:
ctx - the command context to lookup the connection factory.
connectAsRequired - whether or not to auto connect if the connection is closed.
Returns:
the meta data manager configured in the given swing command context or null.

getSQLClientPreferences

public final SQLClientPreferences getSQLClientPreferences()
Convenience method to get the SQLClientPreferences.


getWebsiteURL

public final java.lang.String getWebsiteURL()

lookupDataClassList

public final java.util.List lookupDataClassList(java.lang.Object dbConnectionId)
Helper method to lookup the list of data classes for the given DB connection Id. If no such list exists, then null will be returned.


lookupDataObjectFilter

public final thinkui.sqlclient.DataObjectFilter lookupDataObjectFilter(java.lang.Integer dbConnectionId,
                                                                       java.lang.String filterClassName)
Helper method to lookup the data object filter for given filter class class. If no such filter exists, then null will be returned.


overrideDatabaseConnection

public static final thinkui.sqlclient.SQLClientConnectionFactory overrideDatabaseConnection(thinkui.desktop.SwingCommandContext ctx,
                                                                                            thinkui.db.ConnectionData connectionData,
                                                                                            boolean manageConnection)
                                                                                     throws java.lang.Exception
Helper method for use by the batch Ant GenerateTask.

Throws:
java.lang.Exception

overrideDatabaseConnection

public static final thinkui.sqlclient.SQLClientConnectionFactory overrideDatabaseConnection(thinkui.desktop.SwingCommandContext ctx,
                                                                                            DbConnection dbConnection,
                                                                                            boolean manageConnection)
                                                                                     throws java.lang.Exception
Create the SQLClientConnectionFactory for the given database connection and configure it in the swing command context request value.

Parameters:
ctx - the command context to set the database connection in.
dbConnection - the database connection data.
manageConnection - whether or not to manage the database connection.
Returns:
the connection factory for the given database connection.
Throws:
java.lang.Exception

overrideDatabaseConnection

public static final thinkui.sqlclient.SQLClientConnectionFactory overrideDatabaseConnection(thinkui.desktop.SwingCommandContext ctx,
                                                                                            java.lang.String dbConnectionName)
                                                                                     throws java.lang.Exception
Looks up the database connection information by the given dbConnectionName and invokes overrideDatabaseConnection() method to create the SQLClientConnectionFactory for the given database connection and configure it in the swing command context request value.

Parameters:
ctx - the command context to set the database connection in.
dbConnectionName - the database connection name.
Returns:
the connection factory for the given database connection.
Throws:
java.lang.Exception

removeDataClassList

public final void removeDataClassList(java.lang.Object dbConnectionId)
Helper method to remove the list of data classes (if any) currently cached for the given DB connection Id.


removeDataObjectManager

public final void removeDataObjectManager(thinkui.db.jdbc.JDBCDataObjectManager dataObjectMgr)
Helper method to remove the given data object manager to the list of all data object managers.


run

public final void run()
Run the application.


setConnectionFactory

public static final void setConnectionFactory(thinkui.desktop.SwingCommandContext ctx,
                                              thinkui.sqlclient.SQLClientConnectionFactory connectionFactory)
Helper method to set the connection factory in the given command context.


setConnectionManager

public final void setConnectionManager(thinkui.db.jdbc.JDBCConnectionManager connectionMgr)

setupAttributeMetaDataManager

public final void setupAttributeMetaDataManager(thinkui.desktop.SwingCommandContext ctx,
                                                DbConnection dbConnection)
                                         throws java.lang.Exception
Helper method to setup the attribute meta data manager for the given database connection on the command context. If the load meta data preferences is set, the latest model meta data will be automatically loaded for the given DB connection.

Throws:
java.lang.Exception

ThinkUI SQL Client 1.1.3 API

Copyright © 2007-2009. ThinkUI Software Inc. All rights reserved.