You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@portals.apache.org by wo...@apache.org on 2014/11/20 00:52:33 UTC

svn commit: r1640645 - in /portals/site/applications/src/site: argouml/apa-webcontent-2.zargo resources/images/content-rewriter-class-diagram.png xdoc/webcontent2/content-rewriter-module.xml

Author: woonsan
Date: Wed Nov 19 23:52:33 2014
New Revision: 1640645

URL: http://svn.apache.org/r1640645
Log:
APA-67: describing content-rewriter module

Added:
    portals/site/applications/src/site/resources/images/content-rewriter-class-diagram.png   (with props)
Modified:
    portals/site/applications/src/site/argouml/apa-webcontent-2.zargo
    portals/site/applications/src/site/xdoc/webcontent2/content-rewriter-module.xml

Modified: portals/site/applications/src/site/argouml/apa-webcontent-2.zargo
URL: http://svn.apache.org/viewvc/portals/site/applications/src/site/argouml/apa-webcontent-2.zargo?rev=1640645&r1=1640644&r2=1640645&view=diff
==============================================================================
Binary files - no diff available.

Added: portals/site/applications/src/site/resources/images/content-rewriter-class-diagram.png
URL: http://svn.apache.org/viewvc/portals/site/applications/src/site/resources/images/content-rewriter-class-diagram.png?rev=1640645&view=auto
==============================================================================
Binary file - no diff available.

Propchange: portals/site/applications/src/site/resources/images/content-rewriter-class-diagram.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: portals/site/applications/src/site/xdoc/webcontent2/content-rewriter-module.xml
URL: http://svn.apache.org/viewvc/portals/site/applications/src/site/xdoc/webcontent2/content-rewriter-module.xml?rev=1640645&r1=1640644&r2=1640645&view=diff
==============================================================================
--- portals/site/applications/src/site/xdoc/webcontent2/content-rewriter-module.xml (original)
+++ portals/site/applications/src/site/xdoc/webcontent2/content-rewriter-module.xml Wed Nov 19 23:52:33 2014
@@ -25,7 +25,100 @@
   <body>
 
     <section name="Content Rewriter Module">
-      <p>TODO</p>
+      <p>
+        Content Rewriter module defines simple APIs to bridge any content rewriting libraries
+        such as <a href="http://htmlcleaner.sourceforge.net/" target="_blank">HtmlCleaner</a>.
+        By default, this module includes HtmlCleaner based content rewriter component
+        as well as simple text-line based content rewriter component.
+      </p>
+
+      <subsection name="Class Diagram and Descriptions">
+
+        <p>Here is a class diagram showing the major interfaces and classes.</p>
+
+        <img alt="Class Diagram" src="../images/content-rewriter-class-diagram.png" />
+
+        <table>
+          <tr>
+            <th>Interface or Class</th>
+            <th>Description</th>
+          </tr>
+          <tr>
+            <td>ContentRewriter</td>
+            <td>
+              The main interface of the Content Rewriter module,
+              defining a simple <code>#rewrite(source, sink, context)</code> method
+              which should do content rewriting from <code>source</code> to <code>target</code>
+              with using the given <code>context</code>.
+            </td>
+          </tr>
+          <tr>
+            <td>Source</td>
+            <td>
+              Abstraction of input source which can give either <code>java.io.InputStream</code>
+              or <code>java.io.Reader</code> from the underlying content data source.
+            </td>
+          </tr>
+          <tr>
+            <td>Sink</td>
+            <td>
+              Abstraction of output target which can give either <code>java.io.OutputStream</code>
+              or <code>java.io.Writer</code> to the underlying content data sink.
+            </td>
+          </tr>
+          <tr>
+            <td>ContentRewritingContext</td>
+            <td>
+              Abstraction of the current content rewriting context which allows to
+              set/get/iterate attribute objects by name.
+              <br/>
+              This context abstraction is designed for the case where the caller needs to
+              set some environment specific attributes to be referenced by the content rewriter
+              component during the process.
+            </td>
+          </tr>
+          <tr>
+            <td>AbstractTextLineContentRewriter</td>
+            <td>
+              An abstract simple content rewriting component implementation class
+              which reads each line from the source and tries to rewrite it to the sink.
+              <br/>
+              Derived classes may simply override <code>#rewriteLine(String line, ContentRewritingContext context)</code> method
+              by reading the <code>line</code> and <code>context</code> attributes
+              and transforming the <code>line</code> to return.
+              For example, a derived class may use regular expressions to transform the <code>line</code>.
+            </td>
+          </tr>
+          <tr>
+            <td>HtmlCleanerContentRewriter</td>
+            <td>
+              HtmlCleaner based content rewriting component implementation class
+              which provides properties for the underlying HtmlCleaner instance
+              and simplified usages for most use cases.
+            </td>
+          </tr>
+        </table>
+
+      </subsection>
+
+      <subsection name="Examples">
+        <p>You can find example code in the unit tests:</p>
+        <ul>
+          <li>
+            Text line based content rewriting example:
+            <a href="http://svn.apache.org/repos/asf/portals/applications/webcontent/trunk/content-rewriter/src/test/java/org/apache/portals/applications/webcontent2/rewriter/TextLineContentRewriterTest.java" target="_blank">
+              TextLineContentRewriterTest.java
+            </a>
+          </li>
+          <li>
+            HtmlCleaner based content rewriting example:
+            <a href="http://svn.apache.org/repos/asf/portals/applications/webcontent/trunk/content-rewriter/src/test/java/org/apache/portals/applications/webcontent2/rewriter/HtmlCleanerContentRewriterTest.java" target="_blank">
+              HtmlCleanerContentRewriterTest.java
+            </a>
+          </li>
+        </ul>
+      </subsection>
+
     </section>
 
   </body>