View Javadoc
1   package org.codehaus.mojo.webstart.util;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.maven.artifact.Artifact;
23  import org.apache.maven.artifact.repository.ArtifactRepository;
24  import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
25  import org.apache.maven.plugin.MojoExecutionException;
26  import org.apache.maven.project.MavenProject;
27  import org.codehaus.mojo.webstart.JarResource;
28  
29  import java.util.List;
30  import java.util.Map;
31  import java.util.Set;
32  
33  /**
34   * Some usefull methods on artifacts.
35   *
36   * @author tchemit <chemit@codelutin.com>
37   * @since 1.0-beta-4
38   */
39  public interface ArtifactUtil
40  {
41  
42      /**
43       * Plexus component role.
44       */
45      String ROLE = ArtifactUtil.class.getName();
46  
47      /**
48       * Tests if the given fully qualified name exists in the given artifact.
49       *
50       * @param artifact  artifact to test
51       * @param mainClass the fully qualified name to find in artifact
52       * @return {@code true} if given artifact contains the given fqn, {@code false} otherwise
53       * @throws MojoExecutionException if artifact file url is mal formed
54       */
55      public boolean artifactContainsClass( Artifact artifact, final String mainClass )
56          throws MojoExecutionException;
57  
58      /**
59       * Creates from the given jar resource the underlying artifact.
60       *
61       * @param jarResource the jar resource
62       * @return the created artifact from the given jar resource
63       */
64      Artifact createArtifact( JarResource jarResource );
65  
66      MavenProject resolveFromReactor( Artifact artifact, MavenProject mavenProject, List<MavenProject> reactorProjects )
67          throws MojoExecutionException;
68  
69  
70      void resolveFromRepositories( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository )
71          throws MojoExecutionException;
72  
73      Set<Artifact> resolveTransitively( Set<Artifact> jarResourceArtifacts, Set<MavenProject> siblingProjects,
74                                         Artifact artifact, ArtifactRepository localRepository,
75                                         List<ArtifactRepository> remoteRepositories, ArtifactFilter artifactFilter, Map managedVersions)
76          throws MojoExecutionException;
77  }