Class ProjectDeploymentValidator


  • public class ProjectDeploymentValidator
    extends Object
    This class can be used to validate Projects before deploying them on the server.
    Warning: this class works only on the server.
    API:
    This is a public API.
    • Method Detail

      • prepareIvyProject

        public IIvyProject prepareIvyProject​(File projectDirectory,
                                             IProcessModel processModel,
                                             IProgressMonitor progressMonitor)
                                      throws Exception
        Uses the project under projectDirectory to mock a project which is not yet deployed. Use this method only if you intend to add a new process model version to an existing process model. Otherwise use prepareIvyProject(File, IApplication, IProgressMonitor) or prepareIvyProject(File, IProcessModelVersion, IProgressMonitor)
        Warning: this methods works only on the server.
        Parameters:
        projectDirectory - it points to a directory, where the extracted ivy project is located on the server (neither *.iar nor *.zip files are supported)
        processModel - the process model for which a new process model version is going to be created to deploy the project.
        progressMonitor - may be null
        Returns:
        the IIvyProject to access the mocked Project
        Throws:
        Exception
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • validate

        public List<ch.ivyteam.ivy.deployment.restricted.IProjectDeploymentValidationIssue> validate​(IIvyProject project,
                                                                                                     IProgressMonitor progressMonitor)

        Validates the IIvyProject and returns a list containing an IProjectDeploymentValidationIssue for each issue found.

        To get the IIvyProject for a project, which is not deployed yet, use one of the prepareIvyProject methods.

        If there are multiple projects to be validated before deployment, then mock all projects before validating them. Mocking all deployable projects ensures that even those dependent projects become visible for validation, which are not deployed yet. For example:

         ProjectDeploymentValidator validator = ProjectDeployment.newDeploymentValidator()
         IIvyProject projectA = validator.prepareIvyProject(dirA, myApp, monitor);
         IIvyProject projectB = validator.prepareIvyProject(dirB, myApp, monitor);
         
         List<IProjectDeploymentValidationIssue> issuesA = validator.validate(projectA, monitor);
         List<IProjectDeploymentValidationIssue> issuesB = validator.validate(projectB, monitor);
         

        Parameters:
        project - an ivy project reference (you might get it e.g. invoking prepareIvyProject(File, IApplication, IProgressMonitor) )
        progressMonitor - may be null.
        Returns:
        a List of IProjectDeploymentValidationIssues. Never null.
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • finishValidation

        public void finishValidation()

        Call this when the validation is finished to clean up temporary allocated resources. Call this before the actual deployment.

        Any ivy projects, that have been mocked with prepareIvyProject(File, IApplication, IProgressMonitor) must not be used after finishValidation() was called.

        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.