mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Review feedback
This commit is contained in:
@@ -56,8 +56,3 @@ 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
|
|
@@ -16,6 +16,7 @@
|
|||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.alfresco.module.org_alfresco_module_rm.bootstrap;
|
package org.alfresco.module.org_alfresco_module_rm.bootstrap;
|
||||||
|
|
||||||
import org.alfresco.service.cmr.admin.RepoUsage.LicenseMode;
|
import org.alfresco.service.cmr.admin.RepoUsage.LicenseMode;
|
||||||
@@ -40,106 +41,106 @@ import org.springframework.context.event.ContextRefreshedEvent;
|
|||||||
*/
|
*/
|
||||||
public class ModuleCompatibilityComponent implements ApplicationListener<ContextRefreshedEvent>
|
public class ModuleCompatibilityComponent implements ApplicationListener<ContextRefreshedEvent>
|
||||||
{
|
{
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static Log logger = LogFactory.getLog(ModuleCompatibilityComponent.class);
|
private static Log logger = LogFactory.getLog(ModuleCompatibilityComponent.class);
|
||||||
|
|
||||||
// TODO get this from somewhere
|
// TODO get this from somewhere
|
||||||
private static final String RM_ENT_MODULE_ID = "alfresco-rm-enterprise-repo";
|
private static final String RM_ENT_MODULE_ID = "alfresco-rm-enterprise-repo";
|
||||||
|
|
||||||
/** descriptor service */
|
/** descriptor service */
|
||||||
private DescriptorService descriptorService;
|
private DescriptorService descriptorService;
|
||||||
|
|
||||||
/** module service */
|
/** module service */
|
||||||
private ModuleService moduleService;
|
private ModuleService moduleService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param descriptorService descriptor service
|
* @param descriptorService descriptor service
|
||||||
*/
|
*/
|
||||||
public void setDescriptorService(DescriptorService descriptorService)
|
public void setDescriptorService(DescriptorService descriptorService)
|
||||||
{
|
{
|
||||||
this.descriptorService = descriptorService;
|
this.descriptorService = descriptorService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param moduleService module service
|
* @param moduleService module service
|
||||||
*/
|
*/
|
||||||
public void setModuleService(ModuleService moduleService)
|
public void setModuleService(ModuleService moduleService)
|
||||||
{
|
{
|
||||||
this.moduleService = moduleService;
|
this.moduleService = moduleService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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(ContextRefreshedEvent contextRefreshedEvent)
|
public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent)
|
||||||
{
|
{
|
||||||
// license mode
|
// license mode
|
||||||
LicenseMode licenseMode = LicenseMode.UNKNOWN;
|
LicenseMode licenseMode = LicenseMode.UNKNOWN;
|
||||||
|
|
||||||
// grab the application context
|
// grab the application context
|
||||||
ApplicationContext applicationContext = contextRefreshedEvent.getApplicationContext();
|
ApplicationContext applicationContext = contextRefreshedEvent.getApplicationContext();
|
||||||
|
|
||||||
// get the license mode
|
// get the license mode
|
||||||
LicenseDescriptor license = descriptorService.getLicenseDescriptor();
|
LicenseDescriptor license = descriptorService.getLicenseDescriptor();
|
||||||
if (license != null)
|
if (license != null)
|
||||||
{
|
{
|
||||||
licenseMode = license.getLicenseMode();
|
licenseMode = license.getLicenseMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
// determine whether RM Enterprise is installed or not
|
// determine whether RM Enterprise is installed or not
|
||||||
boolean isRMEnterprise = isRMEnterprise();
|
boolean isRMEnterprise = isRMEnterprise();
|
||||||
|
|
||||||
// debug log
|
// debug log
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
logger.debug("Module compatibility information:");
|
logger.debug("Module compatibility information:");
|
||||||
logger.debug(" Repository licence mode = " + licenseMode.toString());
|
logger.debug(" Repository licence mode = " + licenseMode.toString());
|
||||||
logger.debug(" RM Enterprise installed = " + isRMEnterprise);
|
logger.debug(" RM Enterprise installed = " + isRMEnterprise);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LicenseMode.ENTERPRISE.equals(licenseMode) && !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
|
||||||
closeApplicationContext(
|
// context
|
||||||
applicationContext,
|
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) && isRMEnterprise)
|
else if (!LicenseMode.ENTERPRISE.equals(licenseMode) && isRMEnterprise)
|
||||||
{
|
{
|
||||||
// running community rm on enterprise core so close application context
|
// running community rm on enterprise core so close application
|
||||||
closeApplicationContext(
|
// context
|
||||||
applicationContext,
|
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.
|
* Indicates whether RM Enterprise module is installed or not.
|
||||||
*
|
*
|
||||||
* @return boolean true if RM Enterprise is installed, false otherwise
|
* @return boolean true if RM Enterprise is installed, false otherwise
|
||||||
*/
|
*/
|
||||||
private boolean isRMEnterprise()
|
private boolean isRMEnterprise()
|
||||||
{
|
{
|
||||||
return (moduleService.getModule(RM_ENT_MODULE_ID) != null);
|
return (moduleService.getModule(RM_ENT_MODULE_ID) != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close application context, logging message.
|
* Close application context, logging message.
|
||||||
*
|
*
|
||||||
* @param applicationContext application context
|
* @param applicationContext application context
|
||||||
* @param message closure message
|
* @param message closure message
|
||||||
*/
|
*/
|
||||||
private void closeApplicationContext(ApplicationContext applicationContext, String message)
|
private void closeApplicationContext(ApplicationContext applicationContext, String message)
|
||||||
{
|
{
|
||||||
// log closure message
|
// log closure message
|
||||||
if (logger.isErrorEnabled())
|
if (logger.isErrorEnabled())
|
||||||
{
|
{
|
||||||
logger.error(message);
|
logger.error(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
// close the application context!
|
// close the application context!
|
||||||
((ConfigurableApplicationContext)applicationContext).close();
|
((ConfigurableApplicationContext) applicationContext).close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user