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