Author: jkoster Date: 2010-02-15 16:24:19 +0100 (Mon, 15 Feb 2010) New Revision: 41012
Added: CMSContainer/branches/b1_7/CMSContainer/builderConverter/readme.txt CMSContainer/branches/b1_7/CMSContainer/builderConverter/src/java/ CMSContainer/branches/b1_7/CMSContainer/builderConverter/src/java/com/finalist/cmsc/builderconverter/ Removed: CMSContainer/branches/b1_7/CMSContainer/builderConverter/pom.xml CMSContainer/branches/b1_7/CMSContainer/builderConverter/src/java/com/finalist/cmsc/mmbase/ CMSContainer/branches/b1_7/CMSContainer/builderConverter/src/main/ Modified: CMSContainer/branches/b1_7/CMSContainer/builderConverter/src/java/com/finalist/cmsc/builderconverter/BuilderConverter.java Log: Update builder converter. Deleted: CMSContainer/branches/b1_7/CMSContainer/builderConverter/pom.xml =================================================================== --- CMSContainer/branches/b1_7/CMSContainer/builderConverter/pom.xml 2010-02-15 15:24:16 UTC (rev 41011) +++ CMSContainer/branches/b1_7/CMSContainer/builderConverter/pom.xml 2010-02-15 15:24:19 UTC (rev 41012) @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>net.klasens.maven</groupId> - <artifactId>BuilderConverter</artifactId> - <version>1.0-SNAPSHOT</version> - <name>Builder Converter</name> - <packaging>jar</packaging> - - <dependencies> - <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-plugin-api</artifactId> - <version>2.0</version> - </dependency> - <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-project</artifactId> - <version>2.0</version> - </dependency> - <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-artifact</artifactId> - <version>2.0</version> - </dependency> - <dependency> - <groupId>classworlds</groupId> - <artifactId>classworlds</artifactId> - <version>1.1-alpha-2</version> - </dependency> - <dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-utils</artifactId> - <version>1.5.1</version> - </dependency> - </dependencies> - -</project> Added: CMSContainer/branches/b1_7/CMSContainer/builderConverter/readme.txt =================================================================== --- CMSContainer/branches/b1_7/CMSContainer/builderConverter/readme.txt (rev 0) +++ CMSContainer/branches/b1_7/CMSContainer/builderConverter/readme.txt 2010-02-15 15:24:19 UTC (rev 41012) @@ -0,0 +1,5 @@ +BuilderConverter to convert MMBase builders <= 1.8 to MMBase 1.9 format + +- Open the BuilderConverter.java in Eclipse +- Run the file from Eclipse, with the start directory as first parameter +- Builders are converted \ No newline at end of file Copied: CMSContainer/branches/b1_7/CMSContainer/builderConverter/src/java (from rev 40765, CMSContainer/branches/b1_7/CMSContainer/builderConverter/src/main/java) Copied: CMSContainer/branches/b1_7/CMSContainer/builderConverter/src/java/com/finalist/cmsc/builderconverter (from rev 40765, CMSContainer/branches/b1_7/CMSContainer/builderConverter/src/main/java/com/finalist/cmsc/mmbase) Modified: CMSContainer/branches/b1_7/CMSContainer/builderConverter/src/java/com/finalist/cmsc/builderconverter/BuilderConverter.java =================================================================== --- CMSContainer/branches/b1_7/CMSContainer/builderConverter/src/main/java/com/finalist/cmsc/mmbase/BuilderConverter.java 2010-02-01 14:32:41 UTC (rev 40765) +++ CMSContainer/branches/b1_7/CMSContainer/builderConverter/src/java/com/finalist/cmsc/builderconverter/BuilderConverter.java 2010-02-15 15:24:19 UTC (rev 41012) @@ -1,13 +1,14 @@ -package com.finalist.cmsc.mmbase; +package com.finalist.cmsc.builderconverter; import java.io.*; import java.util.*; -import org.codehaus.plexus.util.DirectoryScanner; -import org.codehaus.plexus.util.FileUtils; +import org.apache.commons.io.FileUtils; import org.w3c.dom.*; +import org.codehaus.plexus.util.DirectoryScanner; + import com.finalist.cmsc.util.XmlUtil; import com.sun.org.apache.xml.internal.serialize.OutputFormat; import com.sun.org.apache.xml.internal.serialize.XMLSerializer; @@ -25,7 +26,9 @@ throw new IllegalArgumentException("baseDirectory not provided"); } + System.out.println("Running..."); + String newBaseDirectory = baseDirectory; convertBuilders(baseDirectory, newBaseDirectory); @@ -447,29 +450,28 @@ // faulty path System.err.println("No tokens in path"); return null; - } else { - String root = st.nextToken(); - if (!e.getNodeName().equals(root)) { - // path should start with root element - System.err.println("path [" + path + "] with root (" + root + ") doesn't start with root element (" + e.getLocalName() + "): incorrect xml file" + - "(" + e.getOwnerDocument().getDocumentURI() + ")"); - return null; - } - OUTER: - while (st.hasMoreTokens()) { - String tag = st.nextToken(); - NodeList nl = e.getChildNodes(); - for(int i = 0; i < nl.getLength(); i++) { - if (! (nl.item(i) instanceof Element)) continue; - e = (Element) nl.item(i); - String tagName = e.getNodeName(); - if (tagName == null || tagName.equals(tag) || "*".equals(tag)) continue OUTER; - } - // Handle error! - return null; - } - return e; } + String root = st.nextToken(); + if (!e.getNodeName().equals(root)) { + // path should start with root element + System.err.println("path [" + path + "] with root (" + root + ") doesn't start with root element (" + e.getLocalName() + "): incorrect xml file" + + "(" + e.getOwnerDocument().getDocumentURI() + ")"); + return null; + } + OUTER: + while (st.hasMoreTokens()) { + String tag = st.nextToken(); + NodeList nl = e.getChildNodes(); + for(int i = 0; i < nl.getLength(); i++) { + if (! (nl.item(i) instanceof Element)) continue; + e = (Element) nl.item(i); + String tagName = e.getNodeName(); + if (tagName == null || tagName.equals(tag) || "*".equals(tag)) continue OUTER; + } + // Handle error! + return null; + } + return e; } public static String getNodeTextValue(Node n, boolean trim) { _______________________________________________ Cvs mailing list [email protected] http://lists.mmbase.org/mailman/listinfo/cvs
