You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by gn...@apache.org on 2006/08/30 16:14:55 UTC
svn commit: r438491 [1/2] - in /geronimo/xbean/trunk: ./
xbean-spring-itests/ xbean-spring-itests/2.0-rc3/
xbean-spring-itests/2.0-rc3/src/ xbean-spring-itests/2.0-rc3/src/main/
xbean-spring-itests/2.0-rc3/src/main/resources/ xbean-spring-itests/2.0-rc...
Author: gnodet
Date: Wed Aug 30 07:14:53 2006
New Revision: 438491
URL: http://svn.apache.org/viewvc?rev=438491&view=rev
Log:
XBEAN-49: Incompatibility with spring 2.0 rc3
Added:
geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/ (with props)
geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/LICENSE.txt
geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/NOTICE.txt
geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/pom.xml
geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/src/
geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/src/main/
geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/src/main/resources/
geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/src/main/resources/META-INF/
geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/src/main/resources/META-INF/LICENSE
geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/src/main/resources/META-INF/NOTICE
geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/src/test/
geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/src/test/java/
geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/src/test/java/org/
geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/src/test/java/org/apache/
geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/src/test/java/org/apache/xbean/
geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/src/test/java/org/apache/xbean/spring/
geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/src/test/java/org/apache/xbean/spring/context/
geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/src/test/java/org/apache/xbean/spring/context/Spring20RC3Test.java
geronimo/xbean/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanV2Helper.java
geronimo/xbean/trunk/xbean-spring-v2a/
- copied from r438432, geronimo/xbean/trunk/xbean-spring-v2/
geronimo/xbean/trunk/xbean-spring-v2a/src/main/java/org/apache/xbean/spring/context/v2a/
geronimo/xbean/trunk/xbean-spring-v2a/src/main/java/org/apache/xbean/spring/context/v2a/XBeanBeanDefinitionParserDelegate.java
geronimo/xbean/trunk/xbean-spring-v2a/src/main/java/org/apache/xbean/spring/context/v2a/XBeanNamespaceHandler.java
geronimo/xbean/trunk/xbean-spring-v2b/src/main/java/org/apache/xbean/spring/context/v2b/
- copied from r438432, geronimo/xbean/trunk/xbean-spring-v2b/src/main/java/org/apache/xbean/spring/context/v2/
Removed:
geronimo/xbean/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanBeanDefinitionParserDelegate.java
geronimo/xbean/trunk/xbean-spring-v2/src/test/
geronimo/xbean/trunk/xbean-spring-v2a/src/main/java/org/apache/xbean/spring/context/v2/
geronimo/xbean/trunk/xbean-spring-v2b/src/main/java/org/apache/xbean/spring/context/v2/
geronimo/xbean/trunk/xbean-spring-v2b/src/main/java/org/apache/xbean/spring/context/v2b/XBeanBeanDefinitionDocumentReader.java
geronimo/xbean/trunk/xbean-spring-v2b/src/main/java/org/apache/xbean/spring/context/v2b/XBeanBeanDefinitionParserDelegate.java
geronimo/xbean/trunk/xbean-spring-v2b/src/main/java/org/apache/xbean/spring/context/v2b/XBeanNamespaceHandlerResolver.java
geronimo/xbean/trunk/xbean-spring-v2b/src/main/java/org/apache/xbean/spring/context/v2b/XBeanQNameHelper.java
geronimo/xbean/trunk/xbean-spring-v2b/src/main/java/org/apache/xbean/spring/context/v2b/XBeanXmlBeanDefinitionReader.java
geronimo/xbean/trunk/xbean-spring-v2b/src/main/java/org/apache/xbean/spring/context/v2b/XBeanXmlBeanFactory.java
Modified:
geronimo/xbean/trunk/pom.xml
geronimo/xbean/trunk/xbean-spring-itests/pom.xml
geronimo/xbean/trunk/xbean-spring-v2/pom.xml
geronimo/xbean/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanBeanDefinitionDocumentReader.java
geronimo/xbean/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanNamespaceHandler.java
geronimo/xbean/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanNamespaceHandlerResolver.java
geronimo/xbean/trunk/xbean-spring-v2a/pom.xml
geronimo/xbean/trunk/xbean-spring-v2b/pom.xml
geronimo/xbean/trunk/xbean-spring-v2b/src/main/java/org/apache/xbean/spring/context/v2b/XBeanNamespaceHandler.java
geronimo/xbean/trunk/xbean-spring/pom.xml
Modified: geronimo/xbean/trunk/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/pom.xml?rev=438491&r1=438490&r2=438491&view=diff
==============================================================================
--- geronimo/xbean/trunk/pom.xml (original)
+++ geronimo/xbean/trunk/pom.xml Wed Aug 30 07:14:53 2006
@@ -260,6 +260,8 @@
<module>xbean-spring-common</module>
<module>xbean-spring-v1</module>
<module>xbean-spring-v2</module>
+ <module>xbean-spring-v2a</module>
+ <module>xbean-spring-v2b</module>
<module>xbean-spring</module>
<module>xbean-spring-itests</module>
<module>xbean-telnet</module>
Propchange: geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Aug 30 07:14:53 2006
@@ -0,0 +1,4 @@
+.classpath
+.project
+.settings
+target
Added: geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/LICENSE.txt
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/LICENSE.txt?rev=438491&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/LICENSE.txt (added)
+++ geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/LICENSE.txt Wed Aug 30 07:14:53 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.
+
Added: geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/NOTICE.txt
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/NOTICE.txt?rev=438491&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/NOTICE.txt (added)
+++ geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/NOTICE.txt Wed Aug 30 07:14:53 2006
@@ -0,0 +1,3 @@
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
Added: geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/pom.xml?rev=438491&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/pom.xml (added)
+++ geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/pom.xml Wed Aug 30 07:14:53 2006
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+
+<!-- $Rev: 437612 $ $Date: 2006-08-28 10:57:37 +0200 (lun., 28 août 2006) $ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>xbean-spring-itests</artifactId>
+ <groupId>org.apache.xbean</groupId>
+ <version>2.6-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>xbean-spring-itests-20rc3</artifactId>
+ <name>XBean :: Spring :: ITests :: 20rc3</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring</artifactId>
+ <version>2.0-rc3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.xbean</groupId>
+ <artifactId>xbean-spring-itests-core</artifactId>
+ </dependency>
+
+ </dependencies>
+
+</project>
Added: geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/src/main/resources/META-INF/LICENSE
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/src/main/resources/META-INF/LICENSE?rev=438491&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/src/main/resources/META-INF/LICENSE (added)
+++ geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/src/main/resources/META-INF/LICENSE Wed Aug 30 07:14:53 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.
+
Added: geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/src/main/resources/META-INF/NOTICE
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/src/main/resources/META-INF/NOTICE?rev=438491&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/src/main/resources/META-INF/NOTICE (added)
+++ geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/src/main/resources/META-INF/NOTICE Wed Aug 30 07:14:53 2006
@@ -0,0 +1,3 @@
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
Added: geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/src/test/java/org/apache/xbean/spring/context/Spring20RC3Test.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/src/test/java/org/apache/xbean/spring/context/Spring20RC3Test.java?rev=438491&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/src/test/java/org/apache/xbean/spring/context/Spring20RC3Test.java (added)
+++ geronimo/xbean/trunk/xbean-spring-itests/2.0-rc3/src/test/java/org/apache/xbean/spring/context/Spring20RC3Test.java Wed Aug 30 07:14:53 2006
@@ -0,0 +1,21 @@
+/**
+ * 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.xbean.spring.context;
+
+public class Spring20RC3Test extends RestaurantUsingXBeanTest {
+
+}
Modified: geronimo/xbean/trunk/xbean-spring-itests/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-itests/pom.xml?rev=438491&r1=438490&r2=438491&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-itests/pom.xml (original)
+++ geronimo/xbean/trunk/xbean-spring-itests/pom.xml Wed Aug 30 07:14:53 2006
@@ -176,6 +176,7 @@
<module>2.0-m5</module>
<module>2.0-rc1</module>
<module>2.0-rc2</module>
+ <module>2.0-rc3</module>
</modules>
<profiles>
Modified: geronimo/xbean/trunk/xbean-spring-v2/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2/pom.xml?rev=438491&r1=438490&r2=438491&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2/pom.xml (original)
+++ geronimo/xbean/trunk/xbean-spring-v2/pom.xml Wed Aug 30 07:14:53 2006
@@ -85,44 +85,4 @@
</dependencies>
- <build>
- <testResources>
- <testResource>
- <directory>src/test/resources</directory>
- </testResource>
- <testResource>
- <directory>target/test-generated</directory>
- </testResource>
- </testResources>
-
- <plugins>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <phase>process-classes</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <taskdef classname="org.apache.xbean.spring.generator.MappingGeneratorTask" name="mapping">
- <classpath>
- <pathelement path="${basedir}/target/classes"></pathelement>
- <pathelement path="${basedir}/target/test-classes"></pathelement>
- <path refid="maven.runtime.classpath"></path>
- </classpath>
- </taskdef>
- <mapping namespace="http://xbean.apache.org/schemas/pizza" srcdir="src/test/java" destFile="target/restaurant.xsd" metaInfDir="${basedir}/target/test-generated/"></mapping>
- <copy todir="${basedir}/target/test-classes">
- <fileset dir="${basedir}/target/test-generated"></fileset>
- </copy>
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
</project>
Modified: geronimo/xbean/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanBeanDefinitionDocumentReader.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanBeanDefinitionDocumentReader.java?rev=438491&r1=438490&r2=438491&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanBeanDefinitionDocumentReader.java (original)
+++ geronimo/xbean/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanBeanDefinitionDocumentReader.java Wed Aug 30 07:14:53 2006
@@ -25,7 +25,7 @@
public class XBeanBeanDefinitionDocumentReader extends DefaultBeanDefinitionDocumentReader {
protected BeanDefinitionParserDelegate createHelper(XmlReaderContext readerContext, Element root) {
- BeanDefinitionParserDelegate delegate = new XBeanBeanDefinitionParserDelegate(readerContext);
+ BeanDefinitionParserDelegate delegate = XBeanV2Helper.createParser(readerContext);
delegate.initDefaults(root);
return delegate;
}
Modified: geronimo/xbean/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanNamespaceHandler.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanNamespaceHandler.java?rev=438491&r1=438490&r2=438491&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanNamespaceHandler.java (original)
+++ geronimo/xbean/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanNamespaceHandler.java Wed Aug 30 07:14:53 2006
@@ -16,54 +16,12 @@
*/
package org.apache.xbean.spring.context.v2;
-import java.beans.BeanInfo;
-import java.beans.PropertyDescriptor;
-import java.beans.PropertyEditor;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.xbean.spring.context.impl.MappingMetaData;
-import org.apache.xbean.spring.context.impl.NamedConstructorArgs;
-import org.apache.xbean.spring.context.impl.NamespaceHelper;
-import org.apache.xbean.spring.context.impl.PropertyEditorHelper;
-import org.springframework.beans.PropertyValue;
-import org.springframework.beans.factory.BeanDefinitionStoreException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanDefinitionHolder;
-import org.springframework.beans.factory.config.RuntimeBeanReference;
-import org.springframework.beans.factory.support.AbstractBeanDefinition;
-import org.springframework.beans.factory.support.BeanComponentDefinition;
-import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
-import org.springframework.beans.factory.support.DefaultListableBeanFactory;
-import org.springframework.beans.factory.support.ManagedList;
-import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
-import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
-import org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader;
import org.springframework.beans.factory.xml.NamespaceHandler;
import org.springframework.beans.factory.xml.ParserContext;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.context.support.AbstractApplicationContext;
-import org.w3c.dom.Attr;
import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
/**
* An enhanced XML parser capable of handling custom XML schemas.
@@ -77,785 +35,22 @@
public static final String SPRING_SCHEMA = "http://xbean.apache.org/schemas/spring/1.0";
public static final String SPRING_SCHEMA_COMPAT = "http://xbean.org/schemas/spring/1.0";
- static {
- PropertyEditorHelper.registerCustomEditors();
- }
-
- private static final Log log = LogFactory.getLog(XBeanNamespaceHandler.class);
-
- private static final String QNAME_ELEMENT = "qname";
+ private final NamespaceHandler delegate;
- private static final String DESCRIPTION_ELEMENT = "description";
-
- /**
- * All the reserved Spring XML element names which cannot be overloaded by
- * an XML extension
- */
- protected static final String[] RESERVED_ELEMENT_NAMES = {
- "beans",
- DESCRIPTION_ELEMENT,
- DefaultBeanDefinitionDocumentReader.IMPORT_ELEMENT,
- DefaultBeanDefinitionDocumentReader.ALIAS_ELEMENT,
- DefaultBeanDefinitionDocumentReader.BEAN_ELEMENT,
- BeanDefinitionParserDelegate.CONSTRUCTOR_ARG_ELEMENT,
- BeanDefinitionParserDelegate.PROPERTY_ELEMENT,
- BeanDefinitionParserDelegate.LOOKUP_METHOD_ELEMENT,
- BeanDefinitionParserDelegate.REPLACED_METHOD_ELEMENT,
- BeanDefinitionParserDelegate.ARG_TYPE_ELEMENT,
- BeanDefinitionParserDelegate.REF_ELEMENT,
- BeanDefinitionParserDelegate.IDREF_ELEMENT,
- BeanDefinitionParserDelegate.VALUE_ELEMENT,
- BeanDefinitionParserDelegate.NULL_ELEMENT,
- BeanDefinitionParserDelegate.LIST_ELEMENT,
- BeanDefinitionParserDelegate.SET_ELEMENT,
- BeanDefinitionParserDelegate.MAP_ELEMENT,
- BeanDefinitionParserDelegate.ENTRY_ELEMENT,
- BeanDefinitionParserDelegate.KEY_ELEMENT,
- BeanDefinitionParserDelegate.PROPS_ELEMENT,
- BeanDefinitionParserDelegate.PROP_ELEMENT,
- QNAME_ELEMENT };
-
- protected static final String[] RESERVED_BEAN_ATTRIBUTE_NAMES = {
- AbstractBeanDefinitionParser.ID_ATTRIBUTE,
- BeanDefinitionParserDelegate.NAME_ATTRIBUTE,
- BeanDefinitionParserDelegate.CLASS_ATTRIBUTE,
- BeanDefinitionParserDelegate.PARENT_ATTRIBUTE,
- BeanDefinitionParserDelegate.DEPENDS_ON_ATTRIBUTE,
- BeanDefinitionParserDelegate.FACTORY_METHOD_ATTRIBUTE,
- BeanDefinitionParserDelegate.FACTORY_BEAN_ATTRIBUTE,
- BeanDefinitionParserDelegate.DEPENDENCY_CHECK_ATTRIBUTE,
- BeanDefinitionParserDelegate.AUTOWIRE_ATTRIBUTE,
- BeanDefinitionParserDelegate.INIT_METHOD_ATTRIBUTE,
- BeanDefinitionParserDelegate.DESTROY_METHOD_ATTRIBUTE,
- BeanDefinitionParserDelegate.ABSTRACT_ATTRIBUTE,
- BeanDefinitionParserDelegate.SINGLETON_ATTRIBUTE,
- BeanDefinitionParserDelegate.LAZY_INIT_ATTRIBUTE };
-
- private static final String JAVA_PACKAGE_PREFIX = "java://";
-
- private static final String BEAN_REFERENCE_PREFIX = "#";
- private static final String NULL_REFERENCE = "#null";
-
- private Set reservedElementNames = new HashSet(Arrays.asList(RESERVED_ELEMENT_NAMES));
- private Set reservedBeanAttributeNames = new HashSet(Arrays.asList(RESERVED_BEAN_ATTRIBUTE_NAMES));
- protected final NamedConstructorArgs namedConstructorArgs = new NamedConstructorArgs();
-
- private ParserContext parserContext;
+ public XBeanNamespaceHandler() {
+ delegate = XBeanV2Helper.createNamespaceHandler();
+ }
- private XBeanQNameHelper qnameHelper;
-
public void init() {
+ delegate.init();
}
public BeanDefinition parse(Element element, ParserContext parserContext) {
- this.parserContext = parserContext;
- this.qnameHelper = new XBeanQNameHelper(parserContext.getReaderContext());
- BeanDefinitionHolder holder = parseBeanFromExtensionElement(element);
- BeanDefinitionReaderUtils.registerBeanDefinition(holder, parserContext.getRegistry());
- BeanComponentDefinition componentDefinition = new BeanComponentDefinition(holder);
- parserContext.getReaderContext().fireComponentRegistered(componentDefinition);
- return holder.getBeanDefinition();
- }
-
- public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext) {
- throw new IllegalArgumentException("Cannot locate BeanDefinitionDecorator for "
- + (node instanceof Element ? "element" : "attribute") + " [" +
- node.getLocalName() + "].");
- }
-
- /**
- * Configures the XmlBeanDefinitionReader to work nicely with extensible XML
- * using this reader implementation.
- */
- public static void configure(AbstractApplicationContext context, XmlBeanDefinitionReader reader) {
- reader.setNamespaceAware(true);
- reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD);
+ return delegate.parse(element, parserContext);
}
- /**
- * Registers whatever custom editors we need
- */
- public static void registerCustomEditors(DefaultListableBeanFactory beanFactory) {
- PropertyEditorHelper.registerCustomEditors();
+ public BeanDefinitionHolder decorate(Node element, BeanDefinitionHolder definition, ParserContext parserContext) {
+ return delegate.decorate(element, definition, parserContext);
}
-
- /**
- * Parses the non-standard XML element as a Spring bean definition
- */
- protected BeanDefinitionHolder parseBeanFromExtensionElement(Element element, String parentClass, String property) {
- String uri = element.getNamespaceURI();
- String localName = getLocalName(element);
-
- MappingMetaData metadata = findNamespaceProperties(uri, localName);
- if (metadata != null) {
- // lets see if we configured the localName to a bean class
- String className = getPropertyDescriptor(parentClass, property).getPropertyType().getName();
- if (className != null) {
- return parseBeanFromExtensionElement(element, metadata, className);
- }
- }
- return null;
- }
-
- private BeanDefinitionHolder parseBeanFromExtensionElement(Element element, MappingMetaData metadata, String className) {
- Element original = cloneElement(element);
- // lets assume the class name == the package name plus the
- element.setAttributeNS(null, "class", className);
- addSpringAttributeValues(className, element);
- BeanDefinitionHolder definition = parserContext.getDelegate().parseBeanDefinitionElement(element, false);
- addAttributeProperties(definition, metadata, className, original);
- addContentProperty(definition, metadata, element);
- addNestedPropertyElements(definition, metadata, className, element);
- qnameHelper.coerceNamespaceAwarePropertyValues(definition.getBeanDefinition(), element);
- declareLifecycleMethods(definition, metadata, element);
- resolveBeanClass((AbstractBeanDefinition) definition.getBeanDefinition(), definition.getBeanName());
- namedConstructorArgs.processParameters(definition, metadata);
- return definition;
- }
-
- protected Class resolveBeanClass(AbstractBeanDefinition bd, String beanName) {
- if (bd.hasBeanClass()) {
- return bd.getBeanClass();
- }
- try {
- ClassLoader cl = parserContext.getReaderContext().getReader().getBeanClassLoader();
- if (cl == null) {
- cl = Thread.currentThread().getContextClassLoader();
- }
- if (cl == null) {
- cl = getClass().getClassLoader();
- }
- return bd.resolveBeanClass(cl);
- }
- catch (ClassNotFoundException ex) {
- throw new BeanDefinitionStoreException(bd.getResourceDescription(),
- beanName, "Bean class [" + bd.getBeanClassName() + "] not found", ex);
- }
- catch (NoClassDefFoundError err) {
- throw new BeanDefinitionStoreException(bd.getResourceDescription(),
- beanName, "Class that bean class [" + bd.getBeanClassName() + "] depends on not found", err);
- }
- }
-
- /**
- * Parses the non-standard XML element as a Spring bean definition
- */
- protected BeanDefinitionHolder parseBeanFromExtensionElement(Element element) {
- String uri = element.getNamespaceURI();
- String localName = getLocalName(element);
-
- MappingMetaData metadata = findNamespaceProperties(uri, localName);
- if (metadata != null) {
- // lets see if we configured the localName to a bean class
- String className = metadata.getClassName(localName);
- if (className != null) {
- return parseBeanFromExtensionElement(element, metadata, className);
- } else {
- throw new BeanDefinitionStoreException("Unrecognized xbean element mapping: " + localName + " in namespace " + uri);
- }
- } else {
- if (uri == null) throw new BeanDefinitionStoreException("Unrecognized Spring element: " + localName);
- else throw new BeanDefinitionStoreException("Unrecognized xbean namespace mapping: " + uri);
- }
- }
-
- protected void addSpringAttributeValues(String className, Element element) {
- NamedNodeMap attributes = element.getAttributes();
- for (int i = 0, size = attributes.getLength(); i < size; i++) {
- Attr attribute = (Attr) attributes.item(i);
- String uri = attribute.getNamespaceURI();
- String localName = attribute.getLocalName();
-
- if (uri != null && (uri.equals(SPRING_SCHEMA) || uri.equals(SPRING_SCHEMA_COMPAT))) {
- element.setAttributeNS(null, localName, attribute.getNodeValue());
- }
- }
- }
-
- /**
- * Creates a clone of the element and its attribute (though not its content)
- */
- protected Element cloneElement(Element element) {
- Element answer = element.getOwnerDocument().createElementNS(element.getNamespaceURI(), element.getNodeName());
- NamedNodeMap attributes = element.getAttributes();
- for (int i = 0, size = attributes.getLength(); i < size; i++) {
- Attr attribute = (Attr) attributes.item(i);
- String uri = attribute.getNamespaceURI();
- answer.setAttributeNS(uri, attribute.getName(), attribute.getNodeValue());
- }
- return answer;
- }
-
- /**
- * Parses attribute names and values as being bean property expressions
- */
- protected void addAttributeProperties(BeanDefinitionHolder definition, MappingMetaData metadata, String className,
- Element element) {
- NamedNodeMap attributes = element.getAttributes();
- // First pass on attributes with no namespaces
- for (int i = 0, size = attributes.getLength(); i < size; i++) {
- Attr attribute = (Attr) attributes.item(i);
- String uri = attribute.getNamespaceURI();
- String localName = attribute.getLocalName();
- // Skip namespaces
- if (localName == null || localName.equals("xmlns") || localName.startsWith("xmlns:")) {
- continue;
- }
- // Add attributes with no namespaces
- if (isEmpty(uri) && !localName.equals("class")) {
- boolean addProperty = true;
- if (reservedBeanAttributeNames.contains(localName)) {
- // should we allow the property to shine through?
- PropertyDescriptor descriptor = getPropertyDescriptor(className, localName);
- addProperty = descriptor != null;
- }
- if (addProperty) {
- addAttributeProperty(definition, metadata, element, attribute);
- }
- }
- }
- // Second pass on attributes with namespaces
- for (int i = 0, size = attributes.getLength(); i < size; i++) {
- Attr attribute = (Attr) attributes.item(i);
- String uri = attribute.getNamespaceURI();
- String localName = attribute.getLocalName();
- // Skip namespaces
- if (localName == null || localName.equals("xmlns") || localName.startsWith("xmlns:")) {
- continue;
- }
- // Add attributs with namespaces matching the element ns
- if (!isEmpty(uri) && uri.equals(element.getNamespaceURI())) {
- boolean addProperty = true;
- if (reservedBeanAttributeNames.contains(localName)) {
- // should we allow the property to shine through?
- PropertyDescriptor descriptor = getPropertyDescriptor(className, localName);
- addProperty = descriptor != null;
- }
- if (addProperty) {
- addAttributeProperty(definition, metadata, element, attribute);
- }
- }
- }
- }
-
- protected void addContentProperty(BeanDefinitionHolder definition, MappingMetaData metadata, Element element) {
- String name = metadata.getContentProperty(getLocalName(element));
- if (name != null) {
- String value = getElementText(element);
- addProperty(definition, metadata, element, name, value);
- }
- else {
- StringBuffer buffer = new StringBuffer();
- NodeList childNodes = element.getChildNodes();
- for (int i = 0, size = childNodes.getLength(); i < size; i++) {
- Node node = childNodes.item(i);
- if (node instanceof Text) {
- buffer.append(((Text) node).getData());
- }
- }
-
- ByteArrayInputStream in = new ByteArrayInputStream(buffer.toString().getBytes());
- Properties properties = new Properties();
- try {
- properties.load(in);
- }
- catch (IOException e) {
- return;
- }
- Enumeration enumeration = properties.propertyNames();
- while (enumeration.hasMoreElements()) {
- String propertyName = (String) enumeration.nextElement();
- String propertyEditor = metadata.getPropertyEditor(getLocalName(element), propertyName);
-
- Object value = getValue(properties.getProperty(propertyName), propertyEditor);
- definition.getBeanDefinition().getPropertyValues().addPropertyValue(propertyName, value);
- }
- }
- }
-
- protected void addAttributeProperty(BeanDefinitionHolder definition, MappingMetaData metadata, Element element,
- Attr attribute) {
- String localName = attribute.getLocalName();
- String value = attribute.getValue();
- addProperty(definition, metadata, element, localName, value);
- }
-
- /**
- * Add a property onto the current BeanDefinition.
- */
- protected void addProperty(BeanDefinitionHolder definition, MappingMetaData metadata, Element element,
- String localName, String value) {
- String propertyName = metadata.getPropertyName(getLocalName(element), localName);
- String propertyEditor = metadata.getPropertyEditor(getLocalName(element), propertyName);
- if (propertyName != null) {
- definition.getBeanDefinition().getPropertyValues().addPropertyValue(
- propertyName, getValue(value,propertyEditor));
- }
- }
-
- protected Object getValue(String value, String propertyEditor) {
- if (value == null) return null;
-
- //
- // If value is #null then we are explicitly setting the value null instead of an empty string
- //
- if (NULL_REFERENCE.equals(value)) {
- return null;
- }
-
- //
- // If value starts with # then we have a ref
- //
- if (value.startsWith(BEAN_REFERENCE_PREFIX)) {
- // strip off the #
- value = value.substring(BEAN_REFERENCE_PREFIX.length());
-
- // if the new value starts with a #, then we had an excaped value (e.g. ##value)
- if (!value.startsWith(BEAN_REFERENCE_PREFIX)) {
- return new RuntimeBeanReference(value);
- }
- }
-
- if( propertyEditor!=null ) {
- PropertyEditor p = createPropertyEditor(propertyEditor);
- p.setAsText(value);
- return p.getValue();
- }
-
- //
- // Neither null nor a reference
- //
- return value;
- }
-
- protected PropertyEditor createPropertyEditor(String propertyEditor) {
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- if( cl==null ) {
- cl = XBeanNamespaceHandler.class.getClassLoader();
- }
-
- try {
- return (PropertyEditor)cl.loadClass(propertyEditor).newInstance();
- } catch (Throwable e){
- throw (IllegalArgumentException)new IllegalArgumentException("Could not load property editor: "+propertyEditor).initCause(e);
- }
- }
-
- protected String getLocalName(Element element) {
- String localName = element.getLocalName();
- if (localName == null) {
- localName = element.getNodeName();
- }
- return localName;
- }
-
- /**
- * Lets iterate through the children of this element and create any nested
- * child properties
- */
- protected void addNestedPropertyElements(BeanDefinitionHolder definition, MappingMetaData metadata,
- String className, Element element) {
- NodeList nl = element.getChildNodes();
-
- for (int i = 0; i < nl.getLength(); i++) {
- Node node = nl.item(i);
- if (node instanceof Element) {
- Element childElement = (Element) node;
- String uri = childElement.getNamespaceURI();
- String localName = childElement.getLocalName();
-
- if (!isEmpty(uri) || !reservedElementNames.contains(localName)) {
- // we could be one of the following
- // * the child element maps to a <property> tag with inner
- // tags being the bean
- // * the child element maps to a <property><list> tag with
- // inner tags being the contents of the list
- // * the child element maps to a <property> tag and is the
- // bean tag too
- // * the child element maps to a <property> tag and is a simple
- // type (String, Class, int, etc).
- Object value = null;
- String propertyName = metadata.getNestedListProperty(getLocalName(element), localName);
- if (propertyName != null) {
- value = parseListElement(childElement, propertyName);
- }
- else {
- propertyName = metadata.getFlatCollectionProperty(getLocalName(element), localName);
- if (propertyName != null) {
- Object def = parseBeanFromExtensionElement(childElement);
- PropertyValue pv = definition.getBeanDefinition().getPropertyValues().getPropertyValue(propertyName);
- if (pv != null) {
- Collection l = (Collection) pv.getValue();
- l.add(def);
- continue;
- } else {
- ManagedList l = new ManagedList();
- l.add(def);
- value = l;
- }
- } else {
- propertyName = metadata.getNestedProperty(getLocalName(element), localName);
- if (propertyName != null) {
- // lets find the first child bean that parses fine
- value = parseChildExtensionBean(childElement);
- }
- }
- }
-
- if (propertyName == null && metadata.isFlatProperty(getLocalName(element), localName)) {
- value = parseBeanFromExtensionElement(childElement, className, localName);
- propertyName = localName;
- }
-
- if (propertyName == null) {
- value = tryParseNestedPropertyViaIntrospection(metadata, className, childElement);
- propertyName = localName;
- }
-
- if (value != null) {
- definition.getBeanDefinition().getPropertyValues().addPropertyValue(propertyName, value);
- }
- else
- {
- /**
- * In this case there is no nested property, so just do a normal
- * addProperty like we do with attributes.
- */
- String text = getElementText(childElement);
-
- if (text != null) {
- addProperty(definition, metadata, element, localName, text);
- }
- }
- }
- }
- }
- }
-
- /**
- * Attempts to use introspection to parse the nested property element.
- */
- protected Object tryParseNestedPropertyViaIntrospection(MappingMetaData metadata, String className, Element element) {
- String localName = getLocalName(element);
- PropertyDescriptor descriptor = getPropertyDescriptor(className, localName);
- if (descriptor != null) {
- return parseNestedPropertyViaIntrospection(metadata, element, descriptor.getName(), descriptor.getPropertyType());
- } else {
- return parseNestedPropertyViaIntrospection(metadata, element, localName, Object.class);
- }
- }
-
- /**
- * Looks up the property decriptor for the given class and property name
- */
- protected PropertyDescriptor getPropertyDescriptor(String className, String localName) {
- BeanInfo beanInfo = qnameHelper.getBeanInfo(className);
- if (beanInfo != null) {
- PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
- for (int i = 0; i < descriptors.length; i++) {
- PropertyDescriptor descriptor = descriptors[i];
- String name = descriptor.getName();
- if (name.equals(localName)) {
- return descriptor;
- }
- }
- }
- return null;
- }
-
- /**
- * Attempts to use introspection to parse the nested property element.
- */
- private Object parseNestedPropertyViaIntrospection(MappingMetaData metadata, Element element, String propertyName, Class propertyType) {
- if (isMap(propertyType)) {
- return parseCustomMapElement(metadata, element, propertyName);
- } else if (isCollection(propertyType)) {
- return parseListElement(element, propertyName);
- } else {
- return parseChildExtensionBean(element);
- }
- }
-
- protected Object parseListElement(Element element, String name) {
- return parserContext.getDelegate().parseListElement(element);
- }
-
- protected Object parseCustomMapElement(MappingMetaData metadata, Element element, String name) {
- Map map = new HashMap();
-
- Element parent = (Element) element.getParentNode();
- String entryName = metadata.getMapEntryName(getLocalName(parent), name);
- String keyName = metadata.getMapKeyName(getLocalName(parent), name);
-
- if (entryName == null) entryName = "property";
- if (keyName == null) keyName = "key";
-
- // TODO : support further customizations
- //String valueName = "value";
- //boolean keyIsAttr = true;
- //boolean valueIsAttr = false;
- NodeList nl = element.getChildNodes();
- for (int i = 0; i < nl.getLength(); i++) {
- Node node = nl.item(i);
- if (node instanceof Element) {
- Element childElement = (Element) node;
-
- String localName = childElement.getLocalName();
- String uri = childElement.getNamespaceURI();
- if (localName == null || localName.equals("xmlns") || localName.startsWith("xmlns:")) {
- continue;
- }
-
- // we could use namespaced attributes to differentiate real spring
- // attributes from namespace-specific attributes
- if (!isEmpty(uri) && localName.equals(entryName)) {
- String key = childElement.getAttribute(keyName);
- if (key == null) throw new RuntimeException("No key defined for map " + entryName);
-
- Object keyValue = getValue(key, null);
-
- Object value = getValue(getElementText(childElement), null);
-
- map.put(keyValue, value);
- }
- }
- }
- return map;
- }
-
- protected boolean isMap(Class type) {
- return Map.class.isAssignableFrom(type);
- }
-
- /**
- * Returns true if the given type is a collection type or an array
- */
- protected boolean isCollection(Class type) {
- return type.isArray() || Collection.class.isAssignableFrom(type);
- }
-
- /**
- * Iterates the children of this element to find the first nested bean
- */
- protected Object parseChildExtensionBean(Element element) {
- NodeList nl = element.getChildNodes();
- for (int i = 0; i < nl.getLength(); i++) {
- Node node = nl.item(i);
- if (node instanceof Element) {
- Element childElement = (Element) node;
- String uri = childElement.getNamespaceURI();
- String localName = childElement.getLocalName();
-
- if (uri == null ||
- uri.equals(SPRING_SCHEMA) ||
- uri.equals(SPRING_SCHEMA_COMPAT) ||
- uri.equals(BeanDefinitionParserDelegate.BEANS_NAMESPACE_URI)) {
- if (BeanDefinitionParserDelegate.BEAN_ELEMENT.equals(localName)) {
- return parserContext.getDelegate().parseBeanDefinitionElement(childElement, true);
- } else {
- return parserContext.getDelegate().parsePropertySubElement(childElement);
- }
- } else {
- Object value = parseBeanFromExtensionElement(childElement);
- if (value != null) {
- return value;
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Uses META-INF/services discovery to find a Properties file with the XML
- * marshaling configuration
- *
- * @param namespaceURI
- * the namespace URI of the element
- * @param localName
- * the local name of the element
- * @return the properties configuration of the namespace or null if none
- * could be found
- */
- protected MappingMetaData findNamespaceProperties(String namespaceURI, String localName) {
- // lets look for the magic prefix
- if (namespaceURI != null && namespaceURI.startsWith(JAVA_PACKAGE_PREFIX)) {
- String packageName = namespaceURI.substring(JAVA_PACKAGE_PREFIX.length());
- return new MappingMetaData(packageName);
- }
-
- String uri = NamespaceHelper.createDiscoveryPathName(namespaceURI, localName);
- InputStream in = loadResource(uri);
- if (in == null) {
- if (namespaceURI != null && namespaceURI.length() > 0) {
- uri = NamespaceHelper.createDiscoveryPathName(namespaceURI);
- in = loadResource(uri);
- if (in == null) {
- uri = NamespaceHelper.createDiscoveryOldPathName(namespaceURI);
- in = loadResource(uri);
- }
- }
- }
-
- if (in != null) {
- try {
- Properties properties = new Properties();
- properties.load(in);
- return new MappingMetaData(properties);
- }
- catch (IOException e) {
- log.warn("Failed to load resource from uri: " + uri, e);
- }
- }
- return null;
- }
-
- /**
- * Loads the resource from the given URI
- */
- protected InputStream loadResource(String uri) {
- if (System.getProperty("xbean.dir") != null) {
- File f = new File(System.getProperty("xbean.dir") + uri);
- try {
- return new FileInputStream(f);
- } catch (FileNotFoundException e) {
- // Ignore
- }
- }
- // lets try the thread context class loader first
- InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(uri);
- if (in == null) {
- in = getClass().getClassLoader().getResourceAsStream(uri);
- if (in == null) {
- log.debug("Could not find resource: " + uri);
- }
- }
- return in;
- }
-
- protected boolean isEmpty(String uri) {
- return uri == null || uri.length() == 0;
- }
-
- protected void declareLifecycleMethods(BeanDefinitionHolder definitionHolder, MappingMetaData metaData,
- Element element) {
- BeanDefinition definition = definitionHolder.getBeanDefinition();
- if (definition instanceof AbstractBeanDefinition) {
- AbstractBeanDefinition beanDefinition = (AbstractBeanDefinition) definition;
- if (beanDefinition.getInitMethodName() == null) {
- beanDefinition.setInitMethodName(metaData.getInitMethodName(getLocalName(element)));
- }
- if (beanDefinition.getDestroyMethodName() == null) {
- beanDefinition.setDestroyMethodName(metaData.getDestroyMethodName(getLocalName(element)));
- }
- if (beanDefinition.getFactoryMethodName() == null) {
- beanDefinition.setFactoryMethodName(metaData.getFactoryMethodName(getLocalName(element)));
- }
- }
- }
-
- // -------------------------------------------------------------------------
- //
- // TODO we could apply the following patches into the Spring code -
- // though who knows if it'll ever make it into a release! :)
- //
- // -------------------------------------------------------------------------
- /*
- protected int parseBeanDefinitions(Element root) throws BeanDefinitionStoreException {
- int beanDefinitionCount = 0;
- if (isEmpty(root.getNamespaceURI()) || root.getLocalName().equals("beans")) {
- NodeList nl = root.getChildNodes();
- for (int i = 0; i < nl.getLength(); i++) {
- Node node = nl.item(i);
- if (node instanceof Element) {
- Element ele = (Element) node;
- if (IMPORT_ELEMENT.equals(node.getNodeName())) {
- importBeanDefinitionResource(ele);
- }
- else if (ALIAS_ELEMENT.equals(node.getNodeName())) {
- String name = ele.getAttribute(NAME_ATTRIBUTE);
- String alias = ele.getAttribute(ALIAS_ATTRIBUTE);
- getBeanDefinitionReader().getBeanFactory().registerAlias(name, alias);
- }
- else if (BEAN_ELEMENT.equals(node.getNodeName())) {
- beanDefinitionCount++;
- BeanDefinitionHolder bdHolder = parseBeanDefinitionElement(ele, false);
- BeanDefinitionReaderUtils.registerBeanDefinition(bdHolder, getBeanDefinitionReader()
- .getBeanFactory());
- }
- else {
- BeanDefinitionHolder bdHolder = parseBeanFromExtensionElement(ele);
- if (bdHolder != null) {
- beanDefinitionCount++;
- BeanDefinitionReaderUtils.registerBeanDefinition(bdHolder, getBeanDefinitionReader()
- .getBeanFactory());
- }
- else {
- log.debug("Ignoring unknown element namespace: " + ele.getNamespaceURI() + " localName: "
- + ele.getLocalName());
- }
- }
- }
- }
- } else {
- BeanDefinitionHolder bdHolder = parseBeanFromExtensionElement(root);
- if (bdHolder != null) {
- beanDefinitionCount++;
- BeanDefinitionReaderUtils.registerBeanDefinition(bdHolder, getBeanDefinitionReader()
- .getBeanFactory());
- }
- else {
- log.debug("Ignoring unknown element namespace: " + root.getNamespaceURI() + " localName: " + root.getLocalName());
- }
- }
- return beanDefinitionCount;
- }
-
- protected BeanDefinitionHolder parseBeanDefinitionElement(Element ele, boolean isInnerBean) throws BeanDefinitionStoreException {
-
- BeanDefinitionHolder bdh = super.parseBeanDefinitionElement(ele, isInnerBean);
- coerceNamespaceAwarePropertyValues(bdh, ele);
- return bdh;
- }
-
- protected Object parsePropertySubElement(Element element, String beanName) throws BeanDefinitionStoreException {
- String uri = element.getNamespaceURI();
- String localName = getLocalName(element);
-
- if ((!isEmpty(uri) && !(uri.equals(SPRING_SCHEMA) || uri.equals(SPRING_SCHEMA_COMPAT)))
- || !reservedElementNames.contains(localName)) {
- Object answer = parseBeanFromExtensionElement(element);
- if (answer != null) {
- return answer;
- }
- }
- if (QNAME_ELEMENT.equals(localName) && isQnameIsOnClassPath()) {
- Object answer = parseQNameElement(element);
- if (answer != null) {
- return answer;
- }
- }
- return super.parsePropertySubElement(element, beanName);
- }
-
- protected Object parseQNameElement(Element element) {
- return QNameReflectionHelper.createQName(element, getElementText(element));
- }
- */
-
- /**
- * Returns the text of the element
- */
- protected String getElementText(Element element) {
- StringBuffer buffer = new StringBuffer();
- NodeList nodeList = element.getChildNodes();
- for (int i = 0, size = nodeList.getLength(); i < size; i++) {
- Node node = nodeList.item(i);
- if (node.getNodeType() == Node.TEXT_NODE) {
- buffer.append(node.getNodeValue());
- }
- }
- return buffer.toString();
- }
}
Modified: geronimo/xbean/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanNamespaceHandlerResolver.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanNamespaceHandlerResolver.java?rev=438491&r1=438490&r2=438491&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanNamespaceHandlerResolver.java (original)
+++ geronimo/xbean/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanNamespaceHandlerResolver.java Wed Aug 30 07:14:53 2006
@@ -27,7 +27,12 @@
}
public NamespaceHandler resolve(String namespaceUri) {
- NamespaceHandler handler = super.resolve(namespaceUri);
+ NamespaceHandler handler = null;
+ try {
+ handler = super.resolve(namespaceUri);
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
if (handler == null) {
handler = new XBeanNamespaceHandler();
}
Added: geronimo/xbean/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanV2Helper.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanV2Helper.java?rev=438491&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanV2Helper.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanV2Helper.java Wed Aug 30 07:14:53 2006
@@ -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.xbean.spring.context.v2;
+
+import java.lang.reflect.Constructor;
+
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
+import org.springframework.beans.factory.xml.NamespaceHandler;
+import org.springframework.beans.factory.xml.XmlReaderContext;
+import org.w3c.dom.Element;
+
+public class XBeanV2Helper {
+
+ public static String version = null;
+
+ public static BeanDefinitionParserDelegate createParser(XmlReaderContext readerContext) {
+ try {
+ String className = "org.apache.xbean.spring.context." + getVersion() + ".XBeanBeanDefinitionParserDelegate";
+ Class clParser = Class.forName(className);
+ Constructor cns = clParser.getConstructor(new Class[] { XmlReaderContext.class });
+ return (BeanDefinitionParserDelegate) cns.newInstance(new Object[] { readerContext });
+ } catch (Throwable e) {
+ throw (IllegalStateException) new IllegalStateException("Unable to create namespace handler for: " + version).initCause(e);
+ }
+ }
+
+ public static NamespaceHandler createNamespaceHandler() {
+ try {
+ String className = "org.apache.xbean.spring.context." + getVersion() + ".XBeanNamespaceHandler";
+ Class clHandler = Class.forName(className);
+ return (NamespaceHandler) clHandler.newInstance();
+ } catch (Throwable e) {
+ throw (IllegalStateException) new IllegalStateException("Unable to create namespace handler for: " + version).initCause(e);
+ }
+ }
+
+ private static String getVersion() {
+ if (version == null) {
+ try {
+ Class cl = Class.forName("org.springframework.beans.factory.xml.BeanDefinitionParserDelegate");
+ try {
+ cl.getMethod("parsePropertyElements", new Class[] { Element.class, BeanDefinition.class });
+ version = "v2b";
+ } catch (NoSuchMethodException e) {
+ version = "v2a";
+ }
+ } catch (Throwable e) {
+ throw (IllegalStateException) new IllegalStateException("Could not create namespace handler for: " + version).initCause(e);
+ }
+ }
+ return version;
+ }
+}
Modified: geronimo/xbean/trunk/xbean-spring-v2a/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2a/pom.xml?rev=438491&r1=438432&r2=438491&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2a/pom.xml (original)
+++ geronimo/xbean/trunk/xbean-spring-v2a/pom.xml Wed Aug 30 07:14:53 2006
@@ -30,20 +30,20 @@
<version>2.6-SNAPSHOT</version>
</parent>
- <artifactId>xbean-spring-v2</artifactId>
- <name>XBean :: Spring :: V2</name>
+ <artifactId>xbean-spring-v2a</artifactId>
+ <name>XBean :: Spring :: V2A</name>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
- <version>2.0-m5</version>
+ <version>2.0-rc2</version>
</dependency>
<dependency>
<groupId>org.apache.xbean</groupId>
- <artifactId>xbean-spring-common</artifactId>
+ <artifactId>xbean-spring-v2</artifactId>
<version>${pom.version}</version>
<exclusions>
<exclusion>
@@ -96,6 +96,15 @@
</testResources>
<plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>**/BeerUsingXBeanNSTest.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
Added: geronimo/xbean/trunk/xbean-spring-v2a/src/main/java/org/apache/xbean/spring/context/v2a/XBeanBeanDefinitionParserDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2a/src/main/java/org/apache/xbean/spring/context/v2a/XBeanBeanDefinitionParserDelegate.java?rev=438491&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2a/src/main/java/org/apache/xbean/spring/context/v2a/XBeanBeanDefinitionParserDelegate.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2a/src/main/java/org/apache/xbean/spring/context/v2a/XBeanBeanDefinitionParserDelegate.java Wed Aug 30 07:14:53 2006
@@ -0,0 +1,99 @@
+/**
+ * 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.xbean.spring.context.v2a;
+
+import java.lang.reflect.Method;
+
+import org.apache.xbean.spring.context.impl.PropertyEditorHelper;
+import org.apache.xbean.spring.context.impl.QNameReflectionHelper;
+import org.apache.xbean.spring.context.v2.XBeanNamespaceHandler;
+import org.apache.xbean.spring.context.v2.XBeanQNameHelper;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
+import org.springframework.beans.factory.xml.XmlReaderContext;
+import org.springframework.util.StringUtils;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class XBeanBeanDefinitionParserDelegate extends BeanDefinitionParserDelegate {
+
+ public static final String QNAME_ELEMENT = "qname";
+
+ private XBeanQNameHelper qnameHelper;
+
+ static {
+ PropertyEditorHelper.registerCustomEditors();
+ }
+
+ public XBeanBeanDefinitionParserDelegate(XmlReaderContext readerContext) {
+ super(readerContext);
+ qnameHelper = new XBeanQNameHelper(readerContext);
+ }
+
+ public Object parsePropertySubElement(Element ele, String defaultTypeClassName) {
+ if (!isDefaultNamespace(ele.getNamespaceURI())) {
+ return internalParseNestedCustomElement(ele);
+ }
+ else if (ele.getTagName().equals(QNAME_ELEMENT)) {
+ return parseQNameElement(ele);
+ }
+ else {
+ return super.parsePropertySubElement(ele, defaultTypeClassName);
+ }
+ }
+
+ public BeanDefinition parseBeanDefinitionElement(Element ele, String beanName) {
+ BeanDefinition bd = super.parseBeanDefinitionElement(ele, beanName);
+ qnameHelper.coerceNamespaceAwarePropertyValues(bd, ele);
+ return bd;
+ }
+
+ public boolean isDefaultNamespace(String namespaceUri) {
+ return (!StringUtils.hasLength(namespaceUri) ||
+ BEANS_NAMESPACE_URI.equals(namespaceUri)) ||
+ XBeanNamespaceHandler.SPRING_SCHEMA.equals(namespaceUri) ||
+ XBeanNamespaceHandler.SPRING_SCHEMA_COMPAT.equals(namespaceUri);
+ }
+
+ protected Object parseQNameElement(Element element) {
+ return QNameReflectionHelper.createQName(element, getElementText(element));
+ }
+
+ protected String getElementText(Element element) {
+ StringBuffer buffer = new StringBuffer();
+ NodeList nodeList = element.getChildNodes();
+ for (int i = 0, size = nodeList.getLength(); i < size; i++) {
+ Node node = nodeList.item(i);
+ if (node.getNodeType() == Node.TEXT_NODE) {
+ buffer.append(node.getNodeValue());
+ }
+ }
+ return buffer.toString();
+ }
+
+ private Object internalParseNestedCustomElement(Element candidateEle) {
+ try {
+ Method mth = getClass().getSuperclass().getDeclaredMethod("parseNestedCustomElement", new Class[] { Element.class });
+ mth.setAccessible(true);
+ return mth.invoke(this, new Object[] { candidateEle });
+ } catch (Exception e) {
+ throw new IllegalStateException("Unable to invoke parseNestedCustomElement method", e);
+ }
+ }
+
+}