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 org.apache.tools.ant.taskdefs.optional.metaboss;
16:
17: import java.io.File;
18:
19: import org.apache.tools.ant.BuildException;
20: import org.apache.tools.ant.types.Path;
21:
22: /** The container of the tool invocation property name and value. Any number of the properties
23: * can be passed to any of the tool invocation tasks */
24: public class MetaBossToolInvocationParam {
25: private String mName = null;
26: private String mContent = null;
27:
28: /** The setter for the "name" attribute */
29: public void setName(String pName) throws BuildException {
30: if (pName.equals("Home"))
31: throw new BuildException(
32: "'Home' is a reserved word and can not be used as a name of extra parameter.");
33: if (pName.equals("SystemDefinitionPath"))
34: throw new BuildException(
35: "'SystemDefinitionPath' is a reserved word and can not be used as a name of extra parameter.");
36: mName = pName;
37: }
38:
39: /** The setter for the "value" attribute. Note that setValue(), setFile() and setPath()
40: * are mutually exclusive setters and only one of them can be called */
41: public void setValue(String pValue) throws BuildException {
42: if (mContent != null)
43: throw new BuildException(
44: "Only one of 'value', 'file' or 'path' arguments can be specified.");
45: mContent = pValue;
46: }
47:
48: /** The setter for the "file" attribute */
49: public void setFile(File pFile) throws BuildException {
50: if (mContent != null)
51: throw new BuildException(
52: "Only one of 'value', 'file' or 'path' arguments can be specified.");
53: mContent = pFile.getAbsolutePath();
54: }
55:
56: /** The setter for the "path" attribute */
57: public void setPath(Path pPath) throws BuildException {
58: if (mContent != null)
59: throw new BuildException(
60: "Only one of 'value', 'file' or 'path' arguments can be specified.");
61: mContent = pPath.toString();
62: }
63:
64: /** The getter for the "name" attribute */
65: public String getName() {
66: return mName;
67: }
68:
69: /** The getter for the "value" or "file" or "path" attribute */
70: public String getContent() {
71: return mContent;
72: }
73: }
|