import org.apache.tools.ant.BuildException;\r
import org.apache.tools.ant.Target;\r
\r
+import org.argeo.slc.ant.SlcAntConstants;\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.SpringArg;\r
import org.argeo.slc.ant.spring.AbstractSpringTask;\r
import org.argeo.slc.core.structure.SimpleSElement;\r
import org.argeo.slc.core.structure.StructureAware;\r
public abstract class SAwareTask extends AbstractSpringTask {\r
private String path;\r
private TreeSPath treeSPath;\r
- private final List<AbstractSpringArg> sAwareArgs = new Vector<AbstractSpringArg>();\r
+ private final List<SpringArg> sAwareArgs = new Vector<SpringArg>();\r
\r
private StructureElementArg structureElementArg;\r
\r
* Includes this arg in the checks for propagation of structure related\r
* information.\r
*/\r
- protected void addSAwareArg(AbstractSpringArg arg) {\r
+ protected void addSAwareArg(SpringArg arg) {\r
sAwareArgs.add(arg);\r
}\r
\r
}\r
\r
// notify registered args\r
- for (AbstractSpringArg arg : sAwareArgs) {\r
+ for (SpringArg arg : sAwareArgs) {\r
Object obj = arg.getBeanInstance();\r
\r
if (obj instanceof StructureAware) {\r
/** Actions to be executed by the implementor. */\r
protected abstract void executeActions(String mode);\r
\r
+ public <T> T getBean(String beanName) {\r
+ return (T) getContext().getBean(beanName);\r
+ }\r
+\r
/** Create a reference to an external structure element. */\r
public StructureElementArg createStructureElement() {\r
if (structureElementArg != null)\r
/** Gets the underlying structure registry. */\r
protected StructureRegistry<TreeSPath> getRegistry() {\r
return (StructureRegistry<TreeSPath>) getProject().getReference(\r
- SlcProjectHelper.REF_STRUCTURE_REGISTRY);\r
+ SlcAntConstants.REF_STRUCTURE_REGISTRY);\r
}\r
\r
/** Creates the treeSPath for a given Ant target. */\r
protected static TreeSPath createTargetPath(Target target) {\r
TreeSPath projectPath = (TreeSPath) target.getProject().getReference(\r
- SlcProjectHelper.REF_PROJECT_PATH);\r
+ SlcAntConstants.REF_PROJECT_PATH);\r
return projectPath.createChild(target.getName());\r
}\r
\r
}\r
}\r
\r
-class StructureElementArg extends AbstractSpringArg {\r
+class StructureElementArg extends SpringArg {\r
public StructureElement getStructureElement() {\r
return (StructureElement) getBeanInstance();\r
}\r