View Javadoc

1   /*
2    * $Id: UndeployTask.java,v 1.1 2004/12/15 14:18:17 patforna Exp $
3    *
4    * Copyright (c) 2004 Patric Fornasier, Pawel Kowalski
5    * Berne University of Applied Sciences
6    * School of Engineering and Information Technology
7    * All rights reserved.
8    */
9   package bexee.ant;
10  
11  import org.apache.tools.ant.BuildException;
12  import org.apache.tools.ant.Task;
13  
14  import bexee.admin.Admin;
15  import bexee.admin.AdminException;
16  
17  /***
18   * Undeploys a BPEL process from bexee.
19   * 
20   * @version $Revision: 1.1 $, $Date: 2004/12/15 14:18:17 $
21   * @author Patric Fornasier
22   * @author Pawel Kowalski
23   */
24  public class UndeployTask extends Task {
25  
26      private String url;
27  
28      private String name;
29  
30      /***
31       * Name of the BPEL process to undeploy file to deploy.
32       * 
33       * @param name
34       *            a <code>String</code>
35       */
36      public void setName(String name) {
37          this.name = name;
38      }
39  
40      /***
41       * Location of the Manager Web Service.
42       * 
43       * @param url
44       *            a <code>URL</code>
45       */
46      public void setUrl(String url) {
47          this.url = url;
48      }
49  
50      /***
51       * Undeploys the process from bexee.
52       */
53      public void execute() throws BuildException {
54  
55          // check if the required parameter have been set
56          if (url == null || name == null) {
57              throw new BuildException("All of url and name are required");
58          }
59  
60          // create admin client with url to Manager service
61          Admin admin = new Admin(url);
62  
63          // deploy to Manager
64          try {
65              String result = admin.undeploy(name);
66              log(result);
67          } catch (AdminException e) {
68              throw new BuildException(e);
69          }
70      }
71  }