mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Use context refresh event to ensure handler is called
This commit is contained in:
@@ -56,3 +56,8 @@ log4j.logger.org.alfresco.module.org_alfresco_module_rm.patch=info
|
|||||||
# Job debug
|
# Job debug
|
||||||
#
|
#
|
||||||
#log4j.logger.org.alfresco.module.org_alfresco_module_rm.job=debug
|
#log4j.logger.org.alfresco.module.org_alfresco_module_rm.job=debug
|
||||||
|
|
||||||
|
#
|
||||||
|
# Module compatibility debug
|
||||||
|
#
|
||||||
|
log4j.logger.org.alfresco.module.org_alfresco_module_rm.bootstrap.ModuleCompatibilityComponent=debug
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
<!-- Module compatibility component -->
|
<!-- Module compatibility component -->
|
||||||
<bean name="rm.moduleCompatibilityComponent" class="org.alfresco.module.org_alfresco_module_rm.bootstrap.ModuleCompatibilityComponent">
|
<bean name="rm.moduleCompatibilityComponent" class="org.alfresco.module.org_alfresco_module_rm.bootstrap.ModuleCompatibilityComponent">
|
||||||
<property name="descriptorService" ref="DescriptorService"/>
|
<property name="descriptorService" ref="descriptorComponent"/>
|
||||||
<property name="moduleService" ref="ModuleService"/>
|
<property name="moduleService" ref="ModuleService"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
@@ -26,7 +26,7 @@ import org.apache.commons.logging.LogFactory;
|
|||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.context.ApplicationListener;
|
import org.springframework.context.ApplicationListener;
|
||||||
import org.springframework.context.ConfigurableApplicationContext;
|
import org.springframework.context.ConfigurableApplicationContext;
|
||||||
import org.springframework.context.event.ContextStartedEvent;
|
import org.springframework.context.event.ContextRefreshedEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Module compatibility component.
|
* Module compatibility component.
|
||||||
@@ -37,7 +37,7 @@ import org.springframework.context.event.ContextStartedEvent;
|
|||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
* @since 2.4
|
* @since 2.4
|
||||||
*/
|
*/
|
||||||
public class ModuleCompatibilityComponent implements ApplicationListener<ContextStartedEvent>
|
public class ModuleCompatibilityComponent implements ApplicationListener<ContextRefreshedEvent>
|
||||||
{
|
{
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static Log logger = LogFactory.getLog(ModuleCompatibilityComponent.class);
|
private static Log logger = LogFactory.getLog(ModuleCompatibilityComponent.class);
|
||||||
@@ -71,28 +71,52 @@ public class ModuleCompatibilityComponent implements ApplicationListener<Context
|
|||||||
* @see org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent)
|
* @see org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onApplicationEvent(ContextStartedEvent contextStartedEvent)
|
public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent)
|
||||||
{
|
{
|
||||||
// get the license mode
|
// grab the application context
|
||||||
LicenseMode licenseMode = descriptorService.getLicenseDescriptor().getLicenseMode();
|
ApplicationContext applicationContext = contextRefreshedEvent.getApplicationContext();
|
||||||
|
|
||||||
if (LicenseMode.ENTERPRISE.equals(licenseMode) &&
|
// get the license mode
|
||||||
moduleService.getModule(RM_ENT_MODULE_ID) == null)
|
LicenseMode licenseMode = descriptorService.getServerDescriptor().getLicenseMode();
|
||||||
|
|
||||||
|
// determine whether RM Enterprise is installed or not
|
||||||
|
boolean isRMEnterprise = isRMEnterprise();
|
||||||
|
|
||||||
|
// debug log
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.debug("Module compatibility information:");
|
||||||
|
logger.debug(" Repository licence mode = " + licenseMode.toString());
|
||||||
|
logger.debug(" RM Enterprise installed = " + isRMEnterprise);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LicenseMode.ENTERPRISE.equals(licenseMode) && !isRMEnterprise)
|
||||||
{
|
{
|
||||||
// running enterprise rm on community core so close application context
|
// running enterprise rm on community core so close application context
|
||||||
closeApplicationContext(contextStartedEvent.getApplicationContext(),
|
closeApplicationContext(
|
||||||
|
applicationContext,
|
||||||
"Running Community Records Management Module on Enterprise Alfresco One is not a supported configuration.");
|
"Running Community Records Management Module on Enterprise Alfresco One is not a supported configuration.");
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (!LicenseMode.ENTERPRISE.equals(licenseMode) &&
|
else if (!LicenseMode.ENTERPRISE.equals(licenseMode) && isRMEnterprise)
|
||||||
moduleService.getModule(RM_ENT_MODULE_ID) != null)
|
|
||||||
{
|
{
|
||||||
// running community rm on enterprise core so close application context
|
// running community rm on enterprise core so close application context
|
||||||
closeApplicationContext(contextStartedEvent.getApplicationContext(),
|
closeApplicationContext(
|
||||||
|
applicationContext,
|
||||||
"Running Enterprise Records Management module on Community Alfresco One is not a supported configuration.");
|
"Running Enterprise Records Management module on Community Alfresco One is not a supported configuration.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether RM Enterprise module is installed or not.
|
||||||
|
*
|
||||||
|
* @return boolean true if RM Enterprise is installed, false otherwise
|
||||||
|
*/
|
||||||
|
private boolean isRMEnterprise()
|
||||||
|
{
|
||||||
|
return (moduleService.getModule(RM_ENT_MODULE_ID) != null);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close application context, logging message.
|
* Close application context, logging message.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user