]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc/src/main/java/org/argeo/slc/ant/AntRegistryUtil.java
- Documentation
[gpl/argeo-slc.git] / org.argeo.slc / src / main / java / org / argeo / slc / ant / AntRegistryUtil.java
index 7b827935b02d94b558f7f7fafea230e190e985a6..872dd9cc1bd17432ff2b1ae076817810ce63e1d0 100644 (file)
@@ -2,7 +2,6 @@ package org.argeo.slc.ant;
 \r
 import java.io.File;\r
 import java.util.List;\r
-import java.util.Vector;\r
 \r
 import org.apache.commons.logging.Log;\r
 import org.apache.commons.logging.LogFactory;\r
@@ -16,9 +15,10 @@ import org.argeo.slc.core.structure.StructureRegistry;
 public class AntRegistryUtil {\r
        private static Log log = LogFactory.getLog(AntRegistryUtil.class);\r
 \r
-       /** Read a structure registry from an Ant file without executing it. */\r
+       /** Reads a structure registry from an Ant file without executing it. */\r
        public static StructureRegistry readRegistry(File antFile) {\r
-\r
+               if (log.isDebugEnabled())\r
+                       log.debug("Reads registry for Ant file " + antFile);\r
                Project p = new Project();\r
                p.setUserProperty("ant.file", antFile.getAbsolutePath());\r
                p.setBaseDir(antFile.getParentFile());\r
@@ -35,9 +35,11 @@ public class AntRegistryUtil {
                return registry;\r
        }\r
 \r
-       /** Execute only the active paths of the Ant file. */\r
+       /** Executes only the active paths of the Ant file. */\r
        public static void runActive(File antFile, List<StructurePath> activePaths) {\r
-\r
+               if (log.isDebugEnabled())\r
+                       log.debug("Runs the " + activePaths.size()\r
+                                       + " provided active paths of Ant file " + antFile);\r
                Project p = new Project();\r
                p.setUserProperty("ant.file", antFile.getAbsolutePath());\r
                p.setBaseDir(antFile.getParentFile());\r
@@ -53,8 +55,10 @@ public class AntRegistryUtil {
                p.executeTarget(p.getDefaultTarget());\r
        }\r
 \r
-       /** Execute all paths of the default target of the Ant file. */\r
+       /** Executes all paths of the default target of the Ant file. */\r
        public static void runAll(File antFile) {\r
+               if (log.isDebugEnabled())\r
+                       log.debug("Runs all paths of Ant file " + antFile);\r
                Project p = new Project();\r
                p.setUserProperty("ant.file", antFile.getAbsolutePath());\r
                p.setBaseDir(antFile.getParentFile());\r
@@ -64,30 +68,4 @@ public class AntRegistryUtil {
                helper.parse(p, antFile);\r
                p.executeTarget(p.getDefaultTarget());\r
        }\r
-\r
-       public static void main(String[] args) {\r
-               File antFile = new File(\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 (StructurePath path : registry.listPaths()) {\r
-                       buf.append(path);\r
-                       if (count != 0 && count % 3 == 0) {\r
-                               // skip\r
-                       } else {\r
-                               activePaths.add(path);\r
-                               buf.append(" <");\r
-                       }\r
-                       buf.append('\n');\r
-                       count++;\r
-               }\r
-               log.info(buf);\r
-\r
-               runActive(antFile, activePaths);\r
-\r
-       }\r
 }\r