1 package org.codehaus.mojo.weblogic;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import org.apache.maven.plugin.MojoExecutionException;
20 import org.apache.tools.ant.Project;
21 import org.apache.tools.ant.types.Path;
22 import org.codehaus.mojo.weblogic.util.WeblogicMojoUtilities;
23 import weblogic.ant.taskdefs.webservices.wsdlgen.WSDLGen;
24
25 import java.io.File;
26
27
28
29
30
31
32
33
34
35
36 public class WsdlGenMojo
37 extends AbstractWeblogicMojo
38 {
39
40
41
42
43
44
45 private String serviceName;
46
47
48
49
50
51
52
53 private String warName;
54
55
56
57
58
59
60 private String wsdlFile;
61
62
63
64
65
66
67 private String defaultEndpoint;
68
69
70
71
72
73 private String earFileName;
74
75
76
77
78
79
80 private boolean overwrite;
81
82
83
84
85 public void execute()
86 throws MojoExecutionException
87 {
88 super.execute();
89
90 if ( getLog().isInfoEnabled() )
91 {
92 getLog().info( "Weblogic wsdl gen beginning " );
93 }
94
95 File earFile;
96 if ( this.earFileName == null )
97 {
98 earFile = WeblogicMojoUtilities.getEarFileName( getArtifacts() );
99 }
100 else
101 {
102 earFile = new File( this.earFileName );
103 }
104 final String classPath = WeblogicMojoUtilities
105 .getDependencies( getArtifacts() );
106
107 if ( getLog().isInfoEnabled() )
108 {
109 getLog().info( "Weblogic wsdl gen for ear " + earFile );
110 }
111
112 try
113 {
114 final WSDLGen wsdl = new WSDLGen();
115 final Project antProject = new Project();
116 antProject.setName( "wsdlgen" );
117 wsdl.setProject( antProject );
118 wsdl.setClasspath( new Path( antProject, classPath ) );
119 wsdl.setEar( earFile );
120 wsdl.setWarName( this.warName );
121 final File wsdlFileFile = new File( this.wsdlFile );
122 wsdl.setWsdlFile( wsdlFileFile );
123 wsdl.setServiceName( this.serviceName );
124 wsdl.execute();
125 }
126 catch ( Exception ex )
127 {
128 getLog().error( "Exception encountered during WSDLGen processing ", ex );
129 throw new MojoExecutionException( "Exception encountered during WSDLGen processing", ex );
130 }
131
132 }
133
134
135
136
137
138
139 public String getServiceName()
140 {
141 return serviceName;
142 }
143
144
145
146
147
148
149 public void setServiceName( String serviceName )
150 {
151 this.serviceName = serviceName;
152 }
153
154 public String getWarName()
155 {
156 return warName;
157 }
158
159 public void setWarName( String warName )
160 {
161 this.warName = warName;
162 }
163
164 public String getWsdlFile()
165 {
166 return wsdlFile;
167 }
168
169 public void setWsdlFile( String wsdlFile )
170 {
171 this.wsdlFile = wsdlFile;
172 }
173
174 public String getDefaultEndpoint()
175 {
176 return defaultEndpoint;
177 }
178
179 public void setDefaultEndpoint( String defaultEndpoint )
180 {
181 this.defaultEndpoint = defaultEndpoint;
182 }
183
184 public String getEarFileName()
185 {
186 return earFileName;
187 }
188
189 public void setEarFileName( String earFileName )
190 {
191 this.earFileName = earFileName;
192 }
193
194 public boolean isOverwrite()
195 {
196 return overwrite;
197 }
198
199 public void setOverwrite( boolean overwrite )
200 {
201 this.overwrite = overwrite;
202 }
203
204
205
206
207
208
209 public String toString()
210 {
211 StringBuffer buffer = new StringBuffer();
212 buffer.append( "ClientGenMojo[" );
213 buffer.append( "earFileName = " ).append( earFileName );
214 buffer.append( ", warName = " ).append( warName );
215 buffer.append( ", serviceName = " ).append( serviceName );
216 buffer.append( ", overwrite = " ).append( overwrite );
217 buffer.append( "]" );
218 return buffer.toString();
219 }
220 }