Search in sources :

Example 6 with ComponentInstallationReport

use of org.entando.entando.aps.system.init.model.ComponentInstallationReport in project entando-core by entando.

the class InitializerManager method executePostInitProcesses.

public void executePostInitProcesses() throws BeansException {
    SystemInstallationReport report = null;
    try {
        report = this.extractReport();
        List<Component> components = this.getComponentManager().getCurrentComponents();
        for (int i = 0; i < components.size(); i++) {
            Component component = components.get(i);
            ComponentInstallationReport componentReport = report.getComponentReport(component.getCode(), false);
            SystemInstallationReport.Status postProcessStatus = componentReport.getPostProcessStatus();
            if (!postProcessStatus.equals(SystemInstallationReport.Status.INIT)) {
                continue;
            }
            String compEnvKey = (AbstractInitializerManager.Environment.test.equals(this.getEnvironment())) ? AbstractInitializerManager.Environment.test.toString() : AbstractInitializerManager.Environment.production.toString();
            ComponentEnvironment componentEnvironment = (null != component.getEnvironments()) ? component.getEnvironments().get(compEnvKey) : null;
            List<IPostProcess> postProcesses = (null != componentEnvironment) ? componentEnvironment.getPostProcesses() : null;
            if (null == postProcesses || postProcesses.isEmpty()) {
                postProcessStatus = SystemInstallationReport.Status.NOT_AVAILABLE;
            } else if (!this.isCheckOnStartup()) {
                postProcessStatus = SystemInstallationReport.Status.SKIPPED;
            } else if (!componentReport.isPostProcessExecutionRequired()) {
                // Porting or restore
                postProcessStatus = SystemInstallationReport.Status.NOT_AVAILABLE;
            } else {
                postProcessStatus = this.executePostProcesses(postProcesses);
            }
            componentReport.setPostProcessStatus(postProcessStatus);
            report.setUpdated();
        }
    } catch (Throwable t) {
        logger.error("Error while executing post processes", t);
        throw new FatalBeanException("Error while executing post processes", t);
    } finally {
        if (null != report && report.isUpdated()) {
            this.saveReport(report);
        }
    }
}
Also used : ComponentEnvironment(org.entando.entando.aps.system.init.model.ComponentEnvironment) IPostProcess(org.entando.entando.aps.system.init.model.IPostProcess) ComponentInstallationReport(org.entando.entando.aps.system.init.model.ComponentInstallationReport) FatalBeanException(org.springframework.beans.FatalBeanException) SystemInstallationReport(org.entando.entando.aps.system.init.model.SystemInstallationReport) Component(org.entando.entando.aps.system.init.model.Component)

Aggregations

ComponentInstallationReport (org.entando.entando.aps.system.init.model.ComponentInstallationReport)6 SystemInstallationReport (org.entando.entando.aps.system.init.model.SystemInstallationReport)5 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)4 DataSource (javax.sql.DataSource)4 ArrayList (java.util.ArrayList)2 Component (org.entando.entando.aps.system.init.model.Component)2 ComponentEnvironment (org.entando.entando.aps.system.init.model.ComponentEnvironment)2 DataInstallationReport (org.entando.entando.aps.system.init.model.DataInstallationReport)2 DataSourceInstallationReport (org.entando.entando.aps.system.init.model.DataSourceInstallationReport)2 Resource (org.springframework.core.io.Resource)2 List (java.util.List)1 IPostProcess (org.entando.entando.aps.system.init.model.IPostProcess)1 FatalBeanException (org.springframework.beans.FatalBeanException)1