Ontimize 5.2072EN

com.ontimize.gui.i18n
Class DatabaseBundleManager

java.lang.Object
  extended byjava.rmi.server.RemoteObject
      extended byjava.rmi.server.RemoteServer
          extended byjava.rmi.server.UnicastRemoteObject
              extended bycom.ontimize.util.remote.AbstractRemoteReference
                  extended bycom.ontimize.gui.i18n.DatabaseBundleManager
All Implemented Interfaces:
IDatabaseBundleManager, java.rmi.Remote, java.io.Serializable

public class DatabaseBundleManager
extends AbstractRemoteReference
implements IDatabaseBundleManager

See Also:
Serialized Form

Field Summary
static java.lang.String AUTOCONFIGURE_LOCALE_COLUMNS
           
protected  boolean autoconfigureLocaleColumns
           
static java.lang.String BUNDLE_CLASS_NAME_COLUMN
           
static java.lang.String BUNDLE_DESCRIPTION_COLUMN
           
static java.lang.String BUNDLE_ENTITY_NAME
           
static java.lang.String BUNDLE_KEY_COLUMN
           
static java.lang.String BUNDLE_TABLE_NAME
           
static java.lang.String BUNDLE_VALUES_ENTITY_NAME
           
static java.lang.String BUNDLE_VALUES_KEY_COLUMN
           
static java.lang.String BUNDLE_VALUES_TABLE_NAME
           
static java.lang.String BUNDLE_VALUES_TEXT_KEY_COLUMN
           
static java.lang.String bundleClassNameColumn
           
static java.lang.String bundleDescriptionColumn
           
static java.lang.String bundleEntityName
           
static java.lang.String bundleKeyColumn
           
static java.lang.String bundleTableName
           
static java.lang.String bundleValuesEntityName
           
static java.lang.String bundleValuesKeyColumn
           
static java.lang.String bundleValuesTableName
           
static java.lang.String bundleValuesTextKeyColumn
           
static java.lang.String DATABASE_CONNECTION_MANAGER_ID
           
protected  java.util.Hashtable localeColumnNames
           
static java.lang.String TO_LOWER_CASE
           
static java.lang.Boolean toLowerCase
          Boolean to know the names of the columns in the table
Default value is null, to use directly the names in the configuration file or the default ones.
 
Fields inherited from class com.ontimize.util.remote.AbstractRemoteReference
dbConnectionManagerId, locator
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
DatabaseBundleManager(int port, EntityReferenceLocator locator, java.util.Hashtable params)
           
 
Method Summary
protected  void autoconfigureLocaleColumns()
           
 EntityResult executePreparedStatement(SQLStatementBuilder.SQLStatement sqlStatement, java.sql.Connection con, int sessionId, java.util.List queryColumns)
           
protected  EntityResult executeQueryStatement(SQLStatementBuilder.SQLStatement sqlStatement, int sessionId, java.util.List queryColumns, java.sql.Connection con)
           
protected  void executeUpdateStatement(SQLStatementBuilder.SQLStatement sqlStatement, int sessionId, java.sql.Connection con)
           
 java.util.Hashtable getAllResourceBundles(java.util.Locale locale, int sessionId)
          Get a hashtable with all the available bundles in the database for the specified locale
 DatabaseBundleDescriptor[] getAvailableBundles(int sessionId)
          Get a list with all the available bundle classes
 DatabaseBundleDescriptor[] getAvailableBundles(int sessionId, java.sql.Connection con)
          Get all the available bundles in the database.
 java.lang.String[] getAvailableLocales(int sessionId)
          Get a list with the suffix of the available locales in the database
protected  java.util.ResourceBundle getBundle(DatabaseBundleDescriptor bundleDescriptor, java.util.Locale locale, int sessionId)
           
 java.util.ResourceBundle getBundle(java.lang.String baseName, java.util.Locale locale, int sessionId)
          Get the resource bundle for the specified name and locale
protected  DatabaseBundleDescriptor getBundleDescriptor(java.lang.String bundleClassName, int sessionId)
           
protected  java.lang.Object getBundleId(java.lang.String bundleClassName, java.util.List availablebundles, int sessionId, java.sql.Connection con)
           
 java.util.Hashtable getBundles(java.util.List baseNames, java.util.Locale locale, int sessionId)
          Get all the resources for the specified locale and different names
protected  java.lang.Object getBundleValueKey(java.util.Hashtable filter, int sessionId, java.sql.Connection con)
           
protected  java.lang.String getColumnName(java.util.Locale locale)
           
protected  java.lang.String getLocaleString(java.lang.String locale)
           
protected  java.lang.String getTableNameFromMetadata(java.lang.String tableName, java.sql.Connection con)
           
protected  void init(java.util.Hashtable params)
          This method gets the Hashtable and initializes the properties
protected  void insertBundleValue(java.util.Hashtable values, int sessionId, java.sql.Connection con)
           
protected  EntityResult insertNewBundle(java.lang.String bundleClassName, int sessionId, java.sql.Connection con)
           
protected  EntityResult queryBundleValues(java.lang.Object bundleId, java.lang.String languageColumn, int sessionId)
           
 void resultSetToEntityResult(java.sql.ResultSet resultSet, EntityResult entityResult, java.util.List columnNames)
           
protected  void updateBundleValue(java.util.Hashtable filter, java.util.Hashtable values, int sessionId, java.sql.Connection con)
           
 void updateBundleValues(DatabaseBundleValues dbvalues, int sessionId)
          Update the specified values in the database bundle
 void updateBundleValues(DatabaseBundleValues dbvalues, int sessionId, java.sql.Connection con)
           
 
Methods inherited from class com.ontimize.util.remote.AbstractRemoteReference
connect, connect, disconnect, getDatabaseConnectionManager, getEntityReference, hasSession
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

BUNDLE_TABLE_NAME

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

BUNDLE_VALUES_TABLE_NAME

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

BUNDLE_VALUES_ENTITY_NAME

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

BUNDLE_ENTITY_NAME

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

BUNDLE_CLASS_NAME_COLUMN

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

BUNDLE_DESCRIPTION_COLUMN

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

BUNDLE_KEY_COLUMN

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

BUNDLE_VALUES_KEY_COLUMN

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

BUNDLE_VALUES_TEXT_KEY_COLUMN

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

DATABASE_CONNECTION_MANAGER_ID

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

TO_LOWER_CASE

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

AUTOCONFIGURE_LOCALE_COLUMNS

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

bundleTableName

public static java.lang.String bundleTableName

bundleValuesTableName

public static java.lang.String bundleValuesTableName

bundleEntityName

public static java.lang.String bundleEntityName

bundleValuesEntityName

public static java.lang.String bundleValuesEntityName

bundleClassNameColumn

public static java.lang.String bundleClassNameColumn

bundleDescriptionColumn

public static java.lang.String bundleDescriptionColumn

bundleKeyColumn

public static java.lang.String bundleKeyColumn

bundleValuesKeyColumn

public static java.lang.String bundleValuesKeyColumn

bundleValuesTextKeyColumn

public static java.lang.String bundleValuesTextKeyColumn

toLowerCase

public static java.lang.Boolean toLowerCase
Boolean to know the names of the columns in the table
Default value is null, to use directly the names in the configuration file or the default ones.
If it is true then use the values but in lower case. If it is false then use the configuration or default values but in upper case


localeColumnNames

protected java.util.Hashtable localeColumnNames

autoconfigureLocaleColumns

protected boolean autoconfigureLocaleColumns
Constructor Detail

DatabaseBundleManager

public DatabaseBundleManager(int port,
                             EntityReferenceLocator locator,
                             java.util.Hashtable params)
                      throws java.lang.Exception
Method Detail

init

protected void init(java.util.Hashtable params)
This method gets the Hashtable and initializes the properties

Overrides:
init in class AbstractRemoteReference

autoconfigureLocaleColumns

protected void autoconfigureLocaleColumns()

getTableNameFromMetadata

protected java.lang.String getTableNameFromMetadata(java.lang.String tableName,
                                                    java.sql.Connection con)
                                             throws java.sql.SQLException
Throws:
java.sql.SQLException

getLocaleString

protected java.lang.String getLocaleString(java.lang.String locale)

getAllResourceBundles

public java.util.Hashtable getAllResourceBundles(java.util.Locale locale,
                                                 int sessionId)
                                          throws java.lang.Exception
Description copied from interface: IDatabaseBundleManager
Get a hashtable with all the available bundles in the database for the specified locale

Specified by:
getAllResourceBundles in interface IDatabaseBundleManager
Parameters:
locale - Locale
sessionId -
Returns:
The keys of the object are Strings with the bundle class name (for example com.ontimize.gui.i18m.bundle) and each value is the ResourceBundle object
Throws:
java.lang.Exception

getBundles

public java.util.Hashtable getBundles(java.util.List baseNames,
                                      java.util.Locale locale,
                                      int sessionId)
                               throws java.lang.Exception
Description copied from interface: IDatabaseBundleManager
Get all the resources for the specified locale and different names

Specified by:
getBundles in interface IDatabaseBundleManager
Parameters:
baseNames - A list of String objects with the names of the resources to query
locale - Locale
sessionId -
Returns:
Throws:
java.lang.Exception

getBundle

public java.util.ResourceBundle getBundle(java.lang.String baseName,
                                          java.util.Locale locale,
                                          int sessionId)
                                   throws java.lang.Exception
Description copied from interface: IDatabaseBundleManager
Get the resource bundle for the specified name and locale

Specified by:
getBundle in interface IDatabaseBundleManager
Parameters:
baseName -
locale -
sessionId -
Returns:
Throws:
java.lang.Exception

getBundle

protected java.util.ResourceBundle getBundle(DatabaseBundleDescriptor bundleDescriptor,
                                             java.util.Locale locale,
                                             int sessionId)
                                      throws java.lang.Exception
Throws:
java.lang.Exception

queryBundleValues

protected EntityResult queryBundleValues(java.lang.Object bundleId,
                                         java.lang.String languageColumn,
                                         int sessionId)
                                  throws java.lang.Exception
Throws:
java.lang.Exception

getColumnName

protected java.lang.String getColumnName(java.util.Locale locale)

getBundleDescriptor

protected DatabaseBundleDescriptor getBundleDescriptor(java.lang.String bundleClassName,
                                                       int sessionId)
                                                throws java.lang.Exception
Throws:
java.lang.Exception

getAvailableBundles

public DatabaseBundleDescriptor[] getAvailableBundles(int sessionId,
                                                      java.sql.Connection con)
                                               throws java.lang.Exception
Get all the available bundles in the database.
If (DatabaseBundleManager.bundleValuesEntityName is not null and a entity with this name exists then use this entity to query the available bundles.
If (DatabaseBundleManager.bundleValuesEntityName is null and bundleTableName is not null then query the table directly. In other case return null

Returns:
Throws:
java.lang.Exception

getAvailableBundles

public DatabaseBundleDescriptor[] getAvailableBundles(int sessionId)
                                               throws java.lang.Exception
Description copied from interface: IDatabaseBundleManager
Get a list with all the available bundle classes

Specified by:
getAvailableBundles in interface IDatabaseBundleManager
Parameters:
sessionId -
Returns:
Throws:
java.lang.Exception

getAvailableLocales

public java.lang.String[] getAvailableLocales(int sessionId)
                                       throws java.lang.Exception
Description copied from interface: IDatabaseBundleManager
Get a list with the suffix of the available locales in the database

Specified by:
getAvailableLocales in interface IDatabaseBundleManager
Parameters:
sessionId -
Returns:
Throws:
java.lang.Exception

updateBundleValues

public void updateBundleValues(DatabaseBundleValues dbvalues,
                               int sessionId)
                        throws java.lang.Exception
Description copied from interface: IDatabaseBundleManager
Update the specified values in the database bundle

Specified by:
updateBundleValues in interface IDatabaseBundleManager
Parameters:
dbvalues -
sessionId -
Throws:
java.lang.Exception

updateBundleValues

public void updateBundleValues(DatabaseBundleValues dbvalues,
                               int sessionId,
                               java.sql.Connection con)
                        throws java.lang.Exception
Throws:
java.lang.Exception

updateBundleValue

protected void updateBundleValue(java.util.Hashtable filter,
                                 java.util.Hashtable values,
                                 int sessionId,
                                 java.sql.Connection con)
                          throws java.lang.Exception
Throws:
java.lang.Exception

insertBundleValue

protected void insertBundleValue(java.util.Hashtable values,
                                 int sessionId,
                                 java.sql.Connection con)
                          throws java.lang.Exception
Throws:
java.lang.Exception

getBundleValueKey

protected java.lang.Object getBundleValueKey(java.util.Hashtable filter,
                                             int sessionId,
                                             java.sql.Connection con)
                                      throws java.lang.Exception
Throws:
java.lang.Exception

getBundleId

protected java.lang.Object getBundleId(java.lang.String bundleClassName,
                                       java.util.List availablebundles,
                                       int sessionId,
                                       java.sql.Connection con)
                                throws java.lang.Exception
Throws:
java.lang.Exception

insertNewBundle

protected EntityResult insertNewBundle(java.lang.String bundleClassName,
                                       int sessionId,
                                       java.sql.Connection con)
                                throws java.lang.Exception
Throws:
java.lang.Exception

executeUpdateStatement

protected void executeUpdateStatement(SQLStatementBuilder.SQLStatement sqlStatement,
                                      int sessionId,
                                      java.sql.Connection con)
                               throws java.lang.Exception
Throws:
java.lang.Exception

executeQueryStatement

protected EntityResult executeQueryStatement(SQLStatementBuilder.SQLStatement sqlStatement,
                                             int sessionId,
                                             java.util.List queryColumns,
                                             java.sql.Connection con)
                                      throws java.lang.Exception
Throws:
java.lang.Exception

executePreparedStatement

public EntityResult executePreparedStatement(SQLStatementBuilder.SQLStatement sqlStatement,
                                             java.sql.Connection con,
                                             int sessionId,
                                             java.util.List queryColumns)
                                      throws java.lang.Exception
Throws:
java.lang.Exception

resultSetToEntityResult

public void resultSetToEntityResult(java.sql.ResultSet resultSet,
                                    EntityResult entityResult,
                                    java.util.List columnNames)
                             throws java.lang.Exception
Throws:
java.lang.Exception

Ontimize