Class DBPersistenceManager
- java.lang.Object
-
- de.hybris.platform.persistence.property.DBPersistenceManager
-
- All Implemented Interfaces:
PersistenceManager
public class DBPersistenceManager extends java.lang.Object implements PersistenceManager
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DISALLOW_CLEAR_PARAM
static java.lang.String
DUMP_FILE_PARAM
static java.lang.String
LOG_CLEAR_PARAM
static java.lang.String
TYPE_INFO_MAP_BATCH_MODE
-
Fields inherited from interface de.hybris.platform.persistence.property.PersistenceManager
NO_DATABASE
-
-
Constructor Summary
Constructors Constructor Description DBPersistenceManager(AbstractTenant tenant, InvalidationManager invManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected PersistenceInfoCache
cache()
boolean
cachesInfoFor(PK typePK)
void
clearBeforeDropTables()
For initialization only !void
clearComposedType(PK typePK, java.lang.String code)
protected void
clearTypeCache(de.hybris.platform.persistence.property.DBPersistenceManager.LoadStatus newStatus)
java.util.Collection<PropertyTableDefinition>
createInitialPersistenceInfos(java.util.Collection types, boolean reinit)
should only be called during initialization! this analyzes the collection of item type and creates new TypeInfoMap instances for them.void
destroy()
protected void
dumpPersistenceInfoCache(PersistenceInfoCache pic)
java.util.Set<ItemDeployment>
getAllDeployments()
java.util.Collection<ItemDeployment>
getAllSubDeployments(ItemDeployment depl)
java.util.Set<java.lang.Integer>
getBeanTypeCodes(PK typePK)
Returns a set of all beans typecode which are typed by the type of the specified pk.java.lang.String
getDumpFileName()
java.util.Map<java.lang.Integer,ItemDeployment>
getDuplicatedItemDeployments()
Returns a duplicated deployments by its type code.java.util.Set<PK>
getExternalTableTypes(PK typePK)
Finds all subtypes of a given non-abstract type which are mapped to a different deployment.PropertyTableDefinition
getInitialPersistenceInfos(ComposedTypeRemote type, boolean reinit)
ItemDeployment
getItemDeployment(int tc)
ItemDeployment
getItemDeployment(java.lang.String beanOrJNDIName)
java.lang.String
getJNDIName(int typeCode)
java.lang.String
getJNDIName(java.lang.String code)
locates the JNDI name for a given composed type code.TypeInfoMap
getPersistenceInfo(PK typePK)
TypeInfoMap
getPersistenceInfo(java.lang.String code)
Returns a TypeInfoMap instance for each composed type.java.lang.String
getSQLTypeDef(java.lang.Class javaClass, java.lang.String ownTypeDef)
PK
getTypePK(java.lang.String code)
boolean
isDestroyed()
boolean
isLoaded()
boolean
isLoading()
boolean
isRootRelationType(java.lang.String code)
void
legacyLoadPersistenceInfosInternalInTX()
void
loadPersistenceInfos()
loads persistence info for all non-abstract types of the initialized system.protected void
registerHJMPFinderListeners(InvalidationManager invMan)
void
reloadPersistenceInfos()
protected PersistenceInfoCache
restorePersistenceInfoCache()
void
simulateFullClear()
For testing only! Do not use!
-
-
-
Field Detail
-
TYPE_INFO_MAP_BATCH_MODE
public static final java.lang.String TYPE_INFO_MAP_BATCH_MODE
- See Also:
- Constant Field Values
-
DUMP_FILE_PARAM
public static final java.lang.String DUMP_FILE_PARAM
- See Also:
- Constant Field Values
-
LOG_CLEAR_PARAM
public static final java.lang.String LOG_CLEAR_PARAM
- See Also:
- Constant Field Values
-
DISALLOW_CLEAR_PARAM
public static final java.lang.String DISALLOW_CLEAR_PARAM
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DBPersistenceManager
public DBPersistenceManager(AbstractTenant tenant, InvalidationManager invManager)
-
-
Method Detail
-
getSQLTypeDef
public java.lang.String getSQLTypeDef(java.lang.Class javaClass, java.lang.String ownTypeDef)
- Specified by:
getSQLTypeDef
in interfacePersistenceManager
- Returns:
- the property SQL column type definition for a given java class. ( e.g. for oracle
String.class
would be mapped toNVARCHAR2(2000)
)
-
cache
protected final PersistenceInfoCache cache()
-
getPersistenceInfo
public final TypeInfoMap getPersistenceInfo(java.lang.String code)
Returns a TypeInfoMap instance for each composed type. These instances are cached and pre-loaded on system startup. only composed types created after startup will be analyzed and a new instance is created.If the instances could not be pre-load ( ususally when the system is not yet initialized )
TypeInfoMap.EMPTY_INFOMAP
is returned.- Specified by:
getPersistenceInfo
in interfacePersistenceManager
- Parameters:
code
- the code of the item type aka composed type
-
getPersistenceInfo
public final TypeInfoMap getPersistenceInfo(PK typePK)
- Specified by:
getPersistenceInfo
in interfacePersistenceManager
-
getInitialPersistenceInfos
public PropertyTableDefinition getInitialPersistenceInfos(ComposedTypeRemote type, boolean reinit)
- Specified by:
getInitialPersistenceInfos
in interfacePersistenceManager
-
createInitialPersistenceInfos
public final java.util.Collection<PropertyTableDefinition> createInitialPersistenceInfos(java.util.Collection types, boolean reinit)
should only be called during initialization! this analyzes the collection of item type and creates new TypeInfoMap instances for them. the difference to loading them viagetPersistenceInfo(String)
orloadPersistenceInfos()
is that even property features without database column are put inside the instance, provided they have a proposed column name. this assumes that the caller of this method is able to create these columns somehow.- Specified by:
createInitialPersistenceInfos
in interfacePersistenceManager
- Parameters:
types
- the initial (non-abstract) types of the systemreinit
- needed to get type manager from- Returns:
- a collection of
PropertyTableDefinition
, one for each table
-
getDumpFileName
public java.lang.String getDumpFileName()
-
restorePersistenceInfoCache
protected PersistenceInfoCache restorePersistenceInfoCache()
-
dumpPersistenceInfoCache
protected void dumpPersistenceInfoCache(PersistenceInfoCache pic)
-
reloadPersistenceInfos
public final void reloadPersistenceInfos()
-
loadPersistenceInfos
public final void loadPersistenceInfos()
loads persistence info for all non-abstract types of the initialized system. this has to be called before any access to items ! otherwise accessing their properties will fail.for each type a instance is created and cached. these maps only contain features with present database column. you may use this to manually change a database column , shutdown the system, change you schema accordingly and restart the system again.
- Specified by:
loadPersistenceInfos
in interfacePersistenceManager
-
legacyLoadPersistenceInfosInternalInTX
public void legacyLoadPersistenceInfosInternalInTX()
-
cachesInfoFor
public boolean cachesInfoFor(PK typePK)
- Specified by:
cachesInfoFor
in interfacePersistenceManager
-
isLoaded
public boolean isLoaded()
- Specified by:
isLoaded
in interfacePersistenceManager
-
isDestroyed
public boolean isDestroyed()
-
isLoading
public boolean isLoading()
-
getAllDeployments
public java.util.Set<ItemDeployment> getAllDeployments()
-
getItemDeployment
public ItemDeployment getItemDeployment(java.lang.String beanOrJNDIName)
- Specified by:
getItemDeployment
in interfacePersistenceManager
- Parameters:
beanOrJNDIName
- the jndi or bean name to get the deployment for- Returns:
- the item deployment for this bean or jndi name, null if no such deployment exists
-
getDuplicatedItemDeployments
public java.util.Map<java.lang.Integer,ItemDeployment> getDuplicatedItemDeployments()
Description copied from interface:PersistenceManager
Returns a duplicated deployments by its type code. There is always inserted deployment which is deployed in DB persistance as to be redundant in compare to xml modeled one.- Specified by:
getDuplicatedItemDeployments
in interfacePersistenceManager
-
getItemDeployment
public ItemDeployment getItemDeployment(int tc)
- Specified by:
getItemDeployment
in interfacePersistenceManager
-
getAllSubDeployments
public java.util.Collection<ItemDeployment> getAllSubDeployments(ItemDeployment depl)
- Specified by:
getAllSubDeployments
in interfacePersistenceManager
-
getJNDIName
public java.lang.String getJNDIName(int typeCode)
- Specified by:
getJNDIName
in interfacePersistenceManager
- Parameters:
typeCode
- the item typecode to get the jndi name for- Returns:
- the jndi name of the bean deployment which owns this typecode, null if no such deployment exists
-
getJNDIName
public java.lang.String getJNDIName(java.lang.String code)
locates the JNDI name for a given composed type code.- Specified by:
getJNDIName
in interfacePersistenceManager
-
getTypePK
public PK getTypePK(java.lang.String code)
- Specified by:
getTypePK
in interfacePersistenceManager
-
isRootRelationType
public boolean isRootRelationType(java.lang.String code)
- Specified by:
isRootRelationType
in interfacePersistenceManager
-
getExternalTableTypes
public java.util.Set<PK> getExternalTableTypes(PK typePK)
Description copied from interface:PersistenceManager
Finds all subtypes of a given non-abstract type which are mapped to a different deployment.- Specified by:
getExternalTableTypes
in interfacePersistenceManager
-
registerHJMPFinderListeners
protected void registerHJMPFinderListeners(InvalidationManager invMan)
-
clearComposedType
public void clearComposedType(PK typePK, java.lang.String code)
- Specified by:
clearComposedType
in interfacePersistenceManager
-
clearTypeCache
protected void clearTypeCache(de.hybris.platform.persistence.property.DBPersistenceManager.LoadStatus newStatus)
-
getBeanTypeCodes
public java.util.Set<java.lang.Integer> getBeanTypeCodes(PK typePK)
Returns a set of all beans typecode which are typed by the type of the specified pk.- Specified by:
getBeanTypeCodes
in interfacePersistenceManager
- Parameters:
typePK
- the pk of the type to get bean codes for- Returns:
- a set of bean code strings
-
simulateFullClear
public void simulateFullClear()
For testing only! Do not use!
-
clearBeforeDropTables
public void clearBeforeDropTables()
For initialization only !
-
destroy
public void destroy()
-
-