Add taskdefs.property
authorMathieu Baudier <mbaudier@argeo.org>
Wed, 24 Oct 2007 15:25:27 +0000 (15:25 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Wed, 24 Oct 2007 15:25:27 +0000 (15:25 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@639 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

org.argeo.slc/javadoc.xml [new file with mode: 0644]
org.argeo.slc/src/main/java/org/argeo/slc/ant/AntRegistryUtil.java
org.argeo.slc/src/main/java/org/argeo/slc/ant/SlcProjectHelper.java
org.argeo.slc/src/main/java/org/argeo/slc/ant/package.html [new file with mode: 0644]
org.argeo.slc/src/main/java/org/argeo/slc/ant/taskdefs.properties [new file with mode: 0644]
org.argeo.slc/src/test/ant/build.xml

diff --git a/org.argeo.slc/javadoc.xml b/org.argeo.slc/javadoc.xml
new file mode 100644 (file)
index 0000000..990bb46
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<project default="javadoc">\r
+<target name="javadoc">\r
+<javadoc access="public" author="true" classpath="lib/commons-logging.jar;lib/ant-launcher.jar;lib/spring-2.0.6.jar;lib/ant.jar" destdir="doc" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" packagenames="org.argeo.slc.ant,org.argeo.slc.core.structure.tree,org.argeo.slc.core.test,org.argeo.slc.ant.test,org.argeo.slc.core.structure,org.argeo.slc.ant.spring,org.argeo.slc.ant.structure" source="1.5" sourcepath="src/test/java;src/main/java" splitindex="true" use="true" version="true"/>\r
+</target>\r
+</project>\r
index a871d6fde5c31be2bac1149701cb8d075cfdef82..356a7c7484dfe6dd9ad14b29591298aeeea4e1cd 100644 (file)
@@ -13,9 +13,11 @@ import org.argeo.slc.core.structure.StructureElement;
 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
 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
        public static StructureRegistry readRegistry(File antFile) {\r
 \r
                Project p = new Project();\r
@@ -33,6 +35,7 @@ public class AntRegistryUtil {
                return registry;\r
        }\r
 \r
+       /** Execute only the active paths of teh Ant files. */\r
        public static void runActive(File antFile, List<StructurePath> activePaths) {\r
 \r
                Project p = new Project();\r
@@ -43,7 +46,7 @@ public class AntRegistryUtil {
                helper.parse(p, antFile);\r
 \r
                StructureRegistry registry = (StructureRegistry) p\r
-               .getReference(SlcProjectHelper.REF_STRUCTURE_REGISTRY);\r
+                               .getReference(SlcProjectHelper.REF_STRUCTURE_REGISTRY);\r
                registry.setMode(StructureRegistry.ACTIVE);\r
                registry.setActivePaths(activePaths);\r
                p.executeTarget(p.getDefaultTarget());\r
index 2eb703e90689a0bb06e82483b0e1e86f9d6ac6f7..e08ec43059cd687c732869393764f086443d8f96 100644 (file)
@@ -11,9 +11,14 @@ import org.argeo.slc.core.structure.DefaultSRegistry;
 import org.argeo.slc.core.structure.tree.TreeSElement;\r
 import org.argeo.slc.core.structure.tree.TreeSPath;\r
 \r
+/**\r
+ * Custom implementation of a <code>ProjectHelper</code> binding a Spring\r
+ * application context and a structure registry with the Ant project.\r
+ */\r
 public class SlcProjectHelper extends ProjectHelperImpl {\r
        public static String PROP_APPLICATION_CONTEXT = "org.argeo.slc.slcRootContext";\r
-       //public static String PROP_REGISTRY_MODE = "org.argeo.slc.slcRegistryMode";\r
+       // public static String PROP_REGISTRY_MODE =\r
+       // "org.argeo.slc.slcRegistryMode";\r
        public static String REF_ROOT_CONTEXT = "slcApplicationContext";\r
        public static String REF_STRUCTURE_REGISTRY = "slcStructureRegistry";\r
 \r
@@ -29,23 +34,23 @@ public class SlcProjectHelper extends ProjectHelperImpl {
 \r
                // init structure register if it does not exist\r
                DefaultSRegistry registry = new DefaultSRegistry();\r
-                       project.addReference(REF_STRUCTURE_REGISTRY, registry);\r
+               project.addReference(REF_STRUCTURE_REGISTRY, registry);\r
 \r
-                       // call the underlying implementation to do the actual work\r
-                       super.parse(project, source);\r
+               // call the underlying implementation to do the actual work\r
+               super.parse(project, source);\r
 \r
-                       String projectDescription = project.getDescription() != null ? project\r
-                                       .getDescription()\r
-                                       : "Root";\r
-                       TreeSElement element = TreeSElement.createRootElelment(\r
-                                       getProjectPathName(project), projectDescription);\r
-                       registry.register(element);\r
+               String projectDescription = project.getDescription() != null ? project\r
+                               .getDescription() : "Root";\r
+               TreeSElement element = TreeSElement.createRootElelment(\r
+                               getProjectPathName(project), projectDescription);\r
+               registry.register(element);\r
        }\r
 \r
        private static void stdOut(Object o) {\r
                System.out.println(o);\r
        }\r
 \r
+       /** Get the path of a project (root).*/\r
        public static TreeSPath getProjectPath(Project project) {\r
                return TreeSPath.createChild(null, getProjectPathName(project));\r
        }\r
diff --git a/org.argeo.slc/src/main/java/org/argeo/slc/ant/package.html b/org.argeo.slc/src/main/java/org/argeo/slc/ant/package.html
new file mode 100644 (file)
index 0000000..14a54d1
--- /dev/null
@@ -0,0 +1,14 @@
+<html>\r
+<head></head>\r
+<body>\r
+Bases classes for SLC Ant extensions.\r
+<h2>Usage of SLC Ant extensions</h2>\r
+Add:\r
+<pre>\r
+&lt;taskdef resource="org/argeo/slc/ant/taskdefs.properties" /&gt;\r
+</pre>\r
+at the beginning of your file.\r
+\r
+\r
+</body>\r
+</html>
\ No newline at end of file
diff --git a/org.argeo.slc/src/main/java/org/argeo/slc/ant/taskdefs.properties b/org.argeo.slc/src/main/java/org/argeo/slc/ant/taskdefs.properties
new file mode 100644 (file)
index 0000000..4df33bd
--- /dev/null
@@ -0,0 +1 @@
+slc.test=org.argeo.slc.ant.test.SlcTestTask
\ No newline at end of file
index 76fa1c79bb05203916e8a961ef0a3dfded78bd74..ec1cfb5a39d8a016156651b1d7691c0ae70e10dc 100644 (file)
@@ -1,7 +1,7 @@
 <project default="test" name="testProject">\r
        <description>A Test project</description>\r
        \r
-       <taskdef name="slc.test" classname="org.argeo.slc.ant.test.SlcTestTask" />\r
+       <taskdef resource="org/argeo/slc/ant/taskdefs.properties" />\r
 \r
        <target name="test" depends="testSimple,testObj">\r
        </target>\r