/** {@inheritDoc} */
  public Tree<InstallArtifact> recoverInstallTree(
      File sourceFile, DeploymentOptions deploymentOptions) {
    ArtifactStorage artifactStorage = null;
    if (deploymentOptions.getRecoverable()
        && (!deploymentOptions.getDeployerOwned() || sourceFile.exists())) {
      try {
        ArtifactIdentity artifactIdentity = determineIdentity(sourceFile);
        artifactStorage = this.artifactStorageFactory.create(sourceFile, artifactIdentity);
        Tree<InstallArtifact> installArtifactTree =
            constructInstallArtifactTree(artifactIdentity, null, artifactStorage, null);

        return installArtifactTree;
      } catch (RuntimeException e) {
        if (artifactStorage != null) {
          artifactStorage.delete();
        }
        this.logger.error(
            String.format("An error occurred during recovery of artefact '%s'", sourceFile), e);
        throw e;
      } catch (DeploymentException e) {
        artifactStorage.delete();
        this.logger.warn(
            String.format("An error occurred during recovery of artefact '%s'", sourceFile), e);
        return null;
      }
    }
    return null;
  }
  /** {@inheritDoc} */
  public Tree<InstallArtifact> createInstallTree(File sourceFile) throws DeploymentException {

    if (!sourceFile.exists()) {
      throw new DeploymentException(sourceFile + " does not exist");
    }

    ArtifactIdentity artifactIdentity = determineIdentity(sourceFile);

    ArtifactStorage artifactStorage = null;
    try {
      artifactStorage = this.artifactStorageFactory.create(sourceFile, artifactIdentity);

      Tree<InstallArtifact> installArtifactTree =
          constructInstallArtifactTree(artifactIdentity, null, artifactStorage, null);
      return installArtifactTree;
    } catch (DeploymentException e) {
      artifactStorage.delete();
      throw e;
    } catch (Exception e) {
      throw new DeploymentException(e.getMessage(), e);
    }
  }