View Javadoc
1   package org.apache.maven.plugin.javadoc.resolver;
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.factory.ArtifactFactory;
23  import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
24  import org.apache.maven.artifact.repository.ArtifactRepository;
25  import org.apache.maven.artifact.resolver.ArtifactResolver;
26  import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
27  import org.apache.maven.plugin.logging.Log;
28  import org.apache.maven.project.MavenProject;
29  import org.codehaus.plexus.archiver.manager.ArchiverManager;
30  
31  import java.io.File;
32  import java.util.List;
33  
34  /**
35   * 
36   */
37  public class SourceResolverConfig
38  {
39  
40      private final MavenProject project;
41  
42      private ArtifactFilter filter;
43  
44      private List<MavenProject> reactorProjects;
45  
46      private final File outputBasedir;
47  
48      private boolean compileSourceIncluded;
49  
50      private boolean testSourceIncluded;
51  
52      private final ArtifactRepository localRepository;
53  
54      private final ArtifactResolver artifactResolver;
55  
56      private final ArtifactMetadataSource artifactMetadataSource;
57  
58      private final ArchiverManager archiverManager;
59  
60      private final ArtifactFactory artifactFactory;
61  
62      private final Log log;
63  
64      public SourceResolverConfig( final Log log, final MavenProject project, final ArtifactRepository localRepository,
65                                   final File outputBasedir, final ArtifactResolver artifactResolver,
66                                   final ArtifactFactory artifactFactory,
67                                   final ArtifactMetadataSource artifactMetadataSource,
68                                   final ArchiverManager archiverManager )
69      {
70          this.log = log;
71          this.project = project;
72          this.localRepository = localRepository;
73          this.outputBasedir = outputBasedir;
74          this.artifactResolver = artifactResolver;
75          this.artifactFactory = artifactFactory;
76          this.artifactMetadataSource = artifactMetadataSource;
77          this.archiverManager = archiverManager;
78      }
79  
80      public SourceResolverConfig withFilter( final ArtifactFilter filter )
81      {
82          this.filter = filter;
83          return this;
84      }
85  
86      public SourceResolverConfig withReactorProjects( final List<MavenProject> reactorProjects )
87      {
88          this.reactorProjects = reactorProjects;
89          return this;
90      }
91  
92      public SourceResolverConfig withCompileSources()
93      {
94          compileSourceIncluded = true;
95          return this;
96      }
97  
98      public SourceResolverConfig withoutCompileSources()
99      {
100         compileSourceIncluded = false;
101         return this;
102     }
103 
104     public SourceResolverConfig withTestSources()
105     {
106         testSourceIncluded = true;
107         return this;
108     }
109 
110     public SourceResolverConfig withoutTestSources()
111     {
112         testSourceIncluded = false;
113         return this;
114     }
115 
116     public MavenProject project()
117     {
118         return project;
119     }
120 
121     public ArtifactRepository localRepository()
122     {
123         return localRepository;
124     }
125 
126     public ArtifactFilter filter()
127     {
128         return filter;
129     }
130 
131     public List<MavenProject> reactorProjects()
132     {
133         return reactorProjects;
134     }
135 
136     public File outputBasedir()
137     {
138         return outputBasedir;
139     }
140 
141     public boolean includeCompileSources()
142     {
143         return compileSourceIncluded;
144     }
145 
146     public boolean includeTestSources()
147     {
148         return testSourceIncluded;
149     }
150 
151     public ArtifactResolver artifactResolver()
152     {
153         return artifactResolver;
154     }
155 
156     public ArtifactMetadataSource artifactMetadataSource()
157     {
158         return artifactMetadataSource;
159     }
160 
161     public ArchiverManager archiverManager()
162     {
163         return archiverManager;
164     }
165 
166     public ArtifactFactory artifactFactory()
167     {
168         return artifactFactory;
169     }
170     
171     public Log log()
172     {
173         return log;
174     }
175 
176 }