View Javadoc
1   package org.apache.maven.archetype.common;
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.archetype.exception.UnknownArchetype;
23  import org.apache.maven.archetype.metadata.ArchetypeDescriptor;
24  import org.apache.maven.artifact.repository.ArtifactRepository;
25  import org.apache.maven.model.Model;
26  import org.apache.maven.project.ProjectBuildingRequest;
27  import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
28  
29  import java.io.File;
30  import java.io.IOException;
31  
32  import java.util.List;
33  import java.util.zip.ZipFile;
34  
35  public interface ArchetypeArtifactManager
36  {
37      String ROLE = ArchetypeArtifactManager.class.getName ();
38  
39      Model getArchetypePom ( File jar )
40          throws XmlPullParserException, UnknownArchetype, IOException;
41  
42      /**
43       * @param buildingRequest TODO
44       */
45      File getArchetypeFile( String groupId, String artifactId, String version,
46                             ArtifactRepository archetypeRepository, ArtifactRepository localRepository,
47                             List<ArtifactRepository> repositories, ProjectBuildingRequest buildingRequest )
48          throws UnknownArchetype;
49  
50      /**
51       */
52      ClassLoader getArchetypeJarLoader( File archetypeFile )
53          throws UnknownArchetype;
54  
55      /**
56       */
57      ZipFile getArchetypeZipFile( File archetypeFile )
58          throws UnknownArchetype;
59  
60      /**
61       */
62      boolean isFileSetArchetype( File archetypeFile );
63  
64      /**
65       * @param buildingRequest TODO
66       */
67      boolean isFileSetArchetype( String groupId, String artifactId, String version,
68                                  ArtifactRepository archetypeRepository, ArtifactRepository localRepository,
69                                  List<ArtifactRepository> repositories, ProjectBuildingRequest buildingRequest );
70  
71      /**
72       */
73      boolean isOldArchetype( File archetypeFile );
74  
75      /**
76       * @param buildingRequest TODO
77       */
78      boolean isOldArchetype( String groupId, String artifactId, String version, ArtifactRepository archetypeRepository,
79                              ArtifactRepository localRepository, List<ArtifactRepository> repositories,
80                              ProjectBuildingRequest buildingRequest );
81  
82      /**
83       * @param buildingRequest TODO
84       */
85      boolean exists( String archetypeGroupId, String archetypeArtifactId, String archetypeVersion,
86                      ArtifactRepository archetypeRepository, ArtifactRepository localRepository,
87                      List<ArtifactRepository> repos, ProjectBuildingRequest buildingRequest );
88  
89      /**
90       * Get the archetype file's post-generation script content, read as UTF-8 content.
91       * 
92       * @param archetypeFile the archetype file
93       * @return the archetype file's post-generation script content or <code>null</code> if there is no script in the
94       *   archetype
95       * @throws UnknownArchetype
96       */
97      String getPostGenerationScript( File archetypeFile )
98          throws UnknownArchetype;
99  
100     /**
101      */
102     ArchetypeDescriptor getFileSetArchetypeDescriptor( File archetypeFile )
103         throws UnknownArchetype;
104 
105     /**
106      * @param buildingRequest TODO
107      */
108     ArchetypeDescriptor getFileSetArchetypeDescriptor( String groupId, String artifactId, String version,
109                                                        ArtifactRepository archetypeRepository,
110                                                        ArtifactRepository localRepository,
111                                                        List<ArtifactRepository> repositories,
112                                                        ProjectBuildingRequest buildingRequest )
113         throws UnknownArchetype;
114 
115     /**
116      */
117     List<String> getFilesetArchetypeResources( File archetypeFile )
118         throws UnknownArchetype;
119 
120     /**
121      */
122     org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor getOldArchetypeDescriptor( File archetypeFile )
123         throws UnknownArchetype;
124 
125     /**
126      * @param buildingRequest TODO
127      */
128     org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor getOldArchetypeDescriptor( String groupId,
129                                                                      String artifactId,
130                                                                      String version,
131                                                                      ArtifactRepository archetypeRepository,
132                                                                      ArtifactRepository localRepository,
133                                                                      List<ArtifactRepository> repositories,
134                                                                      ProjectBuildingRequest buildingRequest )
135         throws UnknownArchetype;
136 }