Class StudioUpgradeManagerImpl

  • All Implemented Interfaces:
    org.craftercms.commons.upgrade.UpgradeManager<String>, StudioUpgradeManager, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

    public class StudioUpgradeManagerImpl
    extends org.craftercms.commons.upgrade.impl.AbstractUpgradeManager<String>
    implements StudioUpgradeManager
    Default implementation for StudioUpgradeManager.
    Author:
    joseross
    • Field Detail

      • dbVersionProvider

        protected org.craftercms.commons.upgrade.VersionProvider dbVersionProvider
      • dbPipelineFactory

        protected org.craftercms.commons.upgrade.UpgradePipelineFactory<String> dbPipelineFactory
      • bpPipelineFactory

        protected org.craftercms.commons.upgrade.UpgradePipelineFactory<String> bpPipelineFactory
      • configurationFile

        protected org.springframework.core.io.Resource configurationFile
      • integrityValidator

        protected org.craftercms.commons.entitlements.validator.DbIntegrityValidator integrityValidator
    • Constructor Detail

      • StudioUpgradeManagerImpl

        @ConstructorProperties({"dbVersionProvider","dbPipelineFactory","bpPipelineFactory","configurationFile","dataSource","integrityValidator","contentRepository","studioConfiguration","instanceService","retryingRepositoryOperationFacade"})
        public StudioUpgradeManagerImpl​(org.craftercms.commons.upgrade.VersionProvider dbVersionProvider,
                                        org.craftercms.commons.upgrade.UpgradePipelineFactory<String> dbPipelineFactory,
                                        org.craftercms.commons.upgrade.UpgradePipelineFactory<String> bpPipelineFactory,
                                        org.springframework.core.io.Resource configurationFile,
                                        DataSource dataSource,
                                        org.craftercms.commons.entitlements.validator.DbIntegrityValidator integrityValidator,
                                        ContentRepository contentRepository,
                                        StudioConfiguration studioConfiguration,
                                        InstanceService instanceService,
                                        RetryingRepositoryOperationFacade retryingRepositoryOperationFacade)
    • Method Detail

      • upgradeDatabaseAndConfiguration

        public void upgradeDatabaseAndConfiguration()
                                             throws org.craftercms.commons.upgrade.exception.UpgradeException,
                                                    org.craftercms.commons.config.ConfigurationException
        Executes all required upgrades for the system.
        Specified by:
        upgradeDatabaseAndConfiguration in interface StudioUpgradeManager
        Throws:
        org.craftercms.commons.upgrade.exception.UpgradeException - if any of the upgrades fails
        org.craftercms.commons.config.ConfigurationException
      • getVersionProvider

        protected org.craftercms.commons.upgrade.VersionProvider getVersionProvider​(String name,
                                                                                    Object... args)
      • getPipelineFactory

        protected org.craftercms.commons.upgrade.UpgradePipelineFactory<String> getPipelineFactory​(String factoryName)
      • doUpgrade

        public void doUpgrade​(org.craftercms.commons.upgrade.impl.UpgradeContext<String> context)
                       throws org.craftercms.commons.upgrade.exception.UpgradeException,
                              org.craftercms.commons.config.ConfigurationException
        Specified by:
        doUpgrade in class org.craftercms.commons.upgrade.impl.AbstractUpgradeManager<String>
        Throws:
        org.craftercms.commons.upgrade.exception.UpgradeException
        org.craftercms.commons.config.ConfigurationException
      • doGetTargets

        protected List<String> doGetTargets()
                                     throws Exception
        Specified by:
        doGetTargets in class org.craftercms.commons.upgrade.impl.AbstractUpgradeManager<String>
        Throws:
        Exception
      • createUpgradeContext

        protected org.craftercms.commons.upgrade.impl.UpgradeContext<String> createUpgradeContext​(String site)
        Specified by:
        createUpgradeContext in class org.craftercms.commons.upgrade.impl.AbstractUpgradeManager<String>
      • upgradeSiteConfiguration

        public void upgradeSiteConfiguration​(StudioUpgradeContext context)
                                      throws org.craftercms.commons.upgrade.exception.UpgradeException
        Executes the upgrades for all managed configurations in the given site.
        Specified by:
        upgradeSiteConfiguration in interface StudioUpgradeManager
        Parameters:
        context - the context for the upgrades
        Throws:
        org.craftercms.commons.upgrade.exception.UpgradeException - if any of the upgrades fails
      • upgradeExistingSites

        public void upgradeExistingSites()
                                  throws org.craftercms.commons.upgrade.exception.UpgradeException
        Executes the upgrades for all existing sites.
        Specified by:
        upgradeExistingSites in interface StudioUpgradeManager
        Throws:
        org.craftercms.commons.upgrade.exception.UpgradeException - if any of the upgrades fails
      • checkIfSiteRepoExists

        protected boolean checkIfSiteRepoExists​(String site)
      • upgradeBlueprints

        public void upgradeBlueprints()
                               throws org.craftercms.commons.upgrade.exception.UpgradeException,
                                      org.craftercms.commons.config.ConfigurationException
        Executes all required upgrades for the blueprints.
        Specified by:
        upgradeBlueprints in interface StudioUpgradeManager
        Throws:
        org.craftercms.commons.upgrade.exception.UpgradeException - if any of the upgrades fails
        org.craftercms.commons.config.ConfigurationException
      • startUpgrade

        @EventListener(StartUpgradeEvent.class)
        public void startUpgrade()
                          throws org.craftercms.commons.upgrade.exception.UpgradeException,
                                 org.craftercms.commons.entitlements.exception.EntitlementException,
                                 org.craftercms.commons.config.ConfigurationException
        Obtains the current version and starts the upgrade process.
        Throws:
        org.craftercms.commons.upgrade.exception.UpgradeException - if there is any error in the upgrade process
        org.craftercms.commons.entitlements.exception.EntitlementException - if there is any validation error after the upgrade process
        org.craftercms.commons.config.ConfigurationException
      • loadUpgradeConfiguration

        protected org.apache.commons.configuration2.HierarchicalConfiguration loadUpgradeConfiguration()
                                                                                                throws org.craftercms.commons.upgrade.exception.UpgradeException
        Throws:
        org.craftercms.commons.upgrade.exception.UpgradeException