Package org.craftercms.deployer.impl
Class TargetImpl
java.lang.Object
org.craftercms.deployer.impl.TargetImpl
- All Implemented Interfaces:
Target
Default implementation of
Target
.- Author:
- avasquez
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
protected class
Nested classes/interfaces inherited from interface org.craftercms.deployer.api.Target
Target.Status
-
Field Summary
Modifier and TypeFieldDescriptionprotected final org.springframework.context.ConfigurableApplicationContext
protected final org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode>
protected final File
protected Deployment
protected final Lock
protected DeploymentPipeline
protected final DeploymentPipelineFactory
protected final String
protected final ExecutorService
protected final ZonedDateTime
protected final String
protected final Queue<Deployment>
protected ScheduledFuture<?>
protected final org.springframework.scheduling.TaskScheduler
protected final String
protected Target.Status
static final String
protected final TargetLifecycleHooksResolver
Fields inherited from interface org.craftercms.deployer.api.Target
AUTHORING_ENV
-
Constructor Summary
ConstructorDescriptionTargetImpl
(String env, String siteName, String localRepoPath, File configurationFile, org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> configuration, org.springframework.context.ConfigurableApplicationContext applicationContext, ExecutorService executor, org.springframework.scheduling.TaskScheduler scheduler, TargetLifecycleHooksResolver targetLifecycleHooksResolver, DeploymentPipelineFactory deploymentPipelineFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Performs a cleanup of the local repository.static void
clear()
void
close()
Closes the target, releases any open resources and stops any running threads associated to the target.void
delete()
Deletes the target, executing any delete hooks.Starts a new deployment for the target (asynchronous operation ifwaitTillDone
is false).boolean
Returns all deployments (pending and current).org.springframework.context.ConfigurableApplicationContext
Returns this target's Spring application contextorg.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode>
Returns the configuration of the target.Returns the YAML configuration file of the target.static Target
Returns the current deployment.protected List<TargetLifecycleHook>
getEnv()
Returns the environment of the target.getId()
Returns the ID of the target.static String
protected List<TargetLifecycleHook>
Returns the load date of the target.Returns the pending deployments.Returns the site name of the target.Returns the status of the targetint
hashCode()
void
init()
Starts the initialization of the target (asynchronous operation).protected void
static void
setCurrent
(Target target) protected void
toString()
void
unlock()
Deletes the git lock file is present in the local repository.
-
Field Details
-
TARGET_ID_FORMAT
- See Also:
-
loadDate
-
env
-
siteName
-
localRepoPath
-
configurationFile
-
configuration
protected final org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> configuration -
applicationContext
protected final org.springframework.context.ConfigurableApplicationContext applicationContext -
executor
-
scheduler
protected final org.springframework.scheduling.TaskScheduler scheduler -
targetLifecycleHooksResolver
-
deploymentPipelineFactory
-
status
-
deploymentPipeline
-
scheduledDeploymentFuture
-
pendingDeployments
-
currentDeployment
-
deploymentLock
-
-
Constructor Details
-
TargetImpl
public TargetImpl(@Value("${target.env}") String env, @Value("${target.siteName}") String siteName, @Value("${target.localRepoPath}") String localRepoPath, @Value("${target.configFile}") File configurationFile, @Autowired org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> configuration, @Autowired org.springframework.context.ConfigurableApplicationContext applicationContext, @Autowired ExecutorService executor, @Autowired org.springframework.scheduling.TaskScheduler scheduler, @Autowired TargetLifecycleHooksResolver targetLifecycleHooksResolver, @Autowired DeploymentPipelineFactory deploymentPipelineFactory)
-
-
Method Details
-
setCurrent
-
getCurrent
-
clear
public static void clear() -
getId
-
getEnv
Description copied from interface:Target
Returns the environment of the target. -
getSiteName
Description copied from interface:Target
Returns the site name of the target.- Specified by:
getSiteName
in interfaceTarget
-
getId
Description copied from interface:Target
Returns the ID of the target. -
getLoadDate
Description copied from interface:Target
Returns the load date of the target.- Specified by:
getLoadDate
in interfaceTarget
-
getStatus
Description copied from interface:Target
Returns the status of the target -
getConfigurationFile
Description copied from interface:Target
Returns the YAML configuration file of the target.- Specified by:
getConfigurationFile
in interfaceTarget
-
getConfiguration
public org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> getConfiguration()Description copied from interface:Target
Returns the configuration of the target.- Specified by:
getConfiguration
in interfaceTarget
-
getApplicationContext
public org.springframework.context.ConfigurableApplicationContext getApplicationContext()Description copied from interface:Target
Returns this target's Spring application context- Specified by:
getApplicationContext
in interfaceTarget
-
init
public void init()Description copied from interface:Target
Starts the initialization of the target (asynchronous operation). Called when the create target API is called or the target config is loaded. -
deploy
public Deployment deploy(boolean waitTillDone, Map<String, Object> params) throws TargetNotReadyExceptionDescription copied from interface:Target
Starts a new deployment for the target (asynchronous operation ifwaitTillDone
is false).- Specified by:
deploy
in interfaceTarget
- Parameters:
waitTillDone
- if the method should wait till the deployment is done or return immediatelyparams
- miscellaneous parameters that can be used by the processors.- Returns:
- the deployment info
- Throws:
TargetNotReadyException
- if the target is not inTarget.Status.INIT_COMPLETED
-
getPendingDeployments
Description copied from interface:Target
Returns the pending deployments.- Specified by:
getPendingDeployments
in interfaceTarget
-
getCurrentDeployment
Description copied from interface:Target
Returns the current deployment.- Specified by:
getCurrentDeployment
in interfaceTarget
-
getAllDeployments
Description copied from interface:Target
Returns all deployments (pending and current).- Specified by:
getAllDeployments
in interfaceTarget
-
cleanRepo
public void cleanRepo()Performs a cleanup of the local repository. -
close
public void close()Description copied from interface:Target
Closes the target, releases any open resources and stops any running threads associated to the target. -
delete
public void delete()Description copied from interface:Target
Deletes the target, executing any delete hooks. CallsTarget.close()
too. -
unlock
public void unlock()Description copied from interface:Target
Deletes the git lock file is present in the local repository. -
getInitHooks
protected List<TargetLifecycleHook> getInitHooks() throws DeployerException, org.craftercms.commons.config.ConfigurationException- Throws:
DeployerException
org.craftercms.commons.config.ConfigurationException
-
getDeleteHooks
protected List<TargetLifecycleHook> getDeleteHooks() throws DeployerException, org.craftercms.commons.config.ConfigurationException- Throws:
DeployerException
org.craftercms.commons.config.ConfigurationException
-
scheduleDeployments
protected void scheduleDeployments() throws org.craftercms.commons.config.ConfigurationException- Throws:
org.craftercms.commons.config.ConfigurationException
-
stopDeployments
protected void stopDeployments() -
equals
-
hashCode
public int hashCode() -
toString
-