[hornetq-commits] JBoss hornetq SVN: r12239 - branches/Branch_2_2_EAP_HORNETQ-787/src/main/org/hornetq/core/persistence/impl/journal.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Mar 5 11:27:07 EST 2012


Author: jbertram
Date: 2012-03-05 11:27:05 -0500 (Mon, 05 Mar 2012)
New Revision: 12239

Removed:
   branches/Branch_2_2_EAP_HORNETQ-787/src/main/org/hornetq/core/persistence/impl/journal/PrettyPrintHandler.java
Log:
[HORNETQ-787] removed unnecessary class

Deleted: branches/Branch_2_2_EAP_HORNETQ-787/src/main/org/hornetq/core/persistence/impl/journal/PrettyPrintHandler.java
===================================================================
--- branches/Branch_2_2_EAP_HORNETQ-787/src/main/org/hornetq/core/persistence/impl/journal/PrettyPrintHandler.java	2012-03-05 16:25:22 UTC (rev 12238)
+++ branches/Branch_2_2_EAP_HORNETQ-787/src/main/org/hornetq/core/persistence/impl/journal/PrettyPrintHandler.java	2012-03-05 16:27:05 UTC (rev 12239)
@@ -1,91 +0,0 @@
-package org.hornetq.core.persistence.impl.journal;
-
-import javax.xml.stream.XMLStreamWriter;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
-
-class PrettyPrintHandler implements InvocationHandler
-{
-
-   private XMLStreamWriter target;
-
-   private int depth = 0;
-   private Map<Integer, Boolean> hasChildElement = new HashMap<Integer, Boolean>();
-
-   private static final String INDENT_CHAR = "   ";
-   private static final String LINEFEED_CHAR = "\n";
-
-   public PrettyPrintHandler(XMLStreamWriter target)
-   {
-      this.target = target;
-   }
-
-   public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
-   {
-      String m = method.getName();
-
-      // Needs to be BEFORE the actual event, so that for instance the
-      // sequence writeStartElem, writeAttr, writeStartElem, writeEndElem, writeEndElem
-      // is correctly handled
-
-      if ("writeStartElement".equals(m))
-      {
-         // update state of parent node
-         if (depth > 0)
-         {
-            hasChildElement.put(depth - 1, true);
-         }
-
-         // reset state of current node
-         hasChildElement.put(depth, false);
-
-         // indent for current depth
-         target.writeCharacters(LINEFEED_CHAR);
-         target.writeCharacters(repeat(depth, INDENT_CHAR));
-
-         depth++;
-      }
-      else if ("writeEndElement".equals(m))
-      {
-         depth--;
-
-         target.writeCharacters(LINEFEED_CHAR);
-         target.writeCharacters(repeat(depth, INDENT_CHAR));
-      }
-      else if ("writeEmptyElement".equals(m))
-      {
-         // update state of parent node
-         if (depth > 0)
-         {
-            hasChildElement.put(depth - 1, true);
-         }
-
-         // indent for current depth
-         target.writeCharacters(LINEFEED_CHAR);
-         target.writeCharacters(repeat(depth, INDENT_CHAR));
-
-      }
-      else if ("writeCharacters".equals(m))
-      {
-         // indent for current depth
-         target.writeCharacters(LINEFEED_CHAR);
-         target.writeCharacters(repeat(depth, INDENT_CHAR));
-      }
-
-      method.invoke(target, args);
-
-      return null;
-   }
-
-   private String repeat(int d, String s)
-   {
-      String _s = "";
-      while (d-- > 0)
-      {
-         _s += s;
-      }
-      return _s;
-   }
-}
\ No newline at end of file



More information about the hornetq-commits mailing list