View Javadoc

1   package org.codehaus.mojo.weblogic;
2   
3   /*
4    * Copyright 2006 The Apache Software Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *      http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  import org.apache.maven.plugin.MojoExecutionException;
20  
21  import weblogic.Deployer;
22  
23  /**
24   * Undeploy artifacts from Weblogic server(s) or cluster(s).
25   * 
26   * @author <a href="mailto:scott@theryansplace.com">Scott Ryan</a>
27   * @version $Id: UnDeployMojo.java 6588 2008-03-28 12:22:57Z bentmann $
28   * @description undeploy an artifact (war, ear, etc) to a target(s) which can be servers or clusters.
29   * @goal undeploy
30   */
31  public class UnDeployMojo extends DeployMojoBase
32  {
33  
34      /**
35       * This task will perform the un-deployment of the object to the proper server url.
36       * 
37       * @throws MojoExecutionException
38       *             Thrown if we fail to obtain a Weblogic deployment instance.
39       */
40      public void execute() throws MojoExecutionException
41      {
42  
43          if ( getLog().isInfoEnabled() )
44          {
45              getLog().info( "Weblogic un-deployment beginning with parameters " + this.toString() );
46          }
47  
48          // get the basic parameters
49          String[] parameters = this.getInputParameters( "undeploy" );
50  
51          try
52          {
53  
54              // Deploy with the parameters
55              Deployer deployer = new Deployer( parameters );
56  
57              deployer.run();
58          }
59          catch ( Exception ex )
60          {
61              getLog().error( "Exception encountered during un-deployment ", ex );
62              throw new MojoExecutionException( "Exception encountered during un-deployment", ex );
63          }
64  
65          if ( getLog().isInfoEnabled() )
66          {
67              getLog().info( "Weblogic un-deployment successful " );
68          }
69  
70      }
71  
72  }