Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: f6e1c2de5261af885c8147c435fbd75dad305e98 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*******************************************************************************
 * Copyright (c) 2008 Sonatype, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/

package org.eclipse.m2e.cliresolver30;

import java.io.File;
import java.util.List;

import org.codehaus.plexus.component.annotations.Component;

import org.sonatype.aether.repository.WorkspaceReader;
import org.sonatype.aether.repository.WorkspaceRepository;

import org.eclipse.m2e.cli.WorkspaceState;


/**
 * Enables workspace resolution in Maven 3.0-beta-3 and newer.
 */
@Component(role = WorkspaceReader.class, hint = "ide")
public final class EclipseWorkspaceReader implements WorkspaceReader {

  private WorkspaceRepository workspaceRepository;

  public EclipseWorkspaceReader() {
    this.workspaceRepository = new WorkspaceRepository("ide", getClass());
  }

  @Override
  public int hashCode() {
    return getClass().hashCode(); // no state
  }

  @Override
  public boolean equals(Object obj) {
    return obj instanceof EclipseWorkspaceReader;
  }

  public WorkspaceRepository getRepository() {
    return workspaceRepository;
  }

  public File findArtifact(org.sonatype.aether.artifact.Artifact artifact) {
    return WorkspaceState.findArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getExtension(),
        artifact.getClassifier(), artifact.getBaseVersion());
  }

  public List<String> findVersions(org.sonatype.aether.artifact.Artifact artifact) {
    return WorkspaceState.findVersions(artifact.getGroupId(), artifact.getArtifactId());
  }

}

Back to the top