You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by js...@apache.org on 2006/05/09 03:08:32 UTC

svn commit: r405255 - in /geronimo/xbean/trunk/xbean-jaxb: ./ .settings/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/xbean/ src/main/java/org/apache/xbean/jaxb/ src/main/java/org/apache/xbean/jaxb...

Author: jstrachan
Date: Mon May  8 18:08:30 2006
New Revision: 405255

URL: http://svn.apache.org/viewcvs?rev=405255&view=rev
Log:
a first spike of a JNDI provider implemented using JAXB2 to deal with the marshalling of POJOs to XML and back again

Added:
    geronimo/xbean/trunk/xbean-jaxb/   (with props)
    geronimo/xbean/trunk/xbean-jaxb/.classpath   (with props)
    geronimo/xbean/trunk/xbean-jaxb/.project   (with props)
    geronimo/xbean/trunk/xbean-jaxb/.settings/
    geronimo/xbean/trunk/xbean-jaxb/.settings/org.eclipse.jdt.core.prefs
    geronimo/xbean/trunk/xbean-jaxb/LICENSE.txt   (with props)
    geronimo/xbean/trunk/xbean-jaxb/NOTICE.txt   (with props)
    geronimo/xbean/trunk/xbean-jaxb/README.txt   (with props)
    geronimo/xbean/trunk/xbean-jaxb/pom.xml   (with props)
    geronimo/xbean/trunk/xbean-jaxb/src/
    geronimo/xbean/trunk/xbean-jaxb/src/main/
    geronimo/xbean/trunk/xbean-jaxb/src/main/java/
    geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/
    geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/
    geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/
    geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/
    geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/ContextEntry.java   (with props)
    geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/ContextImpl.java   (with props)
    geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jaxb.index
    geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jndi/
    geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jndi/DefaultContext.java   (with props)
    geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jndi/JaxbInitialContextFactory.java   (with props)
    geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jndi/NameParserImpl.java   (with props)
    geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/package-info.java   (with props)
    geronimo/xbean/trunk/xbean-jaxb/src/test/
    geronimo/xbean/trunk/xbean-jaxb/src/test/java/
    geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/
    geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/
    geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/
    geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/
    geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/ContextMarshalTest.java   (with props)
    geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/
    geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/Address.java   (with props)
    geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/BusinessCard.java   (with props)
    geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/jaxb.index
    geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/package-info.java   (with props)
    geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/jndi/
    geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/jndi/JndiTest.java   (with props)
    geronimo/xbean/trunk/xbean-jaxb/src/test/resources/
    geronimo/xbean/trunk/xbean-jaxb/src/test/resources/org/
    geronimo/xbean/trunk/xbean-jaxb/src/test/resources/org/apache/
    geronimo/xbean/trunk/xbean-jaxb/src/test/resources/org/apache/xbean/
    geronimo/xbean/trunk/xbean-jaxb/src/test/resources/org/apache/xbean/jaxb/
    geronimo/xbean/trunk/xbean-jaxb/src/test/resources/org/apache/xbean/jaxb/example1.xml   (with props)

Propchange: geronimo/xbean/trunk/xbean-jaxb/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon May  8 18:08:30 2006
@@ -0,0 +1,2 @@
+
+target

Added: geronimo/xbean/trunk/xbean-jaxb/.classpath
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-jaxb/.classpath?rev=405255&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-jaxb/.classpath (added)
+++ geronimo/xbean/trunk/xbean-jaxb/.classpath Mon May  8 18:08:30 2006
@@ -0,0 +1,16 @@
+<classpath>
+  <classpathentry kind="src" path="src/main/java"/>
+  <classpathentry kind="src" path="src/main/resources"/>
+  <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
+  <classpathentry kind="src" path="src/test/resources" output="target/test-classes"/>
+  <classpathentry kind="src" path="target/generated-sources/xjc"/>
+  <classpathentry kind="output" path="target/classes"/>
+  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+  <classpathentry kind="var" path="M2_REPO/jaxb/activation/1.0.2/activation-1.0.2.jar"/>
+  <classpathentry kind="var" path="M2_REPO/jaxb/jsr173_api/1.0/jsr173_api-1.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/springframework/spring/2.0-m4/spring-2.0-m4.jar"/>
+  <classpathentry kind="var" path="M2_REPO/jaxb/jaxb-impl/2.0-SNAPSHOT/jaxb-impl-2.0-SNAPSHOT.jar"/>
+  <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.jar"/>
+  <classpathentry kind="var" path="M2_REPO/jaxb/jaxb-api/2.0-SNAPSHOT/jaxb-api-2.0-SNAPSHOT.jar"/>
+</classpath>
\ No newline at end of file

Propchange: geronimo/xbean/trunk/xbean-jaxb/.classpath
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/xbean/trunk/xbean-jaxb/.project
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-jaxb/.project?rev=405255&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-jaxb/.project (added)
+++ geronimo/xbean/trunk/xbean-jaxb/.project Mon May  8 18:08:30 2006
@@ -0,0 +1,14 @@
+<projectDescription>
+  <name>xbean-jaxb</name>
+  <comment>XBean is a plugin based server architecture.</comment>
+  <projects/>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+      <arguments/>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+  </natures>
+</projectDescription>
\ No newline at end of file

Propchange: geronimo/xbean/trunk/xbean-jaxb/.project
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/xbean/trunk/xbean-jaxb/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-jaxb/.settings/org.eclipse.jdt.core.prefs?rev=405255&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-jaxb/.settings/org.eclipse.jdt.core.prefs (added)
+++ geronimo/xbean/trunk/xbean-jaxb/.settings/org.eclipse.jdt.core.prefs Mon May  8 18:08:30 2006
@@ -0,0 +1,5 @@
+#Mon May 08 11:59:13 PDT 2006
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5

Added: geronimo/xbean/trunk/xbean-jaxb/LICENSE.txt
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-jaxb/LICENSE.txt?rev=405255&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-jaxb/LICENSE.txt (added)
+++ geronimo/xbean/trunk/xbean-jaxb/LICENSE.txt Mon May  8 18:08:30 2006
@@ -0,0 +1,203 @@
+
+                                 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: geronimo/xbean/trunk/xbean-jaxb/LICENSE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/xbean/trunk/xbean-jaxb/NOTICE.txt
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-jaxb/NOTICE.txt?rev=405255&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-jaxb/NOTICE.txt (added)
+++ geronimo/xbean/trunk/xbean-jaxb/NOTICE.txt Mon May  8 18:08:30 2006
@@ -0,0 +1,3 @@
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+

Propchange: geronimo/xbean/trunk/xbean-jaxb/NOTICE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/xbean/trunk/xbean-jaxb/README.txt
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-jaxb/README.txt?rev=405255&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-jaxb/README.txt (added)
+++ geronimo/xbean/trunk/xbean-jaxb/README.txt Mon May  8 18:08:30 2006
@@ -0,0 +1 @@
+This module provides a simple dependency injection container using JAXB2

Propchange: geronimo/xbean/trunk/xbean-jaxb/README.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/xbean/trunk/xbean-jaxb/pom.xml
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-jaxb/pom.xml?rev=405255&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-jaxb/pom.xml (added)
+++ geronimo/xbean/trunk/xbean-jaxb/pom.xml Mon May  8 18:08:30 2006
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright 2005 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.
+-->
+<!-- $Rev: 356052 $ $Date: 2005-12-11 14:41:20 -0800 (dim., 11 déc. 2005) $ -->
+<project>
+
+  <parent>
+    <artifactId>xbean</artifactId>
+    <groupId>org.apache.xbean</groupId>
+    <version>2.3</version>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>xbean-jaxb</artifactId>
+  <name>XBean :: JAXB</name>
+  <version>2.3</version>
+
+  <pluginRepositories>
+    <pluginRepository>
+      <id>java.net</id>
+      <name>java.net Maven Repository</name>
+      <url>https://maven-repository.dev.java.net/nonav/repository</url>
+      <layout>legacy</layout>
+      <snapshots>
+        <enabled>true</enabled>
+      </snapshots>
+    </pluginRepository>
+  </pluginRepositories>
+
+  <repositories>
+    <repository>
+      <id>java.net</id>
+      <name>java.net Maven Repository</name>
+      <url>https://maven-repository.dev.java.net/nonav/repository</url>
+      <layout>legacy</layout>
+    </repository>
+  </repositories>
+
+  <build>
+    <testResources>
+      <testResource>
+        <directory>src/test/resources</directory>
+      </testResource>
+      <testResource>
+        <directory>target/test-generated</directory>
+      </testResource>
+    </testResources>
+
+    <plugins>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <source>1.5</source>
+          <target>1.5</target>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <groupId>com.sun.tools.xjc.maven2</groupId>
+        <artifactId>maven-jaxb-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>generate</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <generatePackage>org.apache.xbean.jaxb.schema</generatePackage>
+          <includeSchemas>
+            <includeSchema>spring-beans.xsd</includeSchema>
+          </includeSchemas>
+          <excludeSchemas>
+            <excludeSchema>test*.xsd</excludeSchema>
+          </excludeSchemas>
+          <includeBindings>
+            <includeBinding>*.xjb</includeBinding>
+          </includeBindings>
+          <strict>true</strict>
+          <verbose>true</verbose>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>jaxb</groupId>
+      <artifactId>jaxb-api</artifactId>
+      <version>2.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>jaxb</groupId>
+      <artifactId>jaxb-impl</artifactId>
+      <version>2.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring</artifactId>
+      <version>2.0-m4</version>
+    </dependency>
+  </dependencies>
+</project>
\ No newline at end of file

Propchange: geronimo/xbean/trunk/xbean-jaxb/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/ContextEntry.java
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/ContextEntry.java?rev=405255&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/ContextEntry.java (added)
+++ geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/ContextEntry.java Mon May  8 18:08:30 2006
@@ -0,0 +1,64 @@
+/**
+ *
+ * Copyright 2005-2006 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.
+ */
+package org.apache.xbean.jaxb;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAnyElement;
+import javax.xml.bind.annotation.XmlAttribute;
+
+/**
+ * Represents an entry in a context
+ * 
+ * @version $Revision: 1.1 $
+ */
+@XmlAccessorType(value=XmlAccessType.FIELD)
+public class ContextEntry {
+    @XmlAttribute
+    private String key;
+    @XmlAnyElement(lax = true)
+    private Object value;
+
+    public ContextEntry() {
+    }
+
+    public ContextEntry(String key, Object value) {
+        this.key = key;
+        this.value = value;
+    }
+
+    public String getKey() {
+        return key;
+    }
+
+    public void setKey(String key) {
+        this.key = key;
+    }
+
+    public Object getValue() {
+        return value;
+    }
+
+    public void setValue(Object value) {
+        this.value = value;
+    }
+
+    @Override
+    public String toString() {
+        return "ContextEntry[key: " + key + " value: " + value + "]";
+    }
+}

Propchange: geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/ContextEntry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/ContextImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/ContextImpl.java?rev=405255&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/ContextImpl.java (added)
+++ geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/ContextImpl.java Mon May  8 18:08:30 2006
@@ -0,0 +1,83 @@
+package org.apache.xbean.jaxb;
+
+import org.apache.xbean.jaxb.jndi.DefaultContext;
+
+import javax.naming.Context;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+@XmlRootElement(name = "context")
+public class ContextImpl {
+    @XmlTransient
+    public Map<String, Object> entries = new HashMap<String, Object>();
+
+    // for JAXB
+    @XmlElement(name = "entry")
+    private ContextEntry[] getEntries() {
+        ContextEntry[] r = new ContextEntry[entries.size()];
+        int i = 0;
+        for (Map.Entry<String, Object> e : entrySet()) {
+            r[i++] = new ContextEntry(e.getKey(), e.getValue());
+        }
+        return r;
+    }
+
+    private void setEntries(ContextEntry[] v) {
+        entries.clear();
+        for (ContextEntry e : v)
+            entries.put(e.getKey(), e.getValue());
+    }
+    
+    @Override
+    public String toString() {
+        return "Context" + entries;
+    }
+
+    public Object get(String name) {
+        return entries.get(name);
+    }
+
+    public void put(String key, Object value) {
+        entrySet();
+        entries.put(key, value);
+    }
+
+    public Set<Entry<String, Object>> entrySet() {
+        return entries.entrySet();
+    }
+
+    // JAXB helper methods
+    // -------------------------------------------------------------------------
+    public void marshal(JAXBContext context, OutputStream os) throws Exception {
+        Marshaller m = context.createMarshaller();
+        m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
+        m.marshal(this, os);
+    }
+
+    public static ContextImpl load(JAXBContext context, InputStream in) throws Exception {
+        return (ContextImpl) context.createUnmarshaller().unmarshal(in);
+    }
+
+    /**
+     * Converts this context into a full JNDI context
+     */
+    public Context createJndiContext(Hashtable environment) {
+        return new DefaultContext(environment, entries);
+    }
+
+    public void putAll(ContextImpl context) {
+        entries.putAll(context.entries);
+    }
+
+}
\ No newline at end of file

Propchange: geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/ContextImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jaxb.index
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jaxb.index?rev=405255&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jaxb.index (added)
+++ geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jaxb.index Mon May  8 18:08:30 2006
@@ -0,0 +1 @@
+ContextImpl
\ No newline at end of file

Added: geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jndi/DefaultContext.java
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jndi/DefaultContext.java?rev=405255&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jndi/DefaultContext.java (added)
+++ geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jndi/DefaultContext.java Mon May  8 18:08:30 2006
@@ -0,0 +1,452 @@
+/**
+ *
+ * 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.
+ */
+package org.apache.xbean.jaxb.jndi;
+
+import javax.naming.Binding;
+import javax.naming.CompositeName;
+import javax.naming.Context;
+import javax.naming.LinkRef;
+import javax.naming.Name;
+import javax.naming.NameClassPair;
+import javax.naming.NameNotFoundException;
+import javax.naming.NameParser;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.NotContextException;
+import javax.naming.OperationNotSupportedException;
+import javax.naming.Reference;
+import javax.naming.spi.NamingManager;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * A simple JNDI context which is mutable
+ *
+ * @version $Revision: 657 $
+ */
+public class DefaultContext implements Context, Serializable {
+
+    private static final long serialVersionUID = -5754338187296859149L;
+    protected static final NameParser nameParser = new NameParserImpl();
+
+    private boolean freeze = false;
+
+    protected final Hashtable environment;        // environment for this context
+    protected final Map bindings;         // bindings at my level
+    protected final Map treeBindings;     // all bindings under me
+
+    private boolean frozen = false;
+    private String nameInNamespace = "";
+    public static final String SEPARATOR = "/";
+
+    public DefaultContext() {
+        environment = new Hashtable();
+        bindings = new HashMap();
+        treeBindings = new HashMap();
+    }
+
+    public DefaultContext(Hashtable env) {
+        if (env == null) {
+            this.environment = new Hashtable();
+        }
+        else {
+            this.environment = new Hashtable(env);
+        }
+        this.bindings = new HashMap();
+        this.treeBindings = new HashMap();
+    }
+
+    public DefaultContext(Hashtable environment, Map bindings) {
+        if (environment == null) {
+            this.environment = new Hashtable();
+        }
+        else {
+            this.environment = new Hashtable(environment);
+        }
+        this.bindings = bindings;
+        treeBindings = new HashMap();
+        frozen = true;
+    }
+
+    public DefaultContext(Hashtable environment, Map bindings, String nameInNamespace) {
+        this(environment, bindings);
+        this.nameInNamespace = nameInNamespace;
+    }
+
+    protected DefaultContext(DefaultContext clone, Hashtable env) {
+        this.bindings = clone.bindings;
+        this.treeBindings = clone.treeBindings;
+        this.environment = new Hashtable(env);
+    }
+
+    protected DefaultContext(DefaultContext clone, Hashtable env, String nameInNamespace) {
+        this(clone, env);
+        this.nameInNamespace = nameInNamespace;
+    }
+
+    public Object addToEnvironment(String propName, Object propVal) throws NamingException {
+        return environment.put(propName, propVal);
+    }
+
+    public Hashtable getEnvironment() throws NamingException {
+        return (Hashtable) environment.clone();
+    }
+
+    public Object removeFromEnvironment(String propName) throws NamingException {
+        return environment.remove(propName);
+    }
+
+    public Object lookup(String name) throws NamingException {
+        if (name.length() == 0) {
+            return this;
+        }
+        Object result = treeBindings.get(name);
+        if (result == null) {
+            result = bindings.get(name);
+        }
+        if (result == null) {
+            int pos = name.indexOf(':');
+            if (pos > 0) {
+                String scheme = name.substring(0, pos);
+                Context ctx = NamingManager.getURLContext(scheme, environment);
+                if (ctx == null) {
+                    throw new NamingException("scheme " + scheme + " not recognized");
+                }
+                return ctx.lookup(name);
+            }
+            else {
+                // Split out the first name of the path
+                // and look for it in the bindings map.
+                CompositeName path = new CompositeName(name);
+
+                if (path.size() == 0) {
+                    return this;
+                }
+                else {
+                    String first = path.get(0);
+                    Object obj = bindings.get(first);
+                    if (obj == null) {
+                        throw new NameNotFoundException(name);
+                    }
+                    else if (obj instanceof Context && path.size() > 1) {
+                        Context subContext = (Context) obj;
+                        obj = subContext.lookup(path.getSuffix(1));
+                    }
+                    return obj;
+                }
+            }
+        }
+        if (result instanceof LinkRef) {
+            LinkRef ref = (LinkRef) result;
+            result = lookup(ref.getLinkName());
+        }
+        if (result instanceof Reference) {
+            try {
+                result = NamingManager.getObjectInstance(result, null, null, this.environment);
+            }
+            catch (NamingException e) {
+                throw e;
+            }
+            catch (Exception e) {
+                throw (NamingException) new NamingException("could not look up : " + name).initCause(e);
+            }
+        }
+        if (result instanceof DefaultContext) {
+            String prefix = getNameInNamespace();
+            if (prefix.length() > 0) {
+                prefix = prefix + SEPARATOR;
+            }
+            result = new DefaultContext((DefaultContext) result, environment, prefix + name);
+        }
+        return result;
+    }
+
+    public Object lookup(Name name) throws NamingException {
+        return lookup(name.toString());
+    }
+
+    public Object lookupLink(String name) throws NamingException {
+        return lookup(name);
+    }
+
+    public Name composeName(Name name, Name prefix) throws NamingException {
+        Name result = (Name) prefix.clone();
+        result.addAll(name);
+        return result;
+    }
+
+    public String composeName(String name, String prefix) throws NamingException {
+        CompositeName result = new CompositeName(prefix);
+        result.addAll(new CompositeName(name));
+        return result.toString();
+    }
+
+    public NamingEnumeration list(String name) throws NamingException {
+        Object o = lookup(name);
+        if (o == this) {
+            return new DefaultContext.ListEnumeration();
+        }
+        else if (o instanceof Context) {
+            return ((Context) o).list("");
+        }
+        else {
+            throw new NotContextException();
+        }
+    }
+
+    public NamingEnumeration listBindings(String name) throws NamingException {
+        Object o = lookup(name);
+        if (o == this) {
+            return new DefaultContext.ListBindingEnumeration();
+        }
+        else if (o instanceof Context) {
+            return ((Context) o).listBindings("");
+        }
+        else {
+            throw new NotContextException();
+        }
+    }
+
+    public Object lookupLink(Name name) throws NamingException {
+        return lookupLink(name.toString());
+    }
+
+    public NamingEnumeration list(Name name) throws NamingException {
+        return list(name.toString());
+    }
+
+    public NamingEnumeration listBindings(Name name) throws NamingException {
+        return listBindings(name.toString());
+    }
+
+    public void bind(Name name, Object value) throws NamingException {
+        bind(name.toString(), value);
+    }
+
+    public void bind(String name, Object value) throws NamingException {
+        checkFrozen();
+        internalBind(name, value);
+    }
+
+    public void close() throws NamingException {
+        // ignore
+    }
+
+    public Context createSubcontext(Name name) throws NamingException {
+        throw new OperationNotSupportedException();
+    }
+
+    public Context createSubcontext(String name) throws NamingException {
+        throw new OperationNotSupportedException();
+    }
+
+    public void destroySubcontext(Name name) throws NamingException {
+        throw new OperationNotSupportedException();
+    }
+
+    public void destroySubcontext(String name) throws NamingException {
+        throw new OperationNotSupportedException();
+    }
+
+    public String getNameInNamespace() throws NamingException {
+        return nameInNamespace;
+    }
+
+    public NameParser getNameParser(Name name) throws NamingException {
+        return nameParser;
+    }
+
+    public NameParser getNameParser(String name) throws NamingException {
+        return nameParser;
+    }
+
+    public void rebind(Name name, Object value) throws NamingException {
+        rebind(name.toString(), value);
+    }
+
+    public void rebind(String name, Object value) throws NamingException {
+        checkFrozen();
+        internalBind(name, value, true);
+    }
+
+    public void rename(Name oldName, Name newName) throws NamingException {
+        checkFrozen();
+        Object value = lookup(oldName);
+        unbind(oldName);
+        bind(newName, value);
+    }
+
+    public void rename(String oldName, String newName) throws NamingException {
+        Object value = lookup(oldName);
+        unbind(oldName);
+        bind(newName, value);
+    }
+
+    public void unbind(Name name) throws NamingException {
+        unbind(name.toString());
+    }
+
+    public void unbind(String name) throws NamingException {
+        checkFrozen();
+        internalBind(name, null, true);
+    }
+
+    private abstract class LocalNamingEnumeration implements NamingEnumeration {
+        private Iterator i = bindings.entrySet().iterator();
+
+        public boolean hasMore() throws NamingException {
+            return i.hasNext();
+        }
+
+        public boolean hasMoreElements() {
+            return i.hasNext();
+        }
+
+        protected Map.Entry getNext() {
+            return (Map.Entry) i.next();
+        }
+
+        public void close() throws NamingException {
+        }
+    }
+
+    private class ListEnumeration extends DefaultContext.LocalNamingEnumeration {
+        public Object next() throws NamingException {
+            return nextElement();
+        }
+
+        public Object nextElement() {
+            Map.Entry entry = getNext();
+            return new NameClassPair((String) entry.getKey(), entry.getValue().getClass().getName());
+        }
+    }
+
+    private class ListBindingEnumeration extends DefaultContext.LocalNamingEnumeration {
+        public Object next() throws NamingException {
+            return nextElement();
+        }
+
+        public Object nextElement() {
+            Map.Entry entry = getNext();
+            return new Binding((String) entry.getKey(), entry.getValue());
+        }
+    }
+
+    public Map getEntries() {
+        return new HashMap(bindings);
+    }
+
+    public void setEntries(Map entries) throws NamingException {
+        if (entries != null) {
+            for (Iterator iter = entries.entrySet().iterator(); iter.hasNext();) {
+                Map.Entry entry = (Map.Entry) iter.next();
+                String name = (String) entry.getKey();
+                Object value = entry.getValue();
+                internalBind(name, value);
+            }
+        }
+    }
+
+    public boolean isFreeze() {
+        return freeze;
+    }
+
+    public void setFreeze(boolean freeze) {
+        this.freeze = freeze;
+    }
+
+    /**
+     * internalBind is intended for use only during setup or possibly by suitably synchronized superclasses.
+     * It binds every possible lookup into a map in each context.  To do this, each context
+     * strips off one name segment and if necessary creates a new context for it. Then it asks that context
+     * to bind the remaining name.  It returns a map containing all the bindings from the next context, plus
+     * the context it just created (if it in fact created it). (the names are suitably extended by the segment
+     * originally lopped off).
+     *
+     * @param name
+     * @param value
+     * @return
+     * @throws javax.naming.NamingException
+     */
+    protected Map internalBind(String name, Object value) throws NamingException {
+        return internalBind(name, value, false);
+        
+    }
+    protected Map internalBind(String name, Object value, boolean allowRebind) throws NamingException {
+        
+        if (name == null || name.length() == 0){
+            throw new NamingException("Invalid Name " + name);
+        }
+        if (frozen){
+            throw new NamingException("Read only");
+        }
+
+        Map newBindings = new HashMap();
+        int pos = name.indexOf('/');
+        if (pos == -1) {
+            Object oldValue = treeBindings.put(name, value);
+            if (!allowRebind && oldValue != null) {
+                throw new NamingException("Something already bound at " + name);
+            }
+            bindings.put(name, value);
+            newBindings.put(name, value);
+        }
+        else {
+            String segment = name.substring(0, pos);
+          
+            if (segment == null || segment.length()==0){
+                throw new NamingException("Invalid segment " + segment);
+            }
+            Object o = treeBindings.get(segment);
+            if (o == null) {
+                o = newContext();
+                treeBindings.put(segment, o);
+                bindings.put(segment, o);
+                newBindings.put(segment, o);
+            }
+            else if (!(o instanceof DefaultContext)) {
+                throw new NamingException("Something already bound where a subcontext should go");
+            }
+            DefaultContext defaultContext = (DefaultContext) o;
+            String remainder = name.substring(pos + 1);
+            Map subBindings = defaultContext.internalBind(remainder, value, allowRebind);
+            for (Iterator iterator = subBindings.entrySet().iterator(); iterator.hasNext();) {
+                Map.Entry entry = (Map.Entry) iterator.next();
+                String subName = segment + "/" + (String) entry.getKey();
+                Object bound = entry.getValue();
+                treeBindings.put(subName, bound);
+                newBindings.put(subName, bound);
+            }
+        }
+        return newBindings;
+    }
+
+    protected void checkFrozen() throws OperationNotSupportedException {
+        if (isFreeze()) {
+            throw new OperationNotSupportedException("JNDI context is frozen!");
+        }
+    }
+
+    protected DefaultContext newContext() {
+        return new DefaultContext();
+    }
+
+}

Propchange: geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jndi/DefaultContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jndi/JaxbInitialContextFactory.java
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jndi/JaxbInitialContextFactory.java?rev=405255&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jndi/JaxbInitialContextFactory.java (added)
+++ geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jndi/JaxbInitialContextFactory.java Mon May  8 18:08:30 2006
@@ -0,0 +1,143 @@
+/**
+ * 
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors,  as applicable.
+ * 
+ * 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. 
+ * 
+ **/
+package org.apache.xbean.jaxb.jndi;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.xbean.jaxb.ContextImpl;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.spi.InitialContextFactory;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Hashtable;
+
+/**
+ * A simple JNDI initial context which loads the JNDI namespace from an XML
+ * configuration file using JAXB2. The configuration file can be specified by
+ * the {@link Context#PROVIDER_URL} property which can be any spring resource
+ * string (classpath://foo.xml, or file://foo/bar.xml or a URL) otherwise the
+ * jndi.xml file is found on the classpath.
+ * 
+ * @version $Revision: 657 $
+ */
+public class JaxbInitialContextFactory implements InitialContextFactory {
+    public static final String JAXB_PACKAGES = "jaxb.packages";
+    public static final String DEFAULT_URL = "jndi.xml";
+
+    private static final transient Log log = LogFactory.getLog(JaxbInitialContextFactory.class);
+
+    private static Context singleton;
+
+    /**
+     * A factory method which can be used to initialise a singleton JNDI context
+     * from inside a Spring.xml such that future calls to new InitialContext()
+     * will reuse it
+     */
+    public static Context makeInitialContext() {
+        singleton = new DefaultContext();
+        return singleton;
+    }
+
+    public Context getInitialContext(Hashtable environment) throws NamingException {
+        if (singleton != null) {
+            return singleton;
+        }
+        Object value = environment.get(Context.PROVIDER_URL);
+        if (value == null) {
+            value = DEFAULT_URL;
+        }
+
+        InputStream in = null;
+        ContextImpl answer = null;
+        try {
+            in = loadResource(value);
+            if (in != null) {
+                answer = ContextImpl.load(createJaxbContext(environment), in);
+            }
+        }
+        catch (Exception e) {
+            log.warn("Caught: " + e, e);
+            throw new NamingException("Failed to parse resource: " + value + ". Reason: " + e);
+        }
+        if (in == null) {
+            throw new NamingException("Could not find resource: " + value);
+        }
+        if (answer == null) {
+            throw new NamingException("No context returned after parsing resource: " + value);
+        }
+        return answer.createJndiContext(environment);
+    }
+
+    /**
+     * Loads the given resource. If the resource is not a URL then it is assumed
+     * to be a classpath relative string
+     */
+    protected InputStream loadResource(Object value) throws IOException, NamingException {
+        URL url = null;
+        if (value instanceof URL) {
+            url = (URL) value;
+        }
+        else if (value instanceof String) {
+            String text = (String) value;
+            if (text.indexOf(":") > 0) {
+                url = new URL(text);
+            }
+            else {
+                return loadResourceFromClassPath(text);
+            }
+        }
+        if (url != null) {
+            if ("classpath".equals(url.getProtocol())) {
+                return loadResourceFromClassPath(url.getPath());
+            }
+            else {
+                return url.openStream();
+            }
+        }
+        return null;
+    }
+
+    protected InputStream loadResourceFromClassPath(String text) throws NamingException {
+        InputStream answer = Thread.currentThread().getContextClassLoader().getResourceAsStream(text);
+        if (answer == null) {
+            answer = getClass().getResourceAsStream(text);
+            if (answer == null) {
+                throw new NamingException("Could not find resourcE: " + text + " on the classpath");
+            }
+        }
+        return answer;
+    }
+
+    /**
+     * Factory method to create the JAXBContext
+     */
+    protected JAXBContext createJaxbContext(Hashtable environment) throws JAXBException {
+        // TODO dirty hack!!!
+        String packages = (String) environment.get(JAXB_PACKAGES);
+        if (packages == null) {
+            packages = "org.apache.xbean.jaxb";
+        }
+        return JAXBContext.newInstance(packages);
+    }
+}

Propchange: geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jndi/JaxbInitialContextFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jndi/NameParserImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jndi/NameParserImpl.java?rev=405255&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jndi/NameParserImpl.java (added)
+++ geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jndi/NameParserImpl.java Mon May  8 18:08:30 2006
@@ -0,0 +1,36 @@
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors,  as applicable.
+ *
+ * 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.
+ *
+ **/
+
+package org.apache.xbean.jaxb.jndi;
+
+import javax.naming.CompositeName;
+import javax.naming.Name;
+import javax.naming.NameParser;
+import javax.naming.NamingException;
+
+/**
+ * A default implementation of {@link NameParser}
+ *
+ * @version $Revision: 1.2 $
+ */
+public class NameParserImpl implements NameParser {
+
+    public Name parse(String name) throws NamingException {
+        return new CompositeName(name);
+    }
+}

Propchange: geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jndi/NameParserImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/package-info.java
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/package-info.java?rev=405255&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/package-info.java (added)
+++ geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/package-info.java Mon May  8 18:08:30 2006
@@ -0,0 +1,4 @@
+@javax.xml.bind.annotation.XmlSchema(namespace="andi",elementFormDefault=javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+
+package org.apache.xbean.jaxb;
+

Propchange: geronimo/xbean/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/ContextMarshalTest.java
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/ContextMarshalTest.java?rev=405255&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/ContextMarshalTest.java (added)
+++ geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/ContextMarshalTest.java Mon May  8 18:08:30 2006
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2005-2006 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.
+ */
+package org.apache.xbean.jaxb;
+
+import org.apache.xbean.jaxb.example.Address;
+import org.apache.xbean.jaxb.example.BusinessCard;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import java.io.File;
+import java.io.FileOutputStream;
+
+import junit.framework.TestCase;
+
+/**
+ * 
+ * @version $Revision: $
+ */
+public class ContextMarshalTest extends TestCase {
+
+    protected JAXBContext context;
+
+    public void testMarshalThenUnmarshal() throws Exception {
+        File dir = new File("target/jaxb-xml");
+        dir.mkdirs();
+        File file = new File(dir, "xbean.xml");
+
+        Marshaller m = context.createMarshaller();
+        m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
+        ContextImpl oldValue = getBeans();
+        System.out.println("OldValue: " + oldValue);
+
+        m.marshal(oldValue, new FileOutputStream(file));
+        unmarshallContext(file);
+    }
+
+    public void testUnmarshalExample1() throws Exception {
+        unmarshallContext(new File("src/test/resources/org/apache/xbean/jaxb/example1.xml"));
+    }
+    
+    protected void unmarshallContext(File file) throws JAXBException {
+        Unmarshaller um = context.createUnmarshaller();
+        // um.setSchema(getSchema("schema1.xsd"));
+        ContextImpl newValue = (ContextImpl) um.unmarshal(file);
+        System.out.println("new Value: " + newValue);
+
+        Object foo = newValue.get("foo");
+        System.out.println("Foo: " + foo);
+        assertNotNull("entry for foo should not be null!", foo);
+        System.out.println("Foo is of type: " + foo.getClass());
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+         context = JAXBContext.newInstance("org.apache.xbean.jaxb:org.apache.xbean.jaxb.example");
+    }
+
+    protected ContextImpl getBeans() {
+        ContextImpl beans = new ContextImpl();
+        beans.put("foo", new BusinessCard("John Doe", "Sr. Widget Designer", "Acme, Inc.", new Address(null,
+                "123 Widget Way", "Anytown", "MA", (short) 12345), "123.456.7890", null, "123.456.7891",
+                "John.Doe@Acme.ORG"));
+        return beans;
+    }
+}

Propchange: geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/ContextMarshalTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/Address.java
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/Address.java?rev=405255&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/Address.java (added)
+++ geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/Address.java Mon May  8 18:08:30 2006
@@ -0,0 +1,90 @@
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the "License").  You may not use this file except
+ * in compliance with the License.
+ * 
+ * You can obtain a copy of the license at
+ * https://jwsdp.dev.java.net/CDDLv1.0.html
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ * 
+ * When distributing Covered Code, include this CDDL
+ * HEADER in each file and include the License file at
+ * https://jwsdp.dev.java.net/CDDLv1.0.html  If applicable,
+ * add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your
+ * own identifying information: Portions Copyright [yyyy]
+ * [name of copyright owner]
+ */
+
+package org.apache.xbean.jaxb.example;
+
+import javax.xml.bind.annotation.*;
+
+@XmlType
+public class Address {
+
+    private String name;
+    private String street;
+    private String city;
+    private String state;
+    private short zip;
+
+    public Address() {}
+
+    public Address(String name, String street, String city, String state, short zip) {
+        this.name = name;
+        this.street = street;
+        this.city = city;
+        this.state = state;
+        this.zip = zip;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getStreet() {
+        return street;
+    }
+
+    public void setStreet(String street) {
+        this.street = street;
+    }
+
+    public String getCity() {
+        return city;
+    }
+
+    public void setCity(String city) {
+        this.city = city;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    public short getZip() {
+        return zip;
+    }
+
+    public void setZip(short zip) {
+        this.zip = zip;
+    }
+
+    public String toString() {
+        StringBuilder s = new StringBuilder();
+        if(name!=null) s.append(name).append('\n');
+        s.append(street).append('\n').append(city).append(", ").append(state).append(" ").append(zip);
+        return s.toString();
+    }
+}

Propchange: geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/Address.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/BusinessCard.java
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/BusinessCard.java?rev=405255&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/BusinessCard.java (added)
+++ geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/BusinessCard.java Mon May  8 18:08:30 2006
@@ -0,0 +1,127 @@
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the "License").  You may not use this file except
+ * in compliance with the License.
+ * 
+ * You can obtain a copy of the license at
+ * https://jwsdp.dev.java.net/CDDLv1.0.html
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ * 
+ * When distributing Covered Code, include this CDDL
+ * HEADER in each file and include the License file at
+ * https://jwsdp.dev.java.net/CDDLv1.0.html  If applicable,
+ * add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your
+ * own identifying information: Portions Copyright [yyyy]
+ * [name of copyright owner]
+ */
+ 
+package org.apache.xbean.jaxb.example;
+
+import javax.xml.bind.annotation.*;
+
+@XmlRootElement
+public class BusinessCard {
+
+    private String name;
+    private String title;
+    private String company;
+    private Address address;
+    private String phone;
+    private String cellPhone;
+    private String fax;
+    private String email;
+
+    public BusinessCard() {}
+
+    public BusinessCard(String name, String title, String company, Address address,
+                        String phone, String cellPhone, String fax, String email) {
+        this.name = name;
+        this.title = title;
+        this.company = company;
+        this.address = address;
+        this.phone = phone;
+        this.cellPhone = cellPhone;
+        this.fax = fax;
+        this.email = email;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getCompany() {
+        return company;
+    }
+
+    public void setCompany(String company) {
+        this.company = company;
+    }
+
+    public Address getAddress() {
+        return address;
+    }
+
+    public void setAddress(Address address) {
+        this.address = address;
+    }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public String getFax() {
+        return fax;
+    }
+
+    public void setFax(String fax) {
+        this.fax = fax;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    public String getCellPhone() {
+        return cellPhone;
+    }
+
+    public void setCellPhone(String cellPhone) {
+        this.cellPhone = cellPhone;
+    }
+
+    public String toString() {
+        StringBuilder s = new StringBuilder("BusinessCard: ");
+        if(name!=null) s.append(name).append('\n');
+        if(title!=null) s.append(title).append('\n');
+        if(company!=null) s.append(company).append('\n');
+        if(address!=null) s.append(address.toString()).append('\n');
+        if(phone!=null) s.append("phone: ").append(phone).append('\n');
+        if(cellPhone!=null) s.append("cell:  ").append(cellPhone).append('\n');
+        if(fax!=null) s.append("fax:  ").append(fax).append('\n');
+        if(email!=null) s.append(email).append('\n');
+        return s.toString();
+    }
+}

Propchange: geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/BusinessCard.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/jaxb.index
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/jaxb.index?rev=405255&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/jaxb.index (added)
+++ geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/jaxb.index Mon May  8 18:08:30 2006
@@ -0,0 +1,2 @@
+BusinessCard
+Address

Added: geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/package-info.java
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/package-info.java?rev=405255&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/package-info.java (added)
+++ geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/package-info.java Mon May  8 18:08:30 2006
@@ -0,0 +1,3 @@
+package org.apache.xbean.jaxb.example;
+
+import javax.xml.bind.annotation.XmlAccessorType; 

Propchange: geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/jndi/JndiTest.java
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/jndi/JndiTest.java?rev=405255&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/jndi/JndiTest.java (added)
+++ geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/jndi/JndiTest.java Mon May  8 18:08:30 2006
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2005-2006 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.
+ */
+
+package org.apache.xbean.jaxb.jndi;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import java.util.Hashtable;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ * @version $Revision: $
+ */
+public class JndiTest extends TestCase {
+
+    protected Context context;
+    
+    public void testContextFromJAXB() throws Exception {
+        Object foo = context.lookup("foo");
+        System.out.println("Foo: " + foo);
+        assertNotNull("entry for foo should not be null!", foo);
+        System.out.println("Foo is of type: " + foo.getClass());
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        Hashtable environment = createEnvironment();
+        context = new InitialContext(environment );
+        
+        assertNotNull("Should have created a context!", context);
+    }
+
+    protected Hashtable createEnvironment() {
+        Hashtable answer = new Hashtable();
+        answer.put(Context.PROVIDER_URL, "file:src/test/resources/org/apache/xbean/jaxb/example1.xml");
+        answer.put(Context.INITIAL_CONTEXT_FACTORY, JaxbInitialContextFactory.class.getName());
+        answer.put(JaxbInitialContextFactory.JAXB_PACKAGES, "org.apache.xbean.jaxb:org.apache.xbean.jaxb.example");
+        return answer ;
+    }
+}

Propchange: geronimo/xbean/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/jndi/JndiTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/xbean/trunk/xbean-jaxb/src/test/resources/org/apache/xbean/jaxb/example1.xml
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-jaxb/src/test/resources/org/apache/xbean/jaxb/example1.xml?rev=405255&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-jaxb/src/test/resources/org/apache/xbean/jaxb/example1.xml (added)
+++ geronimo/xbean/trunk/xbean-jaxb/src/test/resources/org/apache/xbean/jaxb/example1.xml Mon May  8 18:08:30 2006
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<x:context xmlns:x="andi">
+    <x:entry key="foo">
+        <businessCard>
+            <address>
+                <city>Anytown</city>
+                <state>MA</state>
+                <street>123 Widget Way</street>
+                <zip>12345</zip>
+            </address>
+            <company>Acme, Inc.</company>
+            <email>John.Doe@Acme.ORG</email>
+            <fax>123.456.7891</fax>
+            <name>John Doe</name>
+            <phone>123.456.7890</phone>
+            <title>Sr. Widget Designer</title>
+        </businessCard>
+    </x:entry>
+</x:context>

Propchange: geronimo/xbean/trunk/xbean-jaxb/src/test/resources/org/apache/xbean/jaxb/example1.xml
------------------------------------------------------------------------------
    svn:eol-style = native