Class StudioUpgradeContext

java.lang.Object
org.craftercms.commons.upgrade.impl.UpgradeContext<String>
org.craftercms.studio.impl.v2.upgrade.StudioUpgradeContext

public class StudioUpgradeContext extends org.craftercms.commons.upgrade.impl.UpgradeContext<String>
Extension of UpgradeContext that holds all relevant information for a system or site upgrade. The target object is the name of the site being upgraded.
Since:
4.0.0
Author:
joseross
  • Field Details

    • COMMIT_IDENTIFIER_FORMAT

      public static final String COMMIT_IDENTIFIER_FORMAT
      See Also:
    • studioConfiguration

      protected StudioConfiguration studioConfiguration
      Studio configuration
    • dataSource

      protected DataSource dataSource
      The database data source.
    • instanceService

      protected InstanceService instanceService
      The instance service
    • currentConfigName

      protected String currentConfigName
      The name of the config file being upgraded
    • currentConfigPath

      protected String currentConfigPath
      The path of the config file being upgraded
    • retryingRepositoryOperationFacade

      protected RetryingRepositoryOperationFacade retryingRepositoryOperationFacade
  • Constructor Details

  • Method Details

    • getDataSource

      public DataSource getDataSource()
    • getConnection

      public Connection getConnection() throws SQLException
      Throws:
      SQLException
    • getCurrentConfigName

      public String getCurrentConfigName()
    • setCurrentConfigName

      public void setCurrentConfigName(String currentConfigName)
    • getCurrentConfigPath

      public String getCurrentConfigPath()
    • setCurrentConfigPath

      public void setCurrentConfigPath(String currentConfigPath)
    • isConfigPresent

      public boolean isConfigPresent()
      Indicates if the upgrade is for a specific configuration file.
    • clearCurrentConfig

      public void clearCurrentConfig()
    • getRepositoryPath

      public Path getRepositoryPath()
      Returns the absolute path of the repository being upgraded.
    • getRelativePath

      public String getRelativePath(Path file)
      Returns the relative path of the file based on the site repository
    • commitChanges

      public void commitChanges(String message, List<String> changedFiles, List<String> deletedFiles) throws Exception
      Commits all changes for the given files in the repository of the site being upgraded.
      Parameters:
      message - the commit message
      changedFiles - the list of changed files
      deletedFiles - the list of deleted files
      Throws:
      Exception
    • getIdentifier

      protected String getIdentifier()
      Returns the identifier for this particular Studio instance
    • getFile

      public Path getFile(String path)
      Returns the file as an absolute path
    • toString

      public String toString()
      Overrides:
      toString in class org.craftercms.commons.upgrade.impl.UpgradeContext<String>