Search in sources :

Example 1 with LicenseMode

use of org.alfresco.service.cmr.admin.RepoUsage.LicenseMode in project records-management by Alfresco.

the class ModuleCompatibilityComponent method onApplicationEvent.

/**
 * @see org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent)
 */
@Override
public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
    // license mode
    LicenseMode licenseMode = LicenseMode.UNKNOWN;
    // grab the application context
    ApplicationContext applicationContext = contextRefreshedEvent.getApplicationContext();
    // get the license mode
    LicenseDescriptor license = descriptorService.getLicenseDescriptor();
    if (license != null) {
        licenseMode = license.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
        closeApplicationContext(applicationContext, "Running Community Records Management Module on Enterprise Alfresco One is not a supported configuration.");
    } else if (!LicenseMode.ENTERPRISE.equals(licenseMode) && isRMEnterprise) {
        // running community rm on enterprise core so close application
        // context
        closeApplicationContext(applicationContext, "Running Enterprise Records Management module on Community Alfresco One is not a supported configuration.");
    }
}
Also used : ConfigurableApplicationContext(org.springframework.context.ConfigurableApplicationContext) ApplicationContext(org.springframework.context.ApplicationContext) LicenseMode(org.alfresco.service.cmr.admin.RepoUsage.LicenseMode) LicenseDescriptor(org.alfresco.service.license.LicenseDescriptor)

Aggregations

LicenseMode (org.alfresco.service.cmr.admin.RepoUsage.LicenseMode)1 LicenseDescriptor (org.alfresco.service.license.LicenseDescriptor)1 ApplicationContext (org.springframework.context.ApplicationContext)1 ConfigurableApplicationContext (org.springframework.context.ConfigurableApplicationContext)1