3 * Copyright 2004 The Ant-Contrib project
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 package net
.sf
.antcontrib
.cpptasks
;
20 import org
.apache
.tools
.ant
.types
.DataType
;
21 import org
.apache
.tools
.ant
.types
.Reference
;
22 import java
.util
.Vector
;
25 * Distributed build information (Non-functional prototype).
28 public final class DistributerDef
33 private String ifCond
;
38 private String unlessCond
;
50 private DistributerProtocolEnum protocol
;
53 * Not sure what this is.
63 * local to remote file name maps.
65 private final Vector maps
= new Vector();
71 public DistributerDef() {
75 * Required by documentation generator.
77 public void execute() {
78 throw new org
.apache
.tools
.ant
.BuildException(
79 "Not an actual task, but looks like one for documentation purposes");
83 * Returns true if the if and unless conditions (if any) are
85 * @return true if definition is active.
87 public boolean isActive() {
88 return CUtil
.isActive(getProject(), ifCond
, unlessCond
);
92 * Sets an id that can be used to reference this element.
97 public void setId(final String id
) {
99 // this is actually accomplished by a different
100 // mechanism, but we can document it
105 * Sets the property name for the 'if' condition.
107 * The define will be ignored unless the property is defined.
109 * The value of the property is insignificant, but values that would imply
110 * misinterpretation ("false", "no") will throw an exception when
116 public void setIf(final String propName
) {
121 * Specifies that this element should behave as if the content of the
122 * element with the matching id attribute was inserted at this location. If
123 * specified, no other attributes should be specified.
124 * @param r reference name
126 public void setRefid(final Reference r
) {
131 * Set the property name for the 'unless' condition.
133 * If named property is set, the define will be ignored.
135 * The value of the property is insignificant, but values that would imply
136 * misinterpretation ("false", "no") of the behavior will throw an
137 * exception when evaluated.
142 public void setUnless(final String propName
) {
143 unlessCond
= propName
;
148 * @return hosts, may be null.
151 public String
getHosts() {
153 DistributerDef refDistributer
= (DistributerDef
)
154 getCheckedRef(DistributerDef
.class,
156 return refDistributer
.getHosts();
163 * @return TCP_CORK value.
166 public int getTcpcork() {
168 DistributerDef refDistributer
= (DistributerDef
)
169 getCheckedRef(DistributerDef
.class,
171 return refDistributer
.getTcpcork();
178 * @return protocol, may be null.
181 public DistributerProtocolEnum
getProtocol() {
183 DistributerDef refDistributer
= (DistributerDef
)
184 getCheckedRef(DistributerDef
.class,
186 return refDistributer
.getProtocol();
193 * @param value new value
195 public void setHosts(final String value
) {
197 throw tooManyAttributes();
203 * Sets TCP_CORK value.
204 * @param value new value
206 public void setTcpcork(final int value
) {
208 throw tooManyAttributes();
215 * @param value new value
217 public void setProtocol(final DistributerProtocolEnum value
) {
219 throw tooManyAttributes();
225 * Local to remote filename maps.
228 public DistributerMap
createMap() {
229 DistributerMap map
= new DistributerMap();
230 map
.setProject(getProject());
231 maps
.addElement(map
);
236 * Sets remote user name.
237 * @param value user name
239 public void setUser(final String value
) {