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 Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected StringThe name of the config file being upgradedprotected StringThe path of the config file being upgradedprotected DataSourceThe database data source.protected InstanceServiceThe instance serviceprotected RetryingRepositoryOperationFacadeprotected StudioConfigurationStudio configurationFields inherited from class org.craftercms.commons.upgrade.impl.UpgradeContext
target -
Constructor Summary
ConstructorsConstructorDescriptionStudioUpgradeContext(String target, StudioConfiguration studioConfiguration, DataSource dataSource, InstanceService instanceService, RetryingRepositoryOperationFacade retryingRepositoryOperationFacade) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidCommits all changes for the given files in the repository of the site being upgraded.Returns the file as an absolute pathprotected StringReturns the identifier for this particular Studio instancegetRelativePath(Path file) Returns the relative path of the file based on the site repositoryReturns the absolute path of the repository being upgraded.booleanIndicates if the upgrade is for a specific configuration file.voidsetCurrentConfigName(String currentConfigName) voidsetCurrentConfigPath(String currentConfigPath) toString()Methods inherited from class org.craftercms.commons.upgrade.impl.UpgradeContext
getTarget
-
Field Details
-
COMMIT_IDENTIFIER_FORMAT
- See Also:
-
studioConfiguration
Studio configuration -
dataSource
The database data source. -
instanceService
The instance service -
currentConfigName
The name of the config file being upgraded -
currentConfigPath
The path of the config file being upgraded -
retryingRepositoryOperationFacade
-
-
Constructor Details
-
StudioUpgradeContext
public StudioUpgradeContext(String target, StudioConfiguration studioConfiguration, DataSource dataSource, InstanceService instanceService, RetryingRepositoryOperationFacade retryingRepositoryOperationFacade)
-
-
Method Details
-
getDataSource
-
getConnection
- Throws:
SQLException
-
getCurrentConfigName
-
setCurrentConfigName
-
getCurrentConfigPath
-
setCurrentConfigPath
-
isConfigPresent
public boolean isConfigPresent()Indicates if the upgrade is for a specific configuration file. -
clearCurrentConfig
public void clearCurrentConfig() -
getRepositoryPath
Returns the absolute path of the repository being upgraded. -
getRelativePath
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 messagechangedFiles- the list of changed filesdeletedFiles- the list of deleted files- Throws:
Exception
-
getIdentifier
Returns the identifier for this particular Studio instance -
getFile
Returns the file as an absolute path -
toString
- Overrides:
toStringin classorg.craftercms.commons.upgrade.impl.UpgradeContext<String>
-