Interface TargetService

  • All Known Implementing Classes:
    TargetServiceImpl

    public interface TargetService
    Service that manages targets.
    Author:
    avasquez
    • 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 exists
        TargetServiceException - 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
      • 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