+++ /dev/null
-/*\r
- *\r
- * Copyright 2004 The Ant-Contrib project\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package net.sf.antcontrib.cpptasks;\r
-\r
-\r
-import org.apache.tools.ant.types.DataType;\r
-import org.apache.tools.ant.types.Reference;\r
-import java.util.Vector;\r
-\r
-/**\r
- * Distributed build information (Non-functional prototype).\r
- *\r
- */\r
-public final class DistributerDef\r
- extends DataType {\r
- /**\r
- * if property.\r
- */\r
- private String ifCond;\r
-\r
- /**\r
- * unless property.\r
- */\r
- private String unlessCond;\r
-\r
- /**\r
- * hosts.\r
- *\r
- */\r
- private String hosts;\r
-\r
- /**\r
- * Protocol.\r
- *\r
- */\r
- private DistributerProtocolEnum protocol;\r
-\r
- /**\r
- * Not sure what this is.\r
- */\r
- private int tcpCork;\r
-\r
- /**\r
- * user name.\r
- */\r
- private String user;\r
-\r
- /**\r
- * local to remote file name maps.\r
- */\r
- private final Vector maps = new Vector();\r
-\r
- /**\r
- * Constructor.\r
- *\r
- */\r
- public DistributerDef() {\r
- }\r
-\r
- /**\r
- * Required by documentation generator.\r
- */\r
- public void execute() {\r
- throw new org.apache.tools.ant.BuildException(\r
- "Not an actual task, but looks like one for documentation purposes");\r
- }\r
-\r
- /**\r
- * Returns true if the if and unless conditions (if any) are\r
- * satisfied.\r
- * @return true if definition is active.\r
- */\r
- public boolean isActive() {\r
- return CUtil.isActive(getProject(), ifCond, unlessCond);\r
- }\r
-\r
- /**\r
- * Sets an id that can be used to reference this element.\r
- *\r
- * @param id\r
- * id\r
- */\r
- public void setId(final String id) {\r
- //\r
- // this is actually accomplished by a different\r
- // mechanism, but we can document it\r
- //\r
- }\r
-\r
- /**\r
- * Sets the property name for the 'if' condition.\r
- *\r
- * The define will be ignored unless the property is defined.\r
- *\r
- * The value of the property is insignificant, but values that would imply\r
- * misinterpretation ("false", "no") will throw an exception when\r
- * evaluated.\r
- *\r
- * @param propName\r
- * property name\r
- */\r
- public void setIf(final String propName) {\r
- ifCond = propName;\r
- }\r
-\r
- /**\r
- * Specifies that this element should behave as if the content of the\r
- * element with the matching id attribute was inserted at this location. If\r
- * specified, no other attributes should be specified.\r
- * @param r reference name\r
- */\r
- public void setRefid(final Reference r) {\r
- super.setRefid(r);\r
- }\r
-\r
- /**\r
- * Set the property name for the 'unless' condition.\r
- *\r
- * If named property is set, the define will be ignored.\r
- *\r
- * The value of the property is insignificant, but values that would imply\r
- * misinterpretation ("false", "no") of the behavior will throw an\r
- * exception when evaluated.\r
- *\r
- * @param propName\r
- * name of property\r
- */\r
- public void setUnless(final String propName) {\r
- unlessCond = propName;\r
- }\r
-\r
- /**\r
- * Gets hosts.\r
- * @return hosts, may be null.\r
- *\r
- */\r
- public String getHosts() {\r
- if (isReference()) {\r
- DistributerDef refDistributer = (DistributerDef)\r
- getCheckedRef(DistributerDef.class,\r
- "DistributerDef");\r
- return refDistributer.getHosts();\r
- }\r
- return hosts;\r
- }\r
-\r
- /**\r
- * Gets tcp cork.\r
- * @return TCP_CORK value.\r
- *\r
- */\r
- public int getTcpcork() {\r
- if (isReference()) {\r
- DistributerDef refDistributer = (DistributerDef)\r
- getCheckedRef(DistributerDef.class,\r
- "DistributerDef");\r
- return refDistributer.getTcpcork();\r
- }\r
- return tcpCork;\r
- }\r
-\r
- /**\r
- * Gets protocol.\r
- * @return protocol, may be null.\r
- *\r
- */\r
- public DistributerProtocolEnum getProtocol() {\r
- if (isReference()) {\r
- DistributerDef refDistributer = (DistributerDef)\r
- getCheckedRef(DistributerDef.class,\r
- "DistributerDef");\r
- return refDistributer.getProtocol();\r
- }\r
- return protocol;\r
- }\r
-\r
- /**\r
- * Sets hosts.\r
- * @param value new value\r
- */\r
- public void setHosts(final String value) {\r
- if (isReference()) {\r
- throw tooManyAttributes();\r
- }\r
- hosts = value;\r
- }\r
-\r
- /**\r
- * Sets TCP_CORK value.\r
- * @param value new value\r
- */\r
- public void setTcpcork(final int value) {\r
- if (isReference()) {\r
- throw tooManyAttributes();\r
- }\r
- tcpCork = value;\r
- }\r
-\r
- /**\r
- * Sets protocol.\r
- * @param value new value\r
- */\r
- public void setProtocol(final DistributerProtocolEnum value) {\r
- if (isReference()) {\r
- throw tooManyAttributes();\r
- }\r
- protocol = value;\r
- }\r
-\r
- /**\r
- * Local to remote filename maps.\r
- * @return new map\r
- */\r
- public DistributerMap createMap() {\r
- DistributerMap map = new DistributerMap();\r
- map.setProject(getProject());\r
- maps.addElement(map);\r
- return map;\r
- }\r
-\r
- /**\r
- * Sets remote user name.\r
- * @param value user name\r
- */\r
- public void setUser(final String value) {\r
- user = value;\r
- }\r
-\r
-}\r