View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.archetype.common;
20  
21  import java.io.File;
22  import java.io.IOException;
23  import java.util.List;
24  import java.util.zip.ZipFile;
25  
26  import org.apache.maven.archetype.exception.UnknownArchetype;
27  import org.apache.maven.archetype.metadata.ArchetypeDescriptor;
28  import org.apache.maven.model.Model;
29  import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
30  import org.eclipse.aether.RepositorySystemSession;
31  import org.eclipse.aether.repository.RemoteRepository;
32  
33  public interface ArchetypeArtifactManager {
34  
35      Model getArchetypePom(File jar) throws XmlPullParserException, UnknownArchetype, IOException;
36  
37      File getArchetypeFile(
38              String groupId,
39              String artifactId,
40              String version,
41              List<RemoteRepository> repositories,
42              RepositorySystemSession repositorySystemSession)
43              throws UnknownArchetype;
44  
45      /**
46       */
47      ClassLoader getArchetypeJarLoader(File archetypeFile) throws UnknownArchetype;
48  
49      /**
50       */
51      ZipFile getArchetypeZipFile(File archetypeFile) throws UnknownArchetype;
52  
53      /**
54       */
55      boolean isFileSetArchetype(File archetypeFile);
56  
57      /**
58       */
59      boolean isOldArchetype(File archetypeFile);
60  
61      boolean exists(
62              String archetypeGroupId,
63              String archetypeArtifactId,
64              String archetypeVersion,
65              List<RemoteRepository> repos,
66              RepositorySystemSession repositorySystemSession);
67  
68      /**
69       * Get the archetype file's post-generation script content, read as UTF-8 content.
70       *
71       * @param archetypeFile the archetype file
72       * @return the archetype file's post-generation script content or <code>null</code> if there is no script in the
73       *   archetype
74       * @throws UnknownArchetype
75       */
76      String getPostGenerationScript(File archetypeFile) throws UnknownArchetype;
77  
78      /**
79       */
80      ArchetypeDescriptor getFileSetArchetypeDescriptor(File archetypeFile) throws UnknownArchetype;
81  
82      /**
83       */
84      List<String> getFilesetArchetypeResources(File archetypeFile) throws UnknownArchetype;
85  
86      /**
87       */
88      org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor getOldArchetypeDescriptor(File archetypeFile)
89              throws UnknownArchetype;
90  }