Ontimize 5.2072EN

com.ontimize.locator
Class DatabaseEntityManager

java.lang.Object
  extended bycom.ontimize.locator.DatabaseEntityManager
All Implemented Interfaces:
EntityDataChangeListener, java.util.EventListener, TransactionEntityDataChangeListener

public class DatabaseEntityManager
extends java.lang.Object
implements TransactionEntityDataChangeListener

Since:
5.2057EN-0.9
Author:
Imatia Innovation S.L.

Field Summary
static boolean changeDatabaseIsolation
           
protected static java.lang.String ENTITY_PROVIDER_ENTITY
           
protected static java.lang.String ENTITY_PROVIDER_ENTITYALIAS_COLUMN
           
protected static java.lang.String ENTITY_PROVIDER_ENTITYCLASS_COLUMN
           
protected static java.lang.String ENTITY_PROVIDER_ENTITYNAME_COLUMN
           
protected static java.lang.String ENTITY_PROVIDER_ENTITYPROPERTIES_COLUMN
           
protected  java.lang.String entityProviderEntity
           
protected  java.lang.String entityProviderEntityAliasColumn
           
protected  java.lang.String entityProviderEntityClassColumn
           
protected  java.lang.String entityProviderEntityNameColumn
           
protected  java.lang.String entityProviderEntityPropertiesColumn
           
protected  EntityReferenceLocator locator
           
 
Constructor Summary
DatabaseEntityManager(java.util.Hashtable params, EntityReferenceLocator locator)
           
 
Method Summary
 void dataChanged(DataChangeEvent e)
           
 void dataChanged(DataChangeEvent e, java.sql.Connection con)
           
 Entity getDatabaseEntity(java.lang.String entityName, DatabaseConnectionManager dbConnectionManager)
          Creates a new entity using the information in the database.
protected  java.lang.Class getDatabaseEntityClass(java.lang.String entityName, java.lang.String entityClassName)
          Get the class for the specified entity.
protected  java.util.Hashtable getDatabaseEntityInfo(java.lang.String entityName)
          Query the database to get the info for the specified entity name
static DatabaseEntityManager getDatabaseManagerInstance(java.util.Hashtable params, EntityReferenceLocator locator)
           
protected  java.lang.String getDefaultEntityClassName()
           
protected  java.lang.String getEntitiesPackage()
           
protected  Entity getEntityReference(java.lang.String entityName)
          Returns a reference to an Entity with name entityName.
protected  int getPort()
           
protected  void initDatabaseEntityListeners()
           
protected  java.util.Properties loadProperties(java.lang.String properties)
          Creates a properties object with the information in the parameter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENTITY_PROVIDER_ENTITY

protected static final java.lang.String ENTITY_PROVIDER_ENTITY
See Also:
Constant Field Values

ENTITY_PROVIDER_ENTITYNAME_COLUMN

protected static final java.lang.String ENTITY_PROVIDER_ENTITYNAME_COLUMN
See Also:
Constant Field Values

ENTITY_PROVIDER_ENTITYPROPERTIES_COLUMN

protected static final java.lang.String ENTITY_PROVIDER_ENTITYPROPERTIES_COLUMN
See Also:
Constant Field Values

ENTITY_PROVIDER_ENTITYALIAS_COLUMN

protected static final java.lang.String ENTITY_PROVIDER_ENTITYALIAS_COLUMN
See Also:
Constant Field Values

ENTITY_PROVIDER_ENTITYCLASS_COLUMN

protected static final java.lang.String ENTITY_PROVIDER_ENTITYCLASS_COLUMN
See Also:
Constant Field Values

entityProviderEntity

protected java.lang.String entityProviderEntity

entityProviderEntityNameColumn

protected java.lang.String entityProviderEntityNameColumn

entityProviderEntityPropertiesColumn

protected java.lang.String entityProviderEntityPropertiesColumn

entityProviderEntityAliasColumn

protected java.lang.String entityProviderEntityAliasColumn

entityProviderEntityClassColumn

protected java.lang.String entityProviderEntityClassColumn

locator

protected EntityReferenceLocator locator

changeDatabaseIsolation

public static boolean changeDatabaseIsolation
Constructor Detail

DatabaseEntityManager

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

initDatabaseEntityListeners

protected void initDatabaseEntityListeners()
                                    throws java.lang.Exception
Throws:
java.lang.Exception

getDatabaseManagerInstance

public static DatabaseEntityManager getDatabaseManagerInstance(java.util.Hashtable params,
                                                               EntityReferenceLocator locator)
                                                        throws java.lang.Exception
Throws:
java.lang.Exception

getDatabaseEntity

public Entity getDatabaseEntity(java.lang.String entityName,
                                DatabaseConnectionManager dbConnectionManager)
                         throws java.lang.Exception
Creates a new entity using the information in the database. If there is no information for this entity or database entity provider is not configured then return null

Parameters:
entityName - Name of the entity
dbConnectionManager - Database connection manager for the specified entity (in case of MultiConnectionManager)
Returns:
Throws:
java.lang.Exception

getDatabaseEntityInfo

protected java.util.Hashtable getDatabaseEntityInfo(java.lang.String entityName)
                                             throws java.lang.Exception
Query the database to get the info for the specified entity name

Parameters:
entityName - name of the entity
Returns:
The record in the database with the values for the specified entity
Throws:
java.lang.Exception

loadProperties

protected java.util.Properties loadProperties(java.lang.String properties)
                                       throws java.lang.Exception
Creates a properties object with the information in the parameter

Returns:
Throws:
java.lang.Exception

getDatabaseEntityClass

protected java.lang.Class getDatabaseEntityClass(java.lang.String entityName,
                                                 java.lang.String entityClassName)
Get the class for the specified entity.

Parameters:
entityName - Name of the entity.
entityClassName - Name of the class. This parameter can be null and then we use the name of the entity or the default entity class
Returns:

getEntityReference

protected Entity getEntityReference(java.lang.String entityName)
                             throws java.lang.Exception
Returns a reference to an Entity with name entityName.

This method checks if locator for this entity is an instance of ServerReferenceLocator. If true, getEntityReferenceFromServer(String) is used instead getEntityReference(String)

Parameters:
entityName - the entityName
Returns:
a Entity reference of null if no entity exists with name entityName
Throws:
java.lang.Exception - if an error occurs

getPort

protected int getPort()

getEntitiesPackage

protected java.lang.String getEntitiesPackage()

getDefaultEntityClassName

protected java.lang.String getDefaultEntityClassName()

dataChanged

public void dataChanged(DataChangeEvent e,
                        java.sql.Connection con)
Specified by:
dataChanged in interface TransactionEntityDataChangeListener

dataChanged

public void dataChanged(DataChangeEvent e)
Specified by:
dataChanged in interface EntityDataChangeListener

Ontimize