Class MockTenant
java.lang.Object
de.hybris.platform.servicelayer.tenant.MockTenant
- All Implemented Interfaces:
DataSourceProvider,Tenant
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidSwitches to a specified (by the id) master data source for the current thread.Switches to a slave data source for the current thread.voidSwitches to a specified (by the id) slave data source for the current thread.createAndRegisterBackgroundThread(Runnable payload, ThreadFactory factory) voidAfter a alternative slave or master data source has been activated for the current thread it's necessary to de-activate it again! After this the base master data source is active (again).voidAfter slave data source has been activated for the current thread it's necessary to de-activate it again! After this the master data source is active (again).booleanvoidEnforces the usage of a master data source for all subsequent calls toDataSourceProvider.getDataSource()no matter if a slave data source has been activated or not.Provides IDs of all available alternative master data sources.Returns all known alternative master data sources as Collection.Provides IDs of all available slave data sources.Returns all known slave data sources as Collection.getCache()Returns currently active data source.getDataSource(String className) Returns new data source.Returns master data source no matter which one is currently active.inthashCode()booleanTells whether the current active data source is a alternative master data source.booleanIf on the current data source (slave/master) the methodDataSourceProvider.forceMasterDataSource()was called then this method returns true.booleanTells whether current data source is a slave data source.voidMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.hybris.platform.core.Tenant
getAllItemLifecycleListeners
-
Constructor Details
-
MockTenant
-
-
Method Details
-
resetTenantRestartMarker
public void resetTenantRestartMarker()- Specified by:
resetTenantRestartMarkerin interfaceTenant
-
getDataSource
Description copied from interface:DataSourceProviderReturns new data source. (experimental (related to PLA-7861))- Specified by:
getDataSourcein interfaceDataSourceProvider
-
getCache
-
getConfig
-
getDataSource
Description copied from interface:DataSourceProviderReturns currently active data source.- Specified by:
getDataSourcein interfaceDataSourceProvider
-
getInvalidationManager
- Specified by:
getInvalidationManagerin interfaceTenant
-
getJaloConnection
- Specified by:
getJaloConnectionin interfaceTenant
-
getPersistenceManager
- Specified by:
getPersistenceManagerin interfaceTenant
-
getPersistencePool
- Specified by:
getPersistencePoolin interfaceTenant
-
getSerialNumberGenerator
- Specified by:
getSerialNumberGeneratorin interfaceTenant
-
getSingletonCreator
- Specified by:
getSingletonCreatorin interfaceTenant
-
getSystemEJB
- Specified by:
getSystemEJBin interfaceTenant
-
getTenantID
- Specified by:
getTenantIDin interfaceTenant
-
getTenantSpecificExtensionNames
- Specified by:
getTenantSpecificExtensionNamesin interfaceTenant
-
getTenantSpecificLocale
- Specified by:
getTenantSpecificLocalein interfaceTenant
-
getTenantSpecificTimeZone
- Specified by:
getTenantSpecificTimeZonein interfaceTenant
-
getThreadPool
- Specified by:
getThreadPoolin interfaceTenant
-
getWorkersThreadPool
- Specified by:
getWorkersThreadPoolin interfaceTenant
-
hashCode
public int hashCode() -
equals
-
getActiveSession
- Specified by:
getActiveSessionin interfaceTenant
-
deactivateSlaveDataSource
public void deactivateSlaveDataSource()Description copied from interface:DataSourceProviderAfter slave data source has been activated for the current thread it's necessary to de-activate it again! After this the master data source is active (again).- Specified by:
deactivateSlaveDataSourcein interfaceDataSourceProvider- See Also:
-
activateSlaveDataSource
Description copied from interface:DataSourceProviderSwitches to a slave data source for the current thread. If the current data source is already a slave one this has no effect. Use as follows:Tenant t = Registry.getCurrentTenant(); try { t.activateSlaveDataSource(); // ... business logic ... } finally { t.deactivateSlaveSource(); }- Specified by:
activateSlaveDataSourcein interfaceDataSourceProvider- See Also:
-
activateSlaveDataSource
Description copied from interface:DataSourceProviderSwitches to a specified (by the id) slave data source for the current thread. If the current data source is already a slave one this has no effect. Use as follows:Tenant t = Registry.getCurrentTenant(); try { t.activateSlaveDataSource("your_slave_id"); // ... business logic ... } finally { t.deactivateSlaveSource(); }- Specified by:
activateSlaveDataSourcein interfaceDataSourceProvider- Parameters:
id- the id string of the slave data source- See Also:
-
getMasterDataSource
Description copied from interface:DataSourceProviderReturns master data source no matter which one is currently active.- Specified by:
getMasterDataSourcein interfaceDataSourceProvider
-
isSlaveDataSource
public boolean isSlaveDataSource()Description copied from interface:DataSourceProviderTells whether current data source is a slave data source.- Specified by:
isSlaveDataSourcein interfaceDataSourceProvider- Returns:
- true if the
DataSourceProvideris a slave data source
-
isAlternativeMasterDataSource
public boolean isAlternativeMasterDataSource()Description copied from interface:DataSourceProviderTells whether the current active data source is a alternative master data source.- Specified by:
isAlternativeMasterDataSourcein interfaceDataSourceProvider
-
getAllSlaveDataSources
Description copied from interface:DataSourceProviderReturns all known slave data sources as Collection.- Specified by:
getAllSlaveDataSourcesin interfaceDataSourceProvider- Returns:
- a
SetwithHybrisDataSourceobjects
-
getAllDataSourceIDs
- Specified by:
getAllDataSourceIDsin interfaceDataSourceProvider
-
forceMasterDataSource
public void forceMasterDataSource()Description copied from interface:DataSourceProviderEnforces the usage of a master data source for all subsequent calls toDataSourceProvider.getDataSource()no matter if a slave data source has been activated or not.Please note that this does not affect chosen alternative master data sources. If you want to switch back to the main master data source use
DataSourceProvider.deactivateAlternativeDataSource().- Specified by:
forceMasterDataSourcein interfaceDataSourceProvider
-
isForceMaster
public boolean isForceMaster()Description copied from interface:DataSourceProviderIf on the current data source (slave/master) the methodDataSourceProvider.forceMasterDataSource()was called then this method returns true. ADataSourceProvider.deactivateAlternativeDataSource()will reset this state.- Specified by:
isForceMasterin interfaceDataSourceProvider- Returns:
- true if the master data source is forced
-
activateAlternativeMasterDataSource
Description copied from interface:DataSourceProviderSwitches to a specified (by the id) master data source for the current thread. Use as follows:Tenant t = Registry.getCurrentTenant(); try { t.activateMasterDataSource("your_slave_id"); // ... business logic ... } finally { t.deactivateSlaveSource(); }- Specified by:
activateAlternativeMasterDataSourcein interfaceDataSourceProvider- Parameters:
id- the id string of the slave data source- See Also:
-
deactivateAlternativeDataSource
public void deactivateAlternativeDataSource()Description copied from interface:DataSourceProviderAfter a alternative slave or master data source has been activated for the current thread it's necessary to de-activate it again! After this the base master data source is active (again).- Specified by:
deactivateAlternativeDataSourcein interfaceDataSourceProvider- See Also:
-
getAllAlternativeMasterDataSourceIDs
Description copied from interface:DataSourceProviderProvides IDs of all available alternative master data sources.- Specified by:
getAllAlternativeMasterDataSourceIDsin interfaceDataSourceProvider
-
getAllAlternativeMasterDataSources
Description copied from interface:DataSourceProviderReturns all known alternative master data sources as Collection.- Specified by:
getAllAlternativeMasterDataSourcesin interfaceDataSourceProvider- Returns:
- a
SetwithHybrisDataSourceobjects
-
getAllSlaveDataSourceIDs
Description copied from interface:DataSourceProviderProvides IDs of all available slave data sources.- Specified by:
getAllSlaveDataSourceIDsin interfaceDataSourceProvider
-
createAndRegisterBackgroundThread
- Specified by:
createAndRegisterBackgroundThreadin interfaceTenant
-