1 package org.apache.maven.plugin.jxr;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.project.MavenProject;
23
24 import java.io.File;
25 import java.util.ArrayList;
26 import java.util.Arrays;
27 import java.util.List;
28 import java.util.Locale;
29
30
31
32
33
34
35
36
37
38 public class JxrReport
39 extends AbstractJxrReport
40 {
41
42
43
44
45
46
47
48 private List sourceDirs;
49
50
51
52
53
54
55
56 private String sourcePath;
57
58
59
60
61
62
63 private String destDir;
64
65
66
67
68
69
70 private File javadocDir;
71
72
73
74
75 protected String getDestinationDirectory()
76 {
77 return destDir;
78 }
79
80
81
82
83 protected List getSourceRoots()
84 {
85 if ( sourcePath != null )
86 {
87 String[] sourcePathArray = sourcePath.split( ";" );
88 if ( sourcePathArray.length > 0 )
89 {
90 return Arrays.asList( sourcePathArray );
91 }
92 }
93
94 List l = new ArrayList();
95
96 if ( !"pom".equals( getProject().getPackaging().toLowerCase() ) )
97 {
98 l.addAll( sourceDirs );
99 }
100
101 if ( getProject().getExecutionProject() != null )
102 {
103 if ( !"pom".equals( getProject().getExecutionProject().getPackaging().toLowerCase() ) )
104 {
105 l.addAll( getProject().getExecutionProject().getCompileSourceRoots() );
106 }
107 }
108
109 return l;
110 }
111
112
113
114
115 protected List getSourceRoots( MavenProject project )
116 {
117 List l = new ArrayList();
118
119 if ( !"pom".equals( project.getPackaging().toLowerCase() ) )
120 {
121 l.addAll( project.getCompileSourceRoots() );
122 }
123
124 if ( project.getExecutionProject() != null )
125 {
126 if ( !"pom".equals( project.getExecutionProject().getPackaging().toLowerCase() ) )
127 {
128 l.addAll( project.getExecutionProject().getCompileSourceRoots() );
129 }
130 }
131
132 return l;
133 }
134
135
136
137
138 public String getDescription( Locale locale )
139 {
140 return getBundle( locale ).getString( "report.xref.main.description" );
141 }
142
143
144
145
146 public String getName( Locale locale )
147 {
148 return getBundle( locale ).getString( "report.xref.main.name" );
149 }
150
151
152
153
154 public String getOutputName()
155 {
156 return "xref/index";
157 }
158
159
160
161
162 protected File getJavadocDir()
163 {
164 return javadocDir;
165 }
166
167
168
169
170 public void setReportOutputDirectory( File reportOutputDirectory )
171 {
172 if ( ( reportOutputDirectory != null ) && ( !reportOutputDirectory.getAbsolutePath().endsWith( "xref" ) ) )
173 {
174 this.destDir = new File( reportOutputDirectory, "xref" ).getAbsolutePath();
175 }
176 else
177 {
178 this.destDir = reportOutputDirectory.getAbsolutePath();
179 }
180 }
181 }