public class Registry
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Registry.Init |
protected static class |
Registry.TenantHolder |
| Modifier and Type | Field and Description |
|---|---|
static boolean |
FAILSAVE_NOTENANTACTIVE |
static java.lang.String |
SYSTEM_PROPERTY_FAILSAFE_ACTIVE |
| Constructor and Description |
|---|
Registry() |
| Modifier and Type | Method and Description |
|---|---|
static Tenant |
activateMasterTenant()
Internal note: currently called via reflection from JUnitTestRunner to assure that "ant yunit" will work
|
static Tenant |
activateMasterTenant(de.hybris.platform.core.Registry.REPLACE replace)
Deprecated.
since ages - use
activateMasterTenant(), setCurrentTenant(Tenant) or
setCurrentTenantByID(String) instead |
static Tenant |
activateMasterTenantAndFailIfAlreadySet()
Deprecated.
since ages - use
activateMasterTenant(), setCurrentTenant(Tenant) or
setCurrentTenantByID(String) instead |
static Tenant |
activateMasterTenantForInit() |
static void |
activateStandaloneMode() |
protected static boolean |
assureTenantStarted(AbstractTenant sys) |
static void |
destroy(boolean all) |
static void |
destroyAndForceStartup()
Can be called to ensure new Singletons are created and all startup()-Hookins are called again.
|
static ApplicationContext |
getApplicationContext()
Tries to retrieve web implementation of the
ApplicationContext from the current
javax.servlet.ServletContext or from http session WebSessionFunctions.getCurrentHttpSession() if it
fails it fall backs to core application spring context see getCoreApplicationContext(). |
static java.util.Collection<java.lang.String> |
getClusterGroups() |
static int |
getClusterID()
Returns the cluster ID assigned to this platform instance.
|
static ApplicationContext |
getCoreApplicationContext()
Method returns an instance of
ApplicationContext context. |
static <T extends Tenant> |
getCurrentTenant()
Returns the tenant currently associated with the callers thread.
|
protected static java.lang.Exception |
getCurrentTenantActivationTrace() |
protected static Tenant |
getCurrentTenantInternal() |
static <T extends Tenant> |
getCurrentTenantNoFallback()
Returns the tenant currently associated with the callers thread or
NULL if no tenant had been activated. |
static ApplicationContext |
getGlobalApplicationContext()
Deprecated.
since 5.0 use
getCoreApplicationContext() instead |
static MasterTenant |
getMasterTenant() |
static <T> T |
getNonTenantSingleton(SingletonCreator.Creator<T> creator) |
static PersistenceManager |
getPersistenceManager() |
static int |
getPreferredClusterID()
Deprecated.
since ages - use
isStandaloneMode() instead |
static ServletContext |
getServletContextIfExists()
Returns servlet context if invoked in webcontext
|
static <T> T |
getSingleton(java.lang.Class<T> clazz) |
static <T> T |
getSingleton(SingletonCreator.Creator<T> creator) |
static ApplicationContext |
getSingletonGlobalApplicationContext()
This method returns a global 'super' spring context.
|
static SlaveTenant |
getSlaveJunitTenant()
returns a slave tenant instance if exist otherwise throws
IllegalStateException. |
static java.util.Map<java.lang.String,SlaveTenant> |
getSlaveTenants()
returns immutable map of slave tenant configuration
|
static <T extends Tenant> |
getTenantByID(java.lang.String id)
Return the tenant by its ID or NULL if no tenant was found.
|
static java.util.List<TenantListener> |
getTenantListeners()
Gets all listeners registered for getting tenant notifications.
|
static boolean |
hasCurrentTenant()
Tells whether the callers thread is already associated with a tenant.
|
static boolean |
isCurrentTenant(Tenant tenant)
Tells whether the callers thread is associated with the given tenant.
|
static boolean |
isCurrentTenantStarted() |
static boolean |
isStandaloneMode() |
static void |
registerTenantListener(TenantListener listener)
Registers a
TenantListener which will be then notified on tenant start up / shut down. |
static <T> T |
replaceSingleton(SingletonCreator.Creator<T> creator) |
static <T> T |
runAsTenant(Tenant tenant,
java.util.concurrent.Callable<T> callable)
Runs a given Callable within the given tenant.
|
static void |
setCurrentTenant(Tenant tenant)
Activates the given tenant as current tenant for the callers thread.
|
static void |
setCurrentTenantByID(java.lang.String tenantID) |
protected static void |
setCurrentTenantInternal(Tenant tenant) |
static void |
setPreferredClusterID(int clusterid)
Deprecated.
since ages - Use
activateStandaloneMode() instead |
static void |
startup()
This method starts up the Registry.
|
static void |
unregisterTenantListener(TenantListener listener)
Unregisters a
TenantListener for not be notified on tenant start up / shut down anymore. |
static void |
unsetCurrentTenant()
De-activates the currently active tenant for the callers thread.
|
public static final java.lang.String SYSTEM_PROPERTY_FAILSAFE_ACTIVE
public static final boolean FAILSAVE_NOTENANTACTIVE
public static java.util.Map<java.lang.String,SlaveTenant> getSlaveTenants()
public static SlaveTenant getSlaveJunitTenant()
IllegalStateException.public static void destroyAndForceStartup()
protected static java.lang.Exception getCurrentTenantActivationTrace()
protected static void setCurrentTenantInternal(Tenant tenant)
protected static Tenant getCurrentTenantInternal()
public static void destroy(boolean all)
public static void startup()
public static <T> T getNonTenantSingleton(SingletonCreator.Creator<T> creator)
public static <T> T getSingleton(java.lang.Class<T> clazz)
public static <T> T getSingleton(SingletonCreator.Creator<T> creator)
public static <T> T replaceSingleton(SingletonCreator.Creator<T> creator)
public static <T> T runAsTenant(Tenant tenant, java.util.concurrent.Callable<T> callable) throws java.lang.Exception
java.lang.Exceptionpublic static void setCurrentTenant(Tenant tenant)
@Deprecated public static Tenant activateMasterTenantAndFailIfAlreadySet()
activateMasterTenant(), setCurrentTenant(Tenant) or
setCurrentTenantByID(String) insteadjava.lang.IllegalStateException - if the current tenant is already setpublic static Tenant activateMasterTenant()
public static Tenant activateMasterTenantForInit()
@Deprecated public static Tenant activateMasterTenant(de.hybris.platform.core.Registry.REPLACE replace)
activateMasterTenant(), setCurrentTenant(Tenant) or
setCurrentTenantByID(String) insteadprotected static boolean assureTenantStarted(AbstractTenant sys)
public static void setCurrentTenantByID(java.lang.String tenantID)
public static void unsetCurrentTenant()
public static boolean hasCurrentTenant()
public static boolean isCurrentTenant(Tenant tenant)
public static <T extends Tenant> T getCurrentTenantNoFallback()
NULL if no tenant had been activated.getCurrentTenant()public static boolean isCurrentTenantStarted()
public static <T extends Tenant> T getCurrentTenant()
SlaveTenant or (as default)
the MasterTenant.
Please note that depending upon the setting of activate.tenant.fallback this method will automatically
activate the master tenant if no current tenant could be found!java.lang.IllegalStateException - in case no tenant has been activated and fallback mode is not switched on (system property
'activate.tenant.fallback')getCurrentTenantNoFallback()public static <T extends Tenant> T getTenantByID(java.lang.String id)
public static PersistenceManager getPersistenceManager()
public static MasterTenant getMasterTenant()
public static final int getClusterID()
public static final java.util.Collection<java.lang.String> getClusterGroups()
@Deprecated public static void setPreferredClusterID(int clusterid)
activateStandaloneMode() insteadclusterid - the preferred clusternode (0-15). if set to -1, the preferral is cleared.@Deprecated public static int getPreferredClusterID()
isStandaloneMode() insteadpublic static void activateStandaloneMode()
public static boolean isStandaloneMode()
@Deprecated public static ApplicationContext getGlobalApplicationContext()
getCoreApplicationContext() insteadgetCoreApplicationContext()public static ApplicationContext getApplicationContext()
ApplicationContext from the current
javax.servlet.ServletContext or from http session WebSessionFunctions.getCurrentHttpSession() if it
fails it fall backs to core application spring context see getCoreApplicationContext().public static ServletContext getServletContextIfExists()
public static ApplicationContext getCoreApplicationContext()
ApplicationContext context.
${extname}.application-context = ...
The context also has as a parent global 'super' context @see getSingletonGlobalApplicationContext().public static ApplicationContext getSingletonGlobalApplicationContext()
${extname}.global-application-context = ...
Warning In most cases this context won't contain a business logic beans only those infrastructure ones which
needs to stay in memory longer than tenant lifecycle.public static void registerTenantListener(TenantListener listener)
TenantListener which will be then notified on tenant start up / shut down.listener - the listener to register for notificationspublic static void unregisterTenantListener(TenantListener listener)
TenantListener for not be notified on tenant start up / shut down anymore.listener - the listener to unregister for notificationspublic static java.util.List<TenantListener> getTenantListeners()
Copyright © 2018 SAP SE. All Rights Reserved.