import org.apache.tools.ant.BuildException;\r
import org.apache.tools.ant.Target;\r
\r
+import org.argeo.slc.ant.SlcAntException;\r
import org.argeo.slc.ant.SlcProjectHelper;\r
import org.argeo.slc.ant.spring.AbstractSpringArg;\r
import org.argeo.slc.ant.spring.AbstractSpringTask;\r
private TreeSPath path;\r
private final List<AbstractSpringArg> sAwareArgs = new Vector<AbstractSpringArg>();\r
\r
+ private StructureElementArg structureElementArg;\r
+\r
@Override\r
public void init() throws BuildException {\r
StructureRegistry registry = getRegistry();\r
}\r
\r
/**\r
- * Includes this arg in the checks for propagation of sstructure related\r
+ * Includes this arg in the checks for propagation of structure related\r
* information.\r
*/\r
protected void addSAwareArg(AbstractSpringArg arg) {\r
TreeSPath targetPath = createTargetPath(getOwningTarget());\r
TreeSPath taskPath = targetPath.createChild(getTaskName()\r
+ targetPath.listChildren(getRegistry()).size());\r
- getRegistry().register(taskPath, this);\r
+ if (structureElementArg != null)\r
+ getRegistry().register(taskPath,\r
+ structureElementArg.getStructureElement());\r
+ else\r
+ getRegistry().register(taskPath, this);\r
+\r
path = taskPath;\r
\r
// notify registered args\r
/** Actions to be executed by the implementor. */\r
protected abstract void executeActions(String mode);\r
\r
+ /** Create a reference to an external structure element. */\r
+ public StructureElementArg createStructureElement() {\r
+ if (structureElementArg != null)\r
+ throw new SlcAntException("Arg already set.");\r
+ structureElementArg = new StructureElementArg();\r
+ return structureElementArg;\r
+ }\r
+\r
/** Gets the underlying structure registry. */\r
protected StructureRegistry getRegistry() {\r
return (StructureRegistry) getProject().getReference(\r
return path;\r
}\r
\r
- @Override\r
- public String getDescription() {\r
+ public String getLabel() {\r
String description = super.getDescription();\r
if (description == null) {\r
return "<no task def>";\r
}\r
\r
}\r
+\r
+class StructureElementArg extends AbstractSpringArg {\r
+ public StructureElement getStructureElement() {\r
+ return (StructureElement) getBeanInstance();\r
+ }\r
+}
\ No newline at end of file