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 ofUpgradeContext
that holds all relevant information for a system or site upgrade. Thetarget
object is the name of the site being upgraded.- Since:
- 4.0.0
- Author:
- joseross
-
-
Field Summary
Fields Modifier and Type Field Description static String
COMMIT_IDENTIFIER_FORMAT
protected String
currentConfigName
The name of the config file being upgradedprotected String
currentConfigPath
The path of the config file being upgradedprotected DataSource
dataSource
The database data source.protected InstanceService
instanceService
The instance serviceprotected RetryingRepositoryOperationFacade
retryingRepositoryOperationFacade
protected StudioConfiguration
studioConfiguration
Studio configuration
-
Constructor Summary
Constructors Constructor Description StudioUpgradeContext(String target, StudioConfiguration studioConfiguration, DataSource dataSource, InstanceService instanceService, RetryingRepositoryOperationFacade retryingRepositoryOperationFacade)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearCurrentConfig()
void
commitChanges(String message, List<String> changedFiles, List<String> deletedFiles)
Commits all changes for the given files in the repository of the site being upgraded.Connection
getConnection()
String
getCurrentConfigName()
String
getCurrentConfigPath()
DataSource
getDataSource()
Path
getFile(String path)
Returns the file as an absolute pathprotected String
getIdentifier()
Returns the identifier for this particular Studio instanceString
getRelativePath(Path file)
Returns the relative path of the file based on the site repositoryPath
getRepositoryPath()
Returns the absolute path of the repository being upgraded.boolean
isConfigPresent()
Indicates if the upgrade is for a specific configuration file.void
setCurrentConfigName(String currentConfigName)
void
setCurrentConfigPath(String currentConfigPath)
String
toString()
-
-
-
Field Detail
-
COMMIT_IDENTIFIER_FORMAT
public static final String COMMIT_IDENTIFIER_FORMAT
- See Also:
- Constant Field Values
-
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 Detail
-
StudioUpgradeContext
public StudioUpgradeContext(String target, StudioConfiguration studioConfiguration, DataSource dataSource, InstanceService instanceService, RetryingRepositoryOperationFacade retryingRepositoryOperationFacade)
-
-
Method Detail
-
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 messagechangedFiles
- the list of changed filesdeletedFiles
- the list of deleted files- Throws:
Exception
-
getIdentifier
protected String getIdentifier()
Returns the identifier for this particular Studio instance
-
-