Package org.craftercms.deployer.api
Interface TargetService
-
- All Known Implementing Classes:
TargetServiceImpl
public interface TargetService
Service that manages targets.- Author:
- avasquez
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Target
createTarget(String env, String siteName, boolean replace, String templateName, Map<String,Object> templateParams)
Creates a new target with it's own configuration.void
deleteTarget(String env, String siteName)
Deletes a target with the given ID.List<Target>
getAllTargets()
Returns all targets.Target
getTarget(String env, String siteName)
Returns the current target with the given IDvoid
recreateIndex(String env, String siteName)
Recreates the underlying Elasticsearch index for a given targetList<Target>
resolveTargets()
Scans for target configurations, loading targets with new/modified configuration and unloading targets with no configuration.boolean
targetExists(String env, String siteName)
Returns true if the target associated to the env and site name exists.
-
-
-
Method Detail
-
targetExists
boolean targetExists(String env, String siteName) throws TargetServiceException
Returns true if the target associated to the env and site name exists.- Parameters:
env
- the target's environment (e.g. dev)siteName
- the target's site name (e.g. mysite)- Returns:
- true if the target exists, false otherwise
- Throws:
TargetServiceException
- if a general error occurs
-
createTarget
Target createTarget(String env, String siteName, boolean replace, String templateName, Map<String,Object> templateParams) throws TargetAlreadyExistsException, TargetServiceException
Creates a new target with it's own configuration. Creating a target also triggers its create lifecycle hooks.- Parameters:
env
- the target's environment (e.g. dev)siteName
- the target's site name (e.g. mysite)replace
- indicates that if there's a target with the same name, the target config should be replaced.templateName
- the name of the template used to create the target configuration (can be null).templateParams
- the parameters that the template needs.- Returns:
- the created target
- Throws:
TargetAlreadyExistsException
- if the target for the specified env and site name already existsTargetServiceException
- if a general error occurs
-
deleteTarget
void deleteTarget(String env, String siteName) throws TargetNotFoundException, TargetServiceException
Deletes a target with the given ID. Deleting the target also triggers its delete lifecycle hooks.- Parameters:
env
- the target's environment (e.g. dev)siteName
- the target's site name (e.g. mysite)- Throws:
TargetNotFoundException
- if the target for the specified env and site name doesn't existTargetServiceException
- if a general error occurs
-
resolveTargets
List<Target> resolveTargets() throws TargetServiceException
Scans for target configurations, loading targets with new/modified configuration and unloading targets with no configuration. This method triggers no lifecycle hooks.- Returns:
- existing targets, after being loaded
- Throws:
TargetServiceException
- if a general error occurs
-
getAllTargets
List<Target> getAllTargets() throws TargetServiceException
Returns all targets.- Returns:
- the list of targets
- Throws:
TargetServiceException
- if a general error occurs
-
getTarget
Target getTarget(String env, String siteName) throws TargetNotFoundException, TargetServiceException
Returns the current target with the given ID- Parameters:
env
- the target's environment (e.g. dev)siteName
- the target's site name (e.g. mysite)- Returns:
- the target info
- Throws:
TargetNotFoundException
- if the target for the specified env and site name doesn't existTargetServiceException
- if a general error occurs
-
recreateIndex
void recreateIndex(String env, String siteName) throws TargetNotFoundException
Recreates the underlying Elasticsearch index for a given target- Parameters:
env
- the target's environment (e.g. dev)siteName
- the target's site name (e.g. mysite)- Throws:
TargetNotFoundException
- if the target for the specified env and site name doesn't exist
-
-