KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tools > ant > taskdefs > optional > ide > VAJTask


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */

17
18 package org.apache.tools.ant.taskdefs.optional.ide;
19
20 /**
21  * Super class for all VAJ tasks. Contains common
22  * attributes (remoteServer) and util methods
23  *
24  */

25 import org.apache.tools.ant.Task;
26
27
28 public class VAJTask extends Task {
29     /**
30      * Adaption of VAJLocalUtil to Task context.
31      */

32     class VAJLocalToolUtil extends VAJLocalUtil {
33         public void log(String JavaDoc msg, int level) {
34             VAJTask.this.log(msg, level);
35         }
36     }
37
38     // server name / port of VAJ remote tool api server
39
protected String JavaDoc remoteServer = null;
40
41     // holds the appropriate VAJUtil implementation
42
private VAJUtil util = null;
43
44     // checks if this task throws BuildException on error
45
protected boolean haltOnError = true;
46
47     /**
48      * returns the VAJUtil implementation
49      */

50     protected VAJUtil getUtil() {
51         if (util == null) {
52             if (remoteServer == null) {
53                 util = new VAJLocalToolUtil();
54             } else {
55                 util = new VAJRemoteUtil(this, remoteServer);
56             }
57         }
58         return util;
59     }
60
61     /**
62      * Name and port of a remote tool server, optiona.
63      * Format: <servername>:<port no>.
64      * If this attribute is set, the tasks will be executed on the specified tool
65      * server.
66      */

67     public void setRemote(String JavaDoc remoteServer) {
68         this.remoteServer = remoteServer;
69     }
70
71     /**
72     * Flag to control behaviour in case of VAJ errors.
73     * If this attribute is set errors will be ignored
74     * (no BuildException will be thrown) otherwise
75     * VAJ errors will be wrapped into a BuildException and
76     * stop the build.
77     */

78     public void setHaltonerror(boolean newHaltOnError) {
79         haltOnError = newHaltOnError;
80     }
81 }
82
Popular Tags