[jboss-svn-commits] JBL Code SVN: r16379 - in labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product: rosetta/src/org/jboss/internal/soa/esb/message/format/xml and 4 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Nov 6 06:20:31 EST 2007


Author: mark.little at jboss.com
Date: 2007-11-06 06:20:31 -0500 (Tue, 06 Nov 2007)
New Revision: 16379

Added:
   labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/lib/ext/commons-codec-1.3.jar
   labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/util/Encoding.java
Removed:
   labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/lib/ext/Base64.html
Modified:
   labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/AttachmentImpl.java
   labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/PropertiesImpl.java
   labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/marshal/SerializedMarshalUnmarshalPlugin.java
   labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/message/body/content/BytesBody.java
   labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStoreImpl.java
Log:
http://jira.jboss.com/jira/browse/JBESB-1304, http://jira.jboss.com/jira/browse/JBESB-1280 and http://jira.jboss.com/jira/browse/JBESB-1279

Deleted: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/lib/ext/Base64.html
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/lib/ext/Base64.html	2007-11-06 10:54:24 UTC (rev 16378)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/lib/ext/Base64.html	2007-11-06 11:20:31 UTC (rev 16379)
@@ -1,397 +0,0 @@
-<html>
-  <head>
-<!-- Generated from XML source. Copyright 2001 Robert Harder. -->
-    <title>Base64 - A Public Domain Base64 Encoder/Decoder for Java</title>
-    <meta http-equiv="Content-Type" content="text/html;CHARSET=iso-8859-1"/>
-    <meta http-equiv="Content-Language" content="EN"/>
-    <meta name="keywords" content="base64, base, 64, java, public domain"/>
-    <meta name="description" content="Base64 - A Public Domain Base64 Encoder/Decoder for Java"/>
-    <meta name="abstract" content="Base64 - A Public Domain Base64 Encoder/Decoder for Java"/>
-    <meta name="author" content="Robert Harder"/>
-    <meta name="copyright" content="Robert Harder, 2004"/>
-    <meta name="distribution" content="Global"/>
-    <meta name="revisit-after" content="7 days"/>
-    <meta name="robots" content="FOLLOW,INDEX"/>
-    <link rel="ICON" href="./favicon.ico" type="image/x-icon"/>
-    <link rel="SHORTCUT ICON" href="./favicon.ico"/>
-    <base target="_parent"/>
-    <style type="text/css">
-<!--
-             
-
-body        { margin: 0; }
-.iHarderNet { font-family: arial, geneva, lucida sans unicode, helvetica; color: white; text-align: center; font-size: 14pt; }
-.i_iHarder  { font-family: times new roman, courier; font-style: italic; font-weight: bold; font-size: 12pt; }
-
-               .MainTitle
-                 {  color: white;
-                    font-family: arial, geneva, lucida sans unicode, helvetica;
-                    text-align: center;
-                    font-weight: bold;
-                    font-size: 24pt;
-                    font-style: italic;
-                    margin-bottom: 4pt;
-                 }
-
-               .OpenTS_Home
-                 {  color: white;
-                    font-family: arial, geneva, lucida sans unicode, helvetica;
-                    text-align: center;
-                    font-weight: bold;
-                    font-size: 14pt;
-                    font-style: italic;
-                 }
-
-
-               .Menu
-                 {  margin-top: 10pt;
-                    margin-left: 6pt;
-                    text-indent: -6pt;
-                    font-family: arial, geneva, lucida sans unicode, helvetica;
-                    font-weight: bold;
-                    font-size: 10pt;
-                 }
-
-               .SubMenu
-                 {  margin-top: -5pt;
-                    margin-left: 4pt;
-                 }
-
-
-               .MenuItem
-                 {  margin-top: 10pt;
-                    font-family: arial, geneva, lucida sans unicode, helvetica;
-                    font-weight: bold;
-                    font-size: 10pt;
-                 }
-
-               .Menu A
-                 {  color: #000033;
-                 }
-
-               .Logo
-                 {  text-align: center;
-                 }
-
-.SubTitle
-{  font-family: Arial, san serif;
-   font-size: 16pt;
-   font-style: italic;
-   font-weight: bold;
-}
-
-
-               .SectionTitle
-                 {  margin-top: 1em;
-                    margin-left: 1em;
-                    margin-right: 50%;
-                    font-family: arial, geneva, lucida sans unicode, helvetica;
-                    font-weight: bold;
-                    font-size: larger;
-                    /*border-top: 4px double black;*/
-                    border-bottom: 4px double black;
-                 }
-
-               .MainSectionTitle
-                 {  margin-top: 1em;
-                    font-family: arial, geneva, lucida sans unicode, helvetica;
-                    font-weight: bold;
-                    font-size: 22pt;
-                    font-style: italic;
-                    border-bottom: 4px double black;
-                 }
-
-               .SectionBody
-                 {  margin-top: 1em;
-                 }
-
-               .MainSectionBody
-                 {  margin-top: 10pt;
-                 }
-
-               .MainPage
-                 {  margin: 4pt; 
-                    margin-right: 24pt;
-                 }
-
-               .FAQList_Question
-                 {  
-                    font-family: arial, geneva, lucida sans unicode, helvetica;
-                    font-weight: bold;
-                 }
-
-               .FAQ_Question
-                 {  
-                    font-family: arial, geneva, lucida sans unicode, helvetica;
-                    font-weight: bold;
-                 }
-
-               .FAQ_Answer
-                 {  
-                 }
-
-
-               .TopMenu
-                 {  margin-top: 20pt;
-                    margin-bottom: 10pt;
-                    border-bottom: 4px black;
-                    text-align: center
-                 }
-
-               .BottomMenu
-                 {  margin-top: 0.1in;
-                    border-top: 4px double black;
-                    margin-bottom: 10pt;
-                    border-bottom: 4px black;
-                    text-align: center
-                 }
-
-               p
-                 {  
-                    margin-top: 0.1in;
-                    text-indent: 1em;
-                 }
-
-               li
-                 {  margin-top: 0.2in;  
-                 }
-
-               ul
-                 {  margin-left: 0.25in;
-                    margin-top: 0.1in;
-                 }
-
-               tt
-                 {  font-size: larger;
-                 }
-
-               a
-                 {  color: #000055;
-                 }
-               a:hover
-                 {  background: lavender;
-                    text-decoration: none;
-                    color: black;
-                 }
-
- p.alert { border-left:solid red 6px; margin-left:-12px; padding-left:6px; }
- pre { padding:1ex; border: solid gray 1px;}
- code { font-size: 95%; }
- dl dt { font-weight: bold }
- dl dd { margin-bottom: 1em }
- .newCode { background: #EEEEEE; }
-               
-             
-           -->
-    </style>
-  </head>
-  <body bgcolor="white">
-    <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
-      <tr bgcolor="#000066" height="50">
-        <td width="128" height="50">
-          <div class="iHarderNet">
-            <a href="http://www.iHarder.net">
-              <span class="iHarderNet"><span class="i_iHarder">i</span>Harder.net</span>
-            </a>
-          </div>
-        </td>
-        <td width="*">
-          <div class="MainTitle">
-            <title-medium>Base64</title-medium>
-          </div>
-        </td>
-      </tr>
-      <tr>
-        <td colspan="2">
-          <div style="margin:0 ; border-top: 1px double black"/>
-        </td>
-      </tr>
-      <tr height="*">
-        <td width="128" valign="top" bgcolor="#9090d0">
-          <table width="100%" height="100%" cellpadding="2" cellspacing="0" border="0">
-            <tr height="1">
-              <td height="1" width="120" bgcolor="white" valign="center" align="center">
-                <div class="SubTitle">
-      Base64
-    </div>
-              </td>
-            </tr>
-            <tr>
-              <td valign="top" height="*" style="border-top: solid black 1px; border-right: solid black 1px">
-                <div class="Menu">
-                  <a title="" href="./.">Home</a>
-                </div>
-                <div class="Menu">
-                  <a title="A Java framework for the Tabu Search meta-heuristic" href="http://OpenTS.iHarder.net">OpenTS</a>
-                </div>
-                <div class="Menu">
-                  <a title="Software and tutorials for programming Mac OS X" href="./macosx">Mac OS X</a>
-                </div>
-                <div class="Menu">
-                  <a title="Xmlize (like serialize) your Java objects into XML documents." href="./xmlizable">Xmlizable</a>
-                </div>
-                <div class="Menu">
-                  <a title="Public Domain Base64 Java utility." href="./base64">Base64</a>
-                </div>
-                <div class="Menu">
-                  <a title="Drag and drop files into your Java programs" href="./filedrop">FileDrop</a>
-                </div>
-                <div class="Menu">
-                  <a title="View Mr. Harder's online resume" href="http://resume.iharder.net">Mr. Harder's Resume</a>
-                </div>
-                <div class="Menu">
-                  <a title="Send email to Mr. Harder" href="mailto:robertharder[nospam]gmail.com">Contact Mr. Harder</a>
-                </div>
-                <p>
-                  <hr align="center"/>
-                </p>
-                <div align="center" style="text-align:center">
-                  <a href="http://sourceforge.net">
-                    <img src="http://sourceforge.net/sflogo.php?group_id=23200" width="88" height="31" border="0" alt="SourceForge Logo"/>
-                  </a>
-                </div>
-                <p/>
-                <div align="center" style="text-align:center">
-                  <a href="http://iharder.sourceforge.net/gotmoney.php">
-                    <img src="http://iharder.sourceforge.net/gotmoney.gif" width="88" height="32" border="0" alt="got money?"/>
-                  </a>
-                </div>
-              </td>
-            </tr>
-          </table>
-        </td>
-        <td width="*" height="*" bgcolor="white" valign="top">
-          <div class="MainPage">
-
-    <div class="MainSectionTitle">Summary</div><div class="MainSectionBody">      
-
-<P><em>Now supports GZip-(de)compressing data before/after encoding!</em></P>
-
-        <P>
-          This is a <strong>Public Domain</strong> Java class providing
-          <strong>very fast</strong> Base64 encoding and decoding in 
-          the form of convenience methods and input/output streams.
-        </P>
-
-        <P style="text-align:center; font-weight:bold; font-size:larger">
-          <a href="http://prdownloads.sourceforge.net/iharder/Base64-2.1.zip?download">Download v2.1 Now! base64.zip (40k)</a>
-        </P>
-
-        <p>
-         You can have SourceForge automatically notify you when this Base64 code
-         is updated (I highly recommend you do this). 
-         <a href="http://sourceforge.net/project/filemodule_monitor.php?filemodule_id=30229">Click here.</a>
-        </p>
-
-        <p>
-          There are other Base64 utilities on the Internet, some part
-          of proprietary packages, some with various open source licenses.
-          In any event, I hope with one or more of these Base64 tools, you won't 
-          have to write your own like I did.
-        </p>
-<p>
-Thanks to Brian Burton for providing this <a href="Base64Test.java">Base64Test.java</a> test class for use with <a href="http://www.junit.org">JUnit.org</a>.
-</p>
-
-        
-        <p>
-          <strong>Changes:</strong>
-          <ul>
-<li>v2.1 - Cleaned up javadoc comments and unused variables and methods. Added
-    some convenience methods for reading and writing to and from files.</li>
- <li>
-  v2.0.2 - Now specifies UTF-8 encoding in places where the code fails on systems
-   with other encodings (like EBCDIC).
- </li>
-   
-   <li>v2.0.1 - Fixed an error when decoding a single byte, that is, when the
-     encoded data was a single byte.</li>
-   <li>v2.0 - I got rid of methods that used booleans to set options. 
-    Now everything is more consolidated and cleaner. The code now detects
-    when data that's being decoded is gzip-compressed and will decompress it
-    automatically. Generally things are cleaner. You'll probably have to
-    change some method calls that you were making to support the new
-    options format (<tt>int</tt>s that you &quot;OR&quot; together).</li>
-
-           <li>v1.5.1 - Fixed bug when decompressing and decoding to a
-            byte[] using <tt>decode( String s, boolean gzipCompressed )</tt>.
-            Added the ability to &quot;suspend&quot; encoding in the Output Stream so
-            you can turn on and off the encoding if you need to embed base64
-            data in an otherwise &quot;normal&quot; stream (like an XML file).
-            <em>This has not been fully tested, so please alert me to bugs.</em></li>
-           <li>v1.5 - Output stream pases on flush() command but doesn't do anything itself. This helps when using GZIP streams. Added the ability to <strong>GZip-compress objects</strong> before encoding them.</li>
-           <li>v1.4 - Added some helper methods for reading and writing to/from files.</li>
-           <li>v1.3.6 - Fixed OutputStream.flush() so that 'position' is reset.</li>
-           <li>v1.3.5 - Added flag to turn on and off line breaks. Fixed bug in input stream
-               where last buffer being read, if not completely full, was not returned.</li>
-           <li>v1.3.4 - Fixed when <em>Improperly padded base64 stream</em> exception
-               was incorrectly thrown.</li>
-           <li>A bug has been fixed that kept I/O streams from working at all, really.</li>
-           <li>A bug has been fixed affecting you if you use the Base64.InputStream
-            to encode data.
-           </li>
-           <li>A bug has been fixed where if you specified an offset when encoding
-            an array of bytes, the offset was ignored. 
-           </li>
-          </ul>
-        </p>
-
-      </div>
-
-    <div class="MainSectionTitle">Example</div><div class="MainSectionBody">
-        <p>
-          The easiest way to convert some data is with the convenience methods:
-        </p>
-<code><pre>String result1 = <strong>Base64.encodeObject</strong>( mySerializableObject );
-String result2 = <strong>Base64.encodeBytes</strong>( new byte[]{ 3, 34, 116, 9 } );
-</pre></code>   
-     
-        <p>
-          Or you can use the very efficient streams:
-        </p>
-<code><pre>OutputStream out = <strong>new Base64.OutputStream</strong>( 
-                    new FileOutputStream( &quot;out.txt&quot; ) );
-// Go on about your outputting...
-// ...
-
-InputStream in = <strong>new Base64.InputStream</strong>( 
-                  new FileInputStream( &quot;in.txt&quot; ) );
-// Go on about your inputting...
-// ...
-</pre></code>        
-
-
-        <p>
-          There are defaults (OutputStream encodes, InputStream decodes),
-          but you can easily override that:
-        </p>
-<code><pre>OutputStream out = new Base64.OutputStream( 
-                    new FileOutputStream( &quot;out.txt&quot; ), <strong>Base64.DECODE</strong> );
-// Go on about your outputting...
-// ...
-</pre></code>    
-
-      </div>
-
-
-  </div>
-        </td>
-      </tr>
-      <tr>
-        <td bgcolor="#9090d0" style="height: 1em; border-right: solid black 1px"> </td>
-        <td>
-          <div class="BottomMenu">
-            <span class="Menu"><a title="" href="./.">Home</a> | </span>
-            <span class="Menu"><a title="A Java framework for the Tabu Search meta-heuristic" href="http://OpenTS.iHarder.net">OpenTS</a> | </span>
-            <span class="Menu"><a title="Software and tutorials for programming Mac OS X" href="./macosx">Mac OS X</a> | </span>
-            <span class="Menu"><a title="Xmlize (like serialize) your Java objects into XML documents." href="./xmlizable">Xmlizable</a> | </span>
-            <span class="Menu"><a title="Public Domain Base64 Java utility." href="./base64">Base64</a> | </span>
-            <span class="Menu"><a title="Drag and drop files into your Java programs" href="./filedrop">FileDrop</a> | </span>
-            <span class="Menu"><a title="View Mr. Harder's online resume" href="http://resume.iharder.net">Mr. Harder's Resume</a> | </span>
-            <span class="Menu"><a title="Send email to Mr. Harder" href="mailto:robertharder[nospam]gmail.com">Contact Mr. Harder</a> | </span>
-          </div>
-        </td>
-      </tr>
-    </table>
-  </body>
-</html>

Added: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/lib/ext/commons-codec-1.3.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/lib/ext/commons-codec-1.3.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/AttachmentImpl.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/AttachmentImpl.java	2007-11-06 10:54:24 UTC (rev 16378)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/AttachmentImpl.java	2007-11-06 11:20:31 UTC (rev 16379)
@@ -27,7 +27,7 @@
 import java.util.Hashtable;
 import java.util.Map;
 
-import org.jboss.internal.soa.esb.thirdparty.Base64;
+import org.jboss.internal.soa.esb.util.Encoding;
 import org.jboss.soa.esb.MarshalException;
 import org.jboss.soa.esb.UnmarshalException;
 import org.jboss.soa.esb.message.Attachment;
@@ -165,7 +165,7 @@
 		{
 			Element named = doc.createElement(NAMED_TAG);
 			named.setAttribute(NAME_ATTR, oCurr.getKey());
-			named.appendChild(doc.createCDATASection(Base64.encodeObject(oCurr
+			named.appendChild(doc.createCDATASection(Encoding.encodeObject(oCurr
 					.getValue())));
 			elem.appendChild(named);
 		}
@@ -176,7 +176,7 @@
 		for (Serializable oCurr : _list)
 		{
 			Element anonymous = doc.createElement(UNNAMED_TAG);
-			anonymous.appendChild(doc.createCDATASection(Base64
+			anonymous.appendChild(doc.createCDATASection(Encoding
 					.encodeObject(oCurr)));
 			elem.appendChild(anonymous);
 		}
@@ -226,7 +226,7 @@
 			if (oCurr instanceof Element)
 			{
 				CDATASection cdata = (CDATASection) oCurr.getFirstChild();
-				Object value = Base64.decodeToObject(cdata.getWholeText());
+				Object value = Encoding.decodeToObject(cdata.getWholeText());
 				_list.add((Serializable) value);
 			}
 		}
@@ -242,7 +242,7 @@
 			{
 				CDATASection cdata = (CDATASection) oCurr.getFirstChild();
 				String name = ((Element) oCurr).getAttribute(NAME_ATTR);
-				Object value = Base64.decodeToObject(cdata.getWholeText());
+				Object value = Encoding.decodeToObject(cdata.getWholeText());
 				_table.put(name, (Serializable) value);
 			}
 		}

Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/PropertiesImpl.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/PropertiesImpl.java	2007-11-06 10:54:24 UTC (rev 16378)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/PropertiesImpl.java	2007-11-06 11:20:31 UTC (rev 16379)
@@ -26,7 +26,7 @@
 import java.util.Map;
 
 import org.jboss.internal.soa.esb.assertion.AssertArgument;
-import org.jboss.internal.soa.esb.thirdparty.Base64;
+import org.jboss.internal.soa.esb.util.Encoding;
 import org.jboss.soa.esb.MarshalException;
 import org.jboss.soa.esb.UnmarshalException;
 import org.jboss.soa.esb.message.Properties;
@@ -108,12 +108,12 @@
 			Element keyElement = doc.createElement(KEY_TAG);
 			Element valueElement = doc.createElement(VALUE_TAG);
 			
-			keyElement.appendChild(doc.createCDATASection(Base64.encodeBytes(oCurr.getKey().getBytes())));
+			keyElement.appendChild(doc.createCDATASection(Encoding.encodeBytes(oCurr.getKey().getBytes())));
 			oProp.appendChild(keyElement);
 		
 			try
 			{
-				valueElement.appendChild(doc.createCDATASection(Base64.encodeObject(oCurr.getValue())));
+				valueElement.appendChild(doc.createCDATASection(Encoding.encodeObject(oCurr.getValue())));
 			}
 			catch (IOException ex)
 			{
@@ -182,7 +182,7 @@
 							
 							try
 							{
-								value = Base64.decodeToObject(cdata.getWholeText());
+								value = Encoding.decodeToObject(cdata.getWholeText());
 							}
 							catch (ClassNotFoundException ex)
 							{
@@ -198,7 +198,7 @@
 							if (oProp.getNodeName().equals(KEY_TAG))
 							{
 								CDATASection cdata = (CDATASection) oProp.getFirstChild();
-								key = new String(Base64.decode(cdata.getWholeText()));
+								key = new String(Encoding.decodeToBytes(cdata.getWholeText()));
 							}
 						}
 					}

Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/marshal/SerializedMarshalUnmarshalPlugin.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/marshal/SerializedMarshalUnmarshalPlugin.java	2007-11-06 10:54:24 UTC (rev 16378)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/marshal/SerializedMarshalUnmarshalPlugin.java	2007-11-06 11:20:31 UTC (rev 16379)
@@ -4,7 +4,7 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 
-import org.jboss.internal.soa.esb.thirdparty.Base64;
+import org.jboss.internal.soa.esb.util.Encoding;
 import org.jboss.soa.esb.MarshalException;
 import org.jboss.soa.esb.UnmarshalException;
 import org.w3c.dom.CDATASection;
@@ -92,7 +92,7 @@
 
 				nodeElement.appendChild(doc.getOwnerDocument()
 						.createCDATASection(
-								Base64.encodeObject((Serializable) param)));
+								Encoding.encodeObject((Serializable) param)));
 
 				doc.appendChild(nodeElement);
 			}
@@ -145,7 +145,7 @@
 								CDATASection cdata = (CDATASection) childList
 										.item(j + 1);
 
-								return Base64.decodeToObject(cdata
+								return Encoding.decodeToObject(cdata
 										.getWholeText());
 							}
 						}

Added: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/util/Encoding.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/util/Encoding.java	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/util/Encoding.java	2007-11-06 11:20:31 UTC (rev 16379)
@@ -0,0 +1,85 @@
+/**
+ * A Base64 Encoder/Decoder.
+ *
+ * <p>
+ * This class is used to encode and decode data in Base64 format as described in RFC 1521.
+ *
+ * <p>
+ * This is "Open Source" software and released under the <a href="http://www.gnu.org/licenses/lgpl.html">GNU/LGPL</a> license.<br>
+ * It is provided "as is" without warranty of any kind.<br>
+ * Copyright 2003: Christian d'Heureuse, Inventec Informatik AG, Switzerland.<br>
+ * Home page: <a href="http://www.source-code.biz">www.source-code.biz</a><br>
+ *
+ * <p>
+ * Version history:<br>
+ * 2003-07-22 Christian d'Heureuse (chdh): Module created.<br>
+ * 2005-08-11 chdh: Lincense changed from GPL to LGPL.<br>
+ * 2006-11-21 chdh:<br>
+ *  &nbsp; Method encode(String) renamed to encodeString(String).<br>
+ *  &nbsp; Method decode(String) renamed to decodeString(String).<br>
+ *  &nbsp; New method encode(byte[],int) added.<br>
+ *  &nbsp; New method decode(String) added.<br>
+ */
+
+package org.jboss.internal.soa.esb.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+
+import org.apache.commons.codec.binary.Base64;
+import org.jboss.soa.esb.util.ContextObjectInputStream;
+
+public class Encoding
+{	
+	/*
+	 * The following are methods added by us to support Objects.
+	 */
+	
+	public static String encodeBytes (byte[] param)
+	{
+		return new String(Base64.encodeBase64(param));
+	}
+
+	public static byte[] decodeToBytes (String param)
+	{
+		return Base64.decodeBase64(param.getBytes());
+	}
+	
+	public static String encodeObject (Serializable object) throws IOException
+	{
+		if (object == null)
+			throw new IllegalArgumentException();
+		
+		ByteArrayOutputStream bs = new ByteArrayOutputStream();
+        ObjectOutputStream oos = new ObjectOutputStream(bs);
+        
+        oos.writeObject(object);
+        oos.close();
+        
+        return encodeBytes(bs.toByteArray());
+	}
+	
+	public static Serializable decodeToObject (String param) throws IOException, ClassNotFoundException
+	{
+		if (param == null)
+			throw new IllegalArgumentException();
+		
+		ContextObjectInputStream ois = null;
+		
+		try
+		{
+			ByteArrayInputStream bs = new ByteArrayInputStream(Base64.decodeBase64(param.getBytes()));
+			ois = new ContextObjectInputStream(bs);
+
+			return (Serializable) ois.readObject();
+		}
+		finally
+		{
+			ois.close();
+		}
+	}
+
+}

Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/message/body/content/BytesBody.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/message/body/content/BytesBody.java	2007-11-06 10:54:24 UTC (rev 16378)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/message/body/content/BytesBody.java	2007-11-06 11:20:31 UTC (rev 16379)
@@ -40,7 +40,7 @@
 
 public interface BytesBody extends Body
 {
-    @Deprecated
+
     public static final String BYTES_LOCATION = "org.jboss.soa.esb.message.content.bytes";
 	
 	public boolean readBoolean() throws IncompatibleModeException, IOException,

Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStoreImpl.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStoreImpl.java	2007-11-06 10:54:24 UTC (rev 16378)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStoreImpl.java	2007-11-06 11:20:31 UTC (rev 16379)
@@ -33,7 +33,7 @@
 
 import org.apache.log4j.Logger;
 import org.jboss.internal.soa.esb.message.urigen.DefaultMessageURIGenerator;
-import org.jboss.internal.soa.esb.thirdparty.Base64;
+import org.jboss.internal.soa.esb.util.Encoding;
 import org.jboss.soa.esb.Service;
 import org.jboss.soa.esb.client.ServiceInvoker;
 import org.jboss.soa.esb.common.Environment;
@@ -264,7 +264,7 @@
             
             while (rs.next()) {
                 URI uid = new URI(rs.getString(1));
-                Message msg = Util.deserialize((Serializable) Base64.decodeToObject( rs.getString(2)));
+                Message msg = Util.deserialize((Serializable) Encoding.decodeToObject( rs.getString(2)));
                 messages.put(uid, msg);
             }
             rs.close();
@@ -395,7 +395,7 @@
         ResultSet rs = selectStmt.executeQuery();
         if (rs.next()) {
             try {
-                message = Util.deserialize((Serializable) Base64.decodeToObject(rs.getString("message")));
+                message = Util.deserialize((Serializable) Encoding.decodeToObject(rs.getString("message")));
             } catch (Exception e) {
                 throw new MessageStoreException(e);
             }
@@ -416,7 +416,7 @@
         ResultSet rs = selectStmt.executeQuery();
         if (rs.next()) {
             try {
-                message = Util.deserialize((Serializable) Base64.decodeToObject(rs.getString("message")));
+                message = Util.deserialize((Serializable) Encoding.decodeToObject(rs.getString("message")));
             } catch (Exception e) {
                 throw new MessageStoreException(e);
             }
@@ -447,7 +447,7 @@
         ps.setString(1, uid.toString());
         ps.setString(2, message.getType().toString());
         try {
-            String messageString = Base64.encodeObject(Util.serialize(message));
+            String messageString = Encoding.encodeObject(Util.serialize(message));
             ps.setString(3, messageString);
         } catch (Exception e) {
             throw new MessageStoreException(e);




More information about the jboss-svn-commits mailing list