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.StringDISALLOW_CLEAR_PARAMstatic java.lang.StringDUMP_FILE_PARAMstatic java.lang.StringLOG_CLEAR_PARAMstatic java.lang.StringTYPE_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 PersistenceInfoCachecache()booleancachesInfoFor(PK typePK)voidclearBeforeDropTables()For initialization only !voidclearComposedType(PK typePK, java.lang.String code)protected voidclearTypeCache(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.voiddestroy()protected voiddumpPersistenceInfoCache(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.StringgetDumpFileName()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.PropertyTableDefinitiongetInitialPersistenceInfos(ComposedTypeRemote type, boolean reinit)ItemDeploymentgetItemDeployment(int tc)ItemDeploymentgetItemDeployment(java.lang.String beanOrJNDIName)java.lang.StringgetJNDIName(int typeCode)java.lang.StringgetJNDIName(java.lang.String code)locates the JNDI name for a given composed type code.TypeInfoMapgetPersistenceInfo(PK typePK)TypeInfoMapgetPersistenceInfo(java.lang.String code)Returns a TypeInfoMap instance for each composed type.java.lang.StringgetSQLTypeDef(java.lang.Class javaClass, java.lang.String ownTypeDef)PKgetTypePK(java.lang.String code)booleanisDestroyed()booleanisLoaded()booleanisLoading()booleanisRootRelationType(java.lang.String code)voidlegacyLoadPersistenceInfosInternalInTX()voidloadPersistenceInfos()loads persistence info for all non-abstract types of the initialized system.protected voidregisterHJMPFinderListeners(InvalidationManager invMan)voidreloadPersistenceInfos()protected PersistenceInfoCacherestorePersistenceInfoCache()voidsimulateFullClear()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:
getSQLTypeDefin interfacePersistenceManager- Returns:
- the property SQL column type definition for a given java class. ( e.g. for oracle
String.classwould 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_INFOMAPis returned.- Specified by:
getPersistenceInfoin interfacePersistenceManager- Parameters:
code- the code of the item type aka composed type
-
getPersistenceInfo
public final TypeInfoMap getPersistenceInfo(PK typePK)
- Specified by:
getPersistenceInfoin interfacePersistenceManager
-
getInitialPersistenceInfos
public PropertyTableDefinition getInitialPersistenceInfos(ComposedTypeRemote type, boolean reinit)
- Specified by:
getInitialPersistenceInfosin 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:
createInitialPersistenceInfosin 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:
loadPersistenceInfosin interfacePersistenceManager
-
legacyLoadPersistenceInfosInternalInTX
public void legacyLoadPersistenceInfosInternalInTX()
-
cachesInfoFor
public boolean cachesInfoFor(PK typePK)
- Specified by:
cachesInfoForin interfacePersistenceManager
-
isLoaded
public boolean isLoaded()
- Specified by:
isLoadedin 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:
getItemDeploymentin 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:PersistenceManagerReturns 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:
getDuplicatedItemDeploymentsin interfacePersistenceManager
-
getItemDeployment
public ItemDeployment getItemDeployment(int tc)
- Specified by:
getItemDeploymentin interfacePersistenceManager
-
getAllSubDeployments
public java.util.Collection<ItemDeployment> getAllSubDeployments(ItemDeployment depl)
- Specified by:
getAllSubDeploymentsin interfacePersistenceManager
-
getJNDIName
public java.lang.String getJNDIName(int typeCode)
- Specified by:
getJNDINamein 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:
getJNDINamein interfacePersistenceManager
-
getTypePK
public PK getTypePK(java.lang.String code)
- Specified by:
getTypePKin interfacePersistenceManager
-
isRootRelationType
public boolean isRootRelationType(java.lang.String code)
- Specified by:
isRootRelationTypein interfacePersistenceManager
-
getExternalTableTypes
public java.util.Set<PK> getExternalTableTypes(PK typePK)
Description copied from interface:PersistenceManagerFinds all subtypes of a given non-abstract type which are mapped to a different deployment.- Specified by:
getExternalTableTypesin interfacePersistenceManager
-
registerHJMPFinderListeners
protected void registerHJMPFinderListeners(InvalidationManager invMan)
-
clearComposedType
public void clearComposedType(PK typePK, java.lang.String code)
- Specified by:
clearComposedTypein 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:
getBeanTypeCodesin 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()
-
-