1 package org.apache.maven.model.converter.plugins;
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.model.converter.ProjectConverterException;
23 import org.codehaus.plexus.util.xml.Xpp3Dom;
24
25 import java.util.Properties;
26 import java.util.StringTokenizer;
27
28
29
30
31
32
33
34
35
36 public class PCCJavadoc
37 extends AbstractPluginConfigurationConverter
38 {
39
40
41
42 public String getArtifactId()
43 {
44 return "maven-javadoc-plugin";
45 }
46
47 public String getType()
48 {
49 return TYPE_REPORT_PLUGIN;
50 }
51
52 protected void buildConfiguration( Xpp3Dom configuration, org.apache.maven.model.v3_0_0.Model v3Model,
53 Properties projectProperties )
54 throws ProjectConverterException
55 {
56 addConfigurationChild( configuration, projectProperties, "maven.javadoc.additionalparam", "additionalparam" );
57
58 addConfigurationChild( configuration, projectProperties, "maven.javadoc.author", "author" );
59
60 addConfigurationChild( configuration, projectProperties, "maven.javadoc.bottom", "bottom" );
61
62 addConfigurationChild( configuration, projectProperties, "maven.javadoc.destdir", "destDir" );
63
64 addConfigurationChild( configuration, projectProperties, "maven.javadoc.doclet", "doclet" );
65 addConfigurationChild( configuration, projectProperties, "maven.javadoc.docletpath", "docletPath" );
66
67 addConfigurationChild( configuration, projectProperties, "maven.javadoc.windowtitle", "doctitle" );
68
69 addConfigurationChild( configuration, projectProperties, "maven.javadoc.excludepackagenames",
70 "excludePackageNames" );
71
72 addConfigurationChild( configuration, projectProperties, "maven.javadoc.footer", "footer" );
73
74 addConfigurationChild( configuration, projectProperties, "maven.javadoc.header", "header" );
75
76 String online = projectProperties.getProperty( "maven.javadoc.mode.online" );
77 if ( online != null )
78 {
79 addConfigurationChild( configuration, "isOffline", PropertyUtils.invertBoolean( online ) );
80 }
81
82 String links = projectProperties.getProperty( "maven.javadoc.links" );
83 if ( links != null )
84 {
85 StringTokenizer tokenizer = new StringTokenizer( links, " ," );
86 if ( tokenizer.hasMoreTokens() )
87 {
88 Xpp3Dom linksConfiguration = new Xpp3Dom( "links" );
89 while ( tokenizer.hasMoreTokens() )
90 {
91 String link = tokenizer.nextToken();
92 addConfigurationChild( linksConfiguration, "link", link );
93 }
94 configuration.addChild( linksConfiguration );
95 }
96 }
97
98 addConfigurationChild( configuration, projectProperties, "maven.javadoc.locale", "locale" );
99
100 addConfigurationChild( configuration, projectProperties, "maven.javadoc.maxmemory", "maxmemory" );
101
102 addConfigurationChild( configuration, projectProperties, "maven.javadoc.offlineLinks", "offlineLinks" );
103
104 addConfigurationChild( configuration, projectProperties, "maven.javadoc.overview", "overview" );
105
106 String show = projectProperties.getProperty( "maven.javadoc.private" );
107 if ( show != null && Boolean.valueOf( show ).booleanValue() )
108 {
109 addConfigurationChild( configuration, "show", "private" );
110 }
111 else
112 {
113 show = projectProperties.getProperty( "maven.javadoc.package" );
114 if ( show != null && Boolean.valueOf( show ).booleanValue() )
115 {
116 addConfigurationChild( configuration, "show", "package" );
117 }
118 else
119 {
120 show = projectProperties.getProperty( "maven.javadoc.public" );
121 if ( show != null && Boolean.valueOf( show ).booleanValue() )
122 {
123 addConfigurationChild( configuration, "show", "public" );
124 }
125 }
126 }
127
128 addConfigurationChild( configuration, projectProperties, "maven.javadoc.source", "source" );
129
130 addConfigurationChild( configuration, projectProperties, "maven.javadoc.stylesheet", "stylesheetfile" );
131
132 addConfigurationChild( configuration, projectProperties, "maven.javadoc.taglets", "taglet" );
133 addConfigurationChild( configuration, projectProperties, "maven.javadoc.tagletpath", "tagletpath" );
134
135 String customtags = projectProperties.getProperty( "maven.javadoc.customtags" );
136 if ( customtags != null )
137 {
138 StringTokenizer tokenizer = new StringTokenizer( customtags );
139 if ( tokenizer.hasMoreTokens() )
140 {
141 Xpp3Dom tagsConfiguration = new Xpp3Dom( "tags" );
142 while ( tokenizer.hasMoreTokens() )
143 {
144 String tag = tokenizer.nextToken();
145 Xpp3Dom tagConfiguration = new Xpp3Dom( "tag" );
146 addConfigurationChild( tagConfiguration, projectProperties, tag + ".description", "head" );
147 addConfigurationChild( tagConfiguration, projectProperties, tag + ".name", "name" );
148 String placement = "";
149 String enabled = projectProperties.getProperty( tag + ".enabled" );
150 if ( !Boolean.valueOf( enabled ).booleanValue() )
151 {
152 placement = "X";
153 }
154 String scope = projectProperties.getProperty( tag + ".scope" );
155 if ( "all".equals( scope ) )
156 {
157 placement += "a";
158 }
159 if ( placement.length() > 0 )
160 {
161 addConfigurationChild( tagConfiguration, "placement", placement );
162 }
163 tagsConfiguration.addChild( tagConfiguration );
164 }
165 configuration.addChild( tagsConfiguration );
166 }
167 }
168
169 addConfigurationChild( configuration, projectProperties, "maven.javadoc.use", "use" );
170
171 addConfigurationChild( configuration, projectProperties, "maven.javadoc.version", "version" );
172
173 addConfigurationChild( configuration, projectProperties, "maven.javadoc.windowtitle", "windowtitle" );
174
175
176 if ( configuration.getChildCount() > 0 )
177 {
178
179 addConfigurationChild( configuration, projectProperties, "maven.docs.outputencoding", "docencoding" );
180
181
182 addConfigurationChild( configuration, projectProperties, "maven.compile.encoding", "encoding" );
183
184
185 addConfigurationChild( configuration, projectProperties, "pom.package", "subpackages" );
186 }
187 }
188 }