01: // THIS SOFTWARE IS PROVIDED BY SOFTARIS PTY.LTD. AND OTHER METABOSS
02: // CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
03: // BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
04: // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTARIS PTY.LTD.
05: // OR OTHER METABOSS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
06: // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
07: // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
08: // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
09: // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
10: // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
11: // EVEN IF SOFTARIS PTY.LTD. OR OTHER METABOSS CONTRIBUTORS ARE ADVISED OF THE
12: // POSSIBILITY OF SUCH DAMAGE.
13: //
14: // Copyright 2000-2005 © Softaris Pty.Ltd. All Rights Reserved.
15: package com.metaboss.sdlctools.applications.anttasks.builder.tools;
16:
17: import java.io.File;
18:
19: import org.apache.tools.ant.BuildException;
20: import org.apache.tools.ant.Project;
21:
22: import com.metaboss.sdlctools.applications.anttasks.builder.MetaBossBuilderTask;
23: import com.metaboss.sdlctools.applications.anttasks.builder.ToolInvocationDefinition;
24: import com.sun.xml.rpc.tools.ant.Wsdeploy;
25:
26: /** This definition is responsible for invocation of the Java compiler */
27: public class WSDeployInvocationDefinition extends
28: ToolInvocationDefinition {
29: // This class provides definition of the source definition
30: private File mInWarFile = null;
31: private File mOutWarFile = null;
32:
33: /** Public constructor for the invocation */
34: public WSDeployInvocationDefinition(MetaBossBuilderTask pOwnerTask,
35: String pInvocationName) {
36: super (pOwnerTask, pInvocationName);
37: }
38:
39: /** Setter for the file location */
40: public void setInWarFileLocation(String pFilePath) {
41: mInWarFile = new File(pFilePath).getAbsoluteFile();
42: }
43:
44: /** Gets the path of the InWar file to work on */
45: public File getInWarFile() {
46: if (mInWarFile == null)
47: throw new BuildException(
48: "Missing InWar, which is mandatory for ant task invocation.");
49: return mInWarFile;
50: }
51:
52: /** Setter for the OutWar file location */
53: public void setOutWarFileLocation(String pFilePath) {
54: mOutWarFile = new File(pFilePath).getAbsoluteFile();
55: }
56:
57: /** Gets the path of the OutWar to work on or generate */
58: public File getOutWarFile() {
59: if (mOutWarFile == null)
60: throw new BuildException(
61: "Missing OutWar, which is mandatory for ant task invocation.");
62: return mOutWarFile;
63: }
64:
65: /** Overridden to compare details of the invocation */
66: public boolean equals(Object pOther) {
67: if (this == pOther)
68: return true;
69: return false;
70: }
71:
72: /** This method will have to invoke the generator */
73: public void invoke() throws BuildException {
74: MetaBossBuilderTask lOwnerTask = getOwnerTask();
75: Project lThisProject = lOwnerTask.getProject();
76: // Now create and execute the web services compiler task
77: Wsdeploy lWsdeployTask = (Wsdeploy) lThisProject
78: .createTask("Wsdeploy");
79: if (lWsdeployTask == null)
80: throw new BuildException(
81: "Unable to instantiate Wsdeploy task");
82: lWsdeployTask.setTaskName(lOwnerTask.getTaskName());
83: lWsdeployTask.setKeep(true);
84: lWsdeployTask.setVerbose(false);
85: lWsdeployTask.setInWarFile(getInWarFile());
86: lWsdeployTask.setOutWarFile(getOutWarFile());
87: // Add specialised JAXRPC classpath
88: lWsdeployTask
89: .createClasspath()
90: .addExisting(
91: lOwnerTask
92: .getPath("JAXRPCWebServicesCompileClasspath"));
93: lWsdeployTask.execute();
94: }
95: }
|