Author: andreas
Date: Thu Jul 10 07:35:49 2008
New Revision: 675594
URL: http://svn.apache.org/viewvc?rev=675594&view=rev
Log:
Adding diff functionality based on the longest common subsequence algorithm, adding diffAuthoringLive usecase.
Added:
lenya/docu/modules/diff/config/cocoon-xconf/usecase-diffAuthoringLive.xconf
lenya/docu/modules/diff/config/menu.xml
lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/
lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/AttributeName.java
lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/DiffGenerator.java
lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/DiffHandler.java
lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/DomSerializer.java
lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/EndTag.java
lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/FragmentHandler.java
lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/FragmentingHandler.java
lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/LcsDiff.java
lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/LongestCommonSubsequence.java
lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/NamedObject.java
lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/SaxHandler.java
lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/StartTagEnd.java
lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/StartTagStart.java
lenya/docu/modules/diff/java/test/org/apache/lenya/modules/diff/lcs/
lenya/docu/modules/diff/java/test/org/apache/lenya/modules/diff/lcs/LcsDiffTest.java
lenya/docu/modules/diff/java/test/org/apache/lenya/modules/diff/lcs/test1.xml
lenya/docu/modules/diff/java/test/org/apache/lenya/modules/diff/lcs/test2.xml
lenya/docu/modules/diff/sitemap.xmap
Modified:
lenya/docu/modules/diff/usecases/diff.jx
Added: lenya/docu/modules/diff/config/cocoon-xconf/usecase-diffAuthoringLive.xconf
URL: http://svn.apache.org/viewvc/lenya/docu/modules/diff/config/cocoon-xconf/usecase-diffAuthoringLive.xconf?rev=675594&view=auto
==============================================================================
--- lenya/docu/modules/diff/config/cocoon-xconf/usecase-diffAuthoringLive.xconf (added)
+++ lenya/docu/modules/diff/config/cocoon-xconf/usecase-diffAuthoringLive.xconf Thu Jul 10 07:35:49 2008
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
+<!--
+ This file defines the publication specific use-cases
+-->
+
+ <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'diff.diffAuthoringLive']">
+ <component-instance name="diff.diffAuthoringLive"
+ logger="org.apache.lenya.modules.diff"
+ class="org.apache.lenya.cms.usecase.DummyUsecase">
+ <view uri="modules/diff/usecases/diff.jx" menu="true" createContinuation="false"/>
+ </component-instance>
+ </xconf>
Added: lenya/docu/modules/diff/config/menu.xml
URL: http://svn.apache.org/viewvc/lenya/docu/modules/diff/config/menu.xml?rev=675594&view=auto
==============================================================================
--- lenya/docu/modules/diff/config/menu.xml (added)
+++ lenya/docu/modules/diff/config/menu.xml Thu Jul 10 07:35:49 2008
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<menu xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+ xmlns:uc="http://apache.org/cocoon/lenya/usecase/1.0"
+ xmlns="http://apache.org/cocoon/lenya/menubar/1.0">
+ <menus>
+ <menu i18n:attr="name" name="Workflow">
+ <block areas="authoring">
+ <item uc:usecase="diff.diffAuthoringLive"><i18n:text>Diff to live</i18n:text></item>
+ </block>
+ </menu>
+ </menus>
+</menu>
Added: lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/AttributeName.java
URL: http://svn.apache.org/viewvc/lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/AttributeName.java?rev=675594&view=auto
==============================================================================
--- lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/AttributeName.java (added)
+++ lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/AttributeName.java Thu Jul 10 07:35:49 2008
@@ -0,0 +1,20 @@
+package org.apache.lenya.modules.diff.lcs;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Node;
+
+public class AttributeName extends NamedObject {
+
+ public AttributeName(Attr attr) {
+ this(attr.getNamespaceURI(), attr.getLocalName());
+ }
+
+ public AttributeName(String namespaceUri, String localName) {
+ super(namespaceUri, localName);
+ }
+
+ public String toString() {
+ return "{" + getNamespaceUri() + "}" + getLocalName() + "=";
+ }
+
+}
Added: lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/DiffGenerator.java
URL: http://svn.apache.org/viewvc/lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/DiffGenerator.java?rev=675594&view=auto
==============================================================================
--- lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/DiffGenerator.java (added)
+++ lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/DiffGenerator.java Thu Jul 10 07:35:49 2008
@@ -0,0 +1,45 @@
+package org.apache.lenya.modules.diff.lcs;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.generation.AbstractGenerator;
+import org.apache.lenya.cms.cocoon.source.SourceUtil;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+public class DiffGenerator extends AbstractGenerator implements Serviceable {
+
+ private ServiceManager manager;
+
+ public void generate() throws IOException, SAXException, ProcessingException {
+
+ try {
+ String oldUri = this.parameters.getParameter("oldUri");
+ String newUri = this.parameters.getParameter("newUri");
+
+ Document oldXml = SourceUtil.readDOM(oldUri, this.manager);
+ Document newXml = SourceUtil.readDOM(newUri, this.manager);
+
+ DomSerializer serializer = new DomSerializer();
+ List oldList = serializer.serialize(oldXml);
+ List newList = serializer.serialize(newXml);
+
+ DiffHandler handler = new FragmentingHandler(new SaxHandler(this.contentHandler));
+ new LcsDiff().diff(oldList, newList, handler);
+
+ } catch (Exception e) {
+ throw new ProcessingException(e);
+ }
+
+ }
+
+ public void service(ServiceManager manager) throws ServiceException {
+ this.manager = manager;
+ }
+
+}
Added: lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/DiffHandler.java
URL: http://svn.apache.org/viewvc/lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/DiffHandler.java?rev=675594&view=auto
==============================================================================
--- lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/DiffHandler.java (added)
+++ lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/DiffHandler.java Thu Jul 10 07:35:49 2008
@@ -0,0 +1,15 @@
+package org.apache.lenya.modules.diff.lcs;
+
+public interface DiffHandler {
+
+ void equal(Object obj) throws Exception;
+
+ void added(Object newObj) throws Exception;
+
+ void removed(Object oldObj) throws Exception;
+
+ void start() throws Exception;
+
+ void end() throws Exception;
+
+}
Added: lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/DomSerializer.java
URL: http://svn.apache.org/viewvc/lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/DomSerializer.java?rev=675594&view=auto
==============================================================================
--- lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/DomSerializer.java (added)
+++ lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/DomSerializer.java Thu Jul 10 07:35:49 2008
@@ -0,0 +1,84 @@
+package org.apache.lenya.modules.diff.lcs;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+
+public class DomSerializer {
+
+ public List serialize(Document dom) {
+ return serialize(dom.getDocumentElement());
+ }
+
+ protected static final String XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/";
+
+ protected List serialize(Element element) {
+ List list = new ArrayList();
+ StartTagStart startTag = new StartTagStart(element);
+ list.add(startTag);
+
+ SortedMap attrMap = new TreeMap();
+ NamedNodeMap attrs = element.getAttributes();
+ for (int i = 0; i < attrs.getLength(); i++) {
+ Attr attr = (Attr) attrs.item(i);
+ String ns = attr.getNamespaceURI();
+ if (ns == null || !ns.equals(XMLNS_NAMESPACE)) {
+ String key = getUniversalName(attr);
+ attrMap.put(key, attr);
+ }
+ }
+ for (Iterator i = attrMap.keySet().iterator(); i.hasNext(); ) {
+ String name = (String) i.next();
+ Attr attr = (Attr) attrMap.get(name);
+ list.add(new AttributeName(attr));
+ list.addAll(serialize(attr.getValue()));
+ }
+
+ StartTagEnd startTagEnd = new StartTagEnd(element);
+ list.add(startTagEnd);
+
+ NodeList children = element.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ Node node = children.item(i);
+ if (node instanceof Element) {
+ list.addAll(serialize((Element) node));
+ }
+ else if (node instanceof Text) {
+ list.addAll(serialize((Text) node));
+ }
+ }
+
+ EndTag endTag = new EndTag(element);
+ list.add(endTag);
+ return list;
+ }
+
+ protected List serialize(Text node) {
+ return serialize(node.getNodeValue().trim());
+ }
+
+ protected String getUniversalName(Node node) {
+ return "{" + node.getNamespaceURI() + "}" + node.getLocalName();
+ }
+
+ protected List serialize(String text) {
+ List list = new ArrayList();
+ String[] words = text.split("\\s");
+ for (int i = 0; i < words.length; i++) {
+ list.add(words[i]);
+ }
+ return list;
+ }
+
+}
Added: lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/EndTag.java
URL: http://svn.apache.org/viewvc/lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/EndTag.java?rev=675594&view=auto
==============================================================================
--- lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/EndTag.java (added)
+++ lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/EndTag.java Thu Jul 10 07:35:49 2008
@@ -0,0 +1,19 @@
+package org.apache.lenya.modules.diff.lcs;
+
+import org.w3c.dom.Element;
+
+public class EndTag extends NamedObject {
+
+ public EndTag(String namespaceUri, String localName) {
+ super(namespaceUri, localName);
+ }
+
+ public EndTag(Element element) {
+ this(element.getNamespaceURI(), element.getLocalName());
+ }
+
+ public String toString() {
+ return "</{" + getNamespaceUri() + "}" + getLocalName() + ">";
+ }
+
+}
Added: lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/FragmentHandler.java
URL: http://svn.apache.org/viewvc/lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/FragmentHandler.java?rev=675594&view=auto
==============================================================================
--- lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/FragmentHandler.java (added)
+++ lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/FragmentHandler.java Thu Jul 10 07:35:49 2008
@@ -0,0 +1,19 @@
+package org.apache.lenya.modules.diff.lcs;
+
+public interface FragmentHandler {
+
+ void startAdding() throws Exception;
+
+ void endAdding() throws Exception;
+
+ void startRemoving() throws Exception;
+
+ void endRemoving() throws Exception;
+
+ void element(Object obj) throws Exception;
+
+ void start() throws Exception;
+
+ void end() throws Exception;
+
+}
Added: lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/FragmentingHandler.java
URL: http://svn.apache.org/viewvc/lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/FragmentingHandler.java?rev=675594&view=auto
==============================================================================
--- lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/FragmentingHandler.java (added)
+++ lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/FragmentingHandler.java Thu Jul 10 07:35:49 2008
@@ -0,0 +1,58 @@
+package org.apache.lenya.modules.diff.lcs;
+
+public class FragmentingHandler implements DiffHandler {
+
+ private static final int ADDING = 2;
+ private static final int REMOVING = 1;
+ private static final int EQUAL = 0;
+
+ private int state = EQUAL;
+
+ private FragmentHandler handler;
+
+ public FragmentingHandler(FragmentHandler handler) {
+ this.handler = handler;
+ }
+
+ public void added(Object newObj) throws Exception {
+ endRemoving();
+ state = ADDING;
+ handler.startAdding();
+ handler.element(newObj);
+ }
+
+ protected void endRemoving() throws Exception {
+ if (state == REMOVING) {
+ handler.endRemoving();
+ }
+ }
+
+ public void equal(Object obj) throws Exception {
+ endRemoving();
+ endAdding();
+ handler.element(obj);
+ state = EQUAL;
+ }
+
+ public void removed(Object oldObj) throws Exception {
+ endAdding();
+ state = REMOVING;
+ handler.startRemoving();
+ handler.element(oldObj);
+ }
+
+ protected void endAdding() throws Exception {
+ if (state == ADDING) {
+ handler.endAdding();
+ }
+ }
+
+ public void end() throws Exception {
+ handler.end();
+ }
+
+ public void start() throws Exception {
+ handler.start();
+ }
+
+}
Added: lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/LcsDiff.java
URL: http://svn.apache.org/viewvc/lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/LcsDiff.java?rev=675594&view=auto
==============================================================================
--- lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/LcsDiff.java (added)
+++ lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/LcsDiff.java Thu Jul 10 07:35:49 2008
@@ -0,0 +1,40 @@
+package org.apache.lenya.modules.diff.lcs;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.lenya.util.Queue;
+
+public class LcsDiff {
+
+ public void diff(List oldList, List newList, DiffHandler handler) throws Exception {
+ List lcs = LongestCommonSubsequence.getLongestCommonSubsequence(oldList, newList);
+ Queue oldQueue = new Queue(oldList);
+ Queue newQueue = new Queue(newList);
+ Queue lcsQueue = new Queue(lcs);
+
+ handler.start();
+
+ while (!lcsQueue.isEmpty()) {
+ Object o = lcsQueue.out();
+ while (!oldQueue.front().equals(o)) {
+ handler.removed(oldQueue.out());
+ }
+ while (!newQueue.front().equals(o)) {
+ handler.added(newQueue.out());
+ }
+ oldQueue.out();
+ newQueue.out();
+ handler.equal(o);
+ }
+ while (!oldQueue.isEmpty()) {
+ handler.removed(oldQueue.out());
+ }
+ while (!newQueue.isEmpty()) {
+ handler.added(newQueue.out());
+ }
+
+ handler.end();
+ }
+
+}
Added: lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/LongestCommonSubsequence.java
URL: http://svn.apache.org/viewvc/lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/LongestCommonSubsequence.java?rev=675594&view=auto
==============================================================================
--- lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/LongestCommonSubsequence.java (added)
+++ lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/LongestCommonSubsequence.java Thu Jul 10 07:35:49 2008
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ *
+ */
+package org.apache.lenya.modules.diff.lcs;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class LongestCommonSubsequence {
+
+ // These are "constants" which indicate a direction in the backtracking array.
+ private static final int NEITHER = 0;
+ private static final int UP = 1;
+ private static final int LEFT = 2;
+ private static final int UP_AND_LEFT = 3;
+
+ public static List getLongestCommonSubsequence(List a, List b) {
+ int n = a.size();
+ int m = b.size();
+ int S[][] = new int[n + 1][m + 1];
+ int R[][] = new int[n + 1][m + 1];
+ int ii, jj;
+
+ // It is important to use <=, not <. The next two for-loops are initialization
+ for (ii = 0; ii <= n; ++ii) {
+ S[ii][0] = 0;
+ R[ii][0] = UP;
+ }
+ for (jj = 0; jj <= m; ++jj) {
+ S[0][jj] = 0;
+ R[0][jj] = LEFT;
+ }
+
+ // This is the main dynamic programming loop that computes the score and
+ // backtracking arrays.
+ for (ii = 1; ii <= n; ++ii) {
+ for (jj = 1; jj <= m; ++jj) {
+
+ Object aObj = a.get(ii - 1);
+ Object bObj = b.get(jj - 1);
+
+ if (aObj.equals(bObj)) {
+ S[ii][jj] = S[ii - 1][jj - 1] + 1;
+ R[ii][jj] = UP_AND_LEFT;
+ }
+
+ else {
+ S[ii][jj] = S[ii - 1][jj - 1] + 0;
+ R[ii][jj] = NEITHER;
+ }
+
+ if (S[ii - 1][jj] >= S[ii][jj]) {
+ S[ii][jj] = S[ii - 1][jj];
+ R[ii][jj] = UP;
+ }
+
+ if (S[ii][jj - 1] >= S[ii][jj]) {
+ S[ii][jj] = S[ii][jj - 1];
+ R[ii][jj] = LEFT;
+ }
+ }
+ }
+
+ // The length of the longest substring is S[n][m]
+ ii = n;
+ jj = m;
+ int pos = S[ii][jj] - 1;
+ Object lcs[] = new Object[pos + 1];
+
+ // Trace the backtracking matrix.
+ while (ii > 0 || jj > 0) {
+ if (R[ii][jj] == UP_AND_LEFT) {
+ ii--;
+ jj--;
+ lcs[pos--] = a.get(ii);
+ }
+
+ else if (R[ii][jj] == UP) {
+ ii--;
+ }
+
+ else if (R[ii][jj] == LEFT) {
+ jj--;
+ }
+ }
+
+ return Arrays.asList(lcs);
+ }
+
+}
Added: lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/NamedObject.java
URL: http://svn.apache.org/viewvc/lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/NamedObject.java?rev=675594&view=auto
==============================================================================
--- lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/NamedObject.java (added)
+++ lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/NamedObject.java Thu Jul 10 07:35:49 2008
@@ -0,0 +1,39 @@
+package org.apache.lenya.modules.diff.lcs;
+
+public class NamedObject {
+
+ private String namespaceUri;
+ private String localName;
+
+ public NamedObject(String namespaceUri, String localName) {
+ this.localName = localName;
+ this.namespaceUri = namespaceUri;
+ }
+
+ public boolean equals(Object other) {
+ if (!getClass().isInstance(other)) {
+ return false;
+ }
+ NamedObject otherObj = (NamedObject) other;
+
+ String thisNs = getNamespaceUri();
+ String otherNs = otherObj.getNamespaceUri();
+
+ if (thisNs == null && otherNs != null || thisNs != null && otherNs == null) {
+ return false;
+ }
+
+ return ((otherObj.namespaceUri == null && namespaceUri == null) || otherObj.namespaceUri
+ .equals(namespaceUri))
+ && otherObj.localName.equals(localName);
+ }
+
+ public String getNamespaceUri() {
+ return this.namespaceUri;
+ }
+
+ public String getLocalName() {
+ return this.localName;
+ }
+
+}
Added: lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/SaxHandler.java
URL: http://svn.apache.org/viewvc/lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/SaxHandler.java?rev=675594&view=auto
==============================================================================
--- lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/SaxHandler.java (added)
+++ lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/SaxHandler.java Thu Jul 10 07:35:49 2008
@@ -0,0 +1,116 @@
+package org.apache.lenya.modules.diff.lcs;
+
+import org.xml.sax.ContentHandler;
+import org.xml.sax.helpers.AttributesImpl;
+
+public class SaxHandler implements FragmentHandler {
+
+ protected static final String ENTITY_GT = ">";
+ protected static final String ENTITY_LT = "<";
+ protected static final String ATTR_CLASS = "class";
+ protected static final String ELEM_SPAN = "span";
+ protected static final String ELEM_DIV = "div";
+ public static final String ADDED = "added";
+ public static final String REMOVED = "removed";
+
+ public static final String XHTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
+
+ private ContentHandler handler;
+
+ public SaxHandler(ContentHandler handler) {
+ this.handler = handler;
+ }
+
+ private boolean handlingAttr = false;
+ private boolean handlingText = false;
+
+ public void element(Object obj) throws Exception {
+ if (obj instanceof StartTagStart) {
+ startElement(ELEM_DIV);
+ StartTagStart startTag = (StartTagStart) obj;
+ characters("<" + startTag.getLocalName());
+ this.handlingText = false;
+ }
+ else if (obj instanceof StartTagEnd) {
+ closeAttribute();
+ characters(">");
+ this.handlingText = false;
+ }
+ else if (obj instanceof EndTag) {
+ EndTag endTag = (EndTag) obj;
+ characters("</" + endTag.getLocalName() + ">");
+ endElement(ELEM_DIV);
+ this.handlingText = false;
+ }
+ else if (obj instanceof AttributeName) {
+ closeAttribute();
+ AttributeName attr = (AttributeName) obj;
+ characters(" " + attr.getLocalName() + "=\"");
+ handlingAttr = true;
+ this.handlingText = false;
+ }
+ else if (obj instanceof String) {
+ if (this.handlingText) {
+ characters(" ");
+ }
+ characters((String) obj);
+ this.handlingText = true;
+ }
+ }
+
+ protected void closeAttribute() throws Exception {
+ if (this.handlingAttr) {
+ characters("\"");
+ this.handlingAttr = false;
+ }
+ }
+
+ protected void characters(String text) throws Exception {
+ char[] chars = text.toCharArray();
+ this.handler.characters(chars, 0, chars.length);
+ }
+
+ public void endAdding() throws Exception {
+ endElement(ELEM_SPAN);
+ }
+
+ public void endRemoving() throws Exception {
+ endElement(ELEM_SPAN);
+ }
+
+ public void startAdding() throws Exception {
+ startElement(ELEM_SPAN, ADDED);
+ }
+
+ protected void startElement(String localName, String className) throws Exception {
+ AttributesImpl attrs = new AttributesImpl();
+ attrs.addAttribute("", ATTR_CLASS, ATTR_CLASS, "string", className);
+ this.handler.startElement(XHTML_NAMESPACE, localName, localName, attrs);
+ }
+
+ protected void startElement(String localName) throws Exception {
+ AttributesImpl attrs = new AttributesImpl();
+ this.handler.startElement(XHTML_NAMESPACE, localName, localName, attrs);
+ }
+
+ protected void endElement(String localName) throws Exception {
+ this.handler.endElement(XHTML_NAMESPACE, localName, localName);
+ }
+
+ public void startRemoving() throws Exception {
+ startElement(ELEM_SPAN, REMOVED);
+ }
+
+ public void start() throws Exception {
+ this.handler.startDocument();
+ this.handler.startPrefixMapping("", XHTML_NAMESPACE);
+ startElement(ELEM_DIV, "diff");
+ }
+
+ public void end() throws Exception {
+ endElement(ELEM_DIV);
+ this.handler.endPrefixMapping("");
+ this.handler.endDocument();
+ }
+
+}
Added: lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/StartTagEnd.java
URL: http://svn.apache.org/viewvc/lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/StartTagEnd.java?rev=675594&view=auto
==============================================================================
--- lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/StartTagEnd.java (added)
+++ lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/StartTagEnd.java Thu Jul 10 07:35:49 2008
@@ -0,0 +1,19 @@
+package org.apache.lenya.modules.diff.lcs;
+
+import org.w3c.dom.Element;
+
+public class StartTagEnd extends NamedObject {
+
+ public StartTagEnd(String namespaceUri, String localName) {
+ super(namespaceUri, localName);
+ }
+
+ public StartTagEnd(Element element) {
+ this(element.getNamespaceURI(), element.getLocalName());
+ }
+
+ public String toString() {
+ return "{" + getNamespaceUri() + "}" + getLocalName() + ">";
+ }
+
+}
Added: lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/StartTagStart.java
URL: http://svn.apache.org/viewvc/lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/StartTagStart.java?rev=675594&view=auto
==============================================================================
--- lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/StartTagStart.java (added)
+++ lenya/docu/modules/diff/java/src/org/apache/lenya/modules/diff/lcs/StartTagStart.java Thu Jul 10 07:35:49 2008
@@ -0,0 +1,19 @@
+package org.apache.lenya.modules.diff.lcs;
+
+import org.w3c.dom.Element;
+
+public class StartTagStart extends NamedObject {
+
+ public StartTagStart(String namespaceUri, String localName) {
+ super(namespaceUri, localName);
+ }
+
+ public StartTagStart(Element element) {
+ this(element.getNamespaceURI(), element.getLocalName());
+ }
+
+ public String toString() {
+ return "<{" + getNamespaceUri() + "}" + getLocalName();
+ }
+
+}
\ No newline at end of file
Added: lenya/docu/modules/diff/java/test/org/apache/lenya/modules/diff/lcs/LcsDiffTest.java
URL: http://svn.apache.org/viewvc/lenya/docu/modules/diff/java/test/org/apache/lenya/modules/diff/lcs/LcsDiffTest.java?rev=675594&view=auto
==============================================================================
--- lenya/docu/modules/diff/java/test/org/apache/lenya/modules/diff/lcs/LcsDiffTest.java (added)
+++ lenya/docu/modules/diff/java/test/org/apache/lenya/modules/diff/lcs/LcsDiffTest.java Thu Jul 10 07:35:49 2008
@@ -0,0 +1,108 @@
+package org.apache.lenya.modules.diff.lcs;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.lenya.modules.diff.DifferenceTree;
+import org.apache.lenya.modules.diff.DifferenceTreeWriter;
+import org.apache.lenya.modules.diff.SimpleTreeDiff;
+import org.apache.lenya.modules.diff.Tree;
+import org.apache.lenya.modules.diff.TreeDiff;
+import org.apache.lenya.modules.diff.xml.DomTreeBuilder;
+import org.apache.lenya.modules.diff.xml.DomTreeBuilderFactory;
+import org.apache.lenya.modules.diff.xml.XmlNodeWriter;
+import org.apache.lenya.xml.DocumentHelper;
+import org.w3c.dom.Document;
+
+public class LcsDiffTest extends TestCase implements DiffHandler, FragmentHandler {
+
+ public void testLcsDiff() throws Exception {
+
+ DomSerializer serializer = new DomSerializer();
+ List[] lists = new ArrayList[2];
+ for (int i = 0; i < lists.length; i++) {
+ URL url = getClass().getResource("test" + (i + 1) + ".xml");
+ Document dom = DocumentHelper.readDocument(url);
+ lists[i] = serializer.serialize(dom);
+ }
+
+ System.out.println("List 1: " + lists[0]);
+ System.out.println("List 2: " + lists[1]);
+
+ LcsDiff diff = new LcsDiff();
+ diff.diff(lists[0], lists[1], new FragmentingHandler(this));
+ }
+
+ public void added(Object newObj) throws Exception {
+ printPadded("", newObj);
+ }
+
+ public void end() throws Exception {
+ System.out.println("End");
+ }
+
+ public void equal(Object obj) throws Exception {
+ //printPadded(obj, obj);
+ }
+
+ public void removed(Object oldObj) throws Exception {
+ printPadded(oldObj, "");
+ }
+
+ public void start() throws Exception {
+ System.out.println("Start");
+ }
+
+ private static final int columnWidth = 50;
+
+ protected void printPadded(Object o1, Object o2) {
+ for (int i = 0; i < 2 * columnWidth; i++) {
+ System.out.print("-");
+ }
+ System.out.println();
+ printPadded(o1);
+ printPadded(o2);
+ System.out.println();
+ }
+
+ protected void printPadded(Object obj) {
+ String string = obj.toString();
+ System.out.print(string);
+ for (int i = string.length(); i < columnWidth; i++) {
+ System.out.print(" ");
+ }
+ }
+
+ private boolean adding = false;
+ private boolean removing = false;
+
+ public void element(Object obj) throws Exception {
+ if (adding || removing) {
+ System.out.println(" " + obj);
+ }
+ }
+
+ public void endAdding() throws Exception {
+ this.adding = false;
+ System.out.println("</add>");
+ }
+
+ public void endRemoving() throws Exception {
+ this.removing = false;
+ System.out.println("</remove>");
+ }
+
+ public void startAdding() throws Exception {
+ this.adding = true;
+ System.out.println("<add>");
+ }
+
+ public void startRemoving() throws Exception {
+ this.removing = true;
+ System.out.println("<remove>");
+ }
+
+}
Added: lenya/docu/modules/diff/java/test/org/apache/lenya/modules/diff/lcs/test1.xml
URL: http://svn.apache.org/viewvc/lenya/docu/modules/diff/java/test/org/apache/lenya/modules/diff/lcs/test1.xml?rev=675594&view=auto
==============================================================================
--- lenya/docu/modules/diff/java/test/org/apache/lenya/modules/diff/lcs/test1.xml (added)
+++ lenya/docu/modules/diff/java/test/org/apache/lenya/modules/diff/lcs/test1.xml Thu Jul 10 07:35:49 2008
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8"?><document>
+ <header>
+ <title>Who we are</title>
+ </header>
+ <body>
+ <section id="community">
+ <title>The Lenya Community</title>
+ <p>
+
+ The Lenya Project operates as a meritocracy: the more you do, the more
+ responsibility you will obtain. This page lists all of the people who
+ have gone the extra mile and are Committers. If you would like to get
+ involved, the first step is to join the mailing lists.
+ </p>
+ <p>
+ Of course the committers are not the only people involved in the
+ community. Thanks to the many people for their contributions of patches,
+ assistance, ideas, and email discussion. Some are mentioned at the
+ changes pages. See how we
+ <a href="lenya-document:413a46e0-e986-11dc-b04f-af2277a493d7#contribution">acknowledge</a> contributions.
+ </p>
+ <p>
+ Please do not send emails directly to individual developers asking for
+ free support - see the Important Notices on the
+ <a href="lenya-document:dfb45860-e986-11dc-b04f-af2277a493d7">mailing lists</a> page.
+ </p>
+
+ </section>
+ <section id="committers">
+ <title>List of committers</title>
+ <p>
+ List of all people who have ever been committers at Apache Lenya,
+ sorted alphabetically.
+ </p>
+ <ul>
+ <li>Doug Chestnut (chestnut at apache.org)</li>
+
+ <li>Edith Chevrier (edith at apache.org)</li>
+ <li>Dale Christ (bigdog at apache.org)</li>
+ <li>Christian Egli (egli at apache.org)</li>
+ <li>Paul Ercolino (solprovider at apache.org)</li>
+ <li>
+ <strong>Jann Forrer (jann at apache.org)</strong>
+
+ </li>
+ <li>Richard Frovarp (rfrovarp at apache.org)</li>
+ <li>
+ <strong>Antonio Gallardo (antonio at apache.org)</strong>
+ </li>
+ <li>Bob Harner (bobharner at apache.org)</li>
+ <li>
+
+ <strong>Andreas Hartmann (andreas at apache.org)</strong>
+ </li>
+ <li>
+ <strong>J. Wolfgang Kaltz (jwkaltz at apache.org)</strong>
+ </li>
+ <li>Andreas Kuckartz (aku at apache.org)</li>
+ <li>
+
+ <em>Rolf Kulemann (roku at apache.org)</em>
+ </li>
+ <li>
+ <strong>Jörn Nettingsmeier (nettings at apache.org)</strong>
+ </li>
+ <li>Jürgen Ragaller (ragaller at apache.org)</li>
+ <li>Renaud Richardet (renaud at apache.org)</li>
+ <li>Felix Röthenbacher (froethenbacher at apache.org)</li>
+
+ <li>
+ <strong>
+ <em>Gregor J. Rothfuss (gregor at apache.org)</em>
+ </strong>
+ </li>
+ <li>Torsten Schlabach (tschlabach at apache.org)</li>
+ <li>
+ <strong>Thorsten Scherler (thorsten at apache.org)</strong>
+
+ </li>
+ <li>Josias Thöny (josias at apache.org)</li>
+ <li>Michael Wechner (michi at apache.org)</li>
+ </ul>
+ </section>
+ <section id="notes">
+ <title>Notes</title>
+
+ <p>
+ Strong type denotes "Project Management Committee
+ (<a href="lenya-document:413a46e0-e986-11dc-b04f-af2277a493d7">PMC</a>) member". Emphasis type denotes
+ "emeritus PMC member". See the <a href="lenya-document:413a46e0-e986-11dc-b04f-af2277a493d7">ASF role
+ definitions</a> for detailed role information. The actual list of PMC
+ members is in the SVN "committers" repository at
+ /board/committee-info.txt
+ </p>
+ <p>
+ Some people were committers prior to Lenya becoming a top-level
+ project and so gaining a PMC. They were not around since then, so have
+ never been on the PMC. All new committers are
+ <a href="lenya-document:413a46e0-e986-11dc-b04f-af2277a493d7">encouraged</a> to become PMC
+ members.
+ </p>
+
+ <p>
+ Committers can be as active as they choose and there is no performance
+ pressure from the project. For those who are interested in the work that
+ each particular committer has done, see the
+ <a href="lenya-document:413a46e0-e986-11dc-b04f-af2277a493d7">acknowledgements</a> section.
+ </p>
+ <p>
+ All <a href="http://cocoon.apache.org/community/members.html">Apache
+ Cocoon committers</a> and
+ <a href="http://forrest.apache.org/who.html">Apache
+ Forrest committers</a> also have rights to commit to Lenya.
+ </p>
+
+ </section>
+
+ <section>
+ <title>Other Contributors</title>
+ <ul>
+ <li>
+ Lon Boonen is the original creator of Xopus and helped a
+ lot to integrate it into Lenya. Recently he
+ rewrote the JavaScript of the Lenya menubar.
+ </li>
+ <li>Jose Chaso: Spanish translation</li>
+
+ <li>Stephen England: Design of the Lenya logo, design of the Lenya UI</li>
+ <li>Jorge Gutierrez: Spanish translation</li>
+ <li>Martin Hitz</li>
+ <li>Margrit John</li>
+ <li>Olivier Lange: French translation</li>
+ <li>Jean Pierre LeJacq: Build system improvements</li>
+
+ <li>Martin Lüthi: Mail class</li>
+ <li>
+ Christian Stocker is the original creator of the Bitflux Editor and helped
+ a lot to integrate it into Lenya.
+ </li>
+ <li>Urs Stöckli</li>
+ <li>Giampaolo Trapasso: Italian translation, entertainer on #lenya</li>
+ <li>Markus Vaterlaus</li>
+
+ <li>Kars Veiling</li>
+ <li>Marc von Wattenwyl</li>
+ <li>Thomas Werschlein</li>
+ </ul>
+ </section>
+ </body>
+</document>
Added: lenya/docu/modules/diff/java/test/org/apache/lenya/modules/diff/lcs/test2.xml
URL: http://svn.apache.org/viewvc/lenya/docu/modules/diff/java/test/org/apache/lenya/modules/diff/lcs/test2.xml?rev=675594&view=auto
==============================================================================
--- lenya/docu/modules/diff/java/test/org/apache/lenya/modules/diff/lcs/test2.xml (added)
+++ lenya/docu/modules/diff/java/test/org/apache/lenya/modules/diff/lcs/test2.xml Thu Jul 10 07:35:49 2008
@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+<document>
+ <header>
+ <title>Who we are</title>
+ </header>
+ <body>
+ <section id="community">
+ <title>The Lenya Community</title>
+
+ <p>
+ The Lenya Project operates as a meritocracy: the more you do, the more
+ responsibility you will obtain. This page lists all of the people who
+ have gone the extra mile and are Committers. If you would like to get
+ involved, the first step is to join the mailing lists.
+ </p>
+ <p>
+ Of course the committers are not the only people involved in the
+ community. Thanks to the many people for their contributions of patches,
+ assistance, ideas, and email discussion. Some are mentioned at the
+ changes pages. See how we
+ <a href="lenya-document:413a46e0-e986-11dc-b04f-af2277a493d7">acknowledge</a> contributions.
+ </p>
+ <p>
+ Please do not send emails directly to individual developers asking for
+ free support - see the Important Notices at the
+ <a href="lenya-document:dfb45860-e986-11dc-b04f-af2277a493d7">mailing lists</a> page.
+ </p>
+
+ </section>
+ <section id="committers">
+ <title>List of committers</title>
+ <p>
+ List of all people who have ever been committers at Apache Lenya,
+ sorted alphabetically.
+ </p>
+ <ul>
+ <li>Doug Chestnut (chestnut at apache.org)</li>
+
+ <li>Edith Chevrier (edith at apache.org)</li>
+ <li>Dale Christ (bigdog at apache.org)</li>
+ <li>Christian Egli (egli at apache.org)</li>
+ <li>Paul Ercolino (solprovider at apache.org)</li>
+ <li>
+ <strong>Jann Forrer (jann at apache.org)</strong>
+
+ </li>
+ <li>Richard Frovarp (rfrovarp at apache.org)</li>
+ <li>
+ <strong>Antonio Gallardo (antonio at apache.org)</strong>
+ </li>
+ <li>Bob Harner (bobharner at apache.org)</li>
+ <li>
+
+ <strong>Andreas Hartmann (andreas at apache.org)</strong>
+ </li>
+ <li>
+ <strong>J. Wolfgang Kaltz (jwkaltz at apache.org)</strong>
+ </li>
+ <li>Andreas Kuckartz (aku at apache.org)</li>
+ <li>
+
+ <em>Rolf Kulemann (roku at apache.org)</em>
+ </li>
+ <li>
+ <strong>Jörn Nettingsmeier (nettings at apache.org)</strong>
+ </li>
+ <li>Jürgen Ragaller (ragaller at apache.org)</li>
+ <li>Renaud Richardet (renaud at apache.org)</li>
+ <li>Felix Röthenbacher (froethenbacher at apache.org)</li>
+
+ <li>
+ <strong>
+ <em>Gregor J. Rothfuss (gregor at apache.org)</em>
+ </strong>
+ </li>
+ <li>Torsten Schlabach (tschlabach at apache.org)</li>
+ <li>
+ <strong>Thorsten Scherler (thorsten at apache.org)</strong>
+
+ </li>
+ <li>Josias Thöny (josias at apache.org)</li>
+ <li>Michael Wechner (michi at apache.org)</li>
+ </ul>
+ </section>
+ <section id="notes">
+ <title>Notes</title>
+
+ <p>
+ Strong type denotes "Project Management Committee
+ (<a href="lenya-document:413a46e0-e986-11dc-b04f-af2277a493d7">PMC</a>) member". Emphasis type denotes
+ "emeritus PMC member". See the <a href="lenya-document:413a46e0-e986-11dc-b04f-af2277a493d7">ASF role
+ definitions</a> for detailed role information. The actual list of PMC
+ members is in the SVN "committers" repository at
+ /board/committee-info.txt
+ </p>
+ <p>
+ Some people were committers prior to Lenya becoming a top-level
+ project and so gaining a PMC. They were not around since then, so have
+ never been on the PMC. All new committers are
+ <a href="lenya-document:413a46e0-e986-11dc-b04f-af2277a493d7">encouraged</a> to become PMC
+ members.
+ </p>
+
+ <p>
+ Committers can be as active as they choose and there is no performance
+ pressure from the project. For those who are interested in the work that
+ each particular committer has done, see the
+ <a href="lenya-document:413a46e0-e986-11dc-b04f-af2277a493d7">acknowledgements</a> section.
+ </p>
+ <p>
+ All <a href="http://cocoon.apache.org/community/members.html">Apache
+ Cocoon committers</a> and
+ <a href="http://forrest.apache.org/who.html">Apache
+ Forrest committers</a> also have rights to commit to Lenya.
+ </p>
+
+ </section>
+
+ <section>
+ <title>Other Contributors</title>
+ <ul>
+ <li>
+ Lon Boonen is the original creator of Xopus and helped a
+ lot to integrate it into Lenya. Recently he
+ rewrote the JavaScript of the Lenya menubar.
+ </li>
+ <li>Jose Chaso: Spanish translation</li>
+
+ <li>Stephen England: Design of the Lenya logo, design of the Lenya UI</li>
+ <li>Jorge Gutierrez: Spanish translation</li>
+ <li>Martin Hitz</li>
+ <li>Margrit John</li>
+ <li>Olivier Lange: French translation</li>
+ <li>Jean Pierre LeJacq: Build system improvements</li>
+
+ <li>Martin Lüthi: Mail class</li>
+ <li>
+ Christian Stocker is the original creator of the Bitflux Editor and helped
+ a lot to integrate it into Lenya.
+ </li>
+ <li>Urs Stöckli</li>
+ <li>Giampaolo Trapasso: Italian translation, entertainer on #lenya</li>
+ <li>Markus Vaterlaus</li>
+
+ <li>Kars Veiling</li>
+ <li>Marc von Wattenwyl</li>
+ <li>Thomas Werschlein</li>
+ </ul>
+ </section>
+ </body>
+</document>
Added: lenya/docu/modules/diff/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/docu/modules/diff/sitemap.xmap?rev=675594&view=auto
==============================================================================
--- lenya/docu/modules/diff/sitemap.xmap (added)
+++ lenya/docu/modules/diff/sitemap.xmap Thu Jul 10 07:35:49 2008
@@ -0,0 +1,40 @@
+<?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.
+-->
+
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
+ <map:components>
+ <map:generators default="file">
+ <map:generator name="diff" logger="org.apache.lenya.modules.diff"
+ src="org.apache.lenya.modules.diff.lcs.DiffGenerator"/>
+ </map:generators>
+ </map:components>
+
+ <map:pipelines>
+ <map:pipeline>
+ <map:match pattern="areas/*-*">
+ <map:generate type="diff">
+ <map:parameter name="oldUri" value="lenya-document:,area={1}"/>
+ <map:parameter name="newUri" value="lenya-document:,area={2}"/>
+ </map:generate>
+ <map:serialize type="xml"/>
+ </map:match>
+ </map:pipeline>
+ </map:pipelines>
+
+</map:sitemap>
Modified: lenya/docu/modules/diff/usecases/diff.jx
URL: http://svn.apache.org/viewvc/lenya/docu/modules/diff/usecases/diff.jx?rev=675594&r1=675593&r2=675594&view=diff
==============================================================================
--- lenya/docu/modules/diff/usecases/diff.jx (original)
+++ lenya/docu/modules/diff/usecases/diff.jx Thu Jul 10 07:35:49 2008
@@ -20,67 +20,68 @@
<page:page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:i="http://apache.org/cocoon/include/1.0"
xmlns:i18n="http://apache.org/cocoon/i18n/2.1" >
+ <!--
+ <jx:import uri="fallback://lenya/modules/sitemanagement/usecases/tab/head.jx"/>
+ -->
- <jx:import uri="fallback://lenya/modules/sitemanagement/usecases/tab/head.jx"/>
+ <page:head>
+ <style type="text/css">
+ .diff { font-size: 10pt; margin-top: 2em; color: #999999; }
+ .diff div div { margin-left: 2em; }
+ .added { color: #000000; }
+ .removed { text-decoration: line-through; color: #FF0000; }
+ </style>
+ </page:head>
<page:body>
- <jx:import uri="fallback://lenya/modules/sitemanagement/usecases/tab/sitetree.jx"/>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
+ <!--
+ <jx:import uri="fallback://lenya/modules/sitemanagement/usecases/tab/sitetree.jx"/>
+ <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
+ -->
- <jx:set var="rev1" value="${usecase.getParameter('rev1')}"/>
- <jx:set var="rev2" value="${usecase.getParameter('rev2')}"/>
+ <jx:set var="oldUri" value="${usecase.getParameter('oldUri')}"/>
+ <jx:set var="newUri" value="${usecase.getParameter('newUri')}"/>
- <div id="contentblock1" class="lenya-tab-sitetree">
- <h1>
- <i18n:translate>
- <i18n:text>difference-between</i18n:text>
- <i18n:param>${rev1}</i18n:param>
- <i18n:param>${rev2}</i18n:param>
- </i18n:translate>
- </h1>
-
- <jx:set var="differences" value="${usecase.getParameter('differences')}"/>
- <jx:choose>
- <jx:when test="${differences.size() == 0}">
- <p>
- <i18n:text>no-differences</i18n:text>
- </p>
- </jx:when>
- <jx:otherwise>
- <table class="lenya-table-list">
+ <h1>
+ <i18n:translate>Differences</i18n:translate>
+ </h1>
+
+ <i:include src="cocoon://modules/diff/areas/live-authoring"/>
+
+ <!--
+ <jx:set var="differences" value="${usecase.getParameter('differences')}"/>
+ <jx:choose>
+ <jx:when test="${differences.size() == 0}">
+ <p>
+ <i18n:text>no-differences</i18n:text>
+ </p>
+ </jx:when>
+ <jx:otherwise>
+ <table class="lenya-table-list">
+ <tr>
+ <th>Authoring</th>
+ <th>Live</th>
+ </tr>
+ <jx:forEach var="difference" items="${differences}">
+ <jx:if test="${!difference.getLeft().equals(difference.getRight())}">
<tr>
- <th><i18n:text>Revision</i18n:text> ${rev1}</th>
- <th><i18n:text>Revision</i18n:text> ${rev2}</th>
- <!--
- <th><i18n:text>Location</i18n:text></th>
- <th><i18n:text>Type</i18n:text></th>
- <th><i18n:text>Revision</i18n:text> ${rev1}</th>
- <th><i18n:text>Revision</i18n:text> ${rev2}</th>
- -->
+ <td>
+ ${difference.getRight()}
+ </td>
+ <td>
+ ${difference.getLeft()}
+ </td>
</tr>
- <jx:forEach var="difference" items="${differences}">
- <tr>
- <td style="padding-left: ${difference.getDepth()}em;">
- ${difference.getLeft()}
- </td>
- <td style="padding-left: ${difference.getDepth()}em;">
- ${difference.getRight()}
- </td>
- <!--
- <td>${difference.getControlNodeDetail().getXpathLocation()}</td>
- <td>${difference.getDescription()}</td>
- <td>${difference.getControlNodeDetail().getValue()}</td>
- <td>${difference.getTestNodeDetail().getValue()}</td>
- -->
- </tr>
- </jx:forEach>
- </table>
- </jx:otherwise>
- </jx:choose>
-
- </div>
+ </jx:if>
+ </jx:forEach>
+ </table>
+ </jx:otherwise>
+ </jx:choose>
+ -->
+
</page:body>
</page:page>
\ No newline at end of file
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.