cziegeler 02/05/08 02:55:27
Modified: tools/src ManifestToolTask.java XConfToolTask.java
Added: src/java/org/apache/cocoon/webapps/authentication
authentication-sel.xmap
Log:
Fixing ant tasks, the files are now resolved with respect to the base dir of
the project
Revision Changes Path
1.1
xml-cocoon2/src/java/org/apache/cocoon/webapps/authentication/authentication-sel.xmap
Index: authentication-sel.xmap
===================================================================
<?xml version="1.0"?>
<xmap xpath="/sitemap/components/selectors"
unless="[EMAIL PROTECTED]'auth-media']">
<map:selector name="auth-media"
src="org.apache.cocoon.webapps.authentication.selection.MediaSelector"/>
</xmap>
1.3 +2 -2 xml-cocoon2/tools/src/ManifestToolTask.java
Index: ManifestToolTask.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/tools/src/ManifestToolTask.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ManifestToolTask.java 24 Mar 2002 17:19:57 -0000 1.2
+++ ManifestToolTask.java 8 May 2002 09:55:27 -0000 1.3
@@ -17,7 +17,7 @@
* in the specified directory.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Vadim Gritsenko</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/03/24 17:19:57 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/05/08 09:55:27 $
*/
public final class ManifestToolTask extends Task {
@@ -43,7 +43,7 @@
try {
// process recursive
- this.process(new File(this.directory), this.manifest);
+ this.process(this.project.resolveFile(this.directory),
this.manifest);
} catch (IOException ioe) {
throw new BuildException("IOException: " + ioe);
}
1.6 +32 -33 xml-cocoon2/tools/src/XConfToolTask.java
Index: XConfToolTask.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/tools/src/XConfToolTask.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XConfToolTask.java 4 May 2002 00:15:53 -0000 1.5
+++ XConfToolTask.java 8 May 2002 09:55:27 -0000 1.6
@@ -39,7 +39,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Vadim Gritsenko</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Marcus Crafter</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Ovidiu Predescu</a>
- * @version CVS $Revision: 1.5 $ $Date: 2002/05/04 00:15:53 $
+ * @version CVS $Revision: 1.6 $ $Date: 2002/05/08 09:55:27 $
*/
public final class XConfToolTask extends Task {
@@ -75,14 +75,14 @@
try {
final DocumentBuilder builder =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
final Transformer transformer =
TransformerFactory.newInstance().newTransformer();
- final String file = new
File(this.configuration).getCanonicalPath();
+ final String file =
this.project.resolveFile(this.configuration).getCanonicalPath();
// load xml
System.out.println("Reading: " + file);
final Document configuration = builder.parse(file);
// process recursive
- if (process(builder, configuration, new File(this.directory),
this.extension)) {
+ if (process(builder, configuration,
this.project.resolveFile(this.directory), this.extension)) {
// save xml
System.out.println("Writing: " + file);
transformer.transform(new DOMSource(configuration), new
StreamResult(file));
@@ -132,20 +132,19 @@
* Add entry to cocoon.xconf
*/
private boolean add(final Document configuration,
- final Document component,
- String file)
- throws TransformerException, IOException
- {
+ final Document component,
+ String file)
+ throws TransformerException, IOException {
// Check to see if Document is an xconf-tool document
Element elem = component.getDocumentElement();
if (!elem.getTagName().equals(extension)) {
- System.out.println("Skipping non xconf-tool file: " + file);
- return false;
+ System.out.println("Skipping non xconf-tool file: " + file);
+ return false;
}
// Get 'root' node were 'component' will be inserted into
- String xpath = elem.getAttribute("xpath");
-
+ String xpath = elem.getAttribute("xpath");
+
NodeList nodes = XPathAPI.selectNodeList(configuration, xpath);
if (nodes.getLength() != 1) {
System.out.println("Error in: " + file);
@@ -161,31 +160,31 @@
System.out.println("Skipping: " + file);
return false;
} else {
- // Test if component wants us to remove a list of nodes first
- xpath = component.getDocumentElement().getAttribute("remove");
+ // Test if component wants us to remove a list of nodes first
+ xpath = component.getDocumentElement().getAttribute("remove");
+
+ Node remove = null;
+ if (xpath != null && xpath.length() > 0) {
+ nodes = XPathAPI.selectNodeList(configuration, xpath);
+
+ for (int i = 0, length = nodes.getLength(); i < length; i++)
{
+ Node node = nodes.item(i);
+ Node parent = node.getParentNode();
+ parent.removeChild(node);
+ }
+ }
- Node remove = null;
- if (xpath != null && xpath.length() > 0) {
- nodes = XPathAPI.selectNodeList(configuration, xpath);
-
- for (int i = 0, length = nodes.getLength(); i < length; i++) {
- Node node = nodes.item(i);
- Node parent = node.getParentNode();
- parent.removeChild(node);
+ // Test for an attribute that needs to be added to an element
+ String name =
component.getDocumentElement().getAttribute("add-attribute");
+ String value =
component.getDocumentElement().getAttribute("value");
+ if (name != null && name.length() > 0) {
+ if (value == null)
+ throw new IOException("No attribute value specified for
'add-attribute' " + xpath);
+ if (root instanceof Element)
+ ((Element)root).setAttribute(name, value);
}
- }
- // Test for an attribute that needs to be added to an element
- String name =
component.getDocumentElement().getAttribute("add-attribute");
- String value =
component.getDocumentElement().getAttribute("value");
- if (name != null && name.length() > 0) {
- if (value == null)
- throw new IOException("No attribute value specified for
'add-attribute' " + xpath);
- if (root instanceof Element)
- ((Element)root).setAttribute(name, value);
- }
-
-
+
// Test if 'component' provides desired insertion point
xpath =
component.getDocumentElement().getAttribute("insert-before");
Node before = null;
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]