import org.apache.tools.ant.Project;\r
import org.apache.tools.ant.ProjectHelper;\r
\r
-import org.argeo.slc.core.structure.StructureElement;\r
import org.argeo.slc.core.structure.StructurePath;\r
import org.argeo.slc.core.structure.StructureRegistry;\r
\r
-/** Utilities to manipulate the structure registry in SLC Ant.*/\r
+/** Utilities to manipulate the structure registry in SLC Ant. */\r
public class AntRegistryUtil {\r
private static Log log = LogFactory.getLog(AntRegistryUtil.class);\r
\r
\r
Project p = new Project();\r
p.setUserProperty("ant.file", antFile.getAbsolutePath());\r
+ p.setBaseDir(antFile.getParentFile());\r
p.init();\r
ProjectHelper helper = new SlcProjectHelper();\r
p.addReference("ant.projectHelper", helper);\r
\r
Project p = new Project();\r
p.setUserProperty("ant.file", antFile.getAbsolutePath());\r
+ p.setBaseDir(antFile.getParentFile());\r
p.init();\r
ProjectHelper helper = new SlcProjectHelper();\r
p.addReference("ant.projectHelper", helper);\r
\r
public static void main(String[] args) {\r
File antFile = new File(\r
- "C:/dev/workspaces/default/org.argeo.slc/src/test/ant/build.xml");\r
- System\r
- .setProperty(SlcAntConfig.APPLICATION_CONTEXT_PROPERTY,\r
- "C:/dev/workspaces/default/org.argeo.slc/src/test/ant/applicationContext.xml");\r
+ "C:/dev/workspaces/default/org.argeo.slc/src/test/slc/root/Category1/SubCategory2/build.xml");\r
StructureRegistry registry = AntRegistryUtil.readRegistry(antFile);\r
\r
StringBuffer buf = new StringBuffer("");\r
\r
int count = 0;\r
List<StructurePath> activePaths = new Vector<StructurePath>();\r
- for (StructureElement element : registry.listElements()) {\r
- buf.append(element.getPath());\r
+ for (StructurePath path : registry.listPaths()) {\r
+ buf.append(path);\r
if (count != 0 && count % 3 == 0) {\r
// skip\r
} else {\r
- activePaths.add(element.getPath());\r
+ activePaths.add(path);\r
buf.append(" <");\r
}\r
buf.append('\n');\r
runActive(antFile, activePaths);\r
\r
}\r
-\r
}\r