You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by jo...@apache.org on 2007/04/03 17:22:01 UTC
svn commit: r525176 [12/12] - in
/maven/archiva/branches/archiva-jpox-database-refactor: ./
archiva-api/src/main/java/org/apache/maven/archiva/configuration/
archiva-api/src/main/java/org/apache/maven/archiva/consumers/
archiva-api/src/main/java/org/ap...
Copied: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/DataRefreshExecutorTest.java (from r521491, maven/archiva/branches/archiva-jpox-database-refactor/archiva-api/src/test/java/org/apache/maven/archiva/scheduler/executors/DataRefreshExecutorTest.java)
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/DataRefreshExecutorTest.java?view=diff&rev=525176&p1=maven/archiva/branches/archiva-jpox-database-refactor/archiva-api/src/test/java/org/apache/maven/archiva/scheduler/executors/DataRefreshExecutorTest.java&r1=521491&p2=maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/DataRefreshExecutorTest.java&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-api/src/test/java/org/apache/maven/archiva/scheduler/executors/DataRefreshExecutorTest.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/DataRefreshExecutorTest.java Tue Apr 3 08:21:33 2007
@@ -1,4 +1,4 @@
-package org.apache.maven.archiva.scheduler.executors;
+package org.apache.maven.archiva.scheduled.executors;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -22,7 +22,7 @@
import org.apache.commons.io.FileUtils;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.scheduler.task.DataRefreshTask;
+import org.apache.maven.archiva.scheduled.tasks.DataRefreshTask;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.taskqueue.execution.TaskExecutionException;
import org.codehaus.plexus.taskqueue.execution.TaskExecutor;
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Apr 3 08:21:33 2007
@@ -0,0 +1,15 @@
+target
+*~
+.*.swp
+*.log
+*.patch
+*.diff
+*.ipr
+*.iws
+*.iml
+.classpath
+.project
+.m2eclipse
+.settings
+.wtpmodules
+cobertura.ser
Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/pom.xml
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/pom.xml?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/pom.xml (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/pom.xml Tue Apr 3 08:21:33 2007
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<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">
+ <parent>
+ <groupId>org.apache.maven.archiva</groupId>
+ <artifactId>archiva-base</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>archiva-xml-tools</artifactId>
+ <name>Archiva Base :: XML Tools</name>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.archiva</groupId>
+ <artifactId>archiva-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>dom4j</groupId>
+ <artifactId>dom4j</artifactId>
+ <version>1.6.1</version>
+ </dependency>
+ <dependency>
+ <groupId>jaxen</groupId>
+ <artifactId>jaxen</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </dependency>
+ </dependencies>
+ <!--
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>merge</id>
+ <goals>
+ <goal>merge-descriptors</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>${basedir}/src/main/resources/META-INF/plexus/components.xml</descriptor>
+ <descriptor>${project.build.directory}/generated-resources/plexus/META-INF/plexus/components.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ -->
+</project>
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/pom.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/LatinEntities.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/LatinEntities.java?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/LatinEntities.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/LatinEntities.java Tue Apr 3 08:21:33 2007
@@ -0,0 +1,309 @@
+package org.apache.maven.archiva.xml;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * LatinEntities - simple utility class to handle latin entity conversion.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class LatinEntities
+{
+ private static final Map defaultEntityMap;
+
+ static
+ {
+ defaultEntityMap = new HashMap();
+
+ defaultEntityMap.put( "nbsp", "\u00a0" );
+ defaultEntityMap.put( "iexcl", "\u00a1" );
+ defaultEntityMap.put( "cent", "\u00a2" );
+ defaultEntityMap.put( "pound", "\u00a3" );
+ defaultEntityMap.put( "curren", "\u00a4" );
+ defaultEntityMap.put( "yen", "\u00a5" );
+ defaultEntityMap.put( "brvbar", "\u00a6" );
+ defaultEntityMap.put( "sect", "\u00a7" );
+ defaultEntityMap.put( "uml", "\u00a8" );
+ defaultEntityMap.put( "copy", "\u00a9" );
+ defaultEntityMap.put( "ordf", "\u00aa" );
+ defaultEntityMap.put( "laquo", "\u00ab" );
+ defaultEntityMap.put( "not", "\u00ac" );
+ defaultEntityMap.put( "shy", "\u00ad" );
+ defaultEntityMap.put( "reg", "\u00ae" );
+ defaultEntityMap.put( "macr", "\u00af" );
+ defaultEntityMap.put( "deg", "\u00b0" );
+ defaultEntityMap.put( "plusmn", "\u00b1" );
+ defaultEntityMap.put( "sup2", "\u00b2" );
+ defaultEntityMap.put( "sup3", "\u00b3" );
+ defaultEntityMap.put( "acute", "\u00b4" );
+ defaultEntityMap.put( "micro", "\u00b5" );
+ defaultEntityMap.put( "para", "\u00b6" );
+ defaultEntityMap.put( "middot", "\u00b7" );
+ defaultEntityMap.put( "cedil", "\u00b8" );
+ defaultEntityMap.put( "sup1", "\u00b9" );
+ defaultEntityMap.put( "ordm", "\u00ba" );
+ defaultEntityMap.put( "raquo", "\u00bb" );
+ defaultEntityMap.put( "frac14", "\u00bc" );
+ defaultEntityMap.put( "frac12", "\u00bd" );
+ defaultEntityMap.put( "frac34", "\u00be" );
+ defaultEntityMap.put( "iquest", "\u00bf" );
+ defaultEntityMap.put( "Agrave", "\u00c0" );
+ defaultEntityMap.put( "Aacute", "\u00c1" );
+ defaultEntityMap.put( "Acirc", "\u00c2" );
+ defaultEntityMap.put( "Atilde", "\u00c3" );
+ defaultEntityMap.put( "Auml", "\u00c4" );
+ defaultEntityMap.put( "Aring", "\u00c5" );
+ defaultEntityMap.put( "AElig", "\u00c6" );
+ defaultEntityMap.put( "Ccedil", "\u00c7" );
+ defaultEntityMap.put( "Egrave", "\u00c8" );
+ defaultEntityMap.put( "Eacute", "\u00c9" );
+ defaultEntityMap.put( "Ecirc", "\u00ca" );
+ defaultEntityMap.put( "Euml", "\u00cb" );
+ defaultEntityMap.put( "Igrave", "\u00cc" );
+ defaultEntityMap.put( "Iacute", "\u00cd" );
+ defaultEntityMap.put( "Icirc", "\u00ce" );
+ defaultEntityMap.put( "Iuml", "\u00cf" );
+ defaultEntityMap.put( "ETH", "\u00d0" );
+ defaultEntityMap.put( "Ntilde", "\u00d1" );
+ defaultEntityMap.put( "Ograve", "\u00d2" );
+ defaultEntityMap.put( "Oacute", "\u00d3" );
+ defaultEntityMap.put( "Ocirc", "\u00d4" );
+ defaultEntityMap.put( "Otilde", "\u00d5" );
+ defaultEntityMap.put( "Ouml", "\u00d6" );
+ defaultEntityMap.put( "times", "\u00d7" );
+ defaultEntityMap.put( "Oslash", "\u00d8" );
+ defaultEntityMap.put( "Ugrave", "\u00d9" );
+ defaultEntityMap.put( "Uacute", "\u00da" );
+ defaultEntityMap.put( "Ucirc", "\u00db" );
+ defaultEntityMap.put( "Uuml", "\u00dc" );
+ defaultEntityMap.put( "Yacute", "\u00dd" );
+ defaultEntityMap.put( "THORN", "\u00de" );
+ defaultEntityMap.put( "szlig", "\u00df" );
+ defaultEntityMap.put( "agrave", "\u00e0" );
+ defaultEntityMap.put( "aacute", "\u00e1" );
+ defaultEntityMap.put( "acirc", "\u00e2" );
+ defaultEntityMap.put( "atilde", "\u00e3" );
+ defaultEntityMap.put( "auml", "\u00e4" );
+ defaultEntityMap.put( "aring", "\u00e5" );
+ defaultEntityMap.put( "aelig", "\u00e6" );
+ defaultEntityMap.put( "ccedil", "\u00e7" );
+ defaultEntityMap.put( "egrave", "\u00e8" );
+ defaultEntityMap.put( "eacute", "\u00e9" );
+ defaultEntityMap.put( "ecirc", "\u00ea" );
+ defaultEntityMap.put( "euml", "\u00eb" );
+ defaultEntityMap.put( "igrave", "\u00ec" );
+ defaultEntityMap.put( "iacute", "\u00ed" );
+ defaultEntityMap.put( "icirc", "\u00ee" );
+ defaultEntityMap.put( "iuml", "\u00ef" );
+ defaultEntityMap.put( "eth", "\u00f0" );
+ defaultEntityMap.put( "ntilde", "\u00f1" );
+ defaultEntityMap.put( "ograve", "\u00f2" );
+ defaultEntityMap.put( "oacute", "\u00f3" );
+ defaultEntityMap.put( "ocirc", "\u00f4" );
+ defaultEntityMap.put( "otilde", "\u00f5" );
+ defaultEntityMap.put( "ouml", "\u00f6" );
+ defaultEntityMap.put( "divide", "\u00f7" );
+ defaultEntityMap.put( "oslash", "\u00f8" );
+ defaultEntityMap.put( "ugrave", "\u00f9" );
+ defaultEntityMap.put( "uacute", "\u00fa" );
+ defaultEntityMap.put( "ucirc", "\u00fb" );
+ defaultEntityMap.put( "uuml", "\u00fc" );
+ defaultEntityMap.put( "yacute", "\u00fd" );
+ defaultEntityMap.put( "thorn", "\u00fe" );
+ defaultEntityMap.put( "yuml", "\u00ff" );
+
+ // ----------------------------------------------------------------------
+ // Special entities
+ // ----------------------------------------------------------------------
+
+ defaultEntityMap.put( "OElig", "\u0152" );
+ defaultEntityMap.put( "oelig", "\u0153" );
+ defaultEntityMap.put( "Scaron", "\u0160" );
+ defaultEntityMap.put( "scaron", "\u0161" );
+ defaultEntityMap.put( "Yuml", "\u0178" );
+ defaultEntityMap.put( "circ", "\u02c6" );
+ defaultEntityMap.put( "tilde", "\u02dc" );
+ defaultEntityMap.put( "ensp", "\u2002" );
+ defaultEntityMap.put( "emsp", "\u2003" );
+ defaultEntityMap.put( "thinsp", "\u2009" );
+ defaultEntityMap.put( "zwnj", "\u200c" );
+ defaultEntityMap.put( "zwj", "\u200d" );
+ defaultEntityMap.put( "lrm", "\u200e" );
+ defaultEntityMap.put( "rlm", "\u200f" );
+ defaultEntityMap.put( "ndash", "\u2013" );
+ defaultEntityMap.put( "mdash", "\u2014" );
+ defaultEntityMap.put( "lsquo", "\u2018" );
+ defaultEntityMap.put( "rsquo", "\u2019" );
+ defaultEntityMap.put( "sbquo", "\u201a" );
+ defaultEntityMap.put( "ldquo", "\u201c" );
+ defaultEntityMap.put( "rdquo", "\u201d" );
+ defaultEntityMap.put( "bdquo", "\u201e" );
+ defaultEntityMap.put( "dagger", "\u2020" );
+ defaultEntityMap.put( "Dagger", "\u2021" );
+ defaultEntityMap.put( "permil", "\u2030" );
+ defaultEntityMap.put( "lsaquo", "\u2039" );
+ defaultEntityMap.put( "rsaquo", "\u203a" );
+ defaultEntityMap.put( "euro", "\u20ac" );
+
+ // ----------------------------------------------------------------------
+ // Symbol entities
+ // ----------------------------------------------------------------------
+
+ defaultEntityMap.put( "fnof", "\u0192" );
+ defaultEntityMap.put( "Alpha", "\u0391" );
+ defaultEntityMap.put( "Beta", "\u0392" );
+ defaultEntityMap.put( "Gamma", "\u0393" );
+ defaultEntityMap.put( "Delta", "\u0394" );
+ defaultEntityMap.put( "Epsilon", "\u0395" );
+ defaultEntityMap.put( "Zeta", "\u0396" );
+ defaultEntityMap.put( "Eta", "\u0397" );
+ defaultEntityMap.put( "Theta", "\u0398" );
+ defaultEntityMap.put( "Iota", "\u0399" );
+ defaultEntityMap.put( "Kappa", "\u039a" );
+ defaultEntityMap.put( "Lambda", "\u039b" );
+ defaultEntityMap.put( "Mu", "\u039c" );
+ defaultEntityMap.put( "Nu", "\u039d" );
+ defaultEntityMap.put( "Xi", "\u039e" );
+ defaultEntityMap.put( "Omicron", "\u039f" );
+ defaultEntityMap.put( "Pi", "\u03a0" );
+ defaultEntityMap.put( "Rho", "\u03a1" );
+ defaultEntityMap.put( "Sigma", "\u03a3" );
+ defaultEntityMap.put( "Tau", "\u03a4" );
+ defaultEntityMap.put( "Upsilon", "\u03a5" );
+ defaultEntityMap.put( "Phi", "\u03a6" );
+ defaultEntityMap.put( "Chi", "\u03a7" );
+ defaultEntityMap.put( "Psi", "\u03a8" );
+ defaultEntityMap.put( "Omega", "\u03a9" );
+ defaultEntityMap.put( "alpha", "\u03b1" );
+ defaultEntityMap.put( "beta", "\u03b2" );
+ defaultEntityMap.put( "gamma", "\u03b3" );
+ defaultEntityMap.put( "delta", "\u03b4" );
+ defaultEntityMap.put( "epsilon", "\u03b5" );
+ defaultEntityMap.put( "zeta", "\u03b6" );
+ defaultEntityMap.put( "eta", "\u03b7" );
+ defaultEntityMap.put( "theta", "\u03b8" );
+ defaultEntityMap.put( "iota", "\u03b9" );
+ defaultEntityMap.put( "kappa", "\u03ba" );
+ defaultEntityMap.put( "lambda", "\u03bb" );
+ defaultEntityMap.put( "mu", "\u03bc" );
+ defaultEntityMap.put( "nu", "\u03bd" );
+ defaultEntityMap.put( "xi", "\u03be" );
+ defaultEntityMap.put( "omicron", "\u03bf" );
+ defaultEntityMap.put( "pi", "\u03c0" );
+ defaultEntityMap.put( "rho", "\u03c1" );
+ defaultEntityMap.put( "sigmaf", "\u03c2" );
+ defaultEntityMap.put( "sigma", "\u03c3" );
+ defaultEntityMap.put( "tau", "\u03c4" );
+ defaultEntityMap.put( "upsilon", "\u03c5" );
+ defaultEntityMap.put( "phi", "\u03c6" );
+ defaultEntityMap.put( "chi", "\u03c7" );
+ defaultEntityMap.put( "psi", "\u03c8" );
+ defaultEntityMap.put( "omega", "\u03c9" );
+ defaultEntityMap.put( "thetasym", "\u03d1" );
+ defaultEntityMap.put( "upsih", "\u03d2" );
+ defaultEntityMap.put( "piv", "\u03d6" );
+ defaultEntityMap.put( "bull", "\u2022" );
+ defaultEntityMap.put( "hellip", "\u2026" );
+ defaultEntityMap.put( "prime", "\u2032" );
+ defaultEntityMap.put( "Prime", "\u2033" );
+ defaultEntityMap.put( "oline", "\u203e" );
+ defaultEntityMap.put( "frasl", "\u2044" );
+ defaultEntityMap.put( "weierp", "\u2118" );
+ defaultEntityMap.put( "image", "\u2111" );
+ defaultEntityMap.put( "real", "\u211c" );
+ defaultEntityMap.put( "trade", "\u2122" );
+ defaultEntityMap.put( "alefsym", "\u2135" );
+ defaultEntityMap.put( "larr", "\u2190" );
+ defaultEntityMap.put( "uarr", "\u2191" );
+ defaultEntityMap.put( "rarr", "\u2192" );
+ defaultEntityMap.put( "darr", "\u2193" );
+ defaultEntityMap.put( "harr", "\u2194" );
+ defaultEntityMap.put( "crarr", "\u21b5" );
+ defaultEntityMap.put( "lArr", "\u21d0" );
+ defaultEntityMap.put( "uArr", "\u21d1" );
+ defaultEntityMap.put( "rArr", "\u21d2" );
+ defaultEntityMap.put( "dArr", "\u21d3" );
+ defaultEntityMap.put( "hArr", "\u21d4" );
+ defaultEntityMap.put( "forall", "\u2200" );
+ defaultEntityMap.put( "part", "\u2202" );
+ defaultEntityMap.put( "exist", "\u2203" );
+ defaultEntityMap.put( "empty", "\u2205" );
+ defaultEntityMap.put( "nabla", "\u2207" );
+ defaultEntityMap.put( "isin", "\u2208" );
+ defaultEntityMap.put( "notin", "\u2209" );
+ defaultEntityMap.put( "ni", "\u220b" );
+ defaultEntityMap.put( "prod", "\u220f" );
+ defaultEntityMap.put( "sum", "\u2211" );
+ defaultEntityMap.put( "minus", "\u2212" );
+ defaultEntityMap.put( "lowast", "\u2217" );
+ defaultEntityMap.put( "radic", "\u221a" );
+ defaultEntityMap.put( "prop", "\u221d" );
+ defaultEntityMap.put( "infin", "\u221e" );
+ defaultEntityMap.put( "ang", "\u2220" );
+ defaultEntityMap.put( "and", "\u2227" );
+ defaultEntityMap.put( "or", "\u2228" );
+ defaultEntityMap.put( "cap", "\u2229" );
+ defaultEntityMap.put( "cup", "\u222a" );
+ defaultEntityMap.put( "int", "\u222b" );
+ defaultEntityMap.put( "there4", "\u2234" );
+ defaultEntityMap.put( "sim", "\u223c" );
+ defaultEntityMap.put( "cong", "\u2245" );
+ defaultEntityMap.put( "asymp", "\u2248" );
+ defaultEntityMap.put( "ne", "\u2260" );
+ defaultEntityMap.put( "equiv", "\u2261" );
+ defaultEntityMap.put( "le", "\u2264" );
+ defaultEntityMap.put( "ge", "\u2265" );
+ defaultEntityMap.put( "sub", "\u2282" );
+ defaultEntityMap.put( "sup", "\u2283" );
+ defaultEntityMap.put( "nsub", "\u2284" );
+ defaultEntityMap.put( "sube", "\u2286" );
+ defaultEntityMap.put( "supe", "\u2287" );
+ defaultEntityMap.put( "oplus", "\u2295" );
+ defaultEntityMap.put( "otimes", "\u2297" );
+ defaultEntityMap.put( "perp", "\u22a5" );
+ defaultEntityMap.put( "sdot", "\u22c5" );
+ defaultEntityMap.put( "lceil", "\u2308" );
+ defaultEntityMap.put( "rceil", "\u2309" );
+ defaultEntityMap.put( "lfloor", "\u230a" );
+ defaultEntityMap.put( "rfloor", "\u230b" );
+ defaultEntityMap.put( "lang", "\u2329" );
+ defaultEntityMap.put( "rang", "\u232a" );
+ defaultEntityMap.put( "loz", "\u25ca" );
+ defaultEntityMap.put( "spades", "\u2660" );
+ defaultEntityMap.put( "clubs", "\u2663" );
+ defaultEntityMap.put( "hearts", "\u2665" );
+ defaultEntityMap.put( "diams", "\u2666" );
+ }
+
+ public static String resolveEntity( String entity )
+ {
+ String result = (String) defaultEntityMap.get( entity );
+ if ( result == null )
+ {
+ return entity;
+ }
+
+ return result;
+ }
+}
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/LatinEntities.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/LatinEntities.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/LatinEntities.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/LatinEntityResolutionReader.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/LatinEntityResolutionReader.java?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/LatinEntityResolutionReader.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/LatinEntityResolutionReader.java Tue Apr 3 08:21:33 2007
@@ -0,0 +1,60 @@
+package org.apache.maven.archiva.xml;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.PushbackReader;
+import java.io.Reader;
+
+/**
+ * LatinEntityResolutionReader
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class LatinEntityResolutionReader
+ extends Reader
+{
+ private PushbackReader originalReader;
+
+ public LatinEntityResolutionReader( Reader reader )
+ {
+ this.originalReader = new PushbackReader( reader );
+ }
+
+ public int read( char[] cbuf, int off, int len )
+ throws IOException
+ {
+ char tmpbuf[] = new char[cbuf.length];
+ int count = this.originalReader.read( tmpbuf, off, len );
+
+ StringBuffer sb = new StringBuffer();
+
+
+ return count;
+ }
+
+ public void close()
+ throws IOException
+ {
+ this.originalReader.close();
+ }
+}
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/LatinEntityResolutionReader.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/LatinEntityResolutionReader.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/LatinEntityResolutionReader.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/XMLException.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/XMLException.java?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/XMLException.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/XMLException.java Tue Apr 3 08:21:33 2007
@@ -0,0 +1,41 @@
+package org.apache.maven.archiva.xml;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.archiva.common.ArchivaException;
+
+/**
+ * XMLException
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class XMLException extends ArchivaException
+{
+ public XMLException( String message, Throwable cause )
+ {
+ super( message, cause );
+ }
+
+ public XMLException( String message )
+ {
+ super( message );
+ }
+}
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/XMLException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/XMLException.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/XMLException.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/XMLReader.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/XMLReader.java?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/XMLReader.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/XMLReader.java Tue Apr 3 08:21:33 2007
@@ -0,0 +1,262 @@
+package org.apache.maven.archiva.xml;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.commons.lang.StringUtils;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+import org.dom4j.Node;
+import org.dom4j.XPath;
+import org.dom4j.io.SAXReader;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * XMLReader - a set of common xml utility methods for reading content out of an xml file.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class XMLReader
+{
+ private URL xmlUrl;
+
+ private String documentType;
+
+ private Document document;
+
+ public XMLReader( String type, File file )
+ throws XMLException
+ {
+ if ( !file.exists() )
+ {
+ throw new XMLException( "file does not exist: " + file.getAbsolutePath() );
+ }
+
+ if ( !file.isFile() )
+ {
+ throw new XMLException( "path is not a file: " + file.getAbsolutePath() );
+ }
+
+ if ( !file.canRead() )
+ {
+ throw new XMLException( "Cannot read xml file due to permissions: " + file.getAbsolutePath() );
+ }
+
+ try
+ {
+ init( type, file.toURL() );
+ }
+ catch ( MalformedURLException e )
+ {
+ throw new XMLException( "Unable to translate file " + file + " to URL: " + e.getMessage(), e );
+ }
+ }
+
+ public XMLReader( String type, URL url )
+ throws XMLException
+ {
+ init( type, url );
+ }
+
+ private void init( String type, URL url )
+ throws XMLException
+ {
+ this.documentType = type;
+ this.xmlUrl = url;
+
+ SAXReader reader = new SAXReader();
+ try
+ {
+ InputStream in = url.openStream();
+ InputStreamReader inReader = new InputStreamReader( in );
+ LatinEntityResolutionReader latinReader = new LatinEntityResolutionReader( inReader );
+ this.document = reader.read( latinReader );
+ }
+ catch ( DocumentException e )
+ {
+ throw new XMLException( "Unable to parse " + documentType + " xml " + xmlUrl + ": " + e.getMessage(), e );
+ }
+ catch ( IOException e )
+ {
+ throw new XMLException( "Unable to open stream to " + url + ": " + e.getMessage(), e );
+ }
+
+ Element root = this.document.getRootElement();
+ if ( root == null )
+ {
+ throw new XMLException( "Invalid " + documentType + " xml: root element is null." );
+ }
+
+ if ( !StringUtils.equals( root.getName(), documentType ) )
+ {
+ throw new XMLException( "Invalid " + documentType + " xml: Unexpected root element <" + root.getName()
+ + ">, expected <" + documentType + ">" );
+ }
+ }
+
+ public Element getElement( String xpathExpr )
+ throws XMLException
+ {
+ XPath xpath = document.createXPath( xpathExpr );
+ Object evaluated = xpath.selectSingleNode( document );
+
+ if ( evaluated == null )
+ {
+ return null;
+ }
+
+ if ( evaluated instanceof Element )
+ {
+ Element evalElem = (Element) evaluated;
+ return evalElem;
+ }
+ else
+ {
+ // Unknown evaluated type.
+ throw new XMLException( ".getElement( Expr: " + xpathExpr + " ) resulted in non-Element type -> ("
+ + evaluated.getClass().getName() + ") " + evaluated );
+ }
+ }
+
+ public boolean hasElement( String xpathExpr )
+ throws XMLException
+ {
+ XPath xpath = document.createXPath( xpathExpr );
+ Object evaluated = xpath.selectSingleNode( document );
+
+ if ( evaluated == null )
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ public String getElementText( Node context, String xpathExpr )
+ throws XMLException
+ {
+ XPath xpath = document.createXPath( xpathExpr );
+ Object evaluated = xpath.selectSingleNode( context );
+
+ if ( evaluated == null )
+ {
+ return null;
+ }
+
+ if ( evaluated instanceof Element )
+ {
+ Element evalElem = (Element) evaluated;
+ return evalElem.getTextTrim();
+ }
+ else
+ {
+ // Unknown evaluated type.
+ throw new XMLException( ".getElementText( Node, Expr: " + xpathExpr
+ + " ) resulted in non-Element type -> (" + evaluated.getClass().getName() + ") " + evaluated );
+ }
+ }
+
+ public String getElementText( String xpathExpr )
+ throws XMLException
+ {
+ XPath xpath = document.createXPath( xpathExpr );
+ Object evaluated = xpath.selectSingleNode( document );
+
+ if ( evaluated == null )
+ {
+ return null;
+ }
+
+ if ( evaluated instanceof Element )
+ {
+ Element evalElem = (Element) evaluated;
+ return evalElem.getTextTrim();
+ }
+ else
+ {
+ // Unknown evaluated type.
+ throw new XMLException( ".getElementText( Expr: " + xpathExpr + " ) resulted in non-Element type -> ("
+ + evaluated.getClass().getName() + ") " + evaluated );
+ }
+ }
+
+ public List getElementList( String xpathExpr )
+ throws XMLException
+ {
+ XPath xpath = document.createXPath( xpathExpr );
+ Object evaluated = xpath.evaluate( document );
+
+ if ( evaluated == null )
+ {
+ return null;
+ }
+
+ /* The xpath.evaluate(Context) method can return:
+ * 1) A Collection or List of dom4j Nodes.
+ * 2) A single dom4j Node.
+ */
+
+ if ( evaluated instanceof List )
+ {
+ return (List) evaluated;
+ }
+ else if ( evaluated instanceof Node )
+ {
+ List ret = new ArrayList();
+ ret.add( (Node) evaluated );
+ return ret;
+ }
+ else
+ {
+ // Unknown evaluated type.
+ throw new XMLException( ".getElementList( Expr: " + xpathExpr + " ) resulted in non-List type -> ("
+ + evaluated.getClass().getName() + ") " + evaluated );
+ }
+ }
+
+ public List getElementListText( String xpathExpr )
+ throws XMLException
+ {
+ List elemList = getElementList( xpathExpr );
+ if ( elemList == null )
+ {
+ return null;
+ }
+
+ List ret = new ArrayList();
+ for ( Iterator iter = elemList.iterator(); iter.hasNext(); )
+ {
+ Element listelem = (Element) iter.next();
+ ret.add( listelem.getTextTrim() );
+ }
+ return ret;
+ }
+
+}
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/XMLReader.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/XMLReader.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/XMLReader.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/examples/no-prolog-basic.xml
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/examples/no-prolog-basic.xml?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/examples/no-prolog-basic.xml (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/examples/no-prolog-basic.xml Tue Apr 3 08:21:33 2007
@@ -0,0 +1,14 @@
+<basic>
+ <fruits>
+ <fruit>
+ apple
+ </fruit>
+ <fruit><![CDATA[
+ cherry
+ ]]></fruit>
+ <fruit>
+ <![CDATA[pear]]>
+ </fruit>
+ <fruit>peach</fruit>
+ </fruits>
+</basic>
\ No newline at end of file
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/examples/no-prolog-basic.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/examples/no-prolog-basic.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/examples/no-prolog-basic.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/examples/no-prolog-with-entities.xml
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/examples/no-prolog-with-entities.xml?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/examples/no-prolog-with-entities.xml (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/examples/no-prolog-with-entities.xml Tue Apr 3 08:21:33 2007
@@ -0,0 +1,6 @@
+<basic>
+ <names>
+ <name>Trygve Laugstøl</name>
+ <name>The ∞ Archiva</name>
+ </names>
+</basic>
\ No newline at end of file
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/examples/no-prolog-with-entities.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/examples/no-prolog-with-entities.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/examples/no-prolog-with-entities.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/examples/no-prolog-with-utf8.xml
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/examples/no-prolog-with-utf8.xml?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/examples/no-prolog-with-utf8.xml (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/examples/no-prolog-with-utf8.xml Tue Apr 3 08:21:33 2007
@@ -0,0 +1,6 @@
+<basic>
+ <names>
+ <name>Trygve Laugstøl</name>
+ <name>The â Archiva</name>
+ </names>
+</basic>
\ No newline at end of file
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/examples/no-prolog-with-utf8.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/examples/no-prolog-with-utf8.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/examples/no-prolog-with-utf8.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/examples/prolog-with-utf8.xml
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/examples/prolog-with-utf8.xml?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/examples/prolog-with-utf8.xml (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/examples/prolog-with-utf8.xml Tue Apr 3 08:21:33 2007
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<basic>
+ <names>
+ <name>Trygve Laugstøl</name>
+ <name>The â Archiva</name>
+ </names>
+</basic>
\ No newline at end of file
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/examples/prolog-with-utf8.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/examples/prolog-with-utf8.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/examples/prolog-with-utf8.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/java/org/apache/maven/archiva/xml/XMLReaderTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/java/org/apache/maven/archiva/xml/XMLReaderTest.java?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/java/org/apache/maven/archiva/xml/XMLReaderTest.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/java/org/apache/maven/archiva/xml/XMLReaderTest.java Tue Apr 3 08:21:33 2007
@@ -0,0 +1,113 @@
+package org.apache.maven.archiva.xml;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.dom4j.Element;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+/**
+ * XMLReaderTest
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class XMLReaderTest
+ extends TestCase
+{
+ private File getExampleXml( String filename )
+ {
+ File examplesDir = new File( "src/test/examples" );
+ if ( !examplesDir.exists() )
+ {
+ fail( "Missing the examples directory: " + examplesDir.getAbsolutePath() );
+ }
+ File exampleFile = new File( examplesDir, filename );
+ if ( !exampleFile.exists() )
+ {
+ fail( "Missing the example xml file: " + exampleFile.getAbsolutePath() );
+ }
+ return exampleFile;
+ }
+
+ private void assertElementTexts( List elementList, String[] expectedTexts )
+ {
+ assertEquals( "Element List Size", expectedTexts.length, elementList.size() );
+
+ List texts = new ArrayList();
+ for ( Iterator iter = elementList.iterator(); iter.hasNext(); )
+ {
+ Element element = (Element) iter.next();
+ texts.add( element.getTextTrim() );
+ }
+
+ for ( int i = 0; i < expectedTexts.length; i++ )
+ {
+ String expectedText = expectedTexts[i];
+ assertTrue( "Contains [" + expectedText + "]", texts.contains( expectedText ) );
+ }
+ }
+
+ public void testNoPrologBasicRead()
+ throws XMLException
+ {
+ File xmlFile = getExampleXml( "no-prolog-basic.xml" );
+ XMLReader reader = new XMLReader( "basic", xmlFile );
+
+ List fruits = reader.getElementList( "//basic/fruits/fruit" );
+ assertElementTexts( fruits, new String[] { "apple", "cherry", "pear", "peach" } );
+ }
+
+ public void testNoPrologEntitiesRead()
+ throws XMLException
+ {
+ File xmlFile = getExampleXml( "no-prolog-with-entities.xml" );
+ XMLReader reader = new XMLReader( "basic", xmlFile );
+
+ List names = reader.getElementList( "//basic/names/name" );
+ assertElementTexts( names, new String[] { "Trygve Laugstøl", "The â Archiva" } );
+ }
+
+ public void testNoPrologUtf8Read()
+ throws XMLException
+ {
+ File xmlFile = getExampleXml( "no-prolog-with-utf8.xml" );
+ XMLReader reader = new XMLReader( "basic", xmlFile );
+
+ List names = reader.getElementList( "//basic/names/name" );
+ assertElementTexts( names, new String[] { "Trygve Laugstøl", "The â Archiva" } );
+ }
+
+ public void testPrologUtf8Read()
+ throws XMLException
+ {
+ File xmlFile = getExampleXml( "prolog-with-utf8.xml" );
+ XMLReader reader = new XMLReader( "basic", xmlFile );
+
+ List names = reader.getElementList( "//basic/names/name" );
+ assertElementTexts( names, new String[] { "Trygve Laugstøl", "The â Archiva" } );
+ }
+
+}
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/java/org/apache/maven/archiva/xml/XMLReaderTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/java/org/apache/maven/archiva/xml/XMLReaderTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-xml-tools/src/test/java/org/apache/maven/archiva/xml/XMLReaderTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/pom.xml
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/pom.xml?view=diff&rev=525176&r1=525175&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/pom.xml (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/pom.xml Tue Apr 3 08:21:33 2007
@@ -35,7 +35,8 @@
<module>archiva-consumers</module>
<module>archiva-indexer</module>
<module>archiva-model</module>
- <module>archiva-proxy</module>
+ <!-- <module>archiva-proxy</module> -->
<module>archiva-repository-layer</module>
+ <module>archiva-xml-tools</module>
</modules>
</project>
Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/pom.xml
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/pom.xml?view=diff&rev=525176&r1=525175&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/pom.xml (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/pom.xml Tue Apr 3 08:21:33 2007
@@ -33,9 +33,25 @@
<artifactId>archiva-converter</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.maven.archiva</groupId>
+ <artifactId>archiva-repository-layer</artifactId>
+ </dependency>
+ <!--
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-component-api</artifactId>
+ <version>1.0-alpha-22</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-container-default</artifactId>
+ <version>1.0-alpha-22</version>
+ </dependency>
+ -->
+ <dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-cli</artifactId>
- <version>1.0</version>
+ <version>1.1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/AbstractProgressConsumer.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/AbstractProgressConsumer.java?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/AbstractProgressConsumer.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/AbstractProgressConsumer.java Tue Apr 3 08:21:33 2007
@@ -0,0 +1,61 @@
+package org.apache.maven.archiva.cli;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
+import org.apache.maven.archiva.consumers.ConsumerException;
+import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
+import org.apache.maven.archiva.model.ArchivaRepository;
+
+/**
+ * AbstractProgressConsumer
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public abstract class AbstractProgressConsumer
+ extends AbstractMonitoredConsumer
+ implements RepositoryContentConsumer
+{
+ private int count = 0;
+
+ public void beginScan( ArchivaRepository repository )
+ throws ConsumerException
+ {
+ this.count = 0;
+ }
+
+ public void processFile( String path )
+ throws ConsumerException
+ {
+ count++;
+ if ( ( count % 1000 ) == 0 )
+ {
+ System.out.println( "Files Processed: " + count );
+ }
+
+ }
+
+ public void completeScan()
+ {
+ System.out.println( "Final Count of Artifacts processed by " + getId() + ": " + count );
+ }
+
+}
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/AbstractProgressConsumer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/AbstractProgressConsumer.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/AbstractProgressConsumer.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java?view=diff&rev=525176&r1=525175&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java Tue Apr 3 08:21:33 2007
@@ -20,19 +20,32 @@
*/
import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.common.utils.DateUtil;
+import org.apache.maven.archiva.consumers.ConsumerException;
+import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
import org.apache.maven.archiva.converter.RepositoryConversionException;
import org.apache.maven.archiva.converter.legacy.LegacyRepositoryConverter;
+import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.model.RepositoryContentStatistics;
+import org.apache.maven.archiva.repository.RepositoryException;
+import org.apache.maven.archiva.repository.scanner.RepositoryScanner;
import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.codehaus.plexus.tools.cli.AbstractCli;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Properties;
/**
@@ -47,6 +60,12 @@
public static final char CONVERT = 'c';
+ public static final char SCAN = 's';
+
+ public static final char CONSUMERS = 'u';
+
+ public static final char LIST_CONSUMERS = 'l';
+
// ----------------------------------------------------------------------------
// Properties controlling Repository conversion
// ----------------------------------------------------------------------------
@@ -68,11 +87,36 @@
return "META-INF/maven/org.apache.maven.archiva/archiva-cli/pom.properties";
}
+ private Option createOption( char shortOpt, String longOpt, int argCount, String description )
+ {
+ boolean hasArg = ( argCount > 0 );
+ Option opt = new Option( String.valueOf( shortOpt ), hasArg, description );
+ opt.setLongOpt( longOpt );
+ if ( hasArg )
+ {
+ opt.setArgs( argCount );
+ }
+ return opt;
+ }
+
public Options buildCliOptions( Options options )
{
- options.addOption( OptionBuilder.withLongOpt( "convert" ).hasArg().withDescription(
- "Convert a legacy Maven 1.x repository to a Maven 2.x repository using a properties file to describe the conversion." )
- .create( CONVERT ) );
+ Option convertOption = createOption( CONVERT, "convert", 1, "Convert a legacy Maven 1.x repository to a "
+ + "Maven 2.x repository using a properties file to describe the conversion." );
+ convertOption.setArgName( "conversion.properties" );
+ options.addOption( convertOption );
+
+ Option scanOption = createOption( SCAN, "scan", 1, "Scan the specified repository." );
+ scanOption.setArgName( "repository directory" );
+ options.addOption( scanOption );
+
+ Option consumerOption = createOption( CONSUMERS, "consumers", 1, "The consumers to use. "
+ + "(comma delimited. default: 'count-artifacts')" );
+ consumerOption.setArgName( "consumer list" );
+ options.addOption( consumerOption );
+
+ Option listConsumersOption = createOption( LIST_CONSUMERS, "listconsumers", 0, "List available consumers." );
+ options.addOption( listConsumersOption );
return options;
}
@@ -80,47 +124,147 @@
public void invokePlexusComponent( CommandLine cli, PlexusContainer plexus )
throws Exception
{
- LegacyRepositoryConverter legacyRepositoryConverter =
- (LegacyRepositoryConverter) plexus.lookup( LegacyRepositoryConverter.ROLE );
-
if ( cli.hasOption( CONVERT ) )
{
- Properties p = new Properties();
+ doConversion( cli, plexus );
+ }
+ else if ( cli.hasOption( SCAN ) )
+ {
+ doScan( cli, plexus );
+ }
+ else if ( cli.hasOption( LIST_CONSUMERS ) )
+ {
+ dumpAvailableConsumers( plexus );
+ }
+ else
+ {
+ displayHelp();
+ }
+ }
- try
- {
- p.load( new FileInputStream( cli.getOptionValue( CONVERT ) ) );
- }
- catch ( IOException e )
- {
- showFatalError( "Cannot find properties file which describes the conversion.", e, true );
- }
+ private void doScan( CommandLine cli, PlexusContainer plexus )
+ throws ConsumerException, ComponentLookupException
+ {
+ String path = cli.getOptionValue( SCAN );
- File oldRepositoryPath = new File( p.getProperty( SOURCE_REPO_PATH ) );
+ ArchivaRepository repo = new ArchivaRepository( "cliRepo", "Archiva CLI Provided Repo", "file://" + path );
- File newRepositoryPath = new File( p.getProperty( TARGET_REPO_PATH ) );
+ List consumerList = new ArrayList();
- System.out.println( "Converting " + oldRepositoryPath + " to " + newRepositoryPath );
+ consumerList.addAll( getConsumerList( cli, plexus ) );
- List fileExclusionPatterns = null;
+ RepositoryScanner scanner = new RepositoryScanner();
- String s = p.getProperty( BLACKLISTED_PATTERNS );
+ try
+ {
+ RepositoryContentStatistics stats = scanner.scan( repo, consumerList, true );
- if ( s != null )
- {
- fileExclusionPatterns = Arrays.asList( StringUtils.split( s, "," ) );
- }
+ SimpleDateFormat df = new SimpleDateFormat();
+ System.out.println( ".\\ Scan of " + repo.getId() + " \\.__________________________________________" );
+ System.out.println( " Repository URL : " + repo.getUrl() );
+ System.out.println( " Repository Name : " + repo.getModel().getName() );
+ System.out.println( " Repository Layout : " + repo.getModel().getLayoutName() );
+ System.out.println( " Duration : " + DateUtil.getDuration( stats.getDuration() ) );
+ System.out.println( " When Gathered : " + df.format( stats.getWhenGathered() ) );
+ System.out.println( " Total File Count : " + stats.getTotalFileCount() );
+ System.out.println( " New File Count : " + stats.getNewFileCount() );
+ System.out.println( "______________________________________________________________" );
+ }
+ catch ( RepositoryException e )
+ {
+ e.printStackTrace( System.err );
+ }
+ }
- try
- {
- legacyRepositoryConverter.convertLegacyRepository( oldRepositoryPath, newRepositoryPath,
- fileExclusionPatterns,
- true );
- }
- catch ( RepositoryConversionException e )
+ private Collection getConsumerList( CommandLine cli, PlexusContainer plexus )
+ throws ComponentLookupException, ConsumerException
+ {
+ String specifiedConsumers = "count-artifacts";
+
+ if ( cli.hasOption( CONSUMERS ) )
+ {
+ specifiedConsumers = cli.getOptionValue( CONSUMERS );
+ }
+
+ List consumerList = new ArrayList();
+
+ Map availableConsumers = plexus.lookupMap( RepositoryContentConsumer.class );
+
+ String consumerArray[] = StringUtils.split( specifiedConsumers, ',' );
+
+ for ( int i = 0; i < consumerArray.length; i++ )
+ {
+ String specifiedConsumer = consumerArray[i];
+ if ( !availableConsumers.containsKey( specifiedConsumer ) )
{
- showFatalError( "Error converting repository.", e, true );
+ System.err.println( "Specified consumer [" + specifiedConsumer + "] not found." );
+ dumpAvailableConsumers( plexus );
+ System.exit( 1 );
}
+
+ consumerList.add( availableConsumers.get( specifiedConsumer ) );
+ }
+
+ return consumerList;
+ }
+
+ private void dumpAvailableConsumers( PlexusContainer plexus )
+ throws ComponentLookupException
+ {
+ Map availableConsumers = plexus.lookupMap( RepositoryContentConsumer.class );
+
+ System.out.println( ".\\ Available Consumer List \\.______________________________" );
+
+ for ( Iterator iter = availableConsumers.entrySet().iterator(); iter.hasNext(); )
+ {
+ Map.Entry entry = (Map.Entry) iter.next();
+ String consumerHint = (String) entry.getKey();
+ RepositoryContentConsumer consumer = (RepositoryContentConsumer) entry.getValue();
+ System.out.println( " " + consumerHint + ": " + consumer.getDescription() + " ("
+ + consumer.getClass().getName() + ")" );
+ }
+ }
+
+ private void doConversion( CommandLine cli, PlexusContainer plexus )
+ throws ComponentLookupException
+ {
+ LegacyRepositoryConverter legacyRepositoryConverter = (LegacyRepositoryConverter) plexus
+ .lookup( LegacyRepositoryConverter.ROLE );
+
+ Properties p = new Properties();
+
+ try
+ {
+ p.load( new FileInputStream( cli.getOptionValue( CONVERT ) ) );
+ }
+ catch ( IOException e )
+ {
+ showFatalError( "Cannot find properties file which describes the conversion.", e, true );
+ }
+
+ File oldRepositoryPath = new File( p.getProperty( SOURCE_REPO_PATH ) );
+
+ File newRepositoryPath = new File( p.getProperty( TARGET_REPO_PATH ) );
+
+ System.out.println( "Converting " + oldRepositoryPath + " to " + newRepositoryPath );
+
+ List fileExclusionPatterns = null;
+
+ String s = p.getProperty( BLACKLISTED_PATTERNS );
+
+ if ( s != null )
+ {
+ fileExclusionPatterns = Arrays.asList( StringUtils.split( s, "," ) );
+ }
+
+ try
+ {
+ legacyRepositoryConverter.convertLegacyRepository( oldRepositoryPath, newRepositoryPath,
+ fileExclusionPatterns, true );
+ }
+ catch ( RepositoryConversionException e )
+ {
+ showFatalError( "Error converting repository.", e, true );
}
}
}
Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArtifactCountConsumer.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArtifactCountConsumer.java?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArtifactCountConsumer.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArtifactCountConsumer.java Tue Apr 3 08:21:33 2007
@@ -0,0 +1,95 @@
+package org.apache.maven.archiva.cli;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * ArtifactCountConsumer
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ *
+ * @plexus.component role="org.apache.maven.archiva.consumers.RepositoryContentConsumer"
+ * role-hint="count-artifacts"
+ * instantiation-strategy="per-lookup"
+ */
+public class ArtifactCountConsumer
+ extends AbstractProgressConsumer
+ implements RepositoryContentConsumer
+{
+ /**
+ * @plexus.configuration default-value="count-artifacts"
+ */
+ private String id;
+
+ /**
+ * @plexus.configuration default-value="Count Artifacts"
+ */
+ private String description;
+
+ private List includes;
+
+ public ArtifactCountConsumer()
+ {
+ includes = new ArrayList();
+ includes.add( "**/*.pom" );
+ includes.add( "**/*.jar" );
+ includes.add( "**/*.war" );
+ includes.add( "**/*.ear" );
+ includes.add( "**/*.sar" );
+ includes.add( "**/*.car" );
+ includes.add( "**/*.mar" );
+ includes.add( "**/*.dtd" );
+ includes.add( "**/*.tld" );
+ includes.add( "**/*.gz" );
+ includes.add( "**/*.bz2" );
+ includes.add( "**/*.zip" );
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public boolean isPermanent()
+ {
+ return false;
+ }
+
+ public List getExcludes()
+ {
+ return null;
+ }
+
+ public List getIncludes()
+ {
+ return includes;
+ }
+
+}
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArtifactCountConsumer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArtifactCountConsumer.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArtifactCountConsumer.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ProjectReaderConsumer.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ProjectReaderConsumer.java?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ProjectReaderConsumer.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ProjectReaderConsumer.java Tue Apr 3 08:21:33 2007
@@ -0,0 +1,124 @@
+package org.apache.maven.archiva.cli;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.archiva.consumers.ConsumerException;
+import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
+import org.apache.maven.archiva.model.ArchivaProjectModel;
+import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.repository.project.ProjectModel400Reader;
+import org.apache.maven.archiva.repository.project.ProjectModelException;
+import org.apache.maven.archiva.repository.project.ProjectModelReader;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * ProjectReaderConsumer
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ *
+ * @plexus.component role="org.apache.maven.archiva.consumers.RepositoryContentConsumer"
+ * role-hint="read-poms"
+ * instantiation-strategy="per-lookup"
+ */
+public class ProjectReaderConsumer
+ extends AbstractProgressConsumer
+ implements RepositoryContentConsumer
+{
+ /**
+ * @plexus.configuration default-value="read-poms"
+ */
+ private String id;
+
+ /**
+ * @plexus.configuration default-value="Read POMs and report anomolies."
+ */
+ private String description;
+
+ private ProjectModelReader reader;
+
+ private ArchivaRepository repo;
+
+ private List includes;
+
+ public ProjectReaderConsumer()
+ {
+ reader = new ProjectModel400Reader();
+
+ includes = new ArrayList();
+ includes.add( "**/*.pom" );
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public boolean isPermanent()
+ {
+ return false;
+ }
+
+ public List getExcludes()
+ {
+ return null;
+ }
+
+ public List getIncludes()
+ {
+ return includes;
+ }
+
+ public void beginScan( ArchivaRepository repository )
+ throws ConsumerException
+ {
+ super.beginScan( repository );
+ this.repo = repository;
+ }
+
+ public void processFile( String path )
+ throws ConsumerException
+ {
+ super.processFile( path );
+
+ File pomFile = new File( repo.getUrl().getPath(), path );
+ try
+ {
+ ArchivaProjectModel model = reader.read( pomFile );
+ if ( model == null )
+ {
+ System.err.println( "Got null model on " + pomFile );
+ }
+ }
+ catch ( ProjectModelException e )
+ {
+ System.err.println( "Unable to process: " + pomFile );
+ e.printStackTrace( System.out );
+ }
+ }
+}
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ProjectReaderConsumer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ProjectReaderConsumer.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ProjectReaderConsumer.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/resources/log4j.properties
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/resources/log4j.properties?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/resources/log4j.properties (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-cli/src/main/resources/log4j.properties Tue Apr 3 08:21:33 2007
@@ -0,0 +1,10 @@
+# Set root logger level to DEBUG and its only appender to A1.
+log4j.rootLogger=INFO, A1
+
+# A1 is set to be a ConsoleAppender.
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+
+# A1 uses PatternLayout.
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
+
Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-consumer-api/pom.xml
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-consumer-api/pom.xml?view=diff&rev=525176&r1=525175&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-consumer-api/pom.xml (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-consumer-api/pom.xml Tue Apr 3 08:21:33 2007
@@ -26,7 +26,7 @@
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <artifactId>archiva-consumer-api</artifactId>
+ <artifactId>archiva-consumer-api-OLD</artifactId>
<name>Archiva Consumer API</name>
<dependencies>
<dependency>
Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/MockArtifactConsumer.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/MockArtifactConsumer.java?view=diff&rev=525176&r1=525175&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/MockArtifactConsumer.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/MockArtifactConsumer.java Tue Apr 3 08:21:33 2007
@@ -21,6 +21,7 @@
import org.apache.maven.archiva.common.utils.BaseFile;
import org.apache.maven.archiva.common.utils.PathUtil;
+import org.apache.maven.archiva.consumers.core.GenericArtifactConsumer;
import org.apache.maven.artifact.Artifact;
import java.util.HashMap;
Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/MockModelConsumer.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/MockModelConsumer.java?view=diff&rev=525176&r1=525175&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/MockModelConsumer.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/MockModelConsumer.java Tue Apr 3 08:21:33 2007
@@ -20,7 +20,7 @@
*/
import org.apache.maven.archiva.common.utils.BaseFile;
-import org.apache.maven.archiva.consumers.GenericModelConsumer;
+import org.apache.maven.archiva.consumers.core.GenericModelConsumer;
import org.apache.maven.model.Model;
import java.util.HashMap;
Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/MockRepositoryMetadataConsumer.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/MockRepositoryMetadataConsumer.java?view=diff&rev=525176&r1=525175&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/MockRepositoryMetadataConsumer.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/MockRepositoryMetadataConsumer.java Tue Apr 3 08:21:33 2007
@@ -20,7 +20,7 @@
*/
import org.apache.maven.archiva.common.utils.BaseFile;
-import org.apache.maven.archiva.consumers.GenericRepositoryMetadataConsumer;
+import org.apache.maven.archiva.consumers.core.GenericRepositoryMetadataConsumer;
import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
import java.util.HashMap;
Modified: maven/archiva/branches/archiva-jpox-database-refactor/pom.xml
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/pom.xml?view=diff&rev=525176&r1=525175&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/pom.xml (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/pom.xml Tue Apr 3 08:21:33 2007
@@ -248,6 +248,16 @@
</dependency>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
+ <artifactId>archiva-model</artifactId>
+ <version>${archiva.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.archiva</groupId>
+ <artifactId>archiva-database</artifactId>
+ <version>${archiva.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-discoverer</artifactId>
<version>${archiva.version}</version>
</dependency>
@@ -300,7 +310,7 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-digest</artifactId>
- <version>1.0</version>
+ <version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus.security</groupId>