/** {@inheritDoc} */
  public Tree<InstallArtifact> createInstallTree(
      ArtifactSpecification specification, String scopeName) throws DeploymentException {
    String type = specification.getType();
    String name = specification.getName();
    VersionRange versionRange = specification.getVersionRange();
    RepositoryAwareArtifactDescriptor artifactDescriptor =
        this.repository.get(type, name, versionRange);
    if (artifactDescriptor == null) {
      this.eventLogger.log(
          DeployerLogEvents.ARTIFACT_NOT_FOUND,
          type,
          name,
          versionRange,
          this.repository.getName());
      throw new DeploymentException(
          type + " '" + name + "' version '" + versionRange + "' not found");
    }

    URI artifactURI = artifactDescriptor.getUri();

    ArtifactIdentity identity =
        new ArtifactIdentity(type, name, artifactDescriptor.getVersion(), scopeName);
    identity = ArtifactIdentityScoper.scopeArtifactIdentity(identity);

    ArtifactStorage artifactStorage =
        this.artifactStorageFactory.create(new File(artifactURI), identity);

    Tree<InstallArtifact> installArtifactTree =
        constructInstallArtifactTree(
            identity,
            specification.getProperties(),
            artifactStorage,
            artifactDescriptor.getRepositoryName());
    return installArtifactTree;
  }
 /** {@inheritDoc} */
 public void addArtifactDescriptor(RepositoryAwareArtifactDescriptor artifactDescriptor)
     throws IllegalArgumentException, DuplicateArtifactException {
   if (artifactDescriptor == null) {
     throw new IllegalArgumentException("Argument can not be null");
   }
   synchronized (this.artifactsLock) {
     if (this.artifactDescriptors.contains(artifactDescriptor)) {
       RepositoryAwareArtifactDescriptor original = null;
       for (RepositoryAwareArtifactDescriptor temp : this.artifactDescriptors) {
         if (temp.equals(artifactDescriptor)) {
           original = temp;
         }
       }
       throw new DuplicateArtifactException(original, artifactDescriptor);
     }
     this.artifactDescriptors.add(artifactDescriptor);
     this.index.addArtifactDescriptor(artifactDescriptor);
   }
 }