commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adri...@apache.org
Subject svn commit: r922338 [1/2] - in /commons/sandbox/convert: branches/ tags/ trunk/ trunk/src/ trunk/src/META-INF/ trunk/src/META-INF/services/ trunk/src/java/ trunk/src/java/org/ trunk/src/java/org/apache/ trunk/src/java/org/apache/commons/ trunk/src/java...
Date Fri, 12 Mar 2010 16:58:09 GMT
Author: adrianc
Date: Fri Mar 12 16:58:07 2010
New Revision: 922338

URL: http://svn.apache.org/viewvc?rev=922338&view=rev
Log:
Initial commit of the convert sandbox project. I copied over the structure of the dormant convert project and replaced the old source code with the new code.

The project doesn't build yet and the unit tests are incomplete.

Added:
    commons/sandbox/convert/branches/
    commons/sandbox/convert/tags/
    commons/sandbox/convert/trunk/   (with props)
    commons/sandbox/convert/trunk/.classpath   (with props)
    commons/sandbox/convert/trunk/.project   (with props)
    commons/sandbox/convert/trunk/LICENSE.txt   (with props)
    commons/sandbox/convert/trunk/NOTICE.txt   (with props)
    commons/sandbox/convert/trunk/build.xml   (with props)
    commons/sandbox/convert/trunk/checkstyle.xml   (with props)
    commons/sandbox/convert/trunk/project.properties   (with props)
    commons/sandbox/convert/trunk/project.xml   (with props)
    commons/sandbox/convert/trunk/src/
    commons/sandbox/convert/trunk/src/META-INF/
    commons/sandbox/convert/trunk/src/META-INF/services/
    commons/sandbox/convert/trunk/src/META-INF/services/org.apache.commons.convert.ConverterLoader   (with props)
    commons/sandbox/convert/trunk/src/java/
    commons/sandbox/convert/trunk/src/java/org/
    commons/sandbox/convert/trunk/src/java/org/apache/
    commons/sandbox/convert/trunk/src/java/org/apache/commons/
    commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/
    commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/AbstractConverter.java   (with props)
    commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/AbstractLocalizedConverter.java   (with props)
    commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/BooleanConverters.java   (with props)
    commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/CollectionConverters.java   (with props)
    commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/ConversionException.java   (with props)
    commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/Converter.java   (with props)
    commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/ConverterCreator.java   (with props)
    commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/ConverterLoader.java   (with props)
    commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/Converters.java   (with props)
    commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/DateTimeConverters.java   (with props)
    commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/GenericSingletonToList.java   (with props)
    commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/GenericSingletonToSet.java   (with props)
    commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/LocalizedConverter.java   (with props)
    commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/MiscConverters.java   (with props)
    commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/NetConverters.java   (with props)
    commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/NumberConverters.java   (with props)
    commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/Util.java   (with props)
    commons/sandbox/convert/trunk/src/test/
    commons/sandbox/convert/trunk/src/test/org/
    commons/sandbox/convert/trunk/src/test/org/apache/
    commons/sandbox/convert/trunk/src/test/org/apache/commons/
    commons/sandbox/convert/trunk/src/test/org/apache/commons/convert/
    commons/sandbox/convert/trunk/src/test/org/apache/commons/convert/TestDateTimeConverters.java   (with props)
    commons/sandbox/convert/trunk/xdocs/
    commons/sandbox/convert/trunk/xdocs/class-diagram.png   (with props)
    commons/sandbox/convert/trunk/xdocs/images/
    commons/sandbox/convert/trunk/xdocs/images/convert-logo-white.png   (with props)
    commons/sandbox/convert/trunk/xdocs/images/convert-logo-white.xcf   (with props)
    commons/sandbox/convert/trunk/xdocs/index.xml   (with props)
    commons/sandbox/convert/trunk/xdocs/navigation.xml   (with props)
    commons/sandbox/convert/trunk/xdocs/style/
    commons/sandbox/convert/trunk/xdocs/style/project.css

Propchange: commons/sandbox/convert/trunk/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Mar 12 16:58:07 2010
@@ -0,0 +1 @@
+target

Added: commons/sandbox/convert/trunk/.classpath
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/.classpath?rev=922338&view=auto
==============================================================================
--- commons/sandbox/convert/trunk/.classpath (added)
+++ commons/sandbox/convert/trunk/.classpath Fri Mar 12 16:58:07 2010
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src/java"/>
+	<classpathentry kind="src" path="src/test"/>
+	<classpathentry kind="lib" path="target/lib/ant-1.5.jar"/>
+	<classpathentry kind="lib" path="target/lib/ant-optional-1.5.jar"/>
+	<classpathentry kind="lib" path="target/lib/junit-3.8.1.jar"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Propchange: commons/sandbox/convert/trunk/.classpath
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/convert/trunk/.classpath
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: commons/sandbox/convert/trunk/.classpath
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/convert/trunk/.project
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/.project?rev=922338&view=auto
==============================================================================
--- commons/sandbox/convert/trunk/.project (added)
+++ commons/sandbox/convert/trunk/.project Fri Mar 12 16:58:07 2010
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>Convert</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Propchange: commons/sandbox/convert/trunk/.project
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/convert/trunk/.project
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: commons/sandbox/convert/trunk/.project
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/convert/trunk/LICENSE.txt
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/LICENSE.txt?rev=922338&view=auto
==============================================================================
--- commons/sandbox/convert/trunk/LICENSE.txt (added)
+++ commons/sandbox/convert/trunk/LICENSE.txt Fri Mar 12 16:58:07 2010
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.

Propchange: commons/sandbox/convert/trunk/LICENSE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/convert/trunk/LICENSE.txt
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: commons/sandbox/convert/trunk/LICENSE.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/convert/trunk/NOTICE.txt
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/NOTICE.txt?rev=922338&view=auto
==============================================================================
--- commons/sandbox/convert/trunk/NOTICE.txt (added)
+++ commons/sandbox/convert/trunk/NOTICE.txt Fri Mar 12 16:58:07 2010
@@ -0,0 +1,2 @@
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).

Propchange: commons/sandbox/convert/trunk/NOTICE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/convert/trunk/NOTICE.txt
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: commons/sandbox/convert/trunk/NOTICE.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/convert/trunk/build.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/build.xml?rev=922338&view=auto
==============================================================================
--- commons/sandbox/convert/trunk/build.xml (added)
+++ commons/sandbox/convert/trunk/build.xml Fri Mar 12 16:58:07 2010
@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--build.xml generated by maven from project.xml version 0.1
+  on date October 4 2004, time 2323-->
+
+<project default="jar" name="commons-convert" basedir=".">
+  <property name="defaulttargetdir" value="target">
+  </property>
+  <property name="libdir" value="target/lib">
+  </property>
+  <property name="classesdir" value="target/classes">
+  </property>
+  <property name="testclassesdir" value="target/test-classes">
+  </property>
+  <property name="testreportdir" value="target/test-reports">
+  </property>
+  <property name="distdir" value="dist">
+  </property>
+  <property name="javadocdir" value="dist/docs/api">
+  </property>
+  <property name="final.name" value="commons-convert-0.1">
+  </property>
+  <target name="init" description="o Initializes some properties">
+    <mkdir dir="${libdir}">
+    </mkdir>
+    <condition property="noget">
+      <equals arg2="only" arg1="${build.sysclasspath}">
+      </equals>
+    </condition>
+  </target>
+  <target name="compile" description="o Compile the code" depends="get-deps">
+    <mkdir dir="${classesdir}">
+    </mkdir>
+    <javac destdir="${classesdir}" deprecation="true" debug="true" optimize="false" excludes="**/package.html">
+      <src>
+        <pathelement location="${basedir}/src/java">
+        </pathelement>
+      </src>
+      <classpath>
+        <fileset dir="${libdir}">
+          <include name="*.jar">
+          </include>
+        </fileset>
+      </classpath>
+    </javac>
+    <copy todir="${classesdir}">
+      <fileset dir="${basedir}">
+        <include name="**/*.properties">
+        </include>
+      </fileset>
+    </copy>
+    <copy todir="${classesdir}">
+      <fileset dir="${basedir}">
+        <include name="NOTICE.txt">
+        </include>
+      </fileset>
+    </copy>
+  </target>
+  <target name="jar" description="o Create the jar" depends="compile,test">
+    <jar jarfile="target/${final.name}.jar" excludes="**/package.html" basedir="${classesdir}">
+    </jar>
+  </target>
+  <target name="clean" description="o Clean up the generated directories">
+    <delete dir="${defaulttargetdir}">
+    </delete>
+    <delete dir="${distdir}">
+    </delete>
+  </target>
+  <target name="dist" description="o Create a distribution" depends="jar, javadoc">
+    <mkdir dir="dist">
+    </mkdir>
+    <copy todir="dist">
+      <fileset dir="${defaulttargetdir}" includes="*.jar">
+      </fileset>
+      <fileset dir="${basedir}" includes="LICENSE*, README*">
+      </fileset>
+    </copy>
+  </target>
+  <target name="test" description="o Run the test cases" if="test.failure" depends="internal-test">
+    <fail message="There were test failures.">
+    </fail>
+  </target>
+  <target name="internal-test" depends="compile-tests">
+    <mkdir dir="${testreportdir}">
+    </mkdir>
+    <junit dir="./" failureproperty="test.failure" printSummary="yes" fork="true" haltonerror="true">
+      <sysproperty key="basedir" value=".">
+      </sysproperty>
+      <formatter type="xml">
+      </formatter>
+      <formatter usefile="false" type="plain">
+      </formatter>
+      <classpath>
+        <fileset dir="${libdir}">
+          <include name="*.jar">
+          </include>
+        </fileset>
+        <pathelement path="${testclassesdir}">
+        </pathelement>
+        <pathelement path="${classesdir}">
+        </pathelement>
+      </classpath>
+      <batchtest todir="${testreportdir}">
+        <fileset dir="${basedir}/src/test">
+          <include name="**/Test*.java">
+          </include>
+        </fileset>
+      </batchtest>
+    </junit>
+  </target>
+  <target name="compile-tests" depends="compile">
+    <mkdir dir="${testclassesdir}">
+    </mkdir>
+    <javac destdir="${testclassesdir}" deprecation="true" debug="true" optimize="false" excludes="**/package.html">
+      <src>
+        <pathelement location="${basedir}/src/test">
+        </pathelement>
+      </src>
+      <classpath>
+        <fileset dir="${libdir}">
+          <include name="*.jar">
+          </include>
+        </fileset>
+        <pathelement path="${classesdir}">
+        </pathelement>
+      </classpath>
+    </javac>
+  </target>
+  <target name="javadoc" description="o Generate javadoc" depends="jar">
+    <mkdir dir="${javadocdir}">
+    </mkdir>
+    <tstamp>
+      <format pattern="2003-yyyy" property="year">
+      </format>
+    </tstamp>
+    <property name="copyright" value="Copyright &amp;copy;  The Apache Software Foundation. All Rights Reserved.">
+    </property>
+    <property name="title" value="Commons Convert 0.1 API">
+    </property>
+    <javadoc use="true" private="true" destdir="${javadocdir}" author="true" version="true" sourcepath="${basedir}/src/java" packagenames="org.apache.commons.convert.*.*">
+      <classpath>
+        <fileset dir="${libdir}">
+          <include name="*.jar">
+          </include>
+        </fileset>
+        <pathelement location="target/${final.name}.jar">
+        </pathelement>
+      </classpath>
+    </javadoc>
+  </target>
+  <target name="get-deps" unless="noget" depends="init">
+    <get dest="${libdir}/junit-3.8.1.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/junit/jars/junit-3.8.1.jar">
+    </get>
+    <get dest="${libdir}/ant-1.5.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/ant/jars/ant-1.5.jar">
+    </get>
+    <get dest="${libdir}/ant-optional-1.5.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/ant/jars/ant-optional-1.5.jar">
+    </get>
+  </target>
+  <target name="install-maven">
+    <get dest="${user.home}/maven-install-latest.jar" usetimestamp="true" src="${repo}/maven/maven-install-latest.jar">
+    </get>
+    <unjar dest="${maven.home}" src="${user.home}/maven-install-latest.jar">
+    </unjar>
+  </target>
+</project>

Propchange: commons/sandbox/convert/trunk/build.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/convert/trunk/build.xml
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: commons/sandbox/convert/trunk/build.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: commons/sandbox/convert/trunk/checkstyle.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/checkstyle.xml?rev=922338&view=auto
==============================================================================
--- commons/sandbox/convert/trunk/checkstyle.xml (added)
+++ commons/sandbox/convert/trunk/checkstyle.xml Fri Mar 12 16:58:07 2010
@@ -0,0 +1,70 @@
+<?xml version="1.0"?>
+<!--
+   Copyright 2003-2004 The Apache Software Foundation
+
+   Licensed 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.
+-->
+
+<!DOCTYPE module PUBLIC
+    "-//Puppy Crawl//DTD Check Configuration 1.1//EN"
+    "http://www.puppycrawl.com/dtds/configuration_1_1.dtd">
+
+<!-- commons lang customization of default Checkstyle behavior -->
+<module name="Checker">
+<!--  <property name="basedir" value="."/> -->
+  <property name="localeLanguage" value="en"/>
+  <module name="PackageHtml"/>
+  <module name="TreeWalker">
+    <module name="TabCharacter"/>
+    <module name="AvoidStarImport"/>
+    <module name="RedundantImport"/>
+    <module name="UnusedImports"/>
+    <module name="NeedBraces"/>
+    <module name="WhitespaceAfter"/>
+    <module name="WhitespaceAround"/>
+    <module name="ModifierOrder"/>
+    <module name="RedundantModifier"/>
+    <module name="EmptyBlock"/>
+    <module name="LeftCurly"/>
+    <module name="NeedBraces"/>
+    <module name="RightCurly"/>
+    <module name="UpperEll"/>
+    <module name="ArrayTypeStyle"/>
+    <module name="Indentation"/>
+    
+    <module name="GenericIllegalRegexp">
+      <property name="format" value="System\.out\.println"/>
+    </module>
+    <module name="GenericIllegalRegexp">
+      <property name="format" value="System\.err\.println"/>
+    </module>
+    <module name="GenericIllegalRegexp">
+      <property name="format" value="\.printStackTrace"/>
+    </module>
+    <module name="IllegalInstantiation">
+      <property name="classes" value="java.lang.Boolean"/>
+    </module>
+    <module name="RedundantThrows">
+      <property name="allowUnchecked" value="true"/>
+    </module>
+    <module name="LineLength">
+      <property name="max" value="120"/>
+    </module>
+    <module name="JavadocVariable"/>
+    <module name="JavadocMethod">
+      <property name="allowUndeclaredRTE" value="true"/>
+    </module>
+ </module>
+</module>
+                        
+

Propchange: commons/sandbox/convert/trunk/checkstyle.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/convert/trunk/checkstyle.xml
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: commons/sandbox/convert/trunk/checkstyle.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: commons/sandbox/convert/trunk/project.properties
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/project.properties?rev=922338&view=auto
==============================================================================
--- commons/sandbox/convert/trunk/project.properties (added)
+++ commons/sandbox/convert/trunk/project.properties Fri Mar 12 16:58:07 2010
@@ -0,0 +1,24 @@
+#   Copyright 2003-2004 The Apache Software Foundation
+#
+#   Licensed 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.
+
+maven.xdoc.jsl=../commons-build/commons-site.jsl
+maven.xdoc.date=bottom
+maven.xdoc.poweredby.image=maven-feather.png
+maven.xdoc.version=${pom.currentVersion}
+maven.xdoc.developmentProcessUrl=http://commons.apache.org/charter.html
+maven.xdoc.includeProjectDocumentation=yes
+
+maven.checkstyle.properties=checkstyle.xml
+maven.changelog.factory=org.apache.maven.svnlib.SvnChangeLogFactory
+

Propchange: commons/sandbox/convert/trunk/project.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/convert/trunk/project.properties
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: commons/sandbox/convert/trunk/project.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/convert/trunk/project.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/project.xml?rev=922338&view=auto
==============================================================================
--- commons/sandbox/convert/trunk/project.xml (added)
+++ commons/sandbox/convert/trunk/project.xml Fri Mar 12 16:58:07 2010
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project>
+  <extend>../commons-build/sandbox-project.xml</extend>
+  <name>Commons Convert</name>
+  <id>commons-convert</id>
+  
+  <logo>/images/convert-logo-white.png</logo>
+  
+  <currentVersion>0.1</currentVersion>
+  <inceptionYear>2003</inceptionYear>
+  <shortDescription>Commons Convert</shortDescription>
+  <description>Java Conversion Utilities</description>
+  <url>http://commons.apache.org/sandbox/convert/</url>
+  
+  <siteAddress>jakarta.apache.org</siteAddress>
+  <siteDirectory>/www/commons.apache.org/sandbox/convert/</siteDirectory>
+  
+  <developers>
+    <developer>
+      <name>Adrian Crum</name>
+      <id>adrianc</id>
+      <organization>Apache Software Foundation</organization>
+    </developer>
+    <developer>
+      <name>Adam Heath</name>
+      <id>doogie</id>
+      <organization>Apache Software Foundation</organization>
+    </developer>
+  </developers>
+  
+  <contributors>
+    <contributor>
+      <name>Scott Gray</name>
+    </contributor>
+  </contributors>
+    
+  <dependencies>
+  </dependencies>
+
+  <build>
+    <unitTest>
+      <includes>
+        <include>**/Test*.java</include>
+      </includes>
+    </unitTest>
+  </build>
+
+  <reports>
+     <report>maven-changelog-plugin</report>
+     <report>maven-changes-plugin</report>
+     <report>maven-checkstyle-plugin</report>
+     <report>maven-jcoverage-plugin</report>
+     <report>maven-developer-activity-plugin</report>
+     <report>maven-file-activity-plugin</report>
+     <report>maven-javadoc-plugin</report>
+     <report>maven-junit-report-plugin</report>
+     <report>maven-jxr-plugin</report>
+     <report>maven-license-plugin</report>
+  </reports>
+  
+</project>

Propchange: commons/sandbox/convert/trunk/project.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/convert/trunk/project.xml
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: commons/sandbox/convert/trunk/project.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: commons/sandbox/convert/trunk/src/META-INF/services/org.apache.commons.convert.ConverterLoader
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/src/META-INF/services/org.apache.commons.convert.ConverterLoader?rev=922338&view=auto
==============================================================================
--- commons/sandbox/convert/trunk/src/META-INF/services/org.apache.commons.convert.ConverterLoader (added)
+++ commons/sandbox/convert/trunk/src/META-INF/services/org.apache.commons.convert.ConverterLoader Fri Mar 12 16:58:07 2010
@@ -0,0 +1,23 @@
+# 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.
+
+org.apache.commons.convert.BooleanConverters
+org.apache.commons.convert.CollectionConverters
+org.apache.commons.convert.DateTimeConverters
+org.apache.commons.convert.MiscConverters
+org.apache.commons.convert.NetConverters
+org.apache.commons.convert.NumberConverters

Propchange: commons/sandbox/convert/trunk/src/META-INF/services/org.apache.commons.convert.ConverterLoader
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/convert/trunk/src/META-INF/services/org.apache.commons.convert.ConverterLoader
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: commons/sandbox/convert/trunk/src/META-INF/services/org.apache.commons.convert.ConverterLoader
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/AbstractConverter.java
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/AbstractConverter.java?rev=922338&view=auto
==============================================================================
--- commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/AbstractConverter.java (added)
+++ commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/AbstractConverter.java Fri Mar 12 16:58:07 2010
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * 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.commons.convert;
+
+/** Abstract Converter class. This class handles converter registration
+ * and it implements the <code>canConvert</code>, <code>getSourceClass</code>,
+ * and <code>getTargetClass</code> methods.
+ */
+public abstract class AbstractConverter<S, T> implements Converter<S, T>, ConverterLoader {
+    private final Class<? super S> sourceClass;
+    private final Class<? super T> targetClass;
+
+    protected AbstractConverter(Class<? super S> sourceClass, Class<? super T> targetClass) {
+        this.sourceClass = sourceClass;
+        this.targetClass = targetClass;
+    }
+
+    public void loadConverters() {
+        Converters.registerConverter(this);
+    }
+
+    public T convert(Class<? extends T> targetClass, S obj) throws ConversionException {
+        return convert(obj);
+    }
+
+    public boolean canConvert(Class<?> sourceClass, Class<?> targetClass) {
+        return Util.instanceOf(sourceClass, this.getSourceClass()) && Util.instanceOf(targetClass, this.getTargetClass());
+    }
+
+    public Class<? super S> getSourceClass() {
+        return sourceClass;
+    }
+
+    public Class<? super T> getTargetClass() {
+        return targetClass;
+    }
+}

Propchange: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/AbstractConverter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/AbstractConverter.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/AbstractConverter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/AbstractLocalizedConverter.java
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/AbstractLocalizedConverter.java?rev=922338&view=auto
==============================================================================
--- commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/AbstractLocalizedConverter.java (added)
+++ commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/AbstractLocalizedConverter.java Fri Mar 12 16:58:07 2010
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * 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.commons.convert;
+
+import java.util.Locale;
+import java.util.TimeZone;
+
+/** Abstract LocalizedConverter class. This class handles converter registration
+ * and it implements the <code>canConvert</code>, <code>getSourceClass</code>,
+ * and <code>getTargetClass</code> methods.
+ */
+public abstract class AbstractLocalizedConverter<S, T> extends AbstractConverter<S, T> implements LocalizedConverter<S, T> {
+    protected AbstractLocalizedConverter(Class<? super S> sourceClass, Class<? super T> targetClass) {
+        super(sourceClass, targetClass);
+    }
+
+    public T convert(Class<? extends T> targetClass, S obj, Locale locale, TimeZone timeZone) throws ConversionException {
+        return convert(obj, locale, timeZone);
+    }
+
+    public T convert(Class<? extends T> targetClass, S obj, Locale locale, TimeZone timeZone, String formatString) throws ConversionException {
+        return convert(obj, locale, timeZone, formatString);
+    }
+}

Propchange: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/AbstractLocalizedConverter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/AbstractLocalizedConverter.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/AbstractLocalizedConverter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/BooleanConverters.java
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/BooleanConverters.java?rev=922338&view=auto
==============================================================================
--- commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/BooleanConverters.java (added)
+++ commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/BooleanConverters.java Fri Mar 12 16:58:07 2010
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * 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.commons.convert;
+
+/** Boolean Converter classes. */
+public class BooleanConverters implements ConverterLoader {
+    public static class BooleanToInteger extends AbstractConverter<Boolean, Integer> {
+        public BooleanToInteger() {
+            super(Boolean.class, Integer.class);
+        }
+
+        public Integer convert(Boolean obj) throws ConversionException {
+             return obj.booleanValue() ? 1 : 0;
+        }
+    }
+
+    public static class BooleanToList extends GenericSingletonToList<Boolean> {
+        public BooleanToList() {
+            super(Boolean.class);
+        }
+    }
+
+    public static class BooleanToSet extends GenericSingletonToSet<Boolean> {
+        public BooleanToSet() {
+            super(Boolean.class);
+        }
+    }
+
+    public static class BooleanToString extends AbstractConverter<Boolean, String> {
+        public BooleanToString() {
+            super(Boolean.class, String.class);
+        }
+
+        public String convert(Boolean obj) throws ConversionException {
+            return obj.booleanValue() ? "true" : "false";
+        }
+    }
+
+    public static class IntegerToBoolean extends AbstractConverter<Integer, Boolean> {
+        public IntegerToBoolean() {
+            super(Integer.class, Boolean.class);
+        }
+
+        public Boolean convert(Integer obj) throws ConversionException {
+             return obj.intValue() == 0 ? false : true;
+        }
+    }
+
+    public static class StringToBoolean extends AbstractConverter<String, Boolean> {
+        public StringToBoolean() {
+            super(String.class, Boolean.class);
+        }
+
+        public Boolean convert(String obj) throws ConversionException {
+            return "TRUE".equals(obj.trim().toUpperCase());
+        }
+    }
+
+    public void loadConverters() {
+        Converters.loadContainedConverters(BooleanConverters.class);
+    }
+}

Propchange: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/BooleanConverters.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/BooleanConverters.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/BooleanConverters.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/CollectionConverters.java
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/CollectionConverters.java?rev=922338&view=auto
==============================================================================
--- commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/CollectionConverters.java (added)
+++ commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/CollectionConverters.java Fri Mar 12 16:58:07 2010
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * 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.commons.convert;
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/** Collection Converter classes. */
+public class CollectionConverters implements ConverterLoader {
+    public static class ArrayCreator implements ConverterCreator, ConverterLoader {
+        public void loadConverters() {
+            Converters.registerCreator(this);
+        }
+
+        public <S, T> Converter<S, T> createConverter(Class<S> sourceClass, Class<T> targetClass) {
+            if (!sourceClass.isArray()) {
+               return null;
+            }
+            if (targetClass != List.class) {
+               return null;
+            }
+            if (!(sourceClass.getComponentType() instanceof Object)) {
+                return null;
+            }
+            return Util.cast(new ArrayClassToList<S, T>(sourceClass, targetClass));
+        }
+    }
+
+    private static class ArrayClassToList<S, T> extends AbstractConverter<S, T> {
+        public ArrayClassToList(Class<S> sourceClass, Class<T> targetClass) {
+            super(sourceClass, targetClass);
+        }
+
+        public boolean canConvert(Class<?> sourceClass, Class<?> targetClass) {
+            return sourceClass == this.getSourceClass() && targetClass == this.getTargetClass();
+        }
+
+        public T convert(S obj) throws ConversionException {
+            List<Object> list = new ArrayList<Object>();
+            int len = Array.getLength(obj);
+            for (int i = 0; i < len; i++) {
+                list.add(Array.get(obj, i));
+            }
+            return Util.<T>cast(list);
+        }
+    }
+
+    public static class ArrayToList<T> extends AbstractConverter<T[], List<T>> {
+        public ArrayToList() {
+            super(Object[].class, List.class);
+        }
+
+        @Override
+        public boolean canConvert(Class<?> sourceClass, Class<?> targetClass) {
+            if (!sourceClass.isArray()) {
+                return false;
+            }
+            if (!List.class.isAssignableFrom(targetClass)) {
+                return false;
+            }
+            if (Object[].class.isAssignableFrom(sourceClass)) {
+                return true;
+            }
+            return false;
+        }
+
+        public List<T> convert(T[] obj) throws ConversionException {
+            return Arrays.asList(obj);
+        }
+    }
+
+    public static class ListToString<T> extends AbstractConverter<List<T>, String> {
+        public ListToString() {
+            super(List.class, String.class);
+        }
+
+        public String convert(List<T> obj) throws ConversionException {
+            return obj.toString();
+        }
+    }
+
+    public static class MapToList<K, V> extends AbstractConverter<Map<K, V>, List<Map<K, V>>> {
+        public MapToList() {
+            super(Map.class, List.class);
+        }
+
+        public List<Map<K, V>> convert(Map<K, V> obj) throws ConversionException {
+            List<Map<K, V>> tempList = new ArrayList<Map<K, V>>();
+            tempList.add(obj);
+            return tempList;
+        }
+    }
+
+    public static class MapToSet<K, V> extends AbstractConverter<Map<K, V>, Set<Map<K, V>>> {
+        public MapToSet() {
+            super(Map.class, Set.class);
+        }
+
+        public Set<Map<K, V>> convert(Map<K, V> obj) throws ConversionException {
+            Set<Map<K, V>> tempSet = new HashSet<Map<K, V>>();
+            tempSet.add(obj);
+            return tempSet;
+        }
+    }
+
+    public static class MapToString<K, V> extends AbstractConverter<Map<K, V>, String> {
+        public MapToString() {
+            super(Map.class, String.class);
+        }
+
+        public String convert(Map<K, V> obj) throws ConversionException {
+            return obj.toString();
+        }
+    }
+
+    public void loadConverters() {
+        Converters.loadContainedConverters(CollectionConverters.class);
+    }
+}

Propchange: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/CollectionConverters.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/CollectionConverters.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/CollectionConverters.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/ConversionException.java
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/ConversionException.java?rev=922338&view=auto
==============================================================================
--- commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/ConversionException.java (added)
+++ commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/ConversionException.java Fri Mar 12 16:58:07 2010
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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.commons.convert;
+
+/** ConversionException class. */
+@SuppressWarnings("serial")
+public class ConversionException extends Exception {
+    public ConversionException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public ConversionException(String message) {
+        super(message);
+    }
+
+    public ConversionException(Throwable cause) {
+        super(cause);
+    }
+}

Propchange: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/ConversionException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/ConversionException.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/ConversionException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/Converter.java
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/Converter.java?rev=922338&view=auto
==============================================================================
--- commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/Converter.java (added)
+++ commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/Converter.java Fri Mar 12 16:58:07 2010
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 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.commons.convert;
+
+/** Converter interface. Classes implement this interface to convert one
+ * Java object type to another.
+ *
+ * @param <S> The source object type
+ * @param <T> The target object type
+ */
+public interface Converter<S, T> {
+    /** Returns <code>true</code> if this object can convert
+     * <code>sourceClass</code> to <code>targetClass</code>.
+     * <p>Implementations can accomodate class hierarchy ranges
+     * by converting super classes or interfaces.</p>
+     *
+     * @param sourceClass The source <code>Class</code>
+     * @param targetClass The target <code>Class</code>
+     * @return <code>true</code> if this object can convert
+     * <code>sourceClass</code> to <code>targetClass</code>.
+     */
+    public boolean canConvert(Class<?> sourceClass, Class<?> targetClass);
+
+    /** Converts <code>obj</code> to <code>T</code>.
+     *
+     * @param obj The source <code>Object</code> to convert
+     * @return The converted <code>Object</code>
+     * @throws ConversionException
+     */
+    public T convert(S obj) throws ConversionException;
+
+    /** Converts <code>obj</code> to <code>T</code>.
+     *
+     * @param targetClass The <code>Class</code> to convert to
+     * @param obj The source <code>Object</code> to convert
+     * @return The converted <code>Object</code>
+     * @throws ConversionException
+     */
+    public T convert(Class<? extends T> targetClass, S obj) throws ConversionException;
+
+    /** Returns the source <code>Class</code> for this converter.
+     *
+     * @return The source <code>Class</code> for this converter
+     */
+    public Class<?> getSourceClass();
+
+    /** Returns the target <code>Class</code> for this converter.
+     *
+     * @return The target <code>Class</code> for this converter
+     */
+    public Class<?> getTargetClass();
+}

Propchange: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/Converter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/Converter.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/Converter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/ConverterCreator.java
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/ConverterCreator.java?rev=922338&view=auto
==============================================================================
--- commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/ConverterCreator.java (added)
+++ commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/ConverterCreator.java Fri Mar 12 16:58:07 2010
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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.commons.convert;
+
+/** ConverterCreator interface. Classes implement this interface to create a
+ * converter that can convert one Java object type to another.
+ */
+public interface ConverterCreator {
+    /** Creates a Converter that can convert the <code>sourceClass</code> to
+     * the <code>targetClass</code>. Returns <code>null</code> if this creater
+     * doesn't support the class pair.
+     *
+     * @param sourceClass The source <code>Class</code> to convert
+     * @param targetClass The target <code>Class</code> to convert to
+     * @return a converter that can convert <code>Object</code>s
+     */
+    public <S, T> Converter<S, T> createConverter(Class<S> sourceClass, Class<T> targetClass);
+}

Propchange: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/ConverterCreator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/ConverterCreator.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/ConverterCreator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/ConverterLoader.java
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/ConverterLoader.java?rev=922338&view=auto
==============================================================================
--- commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/ConverterLoader.java (added)
+++ commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/ConverterLoader.java Fri Mar 12 16:58:07 2010
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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.commons.convert;
+
+/** Converter loader interface. Applications implement this
+ * interface to load their Java object converters.
+ *
+ */
+public interface ConverterLoader {
+    /** Create and register converters with the Java object type
+     * conversion framework. If the converter extends one of the
+     * converter abstract classes, then the converter will register
+     * itself when an instance is created. Otherwise, call
+     * {@link org.ofbiz.base.conversion.Converters#registerConverter(Converter)}
+     * with the <code>Converter</code> instance.
+     *
+     */
+    public void loadConverters();
+}

Propchange: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/ConverterLoader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/ConverterLoader.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/ConverterLoader.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/Converters.java
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/Converters.java?rev=922338&view=auto
==============================================================================
--- commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/Converters.java (added)
+++ commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/Converters.java Fri Mar 12 16:58:07 2010
@@ -0,0 +1,235 @@
+/*******************************************************************************
+ * 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.commons.convert;
+
+import java.lang.reflect.Modifier;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.imageio.spi.ServiceRegistry;
+
+/** A <code>Converter</code> factory and repository. */
+public class Converters {
+    protected static final String DELIMITER = "->";
+    protected static final ConcurrentHashMap<String, Converter<?, ?>> converterMap = new ConcurrentHashMap<String, Converter<?, ?>>();
+    protected static final Set<ConverterCreator> creators = Collections.synchronizedSet(new HashSet<ConverterCreator>());
+    protected static final Set<String> noConversions = Collections.synchronizedSet(new HashSet<String>());
+
+    static {
+        registerCreator(new PassThruConverterCreator());
+        ClassLoader loader = Thread.currentThread().getContextClassLoader();
+        Iterator<ConverterLoader> converterLoaders = ServiceRegistry.lookupProviders(ConverterLoader.class, loader);
+        while (converterLoaders.hasNext()) {
+            try {
+                ConverterLoader converterLoader = converterLoaders.next();
+                converterLoader.loadConverters();
+            } catch (Exception e) {
+//                Debug.logError(e, module);
+            }
+        }
+    }
+
+    private Converters() {}
+
+    /** Returns an appropriate <code>Converter</code> instance for
+     * <code>sourceClass</code> and <code>targetClass</code>. If no matching
+     * <code>Converter</code> is found, the method throws
+     * <code>ClassNotFoundException</code>.
+     *
+     * <p>This method is intended to be used when the source or
+     * target <code>Object</code> types are unknown at compile time.
+     * If the source and target <code>Object</code> types are known
+     * at compile time, then one of the "ready made" converters should be used.</p>
+     *
+     * @param sourceClass The object class to convert from
+     * @param targetClass The object class to convert to
+     * @return A matching <code>Converter</code> instance
+     * @throws ClassNotFoundException
+     */
+    public static <S, T> Converter<S, T> getConverter(Class<S> sourceClass, Class<T> targetClass) throws ClassNotFoundException {
+        String key = sourceClass.getName().concat(DELIMITER).concat(targetClass.getName());
+//        if (Debug.verboseOn()) {
+//            Debug.logVerbose("Getting converter: " + key, module);
+//        }
+OUTER:
+        do {
+            Converter<?, ?> result = converterMap.get(key);
+            if (result != null) {
+                return Util.cast(result);
+            }
+            if (noConversions.contains(key)) {
+                throw new ClassNotFoundException("No converter found for " + key);
+            }
+            for (Converter<?, ?> value : converterMap.values()) {
+                if (value.canConvert(sourceClass, targetClass)) {
+                    converterMap.putIfAbsent(key, value);
+                    continue OUTER;
+                }
+            }
+            for (ConverterCreator value : creators) {
+                result = createConverter(value, sourceClass, targetClass);
+                if (result != null) {
+                    converterMap.putIfAbsent(key, result);
+                    continue OUTER;
+                }
+            }
+            if (noConversions.add(key)) {
+                /*
+                Debug.logWarning("*** No converter found, converting from " +
+                        sourceClass.getName() + " to " + targetClass.getName() +
+                        ". Please report this message to the developer community so " +
+                        "a suitable converter can be created. ***", module);
+                */
+            }
+            throw new ClassNotFoundException("No converter found for " + key);
+        } while (true);
+    }
+
+    private static <S, SS extends S, T, TT extends T> Converter<SS, TT> createConverter(ConverterCreator creater, Class<SS> sourceClass, Class<TT> targetClass) {
+        return creater.createConverter(sourceClass, targetClass);
+    }
+
+    /** Load all classes that implement <code>Converter</code> and are
+     * contained in <code>containerClass</code>.
+     *
+     * @param containerClass
+     */
+    public static void loadContainedConverters(Class<?> containerClass) {
+        // This only returns -public- classes and interfaces
+        for (Class<?> clz: containerClass.getClasses()) {
+            try {
+                // non-abstract, which means no interfaces or abstract classes
+                if ((clz.getModifiers() & Modifier.ABSTRACT) == 0) {
+                    Object value;
+                    try {
+                        value = clz.getConstructor().newInstance();
+                    } catch (NoSuchMethodException e) {
+                        // ignore this, as this class might be some other helper class,
+                        // with a non-pubilc constructor
+                        continue;
+                    }
+                    if (value instanceof ConverterLoader) {
+                        ConverterLoader loader = (ConverterLoader) value;
+                        loader.loadConverters();
+                    }
+                }
+            } catch (Exception e) {
+//                Debug.logError(e, module);
+            }
+        }
+    }
+
+    /** Registers a <code>ConverterCreater</code> instance to be used by the
+     * {@link org.ofbiz.base.conversion.Converters#getConverter(Class, Class)}
+     * method, when a converter can't be found.
+     *
+     * @param <S> The source object type
+     * @param <T> The target object type
+     * @param creator The <code>ConverterCreater</code> instance to register
+     */
+    public static <S, T> void registerCreator(ConverterCreator creator) {
+        creators.add(creator);
+    }
+
+    /** Registers a <code>Converter</code> instance to be used by the
+     * {@link org.ofbiz.base.conversion.Converters#getConverter(Class, Class)}
+     * method.
+     *
+     * @param <S> The source object type
+     * @param <T> The target object type
+     * @param converter The <code>Converter</code> instance to register
+     */
+    public static <S, T> void registerConverter(Converter<S, T> converter) {
+        registerConverter(converter, converter.getSourceClass(), converter.getTargetClass());
+    }
+
+    public static <S, T> void registerConverter(Converter<S, T> converter, Class<?> sourceClass, Class<?> targetClass) {
+        StringBuilder sb = new StringBuilder();
+        if (sourceClass != null) {
+            sb.append(sourceClass.getName());
+        } else {
+            sb.append("<null>");
+        }
+        sb.append(DELIMITER);
+        if (targetClass != null) {
+            sb.append(targetClass.getName());
+        } else {
+            sb.append("<null>");
+        }
+        String key = sb.toString();
+        if (converterMap.putIfAbsent(key, converter) == null) {
+//            if (Debug.verboseOn()) {
+//                Debug.logVerbose("Registered converter " + converter.getClass().getName(), module);
+//            }
+        }
+    }
+
+    protected static class PassThruConverterCreator implements ConverterCreator{
+        protected PassThruConverterCreator() {
+        }
+
+        public <S, T> Converter<S, T> createConverter(Class<S> sourceClass, Class<T> targetClass) {
+            if (sourceClass == targetClass || targetClass == Object.class || Util.instanceOf(sourceClass, targetClass)) {
+                return new PassThruConverter<S, T>(sourceClass, targetClass);
+            } else {
+                return null;
+            }
+        }
+    }
+
+    /** Pass thru converter used when the source and target java object
+     * types are the same. The <code>convert</code> method returns the
+     * source object.
+     *
+     */
+    protected static class PassThruConverter<S, T> implements Converter<S, T> {
+        private final Class<S> sourceClass;
+        private final Class<T> targetClass;
+
+        public PassThruConverter(Class<S> sourceClass, Class<T> targetClass) {
+            this.sourceClass = sourceClass;
+            this.targetClass = targetClass;
+        }
+
+        public boolean canConvert(Class<?> sourceClass, Class<?> targetClass) {
+            return this.sourceClass == sourceClass && this.targetClass == targetClass;
+        }
+
+        @SuppressWarnings("unchecked")
+        public T convert(S obj) throws ConversionException {
+            return (T) obj;
+        }
+
+        @SuppressWarnings("unchecked")
+        public T convert(Class<? extends T> targetClass, S obj) throws ConversionException {
+            return (T) obj;
+        }
+
+        public Class<?> getSourceClass() {
+            return sourceClass;
+        }
+
+        public Class<?> getTargetClass() {
+            return targetClass;
+        }
+    }
+}

Propchange: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/Converters.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/Converters.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: commons/sandbox/convert/trunk/src/java/org/apache/commons/convert/Converters.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message