View Javadoc
1   package org.codehaus.mojo.axistools;
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.plugin.AbstractMojo;
23  import org.apache.maven.plugin.MojoExecutionException;
24  import org.apache.maven.plugin.MojoFailureException;
25  import org.apache.maven.project.MavenProject;
26  import org.codehaus.mojo.axistools.admin.DefaultAdminPlugin;
27  import org.codehaus.mojo.axistools.axis.AxisPluginException;
28  
29  import java.io.File;
30  import java.util.ArrayList;
31  
32  /**
33   * Utility for turning xml into Axis deployment operations
34   * (wraps org.apache.axis.utils.Admin)
35   *
36   * @author mlake <mlake@netvue.com>
37   * @version $Id$
38   * @goal admin
39   * @phase process-classes
40   * @description Axis Admin plugin
41   */
42  public class AdminMojo
43      extends AbstractMojo
44  {
45      /**
46       * Where the server-config.wsdd or client-config.wsdd should go.
47       *
48       * @parameter default-value="${basedir}/src/main/webapp/WEB-INF"
49       */
50      private File configOutputDirectory;
51  
52      /**
53       * Generate a server or client deployment file.
54       *
55       * @parameter default-value="true"
56       * @required
57       */
58  
59      private boolean isServerConfig;
60  
61      /**
62       * Files used to create deployment file.
63       *
64       * @parameter expression="${inputFile}"
65       * @required
66       */
67  
68      private ArrayList inputFiles;
69  
70      /**
71       * @parameter default-value="${project}"
72       * @required
73       * @readonly
74       */
75      private MavenProject project;
76  
77      public void execute()
78          throws MojoExecutionException, MojoFailureException
79      {
80          DefaultAdminPlugin plugin = new DefaultAdminPlugin();
81  
82          plugin.setConfigOutputDirectory( configOutputDirectory );
83          plugin.setLog( getLog() );
84          plugin.setProject( project );
85          plugin.setServerConfig( isServerConfig );
86          plugin.setInputFiles( inputFiles );
87  
88          try
89          {
90              plugin.execute();
91          }
92          catch ( AxisPluginException e )
93          {
94              throw new MojoExecutionException( "error executing plugin", e );
95          }
96      }
97  }