Class AbstractDeployer
java.lang.Object
org.craftercms.studio.impl.v2.deployment.AbstractDeployer
- All Implemented Interfaces:
Deployer
- Direct Known Subclasses:
PreviewDeployer
,ServerlessDeliveryDeployer
Base abstract class for
Deployer
s. Provides the commons methods that call the Deployer APIs.- Author:
- avasquez
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected final org.craftercms.commons.rest.RestTemplate
protected static final String
protected static final String
protected final StudioConfiguration
protected static final String
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractDeployer
(StudioConfiguration studioConfiguration, org.craftercms.commons.rest.RestTemplate restTemplate) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addAdditionalParams
(Map<String, Object> params, org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> additionalParams) protected void
addChildParams
(Map<String, Object> childParams, org.apache.commons.configuration2.tree.ImmutableNode parentNode, org.apache.commons.configuration2.interpol.ConfigurationInterpolator interpolator) protected void
doCreateTarget
(String site, String environment, String template, boolean replace, boolean disableDeployCron, String localRepoPath, String repoUrl, org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> additionalParams) protected void
doDeleteTarget
(String site, String environment) protected void
doDuplicateTarget
(String sourceSiteId, String siteId, String env, String template, boolean replace, boolean disableDeployCron, String localRepoPath, String repoUrl, org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> additionalParams) Call Deployer API to duplicate a given targetgetCreateTargetRequestBody
(String site, String environment, String template, boolean replace, boolean disableDeployCron, String localRepoPath, String repoUrl, org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> additionalParams) protected abstract String
protected abstract String
getDeleteTargetUrl
(String site, String environment) getDuplicateTargetRequestBody
(String sourceSite, String site, String environment, String template, boolean replace, boolean disableDeployCron, String localRepoPath, String repoUrl, org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> additionalParams) Get the body parameters for the duplicate-target request.protected String
getDuplicateTargetUrl
(String sourceSiteId, String env) Get the URL of the Deployer API to duplicate a given targetprotected String
getRepoUrl
(String configKey, String site) getSourceTemplateParams
(String sourceSite) Get a source site parameters Map to pass to the target template.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.craftercms.studio.api.v2.deployment.Deployer
createTargets, deleteTargets, duplicateTargets
-
Field Details
-
ENV_TEMPLATE_PARAM
- See Also:
-
SITE_NAME_TEMPLATE_PARAM
- See Also:
-
TEMPLATE_NAME_TEMPLATE_PARAM
- See Also:
-
REPLACE_TEMPLATE_PARAM
- See Also:
-
DISABLE_DEPLOY_CRON_TEMPLATE_PARAM
- See Also:
-
SOURCE_TEMPLATE_PARAM
- See Also:
-
REPO_URL_TEMPLATE_PARAM
- See Also:
-
LOCAL_REPO_PATH_TEMPLATE_PARAM
- See Also:
-
restTemplate
protected final org.craftercms.commons.rest.RestTemplate restTemplate -
studioConfiguration
-
-
Constructor Details
-
AbstractDeployer
public AbstractDeployer(StudioConfiguration studioConfiguration, org.craftercms.commons.rest.RestTemplate restTemplate)
-
-
Method Details
-
doCreateTarget
protected void doCreateTarget(String site, String environment, String template, boolean replace, boolean disableDeployCron, String localRepoPath, String repoUrl, org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> additionalParams) throws IllegalStateException, org.springframework.web.client.RestClientException - Throws:
IllegalStateException
org.springframework.web.client.RestClientException
-
doDeleteTarget
-
getCreateTargetRequestBody
protected Map<String,Object> getCreateTargetRequestBody(String site, String environment, String template, boolean replace, boolean disableDeployCron, String localRepoPath, String repoUrl, org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> additionalParams) -
getDuplicateTargetRequestBody
protected Map<String,Object> getDuplicateTargetRequestBody(String sourceSite, String site, String environment, String template, boolean replace, boolean disableDeployCron, String localRepoPath, String repoUrl, org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> additionalParams) Get the body parameters for the duplicate-target request.- Parameters:
sourceSite
- the site to duplicate fromsite
- the new siteenvironment
- the target environment, e.g.: authoringtemplate
- the deployer target templatereplace
- true to replace the target if it already existsdisableDeployCron
- true to disable the deploy cron (e.g. for preview target)localRepoPath
- the local path to clone the repository. // TODO: this is used for serverless only, should this be a deployer config instead?)repoUrl
- the repository URLadditionalParams
- additional parameters to pass to the deployer to be consumed by the target template- Returns:
- a
Map
containing the parameters, preserving the hierarchical structure of the configuration parameters
-
getSourceTemplateParams
Get a source site parameters Map to pass to the target template. This is useful for deployer to get context on the duplicate source site- Parameters:
sourceSite
- the source site to duplicate from- Returns:
- a
Map
containing the parameters
-
addAdditionalParams
-
addChildParams
-
getRepoUrl
-
doDuplicateTarget
protected void doDuplicateTarget(String sourceSiteId, String siteId, String env, String template, boolean replace, boolean disableDeployCron, String localRepoPath, String repoUrl, org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> additionalParams) throws org.springframework.web.client.RestClientException Call Deployer API to duplicate a given target- Parameters:
sourceSiteId
- the site to duplicate fromsiteId
- the new site idenv
- the target environment, e.g.: authoringtemplate
- the deployer target templatereplace
- true to replace the target if it already existsdisableDeployCron
- true to disable the deploy cron (e.g. for preview target)localRepoPath
- the local path to clone the repository. // TODO: this is used for serverless only, should this be a deployer config instead?)repoUrl
- the repository URLadditionalParams
- additional parameters to pass to the deployer to be consumed by the target template- Throws:
org.springframework.web.client.RestClientException
- if an error occurs while calling Deployer API
-
getDuplicateTargetUrl
Get the URL of the Deployer API to duplicate a given target- Parameters:
sourceSiteId
- the site to duplicate fromenv
- the target environment, e.g.: authoring- Returns:
- the URL of the Deployer API to duplicate a given target
-
getCreateTargetUrl
-
getDeleteTargetUrl
-