public void undeployArtifacts(CarbonApplication carbonApp, AxisConfiguration axisConfig) {
    List<Artifact.Dependency> artifacts =
        carbonApp.getAppConfig().getApplicationArtifact().getDependencies();

    for (Artifact.Dependency dep : artifacts) {
      EventProcessingDeployer deployer;
      Artifact artifact = dep.getArtifact();
      if (artifact == null) {
        continue;
      }

      deployer = getDeployer(artifact, axisConfig);

      List<CappFile> files = artifact.getFiles();
      if (files.size() != 1) {
        log.error("Artifact must have only a single file. But " + files.size() + " files found.");
        continue;
      }

      if (deployer != null
          && AppDeployerConstants.DEPLOYMENT_STATUS_DEPLOYED.equals(
              artifact.getDeploymentStatus())) {
        String fileName = artifact.getFiles().get(0).getName();
        String artifactPath = artifact.getExtractedPath() + File.separator + fileName;
        try {
          deployer.processUndeployment(artifactPath);
          artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_PENDING);
          File artifactFile = new File(artifactPath);
          if (artifactFile.exists() && !artifactFile.delete()) {
            log.warn("Couldn't delete App artifact file : " + artifactPath);
          }
        } catch (Exception e) {
          artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_FAILED);
          log.error(
              "Error occured while trying to undeploy : "
                  + artifact.getName()
                  + " due to "
                  + e.getMessage(),
              e);
        }
      }
    }
  }
 void deploy(EventProcessingDeployer deployer, Artifact artifact) throws DeploymentException {
   List<CappFile> files = artifact.getFiles();
   String fileName = artifact.getFiles().get(0).getName();
   String artifactPath = artifact.getExtractedPath() + File.separator + fileName;
   try {
     deployer.processDeployment(new DeploymentFileData(new File(artifactPath), deployer));
     artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_DEPLOYED);
   } catch (Exception e) {
     artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_FAILED);
     log.error("Deployment is failed due to " + e.getMessage(), e);
     throw new DeploymentException(e.getMessage(), e);
   }
 }