[maven-release-plugin] copy for tag openwebbeans-1.2.5
git-svn-id: https://svn.apache.org/repos/asf/openwebbeans/tags/openwebbeans-1.2.5@1596959 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/owb_1.2.x/KEYS b/owb_1.2.x/KEYS
new file mode 100644
index 0000000..5d4e98f
--- /dev/null
+++ b/owb_1.2.x/KEYS
@@ -0,0 +1,101 @@
+pub 1024D/646A89B4 2008-10-28
+uid Gurkan Erdogdu (Apache Org. Account) <gerdogdu@apache.org>
+sig 3 646A89B4 2009-09-17 Gurkan Erdogdu (Apache Org. Account) <gerdogdu@apache.org>
+uid Gurkan Erdogdu <cgurkanerdogdu@gmail.com>
+sig 3 646A89B4 2008-10-28 Gurkan Erdogdu (Apache Org. Account) <gerdogdu@apache.org>
+sub 2048g/9FD40A52 2008-10-28
+sig 646A89B4 2008-10-28 Gurkan Erdogdu (Apache Org. Account) <gerdogdu@apache.org>
+
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1.4.6 (GNU/Linux)
+
+mQGiBEkG1OERBADSdnS14qMKgE35QUqqMeMRx0V+UBeNTxb+aLNej/z+cNZ3BJSF
+tnK833gDAlvCrpndJ5y778fkK/tyn33S7KF6yFPyXc3BuJ6/b3PdtDxA6zTYbG6M
+yg349QdRJj9ulj2XbTJS1kNFK6zuHl7vRBtsDwtFZTL687DSiWOS4tzTMwCgjmv0
+3Xog/3kNfcq20/sNg1aW7SUD/iBOhsFEGYk+UodQROE7AbHUIQk8NgNNyQLFVU3G
+Uoaz0u/e/EmhzEtZ7ChM76l4a+YDbT6va02C9jsAAGzibcCgRzA9kkh1LanA6fEA
+VyORVjjQ8QNFmL/bHtwHFdrYjozqZs69ieIs/Xt44HVw1lWHXZotffjVlzqDXHQz
+JWLABAC93ZAlo2fyweNAWBTyL3yw0lN/F5iYs8HtFWCfv+UG9Qy4V38Duq62wfmF
+J2SuWE6Jrj4isDI+pOJFpd/9wUUKnw1Zl30SYooF9sicys2jyJ0im4oN0M3JbWIO
+rAIcBRXAj1d8yhNXMe9uxfCjp0DcdOUVOT3rCiAPlpUubbIlI7Q6R3Vya2FuIEVy
+ZG9nZHUgKEFwYWNoZSBPcmcuIEFjY291bnQpIDxnZXJkb2dkdUBhcGFjaGUub3Jn
+PohjBBMRAgAjAhsjBgsJCAcDAgQVAggDBBYCAwECHgECF4AFAkqxmhsCGQEACgkQ
+CeHN0GRqibQmEQCfffP2ETpx0LGbP/DDvnJmr/9ixGwAnjAEmS9+qfq1zyKynk/k
+hT9ZIk+ntClHdXJrYW4gRXJkb2dkdSA8Y2d1cmthbmVyZG9nZHVAZ21haWwuY29t
+PohgBBMRAgAgBQJJBtThAhsjBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQCeHN
+0GRqibRK6gCfcZUPvM7e/25DdkWBNDSyUn67/ZEAoISurFCBYpB/y0pCfBQ+bXcw
+DzIfuQINBEkG1OwQCACyjZOCisI1+ozdL3I+aajwednrLlaSuEPNJJ6Pi9HZOPUM
+eCDEC9NH/lolCizFYHz/UwmjTAqh9dFR5HrPvdeXCaekJ7Wp5wQpN/4hc1o6qxsn
+zMYR8PI6IGslF3AgW+/lsbNaU66Hybl9mRuLI4xZeh3no6reD6zHGeBdWjREi7qW
+hlj7S9dCtNxFYpx3MrTRNeFNtbQwn21ztixJB8YfxIfoEoN/j2qVMwjb9nsy8uFb
+rNRwUeFXK0taB+ApQmuAtmIq7aPO8wmzbBsWPEPCCZsLs5Fi54S9NaemQlsgzyZP
+M7wzVsgkHX+/vp8vOsJDAMHJgLiUckBCL4DQGbuHAAMFB/9iRO9C8plMTzV5kg8o
+oIUf0ufH+gYti6d14o0yX+z6VvNshH0E+763gcd4W/rwwdWg8P0yxMtB+MSo4+Uw
+yrFJzTzYNK8flBjRvT9/UltC7HEik2cVioOdRKH1TdNRAc3dX2vO90R+EYMHTW9V
+H8nFjyVF3jFRiajw1m1sMYs61sCRSKB0gIjjHbVOeNgLUqKMt09Bt7ooX5p+E8Ni
+azT24G4xMnxsKTWnRtUakDIjyAx5rzNxqK8B/gEvCuY/wxx+bSUv7zkMKdXG853C
+ykiV89qjxfTaxV7CXKDUt+ISUuG4YvN4i9d5NshDHVRymmlfLrMD0rGwj5/fsgso
+qDQciEkEGBECAAkFAkkG1OwCGwwACgkQCeHN0GRqibRvmwCfaboJGDcfH+Qr1iKS
+nuviP3qpQAEAnjZ3AFTcoKY9rRalxSOKptp8hQtk
+=iBw8
+-----END PGP PUBLIC KEY BLOCK-----
+
+
+----------------------------
+pub 4096R/2FDB81B1 2010-02-01
+uid Mark Struberg (Apache) <struberg@apache.org>
+sub 4096R/F24C5214 2010-02-01
+
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1.4.9 (GNU/Linux)
+
+mQINBEtnVXUBEACz2CXck8rFZsqlmtZrwySHkCKdKQ3dO5fyya3ScYRofIS0OVi0
+BwpWyVfzezq2jl4AkjEFGS/ja0shnr4hg6tWU6w3obZ4S8dQMyPm8x5kSTxj28mn
+lkNnR1mBr7S13n33ZtA6f5c1cPu4zMqzKEFvsqVoBwD/ru5WOB0buwGi9mG173Vi
+tkTi1MtzQ4aaIo8XiJyLsm/StTq1ylU1vfqtyFDZJUzoakdYSiA4NVfVFUL2LMTl
+gPq3hpWNZjVm41+YKWuzjIJ/lidH2Y2TmjivgtQToVbHMV3sHn/PtDKw91S6Ls2q
+kSLUm/Bs19H4ZGPMhWI1MnQnQiuMMPYvqIddIh2SIog2bSowPZz2FkZxrw04ej/t
+tYrSIfiR3sRegmWoeo/FCLYVWZ32mw5L8Tw0npHg3BSi0v5FoNd/GiD1Y6//Usy3
+tQVFUI1zkh/PSWVImAgmgoE3qhcIjzlkVutsFY4NGr6LH2sUpIJBi/ECy0R38rLg
+sg5pjUPhs7QexH5M9FxshI+yDsvPOTeUjvpHysvemHhVJyPQSmpOa16ONFmx5xvz
+d90FmxKfaJJvmVMvNmGMdhdAzaAJ3XomFEJZDKfyBJoOJSoNvdOQRNBUt7aKEEKb
+3BGypY2bzr0C3WxggpywPmlD1xDohurx/b3dLFoK39hmFiTek4db0tin1QARAQAB
+tCxNYXJrIFN0cnViZXJnIChBcGFjaGUpIDxzdHJ1YmVyZ0BhcGFjaGUub3JnPokC
+NwQTAQoAIQUCS2dVdQIbAwULCQgHAwUVCgkICwUWAgMBAAIeAQIXgAAKCRDpEoeC
+L9uBsTzGD/41kZMlyyzg6gsrQgDZPxzxVbsFWGqareqElLZ8MVTo8mEt9cKwS71T
+dHaEXO1BBukqPWpRjWp1TepRZ1i4PNscDwtDcGkv2lpaQICwo43MNW9GFFRJaGCr
+Ry4Tpov5yYwdbP1cdqNS+Q1TtwZcCTFiEL1xAAnR3nY2BzfdpL/fTXzHggmuLtRD
+OeiIPQrp+NaVzhk994t1MQ5wjevoZYGvH6oV6hQ3Nr4t0rA93F5fKb9vJiz3SnJU
+a97uPANCYzhYSb6IzNICLfSQCKi5AoK7fjENCTaq2Uqsvkl2hVZWmGYmJLRAZDFE
+5RNE2OGU+x7hVCQnD1r/a0rnWpdODqM2EkqDpxkKkH5pJvzPepLeSYv4KmRu3+89
+ljFtBM01pt9TPoBYRE2/sODZUFs+ct+AaxatHjs46U1Ks6g0ah7YmUnolENqsuF+
+grpLtrCwgKrwfY3N4KHIMUnmq4Wmh0ooiL2o/DN0EciA2JDm+3xgK1giAXvzCbDS
+oHgJ/SJ6DAUtSb+t74Gd4GRvpDMoo7u82A7tZj/3h5cjmyuwms1uJc40D6v4/Ljp
+sbltrrWcJ/E1TokJlFT2QpRBJkMixHO4aaS7olOMJqI6/wrrzq7KjZOUfD3KwhDL
+DolhmshiFw1tx1sloa7RlibHAxxLKkcc+DVGVr1MBf4xus38QZT9R7kCDQRLZ1V1
+ARAAstCgZH1oA9RwRaBJ21qKeOzOaB3iOQynBdjeDJGiaKuMQWgv+NpLCh+fqe8t
+QSj0j40fphOJq0dTNSqNExLd4P5hEhUXALkFWGmc8vki5InXkeUc8eMvvAILa8qX
+jXsR5Y13TES1hZGhAUQ9KPirJubrnIWOexoBndW6gEAS6N1awoQEFsTcB7wrV+Ae
+7pBQHH2CrtvFYXePNjiWAHdV63uOTXkM8elozBMa0cIVznv4sgKzs9sdJlg9Q+5E
+iU6zLmEL+zsVgtUczAx5x9nIMRZsqgxlysalqj9GQHlnv49JcR4wyjHSLvuxUVgy
+YOOsRzpbizjyBZe3w+bo/J4K9covXmLIIHEaNm127Xq/pT/aB79cmRmyzXgD4EQ2
+AhP82+c/UVr5GO8PBqPG8pydwMXpT1jzgTmMOwvEhj2hOtqA/HE5cEIpiwgcJOrB
+g2C1irnApXFTmA6xtPGAZjCAaHHouelNepA9T8x2LvzoOdfXIf6dOX218Y99VLRc
+Uwj37uyYTaEwbWvyEX7u+nHuKWXN7SaML/IYTv/rGu+TUVAQGlWTg2lJkY6vh/07
+1EUmavR/BBUOP4NqmisNS0Xtx8OHwQ92x8+ayRixO3Kh6OC1nJH5Jylr/lqpVxXw
+HgA/hn/jX4/TWFpmv9JTvxXlYfnRr9UccEncK9/28eUz+CcAEQEAAYkCHwQYAQoA
+CQUCS2dVdQIbDAAKCRDpEoeCL9uBsRwVD/4ogReEt1w2ODA3SsypnrCettQtnV4J
+Vn7zjvDK0v0U+xZ+tB7VvUqkY7dQ4RmzhxETnORUZNgCWLZ6fs5Us2RB/yoOyYSJ
+c+SBN3YEpbFBwLBLoGlZTGsJPktYNo+nQ9KEIZ+OHFnhXGJLqBknMn0vu6T+pQv5
+8hJzrfOh98TCtFLmKfZGGwoQfKeDAMEo71T69Yoz1NSSFHr5o39iHff8+mhp1WL1
+hsiJI6MOlaUZAwNI1CRebZPQofvydTH+LWsBna1oAiFrO4KcorBJI/gUfGO1mmBq
+l5qjtoxhq5Tr2oBQtFoqbUaXJcwbDVxLSQhk6omNjNlolsRXj6TBy1eTFgd4Ww0Q
+B5mYo8cc8Et0wlzZ3UyhD2ix6EnKxWUqj0oFPIVzFfuQ/whmWuqBiMZcAN9RhCGP
+aovv1v0jP1i983QWptUwpr0m2UjxblFUz2GiQ9sXPCi1Cko978LKCiVseCKVEmbG
+fWdpq/h+sM4GokoYwa6ak5B5Dyu9/JywTAex/DgUvkuGQuBjtipmS84lb+Ah8wkj
+lxiWgAoxUUnVFRJb9bpH7sRNc8SXfy6dYcCDWURq73JYzPtmCVAE6stD5lSU+YvQ
+f+QZZLa4u84eh0skgAakDgkeL2cbOg4tzkUo4EmbXR5M0VRk/946s78/JtchwdNB
+zxrmkygs1IMB6Q==
+=8P8F
+-----END PGP PUBLIC KEY BLOCK-----
+
diff --git a/owb_1.2.x/LICENSE b/owb_1.2.x/LICENSE
new file mode 100644
index 0000000..57bc88a
--- /dev/null
+++ b/owb_1.2.x/LICENSE
@@ -0,0 +1,202 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
diff --git a/owb_1.2.x/NOTICE b/owb_1.2.x/NOTICE
new file mode 100644
index 0000000..8adc55c
--- /dev/null
+++ b/owb_1.2.x/NOTICE
@@ -0,0 +1,6 @@
+Apache OpenWebBeans
+Copyright 2008 - 2014 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/owb_1.2.x/atinject-tck/pom.xml b/owb_1.2.x/atinject-tck/pom.xml
new file mode 100644
index 0000000..55d55b8
--- /dev/null
+++ b/owb_1.2.x/atinject-tck/pom.xml
@@ -0,0 +1,94 @@
+<?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.
+-->
+
+<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>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>1.2.5</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>atinject-tck</artifactId>
+ <name>OWB JSR-330 TCK</name>
+ <packaging>jar</packaging>
+ <description>Apache OpenWebBeans JSR-330 TCK Suite</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ <configuration>
+ <includes>
+ <include>**/OpenWebBeansAtInjectTck.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject-tck</artifactId>
+ <version>1</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <version>${geronimo_atinject.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-porting</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-core</artifactId>
+ <version>3.1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-validation_1.0_spec</artifactId>
+ </dependency>
+
+
+ </dependencies>
+</project>
diff --git a/owb_1.2.x/atinject-tck/src/site/apt/index.apt b/owb_1.2.x/atinject-tck/src/site/apt/index.apt
new file mode 100644
index 0000000..baa565c
--- /dev/null
+++ b/owb_1.2.x/atinject-tck/src/site/apt/index.apt
@@ -0,0 +1,16 @@
+~~ 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.
+OpenWebBeans API
+
+ Application Programming Interface for the JSR-299
+ Java Contexts and Dependency Injection.
+
diff --git a/owb_1.2.x/atinject-tck/src/site/site.xml b/owb_1.2.x/atinject-tck/src/site/site.xml
new file mode 100644
index 0000000..4fb7e75
--- /dev/null
+++ b/owb_1.2.x/atinject-tck/src/site/site.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+<project name="OpenWebBeans-API">
+ <publishDate format="dd MMM yyyy" />
+ <version position="left"/>
+
+ <body>
+ <breadcrumbs>
+ <item name="Apache" href="http://www.apache.org"/>
+ <item name="OpenWebBeans" href="http://openwebbeans.apache.org"/>
+ <item name="atinject TCK" href="http://openwebbeans.apache.org/${project.version}/atinject-tck"/>
+ </breadcrumbs>
+
+ <menu name="Overview">
+ <item name="Introduction" href="index.html" />
+ </menu>
+
+ <menu ref="reports"/>
+ </body>
+</project>
+
diff --git a/owb_1.2.x/atinject-tck/src/test/java/org/apache/webbeans/atinject/tck/OpenWebBeansAtInjectTck.java b/owb_1.2.x/atinject-tck/src/test/java/org/apache/webbeans/atinject/tck/OpenWebBeansAtInjectTck.java
new file mode 100644
index 0000000..7b10991
--- /dev/null
+++ b/owb_1.2.x/atinject-tck/src/test/java/org/apache/webbeans/atinject/tck/OpenWebBeansAtInjectTck.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.atinject.tck;
+
+import org.apache.webbeans.atinject.tck.container.AtInjectContainer;
+
+import junit.framework.Test;
+
+public class OpenWebBeansAtInjectTck
+{
+ public static Test suite()
+ {
+ return new AtInjectContainer().start();
+ }
+
+}
diff --git a/owb_1.2.x/atinject-tck/src/test/java/org/apache/webbeans/atinject/tck/container/AtInjectContainer.java b/owb_1.2.x/atinject-tck/src/test/java/org/apache/webbeans/atinject/tck/container/AtInjectContainer.java
new file mode 100644
index 0000000..6d64718
--- /dev/null
+++ b/owb_1.2.x/atinject-tck/src/test/java/org/apache/webbeans/atinject/tck/container/AtInjectContainer.java
@@ -0,0 +1,98 @@
+/*
+ * 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.webbeans.atinject.tck.container;
+
+import java.lang.annotation.Annotation;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.logging.Level;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
+import junit.framework.Test;
+
+import org.apache.webbeans.atinject.tck.specific.SpecificProducer;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.test.tck.StandaloneContainersImpl;
+import org.atinject.tck.Tck;
+import org.atinject.tck.auto.Car;
+import org.atinject.tck.auto.Convertible;
+import org.atinject.tck.auto.FuelTank;
+import org.atinject.tck.auto.Seat;
+import org.atinject.tck.auto.Tire;
+import org.atinject.tck.auto.V8Engine;
+import org.atinject.tck.auto.accessories.Cupholder;
+import org.jboss.testharness.api.DeploymentException;
+
+public class AtInjectContainer extends StandaloneContainersImpl
+{
+ private static Set<Class<?>> deploymentClasses = null;
+
+ static
+ {
+ deploymentClasses = new HashSet<Class<?>>();
+ deploymentClasses.add(Convertible.class);
+ deploymentClasses.add(Seat.class);
+ deploymentClasses.add(Tire.class);
+ deploymentClasses.add(V8Engine.class);
+ deploymentClasses.add(Cupholder.class);
+ deploymentClasses.add(FuelTank.class);
+
+ //Adding our special producer
+ deploymentClasses.add(SpecificProducer.class);
+
+ }
+
+ public AtInjectContainer()
+ {
+
+ }
+
+ public Test start()
+ {
+ try
+ {
+ deploy(deploymentClasses);
+
+ BeanManager manager = WebBeansContext.getInstance().getBeanManagerImpl();
+ Set<Bean<?>> beans = manager.getBeans(Car.class, new Annotation[0]);
+ Bean<?> carBean = beans.iterator().next();
+
+ Car car = (Car)manager.getReference(carBean , Car.class , manager.createCreationalContext(carBean));
+
+ return Tck.testsFor(car, false, true);
+
+ } catch(DeploymentException e)
+ {
+ logger.log(Level.SEVERE, "AtInjectContainer", e);
+ excpetion = e;
+ }
+
+ return null;
+ }
+
+
+ public void stop()
+ {
+ undeploy();
+
+ }
+
+}
diff --git a/owb_1.2.x/atinject-tck/src/test/java/org/apache/webbeans/atinject/tck/specific/DriverBinding.java b/owb_1.2.x/atinject-tck/src/test/java/org/apache/webbeans/atinject/tck/specific/DriverBinding.java
new file mode 100644
index 0000000..89b88a7
--- /dev/null
+++ b/owb_1.2.x/atinject-tck/src/test/java/org/apache/webbeans/atinject/tck/specific/DriverBinding.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.atinject.tck.specific;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface DriverBinding
+{
+
+}
diff --git a/owb_1.2.x/atinject-tck/src/test/java/org/apache/webbeans/atinject/tck/specific/SpareBinding.java b/owb_1.2.x/atinject-tck/src/test/java/org/apache/webbeans/atinject/tck/specific/SpareBinding.java
new file mode 100644
index 0000000..b6ac71b
--- /dev/null
+++ b/owb_1.2.x/atinject-tck/src/test/java/org/apache/webbeans/atinject/tck/specific/SpareBinding.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.atinject.tck.specific;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface SpareBinding
+{
+
+}
diff --git a/owb_1.2.x/atinject-tck/src/test/java/org/apache/webbeans/atinject/tck/specific/SpecificProducer.java b/owb_1.2.x/atinject-tck/src/test/java/org/apache/webbeans/atinject/tck/specific/SpecificProducer.java
new file mode 100644
index 0000000..ab9c44c
--- /dev/null
+++ b/owb_1.2.x/atinject-tck/src/test/java/org/apache/webbeans/atinject/tck/specific/SpecificProducer.java
@@ -0,0 +1,66 @@
+/*
+ * 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.webbeans.atinject.tck.specific;
+
+import javax.enterprise.inject.Typed;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.New;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+import org.atinject.tck.auto.Drivers;
+import org.atinject.tck.auto.DriversSeat;
+import org.atinject.tck.auto.Seat;
+import org.atinject.tck.auto.accessories.SpareTire;
+
+
+public class SpecificProducer
+{
+ public SpecificProducer()
+ {
+
+ }
+
+ @Produces @Drivers
+ public Seat produceDrivers(@New DriversSeat seat)
+ {
+ return seat;
+ }
+
+
+ @Produces @DriverBinding @Typed(value={DriversSeat.class})
+ public DriversSeat produceDriverSeat(@New DriversSeat seat)
+ {
+ return seat;
+ }
+
+
+ @Produces @Named("spare") @SpareBinding
+ public SpareTire produceSpare(@New SpareTire tire)
+ {
+ return tire;
+ }
+
+ @Produces @Default @Typed(value={SpareTire.class})
+ public SpareTire produceSpareTire(@New SpareTire tire)
+ {
+ return tire;
+ }
+
+}
diff --git a/owb_1.2.x/atinject-tck/src/test/resources/META-INF/openwebbeans/openwebbeans.properties b/owb_1.2.x/atinject-tck/src/test/resources/META-INF/openwebbeans/openwebbeans.properties
new file mode 100644
index 0000000..2c35ac1
--- /dev/null
+++ b/owb_1.2.x/atinject-tck/src/test/resources/META-INF/openwebbeans/openwebbeans.properties
@@ -0,0 +1,39 @@
+#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.
+
+#---------------------------------------------------------------
+# The default configuration for OpenWebBeans
+#
+# The default configuration is intended for a JDK and a simple ServletContainer
+# like jetty, resin or tomcat.
+#
+#---------------------------------------------------------------
+
+#general configuration section
+
+
+# the service section:
+# The key is the Interface, the value the implementation of the service
+
+# use the static HashMap instead of storing objects in JNDI as default
+org.apache.webbeans.spi.JNDIService=org.apache.webbeans.corespi.se.DefaultJndiService
+
+# lookup the javax.transaction.TransactionManager via JNDI as default
+org.apache.webbeans.spi.TransactionService=org.apache.webbeans.corespi.se.DefaultTransactionService
+
+#use the web metadata as default
+org.apache.webbeans.spi.ScannerService=org.apache.webbeans.test.tck.mock.TCKMetaDataDiscoveryImpl
\ No newline at end of file
diff --git a/owb_1.2.x/distribution/pom.xml b/owb_1.2.x/distribution/pom.xml
new file mode 100644
index 0000000..954931a
--- /dev/null
+++ b/owb_1.2.x/distribution/pom.xml
@@ -0,0 +1,184 @@
+<?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.
+-->
+
+<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>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>1.2.5</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-distribution</artifactId>
+ <packaging>pom</packaging>
+
+ <name>Distribution Pkg</name>
+ <description>
+ Apache OpenWebBeans distribution package.
+ Builds the complete OpenWebBeans binary distribution bundles.
+ </description>
+
+ <properties>
+ <skipReports>true</skipReports>
+ </properties>
+
+ <profiles>
+ <profile>
+ <id>apache-release</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2.1</version>
+ <configuration>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ <descriptors>
+ <descriptor>src/assembly/dist-binary.xml</descriptor>
+ </descriptors>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-install-plugin</artifactId>
+ <configuration>
+ <createChecksum>true</createChecksum>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>sign-artifacts</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <!--
+ The assemblies work off of dependency sets since the stuff to be
+ aggregated is no longer sub-modules after moving assembly itself
+ into this 'distribution' module.
+ -->
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>openwebbeans-jsf</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>openwebbeans-jsf12</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>openwebbeans-jms</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>openwebbeans-ejb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>openwebbeans-ee</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>openwebbeans-ee-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>openwebbeans-el10</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>openwebbeans-el22</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>openwebbeans-resource</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>openwebbeans-osgi</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>openwebbeans-tomcat6</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>openwebbeans-tomcat7</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>openwebbeans-web</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/owb_1.2.x/distribution/src/assembly/dist-binary.xml b/owb_1.2.x/distribution/src/assembly/dist-binary.xml
new file mode 100644
index 0000000..8429083
--- /dev/null
+++ b/owb_1.2.x/distribution/src/assembly/dist-binary.xml
@@ -0,0 +1,239 @@
+<!--
+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.
+-->
+<assembly xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/assembly-1.1.0-SNAPSHOT.xsd">
+
+
+ <id>binary</id>
+ <formats>
+ <format>zip</format>
+ <format>tar.gz</format>
+ </formats>
+
+ <includeBaseDirectory>true</includeBaseDirectory>
+
+ <files>
+ <file>
+ <source>../LICENSE</source>
+ </file>
+
+ <file>
+ <source>../NOTICE</source>
+ </file>
+
+ <file>
+ <source>../readme/README.txt</source>
+ </file>
+
+ <file>
+ <source>../KEYS</source>
+ </file>
+
+ <file>
+ <outputDirectory>config</outputDirectory>
+ <source>../samples/guess/src/main/webapp/WEB-INF/web.xml</source>
+ </file>
+
+ <file>
+ <outputDirectory>config</outputDirectory>
+ <source>../webbeans-impl/src/main/resources/META-INF/openwebbeans/openwebbeans.properties</source>
+ </file>
+ </files>
+
+ <fileSets>
+ <fileSet>
+ <directory>../samples/guess</directory>
+ <useDefaultExcludes>true</useDefaultExcludes>
+ <outputDirectory>samples/guess</outputDirectory>
+ <excludes>
+ <exclude>**/target/**</exclude>
+ <exclude>**/.classpath</exclude>
+ <exclude>**/.project</exclude>
+ <exclude>**/.settings/**</exclude>
+ <exclude>**/.git/**</exclude>
+ <exclude>**/.svn/**</exclude>
+ <exclude>**/.metadata/**</exclude>
+ <exclude>**/.gitignore</exclude>
+ </excludes>
+ </fileSet>
+ <fileSet>
+ <directory>../samples/reservation</directory>
+ <useDefaultExcludes>true</useDefaultExcludes>
+ <outputDirectory>samples/reservation</outputDirectory>
+ <excludes>
+ <exclude>**/target/**</exclude>
+ <exclude>**/.classpath</exclude>
+ <exclude>**/.project</exclude>
+ <exclude>**/.settings/**</exclude>
+ <exclude>**/.git/**</exclude>
+ <exclude>**/.svn/**</exclude>
+ <exclude>**/.metadata/**</exclude>
+ <exclude>**/.gitignore</exclude>
+ </excludes>
+ </fileSet>
+ <fileSet>
+ <directory>../samples/ejb-sample</directory>
+ <useDefaultExcludes>true</useDefaultExcludes>
+ <outputDirectory>samples/ejb-sample</outputDirectory>
+ <excludes>
+ <exclude>**/target/**</exclude>
+ <exclude>**/.classpath</exclude>
+ <exclude>**/.project</exclude>
+ <exclude>**/.settings/**</exclude>
+ <exclude>**/.git/**</exclude>
+ <exclude>**/.svn/**</exclude>
+ <exclude>**/.metadata/**</exclude>
+ <exclude>**/.gitignore</exclude>
+ </excludes>
+ </fileSet>
+ <fileSet>
+ <directory>../samples/ejb-telephone</directory>
+ <useDefaultExcludes>true</useDefaultExcludes>
+ <outputDirectory>samples/ejb-telephone</outputDirectory>
+ <excludes>
+ <exclude>**/target/**</exclude>
+ <exclude>**/.classpath</exclude>
+ <exclude>**/.project</exclude>
+ <exclude>**/.settings/**</exclude>
+ <exclude>**/.git/**</exclude>
+ <exclude>**/.svn/**</exclude>
+ <exclude>**/.metadata/**</exclude>
+ <exclude>**/.gitignore</exclude>
+ </excludes>
+ </fileSet>
+ <fileSet>
+ <directory>../samples/conversation-sample</directory>
+ <useDefaultExcludes>true</useDefaultExcludes>
+ <outputDirectory>samples/conversation-sample</outputDirectory>
+ <excludes>
+ <exclude>**/target/**</exclude>
+ <exclude>**/.classpath</exclude>
+ <exclude>**/.project</exclude>
+ <exclude>**/.settings/**</exclude>
+ <exclude>**/.git/**</exclude>
+ <exclude>**/.svn/**</exclude>
+ <exclude>**/.metadata/**</exclude>
+ <exclude>**/.gitignore</exclude>
+ </excludes>
+ </fileSet>
+ <fileSet>
+ <directory>../samples/jms-sample</directory>
+ <useDefaultExcludes>true</useDefaultExcludes>
+ <outputDirectory>samples/jms-sample</outputDirectory>
+ <excludes>
+ <exclude>**/target/**</exclude>
+ <exclude>**/.classpath</exclude>
+ <exclude>**/.project</exclude>
+ <exclude>**/.settings/**</exclude>
+ <exclude>**/.git/**</exclude>
+ <exclude>**/.svn/**</exclude>
+ <exclude>**/.metadata/**</exclude>
+ <exclude>**/.gitignore</exclude>
+ </excludes>
+ </fileSet>
+ <fileSet>
+ <directory>../samples/jsf2sample</directory>
+ <useDefaultExcludes>true</useDefaultExcludes>
+ <outputDirectory>samples/jsf2sample</outputDirectory>
+ <excludes>
+ <exclude>**/target/**</exclude>
+ <exclude>**/.classpath</exclude>
+ <exclude>**/.project</exclude>
+ <exclude>**/.settings/**</exclude>
+ <exclude>**/.git/**</exclude>
+ <exclude>**/.svn/**</exclude>
+ <exclude>**/.metadata/**</exclude>
+ <exclude>**/.gitignore</exclude>
+ </excludes>
+ </fileSet>
+ <fileSet>
+ <directory>../samples/standalone-sample</directory>
+ <useDefaultExcludes>true</useDefaultExcludes>
+ <outputDirectory>samples/standalone-sample</outputDirectory>
+ <excludes>
+ <exclude>**/target/**</exclude>
+ <exclude>**/.classpath</exclude>
+ <exclude>**/.project</exclude>
+ <exclude>**/.settings/**</exclude>
+ <exclude>**/.git/**</exclude>
+ <exclude>**/.svn/**</exclude>
+ <exclude>**/.metadata/**</exclude>
+ <exclude>**/.gitignore</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+
+ <dependencySets>
+
+ <dependencySet>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org.apache.openwebbeans:openwebbeans-impl:jar:${project.version}</include>
+ </includes>
+ </dependencySet>
+
+ <dependencySet>
+ <outputDirectory>api</outputDirectory>
+ <includes>
+ <include>org.apache.geronimo.specs:geronimo-atinject_1.0_spec:jar</include>
+ <include>org.apache.geronimo.specs:geronimo-jcdi_1.0_spec:jar</include>
+ </includes>
+ </dependencySet>
+
+ <dependencySet>
+ <outputDirectory>plugins</outputDirectory>
+ <includes>
+ <include>org.apache.openwebbeans:openwebbeans-resource</include>
+ <include>org.apache.openwebbeans:openwebbeans-jsf</include>
+ <include>org.apache.openwebbeans:openwebbeans-jsf12</include>
+ <include>org.apache.openwebbeans:openwebbeans-jms</include>
+ <include>org.apache.openwebbeans:openwebbeans-ejb</include>
+ <include>org.apache.openwebbeans:openwebbeans-ee</include>
+ <include>org.apache.openwebbeans:openwebbeans-ee-common</include>
+ <include>org.apache.openwebbeans:openwebbeans-el10</include>
+ <include>org.apache.openwebbeans:openwebbeans-el22</include>
+ <include>org.apache.openwebbeans:openwebbeans-resource</include>
+ <include>org.apache.openwebbeans:openwebbeans-osgi</include>
+ <include>org.apache.openwebbeans:openwebbeans-web</include>
+ <include>org.apache.openwebbeans:openwebbeans-tomcat6</include>
+ <include>org.apache.openwebbeans:openwebbeans-tomcat7</include>
+ </includes>
+
+ </dependencySet>
+
+ <dependencySet>
+ <outputDirectory>spi</outputDirectory>
+ <includes>
+ <include>org.apache.openwebbeans:openwebbeans-spi</include>
+ </includes>
+ <excludes>
+ <exclude>org.apache.openwebbeans:openwebbeans-spi:jar:sources</exclude>
+ </excludes>
+ </dependencySet>
+
+ <dependencySet>
+ <outputDirectory>arquillian</outputDirectory>
+ <includes>
+ <include>org.apache.openwebbeans.arquillian:owb-arquillian-standalone</include>
+ </includes>
+ </dependencySet>
+
+ </dependencySets>
+
+
+</assembly>
diff --git a/owb_1.2.x/pom.xml b/owb_1.2.x/pom.xml
new file mode 100644
index 0000000..e9df3d0
--- /dev/null
+++ b/owb_1.2.x/pom.xml
@@ -0,0 +1,841 @@
+<?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.
+-->
+<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>
+ <groupId>org.apache</groupId>
+ <artifactId>apache</artifactId>
+ <version>13</version>
+ </parent>
+
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <name>Apache OpenWebBeans</name>
+ <packaging>pom</packaging>
+ <version>1.2.5</version>
+
+ <url>openwebbeans.apache.org</url>
+
+ <description>
+ Apache OpenWebBeans is an open source implementation of
+ JSR-299 WebBeans
+ </description>
+
+ <organization>
+ <name>The Apache Software Foundation</name>
+ <url>http://apache.org</url>
+ </organization>
+
+ <inceptionYear>2008</inceptionYear>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/openwebbeans/tags/openwebbeans-1.2.5</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/openwebbeans/tags/openwebbeans-1.2.5</developerConnection>
+ <url>https://svn.apache.org/repos/asf/openwebbeans/tags/openwebbeans-1.2.5</url>
+ </scm>
+
+ <issueManagement>
+ <system>jira</system>
+ <url>http://issues.apache.org/jira/browse/OWB</url>
+ </issueManagement>
+
+ <distributionManagement>
+ <site>
+ <id>apache.openwebbeans.site</id>
+ <url>scp://minotaur.apache.org/www/openwebbeans.apache.org/${project.version}</url>
+ </site>
+ </distributionManagement>
+
+ <properties>
+ <geronimo_jaxws.version>1.0</geronimo_jaxws.version>
+ <geronimo_servlet.version>1.2</geronimo_servlet.version>
+ <dom4j.version>1.6.1</dom4j.version>
+ <geronimo_ejb.version>1.0.2</geronimo_ejb.version>
+ <geronimo_el.version>1.0.2</geronimo_el.version>
+ <geronimo_annotation.version>1.0.1</geronimo_annotation.version>
+ <geronimo_jpa.version>1.1</geronimo_jpa.version>
+ <geronimo_jta.version>1.1.1</geronimo_jta.version>
+ <geronimo_jsp.version>1.0.1</geronimo_jsp.version>
+ <geronimo_cdi.version>1.0</geronimo_cdi.version>
+ <geronimo_atinject.version>1.0</geronimo_atinject.version>
+ <geronimo_interceptor.version>1.0</geronimo_interceptor.version>
+ <geronimo_validation.version>1.1</geronimo_validation.version>
+ <openejb.version>3.1.4</openejb.version>
+ <myfaces.version>2.0.7</myfaces.version>
+ <xbean.version>3.17</xbean.version>
+ </properties>
+
+ <mailingLists>
+ <mailingList>
+ <name>OpenWebBeans Developer List</name>
+ <subscribe>dev-subscribe@openwebbeans.apache.org</subscribe>
+ <unsubscribe>dev-unsubscribe@openwebbeans.apache.org</unsubscribe>
+ <post>dev@openwebbeans.apache.org</post>
+ <archive>http://mail-archives.apache.org/mod_mbox/openwebbeans-dev/</archive>
+ </mailingList>
+ <mailingList>
+ <name>OpenWebBeans User List</name>
+ <subscribe>user-subscribe@openwebbeans.apache.org</subscribe>
+ <unsubscribe>user-unsubscribe@openwebbeans.apache.org</unsubscribe>
+ <post>user@openwebbeans.apache.org</post>
+ <archive>http://mail-archives.apache.org/mod_mbox/openwebbeans-user/</archive>
+ </mailingList>
+ <mailingList>
+ <name>OpenWebBeans Commits List</name>
+ <subscribe>commits-subscribe@openwebbeans.apache.org</subscribe>
+ <unsubscribe>commits-unsubscribe@openwebbeans.apache.org</unsubscribe>
+ <post>commits@openwebbeans.apache.org</post>
+ <archive>http://mail-archives.apache.org/mod_mbox/openwebbeans-commits/</archive>
+ </mailingList>
+ <mailingList>
+ <name>OpenWebBeans Private List</name>
+ <subscribe>private-subscribe@openwebbeans.apache.org</subscribe>
+ <unsubscribe>private-unsubscribe@openwebbeans.apache.org</unsubscribe>
+ <post>private@openwebbeans.apache.org</post>
+ </mailingList>
+ </mailingLists>
+
+ <developers>
+ <developer>
+ <id>gerdogdu</id>
+ <name>Gurkan Erdogdu</name>
+ <email>gerdogdu at apache dot org</email>
+ <roles>
+ <role>PMC</role>
+ <role>Chair</role>
+ </roles>
+ </developer>
+ <developer>
+ <id>bergmark</id>
+ <name>Joe Bergmark</name>
+ <email>bergmark at gmail dot com</email>
+ <roles>
+ <role>PMC</role>
+ </roles>
+ </developer>
+ <developer>
+ <id>kevan</id>
+ <name>Kevan Miller</name>
+ <email>kevan dot miller at gmail dot com</email>
+ <roles>
+ <role>PMC</role>
+ </roles>
+ </developer>
+ <developer>
+ <id>matzew</id>
+ <name>Matthias Wessendorf</name>
+ <email>matzew at apache dot org</email>
+ <organization>Oracle, Germany</organization>
+ <organizationUrl>http://www.oracle.com/</organizationUrl>
+ <roles>
+ <role>Committer,Mentor</role>
+ </roles>
+ </developer>
+ <developer>
+ <id>covener</id>
+ <name>Eric Covener</name>
+ <email>covener at gmail dot com</email>
+ <roles>
+ <role>PMC</role>
+ </roles>
+ </developer>
+ <developer>
+ <id>struberg</id>
+ <name>Mark Struberg</name>
+ <email>struberg at yahoo dot de</email>
+ <roles>
+ <role>PMC</role>
+ </roles>
+ </developer>
+ <developer>
+ <id>dblevins</id>
+ <name>David Blevins</name>
+ <email>david dot blevins at visi dot com</email>
+ <roles>
+ <role>PMC</role>
+ </roles>
+ </developer>
+ <developer>
+ <id>gpetracek</id>
+ <name>Gerhard Petracek</name>
+ <email>gpetracek at apache dot org</email>
+ <organization>IRIAN.at, Austria</organization>
+ <organizationUrl>http://www.irian.at/</organizationUrl>
+ <roles>
+ <role>PMC</role>
+ </roles>
+ <timezone>+1</timezone>
+ </developer>
+ <developer>
+ <id>kelapure</id>
+ <name>Rohit Kelapure</name>
+ <email>kelapure at apache dot org</email>
+ <url>http://www.linkedin.com/in/rohitkelapure</url>
+ <organization>IBM</organization>
+ <organizationUrl>http://wasdynacache.blogspot.com</organizationUrl>
+ <roles>
+ <role>Committer</role>
+ </roles>
+ </developer>
+ <developer>
+ <id>rederpj</id>
+ <name>Paul J. Reder</name>
+ <email>rederpj at apache dot org</email>
+ <roles>
+ <role>Committer</role>
+ </roles>
+ </developer>
+ <developer>
+ <id>djencks</id>
+ <name>David Jencks</name>
+ <email>djencks at apache dot org</email>
+ <roles>
+ <role>PMC</role>
+ </roles>
+ </developer>
+ <developer>
+ <id>martinkoci</id>
+ <name>Martin Koci</name>
+ <email>martinkoci at apache dot org</email>
+ <timezone>+1</timezone>
+ <roles>
+ <role>committer</role>
+ </roles>
+ </developer>
+ <developer>
+ <id>arne</id>
+ <name>Arne Limburg</name>
+ <email>arne at apache dot org</email>
+ <timezone>+1</timezone>
+ <roles>
+ <role>committer</role>
+ </roles>
+ </developer>
+ <developer>
+ <id>tandraschko</id>
+ <name>Thomas Andraschko</name>
+ <email>tandraschko at apache dot org</email>
+ <timezone>+1</timezone>
+ <roles>
+ <role>committer</role>
+ </roles>
+ </developer>
+ </developers>
+
+ <contributors>
+ <contributor>
+ <name>Adonis Raduca</name>
+ <email>adonis.raduca at codebeat.ro</email>
+ <roles>
+ <role>Logo-creator</role>
+ </roles>
+ </contributor>
+ </contributors>
+
+ <build>
+ <defaultGoal>install</defaultGoal>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-remote-resources-plugin</artifactId>
+ <version>1.2.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>process</goal>
+ </goals>
+ <configuration>
+ <resourceBundles>
+ <resourceBundle>org.apache:apache-jar-resource-bundle:1.4</resourceBundle>
+ </resourceBundles>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.3.2</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <arguments>-Papache-release -Ptck -Pjsr330-tck</arguments>
+ <autoVersionSubmodules>true</autoVersionSubmodules>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Specification-Title>${project.name}</Specification-Title>
+ <Specification-Version>${project.version}</Specification-Version>
+ <Specification-Vendor>${project.organization.name}</Specification-Vendor>
+ <Implementation-Title>${project.name}</Implementation-Title>
+ <Implementation-Version>${project.version}</Implementation-Version>
+ <Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
+ <Implementation-Vendor-Id>org.apache</Implementation-Vendor-Id>
+ </manifestEntries>
+ <!-- Adding Manifest File -->
+ <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>2.1.0</version>
+ <executions>
+ <execution>
+ <id>bundle-manifest</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>manifest</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <supportedProjectTypes>
+ <supportedProjectType>jar</supportedProjectType>
+ <supportedProjectType>bundle</supportedProjectType>
+ <supportedProjectType>war</supportedProjectType>
+ </supportedProjectTypes>
+ <instructions>
+ <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+ <Bundle-Version>${project.version}</Bundle-Version>
+ <Export-Package>!org.apache.webbeans.internal.*,org.apache.webbeans.*;version="${project.version}"</Export-Package>
+ <Private-Package>org.apache.webbeans.internal.*</Private-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-remote-resources-plugin</artifactId>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.1</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.9</version>
+ <configuration>
+ <includes>
+ <include>**/*Test.java</include>
+ <include>**/*TestCase.java</include>
+ <include>**/*Tests*.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ <!-- force generating a *-sources.jar when building a jar, e.g. for a snapshot release -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.2.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>2.7</version>
+ <executions>
+ <execution>
+ <id>verify-style</id>
+ <phase>verify</phase>
+ <goals><goal>check</goal></goals>
+ </execution>
+ </executions>
+ <configuration>
+ <configLocation>openwebbeans/owb-checks-default.xml</configLocation>
+ <headerLocation>openwebbeans/owb-header.txt</headerLocation>
+ <consoleOutput>true</consoleOutput>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.openwebbeans.build-tools</groupId>
+ <artifactId>checkstyle-rules</artifactId>
+ <version>1.3</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <version>0.7</version>
+ <configuration>
+ <includes>
+ <include>src/**/*</include>
+ <include>pom.xml</include>
+ </includes>
+ <excludes>
+ <exclude>**/*/MANIFEST.MF</exclude>
+ <exclude>.git</exclude>
+ <exclude>.gitignore</exclude>
+ </excludes>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>verify</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.9.1</version>
+ <configuration>
+ <!-- used to suppress fancy javadoc errors in java8 -->
+ <quiet>true</quiet>
+ <links>
+ <link>http://download.oracle.com/javaee/6/api/</link>
+ <link>http://download.oracle.com/javase/6/docs/api/</link>
+ <link>http://myfaces.apache.org/core20/myfaces-api/apidocs/</link>
+ </links>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <version>2.4</version>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>cim</report>
+ <report>index</report>
+ <report>issue-tracking</report>
+ <report>mailing-list</report>
+ <report>project-team</report>
+ <report>scm</report>
+ <report>summary</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.9.1</version>
+ <configuration>
+ <!-- used to suppress fancy javadoc errors in java8 -->
+ <quiet>true</quiet>
+ <links>
+ <link>http://download.oracle.com/javaee/6/api/</link>
+ <link>http://download.oracle.com/javase/6/docs/api/</link>
+ <link>http://myfaces.apache.org/core20/myfaces-api/apidocs/</link>
+ </links>
+ </configuration>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>javadoc</report>
+ <report>test-javadoc</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <modules>
+ <module>webbeans-spi</module>
+ <module>webbeans-impl</module>
+ <module>webbeans-ee-common</module>
+ <module>webbeans-web</module>
+ <module>webbeans-ejb</module>
+ <module>webbeans-ee</module>
+ <module>webbeans-tomcat6</module>
+ <module>webbeans-tomcat7</module>
+ <module>webbeans-jms</module>
+ <module>webbeans-jsf</module>
+ <module>webbeans-jsf12</module>
+ <module>webbeans-clustering</module>
+ <module>webbeans-el10</module>
+ <module>webbeans-el22</module>
+ <module>webbeans-resource</module>
+ <module>webbeans-jee5-ejb-resource</module>
+ <module>webbeans-osgi</module>
+ <module>webbeans-porting</module>
+ <module>webbeans-test</module>
+ <module>webbeans-arquillian</module>
+ <module>samples</module>
+ <module>webbeans-tck</module>
+ <module>distribution</module>
+ <module>webbeans-doc</module>
+ </modules>
+
+ <dependencyManagement>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jaxws_2.1_spec</artifactId>
+ <version>${geronimo_jaxws.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_2.5_spec</artifactId>
+ <version>${geronimo_servlet.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>dom4j</groupId>
+ <artifactId>dom4j</artifactId>
+ <version>${dom4j.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-ejb_3.1_spec</artifactId>
+ <version>${geronimo_ejb.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-el_2.2_spec</artifactId>
+ <version>${geronimo_el.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-validation_1.0_spec</artifactId>
+ <version>${geronimo_validation.version}</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>${myfaces.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <version>${myfaces.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.xbean</groupId>
+ <artifactId>xbean-finder-shaded</artifactId>
+ <version>${xbean.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.xbean</groupId>
+ <artifactId>xbean-asm5-shaded</artifactId>
+ <version>${xbean.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-annotation_1.1_spec</artifactId>
+ <version>${geronimo_annotation.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>4.2.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jpa_2.0_spec</artifactId>
+ <version>${geronimo_jpa.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+ <version>${geronimo_interceptor.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jta_1.1_spec</artifactId>
+ <version>${geronimo_jta.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jsp_2.1_spec</artifactId>
+ <version>${geronimo_jsp.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <version>${geronimo_cdi.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <version>${geronimo_atinject.version}</version>
+ </dependency>
+
+ <!-- this is used for TCK tests -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-el22</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-porting</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-web</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-jsf</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-resource</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-ejb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- CDI Testing Framework -->
+ <dependency>
+ <groupId>org.apache.openwebbeans.test</groupId>
+ <artifactId>cditest</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans.test</groupId>
+ <artifactId>cditest-owb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-core</artifactId>
+ <version>${openejb.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-tomcat-catalina</artifactId>
+ <version>${openejb.version}</version>
+ </dependency>
+
+ </dependencies>
+ </dependencyManagement>
+
+
+ <profiles>
+ <profile>
+ <id>reporting</id>
+ <activation>
+ <property>
+ <name>skipReports</name>
+ <value>!true</value>
+ </property>
+ </activation>
+ <reporting>
+ <plugins>
+ <!-- Apache plugins in alphabetical order -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jxr-plugin</artifactId>
+ <version>2.3</version>
+ <configuration>
+ <inputEncoding>
+ ${project.build.sourceEncoding}
+ </inputEncoding>
+ <outputEncoding>
+ ${project.build.sourceEncoding}
+ </outputEncoding>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <version>2.5</version>
+ <configuration>
+ <targetJdk>1.5</targetJdk>
+ <rulesets>
+ <ruleset>
+ http://svn.codehaus.org/mojo/trunk/mojo/mojo-parent/src/main/config/pmd/mojo_rules.xml
+ </ruleset>
+ </rulesets>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>
+ maven-project-info-reports-plugin
+ </artifactId>
+ <version>2.4</version>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>cim</report>
+ <report>dependencies</report>
+ <report>dependency-convergence</report>
+ <report>dependency-management</report>
+ <report>index</report>
+ <report>issue-tracking</report>
+ <report>license</report>
+ <report>mailing-list</report>
+ <report>plugin-management</report>
+ <report>project-team</report>
+ <report>scm</report>
+ <report>summary</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ <version>2.9</version>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>report</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ <!-- Codehaus plugins in alphabetical order -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <version>2.5.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>taglist-maven-plugin</artifactId>
+ <version>2.4</version>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <threshold>Low</threshold>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </reporting>
+
+ </profile>
+
+ <profile>
+ <id>jsr330-tck</id>
+ <modules>
+ <module>atinject-tck</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>doc</id>
+ <modules>
+ <module>webbeans-doc</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>cdi-1.1</id>
+ <modules>
+ <module>webbeans-cdi11</module>
+ </modules>
+ </profile>
+
+ </profiles>
+</project>
diff --git a/owb_1.2.x/readme/README.txt b/owb_1.2.x/readme/README.txt
new file mode 100644
index 0000000..c3e7dd2
--- /dev/null
+++ b/owb_1.2.x/readme/README.txt
@@ -0,0 +1,1417 @@
+-------------------------------
+Apache OpenWebBeans 1.2.5
+-------------------------------
+Welcome!
+
+Thanks for downloading and using OpenWebBeans.
+This document is a "Getting Started Guide" for OpenWebBeans.
+
+
+--------------------------------
+What is Apache OpenWebBeans?
+--------------------------------
+OpenWebBeans is an Apache License V 2.0 licensed implementation of the JSR-299,
+Contexts and Dependency Injection for the Java EE platform.
+
+It also already incorporates some features which are part of JSR-346 (CDI-1.1)
+but doesn't need API changes as we still use the JCDI-1.0 API. The
+incorporated CDI-1.1 features are mostly parts which are not well
+defined in the CDI-1.0 specification, like Serialisation checks, etc.
+
+Our project's web page can be found at:
+http://openwebbeans.apache.org
+
+The projects WIKI page can be found at:
+https://cwiki.apache.org/confluence/display/OWB/Index
+
+
+
+--------------------------------
+OpenWebBeans Release Features
+--------------------------------
+
+
+- The release supports the following features
+-----------------------------------
+* Managed Beans Support
+* Session Beans Support (via Embeddable OpenEJB container in Tomcat)
+* Producer Method Support
+* Producer Field Support
+* Java EE Resource Injection Support
+* JMS OpenWebBeans Support(OWB Specific)
+* Inheritance, Stereotype Inheritances
+* Specialization Support
+* Event Support
+* Decorator and Interceptor Support
+* Lookup and Dependency Injection Support
+* Java EE Plugin Support (via ServetContextListener interface)
+* Portable Integration Support
+* Passivation Capability of Beans
+* @Alternative support
+* OSGi environment support with an own plugable bundle ClassPath scanner
+* vastly improved Interceptor performance
+* plugable SecurityManager integration doubles speed if no SecurityManager is being used
+* improved Serialization handling
+* improved CreationalContext handling
+* revised internal logging
+* upgrade to JPA-2 and JSF-2 support
+* support for direct CDI usage in tomcat-6 and tomcat-7 environments
+* optional lenient lifecycle interceptor checking
+* automatically detect if BeanManager#isInUse()
+* improved Serialization checks from the CDI-1.1 specification
+
+
+
+Noteable differences to CDI spec behaviour
+--------------------------------------------
+
+In a few special cases Apache OpenWebBeans might behave a little bit different than
+other CDI implementations. This is to some degree caused by the JSR-299 spec being
+not clear about some special topics so we needed to interpret the wording on our own.
+This mainly concerns the area of section 12.1 Bean Archives (BDA) which doesn't work
+out when it comes to OSGi containers and likes.
+In Apache OpenWebBeans, a settings configured in a beans.xml file of a BDA is not
+only effective for this very bean archive but for the whole BeanManager in control
+of the Application. This is especially the case for <alternatives> and
+<interceptors>! An Alternative, Interceptor or Decorator enabled in one BDA is active
+for the whole Application. This behaviour will most likely also be the default behaviour
+in the CDI-1.1 JSR-346 specification.
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.2.5
+-------------------------------------------
+
+Bug
+
+ [OWB-953] - Bean scanning doesn't work in Websphere 7
+ [OWB-956] - DefinitionException when iterateing over instance of org.apache.webbeans.inject.instance.InstanceImpl
+ [OWB-957] - interceptor proxies blow up if you have more than 127 methods in a class
+
+Task
+
+ [OWB-899] - code cleanup for owb-1.2.1 release
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.2.4
+-------------------------------------------
+
+Bug
+
+ [OWB-952] - ensure we only use ConcurrentMap and not ConcurrentHashMap API to avoid issues with java 8
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.2.3
+-------------------------------------------
+
+Bug
+
+ [OWB-938] - NoClassDefFoundError not caught when checking if a bean is a managed one or not in WebBeanUtils (isValidManagedBean)
+
+Improvement
+
+ [OWB-937] - unify startup detection
+
+New Feature
+
+ [OWB-941] - Signal or handle differently final methods
+
+Task
+
+ [OWB-944] - upgrade to asm5
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.2.2
+-------------------------------------------
+
+Bug
+
+ [OWB-914] - @New Bean is not intercepted
+ [OWB-917] - Multiple specialization doesn't work
+ [OWB-918] - openwebbeans-el22 missing from binary
+ [OWB-919] - The word "occurred" misspelled in Messages.properties several times
+ [OWB-920] - NPE in org.apache.webbeans.servlet.WebBeansConfigurationListener.ensureRequestScope()
+ [OWB-923] - wrong handling of bridge methods
+ [OWB-924] - Extensions do miss the passivationId
+ [OWB-929] - implicit filter in InstanceImpl#iterator
+ [OWB-930] - NotificationManager#disableOverriddenObservers removes wrong observers
+
+Improvement
+
+ [OWB-820] - cleanup of el resolvers
+ [OWB-932] - skip validation of the cdi-api
+
+New Feature
+
+ [OWB-921] - Create a synthetic InjectionPoint if the bean got triggered programmatically
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.2.1
+-------------------------------------------
+
+Bug
+
+ [OWB-626] - Conversation Scope isn't accessible after RENDER_RESPONSE phase
+ [OWB-642] - Method WebBeansUtil.configureProducerMethodSpecializations is unreliable
+ [OWB-654] - manual lookups of beans with generics fail
+ [OWB-675] - Alternative resolving does not take Qualifiers into consideration
+ [OWB-679] - StereoTypeManager is completely unused -> remove or fix.
+ [OWB-745] - Fixes usage of java.lang.Class and java.lang.reflect.Method
+ [OWB-774] - missing deployment hints
+ [OWB-812] - study how to resolve the classloader to create a proxy
+ [OWB-870] - @Observer event is being received twice
+ [OWB-872] - Listening to AfterBeanDiscovery suppresses @Decorator registration as a side effect
+ [OWB-874] - AfterBeanDiscovery event should not be fired if there is no extension module registered
+ [OWB-876] - basic handling of virtual resources in arquillian adapter
+ [OWB-877] - no need to cast parent type in AnnotatedTypeImpl
+ [OWB-878] - OpenWebBeans does not correctly handle generics
+ [OWB-881] - interception of bean using constructor injection is not supported
+ [OWB-885] - ProducerMethodBeansBuilder ejb handling is too linked to openejb
+ [OWB-886] - @Specializes appears to be broken
+ [OWB-887] - Ambigious resolution with this two producers: Map<X,Y> and Map<X,Z>
+ [OWB-888] - Provider to an EJB does not work
+ [OWB-889] - intercepted/decorated beans are not serializable even if the whole stack is
+ [OWB-890] - InjectionResolver#checkInjectionPoints throw NPE for some 3rd party beans
+ [OWB-891] - dynamically removing @Alternative does not work
+ [OWB-893] - OpenWebBeans 1.2.1 fails when injecting generic value holder
+ [OWB-895] - BeforeBeanDiscovery.addAnnotatedType() calls does not work as expected when owb jars are deployed outside WEB-INF/lib folder
+ [OWB-896] - Delegate InjectionPoints need different bean resolving rules
+ [OWB-897] - Interceptors do not work on processed injection targets
+ [OWB-898] - ClassFormatError in ASM engine
+ [OWB-901] - missing type erasure handling for ParameterizedType
+ [OWB-902] - NPE when Bean#getBeanClass is null
+ [OWB-904] - VerifyError on Interceptor usage
+ [OWB-905] - Remove @Ingored from DefaultOwbFailOverTest#restoreConversationContexts
+ [OWB-908] - Proxy creation fails if a method throws an Exception which is an inner class
+ [OWB-909] - ConversationBean needs to implement PassivationCapable
+ [OWB-911] - SelfInterceptorBean not serialized correctly in DefaultInterceptorHandler
+
+Documentation
+
+ [OWB-783] - No documentation available in the project webpage
+
+Improvement
+
+ [OWB-652] - Introduce HierarchicBeanManager
+ [OWB-762] - improve error message for "duplicated" configs
+ [OWB-763] - move our remaining tests from TestContext to AbstractUnitTest
+ [OWB-786] - available implementations of SecurityService need an improved error-handling
+ [OWB-820] - cleanup of el resolvers
+ [OWB-821] - reduce the number of string creations
+ [OWB-880] - OpenWebBeans Arquillian Container rely on bad Archive instance assumptions
+
+New Feature
+
+ [OWB-814] - Implement CDI-268
+ [OWB-879] - allow to configure owb properties in owb arquillian adapter
+ [OWB-882] - AbstractUnitTest should support to inject bean instances in test class
+ [OWB-883] - basic @AroundConstruct implementation
+ [OWB-884] - basic @Priority support
+
+Task
+
+ [OWB-782] - Create AnnotatedTypeService SPI interface
+ [OWB-854] - cleanup of jdk 1.5 specific parts
+ [OWB-866] - use xbean asm4 shade
+ [OWB-867] - a class without a "CDI" constructor is not always an issue so log it with info level only when mandatory to not pollute logs
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.2.0
+-------------------------------------------
+
+Bug
+
+ [OWB-151] - @Dependent beans not interceptable
+ [OWB-187] - Interceptors with lifecycle and @AroundInvoke permitted to have bindingtypes containing method-level annotations
+ [OWB-306] - overrridden @AroundInvoke and lifecycle interceptors are still run
+ [OWB-392] - AbstractInjectable#dependentInstanceOfProducerMethods must not be static nor public
+ [OWB-423] - OpenWebBeansEjbInterceptor is LATE in establishing the request context for an EJB
+ [OWB-468] - Make BeansDeployer.deployFromClassPath(ScannerService) resilient to ClassNotFoundException and NoClassDefFoundError's
+ [OWB-497] - Don't break deployment if java can't read all the annotations
+ [OWB-513] - proxies should be inactive after a container shutdown
+ [OWB-549] - Security review needed for ClassUtil
+ [OWB-556] - bean with interceptor + @PreDestroy causes a NullPointerException
+ [OWB-568] - Decorater for generic Interfaces does not work
+ [OWB-569] - OpenWebBeans uses the Java Reflection API to discover program element types and annotations in addition to the AnnotatedType
+ [OWB-570] - Interceptors must support retry
+ [OWB-572] - OwbParametrizedTypeImpl s equals method is broken
+ [OWB-575] - ResourceProxyHandler.invoke should unwrap and throw the underlying cause of the InvocationTargetException
+ [OWB-665] - invocation order of @PostConstruct interceptors
+ [OWB-714] - EmptyStackException when accessing an instance that is created by a producer method that has an InjectionPoint as parameter.
+ [OWB-722] - @Typed not respected for beans using generics
+ [OWB-728] - AbstractProducer stores CreationalContext
+ [OWB-729] - review CreationalContext in Interceptor and Decorator creation
+ [OWB-730] - remove InjectionTargetWrapper
+ [OWB-733] - CLONE - ClassLoader leak in WebBeansUtil.isScopeTypeNormalCache
+ [OWB-739] - CLONE - Ambiguous producer methods and fields are not detected due to bug in AbstractProducerBean equals and hashCode
+ [OWB-740] - NPE while removing dependent beans
+ [OWB-748] - Implement CDI-132
+ [OWB-749] - Move Interceptor stuff to InterceptorManager
+ [OWB-750] - OWB annotationlitteral use instanceof to implement equals and not annotationType()
+ [OWB-754] - fix PassivationCapable detection
+ [OWB-759] - Decorator position not well managed if the decorator is abstract
+ [OWB-764] - constructor with multiple InjectionPoints cause Exception
+ [OWB-767] - DefaultBDABeansXmlScanner synchronizes without visibility guarantees
+ [OWB-768] - add support for proxying protected methods in NormalScopedProxyFactory
+ [OWB-769] - Serialisation support for our new InterceptorDecoratorProxies
+ [OWB-775] - error on shutdown doesn't cleanup WebBeansFinder map
+ [OWB-776] - private and protected producer methods do not properly de-reference the contextual instance
+ [OWB-777] - InjectableMethod must unwrap normalscoping proxies
+ [OWB-778] - InterceptorBean must unwrap InjectionTargetExceptions
+ [OWB-784] - WebContextsService bypasses spi contract of ContextsService
+ [OWB-788] - deployment error when a @Specializes bean is disabled via an Extension
+ [OWB-791] - only one generic is handled for injections of ManagedBeans
+ [OWB-793] - "Ambigious" typo
+ [OWB-794] - AbstractOwbBean#toString doesn't reflect ParameterizedTypes
+ [OWB-801] - null instance shouldn't be destroyed (copy)
+ [OWB-802] - #annotationType() of javax.enterprise:cdi-api not compatible with AbstractAnnotationLiteral
+ [OWB-803] - Forever loop when abstract decorator does not implement invoked method
+ [OWB-805] - CLONE - @Alternative is ignored when using the Provider interface.
+ [OWB-806] - CLONE - Overloaded EJB Observer methods fail to deploy
+ [OWB-807] - performance issue with owb-arquillian-standalone
+ [OWB-813] - CLONE - #annotationType() of javax.enterprise:cdi-api not compatible with AbstractAnnotationLiteral
+ [OWB-817] - the jsf module(s) are bound to a specific el version
+ [OWB-818] - StandaloneResourceInjectionService can lead to injection of 'null'
+ [OWB-822] - ejb should be tested first and not after having defined a managed bean
+ [OWB-823] - EJBs support ee injections
+ [OWB-824] - annotated field events should get the associated annotatedfield
+ [OWB-825] - don't fire the same PAT event for a bean intercepted by itself (ejb interceptor style)
+ [OWB-828] - broken proxies in case of bridge methods
+ [OWB-829] - generate our proxies with 2 $$
+ [OWB-831] - filtering producers by annotated type is too strict (java type should be enough) since it prevents extensions to add producers
+ [OWB-832] - ejb producers should use ejb view methods
+ [OWB-833] - disposal injection points shouldn't be listed in getInjectionPoints() method
+ [OWB-834] - self interceptors have lifecycle methods
+ [OWB-835] - even resource should be serializable
+ [OWB-836] - auto interception ignored when no other reason to proxy the class
+ [OWB-837] - lifecycle interceptors can't catch exceptions
+ [OWB-838] - putting bean dependent instances first in dependent objects
+ [OWB-839] - interceptor lifecycle methods (@postConstruct,...) should be ignored for method interceptors
+ [OWB-840] - don't create decorators if the asked instance if the delegate
+ [OWB-842] - lazy mode for @New on ejbs
+ [OWB-845] - @Disposes not validated
+ [OWB-848] - deserialization of normal-scoped proxies for PassivationCapable beans fails
+ [OWB-849] - org.apache.webbeans.portable.ProviderBasedProxyProducer uses the wrong classloader
+ [OWB-850] - all provider based producer can't be proxied -> handling dependent scope
+ [OWB-855] - NPE when no default constructor is found
+ [OWB-856] - Currently in OpenWebBeans one can add exactly one AnnotatedType
+ [OWB-857] - NullPointerException on passivation
+ [OWB-858] - AnnotatedTypeImpl not thread safe
+ [OWB-861] - Decorator building fails when decorator has inheritance
+ [OWB-862] - allow independent bootstrapping
+
+Improvement
+
+ [OWB-479] - detect loops in producer beans vs. producer method parameters at deployment time
+ [OWB-488] - move WebBeansConfigurationException messages to message bundles
+ [OWB-551] - Reduce static synchronized hashmap usage even further
+ [OWB-603] - Incorporate enhanced BeanArchive handling of the preliminary CDI-1.1 specification
+ [OWB-632] - re-visit WebBeansUtil#isPassivationCapable
+ [OWB-715] - Remove EL22 implementation from Core to Own Project
+ [OWB-717] - Remove Failover implementation from Web to Own Project
+ [OWB-727] - introduce a static INSTANCE for DefaultLiteral, AnyLiteral, etc
+ [OWB-735] - remove CreationalContextWrapper
+ [OWB-744] - change the name of all Bean<T> implementations to reflect this fact
+ [OWB-753] - remove lazy Bean initialisation
+ [OWB-765] - Implement BeanAttributes
+ [OWB-766] - Use CreationalContextImpl to pass info about InjectionPoint, Event, etc
+ [OWB-772] - typo in exception message wrt passivation capable dependencies
+ [OWB-779] - ScannerService using xbean
+ [OWB-797] - AnnotationManager checks the same annotations again
+ [OWB-819] - check injectable reference for normal-scoped beans
+ [OWB-852] - Improve getContextsService performance
+
+New Feature
+
+ [OWB-321] - Conversation beans could not be populated to non-faces request by a JSF redirect navigation rule
+ [OWB-495] - create a jetty integration plugin
+ [OWB-606] - create bundles for standard use cases like JSF-webapp, standalone, etc
+ [OWB-671] - Automatically register FailOverFilter if failover is activated
+ [OWB-710] - openwebbeans-arquillian container
+ [OWB-756] - implement BeanAttributes and ProcessBeanAttritubes
+ [OWB-830] - Implement Instance#destory
+
+Task
+
+ [OWB-692] - remove ContextsFactory
+ [OWB-726] - upgrade trunk (OWB-1.2.x) to target java 1.6
+ [OWB-781] - Remove all Javassist and Scannotation related parts from OWB
+ [OWB-859] - Remove checkstyle double-checked locking rule
+
+Wish
+
+ [OWB-344] - implement Decorators and Interceptors as subclassing
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.8
+-------------------------------------------
+
+Bug
+
+ [OWB-700] - ProcessInjectionTarget.setInjectionTarget() has no effect when trying to post process beans
+ [OWB-723] - Interceptors doesn't work for beans got from stereotype annotated producer methods
+ [OWB-736] - NPE while removing dependent beans
+ [OWB-742] - @Alternative is ignored when using the Provider interface.
+ [OWB-743] - Overloaded EJB Observer methods fail to deploy
+ [OWB-751] - OWB annotation litterals implementation uses only instanceof in equals implementation
+ [OWB-760] - CLONE - Decorator position not well managed if the decorator is abstract
+ [OWB-761] - position in DelegateHandler shouldn't be static
+ [OWB-785] - WebContextsService isn't compatible with actor-frameworks
+ [OWB-790] - owb-1.1.x - deployment error when a @Specializes bean is disabled via an Extension
+
+New Feature
+
+ [OWB-789] - owb-1.1.x - openwebbeans-arquillian container
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.7
+-------------------------------------------
+
+Bug
+
+ [OWB-711] - Specialization does not deactivate Observer methods in parent class
+ [OWB-713] - Static observer methods of superclasses are not called when a method with the same name and parameters exists in the subclass
+ [OWB-718] - Decorator can't call two methods of the delegate object in the same method
+ [OWB-719] - @Named qualifier is not adhering to CDI spec default naming conventions
+ [OWB-720] - injections using generic not well managed
+ [OWB-722] - @Typed not respected for beans using generics
+ [OWB-724] - Ambiguous producer methods and fields are not detected due to bug in AbstractProducerBean equals and hashCode
+ [OWB-725] - Beans containing a producerMethod are using the wrong CreationalContext
+ [OWB-732] - ClassLoader leak in WebBeansUtil.isScopeTypeNormalCache
+ [OWB-734] - CLONE - AbstractProducer stores CreationalContext
+
+Task
+
+ [OWB-712] - Enable console output for checkstyle
+ [OWB-721] - create a branch for OWB-1.1.x maintenance and switch trunk to 1.2.0-SNAPSHOT
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.6
+-------------------------------------------
+
+Bug
+
+ [OWB-694] - Misleading exception message "Wrong termination object"
+ [OWB-696] - check for unproxyable API types should get moved to the validateBeans phase
+ [OWB-697] - Non-Static Loggers leads to NonSerizializableException
+ [OWB-698] - InjectableBeanManager not serializable
+ [OWB-703] - getBeans cache key algorithm must be unique
+ [OWB-707] - tomcat-sample and tomcat7-sample are just broken.
+ [OWB-708] - PrincipalBean doesn't get found
+ [OWB-709] - webbeans-tomcat6 must honour WEB-INF/classes/META-INF/beans.xml
+
+Improvement
+
+ [OWB-695] - Cause missing in AnnotationDB$CrossReferenceException
+ [OWB-701] - Support ASM for Bean Proxies
+ [OWB-702] - Add serialization unit tests to openwebbeans-web to catch future regressions
+ [OWB-704] - use method filter in javassist proxies instead of "manual" filtering
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.5
+-------------------------------------------
+
+Bug
+
+ * [OWB-498] - Java EE Resource Injections for CDI Interceptors & Decorators
+ * [OWB-605] - tomcat plugins must register WebBeansConfigurationListener as first Listener
+ * [OWB-663] - Maven dependencies between impl and spi
+ * [OWB-666] - invalid check in AnnotationManager#checkStereoTypeClass
+ * [OWB-667] - Bean queries have strange behavior (difference between Open Web Beans and the Reference Implementation)
+ * [OWB-669] - Bean fail over is not in sync with specs
+ * [OWB-672] - Decorators creates Stackoverflow or NPE if under heavy load
+ * [OWB-673] - injecttarget are not updated after ProcessInjectionTarget event
+ * [OWB-676] - CdiTest OwbContainer fails if WebContainerLifecycle is being used
+ * [OWB-677] - improve getBeans cache key algorithm
+ * [OWB-680] - drop unused getInstance() methods from our services
+ * [OWB-681] - remove deprecated methods from BeanManagerImpl
+ * [OWB-682] - get rid of OWB InterceptorType and usejavax.enterprise.inject.spi.InterceptionType instead
+ * [OWB-683] - remove obsolete Methods from our Bean implementations and handlers
+ * [OWB-685] - OwbApplicationFactory doesn't set Application
+ * [OWB-686] - OWBApplicationFactory wrappedApp should be consistent between getter and setter and volatile
+ * [OWB-687] - clean up non-static loggers
+ * [OWB-688] - fix non-serializable fields in Serializable classes
+ * [OWB-689] - OWBInjector should be stateless
+ * [OWB-690] - WebContextsService cleanup should get reworked
+ * [OWB-693] - webbeans-web shall not declare StandaloneResourceInjectionService
+
+Improvement
+
+ * [OWB-674] - rewrite owb logger api
+ * [OWB-684] - move from ancient 'ContextTypes' definition to standadrd scope annotations
+
+Task
+
+ * [OWB-678] - Check for unused classes and remove them
+ * [OWB-691] - Sonar cleanup before the 1.1.5 release
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.4
+-------------------------------------------
+
+Bug
+
+ * [OWB-567] - Lookup of Provider results in NullPointerException on get()
+ * [OWB-574] - NewBean doesn't support EJBs
+ * [OWB-580] - ObserverMethodImpl needs support for EJB's whose Bean Types do not include the EJB class
+ * [OWB-602] - OpenWebBeans OpenEJB integration OSGi bundle declares the wrong version for the javax.transaction package
+ * [OWB-617] - NullPointerException in InstanceBean#createInstance
+ * [OWB-628] - Event injection doesn't work in observer methods.
+ * [OWB-633] - define stereotypes & thirdparty
+ * [OWB-634] - @Interceptors added by extension ignored
+ * [OWB-636] - Samples point to parent pom file that doesn't exist
+ * [OWB-643] - it isn't possible to add/remove @Alternative during the bootstrapping process
+ * [OWB-644] - wrong config entry for LoaderService
+ * [OWB-645] - InjectionPoint is null when using @Produces. NullPointerException caused by CDI container providing a null InjectionPoint into a producer method.
+ * [OWB-646] - Failover does not work (again)
+ * [OWB-648] - regression on tck org.jboss.jsr299.tck.tests.lookup.injectionpoint.InjectableReferenceTest
+ * [OWB-649] - exceptions in EJB's are wrapped in InvocationTargetException
+ * [OWB-655] - CDI doesn´t inject stateless EJB by abstract class.
+ * [OWB-658] - BeanManager.getBeans(Type, Annotation...) can not be used to query all known beans
+ * [OWB-659] - An annotated interface class is being seen as a manage bean.
+ * [OWB-660] - WebBeansContext #activateContext for SessionScoped.class doesn't set the ThreadLocal
+
+Improvement
+
+ * [OWB-596] - Provide info about injetion point for "Passivation capable beans must satisfy passivation capable dependencies ..."
+ * [OWB-604] - more details for exceptions during bootstrapping
+ * [OWB-635] - support callbacks (@PostContrcut, @PreDestroy) in Extensions
+ * [OWB-637] - [perf] ELContextStore.destroyDependents() creates unnecessary HashMap$KeyIterator instances
+ * [OWB-638] - [PERF] Avoid unnecessary AbstractList$Itr instances
+ * [OWB-639] - [perf] InjectionResolver.getBeanCacheKey creates many StringBuilder instances
+ * [OWB-641] - the jee5-ejb-resource module should support @EJB(mappedName)
+ * [OWB-647] - [PERF] Avoid unnecessary StringBuilder instances - improve checkNullInstance, checkScopeType, ... methods
+ * [OWB-653] - remove @ViewScoped support
+ * [OWB-657] - review startup performance
+ * [OWB-661] - hashCode, equals and toString() of our built in Qualifier Literals should be implemented ourselfs
+
+Task
+
+ * [OWB-656] - remove webbeans-openejb
+ * [OWB-662] - remove obsolete class WebBeansAnnotation
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.3
+-------------------------------------------
+
+Bug
+
+ * [OWB-515] - interceptors don't support inheritance without an overridden method annotated with @AroundInvoke
+ * [OWB-565] - missing check for producer methods
+ * [OWB-625] - BeanManager.resolve throw java.util.NoSuchElementException with an empty set parameter
+ * [OWB-629] - NoClassDefFoundError for optional dependencies
+ * [OWB-630] - AmbiguousResolutionException thrown for Decorators that Decorate multiple beans where any of those beans are passivation capable.
+ * [OWB-631] - openwebbeans-resource misses openwebbeans.properties
+
+Improvement
+
+ * [OWB-475] - support for optional beans
+ * [OWB-627] - Automatically destroy @Dependent contextual instances created with Instance<T>
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.2
+-------------------------------------------
+
+Bug
+
+ * [OWB-562] - non-enabled alternative beans with passivating scope fail validation during deployment
+ * [OWB-589] - " ... requires a passivation capable dependency ..." for producer method with return type String and non serializable injected dependency
+ * [OWB-597] - StackOverFlow when injecting product in same bean where @Produces is placed
+ * [OWB-615] - remove @Overrides for interfaces to be java5 compatible
+ * [OWB-616] - javax.el.ExpressionFactory has final methods! CDI doesn't allow that. - Test on final **PRIVATE** methods too?
+ * [OWB-618] - we sometimes invoke a dispose method without having created the bean upfront
+ * [OWB-619] - @New beans must only exist if there is at least one injection point for them
+ * [OWB-620] - any disabled bean of passivating scope will wrongly be detected as 'not passivatable'
+ * [OWB-622] - beanmanager injection in afterBeanDiscovery method parameter
+ * [OWB-624] - AnnotatedTypes registered in BeforeBeanDiscovery might get processed twice
+
+Improvement
+
+ * [OWB-623] - Relax check on @AroundInvoke Interceptors 'throws Exception'
+
+New Feature
+
+ * [OWB-621] - Alternative configuration method for buggy container or pre servlet api 2.5 container
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.1
+-------------------------------------------
+
+Bug
+
+ * [OWB-406] - BaseEjbBean.removedStatefulInstance used by multiple instances/EjbBeanProxyHandlers
+ * [OWB-447] - unnecessary contextual/non-contextual distinction in OpenWebBeansEJBIntercpetor
+ * [OWB-449] - EJB interceptor has incorrect/unnecessary use of business method checks
+ * [OWB-483] - Problem with mulitple custom interceptors and passivation
+ * [OWB-512] - ApplicationContext and SingletonContext in WebContextsService
+ * [OWB-554] - DelegateHandler wraps Beans exceptions
+ * [OWB-558] - PassivationCapable bean id's for Producer Fields do not take into account generics
+ * [OWB-561] - Multiple contexts with the same Scope are not handled properly -- causing tck failures
+ * [OWB-563] - producers of passivating beans fail when the declared return type is not serializable but the actual return type is
+ * [OWB-566] - ProcessInjectionTarget event gets fired too early
+ * [OWB-571] - fix site build under maven3 and upgrade logo
+ * [OWB-573] - Invalid checking of Interceptor serialization capabilities for non-Passivation capable EJBs
+ * [OWB-576] - FileNotFoundException on WebSphere
+ * [OWB-577] - FileNotFoundException on WebSphere
+ * [OWB-578] - Allow DI for OpenWebBeansConfiguration properties
+ * [OWB-579] - check for non-proxyiable methods should exclude synthetic methods
+ * [OWB-581] - Decorator interface check needs configurable exclusions
+ * [OWB-584] - check for declared name consistency for specializes beans is wrong
+ * [OWB-585] - ProcessSessionBean doesn't deal with generic type quite right (CDITCK-215)
+ * [OWB-586] - Interceptors added by portable extensions don't work
+ * [OWB-587] - Use business interface for producer and disposer methods of Session beans
+ * [OWB-588] - PrincipalBean is misspelled
+ * [OWB-590] - Seam Persistence does not work with OWB - AfterBeanDiscovery.addBean will be ignored
+ * [OWB-591] - EJB @Specializes inheritance
+ * [OWB-593] - Interceptor binding added on an interceptor class at ProcessAnnotatedType phase is not considered
+ * [OWB-595] - Use case "Faces Request Generates Non-Faces Response" locks conversation forever (-> BusyConversationException)
+ * [OWB-598] - InjectionResolver crashes with a NPE when injecting a method parameter
+ * [OWB-599] - move getBeanXmls() back to Set<URL>
+ * [OWB-600] - cache information about non intercepted methdos in ProxyHandlers
+ * [OWB-601] - WebContextsService only works if ServletContext is given
+ * [OWB-608] - openwebbeans-el10 plugin misses openwebbeans.properties
+ * [OWB-614] - add LICENSE and NOTICE files to all our samples
+
+Improvement
+
+ * [OWB-555] - ClassUtil methods contain spelling, camelcase, etc., type errors
+ * [OWB-557] - #setAccessible(false) isn't needed
+ * [OWB-560] - upgrade the TCK to 1.0.4.SP1
+ * [OWB-564] - CdiTestOpenWebBeansContainer - check if a std.-context is active before destroying it
+ * [OWB-582] - Support for Java 1.5 (needed for WebSphere 6.1)
+ * [OWB-583] - Support for Servlet API 2.4 (needed for WebSphere 6.1)
+ * [OWB-594] - create a configurable mapping Scope->ProxyMethodHandlerImplementation
+ * [OWB-607] - upgrade our samples to newest available dependencies
+ * [OWB-610] - upgrade to apache parent pom 10
+ * [OWB-611] - adding ASF trademark documentation to our official site build
+ * [OWB-612] - upgrade various maven plugins
+ * [OWB-613] - Exclude Samples WARs Publishing with Maven
+
+Task
+
+ * [OWB-592] - EJB Specialization utility method
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.0
+-------------------------------------------
+
+Bug
+
+ * [OWB-295] - resolve bugs in Javassist Proxy
+ * [OWB-417] - BaseEjbBean.destroyComponentInstance() should call direct container remove API, not call an @Remove annotated method
+ * [OWB-422] - Support needed for PrePassivate, PostActivate, and AroundTimeout via EJBInterceptor.
+ * [OWB-444] - Using Static Loggers in Shared ClassLoader
+ * [OWB-452] - set active flag to false then context is destroyed
+ * [OWB-456] - When multiple interceptors are defined for a bean OWB does NOT correctly remove the overridden base Interceptors
+ * [OWB-469] - JSR299TCK: Security Error / Passivation errors during readObject
+ * [OWB-470] - OWBInjector does not work correctly for EJB Beans
+ * [OWB-471] - Possible StackOverflowException from defineProducerMethods in WebBeansAnnotatedTypeUtil
+ * [OWB-473] - bundles that use javasissist to proxy their contents need to import some javassist packages
+ * [OWB-474] - InjectionTargetBean#injectSuperResources is missing
+ * [OWB-477] - Two instances of using ObjectInputStream that may not have visibility into application classloader
+ * [OWB-480] - Avoid a couple NPEs
+ * [OWB-482] - Small issues
+ * [OWB-486] - ResourceBean tries to proxy final classes before testing them for being final
+ * [OWB-489] - AnnotatedTypes added with BeforeBeanDiscovery.addAnnotatedType method are ignored
+ * [OWB-490] - ProcessObserverMethod Type parameters are inverted (CDITCK-174)
+ * [OWB-491] - Decorators init needs to scan superclasses for more interfaces. cf CDITCK-178
+ * [OWB-492] - events don't get sent to private @Observes methods
+ * [OWB-493] - ProcessProducerMethod and ProcessProducerField type parameters are reversed in filtering (?) CDITCK-168
+ * [OWB-494] - Subclasses with non-overriden observer methods not recognized as beans with observer methods
+ * [OWB-496] - Don't replace the ProxyFactory classloaderProvider without the intention to do so
+ * [OWB-499] - WEB-INF/beans.xml of a war will not activate Bean Archive behaviour
+ * [OWB-502] - Only cache the ContextService once, in the SingletonService
+ * [OWB-504] - OwbApplicationFactory getWrapped should return wrapped application factory
+ * [OWB-505] - OwbApplicationFactory should not be installed by default
+ * [OWB-509] - Unwrap InvocationTargetException in ResourceProxyHandler.invokie
+ * [OWB-510] - return null instead of an unusable proxy if a resource is missing
+ * [OWB-511] - Delegate actualInstance serialization behavior in ResourceProxyHandler
+ * [OWB-514] - Leak in ELContextStore
+ * [OWB-519] - broken wls support
+ * [OWB-521] - ProducerMethodBean could theoretically produce a NPE
+ * [OWB-522] - Missing updateTimeout in one of begin methods for conversation
+ * [OWB-523] - @SessionScoped bean failover does not work
+ * [OWB-524] - OWB classpath scanning of non-jars doesn't work if the classpath contains spaces
+ * [OWB-527] - JspFactory.getDefaultFactory() is synchronized, We can cache the return value to improve performance
+ * [OWB-529] - lazy initialized class members should be volatile
+ * [OWB-530] - multi massive execution of our Interceptor test unveils a concurrency problem
+ * [OWB-531] - cleanup WebBeansELResolver#getValue
+ * [OWB-533] - concurrency bottleneck due to use of our logger
+ * [OWB-534] - Injection of @PersistenceContext does not work with abstract/base classes
+ * [OWB-541] - replace WeakHashMap with a standard one in InterceptorHandler
+ * [OWB-542] - Disposer is called twice on Dependent beans when injected into a managed object that is called from a JSP
+ * [OWB-543] - get rid of checked Exceptions in our SPI
+ * [OWB-545] - Cleanup our SecurityManager integration
+ * [OWB-546] - @Typed gets ignored if we use a AnnotatedType from an Extension @Observing ProcessAnnotatedType
+ * [OWB-547] - WebContextsService throws NPE on asynchronous app startup
+ * [OWB-548] - missing null check in DefaultContextsService#stopApplicationContext
+ * [OWB-550] - duplicated observer methods in case of @Specializes
+
+Improvement
+
+ * [OWB-209] - remove all <repositories> from our poms
+ * [OWB-254] - suppress initialising contextual handling for configurable URIs.
+ * [OWB-335] - implement a sample for @ViewScoped in reservation
+ * [OWB-393] - remove old XML configuration code
+ * [OWB-448] - More changes for decorator and interceptor passivation support
+ * [OWB-461] - source code quality
+ * [OWB-472] - archive centric beans.xml enabling
+ * [OWB-478] - make OWB build maven-3 aware
+ * [OWB-485] - AmbiguousResolutionException doesn't print details about the injection point
+ * [OWB-500] - improved app-server support
+ * [OWB-503] - Reduce static synchronized hashmap usage
+ * [OWB-506] - Upgrade our samples to Apache MyFaces-2.0.3 and OpenJPA-2.0.1
+ * [OWB-507] - our samples should be prepared for EE as default
+ * [OWB-508] - Dependent scope proxies are needed to wrap the build-in beans returned from the services if they are not serializable yet
+ * [OWB-516] - Get TCK standalone 1.0.4 CR2
+ * [OWB-517] - Conversation Log Improvement
+ * [OWB-518] - log all bean-archive markers
+ * [OWB-520] - spi for the webbeans-jee5-ejb-resource plugin
+ * [OWB-525] - create a findbugs filter file in our build-tools resource
+ * [OWB-526] - remove usage of java.net.URLs from ScannerService and drop scannotation
+ * [OWB-535] - free ScannerService resources once we don't need it anymore
+ * [OWB-536] - revisit our Logger usage in our Bean impls
+ * [OWB-537] - clear() AnnotatedElementFactory after the deployment
+ * [OWB-539] - fill AnnotatedTypeImpl lazily
+ * [OWB-540] - StandaloneResourceInjectionService should cache info about classes which don't contain EE resource injection points
+ * [OWB-544] - improve BeanManager#getContext performance
+
+New Feature
+
+ * [OWB-433] - add a configuration flag for switching to a lenient lifecycle interceptor checking
+ * [OWB-501] - owb ee 5 resource integration
+ * [OWB-528] - Use ApplicationWrapper as parent of OwbApplication in JSF 2 plugin
+ * [OWB-532] - create a new BeanManager#isInUse()
+ * [OWB-538] - lazy loading of not explicitly marked (via annotation or registered by extension) Dependent beans
+
+Question
+
+ * [OWB-383] - static fields in CreationalContext
+
+TCK Challenge
+
+ * [OWB-484] - Running TCK 1.0.1 Final and Respective Corrections
+
+Task
+
+ * [OWB-19] - Geronimo Integration
+ * [OWB-428] - implementation of equals and hashCode for AbstractOwbBean
+ * [OWB-453] - add a flag to disable context activation in EJB interceptor
+
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0
+-------------------------------------------
+
+Bug
+
+ * [OWB-318] - multiple methods with same EJB @interceptors(foo.class) in same bean class get multiple interceptor instances
+ * [OWB-384] - OWB needs to call 299-defined PrePassivate, PostActivate, and AroundTimeout interceptors for EJBs
+ * [OWB-422] - Support needed for PrePassivate, PostActivate, and AroundTimeout via EJBInterceptor.
+ * [OWB-429] - OpenWebBeansEjbPlugin Class Hierarchy
+ * [OWB-438] - Cached Normal Scoped Proxy instances
+ * [OWB-439] - EjbPlugin session bean proxy creation thread safe problem
+ * [OWB-445] - we must not use javassist ProxyFactory#setHandler(MethodHandler)
+ * [OWB-446] - EJB lifecycle callbacks not stacked correctly
+ * [OWB-450] - NullPointerException in DependentScopedBeanInterceptorHandler when it has a NullCreationalContext (normally from a EE component).
+ * [OWB-454] - ClassUtil.callInstanceMethod() doesn't propogate original exception
+ * [OWB-455] - IllegalArgument method calling remove method of EJB during destroy
+ * [OWB-456] - When multiple interceptors are defined for a bean OWB does NOT correctly remove the overriden base Interceptors
+ * [OWB-457] - we must not create a SessionContext for static resource reqeusts
+ * [OWB-460] - fix owb-openejb and owb-ejb artifactIds
+ * [OWB-464] - InjectionPointImpl using wrong class loader during serialize/deserialize, dropping qualifiers, and omiting qualifier values.
+ * [OWB-466] - Ensure removal of all ThreadLocal values
+
+Improvement
+
+ * [OWB-177] - Handling of InterceptionType#POST_ACTIVATE, PRE_PASSIVATE and AROUND_TIMEOUT is missing
+ * [OWB-407] - detailed information about exceptions
+ * [OWB-451] - Allow InterceptorUtil#callAroundInvokes to propogate a callers 'creational context key'
+ * [OWB-459] - upgrade to newer library versions
+ * [OWB-463] - EjbDefinitionUtility.defineEjbBeanProxy() should be able to create proxies for no-interface local beans
+ * [OWB-465] - enhance EJB common code for crude @LocalBean support
+
+TCK Challenge
+
+ * [OWB-394] - Any idea why our BeforeBeanDiscovery.addInterceptorBinding() has different signature?
+
+Task
+
+ * [OWB-453] - add a flag to disable context activation in EJB interceptor
+ * [OWB-462] - Refactor AnnotationUtil.hasAnnotationMember()
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0-alpha-2
+-------------------------------------------
+Bug
+
+ * [OWB-303] - upgrade Javassist to a newer version
+ * [OWB-338] - our internal SessionContext and ConversationContext must support Session serialization
+ * [OWB-385] - implement passivation of managed beans in ServletContextListener
+ * [OWB-401] - ELContextStore not cleaned up for some JSP EL lookups
+ * [OWB-402] - OpenWebBeansJsfPlugin does not recognize @ManagedBean
+ * [OWB-404] - Contexts must not get stored in a static Map in BeanManager
+ * [OWB-405] - AnnotatedElementFactory must not use static cache maps
+ * [OWB-408] - NPE in WebBeansELResolver
+ * [OWB-415] - EjbBeanProxyHandler for dependent ejb must save ejb instance
+ * [OWB-416] - BaseEJBBean.destroyComponentInstance() tries to call multiple remove methods
+ * [OWB-418] - EjbBeanProxyHandler must be 1:1 with proxy instances for dependent SFSB
+ * [OWB-419] - fix @Dependent handling in ELResolver
+ * [OWB-420] - SingletonContext is mapped to @ConversationScoped
+ * [OWB-421] - defined-in-class EJB lifecycle callbacks masked by our Interceptor
+ * [OWB-426] - Tweak EJBPlugin to work with Standalone Tests
+ * [OWB-431] - Generic Type Inheritance not resolved correctly
+ * [OWB-434] - ThreadLocal<SingletonContext> doen't get cleaned up
+ * [OWB-436] - AbstractContext bean instance creation is not thread safe
+ * [OWB-437] - Improve AbstractContext synchronization
+ * [OWB-440] - WebBeansDecoratorConfig.getDecoratorStack always returns new Decorators
+ * [OWB-442] - our EJB proxies are broken when multiple local interfaces are used on a single class
+ * [OWB-443] - Normal-scoped EJB not removed by container during Contextual.destroy()
+
+Improvement
+
+ * [OWB-57] - cleanup problems found by maven-findbugs-plugin
+ * [OWB-195] - Give warning to the developer related with non- portable operations
+ * [OWB-409] - create a name for OWB our faces-config.xml
+ * [OWB-410] - lazy initialisation of ejbInterceptors
+ * [OWB-411] - cache calls to isNormalScope()
+ * [OWB-412] - Allow container specific extensions to WebConfigurationListener access to the lifecycle
+ * [OWB-413] - cache calls to ClassUtils#getObjectMethodNames()
+ * [OWB-414] - improve Interceptor performance
+ * [OWB-425] - improve performance of owb-el-resolver
+ * [OWB-427] - improve read-performance of AbstractOwbBean
+ * [OWB-430] - improve performance of WebBeansPhaseListener
+ * [OWB-432] - Create Singleton Service SPI
+ * [OWB-441] - new configuration properties mechanism
+
+Sub-task
+
+ * [OWB-193] - If an interceptor or decorator has any scope other than @Dependent, non-portable behavior results.
+ * [OWB-194] - If an interceptor or decorator has a name, non-portable behavior results.
+ * [OWB-196] - If an interceptor or decorator is an alternative, non-portable behavior results.
+ * [OWB-197] - If a stereotype declares any other qualifier an- notation, non-portable behavior results.
+ * [OWB-198] - If a stereotype is annotated @Typed, non-portable behavior results.
+
+
+TCK Challenge
+
+ * [OWB-424] - Adding Document for How to Configure and Run TCK (standalone and web profile TCKs)
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0-alpha-1
+-------------------------------------------
+Bug
+
+ * [OWB-216] - Update pom.xml svn links
+ * [OWB-231] - exception using abstract decorators
+ * [OWB-245] - Using parameterized type varaibles fails for Producer Method injection
+ * [OWB-259] - Implement spec 11.5.5. ProcessModule event
+ * [OWB-289] - Owb return 2 beans for Indirect specialized producer beans
+ * [OWB-302] - InjectionPoint injections (both method and field based) in Decorators result in null
+ * [OWB-312] - Add dopriv's to allow OWB to function with java 2 security enabled
+ * [OWB-317] - creationalContext in InvocationContextImpl is always null
+ * [OWB-318] - multiple methods with same EJB @interceptors(foo.class) in same bean class get multiple interceptor instances
+ * [OWB-327] - annotating an Interceptor with @ApplictionScoped leads to OutOfMemory
+ * [OWB-329] - Interceptor instances get created each time the interceptor gets called
+ * [OWB-332] - Destroy Depdent Of Producer Method Beans when Invocation Completes
+ * [OWB-333] - InjectionTarget and Producer Handling
+ * [OWB-334] - cid is missing when using redirect for a jsf 2.0 application
+ * [OWB-336] - injected BeanManager must be Serializable
+ * [OWB-337] - events must not get broadcasted to beans which have no active Context
+ * [OWB-339] - Injecting Non-Contextual Beans Causes NPE in WebBeansUtil
+ * [OWB-340] - BeanManagerImpl.createInjectionTarget() Throws Exception When No Constructor Found
+ * [OWB-341] - CreationalContext#incompleteInstance should get cleaned after create()
+ * [OWB-342] - InterceptorHandler crashes with NullPointerException after deserialisation
+ * [OWB-343] - upgrade JPA spec from 1.0-PFD2 to 1.0 final revision
+ * [OWB-345] - Remove duplicate dependencies
+ * [OWB-351] - OWB picks up @SessionScoped contextual instances from expired sessions
+ * [OWB-352] - Thread Safety Problem in our InterceptorHandlers, aka proxies
+ * [OWB-353] - NPE in removeDependents@CreationalContextImpl
+ * [OWB-354] - WebContextService may throw NPE in tiered classloading environmemt
+ * [OWB-357] - WebbeansFinder should index first on ClassLoader, not singleton type
+ * [OWB-359] - ownerCreationalContext sometimes causes NPE in InterceptorDataImpl.createNewInstance()
+ * [OWB-361] - underlying EJB method not actually in our interceptors stack
+ * [OWB-362] - InvocationTargetException when invoking Stateless SessionBean
+ * [OWB-363] - Intermittent bug with ApplicationScope disposers not being called
+ * [OWB-366] - ContextNotActiveException fired from AppScope/NormalScopedBeanInterceptorHandler when a proxied object finalized
+ * [OWB-368] - The 299 spec (that I have) uses receive=IF_EXISTS but OWB uses notifyObserver=IF_EXISTS.
+ * [OWB-369] - Static ContextsService in ContextFactory causes wrong webContextService used for multiple applications
+ * [OWB-370] - Intransient Conversation context get rdestroyed randomly by destroyWithRespectToTimout
+ * [OWB-371] - no lifecycle interceptors for non-contextual EJB
+ * [OWB-372] - creational context not cleaned up for non-contextual EJB interceptions
+ * [OWB-373] - build crashes with missing artifact error
+ * [OWB-374] - migrate jsf2sample from sun to MyFaces
+ * [OWB-376] - [patch] Guess example broken with Jetty plugin 6.x due to EL 2.2
+ * [OWB-377] - revise logging
+ * [OWB-378] - ejb at bottom of decorator stack doesn't handle changed method
+ * [OWB-380] - NormalScopedBeanInterceptorHandler throws NPE when handling 3rd party Contexts
+ * [OWB-381] - NPE thrown from AbstractInjectable if dependent producer returns null
+ * [OWB-382] - injecting a @Dependent bean into a passivatation scoped bean causes a NonSerializableException
+ * [OWB-387] - DependentContext Interceptor Double Call for PostConstruct
+ * [OWB-390] - fix broken links in our 'site'
+ * [OWB-396] - fix poms to work with maven 3
+ * [OWB-398] - DelegateHandler cached too agressively
+ * [OWB-399] - Proxy objects could not be correctly deserialized by using javassist 3.11. we need to update to 3.12
+ * [OWB-400] - starting OWB as part of an EAR in geronimo causes a exception due to missing 'bundle' protocol
+
+Improvement
+
+ * [OWB-116] - Update Business Method Definition
+ * [OWB-118] - Supports Decorators for Other Delegate Injections
+ * [OWB-136] - fix 'broken' license headers in our java files
+ * [OWB-170] - Address findbug issues in webbeans-impl
+ * [OWB-183] - Improve webbeans-doc module to get a documentation more user friendly
+ * [OWB-214] - get rid of javax.transaction.Transaction dependency in webbeans-impl
+ * [OWB-237] - NoSuchElementException when WebBeansConfigurationListener is absent
+ * [OWB-275] - remove unused imports and cleanup code
+ * [OWB-286] - java.lang.NoClassDefFoundError: javax/validation/Validator
+ * [OWB-313] - create caching strategies for resolving Bean<T> for BeanManager and EL invocations
+ * [OWB-314] - cache resolved instances in NormalScopedBeanMethodHandlers of @ApplicationScoped beans
+ * [OWB-315] - cache resolved instances in NormalScopedBeanMethodHandlers of @SessionScoped beans
+ * [OWB-319] - Strange logging when writing non-Serializable SessionScoped bean
+ * [OWB-320] - Remove Java EE Dependencies from WebBeans Core
+ * [OWB-322] - Create new EJB project and separate common EJB classes from OpenEJB plugin
+ * [OWB-325] - Relocate SPI Classes to SPI Module. Change JSR299, JSR330 as optional pom dependency.
+ * [OWB-326] - improve producer tests
+ * [OWB-328] - improve logger performance
+ * [OWB-330] - reduce BeanManagerImpl#getManager() calls inside the same functions
+ * [OWB-331] - Cache Interceptor & Decorator Stack oon Interceptor Handler
+ * [OWB-346] - Make EJB samples running
+ * [OWB-347] - Using InjectableBeanManager in TCK
+ * [OWB-349] - ignore exception during type hierarchy scan
+ * [OWB-350] - Support Interceptor for non-contextual EJBs
+ * [OWB-355] - OpenEjbBean should look for @Remove methods
+ * [OWB-356] - EjbPlugin only looks for DeployementInfo once, so new deployed application won't be discovered
+ * [OWB-358] - provide property to skip injection in @PostConstruct of OpenWebBeansEjbInterceptor
+ * [OWB-360] - Add BeanManager to a ServletContext attribute
+ * [OWB-364] - Reduce the amount of info level logging
+ * [OWB-365] - make injection optional in OWBEJBInterceptor
+ * [OWB-375] - Performance: OWB logging performs operations when logging disabled.
+ * [OWB-379] - upgrade to final atinject-spec artifact
+ * [OWB-386] - upgarde CDI TCK to 1.0.2.CR1
+ * [OWB-389] - atinject-tck upgrade to final 1.0 release
+ * [OWB-397] - Add helper method and some debug to WebBeansFinder
+
+New Feature
+
+ * [OWB-316] - Implement a generic TestContainer for CDI implementations
+ * [OWB-323] - Provide methods to pass classloader into ServiceLoader and WebBeansFinder for use in tiered classloader situations
+ * [OWB-324] - Add Tomcat Plugin
+ * [OWB-348] - Adding Interceptor and Decorator Support for EJB Beans
+ * [OWB-395] - OpenWebBeans Tomcat 7 Support
+
+TCK Challenge
+
+ * [OWB-388] - Pass TCK 1.0.2 CR1 Web Profile
+
+Task
+
+ * [OWB-6] - Scope passivation
+ * [OWB-14] - Update WebBeans Lifecycle for Servlet Beans
+ * [OWB-46] - Injection into non-contextual objects
+ * [OWB-204] - Update Samples for JSF2 Usage
+ * [OWB-220] - Update site.xml links and bread crumbs to point to non-incubator.
+ * [OWB-310] - Drop dom4j and use jre builtin xml parsers for processing beans.xml
+ * [OWB-391] - create a owb-build-tools project to maintain project specific checkstyle rules, etc.
+
+Test
+
+ * [OWB-56] - Integrate the official JSR-299 TCK test suite
+ * [OWB-222] - Update website download link, and fix relative URL translation
+ * [OWB-367] - Add a unit test for IF_EXISTS
+
+
+----------------------------------------------
+Required Platform
+----------------------------------------------
+Java Version : Java SE >= 5.0
+Java EE Must : Java EE >= 5.0
+
+---------------------------------------------
+How to Configure OpenWebBeans
+---------------------------------------------
+
+This section explains a content of the distribution bundle, OWB plugins and its
+dependent libraries.
+
+---------------------------------------------
+1.1.6 Distribution Content
+---------------------------------------------
+There are several jars in the OpenWebBeans 1.0.0 distribution;
+
+ - openwebbeans-impl-1.1.6.jar --> Includes Core Dependency Injection Service.
+ - openwebbeans-ejb-1.1.6.jar --> EJB Plugin(Supports EJBs in OpenEJB embedded in Tomcat).
+ - openwebbeans-jms-1.1.6.jar --> JMS Plugin(Supports injection of JMS related artifacts,i.e, ConnectionFactory, Session, Connection etc.)
+ - openwebbeans-jsf-1.1.6.jar --> JSF-2.0 Plugin(JSF Conversation Scoped Support).
+ - openwebbeans-jsf12-1.1.6.jar --> JSF-1.2 Plugin(JSF Conversation Scoped Support).
+ - openwebbeans-resource-1.1.6.jar --> Java EE Resource Injection for Web Projects (Includes @PersistenceContext,@PersistenceUnit
+ and @Resource injection into the Managed Beans. @Resource injections use java:/comp/env of the
+ Web application component. @PersistenceContext is based on extended EntityManager.
+ - openwebbeans-spi-1.1.6.jar --> OpenWebBeans Server Provider Interfaces. They are implemented by runtime environments that would
+ like to use OpenWebBeans as a JSR-299 implementation.
+ - samples --> Includes source code of the samples. Samples are mavenized project therefore you can easily build and run
+ them from your environment that has maven runtime.
+ - openwebbeans-osgi-1.1.6.jar --> ClassPath ScannerService SPI implementation for OSGI environments like Apache Geronimo-3
+ - openwebbeans-web-1.1.6.jar --> Basic Servlet integration
+ - openwebbeans-tomcat6-1.1.6.jar --> Support for deeper integration into Apache Tomcat-6
+ - openwebbeans-tomcat7-1.1.6.jar --> Support for deeper integration into Apache Tomcat-7
+
+
+
+
+------------------------------------------
+How OWB Plugins Work
+------------------------------------------
+
+OpenWebBeans has been developed with a plugin architecture. The Core dependency injection service
+is provided with openwebbeans-impl. If you need further service functionality,
+you have to add respective plugin jars into the application classpath. OpenWebBeans
+uses the Java SE 6.0 java.util.ServiceLoader mechanism to pickup plugins at runtime.
+If you run under Java SE 5.0, an similar hand written implementation will be used.
+Please do not confuse OWB plugins with portable Extensions! OWB plugins are for
+internal use only whereas portable CDI Extensions will run on any JSR-299 container.
+
+Current Plugins:
+---------------------
+Look at "1.1.6 Distribution Content" above.
+
+------------------------------------------
+Dependent Libraries
+------------------------------------------
+
+Third Party jars:
+-----------------
+They are necessary at runtime in the Core Implementation.
+
+javassist : Version 3.12.0.GA
+scannotation : Version 1.0.2 (if not running in an OSGi environment like Apache Geronimo-3)
+
+Java EE APIs jars(Container Provider Libraries) :
+-------------------------------------------------
+Generally full Java EE servers provides these jars. But web containers like Tomcat or Jetty
+do not contain some of them, such as JPA, JSF, Validation API etc. So, if you do not want to bundle
+these libraries within your application classpath, you have to include these libraries in your
+server common classpath.
+
+jcdi-api (JSR-299 Specification API)
+atinject-api (JSR-330 Specification API)
+servlet-2.5 or servlet 3.0 (Servlet Specification API)
+ejb-3.1 (EJB Specification API)
+el-2.2 (Expression Langauge Specification API)
+jsf-2.0 (Java Server Faces API)
+jsr-250 (Annotation API)
+interceptor-1.1 (Interceptor API)
+jta-1.1 (Java Transaction API)
+jsp.2.1 or jsp-2.2 (Java Server Pages API)
+jpa-2.0 (Java Persistence API)
+jaxws-2.1 or jaxws-2.2 (Java Web Service API)
+jms-1.1 or jms-1.2 (Java Messaging Service API)
+validation (Validation Specification)
+
+Dependencies of OpenWebBeans Maven Modules&Plugins
+--------------------------------------------------
+
+openwebbeans-impl :
+------------------
+Third party : javassist, scannotation, openwebbeans-spi
+Container Provided : jcdi-api, at-inject, servlet, el, jsr-250, interceptor, jta, jsp, validation
+
+openwebbeans-ejb:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : OpenWebBeans EJB plugin is based on OpenEJB in Tomcat. Therefore, if you install OpenEJB
+ within Tomcat correctly, there is no need to add any additional libraries. Look at the
+ OpenEJB in Tomcat configuration section.
+
+openwebbeans-jms:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : jms
+
+openwebbeans-jsf:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : jsf
+
+NOTE : We are trying to decrease dependent libraries of the our core, i.e, openwebbeans-impl.
+At 1.1.6, dependent third party libraries will be decreased. We have a plan to create profile
+plugins, therefore each profile plugin provides its own dependent libraries. For example, in
+fully Java EE Profile Plugin, Transaction API is supported but this will not be the case
+for Java Web Profile Plugin or Java SE Profile Plugin. Stay Tuned!
+
+Currently, as you have seen above, openwebbeans-impl depends on some Java EE/Runtime
+provided libraries (servlet, jsp, el etc). In the future, with OpenWebBeans profiling support,
+openwebbeans-impl will not depend on any Java EE APIs. Those APIs will be provided
+by OpenWebBeans profiles/plugins that openwebbeans-impl will be used. Therefore,
+you will able to use OpenWebBeans in your own runtime environment easily by writing
+your own plugins and contributing it to OpenWebBeans :)
+
+------------------------------------------
+Library Configuration
+------------------------------------------
+To run openwebbeans applications in the Java EE based application server,
+you could add the JSR-299 API and JSR-330 API into the server common classpath, and
+implementation, plugins and dependent jars into your "WEB-INF/lib" directory
+of the Java EE Web Application.
+
+In this release, we can not support the OpenWebBeans as an integrated
+functionality of the Java EE Application Servers. So, you have to manage the
+configuration of the OpenWebBeans within your application's "web.xml" file. A sample "web.xml"
+file can be found in the "config" directory. To use EJB functionality, you also have to
+add OWB specific interceptor into your EJB beans. Look at the EJB section of this readme
+for further details.
+
+---------------------------------------------
+OpenWebBeans Properties File
+---------------------------------------------
+OpenWebBeans uses a default configuration file to configure some of its
+properties. Default configuration files are embedded into OWB implementation
+jar files. Instead of opening the jars file and changing configuration properties, simply add
+an "openwebbeans.properties" file into a "META-INF/openwebbeans" folder of your application
+classpath. This will override the values from the default configuration.
+You can specify a property 'configuraion.ordinal' in this file to define the overlay order.
+A properties file with higher 'configuration.ordinal' value will applied later and thus
+have a higher precedence. If you don't specify a 'configuration.ordinal' a value of 100 is assumed;
+This allows to have multiple openwebbeans.properties files e.g. a common one in an EAR lib
+(with configuration.ordinal=100) and more specific ones for each WebApp in your EAR (with a
+configuration.ordinal of e.g. 101).
+
+Each plugin developer can provide their own SPI implementation class and own configuration values. If you would like
+to use those implementation classes or configuration values, you have to override the default configuration file as explained
+in the above paragraph, i.e, putting "openwebbeans.properties" file into "META-INF/openwebbeans" folder of your application.
+It is recommended to use a 'configuration.ordinal' between 50 and 99 for custom SPI implementations.
+
+Below are OpenWebBeans' default configuration properties from our openwebbeans-impl.jar file and our plugins such as
+our OpenEJB plugin.
+
+Override default value of ResourceInjectionService
+-------------------------------------------------
+org.apache.webbeans.spi.ResourceInjectionService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService
+
+OpenWebBeans uses the "OpenEjbResourceInjectionService" class to inject resources into the managed bean instances.
+
+Configuration Names and Their Default Values :
+
+- "org.apache.webbeans.spi.ContainerLifecycle"
+ Description : Implementation of org.apache.webbeans.spi.ContainerLifecycle. All magic starts from here.
+ Values : org.apache.webbeans.lifecycle.DefaultLifecycle, OR CUSTOM
+ Default : org.apache.webbeans.lifecycle.DefaultLifecycle
+
+- "org.apache.webbeans.spi.JNDIService"
+ Description : Configures JNDI provider implementation.
+ Values : org.apache.webbeans.spi.se.DefaultJndiService OR CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultJndiService
+
+- "org.apache.webbeans.spi.conversation.ConversationService"
+ Description : Implementation of conversation.
+ Values : org.apache.webbeans.spi.conversation.jsf.DefaultConversationService OR CUSTOM
+ Default : org.apache.webbeans.spi.conversation.jsf.DefaultConversationService
+
+- "org.apache.webbeans.spi.ScannerService"
+ Description : Default implementation of org.apache.webbeans.spi.ScannerService. It is used for scanning application deployment
+ for finding bean classes and configuration files.
+ Values : org.apache.webbeans.spi.ee.deployer.DefaultScannerService OR CUSTOM
+ Default : org.apache.webbeans.spi.ee.deployer.DefaultScannerService
+
+- "org.apache.webbeans.spi.SecurityService"
+ Description : Implementation of org.apache.webbeans.spi.SecurityService. It is used for getting current "Principal".
+ Values : org.apache.webbeans.spi.se.DefaultSecurityService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultSecurityService
+
+- "org.apache.webbeans.spi.ValidatorService"
+ Description : Implementation of org.apache.webbeans.spi.ValidatorService. It is used for getting "ValidatorFactory" and "Validator".
+ Values : org.apache.webbeans.spi.se.DefaultValidatorService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultValidatorService
+
+- "org.apache.webbeans.spi.TransactionService"
+ Description : Implementation of org.apache.webbeans.spi.TransactionService. It is used for getting "TransactionManager" and "Transaction".
+ Values : org.apache.webbeans.spi.se.DefaultTransactionService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultTransactionService
+
+- "org.apache.webbeans.spi.ResourceInjectionService"
+ Description : Implementation of org.apache.webbeans.spi.ResourceInjectionService. It is used for injection Java EE enviroment resource into the
+ Managed Bean instances.
+ Values : org.apache.webbeans.se.DefaultResourceInjectionService or CUSTOM
+ Default : org.apache.webbeans.se.DefaultResourceInjectionService
+
+- "org.apache.webbeans.spi.JNDIService.jmsConnectionFactoryJndi"
+ Description : Configures JMS ConnectionFactory object jndi name
+ Values : Server specific JNDI name
+ Default : ConnectionFactory
+
+- "org.apache.webbeans.conversation.Conversation.periodicDelay"
+ Description : Conversation removing thread periodic delay
+ Values : Configured in millisecond
+ Default : 150000 ms
+
+- "org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService"
+ Description : Use EJB functionality or not. If use OpenEJB configures to true
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.spi.FailOverService"
+ Description : Implementation of the org.apache.webbeans.spi.FailOverService. It is used for enabling passivation/failover beans.
+ Values : org.apache.webbeans.web.failover.DefaultOwbFailOverService or CUSTOM
+ Default : org.apache.webbeans.web.failover.DefaultOwbFailOverService
+
+- "org.apache.webbeans.web.failover.issupportfailover"
+ Description : Support failover of beans or not
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.web.failover.issupportpassivation"
+ Description : Support passivation of beans or not
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.forceNoCheckedExceptions"
+ Description : The interceptors spec defines that @PostConstruct & Co must not throw checked Exceptions. Setting this configuration to 'false' disables this check.
+ Values : false, true
+ Default : true
+
+- "org.apache.webbeans.spi.SecurityService"
+ Description : Service to provide methods which must be guarded via doPrivileged blocks.
+ Values : org.apache.webbeans.corespi.security.SimpleSercurityService or org.apache.webbeans.corespi.security.ManagedSecurityService
+ Default : org.apache.webbeans.corespi.security.SimpleSercurityService
+
+
+---------------------------------------------
+EJB Support via Embeddable OpenEJB Container in Tomcat 6.X
+---------------------------------------------
+
+Configuration Steps:
+--------------------------------------------
+1* Download Tomcat 6.X version
+2* Configure OpenEJB. Look at URL http://openejb.apache.org/tomcat.html for installation.
+3* Copy JSR-330 API to Tomcat /lib folder.
+4* Copy JSR-299 API to Tomcat /lib folder
+5* Put all dependent libraries of the OpenWebBeans OpenEJB Plugin
+ - openwebbeans-ejb
+ - openwebbeans-impl and its dependencies
+
+You could look at ejb-sample.war for "WEB-INF/lib" libraries as an example to develop custom applications.
+The source of this project is also available.
+
+To use EJB functionality, you will use OpenEJB collapse-ear support. In this configuration,
+your EJB beans live within your "war" bundle.
+
+How to Develop EJB Applications
+---------------------------------------------
+1* Add "META-INF/openwebbeans.properties" into your application classpath.
+2* Add "org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService=true" to use EJB functionality.
+ So OWB container looks for EJBs.
+3* Add "org.apache.webbeans.resource.spi.ResourceService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService to
+use OpenEJB Resource injections.
+4* Add "openwebbeans-ejb", plugin into your web application classpath.
+5* If you want to use other plugins, add respective plugins into your application classpath. For example, if you wish to use
+JSF framework, you add "openwebbeans-jsf" plugin.
+6* Add OWB related interceptor into your EJB Beans. This is called "org.apache.webbeans.ejb.interceptor.OpenWebBeansEjbInterceptor"
+This is needed for OWB injections.
+7* Update your application's "web.xml" to add OWB specific configuration.
+
+---------------------------------------------
+How to Run Samples
+---------------------------------------------
+
+In this release, there are several sample applications located in the "/samples" directory
+of the distribution. You can run those samples via simple maven command.
+
+1) "Guess Application" : Simple usage of the OWB + JSF.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+2) "Hotel Reservation Application" : Show usage of JSF + JPA + OWB
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+3) "EJB Sample Application" : Shows the usage of EJBs with embeddable OpenEJB in Tomcat. Firstly
+configure OpenEJB with Tomcat as explained above.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+4) "EJB Telephone Application" : Shows the usage of OpenEJB resource injection service.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+5) "JMS Injection Sample" : Show JMS injections. JMS injection currently uses
+ ConnectionFactory as JMS connection factory jndi name. You can change this
+ via configuration file. Look above explanation for how to configure JMS jndi. Also,
+ JMS injection requires to use of a JMS provider. Generally Java EE servers contains
+ default JMS provider. It can be run on JBoss and Geronimo. It uses Queue with jndi_name = "queue/A".
+ So you have to create a queue destination in your JMS provider with name "queue/A" to run example.
+ If you want to change queue jndi name, then look at source and change it from "WEB-INF/beans.xml" file.
+
+6) "Conversation Sample" : Shows usage of JSF conversations.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+7) "JSF2 Sample" : Shows usage of JSF2 Ajax.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section. It requires
+to use JSF2 runtime.
+
+
+8) "Standalone Sample" : Shows usage of OpenWebBeans in Standalone Swing Application.
+Look at "OpenWebBeans in Java SE" section.
+
+Configuring and Running the Applications:
+--------------------------------------------
+See section Compile and Run Samples via Jetty&Tomcat Plugin.
+
+--------------------------------------------
+Maven Install and Package From the Source
+--------------------------------------------
+
+Maven Version : Apache Maven 2.2.1 or later
+
+First you have to download the "source" version of the OpenWebBeans project that
+contains the all source code of the OpenWebBeans.
+
+To install the Maven artifacts of the project from the source, Maven must be installed
+in your runtime. After Maven installation, just run the following command in the top level
+directory that contains the main "pom.xml" :
+
+> mvn clean install
+
+This command will install all the Maven artifacts into your local Maven repository.
+
+If you wish to package all artifacts of the project, just run the following command
+in in the top level directory that contains the main "pom.xml" :
+
+> mvn clean package
+
+This command will package the project artifacts from the source and put these artifacts into the each modules
+respective "target" directory.
+
+-------------------------------------------
+Compile and Run Samples via Tomcat&Jetty Plugin
+-------------------------------------------
+This section shows how to run samples in Jetty or OpenEJB Embedded Tomcat.
+
+------------------------------------------
+Samples Run within Jetty Plugin
+------------------------------------------
+You can compile and run "guess","jsf2","conversation-sample" and "reservation "samples via maven Jetty plugin.
+Go to the source bundle "samples/" directory. In the "guess/" or "reservation/" directory, run
+the following maven commands. It will start up maven Jetty container. It bundles all of the
+required jars into the WEB-INF/lib folder. You are not required to add any jar to the classpath.
+
+Samples : Guess and Reservation
+------------------------------
+Go to the source folder of projects and run
+
+> mvn clean install -Pjetty
+> mvn jetty:run -Pjetty
+
+Guess URL : http://localhost:8080/guess
+Reservation URL : http://localhost:8080/reservation
+
+Samples : Conversation Sample and JSF2
+-------------------------------------
+Go to the source folder of projects and run
+
+>mvn clean install
+>mvn jetty:run
+
+Conversation Sample URL : http://localhost:8080/conversation-sample
+JSF2 Sample URL : http://localhost:8080/jsf2sample
+
+------------------------------------------
+Samples Run within Tomcat Plugin
+------------------------------------------
+OpenEJB samples are run with Maven Tomcat Plugin.
+
+Tomcat Plugin uses http://localhost:8080/manager application to deploy war file
+into your embeddable EJB Tomcat container. There must be an tomcat-users.xml
+file in the "conf" directory of the server that contains manager role and username.
+
+>Start Tomcat server if not started
+>mvn tomcat:deploy
+
+Ejb Sample URL : http://localhost:8080/ejb-sample
+Ejb Telephone URL : http://localhost:8080/ejb-telephone
+
+Example tomcat-users.xml file
+------------------------------------------
+<tomcat-users>
+<role rolename="manager"/>
+<user username="admin" password="" roles="manager"/>
+</tomcat-users>
+
+-----------------------------------------
+Deploy JMS Sample
+-----------------------------------------
+Simple drops jms-sample.war file into your application deploy location.
+
+JMS Sample Example URL : Hit the url http://localhost:8080/jms-sample/sender.jsf for sending JMS messages
+ Hit the url http://localhost:8080/jms-sample/receiver.jsf for receiving JMS messages
+
+-----------------------------------------
+OpenWebBeans in Java SE
+----------------------------------------
+OpenWebBeans can be used in Java SE environments such as Java Swing
+applications. A Standalone Sample is provided to show how to use OpenWebBeans
+in Java SE.
+
+Go to the source directory of the standalone sample:
+>mvn clean package;
+>cd target;
+>jar -xvf standalone-sample.jar
+>java -jar standalone-sample-1.1.6-SNAPSHOT.jar
+>Enjoy :)
+
+-----------------------------------------------
+OpenWebBeans User and Development Mailing Lists
+-----------------------------------------------
+Please mail to the user mailing list with any questions or advice
+about the OpenWebBeans.
+
+User Mailing List : [users@openwebbeans.apache.org]
+
+You can also join the discussions happening in the dev list
+
+Dev Mailing List : [dev@openwebbeans.apache.org]
+
+-------------------------------------------
+OpenWebBeans JIRA Page
+-------------------------------------------
+Please logs bugs into the "https://issues.apache.org/jira/browse/OWB".
+
+------------------------------------------
+OpenWebBeans Wiki and Blog Page
+-----------------------------------------
+Wiki: http://cwiki.apache.org/OWB/
+Introduction to OpenWebBeans : http://cwiki.apache.org/OWB/introduction-to-openwebbeans.html
+Blog : http://blogs.apache.org/owb
+
+-----------------------------------------
+OpenWebBeans Web Page
+----------------------------------------
+You can reach the OpenWebBeans web page at
+http://openwebbeans.apache.org
+---------------------------------------
+
+Your Apache OpenWebBeans Team
+
+Enjoy!
diff --git a/owb_1.2.x/readme/README_1_0_0-alpha-1.txt b/owb_1.2.x/readme/README_1_0_0-alpha-1.txt
new file mode 100644
index 0000000..f412ff2
--- /dev/null
+++ b/owb_1.2.x/readme/README_1_0_0-alpha-1.txt
@@ -0,0 +1,616 @@
+-------------------------------
+Apache OpenWebBeans 1.0.0-alpha-1
+-------------------------------
+Welcome! Thanks for downloading and using OpenWebBeans.
+This document is a "Getting Started Guide" for OpenWebBeans.
+
+This document is based on the 1.0.0-alpha-1 release of the OpenWebBeans.
+
+NOTE : Final release version of OpenWebBeans will be 1.0.0.
+
+--------------------------------
+What is Apache OpenWebBeans?
+--------------------------------
+OpenWebBeans is an ASL 2.0-licensed implementation of the JSR-299, Contexts and Dependency Injection for the Java EE platform.
+
+Project's web page can be found at:
+"http://openwebbeans.apache.org"
+
+--------------------------------
+OpenWebBeans 1.0.0-alpha-1 Release Features
+--------------------------------
+
+- 1.0.0-alpha-1 release supports the following features
+-----------------------------------
+* Managed Beans Support
+* Session Beans Support (via Embeddable OpenEJB container in Tomcat)
+* Producer Method Support
+* Producer Field Support
+* Java EE Resource Injection Support
+* JMS OpenWebBeans Support(OWB Specific)
+* Inheritance, Stereotype Inheritances
+* Specialization Support
+* Event Support
+* Decorator and Interceptor Support
+* Lookup and Dependency Injection Support
+* Java EE Plugin Support (via ServetContextListener interface)
+* Portable Integration Support
+* Passivation Capability of Beans
+* @Alternative support
+* OSGi environment support with an own plugable bundle ClassPath scanner
+* vastly improved Interceptor performance
+* improved Serialization handling
+* improved CreationalContext handling
+* revised internal logging
+* upgrade to JPA-2 and JSF-2 support
+* support for direct CDI usage in tomcat-6 and tomcat-7 environments
+
+
+
+- 1.0.0-alpha-1 release does not supports the following features
+--------------------------------------------
+* Does not fully integrate with Geronimo
+ (You have to configure your application to use OWB functionality,
+ e.g configure web.xml, adding interceptor to EJBs etc.)
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0-alpha-1
+-------------------------------------------
+Bug
+
+ * [OWB-216] - Update pom.xml svn links
+ * [OWB-231] - exception using abstract decorators
+ * [OWB-245] - Using parameterized type varaibles fails for Producer Method injection
+ * [OWB-259] - Implement spec 11.5.5. ProcessModule event
+ * [OWB-289] - Owb return 2 beans for Indirect specialized producer beans
+ * [OWB-302] - InjectionPoint injections (both method and field based) in Decorators result in null
+ * [OWB-312] - Add dopriv's to allow OWB to function with java 2 security enabled
+ * [OWB-317] - creationalContext in InvocationContextImpl is always null
+ * [OWB-318] - multiple methods with same EJB @interceptors(foo.class) in same bean class get multiple interceptor instances
+ * [OWB-327] - annotating an Interceptor with @ApplictionScoped leads to OutOfMemory
+ * [OWB-329] - Interceptor instances get created each time the interceptor gets called
+ * [OWB-332] - Destroy Depdent Of Producer Method Beans when Invocation Completes
+ * [OWB-333] - InjectionTarget and Producer Handling
+ * [OWB-334] - cid is missing when using redirect for a jsf 2.0 application
+ * [OWB-336] - injected BeanManager must be Serializable
+ * [OWB-337] - events must not get broadcasted to beans which have no active Context
+ * [OWB-339] - Injecting Non-Contextual Beans Causes NPE in WebBeansUtil
+ * [OWB-340] - BeanManagerImpl.createInjectionTarget() Throws Exception When No Constructor Found
+ * [OWB-341] - CreationalContext#incompleteInstance should get cleaned after create()
+ * [OWB-342] - InterceptorHandler crashes with NullPointerException after deserialisation
+ * [OWB-343] - upgrade JPA spec from 1.0-PFD2 to 1.0 final revision
+ * [OWB-345] - Remove duplicate dependencies
+ * [OWB-351] - OWB picks up @SessionScoped contextual instances from expired sessions
+ * [OWB-352] - Thread Safety Problem in our InterceptorHandlers, aka proxies
+ * [OWB-353] - NPE in removeDependents@CreationalContextImpl
+ * [OWB-354] - WebContextService may throw NPE in tiered classloading environmemt
+ * [OWB-357] - WebbeansFinder should index first on ClassLoader, not singleton type
+ * [OWB-359] - ownerCreationalContext sometimes causes NPE in InterceptorDataImpl.createNewInstance()
+ * [OWB-361] - underlying EJB method not actually in our interceptors stack
+ * [OWB-362] - InvocationTargetException when invoking Stateless SessionBean
+ * [OWB-363] - Intermittent bug with ApplicationScope disposers not being called
+ * [OWB-366] - ContextNotActiveException fired from AppScope/NormalScopedBeanInterceptorHandler when a proxied object finalized
+ * [OWB-368] - The 299 spec (that I have) uses receive=IF_EXISTS but OWB uses notifyObserver=IF_EXISTS.
+ * [OWB-369] - Static ContextsService in ContextFactory causes wrong webContextService used for multiple applications
+ * [OWB-370] - Intransient Conversation context get rdestroyed randomly by destroyWithRespectToTimout
+ * [OWB-371] - no lifecycle interceptors for non-contextual EJB
+ * [OWB-372] - creational context not cleaned up for non-contextual EJB interceptions
+ * [OWB-373] - build crashes with missing artifact error
+ * [OWB-374] - migrate jsf2sample from sun to MyFaces
+ * [OWB-376] - [patch] Guess example broken with Jetty plugin 6.x due to EL 2.2
+ * [OWB-377] - revise logging
+ * [OWB-378] - ejb at bottom of decorator stack doesn't handle changed method
+ * [OWB-380] - NormalScopedBeanInterceptorHandler throws NPE when handling 3rd party Contexts
+ * [OWB-381] - NPE thrown from AbstractInjectable if dependent producer returns null
+ * [OWB-382] - injecting a @Dependent bean into a passivatation scoped bean causes a NonSerializableException
+ * [OWB-387] - DependentContext Interceptor Double Call for PostConstruct
+ * [OWB-390] - fix broken links in our 'site'
+ * [OWB-396] - fix poms to work with maven 3
+ * [OWB-398] - DelegateHandler cached too agressively
+ * [OWB-399] - Proxy objects could not be correctly deserialized by using javassist 3.11. we need to update to 3.12
+ * [OWB-400] - starting OWB as part of an EAR in geronimo causes a exception due to missing 'bundle' protocol
+
+Improvement
+
+ * [OWB-116] - Update Business Method Definition
+ * [OWB-118] - Supports Decorators for Other Delegate Injections
+ * [OWB-136] - fix 'broken' license headers in our java files
+ * [OWB-170] - Address findbug issues in webbeans-impl
+ * [OWB-183] - Improve webbeans-doc module to get a documentation more user friendly
+ * [OWB-214] - get rid of javax.transaction.Transaction dependency in webbeans-impl
+ * [OWB-237] - NoSuchElementException when WebBeansConfigurationListener is absent
+ * [OWB-275] - remove unused imports and cleanup code
+ * [OWB-286] - java.lang.NoClassDefFoundError: javax/validation/Validator
+ * [OWB-313] - create caching strategies for resolving Bean<T> for BeanManager and EL invocations
+ * [OWB-314] - cache resolved instances in NormalScopedBeanMethodHandlers of @ApplicationScoped beans
+ * [OWB-315] - cache resolved instances in NormalScopedBeanMethodHandlers of @SessionScoped beans
+ * [OWB-319] - Strange logging when writing non-Serializable SessionScoped bean
+ * [OWB-320] - Remove Java EE Dependencies from WebBeans Core
+ * [OWB-322] - Create new EJB project and separate common EJB classes from OpenEJB plugin
+ * [OWB-325] - Relocate SPI Classes to SPI Module. Change JSR299, JSR330 as optional pom dependency.
+ * [OWB-326] - improve producer tests
+ * [OWB-328] - improve logger performance
+ * [OWB-330] - reduce BeanManagerImpl#getManager() calls inside the same functions
+ * [OWB-331] - Cache Interceptor & Decorator Stack oon Interceptor Handler
+ * [OWB-346] - Make EJB samples running
+ * [OWB-347] - Using InjectableBeanManager in TCK
+ * [OWB-349] - ignore exception during type hierarchy scan
+ * [OWB-350] - Support Interceptor for non-contextual EJBs
+ * [OWB-355] - OpenEjbBean should look for @Remove methods
+ * [OWB-356] - EjbPlugin only looks for DeployementInfo once, so new deployed application won't be discovered
+ * [OWB-358] - provide property to skip injection in @PostConstruct of OpenWebBeansEjbInterceptor
+ * [OWB-360] - Add BeanManager to a ServletContext attribute
+ * [OWB-364] - Reduce the amount of info level logging
+ * [OWB-365] - make injection optional in OWBEJBInterceptor
+ * [OWB-375] - Performance: OWB logging performs operations when logging disabled.
+ * [OWB-379] - upgrade to final atinject-spec artifact
+ * [OWB-386] - upgarde CDI TCK to 1.0.2.CR1
+ * [OWB-389] - atinject-tck upgrade to final 1.0 release
+ * [OWB-397] - Add helper method and some debug to WebBeansFinder
+
+New Feature
+
+ * [OWB-316] - Implement a generic TestContainer for CDI implementations
+ * [OWB-323] - Provide methods to pass classloader into ServiceLoader and WebBeansFinder for use in tiered classloader situations
+ * [OWB-324] - Add Tomcat Plugin
+ * [OWB-348] - Adding Interceptor and Decorator Support for EJB Beans
+ * [OWB-395] - OpenWebBeans Tomcat 7 Support
+
+TCK Challenge
+
+ * [OWB-388] - Pass TCK 1.0.2 CR1 Web Profile
+
+Task
+
+ * [OWB-6] - Scope passivation
+ * [OWB-14] - Update WebBeans Lifecycle for Servlet Beans
+ * [OWB-46] - Injection into non-contextual objects
+ * [OWB-204] - Update Samples for JSF2 Usage
+ * [OWB-220] - Update site.xml links and bread crumbs to point to non-incubator.
+ * [OWB-310] - Drop dom4j and use jre builtin xml parsers for processing beans.xml
+ * [OWB-391] - create a owb-build-tools project to maintain project specific checkstyle rules, etc.
+
+Test
+
+ * [OWB-56] - Integrate the official JSR-299 TCK test suite
+ * [OWB-222] - Update website download link, and fix relative URL translation
+ * [OWB-367] - Add a unit test for IF_EXISTS
+
+
+----------------------------------------------
+Required Platform
+----------------------------------------------
+Java Version : Java SE >= 6.0
+Java EE Must : Java EE >= 5.0
+
+---------------------------------------------
+How to Configure OpenWebBeans
+---------------------------------------------
+
+This section explains a content of the distribution bundle, OWB plugins and its
+dependent libraries.
+
+---------------------------------------------
+1.0.0-alpha-1 Distribution Content
+---------------------------------------------
+There are several jars in the OpenWebBeans 1.0.0-alpha-1 distribution;
+
+ - openwebbeans-impl-1.0.0-alpha-1.jar --> Includes Core Dependency Injection Service.
+ - openwebbeans-ejb-1.0.0-alpha-1.jar --> EJB Plugin(Supports EJBs in OpenEJB embedded in Tomcat).
+ - openwebbeans-openejb-1.0.0-alpha-1.jar --> OpenEJB specific Plugin SPI implementations as extension to openwebbeans-ejb
+ - openwebbeans-jms-1.0.0-alpha-1.jar --> JMS Plugin(Supports injection of JMS related artifacts,i.e, ConnectionFactory, Session, Connection etc.)
+ - openwebbeans-jsf-1.0.0-alpha-1.jar --> JSF-2.0 Plugin(JSF Conversation Scoped Support).
+ - openwebbeans-jsf12-1.0.0-alpha-1.jar --> JSF-1.2 Plugin(JSF Conversation Scoped Support).
+ - openwebbeans-resource-1.0.0-alpha-1.jar --> Java EE Resource Injection for Web Projects (Includes @PersistenceContext,@PersistenceUnit
+ and @Resource injection into the Managed Beans. @Resource injections use java:/comp/env of the
+ Web application component. @PersistenceContext is based on extended EntityManager.
+ - openwebbeans-spi-1.0.0-alpha-1.jar --> OpenWebBeans Server Provider Interfaces. They are implemented by runtime environments that would
+ like to use OpenWebBeans as a JSR-299 implementation.
+ - samples --> Includes source code of the samples. Samples are mavenized project therefore you can easily build and run
+ them from your environment that has maven runtime.
+ - openwebbeans-osgi-1.0.0-alpha-1.jar --> ClassPath ScannerService SPI implementation for OSGI environments like Apache Geronimo-3
+ - openwebbeans-web-1.0.0-alpha-1.jar --> Basic Servlet integration
+ - openwebbeans-tomcat6-1.0.0-alpha-1.jar --> Support for deeper integration into Apache Tomcat-6
+
+
+
+
+------------------------------------------
+How OWB Plugins Work
+------------------------------------------
+
+OpenWebBeans has been developed with a plugin architecture. The Core dependency injection service
+is provided with openwebbeans-impl. If you need further service functionality,
+you have to add respective plugin jars into the application classpath. OpenWebBeans
+uses the Java SE 6.0 java.util.ServiceLoader mechanism to pickup plugins at runtime.
+
+Current Plugins:
+---------------------
+Look at "1.0.0-alpha-1 Distribution Content" above.
+
+------------------------------------------
+Dependent Libraries
+------------------------------------------
+
+Third Party jars:
+-----------------
+They are necessary at runtime in the Core Implementation.
+
+javassist : Version 3.12.0.GA
+scannotation : Version 1.0.2 (if not running in an OSGi environment like Apache Geronimo-3)
+
+Java EE APIs jars(Container Provider Libraries) :
+-------------------------------------------------
+Generally full Java EE servers provides these jars. But web containers like Tomcat or Jetty
+does not contain some of them, such as JPA, JSF, Validation API etc. So, if you do not want to bundle
+these libraries within your application classpath, you have to put these libraries into your
+server common classpath if it does not contain.
+
+jcdi-api (JSR-299 Specification API)
+atinject-api (JSR-330 Specification API)
+servlet-2.5 or servlet 3.0 (Servlet Specification API)
+ejb-3.1 (EJB Specification API)
+el-2.2 (Expression Langauge Specification API)
+jsf-2.0 (Java Server Faces API)
+jsr-250 (Annotation API)
+interceptor-1.1 (Interceptor API)
+jta-1.1 (Java Transaction API)
+jsp.2.1 or jsp-2.2 (Java Server Pages API)
+jpa-2.0 (Java Persistence API)
+jaxws-2.1 or jaxws-2.2 (Java Web Service API)
+jms-1.1 or jms-1.2 (Java Messaging Service API)
+validation (Validation Specification)
+
+Dependencies of OpenWebBeans Maven Modules&Plugins
+--------------------------------------------------
+
+openwebbeans-impl :
+------------------
+Third party : javassist, scannotation, openwebbeans-spi
+Container Provided : jcdi-api, at-inject, servlet, el, jsr-250, interceptor, jta, jsp, validation
+
+openwebbeans-ejb:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : OpenWebBeans EJB plugin is based on OpenEJB in Tomcat. Therefore, if you install OpenEJB
+ within Tomcat correctly, there is no need to add any additional libraries. Look at the
+ OpenEJB in Tomcat configuration section.
+
+openwebbeans-jms:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : jms
+
+openwebbeans-jsf:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : jsf
+
+NOTE : We are trying to decrease dependent libraries of the our core, i.e, openwebbeans-impl.
+At 1.0.0, dependent third party libraries will be decreased. We have a plan to create profile
+plugins, therefore each profile plugin provides its own dependent libraries. For example, in
+fully Java EE Profile Plugin, Transaction API is supported but this will not be the case
+for Java Web Profile Plugin or Java SE Profile Plugin. Stay Tune!
+
+Currently, as you have seen above, openwebbeans-impl depends on some Java EE/Runtime
+provided libraries (servlet, jsp, el etc). In the future, with OpenWebBeans profiling support,
+openwebbeans-impl will not depend on any Java EE APIs. Those APIs will be provided
+by OpenWebBeans profiles/plugins that openwebbeans-impl will be used. Therefore,
+you will able to use OpenWebBeans in your own runtime environment easily by writing
+your own plugins and contributing it to OpenWebBeans :)
+
+------------------------------------------
+Library Configuration
+------------------------------------------
+To run openwebbeans applications in the Java EE based application server,
+you could add JSR-299 API and JSR-330 API into the server common classpath, and
+implementation, plugins and dependent jars into your "WEB-INF/lib" directory
+of the Java EE Web Application.
+
+In this release, we can not support the OpenWebBeans as an integrated
+functionality of the Java EE Application Servers. So, you have to manage the
+configuration of the OpenWebBeans within your application's "web.xml" file. A sample "web.xml"
+file can be found in the "config" directory. To use EJB functionality, you also have to
+add OWB specific interceptor into your EJB beans. Look at the EJB section of this readme
+for further details.
+
+---------------------------------------------
+OpenWebBeans Properties File
+---------------------------------------------
+OpenWebBeans uses a default configuration file to configure some of its
+properties. Default configuration file is embedded into the OWB implementation
+jar file. Instead of opening this jar file and changing configuration properties, simply add
+"openwebbeans.properties" file into a "META-INF/openwebbeans" folder of your application
+classpath. This will override the default configuration.
+
+Belows are default configuration properties of the OpenWebBeans that is embedded into openwebbeans-impl jar file.
+
+Each plugin or developer can provide its own SPI implementation class and its own configuration values. If you woud like
+to use those implementation classes or configuration values, you have to override default configuration file as explained
+in the above paragraph, i.e, putting "openwebbeans.properties" file into "META-INF/openwebbeans" folder of your application.
+
+For example : You add "META-INF/openwebbeans/openwebbeans.properties" in your application classpath. And you add the following
+key-value pair to use. And this service implementation is provided by your plugin, for example OpenWebBeans OpenEJB plugin.
+
+Override default value of ResourceInjectionService
+-------------------------------------------------
+org.apache.webbeans.spi.ResourceInjectionService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService
+
+OpenWebBeans uses the "OpenEjbResourceInjectionService" class to inject resources into the managed bean instances.
+
+Configuration Names and Their Default Values :
+
+- "org.apache.webbeans.spi.ContainerLifecycle"
+ Description : Implementation of org.apache.webbeans.spi.ContainerLifecycle. All magic starts from here.
+ Values : org.apache.webbeans.lifecycle.DefaultLifecycle, OR CUSTOM
+ Default : org.apache.webbeans.lifecycle.DefaultLifecycle
+
+- "org.apache.webbeans.spi.JNDIService"
+ Description : Configures JNDI provider implementation.
+ Values : org.apache.webbeans.spi.se.DefaultJndiService OR CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultJndiService
+
+- "org.apache.webbeans.spi.conversation.ConversationService"
+ Description : Implementation of conversation.
+ Values : org.apache.webbeans.spi.conversation.jsf.DefaultConversationService OR CUSTOM
+ Default : org.apache.webbeans.spi.conversation.jsf.DefaultConversationService
+
+- "org.apache.webbeans.spi.ScannerService"
+ Description : Default implementation of org.apache.webbeans.spi.ScannerService. It is used for scanning application deployment
+ for finding bean classes and configuration files.
+ Values : org.apache.webbeans.spi.ee.deployer.DefaultScannerService OR CUSTOM
+ Default : org.apache.webbeans.spi.ee.deployer.DefaultScannerService
+
+- "org.apache.webbeans.spi.SecurityService"
+ Description : Implementation of org.apache.webbeans.spi.SecurityService. It is used for getting current "Principal".
+ Values : org.apache.webbeans.spi.se.DefaultSecurityService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultSecurityService
+
+- "org.apache.webbeans.spi.ValidatorService"
+ Description : Implementation of org.apache.webbeans.spi.ValidatorService. It is used for getting "ValidatorFactory" and "Validator".
+ Values : org.apache.webbeans.spi.se.DefaultValidatorService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultValidatorService
+
+- "org.apache.webbeans.spi.TransactionService"
+ Description : Implementation of org.apache.webbeans.spi.TransactionService. It is used for getting "TransactionManager" and "Transaction".
+ Values : org.apache.webbeans.spi.se.DefaultTransactionService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultTransactionService
+
+- "org.apache.webbeans.spi.ResourceInjectionService"
+ Description : Implementation of org.apache.webbeans.spi.ResourceInjectionService. It is used for injection Java EE enviroment resource into the
+ Managed Bean instances.
+ Values : org.apache.webbeans.se.DefaultResourceInjectionService or CUSTOM
+ Default : org.apache.webbeans.se.DefaultResourceInjectionService
+
+- "org.apache.webbeans.spi.JNDIService.jmsConnectionFactoryJndi"
+ Description : Configures JMS ConnectionFactory object jndi name
+ Values : Server specific JNDI name
+ Default : ConnectionFactory
+
+- "org.apache.webbeans.conversation.Conversation.periodicDelay"
+ Description : Conversation removing thread periodic delay
+ Values : Configured in millisecond
+ Default : 150000 ms
+
+- "org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService"
+ Description : Use EJB functionality or not. If use OpenEJB configures to true
+ Values : false, true
+ Default : false
+
+---------------------------------------------
+EJB Support via Embeddable OpenEJB Container in Tomcat 6.X
+---------------------------------------------
+
+Configuration Steps:
+--------------------------------------------
+1* Download Tomcat 6.X version
+2* Configure OpenEJB. Look at URL http://openejb.apache.org/tomcat.html for installation.
+3* Copy JSR-330 API to Tomcat /lib folder.
+4* Copy JSR-299 API to Tomcat /lib folder
+5* Put all dependent libraries of the OpenWebBeans OpenEJB Plugin
+ - openwebbeans-ejb
+ - openwebbeans-impl and its dependencies
+
+You could look at ejb-sample.war for "WEB-INF/lib" libraries to develop custom application.
+You can also look at a source of the project.
+
+To use EJB functionality, you will use OpenEJB collapse-ear support. In this configuration,
+your EJB beans live within your "war" bundle.
+
+How to Develop EJB Applications
+---------------------------------------------
+1* Add "META-INF/openwebbeans.properties" into your application classpath.
+2* Add "org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService=true" to use EJB functionality.
+ So OWB container looks for EJBs.
+3* Add "org.apache.webbeans.resource.spi.ResourceService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService to
+use OpenEJB Resource injections.
+4* Add "openwebbeans-ejb", plugin into your web application classpath.
+5* If you want to use other plugins, add respective plugins into your application classpath. For example, if you wish to use
+JSF framework, you add "openwebbeans-jsf" plugin.
+6* Add OWB related interceptor into your EJB Beans. This is called "org.apache.webbeans.ejb.interceptor.OpenWebBeansEjbInterceptor"
+This is needed for OWB injections.
+7* Update your application's "web.xml" to add OWB specific configuration.
+
+---------------------------------------------
+How to Run Samples
+---------------------------------------------
+
+In this release, there are several sample applications located in the "/samples" directory
+of the distribution. You can run those samples via simple maven command.
+
+1) "Guess Application" : Simple usage of the OWB + JSF.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+2) "Hotel Reservation Application" : Show usage of JSF + JPA + OWB
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+3) "EJB Sample Application" : Shows the usage of EJBs with embeddable OpenEJB in Tomcat. Firstly
+configure OpenEJB with Tomcat as explained above.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+4) "EJB Telephone Application" : Shows the usage of OpenEJB resource injection service.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+5) "JMS Injection Sample" : Show JMS injections. JMS injection currently uses
+ ConnectionFactory as JMS connection factory jndi name. You can change this
+ via configuration file. Look above explanation for how to configure JMS jndi. Also,
+ JMS injection requires to use of a JMS provider. Generally Java EE servers contains
+ default JMS provider. It can be run on JBoss and Geronimo. It uses Queue with jndi_name = "queue/A".
+ So you have to create a queue destination in your JMS provider with name "queue/A" to run example.
+ If you want to change queue jndi name, then look at source and change it from "WEB-INF/beans.xml" file.
+
+6) "Conversation Sample" : Shows usage of JSF conversations.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+7) "JSF2 Sample" : Shows usage of JSF2 Ajax.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section. It requires
+to use JSF2 runtime.
+
+
+8) "Standalone Sample" : Shows usage of OpenWebBeans in Stadnalone Swing Application.
+Look at "OpenWebBeans in Java SE" section.
+
+Configuring and Running the Applications:
+--------------------------------------------
+See section Compile and Run Samples via Jetty&Tomcat Plugin.
+
+--------------------------------------------
+Maven Install and Package From the Source
+--------------------------------------------
+
+Maven Version : Apache Maven 2.2.1 or later
+
+Firstly you have to download the "source" version of the OpenWebBeans project that
+contains the all source codes of the OpenWebBeans.
+
+To install the Maven artifacts of the project from the source, Maven must be installed
+in your runtime. After Maven installation, just run the following command in the top level
+directory that contains the main "pom.xml" :
+
+> mvn clean install
+
+This command will install all the Maven artifacts into your local Maven repository.
+
+If you wish to package all artifacts of the project, just run the following command
+in in the top level directory that contains the main "pom.xml" :
+
+> mvn clean package
+
+This command will package the project artifacts from the source and put these artifacts into the each modules
+respective "target" directory.
+
+-------------------------------------------
+Compile and Run Samples via Tomcat&Jetty Plugin
+-------------------------------------------
+This section shows how to run samples in Jetty or OpenEJB Embedded Tomcat.
+
+------------------------------------------
+Samples Run within Jetty Plugin
+------------------------------------------
+You can compile and run "guess","jsf2","conversation-sample" and "reservation "samples via maven Jetty plugin.
+Go to the source bundle "samples/" directory. In the "guess/" or "reservation/" directory, run
+the following maven commands. It will start up maven Jetty container. It bundles all of the
+required jars into the WEB-INF/lib folder. You are not required to add any jar to the classpath.
+
+Samples : Guess and Reservation
+------------------------------
+Go to the source folder of projects and run
+
+> mvn clean install -Pjetty
+> mvn jetty:run -Pjetty
+
+Guess URL : http://localhost:8080/guess
+Reservation URL : http://localhost:8080/reservation
+
+Samples : Conversation Sample and JSF2
+-------------------------------------
+Go to the source folder of projects and run
+
+>mvn clean install
+>mvn jetty:run
+
+Conversation Sample URL : http://localhost:8080/conversation-sample
+JSF2 Sample URL : http://localhost:8080/jsf2sample
+
+------------------------------------------
+Samples Run within Tomcat Plugin
+------------------------------------------
+OpenEJB samples are run with Maven Tomcat Plugin.
+
+Tomcat Plugin uses http://localhost:8080/manager application to deploy war file
+into your embeddable EJB Tomcat container. There must be an tomcat-users.xml
+file in the "conf" directory of the server that contains manager role and username.
+
+>Start Tomcat server if not started
+>mvn tomcat:deploy
+
+Ejb Sample URL : http://localhost:8080/ejb-sample
+Ejb Telephone URL : http://localhost:8080/ejb-telephone
+
+Example tomcat-users.xml file
+------------------------------------------
+<tomcat-users>
+<role rolename="manager"/>
+<user username="admin" password="" roles="manager"/>
+</tomcat-users>
+
+-----------------------------------------
+Deploy JMS Sample
+-----------------------------------------
+Simple drops jms-sample.war file into your application deploy location.
+
+JMS Sample Example URL : Hit the url http://localhost:8080/jms-sample/sender.jsf for sending JMS messages
+ Hit the url http://localhost:8080/jms-sample/receiver.jsf for receiving JMS messages
+
+-----------------------------------------
+OpenWebBeans in Java SE
+----------------------------------------
+OpenWebBeans can perfeclty use in Java SE environment like Java Swing
+applications. Standalone Samples is provided to show how to use OpenWebBeans
+in Java SE.
+
+Go to the source directory of the standalone sample:
+>mvn clean package;
+>cd target;
+>jar -xvf standalone-sample.jar
+>java -jar standalone-sample-1.0.0-SNAPSHOT.jar
+>Enjoy :)
+
+-----------------------------------------------
+OpenWebBeans User and Development Mailing Lists
+-----------------------------------------------
+Please mail to the user mailing list about any questions or advice
+about the OpenWebBeans.
+
+User Mailing List : [users@openwebbeans.apache.org]
+
+You can also join the discussions happening in the dev list
+
+Dev Mailing List : [dev@openwebbeans.apache.org]
+
+-------------------------------------------
+OpenWebBeans JIRA Page
+-------------------------------------------
+Please logs bugs into the "https://issues.apache.org/jira/browse/OWB".
+
+------------------------------------------
+OpenWebBeans Wiki and Blog Page
+-----------------------------------------
+Wiki: http://cwiki.apache.org/OWB/
+Introduction to OpenWebBeans : http://cwiki.apache.org/OWB/introduction-to-openwebbeans.html
+Blog : http://blogs.apache.org/owb
+
+-----------------------------------------
+OpenWebBeans Web Page
+----------------------------------------
+You can reach the OpenWebBeans web page at
+http://openwebbeans.apache.org
+---------------------------------------
+
+Your OpenWebBeans Team
+
+Enjoy!
diff --git a/owb_1.2.x/readme/README_1_0_0-alpha-2.txt b/owb_1.2.x/readme/README_1_0_0-alpha-2.txt
new file mode 100644
index 0000000..472f486
--- /dev/null
+++ b/owb_1.2.x/readme/README_1_0_0-alpha-2.txt
@@ -0,0 +1,716 @@
+-------------------------------
+Apache OpenWebBeans 1.0.0-alpha-2
+-------------------------------
+Welcome! Thanks for downloading and using OpenWebBeans.
+This document is a "Getting Started Guide" for OpenWebBeans.
+
+This document is based on the 1.0.0-alpha-2 release of the OpenWebBeans.
+
+NOTE : Final release version of OpenWebBeans will be 1.0.0.
+
+--------------------------------
+What is Apache OpenWebBeans?
+--------------------------------
+OpenWebBeans is an ASL 2.0-licensed implementation of the JSR-299, Contexts and Dependency Injection for the Java EE platform.
+
+Project's web page can be found at:
+"http://openwebbeans.apache.org"
+
+--------------------------------
+OpenWebBeans 1.0.0-alpha-2 Release Features
+--------------------------------
+
+- 1.0.0-alpha-2 release supports the following features
+-----------------------------------
+* Managed Beans Support
+* Session Beans Support (via Embeddable OpenEJB container in Tomcat)
+* Producer Method Support
+* Producer Field Support
+* Java EE Resource Injection Support
+* JMS OpenWebBeans Support(OWB Specific)
+* Inheritance, Stereotype Inheritances
+* Specialization Support
+* Event Support
+* Decorator and Interceptor Support
+* Lookup and Dependency Injection Support
+* Java EE Plugin Support (via ServetContextListener interface)
+* Portable Integration Support
+* Passivation Capability of Beans
+* @Alternative support
+* OSGi environment support with an own plugable bundle ClassPath scanner
+* vastly improved Interceptor performance
+* improved Serialization handling
+* improved CreationalContext handling
+* revised internal logging
+* upgrade to JPA-2 and JSF-2 support
+* support for direct CDI usage in tomcat-6 and tomcat-7 environments
+
+
+
+- 1.0.0-alpha-2 release does not support the following features
+--------------------------------------------
+* Does not fully integrate with Geronimo
+ (You have to configure your application to use OWB functionality,
+ e.g configure web.xml, adding interceptor to EJBs etc.)
+
+
+Noteable differences to CDI spec behaviour
+--------------------------------------------
+
+In a few special cases Apache OpenWebBeans might behave a little bit different than
+other CDI implementations. This is to some degree caused by the JSR-299 spec being
+not clear about some special topics so we needed to interpret the wording on our own.
+This mainly concerns the area of section 12.1 Bean Archives (BDA) which doesn't work
+out when it comes to OSGi containers and likes.
+In Apache OpenWebBeans, a settings configured in a beans.xml file of a BDA is not
+only effective for this very bean archive but for the whole BeanManager in control
+of the Application. This is especially the case for <alternatives> and
+<interceptors>! An Alternative, Interceptor or Decorator enabled in one BDA is active
+for the whole Application.
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0-alpha-2
+-------------------------------------------
+Bug
+
+ * [OWB-303] - upgrade Javassist to a newer version
+ * [OWB-338] - our internal SessionContext and ConversationContext must support Session serialization
+ * [OWB-385] - implement passivation of managed beans in ServletContextListener
+ * [OWB-401] - ELContextStore not cleaned up for some JSP EL lookups
+ * [OWB-402] - OpenWebBeansJsfPlugin does not recognize @ManagedBean
+ * [OWB-404] - Contexts must not get stored in a static Map in BeanManager
+ * [OWB-405] - AnnotatedElementFactory must not use static cache maps
+ * [OWB-408] - NPE in WebBeansELResolver
+ * [OWB-415] - EjbBeanProxyHandler for dependent ejb must save ejb instance
+ * [OWB-416] - BaseEJBBean.destroyComponentInstance() tries to call multiple remove methods
+ * [OWB-418] - EjbBeanProxyHandler must be 1:1 with proxy instances for dependent SFSB
+ * [OWB-419] - fix @Dependent handling in ELResolver
+ * [OWB-420] - SingletonContext is mapped to @ConversationScoped
+ * [OWB-421] - defined-in-class EJB lifecycle callbacks masked by our Interceptor
+ * [OWB-426] - Tweak EJBPlugin to work with Standalone Tests
+ * [OWB-431] - Generic Type Inheritance not resolved correctly
+ * [OWB-434] - ThreadLocal<SingletonContext> doen't get cleaned up
+ * [OWB-436] - AbstractContext bean instance creation is not thread safe
+ * [OWB-437] - Improve AbstractContext synchronization
+ * [OWB-440] - WebBeansDecoratorConfig.getDecoratorStack always returns new Decorators
+ * [OWB-442] - our EJB proxies are broken when multiple local interfaces are used on a single class
+ * [OWB-443] - Normal-scoped EJB not removed by container during Contextual.destroy()
+
+Improvement
+
+ * [OWB-57] - cleanup problems found by maven-findbugs-plugin
+ * [OWB-195] - Give warning to the developer related with non- portable operations
+ * [OWB-409] - create a name for OWB our faces-config.xml
+ * [OWB-410] - lazy initialisation of ejbInterceptors
+ * [OWB-411] - cache calls to isNormalScope()
+ * [OWB-412] - Allow container specific extensions to WebConfigurationListener access to the lifecycle
+ * [OWB-413] - cache calls to ClassUtils#getObjectMethodNames()
+ * [OWB-414] - improve Interceptor performance
+ * [OWB-425] - improve performance of owb-el-resolver
+ * [OWB-427] - improve read-performance of AbstractOwbBean
+ * [OWB-430] - improve performance of WebBeansPhaseListener
+ * [OWB-432] - Create Singleton Service SPI
+ * [OWB-441] - new configuration properties mechanism
+
+Sub-task
+
+ * [OWB-193] - If an interceptor or decorator has any scope other than @Dependent, non-portable behavior results.
+ * [OWB-194] - If an interceptor or decorator has a name, non-portable behavior results.
+ * [OWB-196] - If an interceptor or decorator is an alternative, non-portable behavior results.
+ * [OWB-197] - If a stereotype declares any other qualifier an- notation, non-portable behavior results.
+ * [OWB-198] - If a stereotype is annotated @Typed, non-portable behavior results.
+
+
+TCK Challenge
+
+ * [OWB-424] - Adding Document for How to Configure and Run TCK (standalone and web profile TCKs)
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0-alpha-1
+-------------------------------------------
+Bug
+
+ * [OWB-216] - Update pom.xml svn links
+ * [OWB-231] - exception using abstract decorators
+ * [OWB-245] - Using parameterized type varaibles fails for Producer Method injection
+ * [OWB-259] - Implement spec 11.5.5. ProcessModule event
+ * [OWB-289] - Owb return 2 beans for Indirect specialized producer beans
+ * [OWB-302] - InjectionPoint injections (both method and field based) in Decorators result in null
+ * [OWB-312] - Add dopriv's to allow OWB to function with java 2 security enabled
+ * [OWB-317] - creationalContext in InvocationContextImpl is always null
+ * [OWB-318] - multiple methods with same EJB @interceptors(foo.class) in same bean class get multiple interceptor instances
+ * [OWB-327] - annotating an Interceptor with @ApplictionScoped leads to OutOfMemory
+ * [OWB-329] - Interceptor instances get created each time the interceptor gets called
+ * [OWB-332] - Destroy Depdent Of Producer Method Beans when Invocation Completes
+ * [OWB-333] - InjectionTarget and Producer Handling
+ * [OWB-334] - cid is missing when using redirect for a jsf 2.0 application
+ * [OWB-336] - injected BeanManager must be Serializable
+ * [OWB-337] - events must not get broadcasted to beans which have no active Context
+ * [OWB-339] - Injecting Non-Contextual Beans Causes NPE in WebBeansUtil
+ * [OWB-340] - BeanManagerImpl.createInjectionTarget() Throws Exception When No Constructor Found
+ * [OWB-341] - CreationalContext#incompleteInstance should get cleaned after create()
+ * [OWB-342] - InterceptorHandler crashes with NullPointerException after deserialisation
+ * [OWB-343] - upgrade JPA spec from 1.0-PFD2 to 1.0 final revision
+ * [OWB-345] - Remove duplicate dependencies
+ * [OWB-351] - OWB picks up @SessionScoped contextual instances from expired sessions
+ * [OWB-352] - Thread Safety Problem in our InterceptorHandlers, aka proxies
+ * [OWB-353] - NPE in removeDependents@CreationalContextImpl
+ * [OWB-354] - WebContextService may throw NPE in tiered classloading environmemt
+ * [OWB-357] - WebbeansFinder should index first on ClassLoader, not singleton type
+ * [OWB-359] - ownerCreationalContext sometimes causes NPE in InterceptorDataImpl.createNewInstance()
+ * [OWB-361] - underlying EJB method not actually in our interceptors stack
+ * [OWB-362] - InvocationTargetException when invoking Stateless SessionBean
+ * [OWB-363] - Intermittent bug with ApplicationScope disposers not being called
+ * [OWB-366] - ContextNotActiveException fired from AppScope/NormalScopedBeanInterceptorHandler when a proxied object finalized
+ * [OWB-368] - The 299 spec (that I have) uses receive=IF_EXISTS but OWB uses notifyObserver=IF_EXISTS.
+ * [OWB-369] - Static ContextsService in ContextFactory causes wrong webContextService used for multiple applications
+ * [OWB-370] - Intransient Conversation context get rdestroyed randomly by destroyWithRespectToTimout
+ * [OWB-371] - no lifecycle interceptors for non-contextual EJB
+ * [OWB-372] - creational context not cleaned up for non-contextual EJB interceptions
+ * [OWB-373] - build crashes with missing artifact error
+ * [OWB-374] - migrate jsf2sample from sun to MyFaces
+ * [OWB-376] - [patch] Guess example broken with Jetty plugin 6.x due to EL 2.2
+ * [OWB-377] - revise logging
+ * [OWB-378] - ejb at bottom of decorator stack doesn't handle changed method
+ * [OWB-380] - NormalScopedBeanInterceptorHandler throws NPE when handling 3rd party Contexts
+ * [OWB-381] - NPE thrown from AbstractInjectable if dependent producer returns null
+ * [OWB-382] - injecting a @Dependent bean into a passivatation scoped bean causes a NonSerializableException
+ * [OWB-387] - DependentContext Interceptor Double Call for PostConstruct
+ * [OWB-390] - fix broken links in our 'site'
+ * [OWB-396] - fix poms to work with maven 3
+ * [OWB-398] - DelegateHandler cached too agressively
+ * [OWB-399] - Proxy objects could not be correctly deserialized by using javassist 3.11. we need to update to 3.12
+ * [OWB-400] - starting OWB as part of an EAR in geronimo causes a exception due to missing 'bundle' protocol
+
+Improvement
+
+ * [OWB-116] - Update Business Method Definition
+ * [OWB-118] - Supports Decorators for Other Delegate Injections
+ * [OWB-136] - fix 'broken' license headers in our java files
+ * [OWB-170] - Address findbug issues in webbeans-impl
+ * [OWB-183] - Improve webbeans-doc module to get a documentation more user friendly
+ * [OWB-214] - get rid of javax.transaction.Transaction dependency in webbeans-impl
+ * [OWB-237] - NoSuchElementException when WebBeansConfigurationListener is absent
+ * [OWB-275] - remove unused imports and cleanup code
+ * [OWB-286] - java.lang.NoClassDefFoundError: javax/validation/Validator
+ * [OWB-313] - create caching strategies for resolving Bean<T> for BeanManager and EL invocations
+ * [OWB-314] - cache resolved instances in NormalScopedBeanMethodHandlers of @ApplicationScoped beans
+ * [OWB-315] - cache resolved instances in NormalScopedBeanMethodHandlers of @SessionScoped beans
+ * [OWB-319] - Strange logging when writing non-Serializable SessionScoped bean
+ * [OWB-320] - Remove Java EE Dependencies from WebBeans Core
+ * [OWB-322] - Create new EJB project and separate common EJB classes from OpenEJB plugin
+ * [OWB-325] - Relocate SPI Classes to SPI Module. Change JSR299, JSR330 as optional pom dependency.
+ * [OWB-326] - improve producer tests
+ * [OWB-328] - improve logger performance
+ * [OWB-330] - reduce BeanManagerImpl#getManager() calls inside the same functions
+ * [OWB-331] - Cache Interceptor & Decorator Stack oon Interceptor Handler
+ * [OWB-346] - Make EJB samples running
+ * [OWB-347] - Using InjectableBeanManager in TCK
+ * [OWB-349] - ignore exception during type hierarchy scan
+ * [OWB-350] - Support Interceptor for non-contextual EJBs
+ * [OWB-355] - OpenEjbBean should look for @Remove methods
+ * [OWB-356] - EjbPlugin only looks for DeployementInfo once, so new deployed application won't be discovered
+ * [OWB-358] - provide property to skip injection in @PostConstruct of OpenWebBeansEjbInterceptor
+ * [OWB-360] - Add BeanManager to a ServletContext attribute
+ * [OWB-364] - Reduce the amount of info level logging
+ * [OWB-365] - make injection optional in OWBEJBInterceptor
+ * [OWB-375] - Performance: OWB logging performs operations when logging disabled.
+ * [OWB-379] - upgrade to final atinject-spec artifact
+ * [OWB-386] - upgarde CDI TCK to 1.0.2.CR1
+ * [OWB-389] - atinject-tck upgrade to final 1.0 release
+ * [OWB-397] - Add helper method and some debug to WebBeansFinder
+
+New Feature
+
+ * [OWB-316] - Implement a generic TestContainer for CDI implementations
+ * [OWB-323] - Provide methods to pass classloader into ServiceLoader and WebBeansFinder for use in tiered classloader situations
+ * [OWB-324] - Add Tomcat Plugin
+ * [OWB-348] - Adding Interceptor and Decorator Support for EJB Beans
+ * [OWB-395] - OpenWebBeans Tomcat 7 Support
+
+TCK Challenge
+
+ * [OWB-388] - Pass TCK 1.0.2 CR1 Web Profile
+
+Task
+
+ * [OWB-6] - Scope passivation
+ * [OWB-14] - Update WebBeans Lifecycle for Servlet Beans
+ * [OWB-46] - Injection into non-contextual objects
+ * [OWB-204] - Update Samples for JSF2 Usage
+ * [OWB-220] - Update site.xml links and bread crumbs to point to non-incubator.
+ * [OWB-310] - Drop dom4j and use jre builtin xml parsers for processing beans.xml
+ * [OWB-391] - create a owb-build-tools project to maintain project specific checkstyle rules, etc.
+
+Test
+
+ * [OWB-56] - Integrate the official JSR-299 TCK test suite
+ * [OWB-222] - Update website download link, and fix relative URL translation
+ * [OWB-367] - Add a unit test for IF_EXISTS
+
+
+----------------------------------------------
+Required Platform
+----------------------------------------------
+Java Version : Java SE >= 6.0
+Java EE Must : Java EE >= 5.0
+
+---------------------------------------------
+How to Configure OpenWebBeans
+---------------------------------------------
+
+This section explains a content of the distribution bundle, OWB plugins and its
+dependent libraries.
+
+---------------------------------------------
+1.0.0-alpha-2 Distribution Content
+---------------------------------------------
+There are several jars in the OpenWebBeans 1.0.0-alpha-2 distribution;
+
+ - openwebbeans-impl-1.0.0-alpha-2.jar --> Includes Core Dependency Injection Service.
+ - openwebbeans-ejb-1.0.0-alpha-2.jar --> EJB Plugin(Supports EJBs in OpenEJB embedded in Tomcat).
+ - openwebbeans-openejb-1.0.0-alpha-2.jar --> OpenEJB specific Plugin SPI implementations as extension to openwebbeans-ejb
+ - openwebbeans-jms-1.0.0-alpha-2.jar --> JMS Plugin(Supports injection of JMS related artifacts,i.e, ConnectionFactory, Session, Connection etc.)
+ - openwebbeans-jsf-1.0.0-alpha-2.jar --> JSF-2.0 Plugin(JSF Conversation Scoped Support).
+ - openwebbeans-jsf12-1.0.0-alpha-2.jar --> JSF-1.2 Plugin(JSF Conversation Scoped Support).
+ - openwebbeans-resource-1.0.0-alpha-2.jar --> Java EE Resource Injection for Web Projects (Includes @PersistenceContext,@PersistenceUnit
+ and @Resource injection into the Managed Beans. @Resource injections use java:/comp/env of the
+ Web application component. @PersistenceContext is based on extended EntityManager.
+ - openwebbeans-spi-1.0.0-alpha-2.jar --> OpenWebBeans Server Provider Interfaces. They are implemented by runtime environments that would
+ like to use OpenWebBeans as a JSR-299 implementation.
+ - samples --> Includes source code of the samples. Samples are mavenized project therefore you can easily build and run
+ them from your environment that has maven runtime.
+ - openwebbeans-osgi-1.0.0-alpha-2.jar --> ClassPath ScannerService SPI implementation for OSGI environments like Apache Geronimo-3
+ - openwebbeans-web-1.0.0-alpha-2.jar --> Basic Servlet integration
+ - openwebbeans-tomcat6-1.0.0-alpha-2.jar --> Support for deeper integration into Apache Tomcat-6
+
+
+
+
+------------------------------------------
+How OWB Plugins Work
+------------------------------------------
+
+OpenWebBeans has been developed with a plugin architecture. The Core dependency injection service
+is provided with openwebbeans-impl. If you need further service functionality,
+you have to add respective plugin jars into the application classpath. OpenWebBeans
+uses the Java SE 6.0 java.util.ServiceLoader mechanism to pickup plugins at runtime.
+
+Current Plugins:
+---------------------
+Look at "1.0.0-alpha-2 Distribution Content" above.
+
+------------------------------------------
+Dependent Libraries
+------------------------------------------
+
+Third Party jars:
+-----------------
+They are necessary at runtime in the Core Implementation.
+
+javassist : Version 3.12.0.GA
+scannotation : Version 1.0.2 (if not running in an OSGi environment like Apache Geronimo-3)
+
+Java EE APIs jars(Container Provider Libraries) :
+-------------------------------------------------
+Generally full Java EE servers provides these jars. But web containers like Tomcat or Jetty
+do not contain some of them, such as JPA, JSF, Validation API etc. So, if you do not want to bundle
+these libraries within your application classpath, you have to include these libraries in your
+server common classpath.
+
+jcdi-api (JSR-299 Specification API)
+atinject-api (JSR-330 Specification API)
+servlet-2.5 or servlet 3.0 (Servlet Specification API)
+ejb-3.1 (EJB Specification API)
+el-2.2 (Expression Langauge Specification API)
+jsf-2.0 (Java Server Faces API)
+jsr-250 (Annotation API)
+interceptor-1.1 (Interceptor API)
+jta-1.1 (Java Transaction API)
+jsp.2.1 or jsp-2.2 (Java Server Pages API)
+jpa-2.0 (Java Persistence API)
+jaxws-2.1 or jaxws-2.2 (Java Web Service API)
+jms-1.1 or jms-1.2 (Java Messaging Service API)
+validation (Validation Specification)
+
+Dependencies of OpenWebBeans Maven Modules&Plugins
+--------------------------------------------------
+
+openwebbeans-impl :
+------------------
+Third party : javassist, scannotation, openwebbeans-spi
+Container Provided : jcdi-api, at-inject, servlet, el, jsr-250, interceptor, jta, jsp, validation
+
+openwebbeans-ejb:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : OpenWebBeans EJB plugin is based on OpenEJB in Tomcat. Therefore, if you install OpenEJB
+ within Tomcat correctly, there is no need to add any additional libraries. Look at the
+ OpenEJB in Tomcat configuration section.
+
+openwebbeans-jms:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : jms
+
+openwebbeans-jsf:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : jsf
+
+NOTE : We are trying to decrease dependent libraries of the our core, i.e, openwebbeans-impl.
+At 1.0.0, dependent third party libraries will be decreased. We have a plan to create profile
+plugins, therefore each profile plugin provides its own dependent libraries. For example, in
+fully Java EE Profile Plugin, Transaction API is supported but this will not be the case
+for Java Web Profile Plugin or Java SE Profile Plugin. Stay Tuned!
+
+Currently, as you have seen above, openwebbeans-impl depends on some Java EE/Runtime
+provided libraries (servlet, jsp, el etc). In the future, with OpenWebBeans profiling support,
+openwebbeans-impl will not depend on any Java EE APIs. Those APIs will be provided
+by OpenWebBeans profiles/plugins that openwebbeans-impl will be used. Therefore,
+you will able to use OpenWebBeans in your own runtime environment easily by writing
+your own plugins and contributing it to OpenWebBeans :)
+
+------------------------------------------
+Library Configuration
+------------------------------------------
+To run openwebbeans applications in the Java EE based application server,
+you could add the JSR-299 API and JSR-330 API into the server common classpath, and
+implementation, plugins and dependent jars into your "WEB-INF/lib" directory
+of the Java EE Web Application.
+
+In this release, we can not support the OpenWebBeans as an integrated
+functionality of the Java EE Application Servers. So, you have to manage the
+configuration of the OpenWebBeans within your application's "web.xml" file. A sample "web.xml"
+file can be found in the "config" directory. To use EJB functionality, you also have to
+add OWB specific interceptor into your EJB beans. Look at the EJB section of this readme
+for further details.
+
+---------------------------------------------
+OpenWebBeans Properties File
+---------------------------------------------
+OpenWebBeans uses a default configuration file to configure some of its
+properties. Default configuration files are embedded into OWB implementation
+jar files. Instead of opening the jars file and changing configuration properties, simply add
+an "openwebbeans.properties" file into a "META-INF/openwebbeans" folder of your application
+classpath. This will override the values from the default configuration.
+You can specify a property 'configuraion.ordinal' in this file to define the overlay order.
+A properties file with higher 'configuration.ordinal' value will applied later and thus
+have a higher precedence. If you don't specify a 'configuration.ordinal' a value of 100 is assumed;
+This allows to have multiple openwebbeans.properties files e.g. a common one in an EAR lib
+(with configuration.ordinal=100) and more specific ones for each WebApp in your EAR (with a
+configuration.ordinal of e.g. 101).
+
+Each plugin developer can provide their own SPI implementation class and own configuration values. If you would like
+to use those implementation classes or configuration values, you have to override the default configuration file as explained
+in the above paragraph, i.e, putting "openwebbeans.properties" file into "META-INF/openwebbeans" folder of your application.
+It is recommended to use a 'configuration.ordinal' between 50 and 99 for custom SPI implementations.
+
+Below are OpenWebBeans' default configuration properties from our openwebbeans-impl.jar file and our plugins such as
+our OpenEJB plugin.
+
+Override default value of ResourceInjectionService
+-------------------------------------------------
+org.apache.webbeans.spi.ResourceInjectionService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService
+
+OpenWebBeans uses the "OpenEjbResourceInjectionService" class to inject resources into the managed bean instances.
+
+Configuration Names and Their Default Values :
+
+- "org.apache.webbeans.spi.ContainerLifecycle"
+ Description : Implementation of org.apache.webbeans.spi.ContainerLifecycle. All magic starts from here.
+ Values : org.apache.webbeans.lifecycle.DefaultLifecycle, OR CUSTOM
+ Default : org.apache.webbeans.lifecycle.DefaultLifecycle
+
+- "org.apache.webbeans.spi.JNDIService"
+ Description : Configures JNDI provider implementation.
+ Values : org.apache.webbeans.spi.se.DefaultJndiService OR CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultJndiService
+
+- "org.apache.webbeans.spi.conversation.ConversationService"
+ Description : Implementation of conversation.
+ Values : org.apache.webbeans.spi.conversation.jsf.DefaultConversationService OR CUSTOM
+ Default : org.apache.webbeans.spi.conversation.jsf.DefaultConversationService
+
+- "org.apache.webbeans.spi.ScannerService"
+ Description : Default implementation of org.apache.webbeans.spi.ScannerService. It is used for scanning application deployment
+ for finding bean classes and configuration files.
+ Values : org.apache.webbeans.spi.ee.deployer.DefaultScannerService OR CUSTOM
+ Default : org.apache.webbeans.spi.ee.deployer.DefaultScannerService
+
+- "org.apache.webbeans.spi.SecurityService"
+ Description : Implementation of org.apache.webbeans.spi.SecurityService. It is used for getting current "Principal".
+ Values : org.apache.webbeans.spi.se.DefaultSecurityService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultSecurityService
+
+- "org.apache.webbeans.spi.ValidatorService"
+ Description : Implementation of org.apache.webbeans.spi.ValidatorService. It is used for getting "ValidatorFactory" and "Validator".
+ Values : org.apache.webbeans.spi.se.DefaultValidatorService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultValidatorService
+
+- "org.apache.webbeans.spi.TransactionService"
+ Description : Implementation of org.apache.webbeans.spi.TransactionService. It is used for getting "TransactionManager" and "Transaction".
+ Values : org.apache.webbeans.spi.se.DefaultTransactionService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultTransactionService
+
+- "org.apache.webbeans.spi.ResourceInjectionService"
+ Description : Implementation of org.apache.webbeans.spi.ResourceInjectionService. It is used for injection Java EE enviroment resource into the
+ Managed Bean instances.
+ Values : org.apache.webbeans.se.DefaultResourceInjectionService or CUSTOM
+ Default : org.apache.webbeans.se.DefaultResourceInjectionService
+
+- "org.apache.webbeans.spi.JNDIService.jmsConnectionFactoryJndi"
+ Description : Configures JMS ConnectionFactory object jndi name
+ Values : Server specific JNDI name
+ Default : ConnectionFactory
+
+- "org.apache.webbeans.conversation.Conversation.periodicDelay"
+ Description : Conversation removing thread periodic delay
+ Values : Configured in millisecond
+ Default : 150000 ms
+
+- "org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService"
+ Description : Use EJB functionality or not. If use OpenEJB configures to true
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.spi.FailOverService"
+ Description : Implementation of the org.apache.webbeans.spi.FailOverService. It is used for enabling passivation/failover beans.
+ Values : org.apache.webbeans.web.failover.DefaultOwbFailOverService or CUSTOM
+ Default : org.apache.webbeans.web.failover.DefaultOwbFailOverService
+
+- "org.apache.webbeans.web.failover.issupportfailover"
+ Description : Support failover of beans or not
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.web.failover.issupportpassivation"
+ Description : Support passivation of beans or not
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.forceNoCheckedExceptions"
+ Description : The interceptors spec defines that @PostConstruct & Co must not throw checked Exceptions. Setting this configuration to 'false' disables this check.
+ Values : false, true
+ Default : true
+
+
+---------------------------------------------
+EJB Support via Embeddable OpenEJB Container in Tomcat 6.X
+---------------------------------------------
+
+Configuration Steps:
+--------------------------------------------
+1* Download Tomcat 6.X version
+2* Configure OpenEJB. Look at URL http://openejb.apache.org/tomcat.html for installation.
+3* Copy JSR-330 API to Tomcat /lib folder.
+4* Copy JSR-299 API to Tomcat /lib folder
+5* Put all dependent libraries of the OpenWebBeans OpenEJB Plugin
+ - openwebbeans-ejb
+ - openwebbeans-impl and its dependencies
+
+You could look at ejb-sample.war for "WEB-INF/lib" libraries as an example to develop custom applications.
+The source of this project is also available.
+
+To use EJB functionality, you will use OpenEJB collapse-ear support. In this configuration,
+your EJB beans live within your "war" bundle.
+
+How to Develop EJB Applications
+---------------------------------------------
+1* Add "META-INF/openwebbeans.properties" into your application classpath.
+2* Add "org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService=true" to use EJB functionality.
+ So OWB container looks for EJBs.
+3* Add "org.apache.webbeans.resource.spi.ResourceService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService to
+use OpenEJB Resource injections.
+4* Add "openwebbeans-ejb", plugin into your web application classpath.
+5* If you want to use other plugins, add respective plugins into your application classpath. For example, if you wish to use
+JSF framework, you add "openwebbeans-jsf" plugin.
+6* Add OWB related interceptor into your EJB Beans. This is called "org.apache.webbeans.ejb.interceptor.OpenWebBeansEjbInterceptor"
+This is needed for OWB injections.
+7* Update your application's "web.xml" to add OWB specific configuration.
+
+---------------------------------------------
+How to Run Samples
+---------------------------------------------
+
+In this release, there are several sample applications located in the "/samples" directory
+of the distribution. You can run those samples via simple maven command.
+
+1) "Guess Application" : Simple usage of the OWB + JSF.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+2) "Hotel Reservation Application" : Show usage of JSF + JPA + OWB
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+3) "EJB Sample Application" : Shows the usage of EJBs with embeddable OpenEJB in Tomcat. Firstly
+configure OpenEJB with Tomcat as explained above.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+4) "EJB Telephone Application" : Shows the usage of OpenEJB resource injection service.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+5) "JMS Injection Sample" : Show JMS injections. JMS injection currently uses
+ ConnectionFactory as JMS connection factory jndi name. You can change this
+ via configuration file. Look above explanation for how to configure JMS jndi. Also,
+ JMS injection requires to use of a JMS provider. Generally Java EE servers contains
+ default JMS provider. It can be run on JBoss and Geronimo. It uses Queue with jndi_name = "queue/A".
+ So you have to create a queue destination in your JMS provider with name "queue/A" to run example.
+ If you want to change queue jndi name, then look at source and change it from "WEB-INF/beans.xml" file.
+
+6) "Conversation Sample" : Shows usage of JSF conversations.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+7) "JSF2 Sample" : Shows usage of JSF2 Ajax.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section. It requires
+to use JSF2 runtime.
+
+
+8) "Standalone Sample" : Shows usage of OpenWebBeans in Standalone Swing Application.
+Look at "OpenWebBeans in Java SE" section.
+
+Configuring and Running the Applications:
+--------------------------------------------
+See section Compile and Run Samples via Jetty&Tomcat Plugin.
+
+--------------------------------------------
+Maven Install and Package From the Source
+--------------------------------------------
+
+Maven Version : Apache Maven 2.2.1 or later
+
+First you have to download the "source" version of the OpenWebBeans project that
+contains the all source code of the OpenWebBeans.
+
+To install the Maven artifacts of the project from the source, Maven must be installed
+in your runtime. After Maven installation, just run the following command in the top level
+directory that contains the main "pom.xml" :
+
+> mvn clean install
+
+This command will install all the Maven artifacts into your local Maven repository.
+
+If you wish to package all artifacts of the project, just run the following command
+in in the top level directory that contains the main "pom.xml" :
+
+> mvn clean package
+
+This command will package the project artifacts from the source and put these artifacts into the each modules
+respective "target" directory.
+
+-------------------------------------------
+Compile and Run Samples via Tomcat&Jetty Plugin
+-------------------------------------------
+This section shows how to run samples in Jetty or OpenEJB Embedded Tomcat.
+
+------------------------------------------
+Samples Run within Jetty Plugin
+------------------------------------------
+You can compile and run "guess","jsf2","conversation-sample" and "reservation "samples via maven Jetty plugin.
+Go to the source bundle "samples/" directory. In the "guess/" or "reservation/" directory, run
+the following maven commands. It will start up maven Jetty container. It bundles all of the
+required jars into the WEB-INF/lib folder. You are not required to add any jar to the classpath.
+
+Samples : Guess and Reservation
+------------------------------
+Go to the source folder of projects and run
+
+> mvn clean install -Pjetty
+> mvn jetty:run -Pjetty
+
+Guess URL : http://localhost:8080/guess
+Reservation URL : http://localhost:8080/reservation
+
+Samples : Conversation Sample and JSF2
+-------------------------------------
+Go to the source folder of projects and run
+
+>mvn clean install
+>mvn jetty:run
+
+Conversation Sample URL : http://localhost:8080/conversation-sample
+JSF2 Sample URL : http://localhost:8080/jsf2sample
+
+------------------------------------------
+Samples Run within Tomcat Plugin
+------------------------------------------
+OpenEJB samples are run with Maven Tomcat Plugin.
+
+Tomcat Plugin uses http://localhost:8080/manager application to deploy war file
+into your embeddable EJB Tomcat container. There must be an tomcat-users.xml
+file in the "conf" directory of the server that contains manager role and username.
+
+>Start Tomcat server if not started
+>mvn tomcat:deploy
+
+Ejb Sample URL : http://localhost:8080/ejb-sample
+Ejb Telephone URL : http://localhost:8080/ejb-telephone
+
+Example tomcat-users.xml file
+------------------------------------------
+<tomcat-users>
+<role rolename="manager"/>
+<user username="admin" password="" roles="manager"/>
+</tomcat-users>
+
+-----------------------------------------
+Deploy JMS Sample
+-----------------------------------------
+Simple drops jms-sample.war file into your application deploy location.
+
+JMS Sample Example URL : Hit the url http://localhost:8080/jms-sample/sender.jsf for sending JMS messages
+ Hit the url http://localhost:8080/jms-sample/receiver.jsf for receiving JMS messages
+
+-----------------------------------------
+OpenWebBeans in Java SE
+----------------------------------------
+OpenWebBeans can be used in Java SE environments such as Java Swing
+applications. A Standalone Sample is provided to show how to use OpenWebBeans
+in Java SE.
+
+Go to the source directory of the standalone sample:
+>mvn clean package;
+>cd target;
+>jar -xvf standalone-sample.jar
+>java -jar standalone-sample-1.0.0-SNAPSHOT.jar
+>Enjoy :)
+
+-----------------------------------------------
+OpenWebBeans User and Development Mailing Lists
+-----------------------------------------------
+Please mail to the user mailing list with any questions or advice
+about the OpenWebBeans.
+
+User Mailing List : [users@openwebbeans.apache.org]
+
+You can also join the discussions happening in the dev list
+
+Dev Mailing List : [dev@openwebbeans.apache.org]
+
+-------------------------------------------
+OpenWebBeans JIRA Page
+-------------------------------------------
+Please logs bugs into the "https://issues.apache.org/jira/browse/OWB".
+
+------------------------------------------
+OpenWebBeans Wiki and Blog Page
+-----------------------------------------
+Wiki: http://cwiki.apache.org/OWB/
+Introduction to OpenWebBeans : http://cwiki.apache.org/OWB/introduction-to-openwebbeans.html
+Blog : http://blogs.apache.org/owb
+
+-----------------------------------------
+OpenWebBeans Web Page
+----------------------------------------
+You can reach the OpenWebBeans web page at
+http://openwebbeans.apache.org
+---------------------------------------
+
+Your OpenWebBeans Team
+
+Enjoy!
diff --git a/owb_1.2.x/readme/README_1_0_0.txt b/owb_1.2.x/readme/README_1_0_0.txt
new file mode 100644
index 0000000..c325604
--- /dev/null
+++ b/owb_1.2.x/readme/README_1_0_0.txt
@@ -0,0 +1,761 @@
+-------------------------------
+Apache OpenWebBeans 1.0.0
+-------------------------------
+Welcome!
+Thanks for downloading and using OpenWebBeans.
+This document is a "Getting Started Guide" for OpenWebBeans.
+
+This document is based on the 1.0.0 release of the OpenWebBeans.
+
+--------------------------------
+What is Apache OpenWebBeans?
+--------------------------------
+OpenWebBeans is an ASL 2.0-licensed implementation of the JSR-299, Contexts and Dependency Injection for the Java EE platform.
+
+Project's web page can be found at:
+"http://openwebbeans.apache.org"
+
+The projects WIKI page can be found at:
+https://cwiki.apache.org/confluence/display/OWB/Index
+
+
+--------------------------------
+OpenWebBeans 1.0.0 Release Features
+--------------------------------
+
+- 1.0.0 release supports the following features
+-----------------------------------
+* Managed Beans Support
+* Session Beans Support (via Embeddable OpenEJB container in Tomcat)
+* Producer Method Support
+* Producer Field Support
+* Java EE Resource Injection Support
+* JMS OpenWebBeans Support(OWB Specific)
+* Inheritance, Stereotype Inheritances
+* Specialization Support
+* Event Support
+* Decorator and Interceptor Support
+* Lookup and Dependency Injection Support
+* Java EE Plugin Support (via ServetContextListener interface)
+* Portable Integration Support
+* Passivation Capability of Beans
+* @Alternative support
+* OSGi environment support with an own plugable bundle ClassPath scanner
+* vastly improved Interceptor performance
+* improved Serialization handling
+* improved CreationalContext handling
+* revised internal logging
+* upgrade to JPA-2 and JSF-2 support
+* support for direct CDI usage in tomcat-6 and tomcat-7 environments
+
+
+
+- 1.0.0 release does not support the following features
+--------------------------------------------
+* Does not fully integrate with Geronimo
+ (You have to configure your application to use OWB functionality,
+ e.g configure web.xml, adding interceptor to EJBs etc.)
+
+
+Noteable differences to CDI spec behaviour
+--------------------------------------------
+
+In a few special cases Apache OpenWebBeans might behave a little bit different than
+other CDI implementations. This is to some degree caused by the JSR-299 spec being
+not clear about some special topics so we needed to interpret the wording on our own.
+This mainly concerns the area of section 12.1 Bean Archives (BDA) which doesn't work
+out when it comes to OSGi containers and likes.
+In Apache OpenWebBeans, a settings configured in a beans.xml file of a BDA is not
+only effective for this very bean archive but for the whole BeanManager in control
+of the Application. This is especially the case for <alternatives> and
+<interceptors>! An Alternative, Interceptor or Decorator enabled in one BDA is active
+for the whole Application.
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0
+-------------------------------------------
+
+Bug
+
+ * [OWB-318] - multiple methods with same EJB @interceptors(foo.class) in same bean class get multiple interceptor instances
+ * [OWB-384] - OWB needs to call 299-defined PrePassivate, PostActivate, and AroundTimeout interceptors for EJBs
+ * [OWB-422] - Support needed for PrePassivate, PostActivate, and AroundTimeout via EJBInterceptor.
+ * [OWB-429] - OpenWebBeansEjbPlugin Class Hierarchy
+ * [OWB-438] - Cached Normal Scoped Proxy instances
+ * [OWB-439] - EjbPlugin session bean proxy creation thread safe problem
+ * [OWB-445] - we must not use javassist ProxyFactory#setHandler(MethodHandler)
+ * [OWB-446] - EJB lifecycle callbacks not stacked correctly
+ * [OWB-450] - NullPointerException in DependentScopedBeanInterceptorHandler when it has a NullCreationalContext (normally from a EE component).
+ * [OWB-454] - ClassUtil.callInstanceMethod() doesn't propogate original exception
+ * [OWB-455] - IllegalArgument method calling remove method of EJB during destroy
+ * [OWB-456] - When multiple interceptors are defined for a bean OWB does NOT correctly remove the overriden base Interceptors
+ * [OWB-457] - we must not create a SessionContext for static resource reqeusts
+ * [OWB-460] - fix owb-openejb and owb-ejb artifactIds
+ * [OWB-464] - InjectionPointImpl using wrong class loader during serialize/deserialize, dropping qualifiers, and omiting qualifier values.
+ * [OWB-466] - Ensure removal of all ThreadLocal values
+
+Improvement
+
+ * [OWB-177] - Handling of InterceptionType#POST_ACTIVATE, PRE_PASSIVATE and AROUND_TIMEOUT is missing
+ * [OWB-407] - detailed information about exceptions
+ * [OWB-451] - Allow InterceptorUtil#callAroundInvokes to propogate a callers 'creational context key'
+ * [OWB-459] - upgrade to newer library versions
+ * [OWB-463] - EjbDefinitionUtility.defineEjbBeanProxy() should be able to create proxies for no-interface local beans
+ * [OWB-465] - enhance EJB common code for crude @LocalBean support
+
+TCK Challenge
+
+ * [OWB-394] - Any idea why our BeforeBeanDiscovery.addInterceptorBinding() has different signature?
+
+Task
+
+ * [OWB-453] - add a flag to disable context activation in EJB interceptor
+ * [OWB-462] - Refactor AnnotationUtil.hasAnnotationMember()
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0-alpha-2
+-------------------------------------------
+Bug
+
+ * [OWB-303] - upgrade Javassist to a newer version
+ * [OWB-338] - our internal SessionContext and ConversationContext must support Session serialization
+ * [OWB-385] - implement passivation of managed beans in ServletContextListener
+ * [OWB-401] - ELContextStore not cleaned up for some JSP EL lookups
+ * [OWB-402] - OpenWebBeansJsfPlugin does not recognize @ManagedBean
+ * [OWB-404] - Contexts must not get stored in a static Map in BeanManager
+ * [OWB-405] - AnnotatedElementFactory must not use static cache maps
+ * [OWB-408] - NPE in WebBeansELResolver
+ * [OWB-415] - EjbBeanProxyHandler for dependent ejb must save ejb instance
+ * [OWB-416] - BaseEJBBean.destroyComponentInstance() tries to call multiple remove methods
+ * [OWB-418] - EjbBeanProxyHandler must be 1:1 with proxy instances for dependent SFSB
+ * [OWB-419] - fix @Dependent handling in ELResolver
+ * [OWB-420] - SingletonContext is mapped to @ConversationScoped
+ * [OWB-421] - defined-in-class EJB lifecycle callbacks masked by our Interceptor
+ * [OWB-426] - Tweak EJBPlugin to work with Standalone Tests
+ * [OWB-431] - Generic Type Inheritance not resolved correctly
+ * [OWB-434] - ThreadLocal<SingletonContext> doen't get cleaned up
+ * [OWB-436] - AbstractContext bean instance creation is not thread safe
+ * [OWB-437] - Improve AbstractContext synchronization
+ * [OWB-440] - WebBeansDecoratorConfig.getDecoratorStack always returns new Decorators
+ * [OWB-442] - our EJB proxies are broken when multiple local interfaces are used on a single class
+ * [OWB-443] - Normal-scoped EJB not removed by container during Contextual.destroy()
+
+Improvement
+
+ * [OWB-57] - cleanup problems found by maven-findbugs-plugin
+ * [OWB-195] - Give warning to the developer related with non- portable operations
+ * [OWB-409] - create a name for OWB our faces-config.xml
+ * [OWB-410] - lazy initialisation of ejbInterceptors
+ * [OWB-411] - cache calls to isNormalScope()
+ * [OWB-412] - Allow container specific extensions to WebConfigurationListener access to the lifecycle
+ * [OWB-413] - cache calls to ClassUtils#getObjectMethodNames()
+ * [OWB-414] - improve Interceptor performance
+ * [OWB-425] - improve performance of owb-el-resolver
+ * [OWB-427] - improve read-performance of AbstractOwbBean
+ * [OWB-430] - improve performance of WebBeansPhaseListener
+ * [OWB-432] - Create Singleton Service SPI
+ * [OWB-441] - new configuration properties mechanism
+
+Sub-task
+
+ * [OWB-193] - If an interceptor or decorator has any scope other than @Dependent, non-portable behavior results.
+ * [OWB-194] - If an interceptor or decorator has a name, non-portable behavior results.
+ * [OWB-196] - If an interceptor or decorator is an alternative, non-portable behavior results.
+ * [OWB-197] - If a stereotype declares any other qualifier an- notation, non-portable behavior results.
+ * [OWB-198] - If a stereotype is annotated @Typed, non-portable behavior results.
+
+
+TCK Challenge
+
+ * [OWB-424] - Adding Document for How to Configure and Run TCK (standalone and web profile TCKs)
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0-alpha-1
+-------------------------------------------
+Bug
+
+ * [OWB-216] - Update pom.xml svn links
+ * [OWB-231] - exception using abstract decorators
+ * [OWB-245] - Using parameterized type varaibles fails for Producer Method injection
+ * [OWB-259] - Implement spec 11.5.5. ProcessModule event
+ * [OWB-289] - Owb return 2 beans for Indirect specialized producer beans
+ * [OWB-302] - InjectionPoint injections (both method and field based) in Decorators result in null
+ * [OWB-312] - Add dopriv's to allow OWB to function with java 2 security enabled
+ * [OWB-317] - creationalContext in InvocationContextImpl is always null
+ * [OWB-318] - multiple methods with same EJB @interceptors(foo.class) in same bean class get multiple interceptor instances
+ * [OWB-327] - annotating an Interceptor with @ApplictionScoped leads to OutOfMemory
+ * [OWB-329] - Interceptor instances get created each time the interceptor gets called
+ * [OWB-332] - Destroy Depdent Of Producer Method Beans when Invocation Completes
+ * [OWB-333] - InjectionTarget and Producer Handling
+ * [OWB-334] - cid is missing when using redirect for a jsf 2.0 application
+ * [OWB-336] - injected BeanManager must be Serializable
+ * [OWB-337] - events must not get broadcasted to beans which have no active Context
+ * [OWB-339] - Injecting Non-Contextual Beans Causes NPE in WebBeansUtil
+ * [OWB-340] - BeanManagerImpl.createInjectionTarget() Throws Exception When No Constructor Found
+ * [OWB-341] - CreationalContext#incompleteInstance should get cleaned after create()
+ * [OWB-342] - InterceptorHandler crashes with NullPointerException after deserialisation
+ * [OWB-343] - upgrade JPA spec from 1.0-PFD2 to 1.0 final revision
+ * [OWB-345] - Remove duplicate dependencies
+ * [OWB-351] - OWB picks up @SessionScoped contextual instances from expired sessions
+ * [OWB-352] - Thread Safety Problem in our InterceptorHandlers, aka proxies
+ * [OWB-353] - NPE in removeDependents@CreationalContextImpl
+ * [OWB-354] - WebContextService may throw NPE in tiered classloading environmemt
+ * [OWB-357] - WebbeansFinder should index first on ClassLoader, not singleton type
+ * [OWB-359] - ownerCreationalContext sometimes causes NPE in InterceptorDataImpl.createNewInstance()
+ * [OWB-361] - underlying EJB method not actually in our interceptors stack
+ * [OWB-362] - InvocationTargetException when invoking Stateless SessionBean
+ * [OWB-363] - Intermittent bug with ApplicationScope disposers not being called
+ * [OWB-366] - ContextNotActiveException fired from AppScope/NormalScopedBeanInterceptorHandler when a proxied object finalized
+ * [OWB-368] - The 299 spec (that I have) uses receive=IF_EXISTS but OWB uses notifyObserver=IF_EXISTS.
+ * [OWB-369] - Static ContextsService in ContextFactory causes wrong webContextService used for multiple applications
+ * [OWB-370] - Intransient Conversation context get rdestroyed randomly by destroyWithRespectToTimout
+ * [OWB-371] - no lifecycle interceptors for non-contextual EJB
+ * [OWB-372] - creational context not cleaned up for non-contextual EJB interceptions
+ * [OWB-373] - build crashes with missing artifact error
+ * [OWB-374] - migrate jsf2sample from sun to MyFaces
+ * [OWB-376] - [patch] Guess example broken with Jetty plugin 6.x due to EL 2.2
+ * [OWB-377] - revise logging
+ * [OWB-378] - ejb at bottom of decorator stack doesn't handle changed method
+ * [OWB-380] - NormalScopedBeanInterceptorHandler throws NPE when handling 3rd party Contexts
+ * [OWB-381] - NPE thrown from AbstractInjectable if dependent producer returns null
+ * [OWB-382] - injecting a @Dependent bean into a passivatation scoped bean causes a NonSerializableException
+ * [OWB-387] - DependentContext Interceptor Double Call for PostConstruct
+ * [OWB-390] - fix broken links in our 'site'
+ * [OWB-396] - fix poms to work with maven 3
+ * [OWB-398] - DelegateHandler cached too agressively
+ * [OWB-399] - Proxy objects could not be correctly deserialized by using javassist 3.11. we need to update to 3.12
+ * [OWB-400] - starting OWB as part of an EAR in geronimo causes a exception due to missing 'bundle' protocol
+
+Improvement
+
+ * [OWB-116] - Update Business Method Definition
+ * [OWB-118] - Supports Decorators for Other Delegate Injections
+ * [OWB-136] - fix 'broken' license headers in our java files
+ * [OWB-170] - Address findbug issues in webbeans-impl
+ * [OWB-183] - Improve webbeans-doc module to get a documentation more user friendly
+ * [OWB-214] - get rid of javax.transaction.Transaction dependency in webbeans-impl
+ * [OWB-237] - NoSuchElementException when WebBeansConfigurationListener is absent
+ * [OWB-275] - remove unused imports and cleanup code
+ * [OWB-286] - java.lang.NoClassDefFoundError: javax/validation/Validator
+ * [OWB-313] - create caching strategies for resolving Bean<T> for BeanManager and EL invocations
+ * [OWB-314] - cache resolved instances in NormalScopedBeanMethodHandlers of @ApplicationScoped beans
+ * [OWB-315] - cache resolved instances in NormalScopedBeanMethodHandlers of @SessionScoped beans
+ * [OWB-319] - Strange logging when writing non-Serializable SessionScoped bean
+ * [OWB-320] - Remove Java EE Dependencies from WebBeans Core
+ * [OWB-322] - Create new EJB project and separate common EJB classes from OpenEJB plugin
+ * [OWB-325] - Relocate SPI Classes to SPI Module. Change JSR299, JSR330 as optional pom dependency.
+ * [OWB-326] - improve producer tests
+ * [OWB-328] - improve logger performance
+ * [OWB-330] - reduce BeanManagerImpl#getManager() calls inside the same functions
+ * [OWB-331] - Cache Interceptor & Decorator Stack oon Interceptor Handler
+ * [OWB-346] - Make EJB samples running
+ * [OWB-347] - Using InjectableBeanManager in TCK
+ * [OWB-349] - ignore exception during type hierarchy scan
+ * [OWB-350] - Support Interceptor for non-contextual EJBs
+ * [OWB-355] - OpenEjbBean should look for @Remove methods
+ * [OWB-356] - EjbPlugin only looks for DeployementInfo once, so new deployed application won't be discovered
+ * [OWB-358] - provide property to skip injection in @PostConstruct of OpenWebBeansEjbInterceptor
+ * [OWB-360] - Add BeanManager to a ServletContext attribute
+ * [OWB-364] - Reduce the amount of info level logging
+ * [OWB-365] - make injection optional in OWBEJBInterceptor
+ * [OWB-375] - Performance: OWB logging performs operations when logging disabled.
+ * [OWB-379] - upgrade to final atinject-spec artifact
+ * [OWB-386] - upgarde CDI TCK to 1.0.2.CR1
+ * [OWB-389] - atinject-tck upgrade to final 1.0 release
+ * [OWB-397] - Add helper method and some debug to WebBeansFinder
+
+New Feature
+
+ * [OWB-316] - Implement a generic TestContainer for CDI implementations
+ * [OWB-323] - Provide methods to pass classloader into ServiceLoader and WebBeansFinder for use in tiered classloader situations
+ * [OWB-324] - Add Tomcat Plugin
+ * [OWB-348] - Adding Interceptor and Decorator Support for EJB Beans
+ * [OWB-395] - OpenWebBeans Tomcat 7 Support
+
+TCK Challenge
+
+ * [OWB-388] - Pass TCK 1.0.2 CR1 Web Profile
+
+Task
+
+ * [OWB-6] - Scope passivation
+ * [OWB-14] - Update WebBeans Lifecycle for Servlet Beans
+ * [OWB-46] - Injection into non-contextual objects
+ * [OWB-204] - Update Samples for JSF2 Usage
+ * [OWB-220] - Update site.xml links and bread crumbs to point to non-incubator.
+ * [OWB-310] - Drop dom4j and use jre builtin xml parsers for processing beans.xml
+ * [OWB-391] - create a owb-build-tools project to maintain project specific checkstyle rules, etc.
+
+Test
+
+ * [OWB-56] - Integrate the official JSR-299 TCK test suite
+ * [OWB-222] - Update website download link, and fix relative URL translation
+ * [OWB-367] - Add a unit test for IF_EXISTS
+
+
+----------------------------------------------
+Required Platform
+----------------------------------------------
+Java Version : Java SE >= 6.0
+Java EE Must : Java EE >= 5.0
+
+---------------------------------------------
+How to Configure OpenWebBeans
+---------------------------------------------
+
+This section explains a content of the distribution bundle, OWB plugins and its
+dependent libraries.
+
+---------------------------------------------
+1.0.0 Distribution Content
+---------------------------------------------
+There are several jars in the OpenWebBeans 1.0.0 distribution;
+
+ - openwebbeans-impl-1.0.0.jar --> Includes Core Dependency Injection Service.
+ - openwebbeans-ejb-1.0.0.jar --> EJB Plugin(Supports EJBs in OpenEJB embedded in Tomcat).
+ - openwebbeans-openejb-1.0.0.jar --> OpenEJB specific Plugin SPI implementations as extension to openwebbeans-ejb
+ - openwebbeans-jms-1.0.0.jar --> JMS Plugin(Supports injection of JMS related artifacts,i.e, ConnectionFactory, Session, Connection etc.)
+ - openwebbeans-jsf-1.0.0.jar --> JSF-2.0 Plugin(JSF Conversation Scoped Support).
+ - openwebbeans-jsf12-1.0.0.jar --> JSF-1.2 Plugin(JSF Conversation Scoped Support).
+ - openwebbeans-resource-1.0.0.jar --> Java EE Resource Injection for Web Projects (Includes @PersistenceContext,@PersistenceUnit
+ and @Resource injection into the Managed Beans. @Resource injections use java:/comp/env of the
+ Web application component. @PersistenceContext is based on extended EntityManager.
+ - openwebbeans-spi-1.0.0.jar --> OpenWebBeans Server Provider Interfaces. They are implemented by runtime environments that would
+ like to use OpenWebBeans as a JSR-299 implementation.
+ - samples --> Includes source code of the samples. Samples are mavenized project therefore you can easily build and run
+ them from your environment that has maven runtime.
+ - openwebbeans-osgi-1.0.0.jar --> ClassPath ScannerService SPI implementation for OSGI environments like Apache Geronimo-3
+ - openwebbeans-web-1.0.0.jar --> Basic Servlet integration
+ - openwebbeans-tomcat6-1.0.0.jar --> Support for deeper integration into Apache Tomcat-6
+
+
+
+
+------------------------------------------
+How OWB Plugins Work
+------------------------------------------
+
+OpenWebBeans has been developed with a plugin architecture. The Core dependency injection service
+is provided with openwebbeans-impl. If you need further service functionality,
+you have to add respective plugin jars into the application classpath. OpenWebBeans
+uses the Java SE 6.0 java.util.ServiceLoader mechanism to pickup plugins at runtime.
+
+Current Plugins:
+---------------------
+Look at "1.0.0 Distribution Content" above.
+
+------------------------------------------
+Dependent Libraries
+------------------------------------------
+
+Third Party jars:
+-----------------
+They are necessary at runtime in the Core Implementation.
+
+javassist : Version 3.12.0.GA
+scannotation : Version 1.0.2 (if not running in an OSGi environment like Apache Geronimo-3)
+
+Java EE APIs jars(Container Provider Libraries) :
+-------------------------------------------------
+Generally full Java EE servers provides these jars. But web containers like Tomcat or Jetty
+do not contain some of them, such as JPA, JSF, Validation API etc. So, if you do not want to bundle
+these libraries within your application classpath, you have to include these libraries in your
+server common classpath.
+
+jcdi-api (JSR-299 Specification API)
+atinject-api (JSR-330 Specification API)
+servlet-2.5 or servlet 3.0 (Servlet Specification API)
+ejb-3.1 (EJB Specification API)
+el-2.2 (Expression Langauge Specification API)
+jsf-2.0 (Java Server Faces API)
+jsr-250 (Annotation API)
+interceptor-1.1 (Interceptor API)
+jta-1.1 (Java Transaction API)
+jsp.2.1 or jsp-2.2 (Java Server Pages API)
+jpa-2.0 (Java Persistence API)
+jaxws-2.1 or jaxws-2.2 (Java Web Service API)
+jms-1.1 or jms-1.2 (Java Messaging Service API)
+validation (Validation Specification)
+
+Dependencies of OpenWebBeans Maven Modules&Plugins
+--------------------------------------------------
+
+openwebbeans-impl :
+------------------
+Third party : javassist, scannotation, openwebbeans-spi
+Container Provided : jcdi-api, at-inject, servlet, el, jsr-250, interceptor, jta, jsp, validation
+
+openwebbeans-ejb:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : OpenWebBeans EJB plugin is based on OpenEJB in Tomcat. Therefore, if you install OpenEJB
+ within Tomcat correctly, there is no need to add any additional libraries. Look at the
+ OpenEJB in Tomcat configuration section.
+
+openwebbeans-jms:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : jms
+
+openwebbeans-jsf:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : jsf
+
+NOTE : We are trying to decrease dependent libraries of the our core, i.e, openwebbeans-impl.
+At 1.0.0, dependent third party libraries will be decreased. We have a plan to create profile
+plugins, therefore each profile plugin provides its own dependent libraries. For example, in
+fully Java EE Profile Plugin, Transaction API is supported but this will not be the case
+for Java Web Profile Plugin or Java SE Profile Plugin. Stay Tuned!
+
+Currently, as you have seen above, openwebbeans-impl depends on some Java EE/Runtime
+provided libraries (servlet, jsp, el etc). In the future, with OpenWebBeans profiling support,
+openwebbeans-impl will not depend on any Java EE APIs. Those APIs will be provided
+by OpenWebBeans profiles/plugins that openwebbeans-impl will be used. Therefore,
+you will able to use OpenWebBeans in your own runtime environment easily by writing
+your own plugins and contributing it to OpenWebBeans :)
+
+------------------------------------------
+Library Configuration
+------------------------------------------
+To run openwebbeans applications in the Java EE based application server,
+you could add the JSR-299 API and JSR-330 API into the server common classpath, and
+implementation, plugins and dependent jars into your "WEB-INF/lib" directory
+of the Java EE Web Application.
+
+In this release, we can not support the OpenWebBeans as an integrated
+functionality of the Java EE Application Servers. So, you have to manage the
+configuration of the OpenWebBeans within your application's "web.xml" file. A sample "web.xml"
+file can be found in the "config" directory. To use EJB functionality, you also have to
+add OWB specific interceptor into your EJB beans. Look at the EJB section of this readme
+for further details.
+
+---------------------------------------------
+OpenWebBeans Properties File
+---------------------------------------------
+OpenWebBeans uses a default configuration file to configure some of its
+properties. Default configuration files are embedded into OWB implementation
+jar files. Instead of opening the jars file and changing configuration properties, simply add
+an "openwebbeans.properties" file into a "META-INF/openwebbeans" folder of your application
+classpath. This will override the values from the default configuration.
+You can specify a property 'configuraion.ordinal' in this file to define the overlay order.
+A properties file with higher 'configuration.ordinal' value will applied later and thus
+have a higher precedence. If you don't specify a 'configuration.ordinal' a value of 100 is assumed;
+This allows to have multiple openwebbeans.properties files e.g. a common one in an EAR lib
+(with configuration.ordinal=100) and more specific ones for each WebApp in your EAR (with a
+configuration.ordinal of e.g. 101).
+
+Each plugin developer can provide their own SPI implementation class and own configuration values. If you would like
+to use those implementation classes or configuration values, you have to override the default configuration file as explained
+in the above paragraph, i.e, putting "openwebbeans.properties" file into "META-INF/openwebbeans" folder of your application.
+It is recommended to use a 'configuration.ordinal' between 50 and 99 for custom SPI implementations.
+
+Below are OpenWebBeans' default configuration properties from our openwebbeans-impl.jar file and our plugins such as
+our OpenEJB plugin.
+
+Override default value of ResourceInjectionService
+-------------------------------------------------
+org.apache.webbeans.spi.ResourceInjectionService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService
+
+OpenWebBeans uses the "OpenEjbResourceInjectionService" class to inject resources into the managed bean instances.
+
+Configuration Names and Their Default Values :
+
+- "org.apache.webbeans.spi.ContainerLifecycle"
+ Description : Implementation of org.apache.webbeans.spi.ContainerLifecycle. All magic starts from here.
+ Values : org.apache.webbeans.lifecycle.DefaultLifecycle, OR CUSTOM
+ Default : org.apache.webbeans.lifecycle.DefaultLifecycle
+
+- "org.apache.webbeans.spi.JNDIService"
+ Description : Configures JNDI provider implementation.
+ Values : org.apache.webbeans.spi.se.DefaultJndiService OR CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultJndiService
+
+- "org.apache.webbeans.spi.conversation.ConversationService"
+ Description : Implementation of conversation.
+ Values : org.apache.webbeans.spi.conversation.jsf.DefaultConversationService OR CUSTOM
+ Default : org.apache.webbeans.spi.conversation.jsf.DefaultConversationService
+
+- "org.apache.webbeans.spi.ScannerService"
+ Description : Default implementation of org.apache.webbeans.spi.ScannerService. It is used for scanning application deployment
+ for finding bean classes and configuration files.
+ Values : org.apache.webbeans.spi.ee.deployer.DefaultScannerService OR CUSTOM
+ Default : org.apache.webbeans.spi.ee.deployer.DefaultScannerService
+
+- "org.apache.webbeans.spi.SecurityService"
+ Description : Implementation of org.apache.webbeans.spi.SecurityService. It is used for getting current "Principal".
+ Values : org.apache.webbeans.spi.se.DefaultSecurityService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultSecurityService
+
+- "org.apache.webbeans.spi.ValidatorService"
+ Description : Implementation of org.apache.webbeans.spi.ValidatorService. It is used for getting "ValidatorFactory" and "Validator".
+ Values : org.apache.webbeans.spi.se.DefaultValidatorService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultValidatorService
+
+- "org.apache.webbeans.spi.TransactionService"
+ Description : Implementation of org.apache.webbeans.spi.TransactionService. It is used for getting "TransactionManager" and "Transaction".
+ Values : org.apache.webbeans.spi.se.DefaultTransactionService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultTransactionService
+
+- "org.apache.webbeans.spi.ResourceInjectionService"
+ Description : Implementation of org.apache.webbeans.spi.ResourceInjectionService. It is used for injection Java EE enviroment resource into the
+ Managed Bean instances.
+ Values : org.apache.webbeans.se.DefaultResourceInjectionService or CUSTOM
+ Default : org.apache.webbeans.se.DefaultResourceInjectionService
+
+- "org.apache.webbeans.spi.JNDIService.jmsConnectionFactoryJndi"
+ Description : Configures JMS ConnectionFactory object jndi name
+ Values : Server specific JNDI name
+ Default : ConnectionFactory
+
+- "org.apache.webbeans.conversation.Conversation.periodicDelay"
+ Description : Conversation removing thread periodic delay
+ Values : Configured in millisecond
+ Default : 150000 ms
+
+- "org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService"
+ Description : Use EJB functionality or not. If use OpenEJB configures to true
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.spi.FailOverService"
+ Description : Implementation of the org.apache.webbeans.spi.FailOverService. It is used for enabling passivation/failover beans.
+ Values : org.apache.webbeans.web.failover.DefaultOwbFailOverService or CUSTOM
+ Default : org.apache.webbeans.web.failover.DefaultOwbFailOverService
+
+- "org.apache.webbeans.web.failover.issupportfailover"
+ Description : Support failover of beans or not
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.web.failover.issupportpassivation"
+ Description : Support passivation of beans or not
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.forceNoCheckedExceptions"
+ Description : The interceptors spec defines that @PostConstruct & Co must not throw checked Exceptions. Setting this configuration to 'false' disables this check.
+ Values : false, true
+ Default : true
+
+
+---------------------------------------------
+EJB Support via Embeddable OpenEJB Container in Tomcat 6.X
+---------------------------------------------
+
+Configuration Steps:
+--------------------------------------------
+1* Download Tomcat 6.X version
+2* Configure OpenEJB. Look at URL http://openejb.apache.org/tomcat.html for installation.
+3* Copy JSR-330 API to Tomcat /lib folder.
+4* Copy JSR-299 API to Tomcat /lib folder
+5* Put all dependent libraries of the OpenWebBeans OpenEJB Plugin
+ - openwebbeans-ejb
+ - openwebbeans-impl and its dependencies
+
+You could look at ejb-sample.war for "WEB-INF/lib" libraries as an example to develop custom applications.
+The source of this project is also available.
+
+To use EJB functionality, you will use OpenEJB collapse-ear support. In this configuration,
+your EJB beans live within your "war" bundle.
+
+How to Develop EJB Applications
+---------------------------------------------
+1* Add "META-INF/openwebbeans.properties" into your application classpath.
+2* Add "org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService=true" to use EJB functionality.
+ So OWB container looks for EJBs.
+3* Add "org.apache.webbeans.resource.spi.ResourceService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService to
+use OpenEJB Resource injections.
+4* Add "openwebbeans-ejb", plugin into your web application classpath.
+5* If you want to use other plugins, add respective plugins into your application classpath. For example, if you wish to use
+JSF framework, you add "openwebbeans-jsf" plugin.
+6* Add OWB related interceptor into your EJB Beans. This is called "org.apache.webbeans.ejb.interceptor.OpenWebBeansEjbInterceptor"
+This is needed for OWB injections.
+7* Update your application's "web.xml" to add OWB specific configuration.
+
+---------------------------------------------
+How to Run Samples
+---------------------------------------------
+
+In this release, there are several sample applications located in the "/samples" directory
+of the distribution. You can run those samples via simple maven command.
+
+1) "Guess Application" : Simple usage of the OWB + JSF.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+2) "Hotel Reservation Application" : Show usage of JSF + JPA + OWB
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+3) "EJB Sample Application" : Shows the usage of EJBs with embeddable OpenEJB in Tomcat. Firstly
+configure OpenEJB with Tomcat as explained above.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+4) "EJB Telephone Application" : Shows the usage of OpenEJB resource injection service.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+5) "JMS Injection Sample" : Show JMS injections. JMS injection currently uses
+ ConnectionFactory as JMS connection factory jndi name. You can change this
+ via configuration file. Look above explanation for how to configure JMS jndi. Also,
+ JMS injection requires to use of a JMS provider. Generally Java EE servers contains
+ default JMS provider. It can be run on JBoss and Geronimo. It uses Queue with jndi_name = "queue/A".
+ So you have to create a queue destination in your JMS provider with name "queue/A" to run example.
+ If you want to change queue jndi name, then look at source and change it from "WEB-INF/beans.xml" file.
+
+6) "Conversation Sample" : Shows usage of JSF conversations.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+7) "JSF2 Sample" : Shows usage of JSF2 Ajax.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section. It requires
+to use JSF2 runtime.
+
+
+8) "Standalone Sample" : Shows usage of OpenWebBeans in Standalone Swing Application.
+Look at "OpenWebBeans in Java SE" section.
+
+Configuring and Running the Applications:
+--------------------------------------------
+See section Compile and Run Samples via Jetty&Tomcat Plugin.
+
+--------------------------------------------
+Maven Install and Package From the Source
+--------------------------------------------
+
+Maven Version : Apache Maven 2.2.1 or later
+
+First you have to download the "source" version of the OpenWebBeans project that
+contains the all source code of the OpenWebBeans.
+
+To install the Maven artifacts of the project from the source, Maven must be installed
+in your runtime. After Maven installation, just run the following command in the top level
+directory that contains the main "pom.xml" :
+
+> mvn clean install
+
+This command will install all the Maven artifacts into your local Maven repository.
+
+If you wish to package all artifacts of the project, just run the following command
+in in the top level directory that contains the main "pom.xml" :
+
+> mvn clean package
+
+This command will package the project artifacts from the source and put these artifacts into the each modules
+respective "target" directory.
+
+-------------------------------------------
+Compile and Run Samples via Tomcat&Jetty Plugin
+-------------------------------------------
+This section shows how to run samples in Jetty or OpenEJB Embedded Tomcat.
+
+------------------------------------------
+Samples Run within Jetty Plugin
+------------------------------------------
+You can compile and run "guess","jsf2","conversation-sample" and "reservation "samples via maven Jetty plugin.
+Go to the source bundle "samples/" directory. In the "guess/" or "reservation/" directory, run
+the following maven commands. It will start up maven Jetty container. It bundles all of the
+required jars into the WEB-INF/lib folder. You are not required to add any jar to the classpath.
+
+Samples : Guess and Reservation
+------------------------------
+Go to the source folder of projects and run
+
+> mvn clean install -Pjetty
+> mvn jetty:run -Pjetty
+
+Guess URL : http://localhost:8080/guess
+Reservation URL : http://localhost:8080/reservation
+
+Samples : Conversation Sample and JSF2
+-------------------------------------
+Go to the source folder of projects and run
+
+>mvn clean install
+>mvn jetty:run
+
+Conversation Sample URL : http://localhost:8080/conversation-sample
+JSF2 Sample URL : http://localhost:8080/jsf2sample
+
+------------------------------------------
+Samples Run within Tomcat Plugin
+------------------------------------------
+OpenEJB samples are run with Maven Tomcat Plugin.
+
+Tomcat Plugin uses http://localhost:8080/manager application to deploy war file
+into your embeddable EJB Tomcat container. There must be an tomcat-users.xml
+file in the "conf" directory of the server that contains manager role and username.
+
+>Start Tomcat server if not started
+>mvn tomcat:deploy
+
+Ejb Sample URL : http://localhost:8080/ejb-sample
+Ejb Telephone URL : http://localhost:8080/ejb-telephone
+
+Example tomcat-users.xml file
+------------------------------------------
+<tomcat-users>
+<role rolename="manager"/>
+<user username="admin" password="" roles="manager"/>
+</tomcat-users>
+
+-----------------------------------------
+Deploy JMS Sample
+-----------------------------------------
+Simple drops jms-sample.war file into your application deploy location.
+
+JMS Sample Example URL : Hit the url http://localhost:8080/jms-sample/sender.jsf for sending JMS messages
+ Hit the url http://localhost:8080/jms-sample/receiver.jsf for receiving JMS messages
+
+-----------------------------------------
+OpenWebBeans in Java SE
+----------------------------------------
+OpenWebBeans can be used in Java SE environments such as Java Swing
+applications. A Standalone Sample is provided to show how to use OpenWebBeans
+in Java SE.
+
+Go to the source directory of the standalone sample:
+>mvn clean package;
+>cd target;
+>jar -xvf standalone-sample.jar
+>java -jar standalone-sample-1.0.0-SNAPSHOT.jar
+>Enjoy :)
+
+-----------------------------------------------
+OpenWebBeans User and Development Mailing Lists
+-----------------------------------------------
+Please mail to the user mailing list with any questions or advice
+about the OpenWebBeans.
+
+User Mailing List : [users@openwebbeans.apache.org]
+
+You can also join the discussions happening in the dev list
+
+Dev Mailing List : [dev@openwebbeans.apache.org]
+
+-------------------------------------------
+OpenWebBeans JIRA Page
+-------------------------------------------
+Please logs bugs into the "https://issues.apache.org/jira/browse/OWB".
+
+------------------------------------------
+OpenWebBeans Wiki and Blog Page
+-----------------------------------------
+Wiki: http://cwiki.apache.org/OWB/
+Introduction to OpenWebBeans : http://cwiki.apache.org/OWB/introduction-to-openwebbeans.html
+Blog : http://blogs.apache.org/owb
+
+-----------------------------------------
+OpenWebBeans Web Page
+----------------------------------------
+You can reach the OpenWebBeans web page at
+http://openwebbeans.apache.org
+---------------------------------------
+
+Your OpenWebBeans Team
+
+Enjoy!
diff --git a/owb_1.2.x/readme/README_1_1_0.txt b/owb_1.2.x/readme/README_1_1_0.txt
new file mode 100644
index 0000000..14fb1ca
--- /dev/null
+++ b/owb_1.2.x/readme/README_1_1_0.txt
@@ -0,0 +1,881 @@
+-------------------------------
+Apache OpenWebBeans 1.1.0
+-------------------------------
+Welcome!
+Thanks for downloading and using OpenWebBeans.
+This document is a "Getting Started Guide" for OpenWebBeans.
+
+This document is based on the 1.1.0 release of the OpenWebBeans.
+
+--------------------------------
+What is Apache OpenWebBeans?
+--------------------------------
+OpenWebBeans is an Apache License V 2.0 licensed implementation of the JSR-299,
+Contexts and Dependency Injection for the Java EE platform.
+
+Our project's web page can be found at:
+http://openwebbeans.apache.org
+
+The projects WIKI page can be found at:
+https://cwiki.apache.org/confluence/display/OWB/Index
+
+
+--------------------------------
+OpenWebBeans 1.1.0 Release Features
+--------------------------------
+
+- 1.1.0 release supports the following features
+-----------------------------------
+* Managed Beans Support
+* Session Beans Support (via Embeddable OpenEJB container in Tomcat)
+* Producer Method Support
+* Producer Field Support
+* Java EE Resource Injection Support
+* JMS OpenWebBeans Support(OWB Specific)
+* Inheritance, Stereotype Inheritances
+* Specialization Support
+* Event Support
+* Decorator and Interceptor Support
+* Lookup and Dependency Injection Support
+* Java EE Plugin Support (via ServetContextListener interface)
+* Portable Integration Support
+* Passivation Capability of Beans
+* @Alternative support
+* OSGi environment support with an own plugable bundle ClassPath scanner
+* vastly improved Interceptor performance
+* plugable SecurityManager integration doubles speed if no SecurityManager is being used
+* improved Serialization handling
+* improved CreationalContext handling
+* revised internal logging
+* upgrade to JPA-2 and JSF-2 support
+* support for direct CDI usage in tomcat-6 and tomcat-7 environments
+* optional lenient lifecycle interceptor checking
+* automatically detect if BeanManager#isInUse()
+
+
+- 1.1.0 release does not support the following features
+--------------------------------------------
+* Does not fully integrate with Geronimo
+ (You have to configure your application to use OWB functionality,
+ e.g configure web.xml, adding interceptor to EJBs etc.)
+
+
+Noteable differences to CDI spec behaviour
+--------------------------------------------
+
+In a few special cases Apache OpenWebBeans might behave a little bit different than
+other CDI implementations. This is to some degree caused by the JSR-299 spec being
+not clear about some special topics so we needed to interpret the wording on our own.
+This mainly concerns the area of section 12.1 Bean Archives (BDA) which doesn't work
+out when it comes to OSGi containers and likes.
+In Apache OpenWebBeans, a settings configured in a beans.xml file of a BDA is not
+only effective for this very bean archive but for the whole BeanManager in control
+of the Application. This is especially the case for <alternatives> and
+<interceptors>! An Alternative, Interceptor or Decorator enabled in one BDA is active
+for the whole Application.
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.0
+-------------------------------------------
+
+Bug
+
+ * [OWB-295] - resolve bugs in Javassist Proxy
+ * [OWB-417] - BaseEjbBean.destroyComponentInstance() should call direct container remove API, not call an @Remove annotated method
+ * [OWB-422] - Support needed for PrePassivate, PostActivate, and AroundTimeout via EJBInterceptor.
+ * [OWB-444] - Using Static Loggers in Shared ClassLoader
+ * [OWB-452] - set active flag to false then context is destroyed
+ * [OWB-456] - When multiple interceptors are defined for a bean OWB does NOT correctly remove the overridden base Interceptors
+ * [OWB-469] - JSR299TCK: Security Error / Passivation errors during readObject
+ * [OWB-470] - OWBInjector does not work correctly for EJB Beans
+ * [OWB-471] - Possible StackOverflowException from defineProducerMethods in WebBeansAnnotatedTypeUtil
+ * [OWB-473] - bundles that use javasissist to proxy their contents need to import some javassist packages
+ * [OWB-474] - InjectionTargetBean#injectSuperResources is missing
+ * [OWB-477] - Two instances of using ObjectInputStream that may not have visibility into application classloader
+ * [OWB-480] - Avoid a couple NPEs
+ * [OWB-482] - Small issues
+ * [OWB-486] - ResourceBean tries to proxy final classes before testing them for being final
+ * [OWB-489] - AnnotatedTypes added with BeforeBeanDiscovery.addAnnotatedType method are ignored
+ * [OWB-490] - ProcessObserverMethod Type parameters are inverted (CDITCK-174)
+ * [OWB-491] - Decorators init needs to scan superclasses for more interfaces. cf CDITCK-178
+ * [OWB-492] - events don't get sent to private @Observes methods
+ * [OWB-493] - ProcessProducerMethod and ProcessProducerField type parameters are reversed in filtering (?) CDITCK-168
+ * [OWB-494] - Subclasses with non-overriden observer methods not recognized as beans with observer methods
+ * [OWB-496] - Don't replace the ProxyFactory classloaderProvider without the intention to do so
+ * [OWB-499] - WEB-INF/beans.xml of a war will not activate Bean Archive behaviour
+ * [OWB-502] - Only cache the ContextService once, in the SingletonService
+ * [OWB-504] - OwbApplicationFactory getWrapped should return wrapped application factory
+ * [OWB-505] - OwbApplicationFactory should not be installed by default
+ * [OWB-509] - Unwrap InvocationTargetException in ResourceProxyHandler.invokie
+ * [OWB-510] - return null instead of an unusable proxy if a resource is missing
+ * [OWB-511] - Delegate actualInstance serialization behavior in ResourceProxyHandler
+ * [OWB-514] - Leak in ELContextStore
+ * [OWB-519] - broken wls support
+ * [OWB-521] - ProducerMethodBean could theoretically produce a NPE
+ * [OWB-522] - Missing updateTimeout in one of begin methods for conversation
+ * [OWB-523] - @SessionScoped bean failover does not work
+ * [OWB-524] - OWB classpath scanning of non-jars doesn't work if the classpath contains spaces
+ * [OWB-527] - JspFactory.getDefaultFactory() is synchronized, We can cache the return value to improve performance
+ * [OWB-529] - lazy initialized class members should be volatile
+ * [OWB-530] - multi massive execution of our Interceptor test unveils a concurrency problem
+ * [OWB-531] - cleanup WebBeansELResolver#getValue
+ * [OWB-533] - concurrency bottleneck due to use of our logger
+ * [OWB-534] - Injection of @PersistenceContext does not work with abstract/base classes
+ * [OWB-541] - replace WeakHashMap with a standard one in InterceptorHandler
+ * [OWB-542] - Disposer is called twice on Dependent beans when injected into a managed object that is called from a JSP
+ * [OWB-543] - get rid of checked Exceptions in our SPI
+ * [OWB-545] - Cleanup our SecurityManager integration
+ * [OWB-546] - @Typed gets ignored if we use a AnnotatedType from an Extension @Observing ProcessAnnotatedType
+ * [OWB-547] - WebContextsService throws NPE on asynchronous app startup
+ * [OWB-548] - missing null check in DefaultContextsService#stopApplicationContext
+ * [OWB-550] - duplicated observer methods in case of @Specializes
+
+Improvement
+
+ * [OWB-209] - remove all <repositories> from our poms
+ * [OWB-254] - suppress initialising contextual handling for configurable URIs.
+ * [OWB-335] - implement a sample for @ViewScoped in reservation
+ * [OWB-393] - remove old XML configuration code
+ * [OWB-448] - More changes for decorator and interceptor passivation support
+ * [OWB-461] - source code quality
+ * [OWB-472] - archive centric beans.xml enabling
+ * [OWB-478] - make OWB build maven-3 aware
+ * [OWB-485] - AmbiguousResolutionException doesn't print details about the injection point
+ * [OWB-500] - improved app-server support
+ * [OWB-503] - Reduce static synchronized hashmap usage
+ * [OWB-506] - Upgrade our samples to Apache MyFaces-2.0.3 and OpenJPA-2.0.1
+ * [OWB-507] - our samples should be prepared for EE as default
+ * [OWB-508] - Dependent scope proxies are needed to wrap the build-in beans returned from the services if they are not serializable yet
+ * [OWB-516] - Get TCK standalone 1.0.4 CR2
+ * [OWB-517] - Conversation Log Improvement
+ * [OWB-518] - log all bean-archive markers
+ * [OWB-520] - spi for the webbeans-jee5-ejb-resource plugin
+ * [OWB-525] - create a findbugs filter file in our build-tools resource
+ * [OWB-526] - remove usage of java.net.URLs from ScannerService and drop scannotation
+ * [OWB-535] - free ScannerService resources once we don't need it anymore
+ * [OWB-536] - revisit our Logger usage in our Bean impls
+ * [OWB-537] - clear() AnnotatedElementFactory after the deployment
+ * [OWB-539] - fill AnnotatedTypeImpl lazily
+ * [OWB-540] - StandaloneResourceInjectionService should cache info about classes which don't contain EE resource injection points
+ * [OWB-544] - improve BeanManager#getContext performance
+
+New Feature
+
+ * [OWB-433] - add a configuration flag for switching to a lenient lifecycle interceptor checking
+ * [OWB-501] - owb ee 5 resource integration
+ * [OWB-528] - Use ApplicationWrapper as parent of OwbApplication in JSF 2 plugin
+ * [OWB-532] - create a new BeanManager#isInUse()
+ * [OWB-538] - lazy loading of not explicitly marked (via annotation or registered by extension) Dependent beans
+
+Question
+
+ * [OWB-383] - static fields in CreationalContext
+
+TCK Challenge
+
+ * [OWB-484] - Running TCK 1.0.1 Final and Respective Corrections
+
+Task
+
+ * [OWB-19] - Geronimo Integration
+ * [OWB-428] - implementation of equals and hashCode for AbstractOwbBean
+ * [OWB-453] - add a flag to disable context activation in EJB interceptor
+
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0
+-------------------------------------------
+
+Bug
+
+ * [OWB-318] - multiple methods with same EJB @interceptors(foo.class) in same bean class get multiple interceptor instances
+ * [OWB-384] - OWB needs to call 299-defined PrePassivate, PostActivate, and AroundTimeout interceptors for EJBs
+ * [OWB-422] - Support needed for PrePassivate, PostActivate, and AroundTimeout via EJBInterceptor.
+ * [OWB-429] - OpenWebBeansEjbPlugin Class Hierarchy
+ * [OWB-438] - Cached Normal Scoped Proxy instances
+ * [OWB-439] - EjbPlugin session bean proxy creation thread safe problem
+ * [OWB-445] - we must not use javassist ProxyFactory#setHandler(MethodHandler)
+ * [OWB-446] - EJB lifecycle callbacks not stacked correctly
+ * [OWB-450] - NullPointerException in DependentScopedBeanInterceptorHandler when it has a NullCreationalContext (normally from a EE component).
+ * [OWB-454] - ClassUtil.callInstanceMethod() doesn't propogate original exception
+ * [OWB-455] - IllegalArgument method calling remove method of EJB during destroy
+ * [OWB-456] - When multiple interceptors are defined for a bean OWB does NOT correctly remove the overriden base Interceptors
+ * [OWB-457] - we must not create a SessionContext for static resource reqeusts
+ * [OWB-460] - fix owb-openejb and owb-ejb artifactIds
+ * [OWB-464] - InjectionPointImpl using wrong class loader during serialize/deserialize, dropping qualifiers, and omiting qualifier values.
+ * [OWB-466] - Ensure removal of all ThreadLocal values
+
+Improvement
+
+ * [OWB-177] - Handling of InterceptionType#POST_ACTIVATE, PRE_PASSIVATE and AROUND_TIMEOUT is missing
+ * [OWB-407] - detailed information about exceptions
+ * [OWB-451] - Allow InterceptorUtil#callAroundInvokes to propogate a callers 'creational context key'
+ * [OWB-459] - upgrade to newer library versions
+ * [OWB-463] - EjbDefinitionUtility.defineEjbBeanProxy() should be able to create proxies for no-interface local beans
+ * [OWB-465] - enhance EJB common code for crude @LocalBean support
+
+TCK Challenge
+
+ * [OWB-394] - Any idea why our BeforeBeanDiscovery.addInterceptorBinding() has different signature?
+
+Task
+
+ * [OWB-453] - add a flag to disable context activation in EJB interceptor
+ * [OWB-462] - Refactor AnnotationUtil.hasAnnotationMember()
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0-alpha-2
+-------------------------------------------
+Bug
+
+ * [OWB-303] - upgrade Javassist to a newer version
+ * [OWB-338] - our internal SessionContext and ConversationContext must support Session serialization
+ * [OWB-385] - implement passivation of managed beans in ServletContextListener
+ * [OWB-401] - ELContextStore not cleaned up for some JSP EL lookups
+ * [OWB-402] - OpenWebBeansJsfPlugin does not recognize @ManagedBean
+ * [OWB-404] - Contexts must not get stored in a static Map in BeanManager
+ * [OWB-405] - AnnotatedElementFactory must not use static cache maps
+ * [OWB-408] - NPE in WebBeansELResolver
+ * [OWB-415] - EjbBeanProxyHandler for dependent ejb must save ejb instance
+ * [OWB-416] - BaseEJBBean.destroyComponentInstance() tries to call multiple remove methods
+ * [OWB-418] - EjbBeanProxyHandler must be 1:1 with proxy instances for dependent SFSB
+ * [OWB-419] - fix @Dependent handling in ELResolver
+ * [OWB-420] - SingletonContext is mapped to @ConversationScoped
+ * [OWB-421] - defined-in-class EJB lifecycle callbacks masked by our Interceptor
+ * [OWB-426] - Tweak EJBPlugin to work with Standalone Tests
+ * [OWB-431] - Generic Type Inheritance not resolved correctly
+ * [OWB-434] - ThreadLocal<SingletonContext> doen't get cleaned up
+ * [OWB-436] - AbstractContext bean instance creation is not thread safe
+ * [OWB-437] - Improve AbstractContext synchronization
+ * [OWB-440] - WebBeansDecoratorConfig.getDecoratorStack always returns new Decorators
+ * [OWB-442] - our EJB proxies are broken when multiple local interfaces are used on a single class
+ * [OWB-443] - Normal-scoped EJB not removed by container during Contextual.destroy()
+
+Improvement
+
+ * [OWB-57] - cleanup problems found by maven-findbugs-plugin
+ * [OWB-195] - Give warning to the developer related with non- portable operations
+ * [OWB-409] - create a name for OWB our faces-config.xml
+ * [OWB-410] - lazy initialisation of ejbInterceptors
+ * [OWB-411] - cache calls to isNormalScope()
+ * [OWB-412] - Allow container specific extensions to WebConfigurationListener access to the lifecycle
+ * [OWB-413] - cache calls to ClassUtils#getObjectMethodNames()
+ * [OWB-414] - improve Interceptor performance
+ * [OWB-425] - improve performance of owb-el-resolver
+ * [OWB-427] - improve read-performance of AbstractOwbBean
+ * [OWB-430] - improve performance of WebBeansPhaseListener
+ * [OWB-432] - Create Singleton Service SPI
+ * [OWB-441] - new configuration properties mechanism
+
+Sub-task
+
+ * [OWB-193] - If an interceptor or decorator has any scope other than @Dependent, non-portable behavior results.
+ * [OWB-194] - If an interceptor or decorator has a name, non-portable behavior results.
+ * [OWB-196] - If an interceptor or decorator is an alternative, non-portable behavior results.
+ * [OWB-197] - If a stereotype declares any other qualifier an- notation, non-portable behavior results.
+ * [OWB-198] - If a stereotype is annotated @Typed, non-portable behavior results.
+
+
+TCK Challenge
+
+ * [OWB-424] - Adding Document for How to Configure and Run TCK (standalone and web profile TCKs)
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0-alpha-1
+-------------------------------------------
+Bug
+
+ * [OWB-216] - Update pom.xml svn links
+ * [OWB-231] - exception using abstract decorators
+ * [OWB-245] - Using parameterized type varaibles fails for Producer Method injection
+ * [OWB-259] - Implement spec 11.5.5. ProcessModule event
+ * [OWB-289] - Owb return 2 beans for Indirect specialized producer beans
+ * [OWB-302] - InjectionPoint injections (both method and field based) in Decorators result in null
+ * [OWB-312] - Add dopriv's to allow OWB to function with java 2 security enabled
+ * [OWB-317] - creationalContext in InvocationContextImpl is always null
+ * [OWB-318] - multiple methods with same EJB @interceptors(foo.class) in same bean class get multiple interceptor instances
+ * [OWB-327] - annotating an Interceptor with @ApplictionScoped leads to OutOfMemory
+ * [OWB-329] - Interceptor instances get created each time the interceptor gets called
+ * [OWB-332] - Destroy Depdent Of Producer Method Beans when Invocation Completes
+ * [OWB-333] - InjectionTarget and Producer Handling
+ * [OWB-334] - cid is missing when using redirect for a jsf 2.0 application
+ * [OWB-336] - injected BeanManager must be Serializable
+ * [OWB-337] - events must not get broadcasted to beans which have no active Context
+ * [OWB-339] - Injecting Non-Contextual Beans Causes NPE in WebBeansUtil
+ * [OWB-340] - BeanManagerImpl.createInjectionTarget() Throws Exception When No Constructor Found
+ * [OWB-341] - CreationalContext#incompleteInstance should get cleaned after create()
+ * [OWB-342] - InterceptorHandler crashes with NullPointerException after deserialisation
+ * [OWB-343] - upgrade JPA spec from 1.0-PFD2 to 1.0 final revision
+ * [OWB-345] - Remove duplicate dependencies
+ * [OWB-351] - OWB picks up @SessionScoped contextual instances from expired sessions
+ * [OWB-352] - Thread Safety Problem in our InterceptorHandlers, aka proxies
+ * [OWB-353] - NPE in removeDependents@CreationalContextImpl
+ * [OWB-354] - WebContextService may throw NPE in tiered classloading environmemt
+ * [OWB-357] - WebbeansFinder should index first on ClassLoader, not singleton type
+ * [OWB-359] - ownerCreationalContext sometimes causes NPE in InterceptorDataImpl.createNewInstance()
+ * [OWB-361] - underlying EJB method not actually in our interceptors stack
+ * [OWB-362] - InvocationTargetException when invoking Stateless SessionBean
+ * [OWB-363] - Intermittent bug with ApplicationScope disposers not being called
+ * [OWB-366] - ContextNotActiveException fired from AppScope/NormalScopedBeanInterceptorHandler when a proxied object finalized
+ * [OWB-368] - The 299 spec (that I have) uses receive=IF_EXISTS but OWB uses notifyObserver=IF_EXISTS.
+ * [OWB-369] - Static ContextsService in ContextFactory causes wrong webContextService used for multiple applications
+ * [OWB-370] - Intransient Conversation context get rdestroyed randomly by destroyWithRespectToTimout
+ * [OWB-371] - no lifecycle interceptors for non-contextual EJB
+ * [OWB-372] - creational context not cleaned up for non-contextual EJB interceptions
+ * [OWB-373] - build crashes with missing artifact error
+ * [OWB-374] - migrate jsf2sample from sun to MyFaces
+ * [OWB-376] - [patch] Guess example broken with Jetty plugin 6.x due to EL 2.2
+ * [OWB-377] - revise logging
+ * [OWB-378] - ejb at bottom of decorator stack doesn't handle changed method
+ * [OWB-380] - NormalScopedBeanInterceptorHandler throws NPE when handling 3rd party Contexts
+ * [OWB-381] - NPE thrown from AbstractInjectable if dependent producer returns null
+ * [OWB-382] - injecting a @Dependent bean into a passivatation scoped bean causes a NonSerializableException
+ * [OWB-387] - DependentContext Interceptor Double Call for PostConstruct
+ * [OWB-390] - fix broken links in our 'site'
+ * [OWB-396] - fix poms to work with maven 3
+ * [OWB-398] - DelegateHandler cached too agressively
+ * [OWB-399] - Proxy objects could not be correctly deserialized by using javassist 3.11. we need to update to 3.12
+ * [OWB-400] - starting OWB as part of an EAR in geronimo causes a exception due to missing 'bundle' protocol
+
+Improvement
+
+ * [OWB-116] - Update Business Method Definition
+ * [OWB-118] - Supports Decorators for Other Delegate Injections
+ * [OWB-136] - fix 'broken' license headers in our java files
+ * [OWB-170] - Address findbug issues in webbeans-impl
+ * [OWB-183] - Improve webbeans-doc module to get a documentation more user friendly
+ * [OWB-214] - get rid of javax.transaction.Transaction dependency in webbeans-impl
+ * [OWB-237] - NoSuchElementException when WebBeansConfigurationListener is absent
+ * [OWB-275] - remove unused imports and cleanup code
+ * [OWB-286] - java.lang.NoClassDefFoundError: javax/validation/Validator
+ * [OWB-313] - create caching strategies for resolving Bean<T> for BeanManager and EL invocations
+ * [OWB-314] - cache resolved instances in NormalScopedBeanMethodHandlers of @ApplicationScoped beans
+ * [OWB-315] - cache resolved instances in NormalScopedBeanMethodHandlers of @SessionScoped beans
+ * [OWB-319] - Strange logging when writing non-Serializable SessionScoped bean
+ * [OWB-320] - Remove Java EE Dependencies from WebBeans Core
+ * [OWB-322] - Create new EJB project and separate common EJB classes from OpenEJB plugin
+ * [OWB-325] - Relocate SPI Classes to SPI Module. Change JSR299, JSR330 as optional pom dependency.
+ * [OWB-326] - improve producer tests
+ * [OWB-328] - improve logger performance
+ * [OWB-330] - reduce BeanManagerImpl#getManager() calls inside the same functions
+ * [OWB-331] - Cache Interceptor & Decorator Stack oon Interceptor Handler
+ * [OWB-346] - Make EJB samples running
+ * [OWB-347] - Using InjectableBeanManager in TCK
+ * [OWB-349] - ignore exception during type hierarchy scan
+ * [OWB-350] - Support Interceptor for non-contextual EJBs
+ * [OWB-355] - OpenEjbBean should look for @Remove methods
+ * [OWB-356] - EjbPlugin only looks for DeployementInfo once, so new deployed application won't be discovered
+ * [OWB-358] - provide property to skip injection in @PostConstruct of OpenWebBeansEjbInterceptor
+ * [OWB-360] - Add BeanManager to a ServletContext attribute
+ * [OWB-364] - Reduce the amount of info level logging
+ * [OWB-365] - make injection optional in OWBEJBInterceptor
+ * [OWB-375] - Performance: OWB logging performs operations when logging disabled.
+ * [OWB-379] - upgrade to final atinject-spec artifact
+ * [OWB-386] - upgarde CDI TCK to 1.0.2.CR1
+ * [OWB-389] - atinject-tck upgrade to final 1.0 release
+ * [OWB-397] - Add helper method and some debug to WebBeansFinder
+
+New Feature
+
+ * [OWB-316] - Implement a generic TestContainer for CDI implementations
+ * [OWB-323] - Provide methods to pass classloader into ServiceLoader and WebBeansFinder for use in tiered classloader situations
+ * [OWB-324] - Add Tomcat Plugin
+ * [OWB-348] - Adding Interceptor and Decorator Support for EJB Beans
+ * [OWB-395] - OpenWebBeans Tomcat 7 Support
+
+TCK Challenge
+
+ * [OWB-388] - Pass TCK 1.0.2 CR1 Web Profile
+
+Task
+
+ * [OWB-6] - Scope passivation
+ * [OWB-14] - Update WebBeans Lifecycle for Servlet Beans
+ * [OWB-46] - Injection into non-contextual objects
+ * [OWB-204] - Update Samples for JSF2 Usage
+ * [OWB-220] - Update site.xml links and bread crumbs to point to non-incubator.
+ * [OWB-310] - Drop dom4j and use jre builtin xml parsers for processing beans.xml
+ * [OWB-391] - create a owb-build-tools project to maintain project specific checkstyle rules, etc.
+
+Test
+
+ * [OWB-56] - Integrate the official JSR-299 TCK test suite
+ * [OWB-222] - Update website download link, and fix relative URL translation
+ * [OWB-367] - Add a unit test for IF_EXISTS
+
+
+----------------------------------------------
+Required Platform
+----------------------------------------------
+Java Version : Java SE >= 6.0
+Java EE Must : Java EE >= 5.0
+
+---------------------------------------------
+How to Configure OpenWebBeans
+---------------------------------------------
+
+This section explains a content of the distribution bundle, OWB plugins and its
+dependent libraries.
+
+---------------------------------------------
+1.1.0 Distribution Content
+---------------------------------------------
+There are several jars in the OpenWebBeans 1.0.0 distribution;
+
+ - openwebbeans-impl-1.1.0.jar --> Includes Core Dependency Injection Service.
+ - openwebbeans-ejb-1.1.0.jar --> EJB Plugin(Supports EJBs in OpenEJB embedded in Tomcat).
+ - openwebbeans-openejb-1.1.0.jar --> OpenEJB specific Plugin SPI implementations as extension to openwebbeans-ejb
+ - openwebbeans-jms-1.1.0.jar --> JMS Plugin(Supports injection of JMS related artifacts,i.e, ConnectionFactory, Session, Connection etc.)
+ - openwebbeans-jsf-1.1.0.jar --> JSF-2.0 Plugin(JSF Conversation Scoped Support).
+ - openwebbeans-jsf12-1.1.0.jar --> JSF-1.2 Plugin(JSF Conversation Scoped Support).
+ - openwebbeans-resource-1.1.0.jar --> Java EE Resource Injection for Web Projects (Includes @PersistenceContext,@PersistenceUnit
+ and @Resource injection into the Managed Beans. @Resource injections use java:/comp/env of the
+ Web application component. @PersistenceContext is based on extended EntityManager.
+ - openwebbeans-spi-1.1.0.jar --> OpenWebBeans Server Provider Interfaces. They are implemented by runtime environments that would
+ like to use OpenWebBeans as a JSR-299 implementation.
+ - samples --> Includes source code of the samples. Samples are mavenized project therefore you can easily build and run
+ them from your environment that has maven runtime.
+ - openwebbeans-osgi-1.1.0.jar --> ClassPath ScannerService SPI implementation for OSGI environments like Apache Geronimo-3
+ - openwebbeans-web-1.1.0.jar --> Basic Servlet integration
+ - openwebbeans-tomcat6-1.1.0.jar --> Support for deeper integration into Apache Tomcat-6
+ - openwebbeans-tomcat7-1.1.0.jar --> Support for deeper integration into Apache Tomcat-7
+
+
+
+
+------------------------------------------
+How OWB Plugins Work
+------------------------------------------
+
+OpenWebBeans has been developed with a plugin architecture. The Core dependency injection service
+is provided with openwebbeans-impl. If you need further service functionality,
+you have to add respective plugin jars into the application classpath. OpenWebBeans
+uses the Java SE 6.0 java.util.ServiceLoader mechanism to pickup plugins at runtime.
+Please do not confuse OWB plugins with portable Extensions! OWB plugins are for
+internal use only whereas portable CDI Extensions will run on any JSR-299 container.
+
+Current Plugins:
+---------------------
+Look at "1.1.0 Distribution Content" above.
+
+------------------------------------------
+Dependent Libraries
+------------------------------------------
+
+Third Party jars:
+-----------------
+They are necessary at runtime in the Core Implementation.
+
+javassist : Version 3.12.0.GA
+scannotation : Version 1.0.2 (if not running in an OSGi environment like Apache Geronimo-3)
+
+Java EE APIs jars(Container Provider Libraries) :
+-------------------------------------------------
+Generally full Java EE servers provides these jars. But web containers like Tomcat or Jetty
+do not contain some of them, such as JPA, JSF, Validation API etc. So, if you do not want to bundle
+these libraries within your application classpath, you have to include these libraries in your
+server common classpath.
+
+jcdi-api (JSR-299 Specification API)
+atinject-api (JSR-330 Specification API)
+servlet-2.5 or servlet 3.0 (Servlet Specification API)
+ejb-3.1 (EJB Specification API)
+el-2.2 (Expression Langauge Specification API)
+jsf-2.0 (Java Server Faces API)
+jsr-250 (Annotation API)
+interceptor-1.1 (Interceptor API)
+jta-1.1 (Java Transaction API)
+jsp.2.1 or jsp-2.2 (Java Server Pages API)
+jpa-2.0 (Java Persistence API)
+jaxws-2.1 or jaxws-2.2 (Java Web Service API)
+jms-1.1 or jms-1.2 (Java Messaging Service API)
+validation (Validation Specification)
+
+Dependencies of OpenWebBeans Maven Modules&Plugins
+--------------------------------------------------
+
+openwebbeans-impl :
+------------------
+Third party : javassist, scannotation, openwebbeans-spi
+Container Provided : jcdi-api, at-inject, servlet, el, jsr-250, interceptor, jta, jsp, validation
+
+openwebbeans-ejb:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : OpenWebBeans EJB plugin is based on OpenEJB in Tomcat. Therefore, if you install OpenEJB
+ within Tomcat correctly, there is no need to add any additional libraries. Look at the
+ OpenEJB in Tomcat configuration section.
+
+openwebbeans-jms:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : jms
+
+openwebbeans-jsf:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : jsf
+
+NOTE : We are trying to decrease dependent libraries of the our core, i.e, openwebbeans-impl.
+At 1.1.0, dependent third party libraries will be decreased. We have a plan to create profile
+plugins, therefore each profile plugin provides its own dependent libraries. For example, in
+fully Java EE Profile Plugin, Transaction API is supported but this will not be the case
+for Java Web Profile Plugin or Java SE Profile Plugin. Stay Tuned!
+
+Currently, as you have seen above, openwebbeans-impl depends on some Java EE/Runtime
+provided libraries (servlet, jsp, el etc). In the future, with OpenWebBeans profiling support,
+openwebbeans-impl will not depend on any Java EE APIs. Those APIs will be provided
+by OpenWebBeans profiles/plugins that openwebbeans-impl will be used. Therefore,
+you will able to use OpenWebBeans in your own runtime environment easily by writing
+your own plugins and contributing it to OpenWebBeans :)
+
+------------------------------------------
+Library Configuration
+------------------------------------------
+To run openwebbeans applications in the Java EE based application server,
+you could add the JSR-299 API and JSR-330 API into the server common classpath, and
+implementation, plugins and dependent jars into your "WEB-INF/lib" directory
+of the Java EE Web Application.
+
+In this release, we can not support the OpenWebBeans as an integrated
+functionality of the Java EE Application Servers. So, you have to manage the
+configuration of the OpenWebBeans within your application's "web.xml" file. A sample "web.xml"
+file can be found in the "config" directory. To use EJB functionality, you also have to
+add OWB specific interceptor into your EJB beans. Look at the EJB section of this readme
+for further details.
+
+---------------------------------------------
+OpenWebBeans Properties File
+---------------------------------------------
+OpenWebBeans uses a default configuration file to configure some of its
+properties. Default configuration files are embedded into OWB implementation
+jar files. Instead of opening the jars file and changing configuration properties, simply add
+an "openwebbeans.properties" file into a "META-INF/openwebbeans" folder of your application
+classpath. This will override the values from the default configuration.
+You can specify a property 'configuraion.ordinal' in this file to define the overlay order.
+A properties file with higher 'configuration.ordinal' value will applied later and thus
+have a higher precedence. If you don't specify a 'configuration.ordinal' a value of 100 is assumed;
+This allows to have multiple openwebbeans.properties files e.g. a common one in an EAR lib
+(with configuration.ordinal=100) and more specific ones for each WebApp in your EAR (with a
+configuration.ordinal of e.g. 101).
+
+Each plugin developer can provide their own SPI implementation class and own configuration values. If you would like
+to use those implementation classes or configuration values, you have to override the default configuration file as explained
+in the above paragraph, i.e, putting "openwebbeans.properties" file into "META-INF/openwebbeans" folder of your application.
+It is recommended to use a 'configuration.ordinal' between 50 and 99 for custom SPI implementations.
+
+Below are OpenWebBeans' default configuration properties from our openwebbeans-impl.jar file and our plugins such as
+our OpenEJB plugin.
+
+Override default value of ResourceInjectionService
+-------------------------------------------------
+org.apache.webbeans.spi.ResourceInjectionService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService
+
+OpenWebBeans uses the "OpenEjbResourceInjectionService" class to inject resources into the managed bean instances.
+
+Configuration Names and Their Default Values :
+
+- "org.apache.webbeans.spi.ContainerLifecycle"
+ Description : Implementation of org.apache.webbeans.spi.ContainerLifecycle. All magic starts from here.
+ Values : org.apache.webbeans.lifecycle.DefaultLifecycle, OR CUSTOM
+ Default : org.apache.webbeans.lifecycle.DefaultLifecycle
+
+- "org.apache.webbeans.spi.JNDIService"
+ Description : Configures JNDI provider implementation.
+ Values : org.apache.webbeans.spi.se.DefaultJndiService OR CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultJndiService
+
+- "org.apache.webbeans.spi.conversation.ConversationService"
+ Description : Implementation of conversation.
+ Values : org.apache.webbeans.spi.conversation.jsf.DefaultConversationService OR CUSTOM
+ Default : org.apache.webbeans.spi.conversation.jsf.DefaultConversationService
+
+- "org.apache.webbeans.spi.ScannerService"
+ Description : Default implementation of org.apache.webbeans.spi.ScannerService. It is used for scanning application deployment
+ for finding bean classes and configuration files.
+ Values : org.apache.webbeans.spi.ee.deployer.DefaultScannerService OR CUSTOM
+ Default : org.apache.webbeans.spi.ee.deployer.DefaultScannerService
+
+- "org.apache.webbeans.spi.SecurityService"
+ Description : Implementation of org.apache.webbeans.spi.SecurityService. It is used for getting current "Principal".
+ Values : org.apache.webbeans.spi.se.DefaultSecurityService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultSecurityService
+
+- "org.apache.webbeans.spi.ValidatorService"
+ Description : Implementation of org.apache.webbeans.spi.ValidatorService. It is used for getting "ValidatorFactory" and "Validator".
+ Values : org.apache.webbeans.spi.se.DefaultValidatorService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultValidatorService
+
+- "org.apache.webbeans.spi.TransactionService"
+ Description : Implementation of org.apache.webbeans.spi.TransactionService. It is used for getting "TransactionManager" and "Transaction".
+ Values : org.apache.webbeans.spi.se.DefaultTransactionService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultTransactionService
+
+- "org.apache.webbeans.spi.ResourceInjectionService"
+ Description : Implementation of org.apache.webbeans.spi.ResourceInjectionService. It is used for injection Java EE enviroment resource into the
+ Managed Bean instances.
+ Values : org.apache.webbeans.se.DefaultResourceInjectionService or CUSTOM
+ Default : org.apache.webbeans.se.DefaultResourceInjectionService
+
+- "org.apache.webbeans.spi.JNDIService.jmsConnectionFactoryJndi"
+ Description : Configures JMS ConnectionFactory object jndi name
+ Values : Server specific JNDI name
+ Default : ConnectionFactory
+
+- "org.apache.webbeans.conversation.Conversation.periodicDelay"
+ Description : Conversation removing thread periodic delay
+ Values : Configured in millisecond
+ Default : 150000 ms
+
+- "org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService"
+ Description : Use EJB functionality or not. If use OpenEJB configures to true
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.spi.FailOverService"
+ Description : Implementation of the org.apache.webbeans.spi.FailOverService. It is used for enabling passivation/failover beans.
+ Values : org.apache.webbeans.web.failover.DefaultOwbFailOverService or CUSTOM
+ Default : org.apache.webbeans.web.failover.DefaultOwbFailOverService
+
+- "org.apache.webbeans.web.failover.issupportfailover"
+ Description : Support failover of beans or not
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.web.failover.issupportpassivation"
+ Description : Support passivation of beans or not
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.forceNoCheckedExceptions"
+ Description : The interceptors spec defines that @PostConstruct & Co must not throw checked Exceptions. Setting this configuration to 'false' disables this check.
+ Values : false, true
+ Default : true
+
+- "org.apache.webbeans.spi.SecurityService"
+ Description : Service to provide methods which must be guarded via doPrivileged blocks.
+ Values : org.apache.webbeans.corespi.security.SimpleSercurityService or org.apache.webbeans.corespi.security.ManagedSecurityService
+ Default : org.apache.webbeans.corespi.security.SimpleSercurityService
+
+
+---------------------------------------------
+EJB Support via Embeddable OpenEJB Container in Tomcat 6.X
+---------------------------------------------
+
+Configuration Steps:
+--------------------------------------------
+1* Download Tomcat 6.X version
+2* Configure OpenEJB. Look at URL http://openejb.apache.org/tomcat.html for installation.
+3* Copy JSR-330 API to Tomcat /lib folder.
+4* Copy JSR-299 API to Tomcat /lib folder
+5* Put all dependent libraries of the OpenWebBeans OpenEJB Plugin
+ - openwebbeans-ejb
+ - openwebbeans-impl and its dependencies
+
+You could look at ejb-sample.war for "WEB-INF/lib" libraries as an example to develop custom applications.
+The source of this project is also available.
+
+To use EJB functionality, you will use OpenEJB collapse-ear support. In this configuration,
+your EJB beans live within your "war" bundle.
+
+How to Develop EJB Applications
+---------------------------------------------
+1* Add "META-INF/openwebbeans.properties" into your application classpath.
+2* Add "org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService=true" to use EJB functionality.
+ So OWB container looks for EJBs.
+3* Add "org.apache.webbeans.resource.spi.ResourceService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService to
+use OpenEJB Resource injections.
+4* Add "openwebbeans-ejb", plugin into your web application classpath.
+5* If you want to use other plugins, add respective plugins into your application classpath. For example, if you wish to use
+JSF framework, you add "openwebbeans-jsf" plugin.
+6* Add OWB related interceptor into your EJB Beans. This is called "org.apache.webbeans.ejb.interceptor.OpenWebBeansEjbInterceptor"
+This is needed for OWB injections.
+7* Update your application's "web.xml" to add OWB specific configuration.
+
+---------------------------------------------
+How to Run Samples
+---------------------------------------------
+
+In this release, there are several sample applications located in the "/samples" directory
+of the distribution. You can run those samples via simple maven command.
+
+1) "Guess Application" : Simple usage of the OWB + JSF.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+2) "Hotel Reservation Application" : Show usage of JSF + JPA + OWB
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+3) "EJB Sample Application" : Shows the usage of EJBs with embeddable OpenEJB in Tomcat. Firstly
+configure OpenEJB with Tomcat as explained above.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+4) "EJB Telephone Application" : Shows the usage of OpenEJB resource injection service.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+5) "JMS Injection Sample" : Show JMS injections. JMS injection currently uses
+ ConnectionFactory as JMS connection factory jndi name. You can change this
+ via configuration file. Look above explanation for how to configure JMS jndi. Also,
+ JMS injection requires to use of a JMS provider. Generally Java EE servers contains
+ default JMS provider. It can be run on JBoss and Geronimo. It uses Queue with jndi_name = "queue/A".
+ So you have to create a queue destination in your JMS provider with name "queue/A" to run example.
+ If you want to change queue jndi name, then look at source and change it from "WEB-INF/beans.xml" file.
+
+6) "Conversation Sample" : Shows usage of JSF conversations.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+7) "JSF2 Sample" : Shows usage of JSF2 Ajax.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section. It requires
+to use JSF2 runtime.
+
+
+8) "Standalone Sample" : Shows usage of OpenWebBeans in Standalone Swing Application.
+Look at "OpenWebBeans in Java SE" section.
+
+Configuring and Running the Applications:
+--------------------------------------------
+See section Compile and Run Samples via Jetty&Tomcat Plugin.
+
+--------------------------------------------
+Maven Install and Package From the Source
+--------------------------------------------
+
+Maven Version : Apache Maven 2.2.1 or later
+
+First you have to download the "source" version of the OpenWebBeans project that
+contains the all source code of the OpenWebBeans.
+
+To install the Maven artifacts of the project from the source, Maven must be installed
+in your runtime. After Maven installation, just run the following command in the top level
+directory that contains the main "pom.xml" :
+
+> mvn clean install
+
+This command will install all the Maven artifacts into your local Maven repository.
+
+If you wish to package all artifacts of the project, just run the following command
+in in the top level directory that contains the main "pom.xml" :
+
+> mvn clean package
+
+This command will package the project artifacts from the source and put these artifacts into the each modules
+respective "target" directory.
+
+-------------------------------------------
+Compile and Run Samples via Tomcat&Jetty Plugin
+-------------------------------------------
+This section shows how to run samples in Jetty or OpenEJB Embedded Tomcat.
+
+------------------------------------------
+Samples Run within Jetty Plugin
+------------------------------------------
+You can compile and run "guess","jsf2","conversation-sample" and "reservation "samples via maven Jetty plugin.
+Go to the source bundle "samples/" directory. In the "guess/" or "reservation/" directory, run
+the following maven commands. It will start up maven Jetty container. It bundles all of the
+required jars into the WEB-INF/lib folder. You are not required to add any jar to the classpath.
+
+Samples : Guess and Reservation
+------------------------------
+Go to the source folder of projects and run
+
+> mvn clean install -Pjetty
+> mvn jetty:run -Pjetty
+
+Guess URL : http://localhost:8080/guess
+Reservation URL : http://localhost:8080/reservation
+
+Samples : Conversation Sample and JSF2
+-------------------------------------
+Go to the source folder of projects and run
+
+>mvn clean install
+>mvn jetty:run
+
+Conversation Sample URL : http://localhost:8080/conversation-sample
+JSF2 Sample URL : http://localhost:8080/jsf2sample
+
+------------------------------------------
+Samples Run within Tomcat Plugin
+------------------------------------------
+OpenEJB samples are run with Maven Tomcat Plugin.
+
+Tomcat Plugin uses http://localhost:8080/manager application to deploy war file
+into your embeddable EJB Tomcat container. There must be an tomcat-users.xml
+file in the "conf" directory of the server that contains manager role and username.
+
+>Start Tomcat server if not started
+>mvn tomcat:deploy
+
+Ejb Sample URL : http://localhost:8080/ejb-sample
+Ejb Telephone URL : http://localhost:8080/ejb-telephone
+
+Example tomcat-users.xml file
+------------------------------------------
+<tomcat-users>
+<role rolename="manager"/>
+<user username="admin" password="" roles="manager"/>
+</tomcat-users>
+
+-----------------------------------------
+Deploy JMS Sample
+-----------------------------------------
+Simple drops jms-sample.war file into your application deploy location.
+
+JMS Sample Example URL : Hit the url http://localhost:8080/jms-sample/sender.jsf for sending JMS messages
+ Hit the url http://localhost:8080/jms-sample/receiver.jsf for receiving JMS messages
+
+-----------------------------------------
+OpenWebBeans in Java SE
+----------------------------------------
+OpenWebBeans can be used in Java SE environments such as Java Swing
+applications. A Standalone Sample is provided to show how to use OpenWebBeans
+in Java SE.
+
+Go to the source directory of the standalone sample:
+>mvn clean package;
+>cd target;
+>jar -xvf standalone-sample.jar
+>java -jar standalone-sample-1.1.0-SNAPSHOT.jar
+>Enjoy :)
+
+-----------------------------------------------
+OpenWebBeans User and Development Mailing Lists
+-----------------------------------------------
+Please mail to the user mailing list with any questions or advice
+about the OpenWebBeans.
+
+User Mailing List : [users@openwebbeans.apache.org]
+
+You can also join the discussions happening in the dev list
+
+Dev Mailing List : [dev@openwebbeans.apache.org]
+
+-------------------------------------------
+OpenWebBeans JIRA Page
+-------------------------------------------
+Please logs bugs into the "https://issues.apache.org/jira/browse/OWB".
+
+------------------------------------------
+OpenWebBeans Wiki and Blog Page
+-----------------------------------------
+Wiki: http://cwiki.apache.org/OWB/
+Introduction to OpenWebBeans : http://cwiki.apache.org/OWB/introduction-to-openwebbeans.html
+Blog : http://blogs.apache.org/owb
+
+-----------------------------------------
+OpenWebBeans Web Page
+----------------------------------------
+You can reach the OpenWebBeans web page at
+http://openwebbeans.apache.org
+---------------------------------------
+
+Your OpenWebBeans Team
+
+Enjoy!
diff --git a/owb_1.2.x/readme/README_1_1_1.txt b/owb_1.2.x/readme/README_1_1_1.txt
new file mode 100644
index 0000000..2b36636
--- /dev/null
+++ b/owb_1.2.x/readme/README_1_1_1.txt
@@ -0,0 +1,943 @@
+-------------------------------
+Apache OpenWebBeans 1.1.1
+-------------------------------
+Welcome!
+Thanks for downloading and using OpenWebBeans.
+This document is a "Getting Started Guide" for OpenWebBeans.
+
+This document is based on the 1.1.1 release of the OpenWebBeans.
+
+--------------------------------
+What is Apache OpenWebBeans?
+--------------------------------
+OpenWebBeans is an Apache License V 2.0 licensed implementation of the JSR-299,
+Contexts and Dependency Injection for the Java EE platform.
+
+Our project's web page can be found at:
+http://openwebbeans.apache.org
+
+The projects WIKI page can be found at:
+https://cwiki.apache.org/confluence/display/OWB/Index
+
+
+--------------------------------
+OpenWebBeans 1.1.1 Release Features
+--------------------------------
+
+- The 1.1.1 release supports the following features
+-----------------------------------
+* Managed Beans Support
+* Session Beans Support (via Embeddable OpenEJB container in Tomcat)
+* Producer Method Support
+* Producer Field Support
+* Java EE Resource Injection Support
+* JMS OpenWebBeans Support(OWB Specific)
+* Inheritance, Stereotype Inheritances
+* Specialization Support
+* Event Support
+* Decorator and Interceptor Support
+* Lookup and Dependency Injection Support
+* Java EE Plugin Support (via ServetContextListener interface)
+* Portable Integration Support
+* Passivation Capability of Beans
+* @Alternative support
+* OSGi environment support with an own plugable bundle ClassPath scanner
+* vastly improved Interceptor performance
+* plugable SecurityManager integration doubles speed if no SecurityManager is being used
+* improved Serialization handling
+* improved CreationalContext handling
+* revised internal logging
+* upgrade to JPA-2 and JSF-2 support
+* support for direct CDI usage in tomcat-6 and tomcat-7 environments
+* optional lenient lifecycle interceptor checking
+* automatically detect if BeanManager#isInUse()
+
+
+- 1.1.1 release does not support the following features
+--------------------------------------------
+* Does not fully integrate with Geronimo
+ (You have to configure your application to use OWB functionality,
+ e.g configure web.xml, adding interceptor to EJBs etc.)
+
+
+Noteable differences to CDI spec behaviour
+--------------------------------------------
+
+In a few special cases Apache OpenWebBeans might behave a little bit different than
+other CDI implementations. This is to some degree caused by the JSR-299 spec being
+not clear about some special topics so we needed to interpret the wording on our own.
+This mainly concerns the area of section 12.1 Bean Archives (BDA) which doesn't work
+out when it comes to OSGi containers and likes.
+In Apache OpenWebBeans, a settings configured in a beans.xml file of a BDA is not
+only effective for this very bean archive but for the whole BeanManager in control
+of the Application. This is especially the case for <alternatives> and
+<interceptors>! An Alternative, Interceptor or Decorator enabled in one BDA is active
+for the whole Application. This behaviour will most likely also be the default behaviour
+in the CDI-1.1 JSR-346 specification.
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.1
+-------------------------------------------
+
+Bug
+
+ * [OWB-406] - BaseEjbBean.removedStatefulInstance used by multiple instances/EjbBeanProxyHandlers
+ * [OWB-447] - unnecessary contextual/non-contextual distinction in OpenWebBeansEJBIntercpetor
+ * [OWB-449] - EJB interceptor has incorrect/unnecessary use of business method checks
+ * [OWB-483] - Problem with mulitple custom interceptors and passivation
+ * [OWB-512] - ApplicationContext and SingletonContext in WebContextsService
+ * [OWB-554] - DelegateHandler wraps Beans exceptions
+ * [OWB-558] - PassivationCapable bean id's for Producer Fields do not take into account generics
+ * [OWB-561] - Multiple contexts with the same Scope are not handled properly -- causing tck failures
+ * [OWB-563] - producers of passivating beans fail when the declared return type is not serializable but the actual return type is
+ * [OWB-566] - ProcessInjectionTarget event gets fired too early
+ * [OWB-571] - fix site build under maven3 and upgrade logo
+ * [OWB-573] - Invalid checking of Interceptor serialization capabilities for non-Passivation capable EJBs
+ * [OWB-576] - FileNotFoundException on WebSphere
+ * [OWB-577] - FileNotFoundException on WebSphere
+ * [OWB-578] - Allow DI for OpenWebBeansConfiguration properties
+ * [OWB-579] - check for non-proxyiable methods should exclude synthetic methods
+ * [OWB-581] - Decorator interface check needs configurable exclusions
+ * [OWB-584] - check for declared name consistency for specializes beans is wrong
+ * [OWB-585] - ProcessSessionBean doesn't deal with generic type quite right (CDITCK-215)
+ * [OWB-586] - Interceptors added by portable extensions don't work
+ * [OWB-587] - Use business interface for producer and disposer methods of Session beans
+ * [OWB-588] - PrincipalBean is misspelled
+ * [OWB-590] - Seam Persistence does not work with OWB - AfterBeanDiscovery.addBean will be ignored
+ * [OWB-591] - EJB @Specializes inheritance
+ * [OWB-593] - Interceptor binding added on an interceptor class at ProcessAnnotatedType phase is not considered
+ * [OWB-595] - Use case "Faces Request Generates Non-Faces Response" locks conversation forever (-> BusyConversationException)
+ * [OWB-598] - InjectionResolver crashes with a NPE when injecting a method parameter
+ * [OWB-599] - move getBeanXmls() back to Set<URL>
+ * [OWB-600] - cache information about non intercepted methdos in ProxyHandlers
+ * [OWB-601] - WebContextsService only works if ServletContext is given
+ * [OWB-608] - openwebbeans-el10 plugin misses openwebbeans.properties
+ * [OWB-614] - add LICENSE and NOTICE files to all our samples
+
+Improvement
+
+ * [OWB-555] - ClassUtil methods contain spelling, camelcase, etc., type errors
+ * [OWB-557] - #setAccessible(false) isn't needed
+ * [OWB-560] - upgrade the TCK to 1.0.4.SP1
+ * [OWB-564] - CdiTestOpenWebBeansContainer - check if a std.-context is active before destroying it
+ * [OWB-582] - Support for Java 1.5 (needed for WebSphere 6.1)
+ * [OWB-583] - Support for Servlet API 2.4 (needed for WebSphere 6.1)
+ * [OWB-594] - create a configurable mapping Scope->ProxyMethodHandlerImplementation
+ * [OWB-607] - upgrade our samples to newest available dependencies
+ * [OWB-610] - upgrade to apache parent pom 10
+ * [OWB-611] - adding ASF trademark documentation to our official site build
+ * [OWB-612] - upgrade various maven plugins
+ * [OWB-613] - Exclude Samples WARs Publishing with Maven
+
+Task
+
+ * [OWB-592] - EJB Specialization utility method
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.0
+-------------------------------------------
+
+Bug
+
+ * [OWB-295] - resolve bugs in Javassist Proxy
+ * [OWB-417] - BaseEjbBean.destroyComponentInstance() should call direct container remove API, not call an @Remove annotated method
+ * [OWB-422] - Support needed for PrePassivate, PostActivate, and AroundTimeout via EJBInterceptor.
+ * [OWB-444] - Using Static Loggers in Shared ClassLoader
+ * [OWB-452] - set active flag to false then context is destroyed
+ * [OWB-456] - When multiple interceptors are defined for a bean OWB does NOT correctly remove the overridden base Interceptors
+ * [OWB-469] - JSR299TCK: Security Error / Passivation errors during readObject
+ * [OWB-470] - OWBInjector does not work correctly for EJB Beans
+ * [OWB-471] - Possible StackOverflowException from defineProducerMethods in WebBeansAnnotatedTypeUtil
+ * [OWB-473] - bundles that use javasissist to proxy their contents need to import some javassist packages
+ * [OWB-474] - InjectionTargetBean#injectSuperResources is missing
+ * [OWB-477] - Two instances of using ObjectInputStream that may not have visibility into application classloader
+ * [OWB-480] - Avoid a couple NPEs
+ * [OWB-482] - Small issues
+ * [OWB-486] - ResourceBean tries to proxy final classes before testing them for being final
+ * [OWB-489] - AnnotatedTypes added with BeforeBeanDiscovery.addAnnotatedType method are ignored
+ * [OWB-490] - ProcessObserverMethod Type parameters are inverted (CDITCK-174)
+ * [OWB-491] - Decorators init needs to scan superclasses for more interfaces. cf CDITCK-178
+ * [OWB-492] - events don't get sent to private @Observes methods
+ * [OWB-493] - ProcessProducerMethod and ProcessProducerField type parameters are reversed in filtering (?) CDITCK-168
+ * [OWB-494] - Subclasses with non-overriden observer methods not recognized as beans with observer methods
+ * [OWB-496] - Don't replace the ProxyFactory classloaderProvider without the intention to do so
+ * [OWB-499] - WEB-INF/beans.xml of a war will not activate Bean Archive behaviour
+ * [OWB-502] - Only cache the ContextService once, in the SingletonService
+ * [OWB-504] - OwbApplicationFactory getWrapped should return wrapped application factory
+ * [OWB-505] - OwbApplicationFactory should not be installed by default
+ * [OWB-509] - Unwrap InvocationTargetException in ResourceProxyHandler.invokie
+ * [OWB-510] - return null instead of an unusable proxy if a resource is missing
+ * [OWB-511] - Delegate actualInstance serialization behavior in ResourceProxyHandler
+ * [OWB-514] - Leak in ELContextStore
+ * [OWB-519] - broken wls support
+ * [OWB-521] - ProducerMethodBean could theoretically produce a NPE
+ * [OWB-522] - Missing updateTimeout in one of begin methods for conversation
+ * [OWB-523] - @SessionScoped bean failover does not work
+ * [OWB-524] - OWB classpath scanning of non-jars doesn't work if the classpath contains spaces
+ * [OWB-527] - JspFactory.getDefaultFactory() is synchronized, We can cache the return value to improve performance
+ * [OWB-529] - lazy initialized class members should be volatile
+ * [OWB-530] - multi massive execution of our Interceptor test unveils a concurrency problem
+ * [OWB-531] - cleanup WebBeansELResolver#getValue
+ * [OWB-533] - concurrency bottleneck due to use of our logger
+ * [OWB-534] - Injection of @PersistenceContext does not work with abstract/base classes
+ * [OWB-541] - replace WeakHashMap with a standard one in InterceptorHandler
+ * [OWB-542] - Disposer is called twice on Dependent beans when injected into a managed object that is called from a JSP
+ * [OWB-543] - get rid of checked Exceptions in our SPI
+ * [OWB-545] - Cleanup our SecurityManager integration
+ * [OWB-546] - @Typed gets ignored if we use a AnnotatedType from an Extension @Observing ProcessAnnotatedType
+ * [OWB-547] - WebContextsService throws NPE on asynchronous app startup
+ * [OWB-548] - missing null check in DefaultContextsService#stopApplicationContext
+ * [OWB-550] - duplicated observer methods in case of @Specializes
+
+Improvement
+
+ * [OWB-209] - remove all <repositories> from our poms
+ * [OWB-254] - suppress initialising contextual handling for configurable URIs.
+ * [OWB-335] - implement a sample for @ViewScoped in reservation
+ * [OWB-393] - remove old XML configuration code
+ * [OWB-448] - More changes for decorator and interceptor passivation support
+ * [OWB-461] - source code quality
+ * [OWB-472] - archive centric beans.xml enabling
+ * [OWB-478] - make OWB build maven-3 aware
+ * [OWB-485] - AmbiguousResolutionException doesn't print details about the injection point
+ * [OWB-500] - improved app-server support
+ * [OWB-503] - Reduce static synchronized hashmap usage
+ * [OWB-506] - Upgrade our samples to Apache MyFaces-2.0.3 and OpenJPA-2.0.1
+ * [OWB-507] - our samples should be prepared for EE as default
+ * [OWB-508] - Dependent scope proxies are needed to wrap the build-in beans returned from the services if they are not serializable yet
+ * [OWB-516] - Get TCK standalone 1.0.4 CR2
+ * [OWB-517] - Conversation Log Improvement
+ * [OWB-518] - log all bean-archive markers
+ * [OWB-520] - spi for the webbeans-jee5-ejb-resource plugin
+ * [OWB-525] - create a findbugs filter file in our build-tools resource
+ * [OWB-526] - remove usage of java.net.URLs from ScannerService and drop scannotation
+ * [OWB-535] - free ScannerService resources once we don't need it anymore
+ * [OWB-536] - revisit our Logger usage in our Bean impls
+ * [OWB-537] - clear() AnnotatedElementFactory after the deployment
+ * [OWB-539] - fill AnnotatedTypeImpl lazily
+ * [OWB-540] - StandaloneResourceInjectionService should cache info about classes which don't contain EE resource injection points
+ * [OWB-544] - improve BeanManager#getContext performance
+
+New Feature
+
+ * [OWB-433] - add a configuration flag for switching to a lenient lifecycle interceptor checking
+ * [OWB-501] - owb ee 5 resource integration
+ * [OWB-528] - Use ApplicationWrapper as parent of OwbApplication in JSF 2 plugin
+ * [OWB-532] - create a new BeanManager#isInUse()
+ * [OWB-538] - lazy loading of not explicitly marked (via annotation or registered by extension) Dependent beans
+
+Question
+
+ * [OWB-383] - static fields in CreationalContext
+
+TCK Challenge
+
+ * [OWB-484] - Running TCK 1.0.1 Final and Respective Corrections
+
+Task
+
+ * [OWB-19] - Geronimo Integration
+ * [OWB-428] - implementation of equals and hashCode for AbstractOwbBean
+ * [OWB-453] - add a flag to disable context activation in EJB interceptor
+
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0
+-------------------------------------------
+
+Bug
+
+ * [OWB-318] - multiple methods with same EJB @interceptors(foo.class) in same bean class get multiple interceptor instances
+ * [OWB-384] - OWB needs to call 299-defined PrePassivate, PostActivate, and AroundTimeout interceptors for EJBs
+ * [OWB-422] - Support needed for PrePassivate, PostActivate, and AroundTimeout via EJBInterceptor.
+ * [OWB-429] - OpenWebBeansEjbPlugin Class Hierarchy
+ * [OWB-438] - Cached Normal Scoped Proxy instances
+ * [OWB-439] - EjbPlugin session bean proxy creation thread safe problem
+ * [OWB-445] - we must not use javassist ProxyFactory#setHandler(MethodHandler)
+ * [OWB-446] - EJB lifecycle callbacks not stacked correctly
+ * [OWB-450] - NullPointerException in DependentScopedBeanInterceptorHandler when it has a NullCreationalContext (normally from a EE component).
+ * [OWB-454] - ClassUtil.callInstanceMethod() doesn't propogate original exception
+ * [OWB-455] - IllegalArgument method calling remove method of EJB during destroy
+ * [OWB-456] - When multiple interceptors are defined for a bean OWB does NOT correctly remove the overriden base Interceptors
+ * [OWB-457] - we must not create a SessionContext for static resource reqeusts
+ * [OWB-460] - fix owb-openejb and owb-ejb artifactIds
+ * [OWB-464] - InjectionPointImpl using wrong class loader during serialize/deserialize, dropping qualifiers, and omiting qualifier values.
+ * [OWB-466] - Ensure removal of all ThreadLocal values
+
+Improvement
+
+ * [OWB-177] - Handling of InterceptionType#POST_ACTIVATE, PRE_PASSIVATE and AROUND_TIMEOUT is missing
+ * [OWB-407] - detailed information about exceptions
+ * [OWB-451] - Allow InterceptorUtil#callAroundInvokes to propogate a callers 'creational context key'
+ * [OWB-459] - upgrade to newer library versions
+ * [OWB-463] - EjbDefinitionUtility.defineEjbBeanProxy() should be able to create proxies for no-interface local beans
+ * [OWB-465] - enhance EJB common code for crude @LocalBean support
+
+TCK Challenge
+
+ * [OWB-394] - Any idea why our BeforeBeanDiscovery.addInterceptorBinding() has different signature?
+
+Task
+
+ * [OWB-453] - add a flag to disable context activation in EJB interceptor
+ * [OWB-462] - Refactor AnnotationUtil.hasAnnotationMember()
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0-alpha-2
+-------------------------------------------
+Bug
+
+ * [OWB-303] - upgrade Javassist to a newer version
+ * [OWB-338] - our internal SessionContext and ConversationContext must support Session serialization
+ * [OWB-385] - implement passivation of managed beans in ServletContextListener
+ * [OWB-401] - ELContextStore not cleaned up for some JSP EL lookups
+ * [OWB-402] - OpenWebBeansJsfPlugin does not recognize @ManagedBean
+ * [OWB-404] - Contexts must not get stored in a static Map in BeanManager
+ * [OWB-405] - AnnotatedElementFactory must not use static cache maps
+ * [OWB-408] - NPE in WebBeansELResolver
+ * [OWB-415] - EjbBeanProxyHandler for dependent ejb must save ejb instance
+ * [OWB-416] - BaseEJBBean.destroyComponentInstance() tries to call multiple remove methods
+ * [OWB-418] - EjbBeanProxyHandler must be 1:1 with proxy instances for dependent SFSB
+ * [OWB-419] - fix @Dependent handling in ELResolver
+ * [OWB-420] - SingletonContext is mapped to @ConversationScoped
+ * [OWB-421] - defined-in-class EJB lifecycle callbacks masked by our Interceptor
+ * [OWB-426] - Tweak EJBPlugin to work with Standalone Tests
+ * [OWB-431] - Generic Type Inheritance not resolved correctly
+ * [OWB-434] - ThreadLocal<SingletonContext> doen't get cleaned up
+ * [OWB-436] - AbstractContext bean instance creation is not thread safe
+ * [OWB-437] - Improve AbstractContext synchronization
+ * [OWB-440] - WebBeansDecoratorConfig.getDecoratorStack always returns new Decorators
+ * [OWB-442] - our EJB proxies are broken when multiple local interfaces are used on a single class
+ * [OWB-443] - Normal-scoped EJB not removed by container during Contextual.destroy()
+
+Improvement
+
+ * [OWB-57] - cleanup problems found by maven-findbugs-plugin
+ * [OWB-195] - Give warning to the developer related with non- portable operations
+ * [OWB-409] - create a name for OWB our faces-config.xml
+ * [OWB-410] - lazy initialisation of ejbInterceptors
+ * [OWB-411] - cache calls to isNormalScope()
+ * [OWB-412] - Allow container specific extensions to WebConfigurationListener access to the lifecycle
+ * [OWB-413] - cache calls to ClassUtils#getObjectMethodNames()
+ * [OWB-414] - improve Interceptor performance
+ * [OWB-425] - improve performance of owb-el-resolver
+ * [OWB-427] - improve read-performance of AbstractOwbBean
+ * [OWB-430] - improve performance of WebBeansPhaseListener
+ * [OWB-432] - Create Singleton Service SPI
+ * [OWB-441] - new configuration properties mechanism
+
+Sub-task
+
+ * [OWB-193] - If an interceptor or decorator has any scope other than @Dependent, non-portable behavior results.
+ * [OWB-194] - If an interceptor or decorator has a name, non-portable behavior results.
+ * [OWB-196] - If an interceptor or decorator is an alternative, non-portable behavior results.
+ * [OWB-197] - If a stereotype declares any other qualifier an- notation, non-portable behavior results.
+ * [OWB-198] - If a stereotype is annotated @Typed, non-portable behavior results.
+
+
+TCK Challenge
+
+ * [OWB-424] - Adding Document for How to Configure and Run TCK (standalone and web profile TCKs)
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0-alpha-1
+-------------------------------------------
+Bug
+
+ * [OWB-216] - Update pom.xml svn links
+ * [OWB-231] - exception using abstract decorators
+ * [OWB-245] - Using parameterized type varaibles fails for Producer Method injection
+ * [OWB-259] - Implement spec 11.5.5. ProcessModule event
+ * [OWB-289] - Owb return 2 beans for Indirect specialized producer beans
+ * [OWB-302] - InjectionPoint injections (both method and field based) in Decorators result in null
+ * [OWB-312] - Add dopriv's to allow OWB to function with java 2 security enabled
+ * [OWB-317] - creationalContext in InvocationContextImpl is always null
+ * [OWB-318] - multiple methods with same EJB @interceptors(foo.class) in same bean class get multiple interceptor instances
+ * [OWB-327] - annotating an Interceptor with @ApplictionScoped leads to OutOfMemory
+ * [OWB-329] - Interceptor instances get created each time the interceptor gets called
+ * [OWB-332] - Destroy Depdent Of Producer Method Beans when Invocation Completes
+ * [OWB-333] - InjectionTarget and Producer Handling
+ * [OWB-334] - cid is missing when using redirect for a jsf 2.0 application
+ * [OWB-336] - injected BeanManager must be Serializable
+ * [OWB-337] - events must not get broadcasted to beans which have no active Context
+ * [OWB-339] - Injecting Non-Contextual Beans Causes NPE in WebBeansUtil
+ * [OWB-340] - BeanManagerImpl.createInjectionTarget() Throws Exception When No Constructor Found
+ * [OWB-341] - CreationalContext#incompleteInstance should get cleaned after create()
+ * [OWB-342] - InterceptorHandler crashes with NullPointerException after deserialisation
+ * [OWB-343] - upgrade JPA spec from 1.0-PFD2 to 1.0 final revision
+ * [OWB-345] - Remove duplicate dependencies
+ * [OWB-351] - OWB picks up @SessionScoped contextual instances from expired sessions
+ * [OWB-352] - Thread Safety Problem in our InterceptorHandlers, aka proxies
+ * [OWB-353] - NPE in removeDependents@CreationalContextImpl
+ * [OWB-354] - WebContextService may throw NPE in tiered classloading environmemt
+ * [OWB-357] - WebbeansFinder should index first on ClassLoader, not singleton type
+ * [OWB-359] - ownerCreationalContext sometimes causes NPE in InterceptorDataImpl.createNewInstance()
+ * [OWB-361] - underlying EJB method not actually in our interceptors stack
+ * [OWB-362] - InvocationTargetException when invoking Stateless SessionBean
+ * [OWB-363] - Intermittent bug with ApplicationScope disposers not being called
+ * [OWB-366] - ContextNotActiveException fired from AppScope/NormalScopedBeanInterceptorHandler when a proxied object finalized
+ * [OWB-368] - The 299 spec (that I have) uses receive=IF_EXISTS but OWB uses notifyObserver=IF_EXISTS.
+ * [OWB-369] - Static ContextsService in ContextFactory causes wrong webContextService used for multiple applications
+ * [OWB-370] - Intransient Conversation context get rdestroyed randomly by destroyWithRespectToTimout
+ * [OWB-371] - no lifecycle interceptors for non-contextual EJB
+ * [OWB-372] - creational context not cleaned up for non-contextual EJB interceptions
+ * [OWB-373] - build crashes with missing artifact error
+ * [OWB-374] - migrate jsf2sample from sun to MyFaces
+ * [OWB-376] - [patch] Guess example broken with Jetty plugin 6.x due to EL 2.2
+ * [OWB-377] - revise logging
+ * [OWB-378] - ejb at bottom of decorator stack doesn't handle changed method
+ * [OWB-380] - NormalScopedBeanInterceptorHandler throws NPE when handling 3rd party Contexts
+ * [OWB-381] - NPE thrown from AbstractInjectable if dependent producer returns null
+ * [OWB-382] - injecting a @Dependent bean into a passivatation scoped bean causes a NonSerializableException
+ * [OWB-387] - DependentContext Interceptor Double Call for PostConstruct
+ * [OWB-390] - fix broken links in our 'site'
+ * [OWB-396] - fix poms to work with maven 3
+ * [OWB-398] - DelegateHandler cached too agressively
+ * [OWB-399] - Proxy objects could not be correctly deserialized by using javassist 3.11. we need to update to 3.12
+ * [OWB-400] - starting OWB as part of an EAR in geronimo causes a exception due to missing 'bundle' protocol
+
+Improvement
+
+ * [OWB-116] - Update Business Method Definition
+ * [OWB-118] - Supports Decorators for Other Delegate Injections
+ * [OWB-136] - fix 'broken' license headers in our java files
+ * [OWB-170] - Address findbug issues in webbeans-impl
+ * [OWB-183] - Improve webbeans-doc module to get a documentation more user friendly
+ * [OWB-214] - get rid of javax.transaction.Transaction dependency in webbeans-impl
+ * [OWB-237] - NoSuchElementException when WebBeansConfigurationListener is absent
+ * [OWB-275] - remove unused imports and cleanup code
+ * [OWB-286] - java.lang.NoClassDefFoundError: javax/validation/Validator
+ * [OWB-313] - create caching strategies for resolving Bean<T> for BeanManager and EL invocations
+ * [OWB-314] - cache resolved instances in NormalScopedBeanMethodHandlers of @ApplicationScoped beans
+ * [OWB-315] - cache resolved instances in NormalScopedBeanMethodHandlers of @SessionScoped beans
+ * [OWB-319] - Strange logging when writing non-Serializable SessionScoped bean
+ * [OWB-320] - Remove Java EE Dependencies from WebBeans Core
+ * [OWB-322] - Create new EJB project and separate common EJB classes from OpenEJB plugin
+ * [OWB-325] - Relocate SPI Classes to SPI Module. Change JSR299, JSR330 as optional pom dependency.
+ * [OWB-326] - improve producer tests
+ * [OWB-328] - improve logger performance
+ * [OWB-330] - reduce BeanManagerImpl#getManager() calls inside the same functions
+ * [OWB-331] - Cache Interceptor & Decorator Stack oon Interceptor Handler
+ * [OWB-346] - Make EJB samples running
+ * [OWB-347] - Using InjectableBeanManager in TCK
+ * [OWB-349] - ignore exception during type hierarchy scan
+ * [OWB-350] - Support Interceptor for non-contextual EJBs
+ * [OWB-355] - OpenEjbBean should look for @Remove methods
+ * [OWB-356] - EjbPlugin only looks for DeployementInfo once, so new deployed application won't be discovered
+ * [OWB-358] - provide property to skip injection in @PostConstruct of OpenWebBeansEjbInterceptor
+ * [OWB-360] - Add BeanManager to a ServletContext attribute
+ * [OWB-364] - Reduce the amount of info level logging
+ * [OWB-365] - make injection optional in OWBEJBInterceptor
+ * [OWB-375] - Performance: OWB logging performs operations when logging disabled.
+ * [OWB-379] - upgrade to final atinject-spec artifact
+ * [OWB-386] - upgarde CDI TCK to 1.0.2.CR1
+ * [OWB-389] - atinject-tck upgrade to final 1.0 release
+ * [OWB-397] - Add helper method and some debug to WebBeansFinder
+
+New Feature
+
+ * [OWB-316] - Implement a generic TestContainer for CDI implementations
+ * [OWB-323] - Provide methods to pass classloader into ServiceLoader and WebBeansFinder for use in tiered classloader situations
+ * [OWB-324] - Add Tomcat Plugin
+ * [OWB-348] - Adding Interceptor and Decorator Support for EJB Beans
+ * [OWB-395] - OpenWebBeans Tomcat 7 Support
+
+TCK Challenge
+
+ * [OWB-388] - Pass TCK 1.0.2 CR1 Web Profile
+
+Task
+
+ * [OWB-6] - Scope passivation
+ * [OWB-14] - Update WebBeans Lifecycle for Servlet Beans
+ * [OWB-46] - Injection into non-contextual objects
+ * [OWB-204] - Update Samples for JSF2 Usage
+ * [OWB-220] - Update site.xml links and bread crumbs to point to non-incubator.
+ * [OWB-310] - Drop dom4j and use jre builtin xml parsers for processing beans.xml
+ * [OWB-391] - create a owb-build-tools project to maintain project specific checkstyle rules, etc.
+
+Test
+
+ * [OWB-56] - Integrate the official JSR-299 TCK test suite
+ * [OWB-222] - Update website download link, and fix relative URL translation
+ * [OWB-367] - Add a unit test for IF_EXISTS
+
+
+----------------------------------------------
+Required Platform
+----------------------------------------------
+Java Version : Java SE >= 5.0
+Java EE Must : Java EE >= 5.0
+
+---------------------------------------------
+How to Configure OpenWebBeans
+---------------------------------------------
+
+This section explains a content of the distribution bundle, OWB plugins and its
+dependent libraries.
+
+---------------------------------------------
+1.1.1 Distribution Content
+---------------------------------------------
+There are several jars in the OpenWebBeans 1.0.0 distribution;
+
+ - openwebbeans-impl-1.1.1.jar --> Includes Core Dependency Injection Service.
+ - openwebbeans-ejb-1.1.1.jar --> EJB Plugin(Supports EJBs in OpenEJB embedded in Tomcat).
+ - openwebbeans-openejb-1.1.1.jar --> OpenEJB specific Plugin SPI implementations as extension to openwebbeans-ejb
+ - openwebbeans-jms-1.1.1.jar --> JMS Plugin(Supports injection of JMS related artifacts,i.e, ConnectionFactory, Session, Connection etc.)
+ - openwebbeans-jsf-1.1.1.jar --> JSF-2.0 Plugin(JSF Conversation Scoped Support).
+ - openwebbeans-jsf12-1.1.1.jar --> JSF-1.2 Plugin(JSF Conversation Scoped Support).
+ - openwebbeans-resource-1.1.1.jar --> Java EE Resource Injection for Web Projects (Includes @PersistenceContext,@PersistenceUnit
+ and @Resource injection into the Managed Beans. @Resource injections use java:/comp/env of the
+ Web application component. @PersistenceContext is based on extended EntityManager.
+ - openwebbeans-spi-1.1.1.jar --> OpenWebBeans Server Provider Interfaces. They are implemented by runtime environments that would
+ like to use OpenWebBeans as a JSR-299 implementation.
+ - samples --> Includes source code of the samples. Samples are mavenized project therefore you can easily build and run
+ them from your environment that has maven runtime.
+ - openwebbeans-osgi-1.1.1.jar --> ClassPath ScannerService SPI implementation for OSGI environments like Apache Geronimo-3
+ - openwebbeans-web-1.1.1.jar --> Basic Servlet integration
+ - openwebbeans-tomcat6-1.1.1.jar --> Support for deeper integration into Apache Tomcat-6
+ - openwebbeans-tomcat7-1.1.1.jar --> Support for deeper integration into Apache Tomcat-7
+
+
+
+
+------------------------------------------
+How OWB Plugins Work
+------------------------------------------
+
+OpenWebBeans has been developed with a plugin architecture. The Core dependency injection service
+is provided with openwebbeans-impl. If you need further service functionality,
+you have to add respective plugin jars into the application classpath. OpenWebBeans
+uses the Java SE 6.0 java.util.ServiceLoader mechanism to pickup plugins at runtime.
+If you run under Java SE 5.0, an similar hand written implementation will be used.
+Please do not confuse OWB plugins with portable Extensions! OWB plugins are for
+internal use only whereas portable CDI Extensions will run on any JSR-299 container.
+
+Current Plugins:
+---------------------
+Look at "1.1.1 Distribution Content" above.
+
+------------------------------------------
+Dependent Libraries
+------------------------------------------
+
+Third Party jars:
+-----------------
+They are necessary at runtime in the Core Implementation.
+
+javassist : Version 3.12.0.GA
+scannotation : Version 1.0.2 (if not running in an OSGi environment like Apache Geronimo-3)
+
+Java EE APIs jars(Container Provider Libraries) :
+-------------------------------------------------
+Generally full Java EE servers provides these jars. But web containers like Tomcat or Jetty
+do not contain some of them, such as JPA, JSF, Validation API etc. So, if you do not want to bundle
+these libraries within your application classpath, you have to include these libraries in your
+server common classpath.
+
+jcdi-api (JSR-299 Specification API)
+atinject-api (JSR-330 Specification API)
+servlet-2.5 or servlet 3.0 (Servlet Specification API)
+ejb-3.1 (EJB Specification API)
+el-2.2 (Expression Langauge Specification API)
+jsf-2.0 (Java Server Faces API)
+jsr-250 (Annotation API)
+interceptor-1.1 (Interceptor API)
+jta-1.1 (Java Transaction API)
+jsp.2.1 or jsp-2.2 (Java Server Pages API)
+jpa-2.0 (Java Persistence API)
+jaxws-2.1 or jaxws-2.2 (Java Web Service API)
+jms-1.1 or jms-1.2 (Java Messaging Service API)
+validation (Validation Specification)
+
+Dependencies of OpenWebBeans Maven Modules&Plugins
+--------------------------------------------------
+
+openwebbeans-impl :
+------------------
+Third party : javassist, scannotation, openwebbeans-spi
+Container Provided : jcdi-api, at-inject, servlet, el, jsr-250, interceptor, jta, jsp, validation
+
+openwebbeans-ejb:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : OpenWebBeans EJB plugin is based on OpenEJB in Tomcat. Therefore, if you install OpenEJB
+ within Tomcat correctly, there is no need to add any additional libraries. Look at the
+ OpenEJB in Tomcat configuration section.
+
+openwebbeans-jms:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : jms
+
+openwebbeans-jsf:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : jsf
+
+NOTE : We are trying to decrease dependent libraries of the our core, i.e, openwebbeans-impl.
+At 1.1.1, dependent third party libraries will be decreased. We have a plan to create profile
+plugins, therefore each profile plugin provides its own dependent libraries. For example, in
+fully Java EE Profile Plugin, Transaction API is supported but this will not be the case
+for Java Web Profile Plugin or Java SE Profile Plugin. Stay Tuned!
+
+Currently, as you have seen above, openwebbeans-impl depends on some Java EE/Runtime
+provided libraries (servlet, jsp, el etc). In the future, with OpenWebBeans profiling support,
+openwebbeans-impl will not depend on any Java EE APIs. Those APIs will be provided
+by OpenWebBeans profiles/plugins that openwebbeans-impl will be used. Therefore,
+you will able to use OpenWebBeans in your own runtime environment easily by writing
+your own plugins and contributing it to OpenWebBeans :)
+
+------------------------------------------
+Library Configuration
+------------------------------------------
+To run openwebbeans applications in the Java EE based application server,
+you could add the JSR-299 API and JSR-330 API into the server common classpath, and
+implementation, plugins and dependent jars into your "WEB-INF/lib" directory
+of the Java EE Web Application.
+
+In this release, we can not support the OpenWebBeans as an integrated
+functionality of the Java EE Application Servers. So, you have to manage the
+configuration of the OpenWebBeans within your application's "web.xml" file. A sample "web.xml"
+file can be found in the "config" directory. To use EJB functionality, you also have to
+add OWB specific interceptor into your EJB beans. Look at the EJB section of this readme
+for further details.
+
+---------------------------------------------
+OpenWebBeans Properties File
+---------------------------------------------
+OpenWebBeans uses a default configuration file to configure some of its
+properties. Default configuration files are embedded into OWB implementation
+jar files. Instead of opening the jars file and changing configuration properties, simply add
+an "openwebbeans.properties" file into a "META-INF/openwebbeans" folder of your application
+classpath. This will override the values from the default configuration.
+You can specify a property 'configuraion.ordinal' in this file to define the overlay order.
+A properties file with higher 'configuration.ordinal' value will applied later and thus
+have a higher precedence. If you don't specify a 'configuration.ordinal' a value of 100 is assumed;
+This allows to have multiple openwebbeans.properties files e.g. a common one in an EAR lib
+(with configuration.ordinal=100) and more specific ones for each WebApp in your EAR (with a
+configuration.ordinal of e.g. 101).
+
+Each plugin developer can provide their own SPI implementation class and own configuration values. If you would like
+to use those implementation classes or configuration values, you have to override the default configuration file as explained
+in the above paragraph, i.e, putting "openwebbeans.properties" file into "META-INF/openwebbeans" folder of your application.
+It is recommended to use a 'configuration.ordinal' between 50 and 99 for custom SPI implementations.
+
+Below are OpenWebBeans' default configuration properties from our openwebbeans-impl.jar file and our plugins such as
+our OpenEJB plugin.
+
+Override default value of ResourceInjectionService
+-------------------------------------------------
+org.apache.webbeans.spi.ResourceInjectionService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService
+
+OpenWebBeans uses the "OpenEjbResourceInjectionService" class to inject resources into the managed bean instances.
+
+Configuration Names and Their Default Values :
+
+- "org.apache.webbeans.spi.ContainerLifecycle"
+ Description : Implementation of org.apache.webbeans.spi.ContainerLifecycle. All magic starts from here.
+ Values : org.apache.webbeans.lifecycle.DefaultLifecycle, OR CUSTOM
+ Default : org.apache.webbeans.lifecycle.DefaultLifecycle
+
+- "org.apache.webbeans.spi.JNDIService"
+ Description : Configures JNDI provider implementation.
+ Values : org.apache.webbeans.spi.se.DefaultJndiService OR CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultJndiService
+
+- "org.apache.webbeans.spi.conversation.ConversationService"
+ Description : Implementation of conversation.
+ Values : org.apache.webbeans.spi.conversation.jsf.DefaultConversationService OR CUSTOM
+ Default : org.apache.webbeans.spi.conversation.jsf.DefaultConversationService
+
+- "org.apache.webbeans.spi.ScannerService"
+ Description : Default implementation of org.apache.webbeans.spi.ScannerService. It is used for scanning application deployment
+ for finding bean classes and configuration files.
+ Values : org.apache.webbeans.spi.ee.deployer.DefaultScannerService OR CUSTOM
+ Default : org.apache.webbeans.spi.ee.deployer.DefaultScannerService
+
+- "org.apache.webbeans.spi.SecurityService"
+ Description : Implementation of org.apache.webbeans.spi.SecurityService. It is used for getting current "Principal".
+ Values : org.apache.webbeans.spi.se.DefaultSecurityService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultSecurityService
+
+- "org.apache.webbeans.spi.ValidatorService"
+ Description : Implementation of org.apache.webbeans.spi.ValidatorService. It is used for getting "ValidatorFactory" and "Validator".
+ Values : org.apache.webbeans.spi.se.DefaultValidatorService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultValidatorService
+
+- "org.apache.webbeans.spi.TransactionService"
+ Description : Implementation of org.apache.webbeans.spi.TransactionService. It is used for getting "TransactionManager" and "Transaction".
+ Values : org.apache.webbeans.spi.se.DefaultTransactionService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultTransactionService
+
+- "org.apache.webbeans.spi.ResourceInjectionService"
+ Description : Implementation of org.apache.webbeans.spi.ResourceInjectionService. It is used for injection Java EE enviroment resource into the
+ Managed Bean instances.
+ Values : org.apache.webbeans.se.DefaultResourceInjectionService or CUSTOM
+ Default : org.apache.webbeans.se.DefaultResourceInjectionService
+
+- "org.apache.webbeans.spi.JNDIService.jmsConnectionFactoryJndi"
+ Description : Configures JMS ConnectionFactory object jndi name
+ Values : Server specific JNDI name
+ Default : ConnectionFactory
+
+- "org.apache.webbeans.conversation.Conversation.periodicDelay"
+ Description : Conversation removing thread periodic delay
+ Values : Configured in millisecond
+ Default : 150000 ms
+
+- "org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService"
+ Description : Use EJB functionality or not. If use OpenEJB configures to true
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.spi.FailOverService"
+ Description : Implementation of the org.apache.webbeans.spi.FailOverService. It is used for enabling passivation/failover beans.
+ Values : org.apache.webbeans.web.failover.DefaultOwbFailOverService or CUSTOM
+ Default : org.apache.webbeans.web.failover.DefaultOwbFailOverService
+
+- "org.apache.webbeans.web.failover.issupportfailover"
+ Description : Support failover of beans or not
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.web.failover.issupportpassivation"
+ Description : Support passivation of beans or not
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.forceNoCheckedExceptions"
+ Description : The interceptors spec defines that @PostConstruct & Co must not throw checked Exceptions. Setting this configuration to 'false' disables this check.
+ Values : false, true
+ Default : true
+
+- "org.apache.webbeans.spi.SecurityService"
+ Description : Service to provide methods which must be guarded via doPrivileged blocks.
+ Values : org.apache.webbeans.corespi.security.SimpleSercurityService or org.apache.webbeans.corespi.security.ManagedSecurityService
+ Default : org.apache.webbeans.corespi.security.SimpleSercurityService
+
+
+---------------------------------------------
+EJB Support via Embeddable OpenEJB Container in Tomcat 6.X
+---------------------------------------------
+
+Configuration Steps:
+--------------------------------------------
+1* Download Tomcat 6.X version
+2* Configure OpenEJB. Look at URL http://openejb.apache.org/tomcat.html for installation.
+3* Copy JSR-330 API to Tomcat /lib folder.
+4* Copy JSR-299 API to Tomcat /lib folder
+5* Put all dependent libraries of the OpenWebBeans OpenEJB Plugin
+ - openwebbeans-ejb
+ - openwebbeans-impl and its dependencies
+
+You could look at ejb-sample.war for "WEB-INF/lib" libraries as an example to develop custom applications.
+The source of this project is also available.
+
+To use EJB functionality, you will use OpenEJB collapse-ear support. In this configuration,
+your EJB beans live within your "war" bundle.
+
+How to Develop EJB Applications
+---------------------------------------------
+1* Add "META-INF/openwebbeans.properties" into your application classpath.
+2* Add "org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService=true" to use EJB functionality.
+ So OWB container looks for EJBs.
+3* Add "org.apache.webbeans.resource.spi.ResourceService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService to
+use OpenEJB Resource injections.
+4* Add "openwebbeans-ejb", plugin into your web application classpath.
+5* If you want to use other plugins, add respective plugins into your application classpath. For example, if you wish to use
+JSF framework, you add "openwebbeans-jsf" plugin.
+6* Add OWB related interceptor into your EJB Beans. This is called "org.apache.webbeans.ejb.interceptor.OpenWebBeansEjbInterceptor"
+This is needed for OWB injections.
+7* Update your application's "web.xml" to add OWB specific configuration.
+
+---------------------------------------------
+How to Run Samples
+---------------------------------------------
+
+In this release, there are several sample applications located in the "/samples" directory
+of the distribution. You can run those samples via simple maven command.
+
+1) "Guess Application" : Simple usage of the OWB + JSF.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+2) "Hotel Reservation Application" : Show usage of JSF + JPA + OWB
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+3) "EJB Sample Application" : Shows the usage of EJBs with embeddable OpenEJB in Tomcat. Firstly
+configure OpenEJB with Tomcat as explained above.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+4) "EJB Telephone Application" : Shows the usage of OpenEJB resource injection service.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+5) "JMS Injection Sample" : Show JMS injections. JMS injection currently uses
+ ConnectionFactory as JMS connection factory jndi name. You can change this
+ via configuration file. Look above explanation for how to configure JMS jndi. Also,
+ JMS injection requires to use of a JMS provider. Generally Java EE servers contains
+ default JMS provider. It can be run on JBoss and Geronimo. It uses Queue with jndi_name = "queue/A".
+ So you have to create a queue destination in your JMS provider with name "queue/A" to run example.
+ If you want to change queue jndi name, then look at source and change it from "WEB-INF/beans.xml" file.
+
+6) "Conversation Sample" : Shows usage of JSF conversations.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+7) "JSF2 Sample" : Shows usage of JSF2 Ajax.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section. It requires
+to use JSF2 runtime.
+
+
+8) "Standalone Sample" : Shows usage of OpenWebBeans in Standalone Swing Application.
+Look at "OpenWebBeans in Java SE" section.
+
+Configuring and Running the Applications:
+--------------------------------------------
+See section Compile and Run Samples via Jetty&Tomcat Plugin.
+
+--------------------------------------------
+Maven Install and Package From the Source
+--------------------------------------------
+
+Maven Version : Apache Maven 2.2.1 or later
+
+First you have to download the "source" version of the OpenWebBeans project that
+contains the all source code of the OpenWebBeans.
+
+To install the Maven artifacts of the project from the source, Maven must be installed
+in your runtime. After Maven installation, just run the following command in the top level
+directory that contains the main "pom.xml" :
+
+> mvn clean install
+
+This command will install all the Maven artifacts into your local Maven repository.
+
+If you wish to package all artifacts of the project, just run the following command
+in in the top level directory that contains the main "pom.xml" :
+
+> mvn clean package
+
+This command will package the project artifacts from the source and put these artifacts into the each modules
+respective "target" directory.
+
+-------------------------------------------
+Compile and Run Samples via Tomcat&Jetty Plugin
+-------------------------------------------
+This section shows how to run samples in Jetty or OpenEJB Embedded Tomcat.
+
+------------------------------------------
+Samples Run within Jetty Plugin
+------------------------------------------
+You can compile and run "guess","jsf2","conversation-sample" and "reservation "samples via maven Jetty plugin.
+Go to the source bundle "samples/" directory. In the "guess/" or "reservation/" directory, run
+the following maven commands. It will start up maven Jetty container. It bundles all of the
+required jars into the WEB-INF/lib folder. You are not required to add any jar to the classpath.
+
+Samples : Guess and Reservation
+------------------------------
+Go to the source folder of projects and run
+
+> mvn clean install -Pjetty
+> mvn jetty:run -Pjetty
+
+Guess URL : http://localhost:8080/guess
+Reservation URL : http://localhost:8080/reservation
+
+Samples : Conversation Sample and JSF2
+-------------------------------------
+Go to the source folder of projects and run
+
+>mvn clean install
+>mvn jetty:run
+
+Conversation Sample URL : http://localhost:8080/conversation-sample
+JSF2 Sample URL : http://localhost:8080/jsf2sample
+
+------------------------------------------
+Samples Run within Tomcat Plugin
+------------------------------------------
+OpenEJB samples are run with Maven Tomcat Plugin.
+
+Tomcat Plugin uses http://localhost:8080/manager application to deploy war file
+into your embeddable EJB Tomcat container. There must be an tomcat-users.xml
+file in the "conf" directory of the server that contains manager role and username.
+
+>Start Tomcat server if not started
+>mvn tomcat:deploy
+
+Ejb Sample URL : http://localhost:8080/ejb-sample
+Ejb Telephone URL : http://localhost:8080/ejb-telephone
+
+Example tomcat-users.xml file
+------------------------------------------
+<tomcat-users>
+<role rolename="manager"/>
+<user username="admin" password="" roles="manager"/>
+</tomcat-users>
+
+-----------------------------------------
+Deploy JMS Sample
+-----------------------------------------
+Simple drops jms-sample.war file into your application deploy location.
+
+JMS Sample Example URL : Hit the url http://localhost:8080/jms-sample/sender.jsf for sending JMS messages
+ Hit the url http://localhost:8080/jms-sample/receiver.jsf for receiving JMS messages
+
+-----------------------------------------
+OpenWebBeans in Java SE
+----------------------------------------
+OpenWebBeans can be used in Java SE environments such as Java Swing
+applications. A Standalone Sample is provided to show how to use OpenWebBeans
+in Java SE.
+
+Go to the source directory of the standalone sample:
+>mvn clean package;
+>cd target;
+>jar -xvf standalone-sample.jar
+>java -jar standalone-sample-1.1.1-SNAPSHOT.jar
+>Enjoy :)
+
+-----------------------------------------------
+OpenWebBeans User and Development Mailing Lists
+-----------------------------------------------
+Please mail to the user mailing list with any questions or advice
+about the OpenWebBeans.
+
+User Mailing List : [users@openwebbeans.apache.org]
+
+You can also join the discussions happening in the dev list
+
+Dev Mailing List : [dev@openwebbeans.apache.org]
+
+-------------------------------------------
+OpenWebBeans JIRA Page
+-------------------------------------------
+Please logs bugs into the "https://issues.apache.org/jira/browse/OWB".
+
+------------------------------------------
+OpenWebBeans Wiki and Blog Page
+-----------------------------------------
+Wiki: http://cwiki.apache.org/OWB/
+Introduction to OpenWebBeans : http://cwiki.apache.org/OWB/introduction-to-openwebbeans.html
+Blog : http://blogs.apache.org/owb
+
+-----------------------------------------
+OpenWebBeans Web Page
+----------------------------------------
+You can reach the OpenWebBeans web page at
+http://openwebbeans.apache.org
+---------------------------------------
+
+Your OpenWebBeans Team
+
+Enjoy!
diff --git a/owb_1.2.x/readme/README_1_1_2.txt b/owb_1.2.x/readme/README_1_1_2.txt
new file mode 100644
index 0000000..e1a8339
--- /dev/null
+++ b/owb_1.2.x/readme/README_1_1_2.txt
@@ -0,0 +1,975 @@
+-------------------------------
+Apache OpenWebBeans 1.1.2
+-------------------------------
+Welcome!
+Thanks for downloading and using OpenWebBeans.
+This document is a "Getting Started Guide" for OpenWebBeans.
+
+This document is based on the 1.1.2 release of Apache OpenWebBeans.
+
+--------------------------------
+What is Apache OpenWebBeans?
+--------------------------------
+OpenWebBeans is an Apache License V 2.0 licensed implementation of the JSR-299,
+Contexts and Dependency Injection for the Java EE platform.
+
+It also already incorporates some features which are part of JSR-346 (CDI-1.1)
+but doesn't need API changes as we still use the JCDI-1.0 API. The
+incorporated CDI-1.1 features are mostly parts which are not well
+defined in the CDI-1.0 specification, like Serialisation checks, etc.
+
+Our project's web page can be found at:
+http://openwebbeans.apache.org
+
+The projects WIKI page can be found at:
+https://cwiki.apache.org/confluence/display/OWB/Index
+
+
+--------------------------------
+OpenWebBeans 1.1.2 Release Features
+--------------------------------
+
+- The 1.1.2 release supports the following features
+-----------------------------------
+* Managed Beans Support
+* Session Beans Support (via Embeddable OpenEJB container in Tomcat)
+* Producer Method Support
+* Producer Field Support
+* Java EE Resource Injection Support
+* JMS OpenWebBeans Support(OWB Specific)
+* Inheritance, Stereotype Inheritances
+* Specialization Support
+* Event Support
+* Decorator and Interceptor Support
+* Lookup and Dependency Injection Support
+* Java EE Plugin Support (via ServetContextListener interface)
+* Portable Integration Support
+* Passivation Capability of Beans
+* @Alternative support
+* OSGi environment support with an own plugable bundle ClassPath scanner
+* vastly improved Interceptor performance
+* plugable SecurityManager integration doubles speed if no SecurityManager is being used
+* improved Serialization handling
+* improved CreationalContext handling
+* revised internal logging
+* upgrade to JPA-2 and JSF-2 support
+* support for direct CDI usage in tomcat-6 and tomcat-7 environments
+* optional lenient lifecycle interceptor checking
+* automatically detect if BeanManager#isInUse()
+
+
+- 1.1.2 release does not support the following features
+--------------------------------------------
+* Does not fully integrate with Geronimo
+ (You have to configure your application to use OWB functionality,
+ e.g configure web.xml, adding interceptor to EJBs etc.)
+
+
+Noteable differences to CDI spec behaviour
+--------------------------------------------
+
+In a few special cases Apache OpenWebBeans might behave a little bit different than
+other CDI implementations. This is to some degree caused by the JSR-299 spec being
+not clear about some special topics so we needed to interpret the wording on our own.
+This mainly concerns the area of section 12.1 Bean Archives (BDA) which doesn't work
+out when it comes to OSGi containers and likes.
+In Apache OpenWebBeans, a settings configured in a beans.xml file of a BDA is not
+only effective for this very bean archive but for the whole BeanManager in control
+of the Application. This is especially the case for <alternatives> and
+<interceptors>! An Alternative, Interceptor or Decorator enabled in one BDA is active
+for the whole Application. This behaviour will most likely also be the default behaviour
+in the CDI-1.1 JSR-346 specification.
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.2
+-------------------------------------------
+
+Bug
+
+ * [OWB-562] - non-enabled alternative beans with passivating scope fail validation during deployment
+ * [OWB-589] - " ... requires a passivation capable dependency ..." for producer method with return type String and non serializable injected dependency
+ * [OWB-597] - StackOverFlow when injecting product in same bean where @Produces is placed
+ * [OWB-615] - remove @Overrides for interfaces to be java5 compatible
+ * [OWB-616] - javax.el.ExpressionFactory has final methods! CDI doesn't allow that. - Test on final **PRIVATE** methods too?
+ * [OWB-618] - we sometimes invoke a dispose method without having created the bean upfront
+ * [OWB-619] - @New beans must only exist if there is at least one injection point for them
+ * [OWB-620] - any disabled bean of passivating scope will wrongly be detected as 'not passivatable'
+ * [OWB-622] - beanmanager injection in afterBeanDiscovery method parameter
+ * [OWB-624] - AnnotatedTypes registered in BeforeBeanDiscovery might get processed twice
+
+Improvement
+
+ * [OWB-623] - Relax check on @AroundInvoke Interceptors 'throws Exception'
+
+New Feature
+
+ * [OWB-621] - Alternative configuration method for buggy container or pre servlet api 2.5 container
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.1
+-------------------------------------------
+
+Bug
+
+ * [OWB-406] - BaseEjbBean.removedStatefulInstance used by multiple instances/EjbBeanProxyHandlers
+ * [OWB-447] - unnecessary contextual/non-contextual distinction in OpenWebBeansEJBIntercpetor
+ * [OWB-449] - EJB interceptor has incorrect/unnecessary use of business method checks
+ * [OWB-483] - Problem with mulitple custom interceptors and passivation
+ * [OWB-512] - ApplicationContext and SingletonContext in WebContextsService
+ * [OWB-554] - DelegateHandler wraps Beans exceptions
+ * [OWB-558] - PassivationCapable bean id's for Producer Fields do not take into account generics
+ * [OWB-561] - Multiple contexts with the same Scope are not handled properly -- causing tck failures
+ * [OWB-563] - producers of passivating beans fail when the declared return type is not serializable but the actual return type is
+ * [OWB-566] - ProcessInjectionTarget event gets fired too early
+ * [OWB-571] - fix site build under maven3 and upgrade logo
+ * [OWB-573] - Invalid checking of Interceptor serialization capabilities for non-Passivation capable EJBs
+ * [OWB-576] - FileNotFoundException on WebSphere
+ * [OWB-577] - FileNotFoundException on WebSphere
+ * [OWB-578] - Allow DI for OpenWebBeansConfiguration properties
+ * [OWB-579] - check for non-proxyiable methods should exclude synthetic methods
+ * [OWB-581] - Decorator interface check needs configurable exclusions
+ * [OWB-584] - check for declared name consistency for specializes beans is wrong
+ * [OWB-585] - ProcessSessionBean doesn't deal with generic type quite right (CDITCK-215)
+ * [OWB-586] - Interceptors added by portable extensions don't work
+ * [OWB-587] - Use business interface for producer and disposer methods of Session beans
+ * [OWB-588] - PrincipalBean is misspelled
+ * [OWB-590] - Seam Persistence does not work with OWB - AfterBeanDiscovery.addBean will be ignored
+ * [OWB-591] - EJB @Specializes inheritance
+ * [OWB-593] - Interceptor binding added on an interceptor class at ProcessAnnotatedType phase is not considered
+ * [OWB-595] - Use case "Faces Request Generates Non-Faces Response" locks conversation forever (-> BusyConversationException)
+ * [OWB-598] - InjectionResolver crashes with a NPE when injecting a method parameter
+ * [OWB-599] - move getBeanXmls() back to Set<URL>
+ * [OWB-600] - cache information about non intercepted methdos in ProxyHandlers
+ * [OWB-601] - WebContextsService only works if ServletContext is given
+ * [OWB-608] - openwebbeans-el10 plugin misses openwebbeans.properties
+ * [OWB-614] - add LICENSE and NOTICE files to all our samples
+
+Improvement
+
+ * [OWB-555] - ClassUtil methods contain spelling, camelcase, etc., type errors
+ * [OWB-557] - #setAccessible(false) isn't needed
+ * [OWB-560] - upgrade the TCK to 1.0.4.SP1
+ * [OWB-564] - CdiTestOpenWebBeansContainer - check if a std.-context is active before destroying it
+ * [OWB-582] - Support for Java 1.5 (needed for WebSphere 6.1)
+ * [OWB-583] - Support for Servlet API 2.4 (needed for WebSphere 6.1)
+ * [OWB-594] - create a configurable mapping Scope->ProxyMethodHandlerImplementation
+ * [OWB-607] - upgrade our samples to newest available dependencies
+ * [OWB-610] - upgrade to apache parent pom 10
+ * [OWB-611] - adding ASF trademark documentation to our official site build
+ * [OWB-612] - upgrade various maven plugins
+ * [OWB-613] - Exclude Samples WARs Publishing with Maven
+
+Task
+
+ * [OWB-592] - EJB Specialization utility method
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.0
+-------------------------------------------
+
+Bug
+
+ * [OWB-295] - resolve bugs in Javassist Proxy
+ * [OWB-417] - BaseEjbBean.destroyComponentInstance() should call direct container remove API, not call an @Remove annotated method
+ * [OWB-422] - Support needed for PrePassivate, PostActivate, and AroundTimeout via EJBInterceptor.
+ * [OWB-444] - Using Static Loggers in Shared ClassLoader
+ * [OWB-452] - set active flag to false then context is destroyed
+ * [OWB-456] - When multiple interceptors are defined for a bean OWB does NOT correctly remove the overridden base Interceptors
+ * [OWB-469] - JSR299TCK: Security Error / Passivation errors during readObject
+ * [OWB-470] - OWBInjector does not work correctly for EJB Beans
+ * [OWB-471] - Possible StackOverflowException from defineProducerMethods in WebBeansAnnotatedTypeUtil
+ * [OWB-473] - bundles that use javasissist to proxy their contents need to import some javassist packages
+ * [OWB-474] - InjectionTargetBean#injectSuperResources is missing
+ * [OWB-477] - Two instances of using ObjectInputStream that may not have visibility into application classloader
+ * [OWB-480] - Avoid a couple NPEs
+ * [OWB-482] - Small issues
+ * [OWB-486] - ResourceBean tries to proxy final classes before testing them for being final
+ * [OWB-489] - AnnotatedTypes added with BeforeBeanDiscovery.addAnnotatedType method are ignored
+ * [OWB-490] - ProcessObserverMethod Type parameters are inverted (CDITCK-174)
+ * [OWB-491] - Decorators init needs to scan superclasses for more interfaces. cf CDITCK-178
+ * [OWB-492] - events don't get sent to private @Observes methods
+ * [OWB-493] - ProcessProducerMethod and ProcessProducerField type parameters are reversed in filtering (?) CDITCK-168
+ * [OWB-494] - Subclasses with non-overriden observer methods not recognized as beans with observer methods
+ * [OWB-496] - Don't replace the ProxyFactory classloaderProvider without the intention to do so
+ * [OWB-499] - WEB-INF/beans.xml of a war will not activate Bean Archive behaviour
+ * [OWB-502] - Only cache the ContextService once, in the SingletonService
+ * [OWB-504] - OwbApplicationFactory getWrapped should return wrapped application factory
+ * [OWB-505] - OwbApplicationFactory should not be installed by default
+ * [OWB-509] - Unwrap InvocationTargetException in ResourceProxyHandler.invokie
+ * [OWB-510] - return null instead of an unusable proxy if a resource is missing
+ * [OWB-511] - Delegate actualInstance serialization behavior in ResourceProxyHandler
+ * [OWB-514] - Leak in ELContextStore
+ * [OWB-519] - broken wls support
+ * [OWB-521] - ProducerMethodBean could theoretically produce a NPE
+ * [OWB-522] - Missing updateTimeout in one of begin methods for conversation
+ * [OWB-523] - @SessionScoped bean failover does not work
+ * [OWB-524] - OWB classpath scanning of non-jars doesn't work if the classpath contains spaces
+ * [OWB-527] - JspFactory.getDefaultFactory() is synchronized, We can cache the return value to improve performance
+ * [OWB-529] - lazy initialized class members should be volatile
+ * [OWB-530] - multi massive execution of our Interceptor test unveils a concurrency problem
+ * [OWB-531] - cleanup WebBeansELResolver#getValue
+ * [OWB-533] - concurrency bottleneck due to use of our logger
+ * [OWB-534] - Injection of @PersistenceContext does not work with abstract/base classes
+ * [OWB-541] - replace WeakHashMap with a standard one in InterceptorHandler
+ * [OWB-542] - Disposer is called twice on Dependent beans when injected into a managed object that is called from a JSP
+ * [OWB-543] - get rid of checked Exceptions in our SPI
+ * [OWB-545] - Cleanup our SecurityManager integration
+ * [OWB-546] - @Typed gets ignored if we use a AnnotatedType from an Extension @Observing ProcessAnnotatedType
+ * [OWB-547] - WebContextsService throws NPE on asynchronous app startup
+ * [OWB-548] - missing null check in DefaultContextsService#stopApplicationContext
+ * [OWB-550] - duplicated observer methods in case of @Specializes
+
+Improvement
+
+ * [OWB-209] - remove all <repositories> from our poms
+ * [OWB-254] - suppress initialising contextual handling for configurable URIs.
+ * [OWB-335] - implement a sample for @ViewScoped in reservation
+ * [OWB-393] - remove old XML configuration code
+ * [OWB-448] - More changes for decorator and interceptor passivation support
+ * [OWB-461] - source code quality
+ * [OWB-472] - archive centric beans.xml enabling
+ * [OWB-478] - make OWB build maven-3 aware
+ * [OWB-485] - AmbiguousResolutionException doesn't print details about the injection point
+ * [OWB-500] - improved app-server support
+ * [OWB-503] - Reduce static synchronized hashmap usage
+ * [OWB-506] - Upgrade our samples to Apache MyFaces-2.0.3 and OpenJPA-2.0.1
+ * [OWB-507] - our samples should be prepared for EE as default
+ * [OWB-508] - Dependent scope proxies are needed to wrap the build-in beans returned from the services if they are not serializable yet
+ * [OWB-516] - Get TCK standalone 1.0.4 CR2
+ * [OWB-517] - Conversation Log Improvement
+ * [OWB-518] - log all bean-archive markers
+ * [OWB-520] - spi for the webbeans-jee5-ejb-resource plugin
+ * [OWB-525] - create a findbugs filter file in our build-tools resource
+ * [OWB-526] - remove usage of java.net.URLs from ScannerService and drop scannotation
+ * [OWB-535] - free ScannerService resources once we don't need it anymore
+ * [OWB-536] - revisit our Logger usage in our Bean impls
+ * [OWB-537] - clear() AnnotatedElementFactory after the deployment
+ * [OWB-539] - fill AnnotatedTypeImpl lazily
+ * [OWB-540] - StandaloneResourceInjectionService should cache info about classes which don't contain EE resource injection points
+ * [OWB-544] - improve BeanManager#getContext performance
+
+New Feature
+
+ * [OWB-433] - add a configuration flag for switching to a lenient lifecycle interceptor checking
+ * [OWB-501] - owb ee 5 resource integration
+ * [OWB-528] - Use ApplicationWrapper as parent of OwbApplication in JSF 2 plugin
+ * [OWB-532] - create a new BeanManager#isInUse()
+ * [OWB-538] - lazy loading of not explicitly marked (via annotation or registered by extension) Dependent beans
+
+Question
+
+ * [OWB-383] - static fields in CreationalContext
+
+TCK Challenge
+
+ * [OWB-484] - Running TCK 1.0.1 Final and Respective Corrections
+
+Task
+
+ * [OWB-19] - Geronimo Integration
+ * [OWB-428] - implementation of equals and hashCode for AbstractOwbBean
+ * [OWB-453] - add a flag to disable context activation in EJB interceptor
+
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0
+-------------------------------------------
+
+Bug
+
+ * [OWB-318] - multiple methods with same EJB @interceptors(foo.class) in same bean class get multiple interceptor instances
+ * [OWB-384] - OWB needs to call 299-defined PrePassivate, PostActivate, and AroundTimeout interceptors for EJBs
+ * [OWB-422] - Support needed for PrePassivate, PostActivate, and AroundTimeout via EJBInterceptor.
+ * [OWB-429] - OpenWebBeansEjbPlugin Class Hierarchy
+ * [OWB-438] - Cached Normal Scoped Proxy instances
+ * [OWB-439] - EjbPlugin session bean proxy creation thread safe problem
+ * [OWB-445] - we must not use javassist ProxyFactory#setHandler(MethodHandler)
+ * [OWB-446] - EJB lifecycle callbacks not stacked correctly
+ * [OWB-450] - NullPointerException in DependentScopedBeanInterceptorHandler when it has a NullCreationalContext (normally from a EE component).
+ * [OWB-454] - ClassUtil.callInstanceMethod() doesn't propogate original exception
+ * [OWB-455] - IllegalArgument method calling remove method of EJB during destroy
+ * [OWB-456] - When multiple interceptors are defined for a bean OWB does NOT correctly remove the overriden base Interceptors
+ * [OWB-457] - we must not create a SessionContext for static resource reqeusts
+ * [OWB-460] - fix owb-openejb and owb-ejb artifactIds
+ * [OWB-464] - InjectionPointImpl using wrong class loader during serialize/deserialize, dropping qualifiers, and omiting qualifier values.
+ * [OWB-466] - Ensure removal of all ThreadLocal values
+
+Improvement
+
+ * [OWB-177] - Handling of InterceptionType#POST_ACTIVATE, PRE_PASSIVATE and AROUND_TIMEOUT is missing
+ * [OWB-407] - detailed information about exceptions
+ * [OWB-451] - Allow InterceptorUtil#callAroundInvokes to propogate a callers 'creational context key'
+ * [OWB-459] - upgrade to newer library versions
+ * [OWB-463] - EjbDefinitionUtility.defineEjbBeanProxy() should be able to create proxies for no-interface local beans
+ * [OWB-465] - enhance EJB common code for crude @LocalBean support
+
+TCK Challenge
+
+ * [OWB-394] - Any idea why our BeforeBeanDiscovery.addInterceptorBinding() has different signature?
+
+Task
+
+ * [OWB-453] - add a flag to disable context activation in EJB interceptor
+ * [OWB-462] - Refactor AnnotationUtil.hasAnnotationMember()
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0-alpha-2
+-------------------------------------------
+Bug
+
+ * [OWB-303] - upgrade Javassist to a newer version
+ * [OWB-338] - our internal SessionContext and ConversationContext must support Session serialization
+ * [OWB-385] - implement passivation of managed beans in ServletContextListener
+ * [OWB-401] - ELContextStore not cleaned up for some JSP EL lookups
+ * [OWB-402] - OpenWebBeansJsfPlugin does not recognize @ManagedBean
+ * [OWB-404] - Contexts must not get stored in a static Map in BeanManager
+ * [OWB-405] - AnnotatedElementFactory must not use static cache maps
+ * [OWB-408] - NPE in WebBeansELResolver
+ * [OWB-415] - EjbBeanProxyHandler for dependent ejb must save ejb instance
+ * [OWB-416] - BaseEJBBean.destroyComponentInstance() tries to call multiple remove methods
+ * [OWB-418] - EjbBeanProxyHandler must be 1:1 with proxy instances for dependent SFSB
+ * [OWB-419] - fix @Dependent handling in ELResolver
+ * [OWB-420] - SingletonContext is mapped to @ConversationScoped
+ * [OWB-421] - defined-in-class EJB lifecycle callbacks masked by our Interceptor
+ * [OWB-426] - Tweak EJBPlugin to work with Standalone Tests
+ * [OWB-431] - Generic Type Inheritance not resolved correctly
+ * [OWB-434] - ThreadLocal<SingletonContext> doen't get cleaned up
+ * [OWB-436] - AbstractContext bean instance creation is not thread safe
+ * [OWB-437] - Improve AbstractContext synchronization
+ * [OWB-440] - WebBeansDecoratorConfig.getDecoratorStack always returns new Decorators
+ * [OWB-442] - our EJB proxies are broken when multiple local interfaces are used on a single class
+ * [OWB-443] - Normal-scoped EJB not removed by container during Contextual.destroy()
+
+Improvement
+
+ * [OWB-57] - cleanup problems found by maven-findbugs-plugin
+ * [OWB-195] - Give warning to the developer related with non- portable operations
+ * [OWB-409] - create a name for OWB our faces-config.xml
+ * [OWB-410] - lazy initialisation of ejbInterceptors
+ * [OWB-411] - cache calls to isNormalScope()
+ * [OWB-412] - Allow container specific extensions to WebConfigurationListener access to the lifecycle
+ * [OWB-413] - cache calls to ClassUtils#getObjectMethodNames()
+ * [OWB-414] - improve Interceptor performance
+ * [OWB-425] - improve performance of owb-el-resolver
+ * [OWB-427] - improve read-performance of AbstractOwbBean
+ * [OWB-430] - improve performance of WebBeansPhaseListener
+ * [OWB-432] - Create Singleton Service SPI
+ * [OWB-441] - new configuration properties mechanism
+
+Sub-task
+
+ * [OWB-193] - If an interceptor or decorator has any scope other than @Dependent, non-portable behavior results.
+ * [OWB-194] - If an interceptor or decorator has a name, non-portable behavior results.
+ * [OWB-196] - If an interceptor or decorator is an alternative, non-portable behavior results.
+ * [OWB-197] - If a stereotype declares any other qualifier an- notation, non-portable behavior results.
+ * [OWB-198] - If a stereotype is annotated @Typed, non-portable behavior results.
+
+
+TCK Challenge
+
+ * [OWB-424] - Adding Document for How to Configure and Run TCK (standalone and web profile TCKs)
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0-alpha-1
+-------------------------------------------
+Bug
+
+ * [OWB-216] - Update pom.xml svn links
+ * [OWB-231] - exception using abstract decorators
+ * [OWB-245] - Using parameterized type varaibles fails for Producer Method injection
+ * [OWB-259] - Implement spec 11.5.5. ProcessModule event
+ * [OWB-289] - Owb return 2 beans for Indirect specialized producer beans
+ * [OWB-302] - InjectionPoint injections (both method and field based) in Decorators result in null
+ * [OWB-312] - Add dopriv's to allow OWB to function with java 2 security enabled
+ * [OWB-317] - creationalContext in InvocationContextImpl is always null
+ * [OWB-318] - multiple methods with same EJB @interceptors(foo.class) in same bean class get multiple interceptor instances
+ * [OWB-327] - annotating an Interceptor with @ApplictionScoped leads to OutOfMemory
+ * [OWB-329] - Interceptor instances get created each time the interceptor gets called
+ * [OWB-332] - Destroy Depdent Of Producer Method Beans when Invocation Completes
+ * [OWB-333] - InjectionTarget and Producer Handling
+ * [OWB-334] - cid is missing when using redirect for a jsf 2.0 application
+ * [OWB-336] - injected BeanManager must be Serializable
+ * [OWB-337] - events must not get broadcasted to beans which have no active Context
+ * [OWB-339] - Injecting Non-Contextual Beans Causes NPE in WebBeansUtil
+ * [OWB-340] - BeanManagerImpl.createInjectionTarget() Throws Exception When No Constructor Found
+ * [OWB-341] - CreationalContext#incompleteInstance should get cleaned after create()
+ * [OWB-342] - InterceptorHandler crashes with NullPointerException after deserialisation
+ * [OWB-343] - upgrade JPA spec from 1.0-PFD2 to 1.0 final revision
+ * [OWB-345] - Remove duplicate dependencies
+ * [OWB-351] - OWB picks up @SessionScoped contextual instances from expired sessions
+ * [OWB-352] - Thread Safety Problem in our InterceptorHandlers, aka proxies
+ * [OWB-353] - NPE in removeDependents@CreationalContextImpl
+ * [OWB-354] - WebContextService may throw NPE in tiered classloading environmemt
+ * [OWB-357] - WebbeansFinder should index first on ClassLoader, not singleton type
+ * [OWB-359] - ownerCreationalContext sometimes causes NPE in InterceptorDataImpl.createNewInstance()
+ * [OWB-361] - underlying EJB method not actually in our interceptors stack
+ * [OWB-362] - InvocationTargetException when invoking Stateless SessionBean
+ * [OWB-363] - Intermittent bug with ApplicationScope disposers not being called
+ * [OWB-366] - ContextNotActiveException fired from AppScope/NormalScopedBeanInterceptorHandler when a proxied object finalized
+ * [OWB-368] - The 299 spec (that I have) uses receive=IF_EXISTS but OWB uses notifyObserver=IF_EXISTS.
+ * [OWB-369] - Static ContextsService in ContextFactory causes wrong webContextService used for multiple applications
+ * [OWB-370] - Intransient Conversation context get rdestroyed randomly by destroyWithRespectToTimout
+ * [OWB-371] - no lifecycle interceptors for non-contextual EJB
+ * [OWB-372] - creational context not cleaned up for non-contextual EJB interceptions
+ * [OWB-373] - build crashes with missing artifact error
+ * [OWB-374] - migrate jsf2sample from sun to MyFaces
+ * [OWB-376] - [patch] Guess example broken with Jetty plugin 6.x due to EL 2.2
+ * [OWB-377] - revise logging
+ * [OWB-378] - ejb at bottom of decorator stack doesn't handle changed method
+ * [OWB-380] - NormalScopedBeanInterceptorHandler throws NPE when handling 3rd party Contexts
+ * [OWB-381] - NPE thrown from AbstractInjectable if dependent producer returns null
+ * [OWB-382] - injecting a @Dependent bean into a passivatation scoped bean causes a NonSerializableException
+ * [OWB-387] - DependentContext Interceptor Double Call for PostConstruct
+ * [OWB-390] - fix broken links in our 'site'
+ * [OWB-396] - fix poms to work with maven 3
+ * [OWB-398] - DelegateHandler cached too agressively
+ * [OWB-399] - Proxy objects could not be correctly deserialized by using javassist 3.11. we need to update to 3.12
+ * [OWB-400] - starting OWB as part of an EAR in geronimo causes a exception due to missing 'bundle' protocol
+
+Improvement
+
+ * [OWB-116] - Update Business Method Definition
+ * [OWB-118] - Supports Decorators for Other Delegate Injections
+ * [OWB-136] - fix 'broken' license headers in our java files
+ * [OWB-170] - Address findbug issues in webbeans-impl
+ * [OWB-183] - Improve webbeans-doc module to get a documentation more user friendly
+ * [OWB-214] - get rid of javax.transaction.Transaction dependency in webbeans-impl
+ * [OWB-237] - NoSuchElementException when WebBeansConfigurationListener is absent
+ * [OWB-275] - remove unused imports and cleanup code
+ * [OWB-286] - java.lang.NoClassDefFoundError: javax/validation/Validator
+ * [OWB-313] - create caching strategies for resolving Bean<T> for BeanManager and EL invocations
+ * [OWB-314] - cache resolved instances in NormalScopedBeanMethodHandlers of @ApplicationScoped beans
+ * [OWB-315] - cache resolved instances in NormalScopedBeanMethodHandlers of @SessionScoped beans
+ * [OWB-319] - Strange logging when writing non-Serializable SessionScoped bean
+ * [OWB-320] - Remove Java EE Dependencies from WebBeans Core
+ * [OWB-322] - Create new EJB project and separate common EJB classes from OpenEJB plugin
+ * [OWB-325] - Relocate SPI Classes to SPI Module. Change JSR299, JSR330 as optional pom dependency.
+ * [OWB-326] - improve producer tests
+ * [OWB-328] - improve logger performance
+ * [OWB-330] - reduce BeanManagerImpl#getManager() calls inside the same functions
+ * [OWB-331] - Cache Interceptor & Decorator Stack oon Interceptor Handler
+ * [OWB-346] - Make EJB samples running
+ * [OWB-347] - Using InjectableBeanManager in TCK
+ * [OWB-349] - ignore exception during type hierarchy scan
+ * [OWB-350] - Support Interceptor for non-contextual EJBs
+ * [OWB-355] - OpenEjbBean should look for @Remove methods
+ * [OWB-356] - EjbPlugin only looks for DeployementInfo once, so new deployed application won't be discovered
+ * [OWB-358] - provide property to skip injection in @PostConstruct of OpenWebBeansEjbInterceptor
+ * [OWB-360] - Add BeanManager to a ServletContext attribute
+ * [OWB-364] - Reduce the amount of info level logging
+ * [OWB-365] - make injection optional in OWBEJBInterceptor
+ * [OWB-375] - Performance: OWB logging performs operations when logging disabled.
+ * [OWB-379] - upgrade to final atinject-spec artifact
+ * [OWB-386] - upgarde CDI TCK to 1.0.2.CR1
+ * [OWB-389] - atinject-tck upgrade to final 1.0 release
+ * [OWB-397] - Add helper method and some debug to WebBeansFinder
+
+New Feature
+
+ * [OWB-316] - Implement a generic TestContainer for CDI implementations
+ * [OWB-323] - Provide methods to pass classloader into ServiceLoader and WebBeansFinder for use in tiered classloader situations
+ * [OWB-324] - Add Tomcat Plugin
+ * [OWB-348] - Adding Interceptor and Decorator Support for EJB Beans
+ * [OWB-395] - OpenWebBeans Tomcat 7 Support
+
+TCK Challenge
+
+ * [OWB-388] - Pass TCK 1.0.2 CR1 Web Profile
+
+Task
+
+ * [OWB-6] - Scope passivation
+ * [OWB-14] - Update WebBeans Lifecycle for Servlet Beans
+ * [OWB-46] - Injection into non-contextual objects
+ * [OWB-204] - Update Samples for JSF2 Usage
+ * [OWB-220] - Update site.xml links and bread crumbs to point to non-incubator.
+ * [OWB-310] - Drop dom4j and use jre builtin xml parsers for processing beans.xml
+ * [OWB-391] - create a owb-build-tools project to maintain project specific checkstyle rules, etc.
+
+Test
+
+ * [OWB-56] - Integrate the official JSR-299 TCK test suite
+ * [OWB-222] - Update website download link, and fix relative URL translation
+ * [OWB-367] - Add a unit test for IF_EXISTS
+
+
+----------------------------------------------
+Required Platform
+----------------------------------------------
+Java Version : Java SE >= 5.0
+Java EE Must : Java EE >= 5.0
+
+---------------------------------------------
+How to Configure OpenWebBeans
+---------------------------------------------
+
+This section explains a content of the distribution bundle, OWB plugins and its
+dependent libraries.
+
+---------------------------------------------
+1.1.2 Distribution Content
+---------------------------------------------
+There are several jars in the OpenWebBeans 1.0.0 distribution;
+
+ - openwebbeans-impl-1.1.2.jar --> Includes Core Dependency Injection Service.
+ - openwebbeans-ejb-1.1.2.jar --> EJB Plugin(Supports EJBs in OpenEJB embedded in Tomcat).
+ - openwebbeans-openejb-1.1.2.jar --> OpenEJB specific Plugin SPI implementations as extension to openwebbeans-ejb
+ - openwebbeans-jms-1.1.2.jar --> JMS Plugin(Supports injection of JMS related artifacts,i.e, ConnectionFactory, Session, Connection etc.)
+ - openwebbeans-jsf-1.1.2.jar --> JSF-2.0 Plugin(JSF Conversation Scoped Support).
+ - openwebbeans-jsf12-1.1.2.jar --> JSF-1.2 Plugin(JSF Conversation Scoped Support).
+ - openwebbeans-resource-1.1.2.jar --> Java EE Resource Injection for Web Projects (Includes @PersistenceContext,@PersistenceUnit
+ and @Resource injection into the Managed Beans. @Resource injections use java:/comp/env of the
+ Web application component. @PersistenceContext is based on extended EntityManager.
+ - openwebbeans-spi-1.1.2.jar --> OpenWebBeans Server Provider Interfaces. They are implemented by runtime environments that would
+ like to use OpenWebBeans as a JSR-299 implementation.
+ - samples --> Includes source code of the samples. Samples are mavenized project therefore you can easily build and run
+ them from your environment that has maven runtime.
+ - openwebbeans-osgi-1.1.2.jar --> ClassPath ScannerService SPI implementation for OSGI environments like Apache Geronimo-3
+ - openwebbeans-web-1.1.2.jar --> Basic Servlet integration
+ - openwebbeans-tomcat6-1.1.2.jar --> Support for deeper integration into Apache Tomcat-6
+ - openwebbeans-tomcat7-1.1.2.jar --> Support for deeper integration into Apache Tomcat-7
+
+
+
+
+------------------------------------------
+How OWB Plugins Work
+------------------------------------------
+
+OpenWebBeans has been developed with a plugin architecture. The Core dependency injection service
+is provided with openwebbeans-impl. If you need further service functionality,
+you have to add respective plugin jars into the application classpath. OpenWebBeans
+uses the Java SE 6.0 java.util.ServiceLoader mechanism to pickup plugins at runtime.
+If you run under Java SE 5.0, an similar hand written implementation will be used.
+Please do not confuse OWB plugins with portable Extensions! OWB plugins are for
+internal use only whereas portable CDI Extensions will run on any JSR-299 container.
+
+Current Plugins:
+---------------------
+Look at "1.1.2 Distribution Content" above.
+
+------------------------------------------
+Dependent Libraries
+------------------------------------------
+
+Third Party jars:
+-----------------
+They are necessary at runtime in the Core Implementation.
+
+javassist : Version 3.12.0.GA
+scannotation : Version 1.0.2 (if not running in an OSGi environment like Apache Geronimo-3)
+
+Java EE APIs jars(Container Provider Libraries) :
+-------------------------------------------------
+Generally full Java EE servers provides these jars. But web containers like Tomcat or Jetty
+do not contain some of them, such as JPA, JSF, Validation API etc. So, if you do not want to bundle
+these libraries within your application classpath, you have to include these libraries in your
+server common classpath.
+
+jcdi-api (JSR-299 Specification API)
+atinject-api (JSR-330 Specification API)
+servlet-2.5 or servlet 3.0 (Servlet Specification API)
+ejb-3.1 (EJB Specification API)
+el-2.2 (Expression Langauge Specification API)
+jsf-2.0 (Java Server Faces API)
+jsr-250 (Annotation API)
+interceptor-1.1 (Interceptor API)
+jta-1.1 (Java Transaction API)
+jsp.2.1 or jsp-2.2 (Java Server Pages API)
+jpa-2.0 (Java Persistence API)
+jaxws-2.1 or jaxws-2.2 (Java Web Service API)
+jms-1.1 or jms-1.2 (Java Messaging Service API)
+validation (Validation Specification)
+
+Dependencies of OpenWebBeans Maven Modules&Plugins
+--------------------------------------------------
+
+openwebbeans-impl :
+------------------
+Third party : javassist, scannotation, openwebbeans-spi
+Container Provided : jcdi-api, at-inject, servlet, el, jsr-250, interceptor, jta, jsp, validation
+
+openwebbeans-ejb:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : OpenWebBeans EJB plugin is based on OpenEJB in Tomcat. Therefore, if you install OpenEJB
+ within Tomcat correctly, there is no need to add any additional libraries. Look at the
+ OpenEJB in Tomcat configuration section.
+
+openwebbeans-jms:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : jms
+
+openwebbeans-jsf:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : jsf
+
+NOTE : We are trying to decrease dependent libraries of the our core, i.e, openwebbeans-impl.
+At 1.1.2, dependent third party libraries will be decreased. We have a plan to create profile
+plugins, therefore each profile plugin provides its own dependent libraries. For example, in
+fully Java EE Profile Plugin, Transaction API is supported but this will not be the case
+for Java Web Profile Plugin or Java SE Profile Plugin. Stay Tuned!
+
+Currently, as you have seen above, openwebbeans-impl depends on some Java EE/Runtime
+provided libraries (servlet, jsp, el etc). In the future, with OpenWebBeans profiling support,
+openwebbeans-impl will not depend on any Java EE APIs. Those APIs will be provided
+by OpenWebBeans profiles/plugins that openwebbeans-impl will be used. Therefore,
+you will able to use OpenWebBeans in your own runtime environment easily by writing
+your own plugins and contributing it to OpenWebBeans :)
+
+------------------------------------------
+Library Configuration
+------------------------------------------
+To run openwebbeans applications in the Java EE based application server,
+you could add the JSR-299 API and JSR-330 API into the server common classpath, and
+implementation, plugins and dependent jars into your "WEB-INF/lib" directory
+of the Java EE Web Application.
+
+In this release, we can not support the OpenWebBeans as an integrated
+functionality of the Java EE Application Servers. So, you have to manage the
+configuration of the OpenWebBeans within your application's "web.xml" file. A sample "web.xml"
+file can be found in the "config" directory. To use EJB functionality, you also have to
+add OWB specific interceptor into your EJB beans. Look at the EJB section of this readme
+for further details.
+
+---------------------------------------------
+OpenWebBeans Properties File
+---------------------------------------------
+OpenWebBeans uses a default configuration file to configure some of its
+properties. Default configuration files are embedded into OWB implementation
+jar files. Instead of opening the jars file and changing configuration properties, simply add
+an "openwebbeans.properties" file into a "META-INF/openwebbeans" folder of your application
+classpath. This will override the values from the default configuration.
+You can specify a property 'configuraion.ordinal' in this file to define the overlay order.
+A properties file with higher 'configuration.ordinal' value will applied later and thus
+have a higher precedence. If you don't specify a 'configuration.ordinal' a value of 100 is assumed;
+This allows to have multiple openwebbeans.properties files e.g. a common one in an EAR lib
+(with configuration.ordinal=100) and more specific ones for each WebApp in your EAR (with a
+configuration.ordinal of e.g. 101).
+
+Each plugin developer can provide their own SPI implementation class and own configuration values. If you would like
+to use those implementation classes or configuration values, you have to override the default configuration file as explained
+in the above paragraph, i.e, putting "openwebbeans.properties" file into "META-INF/openwebbeans" folder of your application.
+It is recommended to use a 'configuration.ordinal' between 50 and 99 for custom SPI implementations.
+
+Below are OpenWebBeans' default configuration properties from our openwebbeans-impl.jar file and our plugins such as
+our OpenEJB plugin.
+
+Override default value of ResourceInjectionService
+-------------------------------------------------
+org.apache.webbeans.spi.ResourceInjectionService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService
+
+OpenWebBeans uses the "OpenEjbResourceInjectionService" class to inject resources into the managed bean instances.
+
+Configuration Names and Their Default Values :
+
+- "org.apache.webbeans.spi.ContainerLifecycle"
+ Description : Implementation of org.apache.webbeans.spi.ContainerLifecycle. All magic starts from here.
+ Values : org.apache.webbeans.lifecycle.DefaultLifecycle, OR CUSTOM
+ Default : org.apache.webbeans.lifecycle.DefaultLifecycle
+
+- "org.apache.webbeans.spi.JNDIService"
+ Description : Configures JNDI provider implementation.
+ Values : org.apache.webbeans.spi.se.DefaultJndiService OR CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultJndiService
+
+- "org.apache.webbeans.spi.conversation.ConversationService"
+ Description : Implementation of conversation.
+ Values : org.apache.webbeans.spi.conversation.jsf.DefaultConversationService OR CUSTOM
+ Default : org.apache.webbeans.spi.conversation.jsf.DefaultConversationService
+
+- "org.apache.webbeans.spi.ScannerService"
+ Description : Default implementation of org.apache.webbeans.spi.ScannerService. It is used for scanning application deployment
+ for finding bean classes and configuration files.
+ Values : org.apache.webbeans.spi.ee.deployer.DefaultScannerService OR CUSTOM
+ Default : org.apache.webbeans.spi.ee.deployer.DefaultScannerService
+
+- "org.apache.webbeans.spi.SecurityService"
+ Description : Implementation of org.apache.webbeans.spi.SecurityService. It is used for getting current "Principal".
+ Values : org.apache.webbeans.spi.se.DefaultSecurityService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultSecurityService
+
+- "org.apache.webbeans.spi.ValidatorService"
+ Description : Implementation of org.apache.webbeans.spi.ValidatorService. It is used for getting "ValidatorFactory" and "Validator".
+ Values : org.apache.webbeans.spi.se.DefaultValidatorService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultValidatorService
+
+- "org.apache.webbeans.spi.TransactionService"
+ Description : Implementation of org.apache.webbeans.spi.TransactionService. It is used for getting "TransactionManager" and "Transaction".
+ Values : org.apache.webbeans.spi.se.DefaultTransactionService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultTransactionService
+
+- "org.apache.webbeans.spi.ResourceInjectionService"
+ Description : Implementation of org.apache.webbeans.spi.ResourceInjectionService. It is used for injection Java EE enviroment resource into the
+ Managed Bean instances.
+ Values : org.apache.webbeans.se.DefaultResourceInjectionService or CUSTOM
+ Default : org.apache.webbeans.se.DefaultResourceInjectionService
+
+- "org.apache.webbeans.spi.JNDIService.jmsConnectionFactoryJndi"
+ Description : Configures JMS ConnectionFactory object jndi name
+ Values : Server specific JNDI name
+ Default : ConnectionFactory
+
+- "org.apache.webbeans.conversation.Conversation.periodicDelay"
+ Description : Conversation removing thread periodic delay
+ Values : Configured in millisecond
+ Default : 150000 ms
+
+- "org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService"
+ Description : Use EJB functionality or not. If use OpenEJB configures to true
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.spi.FailOverService"
+ Description : Implementation of the org.apache.webbeans.spi.FailOverService. It is used for enabling passivation/failover beans.
+ Values : org.apache.webbeans.web.failover.DefaultOwbFailOverService or CUSTOM
+ Default : org.apache.webbeans.web.failover.DefaultOwbFailOverService
+
+- "org.apache.webbeans.web.failover.issupportfailover"
+ Description : Support failover of beans or not
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.web.failover.issupportpassivation"
+ Description : Support passivation of beans or not
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.forceNoCheckedExceptions"
+ Description : The interceptors spec defines that @PostConstruct & Co must not throw checked Exceptions. Setting this configuration to 'false' disables this check.
+ Values : false, true
+ Default : true
+
+- "org.apache.webbeans.spi.SecurityService"
+ Description : Service to provide methods which must be guarded via doPrivileged blocks.
+ Values : org.apache.webbeans.corespi.security.SimpleSercurityService or org.apache.webbeans.corespi.security.ManagedSecurityService
+ Default : org.apache.webbeans.corespi.security.SimpleSercurityService
+
+
+---------------------------------------------
+EJB Support via Embeddable OpenEJB Container in Tomcat 6.X
+---------------------------------------------
+
+Configuration Steps:
+--------------------------------------------
+1* Download Tomcat 6.X version
+2* Configure OpenEJB. Look at URL http://openejb.apache.org/tomcat.html for installation.
+3* Copy JSR-330 API to Tomcat /lib folder.
+4* Copy JSR-299 API to Tomcat /lib folder
+5* Put all dependent libraries of the OpenWebBeans OpenEJB Plugin
+ - openwebbeans-ejb
+ - openwebbeans-impl and its dependencies
+
+You could look at ejb-sample.war for "WEB-INF/lib" libraries as an example to develop custom applications.
+The source of this project is also available.
+
+To use EJB functionality, you will use OpenEJB collapse-ear support. In this configuration,
+your EJB beans live within your "war" bundle.
+
+How to Develop EJB Applications
+---------------------------------------------
+1* Add "META-INF/openwebbeans.properties" into your application classpath.
+2* Add "org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService=true" to use EJB functionality.
+ So OWB container looks for EJBs.
+3* Add "org.apache.webbeans.resource.spi.ResourceService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService to
+use OpenEJB Resource injections.
+4* Add "openwebbeans-ejb", plugin into your web application classpath.
+5* If you want to use other plugins, add respective plugins into your application classpath. For example, if you wish to use
+JSF framework, you add "openwebbeans-jsf" plugin.
+6* Add OWB related interceptor into your EJB Beans. This is called "org.apache.webbeans.ejb.interceptor.OpenWebBeansEjbInterceptor"
+This is needed for OWB injections.
+7* Update your application's "web.xml" to add OWB specific configuration.
+
+---------------------------------------------
+How to Run Samples
+---------------------------------------------
+
+In this release, there are several sample applications located in the "/samples" directory
+of the distribution. You can run those samples via simple maven command.
+
+1) "Guess Application" : Simple usage of the OWB + JSF.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+2) "Hotel Reservation Application" : Show usage of JSF + JPA + OWB
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+3) "EJB Sample Application" : Shows the usage of EJBs with embeddable OpenEJB in Tomcat. Firstly
+configure OpenEJB with Tomcat as explained above.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+4) "EJB Telephone Application" : Shows the usage of OpenEJB resource injection service.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+5) "JMS Injection Sample" : Show JMS injections. JMS injection currently uses
+ ConnectionFactory as JMS connection factory jndi name. You can change this
+ via configuration file. Look above explanation for how to configure JMS jndi. Also,
+ JMS injection requires to use of a JMS provider. Generally Java EE servers contains
+ default JMS provider. It can be run on JBoss and Geronimo. It uses Queue with jndi_name = "queue/A".
+ So you have to create a queue destination in your JMS provider with name "queue/A" to run example.
+ If you want to change queue jndi name, then look at source and change it from "WEB-INF/beans.xml" file.
+
+6) "Conversation Sample" : Shows usage of JSF conversations.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+7) "JSF2 Sample" : Shows usage of JSF2 Ajax.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section. It requires
+to use JSF2 runtime.
+
+
+8) "Standalone Sample" : Shows usage of OpenWebBeans in Standalone Swing Application.
+Look at "OpenWebBeans in Java SE" section.
+
+Configuring and Running the Applications:
+--------------------------------------------
+See section Compile and Run Samples via Jetty&Tomcat Plugin.
+
+--------------------------------------------
+Maven Install and Package From the Source
+--------------------------------------------
+
+Maven Version : Apache Maven 2.2.1 or later
+
+First you have to download the "source" version of the OpenWebBeans project that
+contains the all source code of the OpenWebBeans.
+
+To install the Maven artifacts of the project from the source, Maven must be installed
+in your runtime. After Maven installation, just run the following command in the top level
+directory that contains the main "pom.xml" :
+
+> mvn clean install
+
+This command will install all the Maven artifacts into your local Maven repository.
+
+If you wish to package all artifacts of the project, just run the following command
+in in the top level directory that contains the main "pom.xml" :
+
+> mvn clean package
+
+This command will package the project artifacts from the source and put these artifacts into the each modules
+respective "target" directory.
+
+-------------------------------------------
+Compile and Run Samples via Tomcat&Jetty Plugin
+-------------------------------------------
+This section shows how to run samples in Jetty or OpenEJB Embedded Tomcat.
+
+------------------------------------------
+Samples Run within Jetty Plugin
+------------------------------------------
+You can compile and run "guess","jsf2","conversation-sample" and "reservation "samples via maven Jetty plugin.
+Go to the source bundle "samples/" directory. In the "guess/" or "reservation/" directory, run
+the following maven commands. It will start up maven Jetty container. It bundles all of the
+required jars into the WEB-INF/lib folder. You are not required to add any jar to the classpath.
+
+Samples : Guess and Reservation
+------------------------------
+Go to the source folder of projects and run
+
+> mvn clean install -Pjetty
+> mvn jetty:run -Pjetty
+
+Guess URL : http://localhost:8080/guess
+Reservation URL : http://localhost:8080/reservation
+
+Samples : Conversation Sample and JSF2
+-------------------------------------
+Go to the source folder of projects and run
+
+>mvn clean install
+>mvn jetty:run
+
+Conversation Sample URL : http://localhost:8080/conversation-sample
+JSF2 Sample URL : http://localhost:8080/jsf2sample
+
+------------------------------------------
+Samples Run within Tomcat Plugin
+------------------------------------------
+OpenEJB samples are run with Maven Tomcat Plugin.
+
+Tomcat Plugin uses http://localhost:8080/manager application to deploy war file
+into your embeddable EJB Tomcat container. There must be an tomcat-users.xml
+file in the "conf" directory of the server that contains manager role and username.
+
+>Start Tomcat server if not started
+>mvn tomcat:deploy
+
+Ejb Sample URL : http://localhost:8080/ejb-sample
+Ejb Telephone URL : http://localhost:8080/ejb-telephone
+
+Example tomcat-users.xml file
+------------------------------------------
+<tomcat-users>
+<role rolename="manager"/>
+<user username="admin" password="" roles="manager"/>
+</tomcat-users>
+
+-----------------------------------------
+Deploy JMS Sample
+-----------------------------------------
+Simple drops jms-sample.war file into your application deploy location.
+
+JMS Sample Example URL : Hit the url http://localhost:8080/jms-sample/sender.jsf for sending JMS messages
+ Hit the url http://localhost:8080/jms-sample/receiver.jsf for receiving JMS messages
+
+-----------------------------------------
+OpenWebBeans in Java SE
+----------------------------------------
+OpenWebBeans can be used in Java SE environments such as Java Swing
+applications. A Standalone Sample is provided to show how to use OpenWebBeans
+in Java SE.
+
+Go to the source directory of the standalone sample:
+>mvn clean package;
+>cd target;
+>jar -xvf standalone-sample.jar
+>java -jar standalone-sample-1.1.2-SNAPSHOT.jar
+>Enjoy :)
+
+-----------------------------------------------
+OpenWebBeans User and Development Mailing Lists
+-----------------------------------------------
+Please mail to the user mailing list with any questions or advice
+about the OpenWebBeans.
+
+User Mailing List : [users@openwebbeans.apache.org]
+
+You can also join the discussions happening in the dev list
+
+Dev Mailing List : [dev@openwebbeans.apache.org]
+
+-------------------------------------------
+OpenWebBeans JIRA Page
+-------------------------------------------
+Please logs bugs into the "https://issues.apache.org/jira/browse/OWB".
+
+------------------------------------------
+OpenWebBeans Wiki and Blog Page
+-----------------------------------------
+Wiki: http://cwiki.apache.org/OWB/
+Introduction to OpenWebBeans : http://cwiki.apache.org/OWB/introduction-to-openwebbeans.html
+Blog : http://blogs.apache.org/owb
+
+-----------------------------------------
+OpenWebBeans Web Page
+----------------------------------------
+You can reach the OpenWebBeans web page at
+http://openwebbeans.apache.org
+---------------------------------------
+
+Your OpenWebBeans Team
+
+Enjoy!
diff --git a/owb_1.2.x/readme/README_1_1_3.txt b/owb_1.2.x/readme/README_1_1_3.txt
new file mode 100644
index 0000000..bad89b6
--- /dev/null
+++ b/owb_1.2.x/readme/README_1_1_3.txt
@@ -0,0 +1,995 @@
+-------------------------------
+Apache OpenWebBeans 1.1.3
+-------------------------------
+Welcome!
+Thanks for downloading and using OpenWebBeans.
+This document is a "Getting Started Guide" for OpenWebBeans.
+
+This document is based on the 1.1.3 release of Apache OpenWebBeans.
+
+--------------------------------
+What is Apache OpenWebBeans?
+--------------------------------
+OpenWebBeans is an Apache License V 2.0 licensed implementation of the JSR-299,
+Contexts and Dependency Injection for the Java EE platform.
+
+It also already incorporates some features which are part of JSR-346 (CDI-1.1)
+but doesn't need API changes as we still use the JCDI-1.0 API. The
+incorporated CDI-1.1 features are mostly parts which are not well
+defined in the CDI-1.0 specification, like Serialisation checks, etc.
+
+Our project's web page can be found at:
+http://openwebbeans.apache.org
+
+The projects WIKI page can be found at:
+https://cwiki.apache.org/confluence/display/OWB/Index
+
+
+--------------------------------
+OpenWebBeans 1.1.3 Release Features
+--------------------------------
+
+- The 1.1.3 release supports the following features
+-----------------------------------
+* Managed Beans Support
+* Session Beans Support (via Embeddable OpenEJB container in Tomcat)
+* Producer Method Support
+* Producer Field Support
+* Java EE Resource Injection Support
+* JMS OpenWebBeans Support(OWB Specific)
+* Inheritance, Stereotype Inheritances
+* Specialization Support
+* Event Support
+* Decorator and Interceptor Support
+* Lookup and Dependency Injection Support
+* Java EE Plugin Support (via ServetContextListener interface)
+* Portable Integration Support
+* Passivation Capability of Beans
+* @Alternative support
+* OSGi environment support with an own plugable bundle ClassPath scanner
+* vastly improved Interceptor performance
+* plugable SecurityManager integration doubles speed if no SecurityManager is being used
+* improved Serialization handling
+* improved CreationalContext handling
+* revised internal logging
+* upgrade to JPA-2 and JSF-2 support
+* support for direct CDI usage in tomcat-6 and tomcat-7 environments
+* optional lenient lifecycle interceptor checking
+* automatically detect if BeanManager#isInUse()
+* improved Serialization checks from the CDI-1.1 specification
+
+
+- 1.1.3 release does not support the following features
+--------------------------------------------
+* Does not fully integrate with Geronimo
+ (You have to configure your application to use OWB functionality,
+ e.g configure web.xml, adding interceptor to EJBs etc.)
+
+
+Noteable differences to CDI spec behaviour
+--------------------------------------------
+
+In a few special cases Apache OpenWebBeans might behave a little bit different than
+other CDI implementations. This is to some degree caused by the JSR-299 spec being
+not clear about some special topics so we needed to interpret the wording on our own.
+This mainly concerns the area of section 12.1 Bean Archives (BDA) which doesn't work
+out when it comes to OSGi containers and likes.
+In Apache OpenWebBeans, a settings configured in a beans.xml file of a BDA is not
+only effective for this very bean archive but for the whole BeanManager in control
+of the Application. This is especially the case for <alternatives> and
+<interceptors>! An Alternative, Interceptor or Decorator enabled in one BDA is active
+for the whole Application. This behaviour will most likely also be the default behaviour
+in the CDI-1.1 JSR-346 specification.
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.3
+-------------------------------------------
+
+Bug
+
+ * [OWB-515] - interceptors don't support inheritance without an overridden method annotated with @AroundInvoke
+ * [OWB-565] - missing check for producer methods
+ * [OWB-625] - BeanManager.resolve throw java.util.NoSuchElementException with an empty set parameter
+ * [OWB-629] - NoClassDefFoundError for optional dependencies
+ * [OWB-630] - AmbiguousResolutionException thrown for Decorators that Decorate multiple beans where any of those beans are passivation capable.
+ * [OWB-631] - openwebbeans-resource misses openwebbeans.properties
+
+Improvement
+
+ * [OWB-475] - support for optional beans
+ * [OWB-627] - Automatically destroy @Dependent contextual instances created with Instance<T>
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.2
+-------------------------------------------
+
+Bug
+
+ * [OWB-562] - non-enabled alternative beans with passivating scope fail validation during deployment
+ * [OWB-589] - " ... requires a passivation capable dependency ..." for producer method with return type String and non serializable injected dependency
+ * [OWB-597] - StackOverFlow when injecting product in same bean where @Produces is placed
+ * [OWB-615] - remove @Overrides for interfaces to be java5 compatible
+ * [OWB-616] - javax.el.ExpressionFactory has final methods! CDI doesn't allow that. - Test on final **PRIVATE** methods too?
+ * [OWB-618] - we sometimes invoke a dispose method without having created the bean upfront
+ * [OWB-619] - @New beans must only exist if there is at least one injection point for them
+ * [OWB-620] - any disabled bean of passivating scope will wrongly be detected as 'not passivatable'
+ * [OWB-622] - beanmanager injection in afterBeanDiscovery method parameter
+ * [OWB-624] - AnnotatedTypes registered in BeforeBeanDiscovery might get processed twice
+
+Improvement
+
+ * [OWB-623] - Relax check on @AroundInvoke Interceptors 'throws Exception'
+
+New Feature
+
+ * [OWB-621] - Alternative configuration method for buggy container or pre servlet api 2.5 container
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.1
+-------------------------------------------
+
+Bug
+
+ * [OWB-406] - BaseEjbBean.removedStatefulInstance used by multiple instances/EjbBeanProxyHandlers
+ * [OWB-447] - unnecessary contextual/non-contextual distinction in OpenWebBeansEJBIntercpetor
+ * [OWB-449] - EJB interceptor has incorrect/unnecessary use of business method checks
+ * [OWB-483] - Problem with mulitple custom interceptors and passivation
+ * [OWB-512] - ApplicationContext and SingletonContext in WebContextsService
+ * [OWB-554] - DelegateHandler wraps Beans exceptions
+ * [OWB-558] - PassivationCapable bean id's for Producer Fields do not take into account generics
+ * [OWB-561] - Multiple contexts with the same Scope are not handled properly -- causing tck failures
+ * [OWB-563] - producers of passivating beans fail when the declared return type is not serializable but the actual return type is
+ * [OWB-566] - ProcessInjectionTarget event gets fired too early
+ * [OWB-571] - fix site build under maven3 and upgrade logo
+ * [OWB-573] - Invalid checking of Interceptor serialization capabilities for non-Passivation capable EJBs
+ * [OWB-576] - FileNotFoundException on WebSphere
+ * [OWB-577] - FileNotFoundException on WebSphere
+ * [OWB-578] - Allow DI for OpenWebBeansConfiguration properties
+ * [OWB-579] - check for non-proxyiable methods should exclude synthetic methods
+ * [OWB-581] - Decorator interface check needs configurable exclusions
+ * [OWB-584] - check for declared name consistency for specializes beans is wrong
+ * [OWB-585] - ProcessSessionBean doesn't deal with generic type quite right (CDITCK-215)
+ * [OWB-586] - Interceptors added by portable extensions don't work
+ * [OWB-587] - Use business interface for producer and disposer methods of Session beans
+ * [OWB-588] - PrincipalBean is misspelled
+ * [OWB-590] - Seam Persistence does not work with OWB - AfterBeanDiscovery.addBean will be ignored
+ * [OWB-591] - EJB @Specializes inheritance
+ * [OWB-593] - Interceptor binding added on an interceptor class at ProcessAnnotatedType phase is not considered
+ * [OWB-595] - Use case "Faces Request Generates Non-Faces Response" locks conversation forever (-> BusyConversationException)
+ * [OWB-598] - InjectionResolver crashes with a NPE when injecting a method parameter
+ * [OWB-599] - move getBeanXmls() back to Set<URL>
+ * [OWB-600] - cache information about non intercepted methdos in ProxyHandlers
+ * [OWB-601] - WebContextsService only works if ServletContext is given
+ * [OWB-608] - openwebbeans-el10 plugin misses openwebbeans.properties
+ * [OWB-614] - add LICENSE and NOTICE files to all our samples
+
+Improvement
+
+ * [OWB-555] - ClassUtil methods contain spelling, camelcase, etc., type errors
+ * [OWB-557] - #setAccessible(false) isn't needed
+ * [OWB-560] - upgrade the TCK to 1.0.4.SP1
+ * [OWB-564] - CdiTestOpenWebBeansContainer - check if a std.-context is active before destroying it
+ * [OWB-582] - Support for Java 1.5 (needed for WebSphere 6.1)
+ * [OWB-583] - Support for Servlet API 2.4 (needed for WebSphere 6.1)
+ * [OWB-594] - create a configurable mapping Scope->ProxyMethodHandlerImplementation
+ * [OWB-607] - upgrade our samples to newest available dependencies
+ * [OWB-610] - upgrade to apache parent pom 10
+ * [OWB-611] - adding ASF trademark documentation to our official site build
+ * [OWB-612] - upgrade various maven plugins
+ * [OWB-613] - Exclude Samples WARs Publishing with Maven
+
+Task
+
+ * [OWB-592] - EJB Specialization utility method
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.0
+-------------------------------------------
+
+Bug
+
+ * [OWB-295] - resolve bugs in Javassist Proxy
+ * [OWB-417] - BaseEjbBean.destroyComponentInstance() should call direct container remove API, not call an @Remove annotated method
+ * [OWB-422] - Support needed for PrePassivate, PostActivate, and AroundTimeout via EJBInterceptor.
+ * [OWB-444] - Using Static Loggers in Shared ClassLoader
+ * [OWB-452] - set active flag to false then context is destroyed
+ * [OWB-456] - When multiple interceptors are defined for a bean OWB does NOT correctly remove the overridden base Interceptors
+ * [OWB-469] - JSR299TCK: Security Error / Passivation errors during readObject
+ * [OWB-470] - OWBInjector does not work correctly for EJB Beans
+ * [OWB-471] - Possible StackOverflowException from defineProducerMethods in WebBeansAnnotatedTypeUtil
+ * [OWB-473] - bundles that use javasissist to proxy their contents need to import some javassist packages
+ * [OWB-474] - InjectionTargetBean#injectSuperResources is missing
+ * [OWB-477] - Two instances of using ObjectInputStream that may not have visibility into application classloader
+ * [OWB-480] - Avoid a couple NPEs
+ * [OWB-482] - Small issues
+ * [OWB-486] - ResourceBean tries to proxy final classes before testing them for being final
+ * [OWB-489] - AnnotatedTypes added with BeforeBeanDiscovery.addAnnotatedType method are ignored
+ * [OWB-490] - ProcessObserverMethod Type parameters are inverted (CDITCK-174)
+ * [OWB-491] - Decorators init needs to scan superclasses for more interfaces. cf CDITCK-178
+ * [OWB-492] - events don't get sent to private @Observes methods
+ * [OWB-493] - ProcessProducerMethod and ProcessProducerField type parameters are reversed in filtering (?) CDITCK-168
+ * [OWB-494] - Subclasses with non-overriden observer methods not recognized as beans with observer methods
+ * [OWB-496] - Don't replace the ProxyFactory classloaderProvider without the intention to do so
+ * [OWB-499] - WEB-INF/beans.xml of a war will not activate Bean Archive behaviour
+ * [OWB-502] - Only cache the ContextService once, in the SingletonService
+ * [OWB-504] - OwbApplicationFactory getWrapped should return wrapped application factory
+ * [OWB-505] - OwbApplicationFactory should not be installed by default
+ * [OWB-509] - Unwrap InvocationTargetException in ResourceProxyHandler.invokie
+ * [OWB-510] - return null instead of an unusable proxy if a resource is missing
+ * [OWB-511] - Delegate actualInstance serialization behavior in ResourceProxyHandler
+ * [OWB-514] - Leak in ELContextStore
+ * [OWB-519] - broken wls support
+ * [OWB-521] - ProducerMethodBean could theoretically produce a NPE
+ * [OWB-522] - Missing updateTimeout in one of begin methods for conversation
+ * [OWB-523] - @SessionScoped bean failover does not work
+ * [OWB-524] - OWB classpath scanning of non-jars doesn't work if the classpath contains spaces
+ * [OWB-527] - JspFactory.getDefaultFactory() is synchronized, We can cache the return value to improve performance
+ * [OWB-529] - lazy initialized class members should be volatile
+ * [OWB-530] - multi massive execution of our Interceptor test unveils a concurrency problem
+ * [OWB-531] - cleanup WebBeansELResolver#getValue
+ * [OWB-533] - concurrency bottleneck due to use of our logger
+ * [OWB-534] - Injection of @PersistenceContext does not work with abstract/base classes
+ * [OWB-541] - replace WeakHashMap with a standard one in InterceptorHandler
+ * [OWB-542] - Disposer is called twice on Dependent beans when injected into a managed object that is called from a JSP
+ * [OWB-543] - get rid of checked Exceptions in our SPI
+ * [OWB-545] - Cleanup our SecurityManager integration
+ * [OWB-546] - @Typed gets ignored if we use a AnnotatedType from an Extension @Observing ProcessAnnotatedType
+ * [OWB-547] - WebContextsService throws NPE on asynchronous app startup
+ * [OWB-548] - missing null check in DefaultContextsService#stopApplicationContext
+ * [OWB-550] - duplicated observer methods in case of @Specializes
+
+Improvement
+
+ * [OWB-209] - remove all <repositories> from our poms
+ * [OWB-254] - suppress initialising contextual handling for configurable URIs.
+ * [OWB-335] - implement a sample for @ViewScoped in reservation
+ * [OWB-393] - remove old XML configuration code
+ * [OWB-448] - More changes for decorator and interceptor passivation support
+ * [OWB-461] - source code quality
+ * [OWB-472] - archive centric beans.xml enabling
+ * [OWB-478] - make OWB build maven-3 aware
+ * [OWB-485] - AmbiguousResolutionException doesn't print details about the injection point
+ * [OWB-500] - improved app-server support
+ * [OWB-503] - Reduce static synchronized hashmap usage
+ * [OWB-506] - Upgrade our samples to Apache MyFaces-2.0.3 and OpenJPA-2.0.1
+ * [OWB-507] - our samples should be prepared for EE as default
+ * [OWB-508] - Dependent scope proxies are needed to wrap the build-in beans returned from the services if they are not serializable yet
+ * [OWB-516] - Get TCK standalone 1.0.4 CR2
+ * [OWB-517] - Conversation Log Improvement
+ * [OWB-518] - log all bean-archive markers
+ * [OWB-520] - spi for the webbeans-jee5-ejb-resource plugin
+ * [OWB-525] - create a findbugs filter file in our build-tools resource
+ * [OWB-526] - remove usage of java.net.URLs from ScannerService and drop scannotation
+ * [OWB-535] - free ScannerService resources once we don't need it anymore
+ * [OWB-536] - revisit our Logger usage in our Bean impls
+ * [OWB-537] - clear() AnnotatedElementFactory after the deployment
+ * [OWB-539] - fill AnnotatedTypeImpl lazily
+ * [OWB-540] - StandaloneResourceInjectionService should cache info about classes which don't contain EE resource injection points
+ * [OWB-544] - improve BeanManager#getContext performance
+
+New Feature
+
+ * [OWB-433] - add a configuration flag for switching to a lenient lifecycle interceptor checking
+ * [OWB-501] - owb ee 5 resource integration
+ * [OWB-528] - Use ApplicationWrapper as parent of OwbApplication in JSF 2 plugin
+ * [OWB-532] - create a new BeanManager#isInUse()
+ * [OWB-538] - lazy loading of not explicitly marked (via annotation or registered by extension) Dependent beans
+
+Question
+
+ * [OWB-383] - static fields in CreationalContext
+
+TCK Challenge
+
+ * [OWB-484] - Running TCK 1.0.1 Final and Respective Corrections
+
+Task
+
+ * [OWB-19] - Geronimo Integration
+ * [OWB-428] - implementation of equals and hashCode for AbstractOwbBean
+ * [OWB-453] - add a flag to disable context activation in EJB interceptor
+
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0
+-------------------------------------------
+
+Bug
+
+ * [OWB-318] - multiple methods with same EJB @interceptors(foo.class) in same bean class get multiple interceptor instances
+ * [OWB-384] - OWB needs to call 299-defined PrePassivate, PostActivate, and AroundTimeout interceptors for EJBs
+ * [OWB-422] - Support needed for PrePassivate, PostActivate, and AroundTimeout via EJBInterceptor.
+ * [OWB-429] - OpenWebBeansEjbPlugin Class Hierarchy
+ * [OWB-438] - Cached Normal Scoped Proxy instances
+ * [OWB-439] - EjbPlugin session bean proxy creation thread safe problem
+ * [OWB-445] - we must not use javassist ProxyFactory#setHandler(MethodHandler)
+ * [OWB-446] - EJB lifecycle callbacks not stacked correctly
+ * [OWB-450] - NullPointerException in DependentScopedBeanInterceptorHandler when it has a NullCreationalContext (normally from a EE component).
+ * [OWB-454] - ClassUtil.callInstanceMethod() doesn't propogate original exception
+ * [OWB-455] - IllegalArgument method calling remove method of EJB during destroy
+ * [OWB-456] - When multiple interceptors are defined for a bean OWB does NOT correctly remove the overriden base Interceptors
+ * [OWB-457] - we must not create a SessionContext for static resource reqeusts
+ * [OWB-460] - fix owb-openejb and owb-ejb artifactIds
+ * [OWB-464] - InjectionPointImpl using wrong class loader during serialize/deserialize, dropping qualifiers, and omiting qualifier values.
+ * [OWB-466] - Ensure removal of all ThreadLocal values
+
+Improvement
+
+ * [OWB-177] - Handling of InterceptionType#POST_ACTIVATE, PRE_PASSIVATE and AROUND_TIMEOUT is missing
+ * [OWB-407] - detailed information about exceptions
+ * [OWB-451] - Allow InterceptorUtil#callAroundInvokes to propogate a callers 'creational context key'
+ * [OWB-459] - upgrade to newer library versions
+ * [OWB-463] - EjbDefinitionUtility.defineEjbBeanProxy() should be able to create proxies for no-interface local beans
+ * [OWB-465] - enhance EJB common code for crude @LocalBean support
+
+TCK Challenge
+
+ * [OWB-394] - Any idea why our BeforeBeanDiscovery.addInterceptorBinding() has different signature?
+
+Task
+
+ * [OWB-453] - add a flag to disable context activation in EJB interceptor
+ * [OWB-462] - Refactor AnnotationUtil.hasAnnotationMember()
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0-alpha-2
+-------------------------------------------
+Bug
+
+ * [OWB-303] - upgrade Javassist to a newer version
+ * [OWB-338] - our internal SessionContext and ConversationContext must support Session serialization
+ * [OWB-385] - implement passivation of managed beans in ServletContextListener
+ * [OWB-401] - ELContextStore not cleaned up for some JSP EL lookups
+ * [OWB-402] - OpenWebBeansJsfPlugin does not recognize @ManagedBean
+ * [OWB-404] - Contexts must not get stored in a static Map in BeanManager
+ * [OWB-405] - AnnotatedElementFactory must not use static cache maps
+ * [OWB-408] - NPE in WebBeansELResolver
+ * [OWB-415] - EjbBeanProxyHandler for dependent ejb must save ejb instance
+ * [OWB-416] - BaseEJBBean.destroyComponentInstance() tries to call multiple remove methods
+ * [OWB-418] - EjbBeanProxyHandler must be 1:1 with proxy instances for dependent SFSB
+ * [OWB-419] - fix @Dependent handling in ELResolver
+ * [OWB-420] - SingletonContext is mapped to @ConversationScoped
+ * [OWB-421] - defined-in-class EJB lifecycle callbacks masked by our Interceptor
+ * [OWB-426] - Tweak EJBPlugin to work with Standalone Tests
+ * [OWB-431] - Generic Type Inheritance not resolved correctly
+ * [OWB-434] - ThreadLocal<SingletonContext> doen't get cleaned up
+ * [OWB-436] - AbstractContext bean instance creation is not thread safe
+ * [OWB-437] - Improve AbstractContext synchronization
+ * [OWB-440] - WebBeansDecoratorConfig.getDecoratorStack always returns new Decorators
+ * [OWB-442] - our EJB proxies are broken when multiple local interfaces are used on a single class
+ * [OWB-443] - Normal-scoped EJB not removed by container during Contextual.destroy()
+
+Improvement
+
+ * [OWB-57] - cleanup problems found by maven-findbugs-plugin
+ * [OWB-195] - Give warning to the developer related with non- portable operations
+ * [OWB-409] - create a name for OWB our faces-config.xml
+ * [OWB-410] - lazy initialisation of ejbInterceptors
+ * [OWB-411] - cache calls to isNormalScope()
+ * [OWB-412] - Allow container specific extensions to WebConfigurationListener access to the lifecycle
+ * [OWB-413] - cache calls to ClassUtils#getObjectMethodNames()
+ * [OWB-414] - improve Interceptor performance
+ * [OWB-425] - improve performance of owb-el-resolver
+ * [OWB-427] - improve read-performance of AbstractOwbBean
+ * [OWB-430] - improve performance of WebBeansPhaseListener
+ * [OWB-432] - Create Singleton Service SPI
+ * [OWB-441] - new configuration properties mechanism
+
+Sub-task
+
+ * [OWB-193] - If an interceptor or decorator has any scope other than @Dependent, non-portable behavior results.
+ * [OWB-194] - If an interceptor or decorator has a name, non-portable behavior results.
+ * [OWB-196] - If an interceptor or decorator is an alternative, non-portable behavior results.
+ * [OWB-197] - If a stereotype declares any other qualifier an- notation, non-portable behavior results.
+ * [OWB-198] - If a stereotype is annotated @Typed, non-portable behavior results.
+
+
+TCK Challenge
+
+ * [OWB-424] - Adding Document for How to Configure and Run TCK (standalone and web profile TCKs)
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0-alpha-1
+-------------------------------------------
+Bug
+
+ * [OWB-216] - Update pom.xml svn links
+ * [OWB-231] - exception using abstract decorators
+ * [OWB-245] - Using parameterized type varaibles fails for Producer Method injection
+ * [OWB-259] - Implement spec 11.5.5. ProcessModule event
+ * [OWB-289] - Owb return 2 beans for Indirect specialized producer beans
+ * [OWB-302] - InjectionPoint injections (both method and field based) in Decorators result in null
+ * [OWB-312] - Add dopriv's to allow OWB to function with java 2 security enabled
+ * [OWB-317] - creationalContext in InvocationContextImpl is always null
+ * [OWB-318] - multiple methods with same EJB @interceptors(foo.class) in same bean class get multiple interceptor instances
+ * [OWB-327] - annotating an Interceptor with @ApplictionScoped leads to OutOfMemory
+ * [OWB-329] - Interceptor instances get created each time the interceptor gets called
+ * [OWB-332] - Destroy Depdent Of Producer Method Beans when Invocation Completes
+ * [OWB-333] - InjectionTarget and Producer Handling
+ * [OWB-334] - cid is missing when using redirect for a jsf 2.0 application
+ * [OWB-336] - injected BeanManager must be Serializable
+ * [OWB-337] - events must not get broadcasted to beans which have no active Context
+ * [OWB-339] - Injecting Non-Contextual Beans Causes NPE in WebBeansUtil
+ * [OWB-340] - BeanManagerImpl.createInjectionTarget() Throws Exception When No Constructor Found
+ * [OWB-341] - CreationalContext#incompleteInstance should get cleaned after create()
+ * [OWB-342] - InterceptorHandler crashes with NullPointerException after deserialisation
+ * [OWB-343] - upgrade JPA spec from 1.0-PFD2 to 1.0 final revision
+ * [OWB-345] - Remove duplicate dependencies
+ * [OWB-351] - OWB picks up @SessionScoped contextual instances from expired sessions
+ * [OWB-352] - Thread Safety Problem in our InterceptorHandlers, aka proxies
+ * [OWB-353] - NPE in removeDependents@CreationalContextImpl
+ * [OWB-354] - WebContextService may throw NPE in tiered classloading environmemt
+ * [OWB-357] - WebbeansFinder should index first on ClassLoader, not singleton type
+ * [OWB-359] - ownerCreationalContext sometimes causes NPE in InterceptorDataImpl.createNewInstance()
+ * [OWB-361] - underlying EJB method not actually in our interceptors stack
+ * [OWB-362] - InvocationTargetException when invoking Stateless SessionBean
+ * [OWB-363] - Intermittent bug with ApplicationScope disposers not being called
+ * [OWB-366] - ContextNotActiveException fired from AppScope/NormalScopedBeanInterceptorHandler when a proxied object finalized
+ * [OWB-368] - The 299 spec (that I have) uses receive=IF_EXISTS but OWB uses notifyObserver=IF_EXISTS.
+ * [OWB-369] - Static ContextsService in ContextFactory causes wrong webContextService used for multiple applications
+ * [OWB-370] - Intransient Conversation context get rdestroyed randomly by destroyWithRespectToTimout
+ * [OWB-371] - no lifecycle interceptors for non-contextual EJB
+ * [OWB-372] - creational context not cleaned up for non-contextual EJB interceptions
+ * [OWB-373] - build crashes with missing artifact error
+ * [OWB-374] - migrate jsf2sample from sun to MyFaces
+ * [OWB-376] - [patch] Guess example broken with Jetty plugin 6.x due to EL 2.2
+ * [OWB-377] - revise logging
+ * [OWB-378] - ejb at bottom of decorator stack doesn't handle changed method
+ * [OWB-380] - NormalScopedBeanInterceptorHandler throws NPE when handling 3rd party Contexts
+ * [OWB-381] - NPE thrown from AbstractInjectable if dependent producer returns null
+ * [OWB-382] - injecting a @Dependent bean into a passivatation scoped bean causes a NonSerializableException
+ * [OWB-387] - DependentContext Interceptor Double Call for PostConstruct
+ * [OWB-390] - fix broken links in our 'site'
+ * [OWB-396] - fix poms to work with maven 3
+ * [OWB-398] - DelegateHandler cached too agressively
+ * [OWB-399] - Proxy objects could not be correctly deserialized by using javassist 3.11. we need to update to 3.12
+ * [OWB-400] - starting OWB as part of an EAR in geronimo causes a exception due to missing 'bundle' protocol
+
+Improvement
+
+ * [OWB-116] - Update Business Method Definition
+ * [OWB-118] - Supports Decorators for Other Delegate Injections
+ * [OWB-136] - fix 'broken' license headers in our java files
+ * [OWB-170] - Address findbug issues in webbeans-impl
+ * [OWB-183] - Improve webbeans-doc module to get a documentation more user friendly
+ * [OWB-214] - get rid of javax.transaction.Transaction dependency in webbeans-impl
+ * [OWB-237] - NoSuchElementException when WebBeansConfigurationListener is absent
+ * [OWB-275] - remove unused imports and cleanup code
+ * [OWB-286] - java.lang.NoClassDefFoundError: javax/validation/Validator
+ * [OWB-313] - create caching strategies for resolving Bean<T> for BeanManager and EL invocations
+ * [OWB-314] - cache resolved instances in NormalScopedBeanMethodHandlers of @ApplicationScoped beans
+ * [OWB-315] - cache resolved instances in NormalScopedBeanMethodHandlers of @SessionScoped beans
+ * [OWB-319] - Strange logging when writing non-Serializable SessionScoped bean
+ * [OWB-320] - Remove Java EE Dependencies from WebBeans Core
+ * [OWB-322] - Create new EJB project and separate common EJB classes from OpenEJB plugin
+ * [OWB-325] - Relocate SPI Classes to SPI Module. Change JSR299, JSR330 as optional pom dependency.
+ * [OWB-326] - improve producer tests
+ * [OWB-328] - improve logger performance
+ * [OWB-330] - reduce BeanManagerImpl#getManager() calls inside the same functions
+ * [OWB-331] - Cache Interceptor & Decorator Stack oon Interceptor Handler
+ * [OWB-346] - Make EJB samples running
+ * [OWB-347] - Using InjectableBeanManager in TCK
+ * [OWB-349] - ignore exception during type hierarchy scan
+ * [OWB-350] - Support Interceptor for non-contextual EJBs
+ * [OWB-355] - OpenEjbBean should look for @Remove methods
+ * [OWB-356] - EjbPlugin only looks for DeployementInfo once, so new deployed application won't be discovered
+ * [OWB-358] - provide property to skip injection in @PostConstruct of OpenWebBeansEjbInterceptor
+ * [OWB-360] - Add BeanManager to a ServletContext attribute
+ * [OWB-364] - Reduce the amount of info level logging
+ * [OWB-365] - make injection optional in OWBEJBInterceptor
+ * [OWB-375] - Performance: OWB logging performs operations when logging disabled.
+ * [OWB-379] - upgrade to final atinject-spec artifact
+ * [OWB-386] - upgarde CDI TCK to 1.0.2.CR1
+ * [OWB-389] - atinject-tck upgrade to final 1.0 release
+ * [OWB-397] - Add helper method and some debug to WebBeansFinder
+
+New Feature
+
+ * [OWB-316] - Implement a generic TestContainer for CDI implementations
+ * [OWB-323] - Provide methods to pass classloader into ServiceLoader and WebBeansFinder for use in tiered classloader situations
+ * [OWB-324] - Add Tomcat Plugin
+ * [OWB-348] - Adding Interceptor and Decorator Support for EJB Beans
+ * [OWB-395] - OpenWebBeans Tomcat 7 Support
+
+TCK Challenge
+
+ * [OWB-388] - Pass TCK 1.0.2 CR1 Web Profile
+
+Task
+
+ * [OWB-6] - Scope passivation
+ * [OWB-14] - Update WebBeans Lifecycle for Servlet Beans
+ * [OWB-46] - Injection into non-contextual objects
+ * [OWB-204] - Update Samples for JSF2 Usage
+ * [OWB-220] - Update site.xml links and bread crumbs to point to non-incubator.
+ * [OWB-310] - Drop dom4j and use jre builtin xml parsers for processing beans.xml
+ * [OWB-391] - create a owb-build-tools project to maintain project specific checkstyle rules, etc.
+
+Test
+
+ * [OWB-56] - Integrate the official JSR-299 TCK test suite
+ * [OWB-222] - Update website download link, and fix relative URL translation
+ * [OWB-367] - Add a unit test for IF_EXISTS
+
+
+----------------------------------------------
+Required Platform
+----------------------------------------------
+Java Version : Java SE >= 5.0
+Java EE Must : Java EE >= 5.0
+
+---------------------------------------------
+How to Configure OpenWebBeans
+---------------------------------------------
+
+This section explains a content of the distribution bundle, OWB plugins and its
+dependent libraries.
+
+---------------------------------------------
+1.1.3 Distribution Content
+---------------------------------------------
+There are several jars in the OpenWebBeans 1.0.0 distribution;
+
+ - openwebbeans-impl-1.1.3.jar --> Includes Core Dependency Injection Service.
+ - openwebbeans-ejb-1.1.3.jar --> EJB Plugin(Supports EJBs in OpenEJB embedded in Tomcat).
+ - openwebbeans-openejb-1.1.3.jar --> OpenEJB specific Plugin SPI implementations as extension to openwebbeans-ejb
+ - openwebbeans-jms-1.1.3.jar --> JMS Plugin(Supports injection of JMS related artifacts,i.e, ConnectionFactory, Session, Connection etc.)
+ - openwebbeans-jsf-1.1.3.jar --> JSF-2.0 Plugin(JSF Conversation Scoped Support).
+ - openwebbeans-jsf12-1.1.3.jar --> JSF-1.2 Plugin(JSF Conversation Scoped Support).
+ - openwebbeans-resource-1.1.3.jar --> Java EE Resource Injection for Web Projects (Includes @PersistenceContext,@PersistenceUnit
+ and @Resource injection into the Managed Beans. @Resource injections use java:/comp/env of the
+ Web application component. @PersistenceContext is based on extended EntityManager.
+ - openwebbeans-spi-1.1.3.jar --> OpenWebBeans Server Provider Interfaces. They are implemented by runtime environments that would
+ like to use OpenWebBeans as a JSR-299 implementation.
+ - samples --> Includes source code of the samples. Samples are mavenized project therefore you can easily build and run
+ them from your environment that has maven runtime.
+ - openwebbeans-osgi-1.1.3.jar --> ClassPath ScannerService SPI implementation for OSGI environments like Apache Geronimo-3
+ - openwebbeans-web-1.1.3.jar --> Basic Servlet integration
+ - openwebbeans-tomcat6-1.1.3.jar --> Support for deeper integration into Apache Tomcat-6
+ - openwebbeans-tomcat7-1.1.3.jar --> Support for deeper integration into Apache Tomcat-7
+
+
+
+
+------------------------------------------
+How OWB Plugins Work
+------------------------------------------
+
+OpenWebBeans has been developed with a plugin architecture. The Core dependency injection service
+is provided with openwebbeans-impl. If you need further service functionality,
+you have to add respective plugin jars into the application classpath. OpenWebBeans
+uses the Java SE 6.0 java.util.ServiceLoader mechanism to pickup plugins at runtime.
+If you run under Java SE 5.0, an similar hand written implementation will be used.
+Please do not confuse OWB plugins with portable Extensions! OWB plugins are for
+internal use only whereas portable CDI Extensions will run on any JSR-299 container.
+
+Current Plugins:
+---------------------
+Look at "1.1.3 Distribution Content" above.
+
+------------------------------------------
+Dependent Libraries
+------------------------------------------
+
+Third Party jars:
+-----------------
+They are necessary at runtime in the Core Implementation.
+
+javassist : Version 3.12.0.GA
+scannotation : Version 1.0.2 (if not running in an OSGi environment like Apache Geronimo-3)
+
+Java EE APIs jars(Container Provider Libraries) :
+-------------------------------------------------
+Generally full Java EE servers provides these jars. But web containers like Tomcat or Jetty
+do not contain some of them, such as JPA, JSF, Validation API etc. So, if you do not want to bundle
+these libraries within your application classpath, you have to include these libraries in your
+server common classpath.
+
+jcdi-api (JSR-299 Specification API)
+atinject-api (JSR-330 Specification API)
+servlet-2.5 or servlet 3.0 (Servlet Specification API)
+ejb-3.1 (EJB Specification API)
+el-2.2 (Expression Langauge Specification API)
+jsf-2.0 (Java Server Faces API)
+jsr-250 (Annotation API)
+interceptor-1.1 (Interceptor API)
+jta-1.1 (Java Transaction API)
+jsp.2.1 or jsp-2.2 (Java Server Pages API)
+jpa-2.0 (Java Persistence API)
+jaxws-2.1 or jaxws-2.2 (Java Web Service API)
+jms-1.1 or jms-1.2 (Java Messaging Service API)
+validation (Validation Specification)
+
+Dependencies of OpenWebBeans Maven Modules&Plugins
+--------------------------------------------------
+
+openwebbeans-impl :
+------------------
+Third party : javassist, scannotation, openwebbeans-spi
+Container Provided : jcdi-api, at-inject, servlet, el, jsr-250, interceptor, jta, jsp, validation
+
+openwebbeans-ejb:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : OpenWebBeans EJB plugin is based on OpenEJB in Tomcat. Therefore, if you install OpenEJB
+ within Tomcat correctly, there is no need to add any additional libraries. Look at the
+ OpenEJB in Tomcat configuration section.
+
+openwebbeans-jms:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : jms
+
+openwebbeans-jsf:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : jsf
+
+NOTE : We are trying to decrease dependent libraries of the our core, i.e, openwebbeans-impl.
+At 1.1.3, dependent third party libraries will be decreased. We have a plan to create profile
+plugins, therefore each profile plugin provides its own dependent libraries. For example, in
+fully Java EE Profile Plugin, Transaction API is supported but this will not be the case
+for Java Web Profile Plugin or Java SE Profile Plugin. Stay Tuned!
+
+Currently, as you have seen above, openwebbeans-impl depends on some Java EE/Runtime
+provided libraries (servlet, jsp, el etc). In the future, with OpenWebBeans profiling support,
+openwebbeans-impl will not depend on any Java EE APIs. Those APIs will be provided
+by OpenWebBeans profiles/plugins that openwebbeans-impl will be used. Therefore,
+you will able to use OpenWebBeans in your own runtime environment easily by writing
+your own plugins and contributing it to OpenWebBeans :)
+
+------------------------------------------
+Library Configuration
+------------------------------------------
+To run openwebbeans applications in the Java EE based application server,
+you could add the JSR-299 API and JSR-330 API into the server common classpath, and
+implementation, plugins and dependent jars into your "WEB-INF/lib" directory
+of the Java EE Web Application.
+
+In this release, we can not support the OpenWebBeans as an integrated
+functionality of the Java EE Application Servers. So, you have to manage the
+configuration of the OpenWebBeans within your application's "web.xml" file. A sample "web.xml"
+file can be found in the "config" directory. To use EJB functionality, you also have to
+add OWB specific interceptor into your EJB beans. Look at the EJB section of this readme
+for further details.
+
+---------------------------------------------
+OpenWebBeans Properties File
+---------------------------------------------
+OpenWebBeans uses a default configuration file to configure some of its
+properties. Default configuration files are embedded into OWB implementation
+jar files. Instead of opening the jars file and changing configuration properties, simply add
+an "openwebbeans.properties" file into a "META-INF/openwebbeans" folder of your application
+classpath. This will override the values from the default configuration.
+You can specify a property 'configuraion.ordinal' in this file to define the overlay order.
+A properties file with higher 'configuration.ordinal' value will applied later and thus
+have a higher precedence. If you don't specify a 'configuration.ordinal' a value of 100 is assumed;
+This allows to have multiple openwebbeans.properties files e.g. a common one in an EAR lib
+(with configuration.ordinal=100) and more specific ones for each WebApp in your EAR (with a
+configuration.ordinal of e.g. 101).
+
+Each plugin developer can provide their own SPI implementation class and own configuration values. If you would like
+to use those implementation classes or configuration values, you have to override the default configuration file as explained
+in the above paragraph, i.e, putting "openwebbeans.properties" file into "META-INF/openwebbeans" folder of your application.
+It is recommended to use a 'configuration.ordinal' between 50 and 99 for custom SPI implementations.
+
+Below are OpenWebBeans' default configuration properties from our openwebbeans-impl.jar file and our plugins such as
+our OpenEJB plugin.
+
+Override default value of ResourceInjectionService
+-------------------------------------------------
+org.apache.webbeans.spi.ResourceInjectionService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService
+
+OpenWebBeans uses the "OpenEjbResourceInjectionService" class to inject resources into the managed bean instances.
+
+Configuration Names and Their Default Values :
+
+- "org.apache.webbeans.spi.ContainerLifecycle"
+ Description : Implementation of org.apache.webbeans.spi.ContainerLifecycle. All magic starts from here.
+ Values : org.apache.webbeans.lifecycle.DefaultLifecycle, OR CUSTOM
+ Default : org.apache.webbeans.lifecycle.DefaultLifecycle
+
+- "org.apache.webbeans.spi.JNDIService"
+ Description : Configures JNDI provider implementation.
+ Values : org.apache.webbeans.spi.se.DefaultJndiService OR CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultJndiService
+
+- "org.apache.webbeans.spi.conversation.ConversationService"
+ Description : Implementation of conversation.
+ Values : org.apache.webbeans.spi.conversation.jsf.DefaultConversationService OR CUSTOM
+ Default : org.apache.webbeans.spi.conversation.jsf.DefaultConversationService
+
+- "org.apache.webbeans.spi.ScannerService"
+ Description : Default implementation of org.apache.webbeans.spi.ScannerService. It is used for scanning application deployment
+ for finding bean classes and configuration files.
+ Values : org.apache.webbeans.spi.ee.deployer.DefaultScannerService OR CUSTOM
+ Default : org.apache.webbeans.spi.ee.deployer.DefaultScannerService
+
+- "org.apache.webbeans.spi.SecurityService"
+ Description : Implementation of org.apache.webbeans.spi.SecurityService. It is used for getting current "Principal".
+ Values : org.apache.webbeans.spi.se.DefaultSecurityService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultSecurityService
+
+- "org.apache.webbeans.spi.ValidatorService"
+ Description : Implementation of org.apache.webbeans.spi.ValidatorService. It is used for getting "ValidatorFactory" and "Validator".
+ Values : org.apache.webbeans.spi.se.DefaultValidatorService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultValidatorService
+
+- "org.apache.webbeans.spi.TransactionService"
+ Description : Implementation of org.apache.webbeans.spi.TransactionService. It is used for getting "TransactionManager" and "Transaction".
+ Values : org.apache.webbeans.spi.se.DefaultTransactionService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultTransactionService
+
+- "org.apache.webbeans.spi.ResourceInjectionService"
+ Description : Implementation of org.apache.webbeans.spi.ResourceInjectionService. It is used for injection Java EE enviroment resource into the
+ Managed Bean instances.
+ Values : org.apache.webbeans.se.DefaultResourceInjectionService or CUSTOM
+ Default : org.apache.webbeans.se.DefaultResourceInjectionService
+
+- "org.apache.webbeans.spi.JNDIService.jmsConnectionFactoryJndi"
+ Description : Configures JMS ConnectionFactory object jndi name
+ Values : Server specific JNDI name
+ Default : ConnectionFactory
+
+- "org.apache.webbeans.conversation.Conversation.periodicDelay"
+ Description : Conversation removing thread periodic delay
+ Values : Configured in millisecond
+ Default : 150000 ms
+
+- "org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService"
+ Description : Use EJB functionality or not. If use OpenEJB configures to true
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.spi.FailOverService"
+ Description : Implementation of the org.apache.webbeans.spi.FailOverService. It is used for enabling passivation/failover beans.
+ Values : org.apache.webbeans.web.failover.DefaultOwbFailOverService or CUSTOM
+ Default : org.apache.webbeans.web.failover.DefaultOwbFailOverService
+
+- "org.apache.webbeans.web.failover.issupportfailover"
+ Description : Support failover of beans or not
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.web.failover.issupportpassivation"
+ Description : Support passivation of beans or not
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.forceNoCheckedExceptions"
+ Description : The interceptors spec defines that @PostConstruct & Co must not throw checked Exceptions. Setting this configuration to 'false' disables this check.
+ Values : false, true
+ Default : true
+
+- "org.apache.webbeans.spi.SecurityService"
+ Description : Service to provide methods which must be guarded via doPrivileged blocks.
+ Values : org.apache.webbeans.corespi.security.SimpleSercurityService or org.apache.webbeans.corespi.security.ManagedSecurityService
+ Default : org.apache.webbeans.corespi.security.SimpleSercurityService
+
+
+---------------------------------------------
+EJB Support via Embeddable OpenEJB Container in Tomcat 6.X
+---------------------------------------------
+
+Configuration Steps:
+--------------------------------------------
+1* Download Tomcat 6.X version
+2* Configure OpenEJB. Look at URL http://openejb.apache.org/tomcat.html for installation.
+3* Copy JSR-330 API to Tomcat /lib folder.
+4* Copy JSR-299 API to Tomcat /lib folder
+5* Put all dependent libraries of the OpenWebBeans OpenEJB Plugin
+ - openwebbeans-ejb
+ - openwebbeans-impl and its dependencies
+
+You could look at ejb-sample.war for "WEB-INF/lib" libraries as an example to develop custom applications.
+The source of this project is also available.
+
+To use EJB functionality, you will use OpenEJB collapse-ear support. In this configuration,
+your EJB beans live within your "war" bundle.
+
+How to Develop EJB Applications
+---------------------------------------------
+1* Add "META-INF/openwebbeans.properties" into your application classpath.
+2* Add "org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService=true" to use EJB functionality.
+ So OWB container looks for EJBs.
+3* Add "org.apache.webbeans.resource.spi.ResourceService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService to
+use OpenEJB Resource injections.
+4* Add "openwebbeans-ejb", plugin into your web application classpath.
+5* If you want to use other plugins, add respective plugins into your application classpath. For example, if you wish to use
+JSF framework, you add "openwebbeans-jsf" plugin.
+6* Add OWB related interceptor into your EJB Beans. This is called "org.apache.webbeans.ejb.interceptor.OpenWebBeansEjbInterceptor"
+This is needed for OWB injections.
+7* Update your application's "web.xml" to add OWB specific configuration.
+
+---------------------------------------------
+How to Run Samples
+---------------------------------------------
+
+In this release, there are several sample applications located in the "/samples" directory
+of the distribution. You can run those samples via simple maven command.
+
+1) "Guess Application" : Simple usage of the OWB + JSF.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+2) "Hotel Reservation Application" : Show usage of JSF + JPA + OWB
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+3) "EJB Sample Application" : Shows the usage of EJBs with embeddable OpenEJB in Tomcat. Firstly
+configure OpenEJB with Tomcat as explained above.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+4) "EJB Telephone Application" : Shows the usage of OpenEJB resource injection service.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+5) "JMS Injection Sample" : Show JMS injections. JMS injection currently uses
+ ConnectionFactory as JMS connection factory jndi name. You can change this
+ via configuration file. Look above explanation for how to configure JMS jndi. Also,
+ JMS injection requires to use of a JMS provider. Generally Java EE servers contains
+ default JMS provider. It can be run on JBoss and Geronimo. It uses Queue with jndi_name = "queue/A".
+ So you have to create a queue destination in your JMS provider with name "queue/A" to run example.
+ If you want to change queue jndi name, then look at source and change it from "WEB-INF/beans.xml" file.
+
+6) "Conversation Sample" : Shows usage of JSF conversations.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+7) "JSF2 Sample" : Shows usage of JSF2 Ajax.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section. It requires
+to use JSF2 runtime.
+
+
+8) "Standalone Sample" : Shows usage of OpenWebBeans in Standalone Swing Application.
+Look at "OpenWebBeans in Java SE" section.
+
+Configuring and Running the Applications:
+--------------------------------------------
+See section Compile and Run Samples via Jetty&Tomcat Plugin.
+
+--------------------------------------------
+Maven Install and Package From the Source
+--------------------------------------------
+
+Maven Version : Apache Maven 2.2.1 or later
+
+First you have to download the "source" version of the OpenWebBeans project that
+contains the all source code of the OpenWebBeans.
+
+To install the Maven artifacts of the project from the source, Maven must be installed
+in your runtime. After Maven installation, just run the following command in the top level
+directory that contains the main "pom.xml" :
+
+> mvn clean install
+
+This command will install all the Maven artifacts into your local Maven repository.
+
+If you wish to package all artifacts of the project, just run the following command
+in in the top level directory that contains the main "pom.xml" :
+
+> mvn clean package
+
+This command will package the project artifacts from the source and put these artifacts into the each modules
+respective "target" directory.
+
+-------------------------------------------
+Compile and Run Samples via Tomcat&Jetty Plugin
+-------------------------------------------
+This section shows how to run samples in Jetty or OpenEJB Embedded Tomcat.
+
+------------------------------------------
+Samples Run within Jetty Plugin
+------------------------------------------
+You can compile and run "guess","jsf2","conversation-sample" and "reservation "samples via maven Jetty plugin.
+Go to the source bundle "samples/" directory. In the "guess/" or "reservation/" directory, run
+the following maven commands. It will start up maven Jetty container. It bundles all of the
+required jars into the WEB-INF/lib folder. You are not required to add any jar to the classpath.
+
+Samples : Guess and Reservation
+------------------------------
+Go to the source folder of projects and run
+
+> mvn clean install -Pjetty
+> mvn jetty:run -Pjetty
+
+Guess URL : http://localhost:8080/guess
+Reservation URL : http://localhost:8080/reservation
+
+Samples : Conversation Sample and JSF2
+-------------------------------------
+Go to the source folder of projects and run
+
+>mvn clean install
+>mvn jetty:run
+
+Conversation Sample URL : http://localhost:8080/conversation-sample
+JSF2 Sample URL : http://localhost:8080/jsf2sample
+
+------------------------------------------
+Samples Run within Tomcat Plugin
+------------------------------------------
+OpenEJB samples are run with Maven Tomcat Plugin.
+
+Tomcat Plugin uses http://localhost:8080/manager application to deploy war file
+into your embeddable EJB Tomcat container. There must be an tomcat-users.xml
+file in the "conf" directory of the server that contains manager role and username.
+
+>Start Tomcat server if not started
+>mvn tomcat:deploy
+
+Ejb Sample URL : http://localhost:8080/ejb-sample
+Ejb Telephone URL : http://localhost:8080/ejb-telephone
+
+Example tomcat-users.xml file
+------------------------------------------
+<tomcat-users>
+<role rolename="manager"/>
+<user username="admin" password="" roles="manager"/>
+</tomcat-users>
+
+-----------------------------------------
+Deploy JMS Sample
+-----------------------------------------
+Simple drops jms-sample.war file into your application deploy location.
+
+JMS Sample Example URL : Hit the url http://localhost:8080/jms-sample/sender.jsf for sending JMS messages
+ Hit the url http://localhost:8080/jms-sample/receiver.jsf for receiving JMS messages
+
+-----------------------------------------
+OpenWebBeans in Java SE
+----------------------------------------
+OpenWebBeans can be used in Java SE environments such as Java Swing
+applications. A Standalone Sample is provided to show how to use OpenWebBeans
+in Java SE.
+
+Go to the source directory of the standalone sample:
+>mvn clean package;
+>cd target;
+>jar -xvf standalone-sample.jar
+>java -jar standalone-sample-1.1.3-SNAPSHOT.jar
+>Enjoy :)
+
+-----------------------------------------------
+OpenWebBeans User and Development Mailing Lists
+-----------------------------------------------
+Please mail to the user mailing list with any questions or advice
+about the OpenWebBeans.
+
+User Mailing List : [users@openwebbeans.apache.org]
+
+You can also join the discussions happening in the dev list
+
+Dev Mailing List : [dev@openwebbeans.apache.org]
+
+-------------------------------------------
+OpenWebBeans JIRA Page
+-------------------------------------------
+Please logs bugs into the "https://issues.apache.org/jira/browse/OWB".
+
+------------------------------------------
+OpenWebBeans Wiki and Blog Page
+-----------------------------------------
+Wiki: http://cwiki.apache.org/OWB/
+Introduction to OpenWebBeans : http://cwiki.apache.org/OWB/introduction-to-openwebbeans.html
+Blog : http://blogs.apache.org/owb
+
+-----------------------------------------
+OpenWebBeans Web Page
+----------------------------------------
+You can reach the OpenWebBeans web page at
+http://openwebbeans.apache.org
+---------------------------------------
+
+Your OpenWebBeans Team
+
+Enjoy!
diff --git a/owb_1.2.x/readme/README_1_1_4.txt b/owb_1.2.x/readme/README_1_1_4.txt
new file mode 100644
index 0000000..d09db0b
--- /dev/null
+++ b/owb_1.2.x/readme/README_1_1_4.txt
@@ -0,0 +1,1034 @@
+-------------------------------
+Apache OpenWebBeans 1.1.4
+-------------------------------
+Welcome!
+Thanks for downloading and using OpenWebBeans.
+This document is a "Getting Started Guide" for OpenWebBeans.
+
+This document is based on the 1.1.4 release of Apache OpenWebBeans.
+
+--------------------------------
+What is Apache OpenWebBeans?
+--------------------------------
+OpenWebBeans is an Apache License V 2.0 licensed implementation of the JSR-299,
+Contexts and Dependency Injection for the Java EE platform.
+
+It also already incorporates some features which are part of JSR-346 (CDI-1.1)
+but doesn't need API changes as we still use the JCDI-1.0 API. The
+incorporated CDI-1.1 features are mostly parts which are not well
+defined in the CDI-1.0 specification, like Serialisation checks, etc.
+
+Our project's web page can be found at:
+http://openwebbeans.apache.org
+
+The projects WIKI page can be found at:
+https://cwiki.apache.org/confluence/display/OWB/Index
+
+
+--------------------------------
+OpenWebBeans 1.1.4 Release Features
+--------------------------------
+
+- The 1.1.4 release supports the following features
+-----------------------------------
+* Managed Beans Support
+* Session Beans Support (via Embeddable OpenEJB container in Tomcat)
+* Producer Method Support
+* Producer Field Support
+* Java EE Resource Injection Support
+* JMS OpenWebBeans Support(OWB Specific)
+* Inheritance, Stereotype Inheritances
+* Specialization Support
+* Event Support
+* Decorator and Interceptor Support
+* Lookup and Dependency Injection Support
+* Java EE Plugin Support (via ServetContextListener interface)
+* Portable Integration Support
+* Passivation Capability of Beans
+* @Alternative support
+* OSGi environment support with an own plugable bundle ClassPath scanner
+* vastly improved Interceptor performance
+* plugable SecurityManager integration doubles speed if no SecurityManager is being used
+* improved Serialization handling
+* improved CreationalContext handling
+* revised internal logging
+* upgrade to JPA-2 and JSF-2 support
+* support for direct CDI usage in tomcat-6 and tomcat-7 environments
+* optional lenient lifecycle interceptor checking
+* automatically detect if BeanManager#isInUse()
+* improved Serialization checks from the CDI-1.1 specification
+
+
+
+Noteable differences to CDI spec behaviour
+--------------------------------------------
+
+In a few special cases Apache OpenWebBeans might behave a little bit different than
+other CDI implementations. This is to some degree caused by the JSR-299 spec being
+not clear about some special topics so we needed to interpret the wording on our own.
+This mainly concerns the area of section 12.1 Bean Archives (BDA) which doesn't work
+out when it comes to OSGi containers and likes.
+In Apache OpenWebBeans, a settings configured in a beans.xml file of a BDA is not
+only effective for this very bean archive but for the whole BeanManager in control
+of the Application. This is especially the case for <alternatives> and
+<interceptors>! An Alternative, Interceptor or Decorator enabled in one BDA is active
+for the whole Application. This behaviour will most likely also be the default behaviour
+in the CDI-1.1 JSR-346 specification.
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.4
+-------------------------------------------
+
+Bug
+
+ * [OWB-567] - Lookup of Provider results in NullPointerException on get()
+ * [OWB-574] - NewBean doesn't support EJBs
+ * [OWB-580] - ObserverMethodImpl needs support for EJB's whose Bean Types do not include the EJB class
+ * [OWB-602] - OpenWebBeans OpenEJB integration OSGi bundle declares the wrong version for the javax.transaction package
+ * [OWB-617] - NullPointerException in InstanceBean#createInstance
+ * [OWB-628] - Event injection doesn't work in observer methods.
+ * [OWB-633] - define stereotypes & thirdparty
+ * [OWB-634] - @Interceptors added by extension ignored
+ * [OWB-636] - Samples point to parent pom file that doesn't exist
+ * [OWB-643] - it isn't possible to add/remove @Alternative during the bootstrapping process
+ * [OWB-644] - wrong config entry for LoaderService
+ * [OWB-645] - InjectionPoint is null when using @Produces. NullPointerException caused by CDI container providing a null InjectionPoint into a producer method.
+ * [OWB-646] - Failover does not work (again)
+ * [OWB-648] - regression on tck org.jboss.jsr299.tck.tests.lookup.injectionpoint.InjectableReferenceTest
+ * [OWB-649] - exceptions in EJB's are wrapped in InvocationTargetException
+ * [OWB-655] - CDI doesn´t inject stateless EJB by abstract class.
+ * [OWB-658] - BeanManager.getBeans(Type, Annotation...) can not be used to query all known beans
+ * [OWB-659] - An annotated interface class is being seen as a manage bean.
+ * [OWB-660] - WebBeansContext #activateContext for SessionScoped.class doesn't set the ThreadLocal
+
+Improvement
+
+ * [OWB-596] - Provide info about injetion point for "Passivation capable beans must satisfy passivation capable dependencies ..."
+ * [OWB-604] - more details for exceptions during bootstrapping
+ * [OWB-635] - support callbacks (@PostContrcut, @PreDestroy) in Extensions
+ * [OWB-637] - [perf] ELContextStore.destroyDependents() creates unnecessary HashMap$KeyIterator instances
+ * [OWB-638] - [PERF] Avoid unnecessary AbstractList$Itr instances
+ * [OWB-639] - [perf] InjectionResolver.getBeanCacheKey creates many StringBuilder instances
+ * [OWB-641] - the jee5-ejb-resource module should support @EJB(mappedName)
+ * [OWB-647] - [PERF] Avoid unnecessary StringBuilder instances - improve checkNullInstance, checkScopeType, ... methods
+ * [OWB-653] - remove @ViewScoped support
+ * [OWB-657] - review startup performance
+ * [OWB-661] - hashCode, equals and toString() of our built in Qualifier Literals should be implemented ourselfs
+
+Task
+
+ * [OWB-656] - remove webbeans-openejb
+ * [OWB-662] - remove obsolete class WebBeansAnnotation
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.3
+-------------------------------------------
+
+Bug
+
+ * [OWB-515] - interceptors don't support inheritance without an overridden method annotated with @AroundInvoke
+ * [OWB-565] - missing check for producer methods
+ * [OWB-625] - BeanManager.resolve throw java.util.NoSuchElementException with an empty set parameter
+ * [OWB-629] - NoClassDefFoundError for optional dependencies
+ * [OWB-630] - AmbiguousResolutionException thrown for Decorators that Decorate multiple beans where any of those beans are passivation capable.
+ * [OWB-631] - openwebbeans-resource misses openwebbeans.properties
+
+Improvement
+
+ * [OWB-475] - support for optional beans
+ * [OWB-627] - Automatically destroy @Dependent contextual instances created with Instance<T>
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.2
+-------------------------------------------
+
+Bug
+
+ * [OWB-562] - non-enabled alternative beans with passivating scope fail validation during deployment
+ * [OWB-589] - " ... requires a passivation capable dependency ..." for producer method with return type String and non serializable injected dependency
+ * [OWB-597] - StackOverFlow when injecting product in same bean where @Produces is placed
+ * [OWB-615] - remove @Overrides for interfaces to be java5 compatible
+ * [OWB-616] - javax.el.ExpressionFactory has final methods! CDI doesn't allow that. - Test on final **PRIVATE** methods too?
+ * [OWB-618] - we sometimes invoke a dispose method without having created the bean upfront
+ * [OWB-619] - @New beans must only exist if there is at least one injection point for them
+ * [OWB-620] - any disabled bean of passivating scope will wrongly be detected as 'not passivatable'
+ * [OWB-622] - beanmanager injection in afterBeanDiscovery method parameter
+ * [OWB-624] - AnnotatedTypes registered in BeforeBeanDiscovery might get processed twice
+
+Improvement
+
+ * [OWB-623] - Relax check on @AroundInvoke Interceptors 'throws Exception'
+
+New Feature
+
+ * [OWB-621] - Alternative configuration method for buggy container or pre servlet api 2.5 container
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.1
+-------------------------------------------
+
+Bug
+
+ * [OWB-406] - BaseEjbBean.removedStatefulInstance used by multiple instances/EjbBeanProxyHandlers
+ * [OWB-447] - unnecessary contextual/non-contextual distinction in OpenWebBeansEJBIntercpetor
+ * [OWB-449] - EJB interceptor has incorrect/unnecessary use of business method checks
+ * [OWB-483] - Problem with mulitple custom interceptors and passivation
+ * [OWB-512] - ApplicationContext and SingletonContext in WebContextsService
+ * [OWB-554] - DelegateHandler wraps Beans exceptions
+ * [OWB-558] - PassivationCapable bean id's for Producer Fields do not take into account generics
+ * [OWB-561] - Multiple contexts with the same Scope are not handled properly -- causing tck failures
+ * [OWB-563] - producers of passivating beans fail when the declared return type is not serializable but the actual return type is
+ * [OWB-566] - ProcessInjectionTarget event gets fired too early
+ * [OWB-571] - fix site build under maven3 and upgrade logo
+ * [OWB-573] - Invalid checking of Interceptor serialization capabilities for non-Passivation capable EJBs
+ * [OWB-576] - FileNotFoundException on WebSphere
+ * [OWB-577] - FileNotFoundException on WebSphere
+ * [OWB-578] - Allow DI for OpenWebBeansConfiguration properties
+ * [OWB-579] - check for non-proxyiable methods should exclude synthetic methods
+ * [OWB-581] - Decorator interface check needs configurable exclusions
+ * [OWB-584] - check for declared name consistency for specializes beans is wrong
+ * [OWB-585] - ProcessSessionBean doesn't deal with generic type quite right (CDITCK-215)
+ * [OWB-586] - Interceptors added by portable extensions don't work
+ * [OWB-587] - Use business interface for producer and disposer methods of Session beans
+ * [OWB-588] - PrincipalBean is misspelled
+ * [OWB-590] - Seam Persistence does not work with OWB - AfterBeanDiscovery.addBean will be ignored
+ * [OWB-591] - EJB @Specializes inheritance
+ * [OWB-593] - Interceptor binding added on an interceptor class at ProcessAnnotatedType phase is not considered
+ * [OWB-595] - Use case "Faces Request Generates Non-Faces Response" locks conversation forever (-> BusyConversationException)
+ * [OWB-598] - InjectionResolver crashes with a NPE when injecting a method parameter
+ * [OWB-599] - move getBeanXmls() back to Set<URL>
+ * [OWB-600] - cache information about non intercepted methdos in ProxyHandlers
+ * [OWB-601] - WebContextsService only works if ServletContext is given
+ * [OWB-608] - openwebbeans-el10 plugin misses openwebbeans.properties
+ * [OWB-614] - add LICENSE and NOTICE files to all our samples
+
+Improvement
+
+ * [OWB-555] - ClassUtil methods contain spelling, camelcase, etc., type errors
+ * [OWB-557] - #setAccessible(false) isn't needed
+ * [OWB-560] - upgrade the TCK to 1.0.4.SP1
+ * [OWB-564] - CdiTestOpenWebBeansContainer - check if a std.-context is active before destroying it
+ * [OWB-582] - Support for Java 1.5 (needed for WebSphere 6.1)
+ * [OWB-583] - Support for Servlet API 2.4 (needed for WebSphere 6.1)
+ * [OWB-594] - create a configurable mapping Scope->ProxyMethodHandlerImplementation
+ * [OWB-607] - upgrade our samples to newest available dependencies
+ * [OWB-610] - upgrade to apache parent pom 10
+ * [OWB-611] - adding ASF trademark documentation to our official site build
+ * [OWB-612] - upgrade various maven plugins
+ * [OWB-613] - Exclude Samples WARs Publishing with Maven
+
+Task
+
+ * [OWB-592] - EJB Specialization utility method
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.0
+-------------------------------------------
+
+Bug
+
+ * [OWB-295] - resolve bugs in Javassist Proxy
+ * [OWB-417] - BaseEjbBean.destroyComponentInstance() should call direct container remove API, not call an @Remove annotated method
+ * [OWB-422] - Support needed for PrePassivate, PostActivate, and AroundTimeout via EJBInterceptor.
+ * [OWB-444] - Using Static Loggers in Shared ClassLoader
+ * [OWB-452] - set active flag to false then context is destroyed
+ * [OWB-456] - When multiple interceptors are defined for a bean OWB does NOT correctly remove the overridden base Interceptors
+ * [OWB-469] - JSR299TCK: Security Error / Passivation errors during readObject
+ * [OWB-470] - OWBInjector does not work correctly for EJB Beans
+ * [OWB-471] - Possible StackOverflowException from defineProducerMethods in WebBeansAnnotatedTypeUtil
+ * [OWB-473] - bundles that use javasissist to proxy their contents need to import some javassist packages
+ * [OWB-474] - InjectionTargetBean#injectSuperResources is missing
+ * [OWB-477] - Two instances of using ObjectInputStream that may not have visibility into application classloader
+ * [OWB-480] - Avoid a couple NPEs
+ * [OWB-482] - Small issues
+ * [OWB-486] - ResourceBean tries to proxy final classes before testing them for being final
+ * [OWB-489] - AnnotatedTypes added with BeforeBeanDiscovery.addAnnotatedType method are ignored
+ * [OWB-490] - ProcessObserverMethod Type parameters are inverted (CDITCK-174)
+ * [OWB-491] - Decorators init needs to scan superclasses for more interfaces. cf CDITCK-178
+ * [OWB-492] - events don't get sent to private @Observes methods
+ * [OWB-493] - ProcessProducerMethod and ProcessProducerField type parameters are reversed in filtering (?) CDITCK-168
+ * [OWB-494] - Subclasses with non-overriden observer methods not recognized as beans with observer methods
+ * [OWB-496] - Don't replace the ProxyFactory classloaderProvider without the intention to do so
+ * [OWB-499] - WEB-INF/beans.xml of a war will not activate Bean Archive behaviour
+ * [OWB-502] - Only cache the ContextService once, in the SingletonService
+ * [OWB-504] - OwbApplicationFactory getWrapped should return wrapped application factory
+ * [OWB-505] - OwbApplicationFactory should not be installed by default
+ * [OWB-509] - Unwrap InvocationTargetException in ResourceProxyHandler.invokie
+ * [OWB-510] - return null instead of an unusable proxy if a resource is missing
+ * [OWB-511] - Delegate actualInstance serialization behavior in ResourceProxyHandler
+ * [OWB-514] - Leak in ELContextStore
+ * [OWB-519] - broken wls support
+ * [OWB-521] - ProducerMethodBean could theoretically produce a NPE
+ * [OWB-522] - Missing updateTimeout in one of begin methods for conversation
+ * [OWB-523] - @SessionScoped bean failover does not work
+ * [OWB-524] - OWB classpath scanning of non-jars doesn't work if the classpath contains spaces
+ * [OWB-527] - JspFactory.getDefaultFactory() is synchronized, We can cache the return value to improve performance
+ * [OWB-529] - lazy initialized class members should be volatile
+ * [OWB-530] - multi massive execution of our Interceptor test unveils a concurrency problem
+ * [OWB-531] - cleanup WebBeansELResolver#getValue
+ * [OWB-533] - concurrency bottleneck due to use of our logger
+ * [OWB-534] - Injection of @PersistenceContext does not work with abstract/base classes
+ * [OWB-541] - replace WeakHashMap with a standard one in InterceptorHandler
+ * [OWB-542] - Disposer is called twice on Dependent beans when injected into a managed object that is called from a JSP
+ * [OWB-543] - get rid of checked Exceptions in our SPI
+ * [OWB-545] - Cleanup our SecurityManager integration
+ * [OWB-546] - @Typed gets ignored if we use a AnnotatedType from an Extension @Observing ProcessAnnotatedType
+ * [OWB-547] - WebContextsService throws NPE on asynchronous app startup
+ * [OWB-548] - missing null check in DefaultContextsService#stopApplicationContext
+ * [OWB-550] - duplicated observer methods in case of @Specializes
+
+Improvement
+
+ * [OWB-209] - remove all <repositories> from our poms
+ * [OWB-254] - suppress initialising contextual handling for configurable URIs.
+ * [OWB-335] - implement a sample for @ViewScoped in reservation
+ * [OWB-393] - remove old XML configuration code
+ * [OWB-448] - More changes for decorator and interceptor passivation support
+ * [OWB-461] - source code quality
+ * [OWB-472] - archive centric beans.xml enabling
+ * [OWB-478] - make OWB build maven-3 aware
+ * [OWB-485] - AmbiguousResolutionException doesn't print details about the injection point
+ * [OWB-500] - improved app-server support
+ * [OWB-503] - Reduce static synchronized hashmap usage
+ * [OWB-506] - Upgrade our samples to Apache MyFaces-2.0.3 and OpenJPA-2.0.1
+ * [OWB-507] - our samples should be prepared for EE as default
+ * [OWB-508] - Dependent scope proxies are needed to wrap the build-in beans returned from the services if they are not serializable yet
+ * [OWB-516] - Get TCK standalone 1.0.4 CR2
+ * [OWB-517] - Conversation Log Improvement
+ * [OWB-518] - log all bean-archive markers
+ * [OWB-520] - spi for the webbeans-jee5-ejb-resource plugin
+ * [OWB-525] - create a findbugs filter file in our build-tools resource
+ * [OWB-526] - remove usage of java.net.URLs from ScannerService and drop scannotation
+ * [OWB-535] - free ScannerService resources once we don't need it anymore
+ * [OWB-536] - revisit our Logger usage in our Bean impls
+ * [OWB-537] - clear() AnnotatedElementFactory after the deployment
+ * [OWB-539] - fill AnnotatedTypeImpl lazily
+ * [OWB-540] - StandaloneResourceInjectionService should cache info about classes which don't contain EE resource injection points
+ * [OWB-544] - improve BeanManager#getContext performance
+
+New Feature
+
+ * [OWB-433] - add a configuration flag for switching to a lenient lifecycle interceptor checking
+ * [OWB-501] - owb ee 5 resource integration
+ * [OWB-528] - Use ApplicationWrapper as parent of OwbApplication in JSF 2 plugin
+ * [OWB-532] - create a new BeanManager#isInUse()
+ * [OWB-538] - lazy loading of not explicitly marked (via annotation or registered by extension) Dependent beans
+
+Question
+
+ * [OWB-383] - static fields in CreationalContext
+
+TCK Challenge
+
+ * [OWB-484] - Running TCK 1.0.1 Final and Respective Corrections
+
+Task
+
+ * [OWB-19] - Geronimo Integration
+ * [OWB-428] - implementation of equals and hashCode for AbstractOwbBean
+ * [OWB-453] - add a flag to disable context activation in EJB interceptor
+
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0
+-------------------------------------------
+
+Bug
+
+ * [OWB-318] - multiple methods with same EJB @interceptors(foo.class) in same bean class get multiple interceptor instances
+ * [OWB-384] - OWB needs to call 299-defined PrePassivate, PostActivate, and AroundTimeout interceptors for EJBs
+ * [OWB-422] - Support needed for PrePassivate, PostActivate, and AroundTimeout via EJBInterceptor.
+ * [OWB-429] - OpenWebBeansEjbPlugin Class Hierarchy
+ * [OWB-438] - Cached Normal Scoped Proxy instances
+ * [OWB-439] - EjbPlugin session bean proxy creation thread safe problem
+ * [OWB-445] - we must not use javassist ProxyFactory#setHandler(MethodHandler)
+ * [OWB-446] - EJB lifecycle callbacks not stacked correctly
+ * [OWB-450] - NullPointerException in DependentScopedBeanInterceptorHandler when it has a NullCreationalContext (normally from a EE component).
+ * [OWB-454] - ClassUtil.callInstanceMethod() doesn't propogate original exception
+ * [OWB-455] - IllegalArgument method calling remove method of EJB during destroy
+ * [OWB-456] - When multiple interceptors are defined for a bean OWB does NOT correctly remove the overriden base Interceptors
+ * [OWB-457] - we must not create a SessionContext for static resource reqeusts
+ * [OWB-460] - fix owb-openejb and owb-ejb artifactIds
+ * [OWB-464] - InjectionPointImpl using wrong class loader during serialize/deserialize, dropping qualifiers, and omiting qualifier values.
+ * [OWB-466] - Ensure removal of all ThreadLocal values
+
+Improvement
+
+ * [OWB-177] - Handling of InterceptionType#POST_ACTIVATE, PRE_PASSIVATE and AROUND_TIMEOUT is missing
+ * [OWB-407] - detailed information about exceptions
+ * [OWB-451] - Allow InterceptorUtil#callAroundInvokes to propogate a callers 'creational context key'
+ * [OWB-459] - upgrade to newer library versions
+ * [OWB-463] - EjbDefinitionUtility.defineEjbBeanProxy() should be able to create proxies for no-interface local beans
+ * [OWB-465] - enhance EJB common code for crude @LocalBean support
+
+TCK Challenge
+
+ * [OWB-394] - Any idea why our BeforeBeanDiscovery.addInterceptorBinding() has different signature?
+
+Task
+
+ * [OWB-453] - add a flag to disable context activation in EJB interceptor
+ * [OWB-462] - Refactor AnnotationUtil.hasAnnotationMember()
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0-alpha-2
+-------------------------------------------
+Bug
+
+ * [OWB-303] - upgrade Javassist to a newer version
+ * [OWB-338] - our internal SessionContext and ConversationContext must support Session serialization
+ * [OWB-385] - implement passivation of managed beans in ServletContextListener
+ * [OWB-401] - ELContextStore not cleaned up for some JSP EL lookups
+ * [OWB-402] - OpenWebBeansJsfPlugin does not recognize @ManagedBean
+ * [OWB-404] - Contexts must not get stored in a static Map in BeanManager
+ * [OWB-405] - AnnotatedElementFactory must not use static cache maps
+ * [OWB-408] - NPE in WebBeansELResolver
+ * [OWB-415] - EjbBeanProxyHandler for dependent ejb must save ejb instance
+ * [OWB-416] - BaseEJBBean.destroyComponentInstance() tries to call multiple remove methods
+ * [OWB-418] - EjbBeanProxyHandler must be 1:1 with proxy instances for dependent SFSB
+ * [OWB-419] - fix @Dependent handling in ELResolver
+ * [OWB-420] - SingletonContext is mapped to @ConversationScoped
+ * [OWB-421] - defined-in-class EJB lifecycle callbacks masked by our Interceptor
+ * [OWB-426] - Tweak EJBPlugin to work with Standalone Tests
+ * [OWB-431] - Generic Type Inheritance not resolved correctly
+ * [OWB-434] - ThreadLocal<SingletonContext> doen't get cleaned up
+ * [OWB-436] - AbstractContext bean instance creation is not thread safe
+ * [OWB-437] - Improve AbstractContext synchronization
+ * [OWB-440] - WebBeansDecoratorConfig.getDecoratorStack always returns new Decorators
+ * [OWB-442] - our EJB proxies are broken when multiple local interfaces are used on a single class
+ * [OWB-443] - Normal-scoped EJB not removed by container during Contextual.destroy()
+
+Improvement
+
+ * [OWB-57] - cleanup problems found by maven-findbugs-plugin
+ * [OWB-195] - Give warning to the developer related with non- portable operations
+ * [OWB-409] - create a name for OWB our faces-config.xml
+ * [OWB-410] - lazy initialisation of ejbInterceptors
+ * [OWB-411] - cache calls to isNormalScope()
+ * [OWB-412] - Allow container specific extensions to WebConfigurationListener access to the lifecycle
+ * [OWB-413] - cache calls to ClassUtils#getObjectMethodNames()
+ * [OWB-414] - improve Interceptor performance
+ * [OWB-425] - improve performance of owb-el-resolver
+ * [OWB-427] - improve read-performance of AbstractOwbBean
+ * [OWB-430] - improve performance of WebBeansPhaseListener
+ * [OWB-432] - Create Singleton Service SPI
+ * [OWB-441] - new configuration properties mechanism
+
+Sub-task
+
+ * [OWB-193] - If an interceptor or decorator has any scope other than @Dependent, non-portable behavior results.
+ * [OWB-194] - If an interceptor or decorator has a name, non-portable behavior results.
+ * [OWB-196] - If an interceptor or decorator is an alternative, non-portable behavior results.
+ * [OWB-197] - If a stereotype declares any other qualifier an- notation, non-portable behavior results.
+ * [OWB-198] - If a stereotype is annotated @Typed, non-portable behavior results.
+
+
+TCK Challenge
+
+ * [OWB-424] - Adding Document for How to Configure and Run TCK (standalone and web profile TCKs)
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0-alpha-1
+-------------------------------------------
+Bug
+
+ * [OWB-216] - Update pom.xml svn links
+ * [OWB-231] - exception using abstract decorators
+ * [OWB-245] - Using parameterized type varaibles fails for Producer Method injection
+ * [OWB-259] - Implement spec 11.5.5. ProcessModule event
+ * [OWB-289] - Owb return 2 beans for Indirect specialized producer beans
+ * [OWB-302] - InjectionPoint injections (both method and field based) in Decorators result in null
+ * [OWB-312] - Add dopriv's to allow OWB to function with java 2 security enabled
+ * [OWB-317] - creationalContext in InvocationContextImpl is always null
+ * [OWB-318] - multiple methods with same EJB @interceptors(foo.class) in same bean class get multiple interceptor instances
+ * [OWB-327] - annotating an Interceptor with @ApplictionScoped leads to OutOfMemory
+ * [OWB-329] - Interceptor instances get created each time the interceptor gets called
+ * [OWB-332] - Destroy Depdent Of Producer Method Beans when Invocation Completes
+ * [OWB-333] - InjectionTarget and Producer Handling
+ * [OWB-334] - cid is missing when using redirect for a jsf 2.0 application
+ * [OWB-336] - injected BeanManager must be Serializable
+ * [OWB-337] - events must not get broadcasted to beans which have no active Context
+ * [OWB-339] - Injecting Non-Contextual Beans Causes NPE in WebBeansUtil
+ * [OWB-340] - BeanManagerImpl.createInjectionTarget() Throws Exception When No Constructor Found
+ * [OWB-341] - CreationalContext#incompleteInstance should get cleaned after create()
+ * [OWB-342] - InterceptorHandler crashes with NullPointerException after deserialisation
+ * [OWB-343] - upgrade JPA spec from 1.0-PFD2 to 1.0 final revision
+ * [OWB-345] - Remove duplicate dependencies
+ * [OWB-351] - OWB picks up @SessionScoped contextual instances from expired sessions
+ * [OWB-352] - Thread Safety Problem in our InterceptorHandlers, aka proxies
+ * [OWB-353] - NPE in removeDependents@CreationalContextImpl
+ * [OWB-354] - WebContextService may throw NPE in tiered classloading environmemt
+ * [OWB-357] - WebbeansFinder should index first on ClassLoader, not singleton type
+ * [OWB-359] - ownerCreationalContext sometimes causes NPE in InterceptorDataImpl.createNewInstance()
+ * [OWB-361] - underlying EJB method not actually in our interceptors stack
+ * [OWB-362] - InvocationTargetException when invoking Stateless SessionBean
+ * [OWB-363] - Intermittent bug with ApplicationScope disposers not being called
+ * [OWB-366] - ContextNotActiveException fired from AppScope/NormalScopedBeanInterceptorHandler when a proxied object finalized
+ * [OWB-368] - The 299 spec (that I have) uses receive=IF_EXISTS but OWB uses notifyObserver=IF_EXISTS.
+ * [OWB-369] - Static ContextsService in ContextFactory causes wrong webContextService used for multiple applications
+ * [OWB-370] - Intransient Conversation context get rdestroyed randomly by destroyWithRespectToTimout
+ * [OWB-371] - no lifecycle interceptors for non-contextual EJB
+ * [OWB-372] - creational context not cleaned up for non-contextual EJB interceptions
+ * [OWB-373] - build crashes with missing artifact error
+ * [OWB-374] - migrate jsf2sample from sun to MyFaces
+ * [OWB-376] - [patch] Guess example broken with Jetty plugin 6.x due to EL 2.2
+ * [OWB-377] - revise logging
+ * [OWB-378] - ejb at bottom of decorator stack doesn't handle changed method
+ * [OWB-380] - NormalScopedBeanInterceptorHandler throws NPE when handling 3rd party Contexts
+ * [OWB-381] - NPE thrown from AbstractInjectable if dependent producer returns null
+ * [OWB-382] - injecting a @Dependent bean into a passivatation scoped bean causes a NonSerializableException
+ * [OWB-387] - DependentContext Interceptor Double Call for PostConstruct
+ * [OWB-390] - fix broken links in our 'site'
+ * [OWB-396] - fix poms to work with maven 3
+ * [OWB-398] - DelegateHandler cached too agressively
+ * [OWB-399] - Proxy objects could not be correctly deserialized by using javassist 3.11. we need to update to 3.12
+ * [OWB-400] - starting OWB as part of an EAR in geronimo causes a exception due to missing 'bundle' protocol
+
+Improvement
+
+ * [OWB-116] - Update Business Method Definition
+ * [OWB-118] - Supports Decorators for Other Delegate Injections
+ * [OWB-136] - fix 'broken' license headers in our java files
+ * [OWB-170] - Address findbug issues in webbeans-impl
+ * [OWB-183] - Improve webbeans-doc module to get a documentation more user friendly
+ * [OWB-214] - get rid of javax.transaction.Transaction dependency in webbeans-impl
+ * [OWB-237] - NoSuchElementException when WebBeansConfigurationListener is absent
+ * [OWB-275] - remove unused imports and cleanup code
+ * [OWB-286] - java.lang.NoClassDefFoundError: javax/validation/Validator
+ * [OWB-313] - create caching strategies for resolving Bean<T> for BeanManager and EL invocations
+ * [OWB-314] - cache resolved instances in NormalScopedBeanMethodHandlers of @ApplicationScoped beans
+ * [OWB-315] - cache resolved instances in NormalScopedBeanMethodHandlers of @SessionScoped beans
+ * [OWB-319] - Strange logging when writing non-Serializable SessionScoped bean
+ * [OWB-320] - Remove Java EE Dependencies from WebBeans Core
+ * [OWB-322] - Create new EJB project and separate common EJB classes from OpenEJB plugin
+ * [OWB-325] - Relocate SPI Classes to SPI Module. Change JSR299, JSR330 as optional pom dependency.
+ * [OWB-326] - improve producer tests
+ * [OWB-328] - improve logger performance
+ * [OWB-330] - reduce BeanManagerImpl#getManager() calls inside the same functions
+ * [OWB-331] - Cache Interceptor & Decorator Stack oon Interceptor Handler
+ * [OWB-346] - Make EJB samples running
+ * [OWB-347] - Using InjectableBeanManager in TCK
+ * [OWB-349] - ignore exception during type hierarchy scan
+ * [OWB-350] - Support Interceptor for non-contextual EJBs
+ * [OWB-355] - OpenEjbBean should look for @Remove methods
+ * [OWB-356] - EjbPlugin only looks for DeployementInfo once, so new deployed application won't be discovered
+ * [OWB-358] - provide property to skip injection in @PostConstruct of OpenWebBeansEjbInterceptor
+ * [OWB-360] - Add BeanManager to a ServletContext attribute
+ * [OWB-364] - Reduce the amount of info level logging
+ * [OWB-365] - make injection optional in OWBEJBInterceptor
+ * [OWB-375] - Performance: OWB logging performs operations when logging disabled.
+ * [OWB-379] - upgrade to final atinject-spec artifact
+ * [OWB-386] - upgarde CDI TCK to 1.0.2.CR1
+ * [OWB-389] - atinject-tck upgrade to final 1.0 release
+ * [OWB-397] - Add helper method and some debug to WebBeansFinder
+
+New Feature
+
+ * [OWB-316] - Implement a generic TestContainer for CDI implementations
+ * [OWB-323] - Provide methods to pass classloader into ServiceLoader and WebBeansFinder for use in tiered classloader situations
+ * [OWB-324] - Add Tomcat Plugin
+ * [OWB-348] - Adding Interceptor and Decorator Support for EJB Beans
+ * [OWB-395] - OpenWebBeans Tomcat 7 Support
+
+TCK Challenge
+
+ * [OWB-388] - Pass TCK 1.0.2 CR1 Web Profile
+
+Task
+
+ * [OWB-6] - Scope passivation
+ * [OWB-14] - Update WebBeans Lifecycle for Servlet Beans
+ * [OWB-46] - Injection into non-contextual objects
+ * [OWB-204] - Update Samples for JSF2 Usage
+ * [OWB-220] - Update site.xml links and bread crumbs to point to non-incubator.
+ * [OWB-310] - Drop dom4j and use jre builtin xml parsers for processing beans.xml
+ * [OWB-391] - create a owb-build-tools project to maintain project specific checkstyle rules, etc.
+
+Test
+
+ * [OWB-56] - Integrate the official JSR-299 TCK test suite
+ * [OWB-222] - Update website download link, and fix relative URL translation
+ * [OWB-367] - Add a unit test for IF_EXISTS
+
+
+----------------------------------------------
+Required Platform
+----------------------------------------------
+Java Version : Java SE >= 5.0
+Java EE Must : Java EE >= 5.0
+
+---------------------------------------------
+How to Configure OpenWebBeans
+---------------------------------------------
+
+This section explains a content of the distribution bundle, OWB plugins and its
+dependent libraries.
+
+---------------------------------------------
+1.1.4 Distribution Content
+---------------------------------------------
+There are several jars in the OpenWebBeans 1.0.0 distribution;
+
+ - openwebbeans-impl-1.1.4.jar --> Includes Core Dependency Injection Service.
+ - openwebbeans-ejb-1.1.4.jar --> EJB Plugin(Supports EJBs in OpenEJB embedded in Tomcat).
+ - openwebbeans-jms-1.1.4.jar --> JMS Plugin(Supports injection of JMS related artifacts,i.e, ConnectionFactory, Session, Connection etc.)
+ - openwebbeans-jsf-1.1.4.jar --> JSF-2.0 Plugin(JSF Conversation Scoped Support).
+ - openwebbeans-jsf12-1.1.4.jar --> JSF-1.2 Plugin(JSF Conversation Scoped Support).
+ - openwebbeans-resource-1.1.4.jar --> Java EE Resource Injection for Web Projects (Includes @PersistenceContext,@PersistenceUnit
+ and @Resource injection into the Managed Beans. @Resource injections use java:/comp/env of the
+ Web application component. @PersistenceContext is based on extended EntityManager.
+ - openwebbeans-spi-1.1.4.jar --> OpenWebBeans Server Provider Interfaces. They are implemented by runtime environments that would
+ like to use OpenWebBeans as a JSR-299 implementation.
+ - samples --> Includes source code of the samples. Samples are mavenized project therefore you can easily build and run
+ them from your environment that has maven runtime.
+ - openwebbeans-osgi-1.1.4.jar --> ClassPath ScannerService SPI implementation for OSGI environments like Apache Geronimo-3
+ - openwebbeans-web-1.1.4.jar --> Basic Servlet integration
+ - openwebbeans-tomcat6-1.1.4.jar --> Support for deeper integration into Apache Tomcat-6
+ - openwebbeans-tomcat7-1.1.4.jar --> Support for deeper integration into Apache Tomcat-7
+
+
+
+
+------------------------------------------
+How OWB Plugins Work
+------------------------------------------
+
+OpenWebBeans has been developed with a plugin architecture. The Core dependency injection service
+is provided with openwebbeans-impl. If you need further service functionality,
+you have to add respective plugin jars into the application classpath. OpenWebBeans
+uses the Java SE 6.0 java.util.ServiceLoader mechanism to pickup plugins at runtime.
+If you run under Java SE 5.0, an similar hand written implementation will be used.
+Please do not confuse OWB plugins with portable Extensions! OWB plugins are for
+internal use only whereas portable CDI Extensions will run on any JSR-299 container.
+
+Current Plugins:
+---------------------
+Look at "1.1.4 Distribution Content" above.
+
+------------------------------------------
+Dependent Libraries
+------------------------------------------
+
+Third Party jars:
+-----------------
+They are necessary at runtime in the Core Implementation.
+
+javassist : Version 3.12.0.GA
+scannotation : Version 1.0.2 (if not running in an OSGi environment like Apache Geronimo-3)
+
+Java EE APIs jars(Container Provider Libraries) :
+-------------------------------------------------
+Generally full Java EE servers provides these jars. But web containers like Tomcat or Jetty
+do not contain some of them, such as JPA, JSF, Validation API etc. So, if you do not want to bundle
+these libraries within your application classpath, you have to include these libraries in your
+server common classpath.
+
+jcdi-api (JSR-299 Specification API)
+atinject-api (JSR-330 Specification API)
+servlet-2.5 or servlet 3.0 (Servlet Specification API)
+ejb-3.1 (EJB Specification API)
+el-2.2 (Expression Langauge Specification API)
+jsf-2.0 (Java Server Faces API)
+jsr-250 (Annotation API)
+interceptor-1.1 (Interceptor API)
+jta-1.1 (Java Transaction API)
+jsp.2.1 or jsp-2.2 (Java Server Pages API)
+jpa-2.0 (Java Persistence API)
+jaxws-2.1 or jaxws-2.2 (Java Web Service API)
+jms-1.1 or jms-1.2 (Java Messaging Service API)
+validation (Validation Specification)
+
+Dependencies of OpenWebBeans Maven Modules&Plugins
+--------------------------------------------------
+
+openwebbeans-impl :
+------------------
+Third party : javassist, scannotation, openwebbeans-spi
+Container Provided : jcdi-api, at-inject, servlet, el, jsr-250, interceptor, jta, jsp, validation
+
+openwebbeans-ejb:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : OpenWebBeans EJB plugin is based on OpenEJB in Tomcat. Therefore, if you install OpenEJB
+ within Tomcat correctly, there is no need to add any additional libraries. Look at the
+ OpenEJB in Tomcat configuration section.
+
+openwebbeans-jms:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : jms
+
+openwebbeans-jsf:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : jsf
+
+NOTE : We are trying to decrease dependent libraries of the our core, i.e, openwebbeans-impl.
+At 1.1.4, dependent third party libraries will be decreased. We have a plan to create profile
+plugins, therefore each profile plugin provides its own dependent libraries. For example, in
+fully Java EE Profile Plugin, Transaction API is supported but this will not be the case
+for Java Web Profile Plugin or Java SE Profile Plugin. Stay Tuned!
+
+Currently, as you have seen above, openwebbeans-impl depends on some Java EE/Runtime
+provided libraries (servlet, jsp, el etc). In the future, with OpenWebBeans profiling support,
+openwebbeans-impl will not depend on any Java EE APIs. Those APIs will be provided
+by OpenWebBeans profiles/plugins that openwebbeans-impl will be used. Therefore,
+you will able to use OpenWebBeans in your own runtime environment easily by writing
+your own plugins and contributing it to OpenWebBeans :)
+
+------------------------------------------
+Library Configuration
+------------------------------------------
+To run openwebbeans applications in the Java EE based application server,
+you could add the JSR-299 API and JSR-330 API into the server common classpath, and
+implementation, plugins and dependent jars into your "WEB-INF/lib" directory
+of the Java EE Web Application.
+
+In this release, we can not support the OpenWebBeans as an integrated
+functionality of the Java EE Application Servers. So, you have to manage the
+configuration of the OpenWebBeans within your application's "web.xml" file. A sample "web.xml"
+file can be found in the "config" directory. To use EJB functionality, you also have to
+add OWB specific interceptor into your EJB beans. Look at the EJB section of this readme
+for further details.
+
+---------------------------------------------
+OpenWebBeans Properties File
+---------------------------------------------
+OpenWebBeans uses a default configuration file to configure some of its
+properties. Default configuration files are embedded into OWB implementation
+jar files. Instead of opening the jars file and changing configuration properties, simply add
+an "openwebbeans.properties" file into a "META-INF/openwebbeans" folder of your application
+classpath. This will override the values from the default configuration.
+You can specify a property 'configuraion.ordinal' in this file to define the overlay order.
+A properties file with higher 'configuration.ordinal' value will applied later and thus
+have a higher precedence. If you don't specify a 'configuration.ordinal' a value of 100 is assumed;
+This allows to have multiple openwebbeans.properties files e.g. a common one in an EAR lib
+(with configuration.ordinal=100) and more specific ones for each WebApp in your EAR (with a
+configuration.ordinal of e.g. 101).
+
+Each plugin developer can provide their own SPI implementation class and own configuration values. If you would like
+to use those implementation classes or configuration values, you have to override the default configuration file as explained
+in the above paragraph, i.e, putting "openwebbeans.properties" file into "META-INF/openwebbeans" folder of your application.
+It is recommended to use a 'configuration.ordinal' between 50 and 99 for custom SPI implementations.
+
+Below are OpenWebBeans' default configuration properties from our openwebbeans-impl.jar file and our plugins such as
+our OpenEJB plugin.
+
+Override default value of ResourceInjectionService
+-------------------------------------------------
+org.apache.webbeans.spi.ResourceInjectionService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService
+
+OpenWebBeans uses the "OpenEjbResourceInjectionService" class to inject resources into the managed bean instances.
+
+Configuration Names and Their Default Values :
+
+- "org.apache.webbeans.spi.ContainerLifecycle"
+ Description : Implementation of org.apache.webbeans.spi.ContainerLifecycle. All magic starts from here.
+ Values : org.apache.webbeans.lifecycle.DefaultLifecycle, OR CUSTOM
+ Default : org.apache.webbeans.lifecycle.DefaultLifecycle
+
+- "org.apache.webbeans.spi.JNDIService"
+ Description : Configures JNDI provider implementation.
+ Values : org.apache.webbeans.spi.se.DefaultJndiService OR CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultJndiService
+
+- "org.apache.webbeans.spi.conversation.ConversationService"
+ Description : Implementation of conversation.
+ Values : org.apache.webbeans.spi.conversation.jsf.DefaultConversationService OR CUSTOM
+ Default : org.apache.webbeans.spi.conversation.jsf.DefaultConversationService
+
+- "org.apache.webbeans.spi.ScannerService"
+ Description : Default implementation of org.apache.webbeans.spi.ScannerService. It is used for scanning application deployment
+ for finding bean classes and configuration files.
+ Values : org.apache.webbeans.spi.ee.deployer.DefaultScannerService OR CUSTOM
+ Default : org.apache.webbeans.spi.ee.deployer.DefaultScannerService
+
+- "org.apache.webbeans.spi.SecurityService"
+ Description : Implementation of org.apache.webbeans.spi.SecurityService. It is used for getting current "Principal".
+ Values : org.apache.webbeans.spi.se.DefaultSecurityService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultSecurityService
+
+- "org.apache.webbeans.spi.ValidatorService"
+ Description : Implementation of org.apache.webbeans.spi.ValidatorService. It is used for getting "ValidatorFactory" and "Validator".
+ Values : org.apache.webbeans.spi.se.DefaultValidatorService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultValidatorService
+
+- "org.apache.webbeans.spi.TransactionService"
+ Description : Implementation of org.apache.webbeans.spi.TransactionService. It is used for getting "TransactionManager" and "Transaction".
+ Values : org.apache.webbeans.spi.se.DefaultTransactionService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultTransactionService
+
+- "org.apache.webbeans.spi.ResourceInjectionService"
+ Description : Implementation of org.apache.webbeans.spi.ResourceInjectionService. It is used for injection Java EE enviroment resource into the
+ Managed Bean instances.
+ Values : org.apache.webbeans.se.DefaultResourceInjectionService or CUSTOM
+ Default : org.apache.webbeans.se.DefaultResourceInjectionService
+
+- "org.apache.webbeans.spi.JNDIService.jmsConnectionFactoryJndi"
+ Description : Configures JMS ConnectionFactory object jndi name
+ Values : Server specific JNDI name
+ Default : ConnectionFactory
+
+- "org.apache.webbeans.conversation.Conversation.periodicDelay"
+ Description : Conversation removing thread periodic delay
+ Values : Configured in millisecond
+ Default : 150000 ms
+
+- "org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService"
+ Description : Use EJB functionality or not. If use OpenEJB configures to true
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.spi.FailOverService"
+ Description : Implementation of the org.apache.webbeans.spi.FailOverService. It is used for enabling passivation/failover beans.
+ Values : org.apache.webbeans.web.failover.DefaultOwbFailOverService or CUSTOM
+ Default : org.apache.webbeans.web.failover.DefaultOwbFailOverService
+
+- "org.apache.webbeans.web.failover.issupportfailover"
+ Description : Support failover of beans or not
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.web.failover.issupportpassivation"
+ Description : Support passivation of beans or not
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.forceNoCheckedExceptions"
+ Description : The interceptors spec defines that @PostConstruct & Co must not throw checked Exceptions. Setting this configuration to 'false' disables this check.
+ Values : false, true
+ Default : true
+
+- "org.apache.webbeans.spi.SecurityService"
+ Description : Service to provide methods which must be guarded via doPrivileged blocks.
+ Values : org.apache.webbeans.corespi.security.SimpleSercurityService or org.apache.webbeans.corespi.security.ManagedSecurityService
+ Default : org.apache.webbeans.corespi.security.SimpleSercurityService
+
+
+---------------------------------------------
+EJB Support via Embeddable OpenEJB Container in Tomcat 6.X
+---------------------------------------------
+
+Configuration Steps:
+--------------------------------------------
+1* Download Tomcat 6.X version
+2* Configure OpenEJB. Look at URL http://openejb.apache.org/tomcat.html for installation.
+3* Copy JSR-330 API to Tomcat /lib folder.
+4* Copy JSR-299 API to Tomcat /lib folder
+5* Put all dependent libraries of the OpenWebBeans OpenEJB Plugin
+ - openwebbeans-ejb
+ - openwebbeans-impl and its dependencies
+
+You could look at ejb-sample.war for "WEB-INF/lib" libraries as an example to develop custom applications.
+The source of this project is also available.
+
+To use EJB functionality, you will use OpenEJB collapse-ear support. In this configuration,
+your EJB beans live within your "war" bundle.
+
+How to Develop EJB Applications
+---------------------------------------------
+1* Add "META-INF/openwebbeans.properties" into your application classpath.
+2* Add "org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService=true" to use EJB functionality.
+ So OWB container looks for EJBs.
+3* Add "org.apache.webbeans.resource.spi.ResourceService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService to
+use OpenEJB Resource injections.
+4* Add "openwebbeans-ejb", plugin into your web application classpath.
+5* If you want to use other plugins, add respective plugins into your application classpath. For example, if you wish to use
+JSF framework, you add "openwebbeans-jsf" plugin.
+6* Add OWB related interceptor into your EJB Beans. This is called "org.apache.webbeans.ejb.interceptor.OpenWebBeansEjbInterceptor"
+This is needed for OWB injections.
+7* Update your application's "web.xml" to add OWB specific configuration.
+
+---------------------------------------------
+How to Run Samples
+---------------------------------------------
+
+In this release, there are several sample applications located in the "/samples" directory
+of the distribution. You can run those samples via simple maven command.
+
+1) "Guess Application" : Simple usage of the OWB + JSF.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+2) "Hotel Reservation Application" : Show usage of JSF + JPA + OWB
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+3) "EJB Sample Application" : Shows the usage of EJBs with embeddable OpenEJB in Tomcat. Firstly
+configure OpenEJB with Tomcat as explained above.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+4) "EJB Telephone Application" : Shows the usage of OpenEJB resource injection service.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+5) "JMS Injection Sample" : Show JMS injections. JMS injection currently uses
+ ConnectionFactory as JMS connection factory jndi name. You can change this
+ via configuration file. Look above explanation for how to configure JMS jndi. Also,
+ JMS injection requires to use of a JMS provider. Generally Java EE servers contains
+ default JMS provider. It can be run on JBoss and Geronimo. It uses Queue with jndi_name = "queue/A".
+ So you have to create a queue destination in your JMS provider with name "queue/A" to run example.
+ If you want to change queue jndi name, then look at source and change it from "WEB-INF/beans.xml" file.
+
+6) "Conversation Sample" : Shows usage of JSF conversations.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+7) "JSF2 Sample" : Shows usage of JSF2 Ajax.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section. It requires
+to use JSF2 runtime.
+
+
+8) "Standalone Sample" : Shows usage of OpenWebBeans in Standalone Swing Application.
+Look at "OpenWebBeans in Java SE" section.
+
+Configuring and Running the Applications:
+--------------------------------------------
+See section Compile and Run Samples via Jetty&Tomcat Plugin.
+
+--------------------------------------------
+Maven Install and Package From the Source
+--------------------------------------------
+
+Maven Version : Apache Maven 2.2.1 or later
+
+First you have to download the "source" version of the OpenWebBeans project that
+contains the all source code of the OpenWebBeans.
+
+To install the Maven artifacts of the project from the source, Maven must be installed
+in your runtime. After Maven installation, just run the following command in the top level
+directory that contains the main "pom.xml" :
+
+> mvn clean install
+
+This command will install all the Maven artifacts into your local Maven repository.
+
+If you wish to package all artifacts of the project, just run the following command
+in in the top level directory that contains the main "pom.xml" :
+
+> mvn clean package
+
+This command will package the project artifacts from the source and put these artifacts into the each modules
+respective "target" directory.
+
+-------------------------------------------
+Compile and Run Samples via Tomcat&Jetty Plugin
+-------------------------------------------
+This section shows how to run samples in Jetty or OpenEJB Embedded Tomcat.
+
+------------------------------------------
+Samples Run within Jetty Plugin
+------------------------------------------
+You can compile and run "guess","jsf2","conversation-sample" and "reservation "samples via maven Jetty plugin.
+Go to the source bundle "samples/" directory. In the "guess/" or "reservation/" directory, run
+the following maven commands. It will start up maven Jetty container. It bundles all of the
+required jars into the WEB-INF/lib folder. You are not required to add any jar to the classpath.
+
+Samples : Guess and Reservation
+------------------------------
+Go to the source folder of projects and run
+
+> mvn clean install -Pjetty
+> mvn jetty:run -Pjetty
+
+Guess URL : http://localhost:8080/guess
+Reservation URL : http://localhost:8080/reservation
+
+Samples : Conversation Sample and JSF2
+-------------------------------------
+Go to the source folder of projects and run
+
+>mvn clean install
+>mvn jetty:run
+
+Conversation Sample URL : http://localhost:8080/conversation-sample
+JSF2 Sample URL : http://localhost:8080/jsf2sample
+
+------------------------------------------
+Samples Run within Tomcat Plugin
+------------------------------------------
+OpenEJB samples are run with Maven Tomcat Plugin.
+
+Tomcat Plugin uses http://localhost:8080/manager application to deploy war file
+into your embeddable EJB Tomcat container. There must be an tomcat-users.xml
+file in the "conf" directory of the server that contains manager role and username.
+
+>Start Tomcat server if not started
+>mvn tomcat:deploy
+
+Ejb Sample URL : http://localhost:8080/ejb-sample
+Ejb Telephone URL : http://localhost:8080/ejb-telephone
+
+Example tomcat-users.xml file
+------------------------------------------
+<tomcat-users>
+<role rolename="manager"/>
+<user username="admin" password="" roles="manager"/>
+</tomcat-users>
+
+-----------------------------------------
+Deploy JMS Sample
+-----------------------------------------
+Simple drops jms-sample.war file into your application deploy location.
+
+JMS Sample Example URL : Hit the url http://localhost:8080/jms-sample/sender.jsf for sending JMS messages
+ Hit the url http://localhost:8080/jms-sample/receiver.jsf for receiving JMS messages
+
+-----------------------------------------
+OpenWebBeans in Java SE
+----------------------------------------
+OpenWebBeans can be used in Java SE environments such as Java Swing
+applications. A Standalone Sample is provided to show how to use OpenWebBeans
+in Java SE.
+
+Go to the source directory of the standalone sample:
+>mvn clean package;
+>cd target;
+>jar -xvf standalone-sample.jar
+>java -jar standalone-sample-1.1.4-SNAPSHOT.jar
+>Enjoy :)
+
+-----------------------------------------------
+OpenWebBeans User and Development Mailing Lists
+-----------------------------------------------
+Please mail to the user mailing list with any questions or advice
+about the OpenWebBeans.
+
+User Mailing List : [users@openwebbeans.apache.org]
+
+You can also join the discussions happening in the dev list
+
+Dev Mailing List : [dev@openwebbeans.apache.org]
+
+-------------------------------------------
+OpenWebBeans JIRA Page
+-------------------------------------------
+Please logs bugs into the "https://issues.apache.org/jira/browse/OWB".
+
+------------------------------------------
+OpenWebBeans Wiki and Blog Page
+-----------------------------------------
+Wiki: http://cwiki.apache.org/OWB/
+Introduction to OpenWebBeans : http://cwiki.apache.org/OWB/introduction-to-openwebbeans.html
+Blog : http://blogs.apache.org/owb
+
+-----------------------------------------
+OpenWebBeans Web Page
+----------------------------------------
+You can reach the OpenWebBeans web page at
+http://openwebbeans.apache.org
+---------------------------------------
+
+Your Apache OpenWebBeans Team
+
+Enjoy!
diff --git a/owb_1.2.x/readme/README_1_1_5.txt b/owb_1.2.x/readme/README_1_1_5.txt
new file mode 100644
index 0000000..a8d05da
--- /dev/null
+++ b/owb_1.2.x/readme/README_1_1_5.txt
@@ -0,0 +1,1073 @@
+-------------------------------
+Apache OpenWebBeans 1.1.5
+-------------------------------
+Welcome!
+Thanks for downloading and using OpenWebBeans.
+This document is a "Getting Started Guide" for OpenWebBeans.
+
+This document is based on the 1.1.5 release of Apache OpenWebBeans.
+
+--------------------------------
+What is Apache OpenWebBeans?
+--------------------------------
+OpenWebBeans is an Apache License V 2.0 licensed implementation of the JSR-299,
+Contexts and Dependency Injection for the Java EE platform.
+
+It also already incorporates some features which are part of JSR-346 (CDI-1.1)
+but doesn't need API changes as we still use the JCDI-1.0 API. The
+incorporated CDI-1.1 features are mostly parts which are not well
+defined in the CDI-1.0 specification, like Serialisation checks, etc.
+
+Our project's web page can be found at:
+http://openwebbeans.apache.org
+
+The projects WIKI page can be found at:
+https://cwiki.apache.org/confluence/display/OWB/Index
+
+
+--------------------------------
+OpenWebBeans 1.1.5 Release Features
+--------------------------------
+
+- The 1.1.5 release supports the following features
+-----------------------------------
+* Managed Beans Support
+* Session Beans Support (via Embeddable OpenEJB container in Tomcat)
+* Producer Method Support
+* Producer Field Support
+* Java EE Resource Injection Support
+* JMS OpenWebBeans Support(OWB Specific)
+* Inheritance, Stereotype Inheritances
+* Specialization Support
+* Event Support
+* Decorator and Interceptor Support
+* Lookup and Dependency Injection Support
+* Java EE Plugin Support (via ServetContextListener interface)
+* Portable Integration Support
+* Passivation Capability of Beans
+* @Alternative support
+* OSGi environment support with an own plugable bundle ClassPath scanner
+* vastly improved Interceptor performance
+* plugable SecurityManager integration doubles speed if no SecurityManager is being used
+* improved Serialization handling
+* improved CreationalContext handling
+* revised internal logging
+* upgrade to JPA-2 and JSF-2 support
+* support for direct CDI usage in tomcat-6 and tomcat-7 environments
+* optional lenient lifecycle interceptor checking
+* automatically detect if BeanManager#isInUse()
+* improved Serialization checks from the CDI-1.1 specification
+
+
+
+Noteable differences to CDI spec behaviour
+--------------------------------------------
+
+In a few special cases Apache OpenWebBeans might behave a little bit different than
+other CDI implementations. This is to some degree caused by the JSR-299 spec being
+not clear about some special topics so we needed to interpret the wording on our own.
+This mainly concerns the area of section 12.1 Bean Archives (BDA) which doesn't work
+out when it comes to OSGi containers and likes.
+In Apache OpenWebBeans, a settings configured in a beans.xml file of a BDA is not
+only effective for this very bean archive but for the whole BeanManager in control
+of the Application. This is especially the case for <alternatives> and
+<interceptors>! An Alternative, Interceptor or Decorator enabled in one BDA is active
+for the whole Application. This behaviour will most likely also be the default behaviour
+in the CDI-1.1 JSR-346 specification.
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.5
+-------------------------------------------
+
+Bug
+
+ * [OWB-498] - Java EE Resource Injections for CDI Interceptors & Decorators
+ * [OWB-605] - tomcat plugins must register WebBeansConfigurationListener as first Listener
+ * [OWB-663] - Maven dependencies between impl and spi
+ * [OWB-666] - invalid check in AnnotationManager#checkStereoTypeClass
+ * [OWB-667] - Bean queries have strange behavior (difference between Open Web Beans and the Reference Implementation)
+ * [OWB-669] - Bean fail over is not in sync with specs
+ * [OWB-672] - Decorators creates Stackoverflow or NPE if under heavy load
+ * [OWB-673] - injecttarget are not updated after ProcessInjectionTarget event
+ * [OWB-676] - CdiTest OwbContainer fails if WebContainerLifecycle is being used
+ * [OWB-677] - improve getBeans cache key algorithm
+ * [OWB-680] - drop unused getInstance() methods from our services
+ * [OWB-681] - remove deprecated methods from BeanManagerImpl
+ * [OWB-682] - get rid of OWB InterceptorType and usejavax.enterprise.inject.spi.InterceptionType instead
+ * [OWB-683] - remove obsolete Methods from our Bean implementations and handlers
+ * [OWB-685] - OwbApplicationFactory doesn't set Application
+ * [OWB-686] - OWBApplicationFactory wrappedApp should be consistent between getter and setter and volatile
+ * [OWB-687] - clean up non-static loggers
+ * [OWB-688] - fix non-serializable fields in Serializable classes
+ * [OWB-689] - OWBInjector should be stateless
+ * [OWB-690] - WebContextsService cleanup should get reworked
+ * [OWB-693] - webbeans-web shall not declare StandaloneResourceInjectionService
+
+Improvement
+
+ * [OWB-674] - rewrite owb logger api
+ * [OWB-684] - move from ancient 'ContextTypes' definition to standadrd scope annotations
+
+Task
+
+ * [OWB-678] - Check for unused classes and remove them
+ * [OWB-691] - Sonar cleanup before the 1.1.5 release
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.4
+-------------------------------------------
+
+Bug
+
+ * [OWB-567] - Lookup of Provider results in NullPointerException on get()
+ * [OWB-574] - NewBean doesn't support EJBs
+ * [OWB-580] - ObserverMethodImpl needs support for EJB's whose Bean Types do not include the EJB class
+ * [OWB-602] - OpenWebBeans OpenEJB integration OSGi bundle declares the wrong version for the javax.transaction package
+ * [OWB-617] - NullPointerException in InstanceBean#createInstance
+ * [OWB-628] - Event injection doesn't work in observer methods.
+ * [OWB-633] - define stereotypes & thirdparty
+ * [OWB-634] - @Interceptors added by extension ignored
+ * [OWB-636] - Samples point to parent pom file that doesn't exist
+ * [OWB-643] - it isn't possible to add/remove @Alternative during the bootstrapping process
+ * [OWB-644] - wrong config entry for LoaderService
+ * [OWB-645] - InjectionPoint is null when using @Produces. NullPointerException caused by CDI container providing a null InjectionPoint into a producer method.
+ * [OWB-646] - Failover does not work (again)
+ * [OWB-648] - regression on tck org.jboss.jsr299.tck.tests.lookup.injectionpoint.InjectableReferenceTest
+ * [OWB-649] - exceptions in EJB's are wrapped in InvocationTargetException
+ * [OWB-655] - CDI doesn´t inject stateless EJB by abstract class.
+ * [OWB-658] - BeanManager.getBeans(Type, Annotation...) can not be used to query all known beans
+ * [OWB-659] - An annotated interface class is being seen as a manage bean.
+ * [OWB-660] - WebBeansContext #activateContext for SessionScoped.class doesn't set the ThreadLocal
+
+Improvement
+
+ * [OWB-596] - Provide info about injetion point for "Passivation capable beans must satisfy passivation capable dependencies ..."
+ * [OWB-604] - more details for exceptions during bootstrapping
+ * [OWB-635] - support callbacks (@PostContrcut, @PreDestroy) in Extensions
+ * [OWB-637] - [perf] ELContextStore.destroyDependents() creates unnecessary HashMap$KeyIterator instances
+ * [OWB-638] - [PERF] Avoid unnecessary AbstractList$Itr instances
+ * [OWB-639] - [perf] InjectionResolver.getBeanCacheKey creates many StringBuilder instances
+ * [OWB-641] - the jee5-ejb-resource module should support @EJB(mappedName)
+ * [OWB-647] - [PERF] Avoid unnecessary StringBuilder instances - improve checkNullInstance, checkScopeType, ... methods
+ * [OWB-653] - remove @ViewScoped support
+ * [OWB-657] - review startup performance
+ * [OWB-661] - hashCode, equals and toString() of our built in Qualifier Literals should be implemented ourselfs
+
+Task
+
+ * [OWB-656] - remove webbeans-openejb
+ * [OWB-662] - remove obsolete class WebBeansAnnotation
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.3
+-------------------------------------------
+
+Bug
+
+ * [OWB-515] - interceptors don't support inheritance without an overridden method annotated with @AroundInvoke
+ * [OWB-565] - missing check for producer methods
+ * [OWB-625] - BeanManager.resolve throw java.util.NoSuchElementException with an empty set parameter
+ * [OWB-629] - NoClassDefFoundError for optional dependencies
+ * [OWB-630] - AmbiguousResolutionException thrown for Decorators that Decorate multiple beans where any of those beans are passivation capable.
+ * [OWB-631] - openwebbeans-resource misses openwebbeans.properties
+
+Improvement
+
+ * [OWB-475] - support for optional beans
+ * [OWB-627] - Automatically destroy @Dependent contextual instances created with Instance<T>
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.2
+-------------------------------------------
+
+Bug
+
+ * [OWB-562] - non-enabled alternative beans with passivating scope fail validation during deployment
+ * [OWB-589] - " ... requires a passivation capable dependency ..." for producer method with return type String and non serializable injected dependency
+ * [OWB-597] - StackOverFlow when injecting product in same bean where @Produces is placed
+ * [OWB-615] - remove @Overrides for interfaces to be java5 compatible
+ * [OWB-616] - javax.el.ExpressionFactory has final methods! CDI doesn't allow that. - Test on final **PRIVATE** methods too?
+ * [OWB-618] - we sometimes invoke a dispose method without having created the bean upfront
+ * [OWB-619] - @New beans must only exist if there is at least one injection point for them
+ * [OWB-620] - any disabled bean of passivating scope will wrongly be detected as 'not passivatable'
+ * [OWB-622] - beanmanager injection in afterBeanDiscovery method parameter
+ * [OWB-624] - AnnotatedTypes registered in BeforeBeanDiscovery might get processed twice
+
+Improvement
+
+ * [OWB-623] - Relax check on @AroundInvoke Interceptors 'throws Exception'
+
+New Feature
+
+ * [OWB-621] - Alternative configuration method for buggy container or pre servlet api 2.5 container
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.1
+-------------------------------------------
+
+Bug
+
+ * [OWB-406] - BaseEjbBean.removedStatefulInstance used by multiple instances/EjbBeanProxyHandlers
+ * [OWB-447] - unnecessary contextual/non-contextual distinction in OpenWebBeansEJBIntercpetor
+ * [OWB-449] - EJB interceptor has incorrect/unnecessary use of business method checks
+ * [OWB-483] - Problem with mulitple custom interceptors and passivation
+ * [OWB-512] - ApplicationContext and SingletonContext in WebContextsService
+ * [OWB-554] - DelegateHandler wraps Beans exceptions
+ * [OWB-558] - PassivationCapable bean id's for Producer Fields do not take into account generics
+ * [OWB-561] - Multiple contexts with the same Scope are not handled properly -- causing tck failures
+ * [OWB-563] - producers of passivating beans fail when the declared return type is not serializable but the actual return type is
+ * [OWB-566] - ProcessInjectionTarget event gets fired too early
+ * [OWB-571] - fix site build under maven3 and upgrade logo
+ * [OWB-573] - Invalid checking of Interceptor serialization capabilities for non-Passivation capable EJBs
+ * [OWB-576] - FileNotFoundException on WebSphere
+ * [OWB-577] - FileNotFoundException on WebSphere
+ * [OWB-578] - Allow DI for OpenWebBeansConfiguration properties
+ * [OWB-579] - check for non-proxyiable methods should exclude synthetic methods
+ * [OWB-581] - Decorator interface check needs configurable exclusions
+ * [OWB-584] - check for declared name consistency for specializes beans is wrong
+ * [OWB-585] - ProcessSessionBean doesn't deal with generic type quite right (CDITCK-215)
+ * [OWB-586] - Interceptors added by portable extensions don't work
+ * [OWB-587] - Use business interface for producer and disposer methods of Session beans
+ * [OWB-588] - PrincipalBean is misspelled
+ * [OWB-590] - Seam Persistence does not work with OWB - AfterBeanDiscovery.addBean will be ignored
+ * [OWB-591] - EJB @Specializes inheritance
+ * [OWB-593] - Interceptor binding added on an interceptor class at ProcessAnnotatedType phase is not considered
+ * [OWB-595] - Use case "Faces Request Generates Non-Faces Response" locks conversation forever (-> BusyConversationException)
+ * [OWB-598] - InjectionResolver crashes with a NPE when injecting a method parameter
+ * [OWB-599] - move getBeanXmls() back to Set<URL>
+ * [OWB-600] - cache information about non intercepted methdos in ProxyHandlers
+ * [OWB-601] - WebContextsService only works if ServletContext is given
+ * [OWB-608] - openwebbeans-el10 plugin misses openwebbeans.properties
+ * [OWB-614] - add LICENSE and NOTICE files to all our samples
+
+Improvement
+
+ * [OWB-555] - ClassUtil methods contain spelling, camelcase, etc., type errors
+ * [OWB-557] - #setAccessible(false) isn't needed
+ * [OWB-560] - upgrade the TCK to 1.0.4.SP1
+ * [OWB-564] - CdiTestOpenWebBeansContainer - check if a std.-context is active before destroying it
+ * [OWB-582] - Support for Java 1.5 (needed for WebSphere 6.1)
+ * [OWB-583] - Support for Servlet API 2.4 (needed for WebSphere 6.1)
+ * [OWB-594] - create a configurable mapping Scope->ProxyMethodHandlerImplementation
+ * [OWB-607] - upgrade our samples to newest available dependencies
+ * [OWB-610] - upgrade to apache parent pom 10
+ * [OWB-611] - adding ASF trademark documentation to our official site build
+ * [OWB-612] - upgrade various maven plugins
+ * [OWB-613] - Exclude Samples WARs Publishing with Maven
+
+Task
+
+ * [OWB-592] - EJB Specialization utility method
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.0
+-------------------------------------------
+
+Bug
+
+ * [OWB-295] - resolve bugs in Javassist Proxy
+ * [OWB-417] - BaseEjbBean.destroyComponentInstance() should call direct container remove API, not call an @Remove annotated method
+ * [OWB-422] - Support needed for PrePassivate, PostActivate, and AroundTimeout via EJBInterceptor.
+ * [OWB-444] - Using Static Loggers in Shared ClassLoader
+ * [OWB-452] - set active flag to false then context is destroyed
+ * [OWB-456] - When multiple interceptors are defined for a bean OWB does NOT correctly remove the overridden base Interceptors
+ * [OWB-469] - JSR299TCK: Security Error / Passivation errors during readObject
+ * [OWB-470] - OWBInjector does not work correctly for EJB Beans
+ * [OWB-471] - Possible StackOverflowException from defineProducerMethods in WebBeansAnnotatedTypeUtil
+ * [OWB-473] - bundles that use javasissist to proxy their contents need to import some javassist packages
+ * [OWB-474] - InjectionTargetBean#injectSuperResources is missing
+ * [OWB-477] - Two instances of using ObjectInputStream that may not have visibility into application classloader
+ * [OWB-480] - Avoid a couple NPEs
+ * [OWB-482] - Small issues
+ * [OWB-486] - ResourceBean tries to proxy final classes before testing them for being final
+ * [OWB-489] - AnnotatedTypes added with BeforeBeanDiscovery.addAnnotatedType method are ignored
+ * [OWB-490] - ProcessObserverMethod Type parameters are inverted (CDITCK-174)
+ * [OWB-491] - Decorators init needs to scan superclasses for more interfaces. cf CDITCK-178
+ * [OWB-492] - events don't get sent to private @Observes methods
+ * [OWB-493] - ProcessProducerMethod and ProcessProducerField type parameters are reversed in filtering (?) CDITCK-168
+ * [OWB-494] - Subclasses with non-overriden observer methods not recognized as beans with observer methods
+ * [OWB-496] - Don't replace the ProxyFactory classloaderProvider without the intention to do so
+ * [OWB-499] - WEB-INF/beans.xml of a war will not activate Bean Archive behaviour
+ * [OWB-502] - Only cache the ContextService once, in the SingletonService
+ * [OWB-504] - OwbApplicationFactory getWrapped should return wrapped application factory
+ * [OWB-505] - OwbApplicationFactory should not be installed by default
+ * [OWB-509] - Unwrap InvocationTargetException in ResourceProxyHandler.invokie
+ * [OWB-510] - return null instead of an unusable proxy if a resource is missing
+ * [OWB-511] - Delegate actualInstance serialization behavior in ResourceProxyHandler
+ * [OWB-514] - Leak in ELContextStore
+ * [OWB-519] - broken wls support
+ * [OWB-521] - ProducerMethodBean could theoretically produce a NPE
+ * [OWB-522] - Missing updateTimeout in one of begin methods for conversation
+ * [OWB-523] - @SessionScoped bean failover does not work
+ * [OWB-524] - OWB classpath scanning of non-jars doesn't work if the classpath contains spaces
+ * [OWB-527] - JspFactory.getDefaultFactory() is synchronized, We can cache the return value to improve performance
+ * [OWB-529] - lazy initialized class members should be volatile
+ * [OWB-530] - multi massive execution of our Interceptor test unveils a concurrency problem
+ * [OWB-531] - cleanup WebBeansELResolver#getValue
+ * [OWB-533] - concurrency bottleneck due to use of our logger
+ * [OWB-534] - Injection of @PersistenceContext does not work with abstract/base classes
+ * [OWB-541] - replace WeakHashMap with a standard one in InterceptorHandler
+ * [OWB-542] - Disposer is called twice on Dependent beans when injected into a managed object that is called from a JSP
+ * [OWB-543] - get rid of checked Exceptions in our SPI
+ * [OWB-545] - Cleanup our SecurityManager integration
+ * [OWB-546] - @Typed gets ignored if we use a AnnotatedType from an Extension @Observing ProcessAnnotatedType
+ * [OWB-547] - WebContextsService throws NPE on asynchronous app startup
+ * [OWB-548] - missing null check in DefaultContextsService#stopApplicationContext
+ * [OWB-550] - duplicated observer methods in case of @Specializes
+
+Improvement
+
+ * [OWB-209] - remove all <repositories> from our poms
+ * [OWB-254] - suppress initialising contextual handling for configurable URIs.
+ * [OWB-335] - implement a sample for @ViewScoped in reservation
+ * [OWB-393] - remove old XML configuration code
+ * [OWB-448] - More changes for decorator and interceptor passivation support
+ * [OWB-461] - source code quality
+ * [OWB-472] - archive centric beans.xml enabling
+ * [OWB-478] - make OWB build maven-3 aware
+ * [OWB-485] - AmbiguousResolutionException doesn't print details about the injection point
+ * [OWB-500] - improved app-server support
+ * [OWB-503] - Reduce static synchronized hashmap usage
+ * [OWB-506] - Upgrade our samples to Apache MyFaces-2.0.3 and OpenJPA-2.0.1
+ * [OWB-507] - our samples should be prepared for EE as default
+ * [OWB-508] - Dependent scope proxies are needed to wrap the build-in beans returned from the services if they are not serializable yet
+ * [OWB-516] - Get TCK standalone 1.0.4 CR2
+ * [OWB-517] - Conversation Log Improvement
+ * [OWB-518] - log all bean-archive markers
+ * [OWB-520] - spi for the webbeans-jee5-ejb-resource plugin
+ * [OWB-525] - create a findbugs filter file in our build-tools resource
+ * [OWB-526] - remove usage of java.net.URLs from ScannerService and drop scannotation
+ * [OWB-535] - free ScannerService resources once we don't need it anymore
+ * [OWB-536] - revisit our Logger usage in our Bean impls
+ * [OWB-537] - clear() AnnotatedElementFactory after the deployment
+ * [OWB-539] - fill AnnotatedTypeImpl lazily
+ * [OWB-540] - StandaloneResourceInjectionService should cache info about classes which don't contain EE resource injection points
+ * [OWB-544] - improve BeanManager#getContext performance
+
+New Feature
+
+ * [OWB-433] - add a configuration flag for switching to a lenient lifecycle interceptor checking
+ * [OWB-501] - owb ee 5 resource integration
+ * [OWB-528] - Use ApplicationWrapper as parent of OwbApplication in JSF 2 plugin
+ * [OWB-532] - create a new BeanManager#isInUse()
+ * [OWB-538] - lazy loading of not explicitly marked (via annotation or registered by extension) Dependent beans
+
+Question
+
+ * [OWB-383] - static fields in CreationalContext
+
+TCK Challenge
+
+ * [OWB-484] - Running TCK 1.0.1 Final and Respective Corrections
+
+Task
+
+ * [OWB-19] - Geronimo Integration
+ * [OWB-428] - implementation of equals and hashCode for AbstractOwbBean
+ * [OWB-453] - add a flag to disable context activation in EJB interceptor
+
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0
+-------------------------------------------
+
+Bug
+
+ * [OWB-318] - multiple methods with same EJB @interceptors(foo.class) in same bean class get multiple interceptor instances
+ * [OWB-384] - OWB needs to call 299-defined PrePassivate, PostActivate, and AroundTimeout interceptors for EJBs
+ * [OWB-422] - Support needed for PrePassivate, PostActivate, and AroundTimeout via EJBInterceptor.
+ * [OWB-429] - OpenWebBeansEjbPlugin Class Hierarchy
+ * [OWB-438] - Cached Normal Scoped Proxy instances
+ * [OWB-439] - EjbPlugin session bean proxy creation thread safe problem
+ * [OWB-445] - we must not use javassist ProxyFactory#setHandler(MethodHandler)
+ * [OWB-446] - EJB lifecycle callbacks not stacked correctly
+ * [OWB-450] - NullPointerException in DependentScopedBeanInterceptorHandler when it has a NullCreationalContext (normally from a EE component).
+ * [OWB-454] - ClassUtil.callInstanceMethod() doesn't propogate original exception
+ * [OWB-455] - IllegalArgument method calling remove method of EJB during destroy
+ * [OWB-456] - When multiple interceptors are defined for a bean OWB does NOT correctly remove the overriden base Interceptors
+ * [OWB-457] - we must not create a SessionContext for static resource reqeusts
+ * [OWB-460] - fix owb-openejb and owb-ejb artifactIds
+ * [OWB-464] - InjectionPointImpl using wrong class loader during serialize/deserialize, dropping qualifiers, and omiting qualifier values.
+ * [OWB-466] - Ensure removal of all ThreadLocal values
+
+Improvement
+
+ * [OWB-177] - Handling of InterceptionType#POST_ACTIVATE, PRE_PASSIVATE and AROUND_TIMEOUT is missing
+ * [OWB-407] - detailed information about exceptions
+ * [OWB-451] - Allow InterceptorUtil#callAroundInvokes to propogate a callers 'creational context key'
+ * [OWB-459] - upgrade to newer library versions
+ * [OWB-463] - EjbDefinitionUtility.defineEjbBeanProxy() should be able to create proxies for no-interface local beans
+ * [OWB-465] - enhance EJB common code for crude @LocalBean support
+
+TCK Challenge
+
+ * [OWB-394] - Any idea why our BeforeBeanDiscovery.addInterceptorBinding() has different signature?
+
+Task
+
+ * [OWB-453] - add a flag to disable context activation in EJB interceptor
+ * [OWB-462] - Refactor AnnotationUtil.hasAnnotationMember()
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0-alpha-2
+-------------------------------------------
+Bug
+
+ * [OWB-303] - upgrade Javassist to a newer version
+ * [OWB-338] - our internal SessionContext and ConversationContext must support Session serialization
+ * [OWB-385] - implement passivation of managed beans in ServletContextListener
+ * [OWB-401] - ELContextStore not cleaned up for some JSP EL lookups
+ * [OWB-402] - OpenWebBeansJsfPlugin does not recognize @ManagedBean
+ * [OWB-404] - Contexts must not get stored in a static Map in BeanManager
+ * [OWB-405] - AnnotatedElementFactory must not use static cache maps
+ * [OWB-408] - NPE in WebBeansELResolver
+ * [OWB-415] - EjbBeanProxyHandler for dependent ejb must save ejb instance
+ * [OWB-416] - BaseEJBBean.destroyComponentInstance() tries to call multiple remove methods
+ * [OWB-418] - EjbBeanProxyHandler must be 1:1 with proxy instances for dependent SFSB
+ * [OWB-419] - fix @Dependent handling in ELResolver
+ * [OWB-420] - SingletonContext is mapped to @ConversationScoped
+ * [OWB-421] - defined-in-class EJB lifecycle callbacks masked by our Interceptor
+ * [OWB-426] - Tweak EJBPlugin to work with Standalone Tests
+ * [OWB-431] - Generic Type Inheritance not resolved correctly
+ * [OWB-434] - ThreadLocal<SingletonContext> doen't get cleaned up
+ * [OWB-436] - AbstractContext bean instance creation is not thread safe
+ * [OWB-437] - Improve AbstractContext synchronization
+ * [OWB-440] - WebBeansDecoratorConfig.getDecoratorStack always returns new Decorators
+ * [OWB-442] - our EJB proxies are broken when multiple local interfaces are used on a single class
+ * [OWB-443] - Normal-scoped EJB not removed by container during Contextual.destroy()
+
+Improvement
+
+ * [OWB-57] - cleanup problems found by maven-findbugs-plugin
+ * [OWB-195] - Give warning to the developer related with non- portable operations
+ * [OWB-409] - create a name for OWB our faces-config.xml
+ * [OWB-410] - lazy initialisation of ejbInterceptors
+ * [OWB-411] - cache calls to isNormalScope()
+ * [OWB-412] - Allow container specific extensions to WebConfigurationListener access to the lifecycle
+ * [OWB-413] - cache calls to ClassUtils#getObjectMethodNames()
+ * [OWB-414] - improve Interceptor performance
+ * [OWB-425] - improve performance of owb-el-resolver
+ * [OWB-427] - improve read-performance of AbstractOwbBean
+ * [OWB-430] - improve performance of WebBeansPhaseListener
+ * [OWB-432] - Create Singleton Service SPI
+ * [OWB-441] - new configuration properties mechanism
+
+Sub-task
+
+ * [OWB-193] - If an interceptor or decorator has any scope other than @Dependent, non-portable behavior results.
+ * [OWB-194] - If an interceptor or decorator has a name, non-portable behavior results.
+ * [OWB-196] - If an interceptor or decorator is an alternative, non-portable behavior results.
+ * [OWB-197] - If a stereotype declares any other qualifier an- notation, non-portable behavior results.
+ * [OWB-198] - If a stereotype is annotated @Typed, non-portable behavior results.
+
+
+TCK Challenge
+
+ * [OWB-424] - Adding Document for How to Configure and Run TCK (standalone and web profile TCKs)
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0-alpha-1
+-------------------------------------------
+Bug
+
+ * [OWB-216] - Update pom.xml svn links
+ * [OWB-231] - exception using abstract decorators
+ * [OWB-245] - Using parameterized type varaibles fails for Producer Method injection
+ * [OWB-259] - Implement spec 11.5.5. ProcessModule event
+ * [OWB-289] - Owb return 2 beans for Indirect specialized producer beans
+ * [OWB-302] - InjectionPoint injections (both method and field based) in Decorators result in null
+ * [OWB-312] - Add dopriv's to allow OWB to function with java 2 security enabled
+ * [OWB-317] - creationalContext in InvocationContextImpl is always null
+ * [OWB-318] - multiple methods with same EJB @interceptors(foo.class) in same bean class get multiple interceptor instances
+ * [OWB-327] - annotating an Interceptor with @ApplictionScoped leads to OutOfMemory
+ * [OWB-329] - Interceptor instances get created each time the interceptor gets called
+ * [OWB-332] - Destroy Depdent Of Producer Method Beans when Invocation Completes
+ * [OWB-333] - InjectionTarget and Producer Handling
+ * [OWB-334] - cid is missing when using redirect for a jsf 2.0 application
+ * [OWB-336] - injected BeanManager must be Serializable
+ * [OWB-337] - events must not get broadcasted to beans which have no active Context
+ * [OWB-339] - Injecting Non-Contextual Beans Causes NPE in WebBeansUtil
+ * [OWB-340] - BeanManagerImpl.createInjectionTarget() Throws Exception When No Constructor Found
+ * [OWB-341] - CreationalContext#incompleteInstance should get cleaned after create()
+ * [OWB-342] - InterceptorHandler crashes with NullPointerException after deserialisation
+ * [OWB-343] - upgrade JPA spec from 1.0-PFD2 to 1.0 final revision
+ * [OWB-345] - Remove duplicate dependencies
+ * [OWB-351] - OWB picks up @SessionScoped contextual instances from expired sessions
+ * [OWB-352] - Thread Safety Problem in our InterceptorHandlers, aka proxies
+ * [OWB-353] - NPE in removeDependents@CreationalContextImpl
+ * [OWB-354] - WebContextService may throw NPE in tiered classloading environmemt
+ * [OWB-357] - WebbeansFinder should index first on ClassLoader, not singleton type
+ * [OWB-359] - ownerCreationalContext sometimes causes NPE in InterceptorDataImpl.createNewInstance()
+ * [OWB-361] - underlying EJB method not actually in our interceptors stack
+ * [OWB-362] - InvocationTargetException when invoking Stateless SessionBean
+ * [OWB-363] - Intermittent bug with ApplicationScope disposers not being called
+ * [OWB-366] - ContextNotActiveException fired from AppScope/NormalScopedBeanInterceptorHandler when a proxied object finalized
+ * [OWB-368] - The 299 spec (that I have) uses receive=IF_EXISTS but OWB uses notifyObserver=IF_EXISTS.
+ * [OWB-369] - Static ContextsService in ContextFactory causes wrong webContextService used for multiple applications
+ * [OWB-370] - Intransient Conversation context get rdestroyed randomly by destroyWithRespectToTimout
+ * [OWB-371] - no lifecycle interceptors for non-contextual EJB
+ * [OWB-372] - creational context not cleaned up for non-contextual EJB interceptions
+ * [OWB-373] - build crashes with missing artifact error
+ * [OWB-374] - migrate jsf2sample from sun to MyFaces
+ * [OWB-376] - [patch] Guess example broken with Jetty plugin 6.x due to EL 2.2
+ * [OWB-377] - revise logging
+ * [OWB-378] - ejb at bottom of decorator stack doesn't handle changed method
+ * [OWB-380] - NormalScopedBeanInterceptorHandler throws NPE when handling 3rd party Contexts
+ * [OWB-381] - NPE thrown from AbstractInjectable if dependent producer returns null
+ * [OWB-382] - injecting a @Dependent bean into a passivatation scoped bean causes a NonSerializableException
+ * [OWB-387] - DependentContext Interceptor Double Call for PostConstruct
+ * [OWB-390] - fix broken links in our 'site'
+ * [OWB-396] - fix poms to work with maven 3
+ * [OWB-398] - DelegateHandler cached too agressively
+ * [OWB-399] - Proxy objects could not be correctly deserialized by using javassist 3.11. we need to update to 3.12
+ * [OWB-400] - starting OWB as part of an EAR in geronimo causes a exception due to missing 'bundle' protocol
+
+Improvement
+
+ * [OWB-116] - Update Business Method Definition
+ * [OWB-118] - Supports Decorators for Other Delegate Injections
+ * [OWB-136] - fix 'broken' license headers in our java files
+ * [OWB-170] - Address findbug issues in webbeans-impl
+ * [OWB-183] - Improve webbeans-doc module to get a documentation more user friendly
+ * [OWB-214] - get rid of javax.transaction.Transaction dependency in webbeans-impl
+ * [OWB-237] - NoSuchElementException when WebBeansConfigurationListener is absent
+ * [OWB-275] - remove unused imports and cleanup code
+ * [OWB-286] - java.lang.NoClassDefFoundError: javax/validation/Validator
+ * [OWB-313] - create caching strategies for resolving Bean<T> for BeanManager and EL invocations
+ * [OWB-314] - cache resolved instances in NormalScopedBeanMethodHandlers of @ApplicationScoped beans
+ * [OWB-315] - cache resolved instances in NormalScopedBeanMethodHandlers of @SessionScoped beans
+ * [OWB-319] - Strange logging when writing non-Serializable SessionScoped bean
+ * [OWB-320] - Remove Java EE Dependencies from WebBeans Core
+ * [OWB-322] - Create new EJB project and separate common EJB classes from OpenEJB plugin
+ * [OWB-325] - Relocate SPI Classes to SPI Module. Change JSR299, JSR330 as optional pom dependency.
+ * [OWB-326] - improve producer tests
+ * [OWB-328] - improve logger performance
+ * [OWB-330] - reduce BeanManagerImpl#getManager() calls inside the same functions
+ * [OWB-331] - Cache Interceptor & Decorator Stack oon Interceptor Handler
+ * [OWB-346] - Make EJB samples running
+ * [OWB-347] - Using InjectableBeanManager in TCK
+ * [OWB-349] - ignore exception during type hierarchy scan
+ * [OWB-350] - Support Interceptor for non-contextual EJBs
+ * [OWB-355] - OpenEjbBean should look for @Remove methods
+ * [OWB-356] - EjbPlugin only looks for DeployementInfo once, so new deployed application won't be discovered
+ * [OWB-358] - provide property to skip injection in @PostConstruct of OpenWebBeansEjbInterceptor
+ * [OWB-360] - Add BeanManager to a ServletContext attribute
+ * [OWB-364] - Reduce the amount of info level logging
+ * [OWB-365] - make injection optional in OWBEJBInterceptor
+ * [OWB-375] - Performance: OWB logging performs operations when logging disabled.
+ * [OWB-379] - upgrade to final atinject-spec artifact
+ * [OWB-386] - upgarde CDI TCK to 1.0.2.CR1
+ * [OWB-389] - atinject-tck upgrade to final 1.0 release
+ * [OWB-397] - Add helper method and some debug to WebBeansFinder
+
+New Feature
+
+ * [OWB-316] - Implement a generic TestContainer for CDI implementations
+ * [OWB-323] - Provide methods to pass classloader into ServiceLoader and WebBeansFinder for use in tiered classloader situations
+ * [OWB-324] - Add Tomcat Plugin
+ * [OWB-348] - Adding Interceptor and Decorator Support for EJB Beans
+ * [OWB-395] - OpenWebBeans Tomcat 7 Support
+
+TCK Challenge
+
+ * [OWB-388] - Pass TCK 1.0.2 CR1 Web Profile
+
+Task
+
+ * [OWB-6] - Scope passivation
+ * [OWB-14] - Update WebBeans Lifecycle for Servlet Beans
+ * [OWB-46] - Injection into non-contextual objects
+ * [OWB-204] - Update Samples for JSF2 Usage
+ * [OWB-220] - Update site.xml links and bread crumbs to point to non-incubator.
+ * [OWB-310] - Drop dom4j and use jre builtin xml parsers for processing beans.xml
+ * [OWB-391] - create a owb-build-tools project to maintain project specific checkstyle rules, etc.
+
+Test
+
+ * [OWB-56] - Integrate the official JSR-299 TCK test suite
+ * [OWB-222] - Update website download link, and fix relative URL translation
+ * [OWB-367] - Add a unit test for IF_EXISTS
+
+
+----------------------------------------------
+Required Platform
+----------------------------------------------
+Java Version : Java SE >= 5.0
+Java EE Must : Java EE >= 5.0
+
+---------------------------------------------
+How to Configure OpenWebBeans
+---------------------------------------------
+
+This section explains a content of the distribution bundle, OWB plugins and its
+dependent libraries.
+
+---------------------------------------------
+1.1.5 Distribution Content
+---------------------------------------------
+There are several jars in the OpenWebBeans 1.0.0 distribution;
+
+ - openwebbeans-impl-1.1.5.jar --> Includes Core Dependency Injection Service.
+ - openwebbeans-ejb-1.1.5.jar --> EJB Plugin(Supports EJBs in OpenEJB embedded in Tomcat).
+ - openwebbeans-jms-1.1.5.jar --> JMS Plugin(Supports injection of JMS related artifacts,i.e, ConnectionFactory, Session, Connection etc.)
+ - openwebbeans-jsf-1.1.5.jar --> JSF-2.0 Plugin(JSF Conversation Scoped Support).
+ - openwebbeans-jsf12-1.1.5.jar --> JSF-1.2 Plugin(JSF Conversation Scoped Support).
+ - openwebbeans-resource-1.1.5.jar --> Java EE Resource Injection for Web Projects (Includes @PersistenceContext,@PersistenceUnit
+ and @Resource injection into the Managed Beans. @Resource injections use java:/comp/env of the
+ Web application component. @PersistenceContext is based on extended EntityManager.
+ - openwebbeans-spi-1.1.5.jar --> OpenWebBeans Server Provider Interfaces. They are implemented by runtime environments that would
+ like to use OpenWebBeans as a JSR-299 implementation.
+ - samples --> Includes source code of the samples. Samples are mavenized project therefore you can easily build and run
+ them from your environment that has maven runtime.
+ - openwebbeans-osgi-1.1.5.jar --> ClassPath ScannerService SPI implementation for OSGI environments like Apache Geronimo-3
+ - openwebbeans-web-1.1.5.jar --> Basic Servlet integration
+ - openwebbeans-tomcat6-1.1.5.jar --> Support for deeper integration into Apache Tomcat-6
+ - openwebbeans-tomcat7-1.1.5.jar --> Support for deeper integration into Apache Tomcat-7
+
+
+
+
+------------------------------------------
+How OWB Plugins Work
+------------------------------------------
+
+OpenWebBeans has been developed with a plugin architecture. The Core dependency injection service
+is provided with openwebbeans-impl. If you need further service functionality,
+you have to add respective plugin jars into the application classpath. OpenWebBeans
+uses the Java SE 6.0 java.util.ServiceLoader mechanism to pickup plugins at runtime.
+If you run under Java SE 5.0, an similar hand written implementation will be used.
+Please do not confuse OWB plugins with portable Extensions! OWB plugins are for
+internal use only whereas portable CDI Extensions will run on any JSR-299 container.
+
+Current Plugins:
+---------------------
+Look at "1.1.5 Distribution Content" above.
+
+------------------------------------------
+Dependent Libraries
+------------------------------------------
+
+Third Party jars:
+-----------------
+They are necessary at runtime in the Core Implementation.
+
+javassist : Version 3.12.0.GA
+scannotation : Version 1.0.2 (if not running in an OSGi environment like Apache Geronimo-3)
+
+Java EE APIs jars(Container Provider Libraries) :
+-------------------------------------------------
+Generally full Java EE servers provides these jars. But web containers like Tomcat or Jetty
+do not contain some of them, such as JPA, JSF, Validation API etc. So, if you do not want to bundle
+these libraries within your application classpath, you have to include these libraries in your
+server common classpath.
+
+jcdi-api (JSR-299 Specification API)
+atinject-api (JSR-330 Specification API)
+servlet-2.5 or servlet 3.0 (Servlet Specification API)
+ejb-3.1 (EJB Specification API)
+el-2.2 (Expression Langauge Specification API)
+jsf-2.0 (Java Server Faces API)
+jsr-250 (Annotation API)
+interceptor-1.1 (Interceptor API)
+jta-1.1 (Java Transaction API)
+jsp.2.1 or jsp-2.2 (Java Server Pages API)
+jpa-2.0 (Java Persistence API)
+jaxws-2.1 or jaxws-2.2 (Java Web Service API)
+jms-1.1 or jms-1.2 (Java Messaging Service API)
+validation (Validation Specification)
+
+Dependencies of OpenWebBeans Maven Modules&Plugins
+--------------------------------------------------
+
+openwebbeans-impl :
+------------------
+Third party : javassist, scannotation, openwebbeans-spi
+Container Provided : jcdi-api, at-inject, servlet, el, jsr-250, interceptor, jta, jsp, validation
+
+openwebbeans-ejb:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : OpenWebBeans EJB plugin is based on OpenEJB in Tomcat. Therefore, if you install OpenEJB
+ within Tomcat correctly, there is no need to add any additional libraries. Look at the
+ OpenEJB in Tomcat configuration section.
+
+openwebbeans-jms:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : jms
+
+openwebbeans-jsf:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : jsf
+
+NOTE : We are trying to decrease dependent libraries of the our core, i.e, openwebbeans-impl.
+At 1.1.5, dependent third party libraries will be decreased. We have a plan to create profile
+plugins, therefore each profile plugin provides its own dependent libraries. For example, in
+fully Java EE Profile Plugin, Transaction API is supported but this will not be the case
+for Java Web Profile Plugin or Java SE Profile Plugin. Stay Tuned!
+
+Currently, as you have seen above, openwebbeans-impl depends on some Java EE/Runtime
+provided libraries (servlet, jsp, el etc). In the future, with OpenWebBeans profiling support,
+openwebbeans-impl will not depend on any Java EE APIs. Those APIs will be provided
+by OpenWebBeans profiles/plugins that openwebbeans-impl will be used. Therefore,
+you will able to use OpenWebBeans in your own runtime environment easily by writing
+your own plugins and contributing it to OpenWebBeans :)
+
+------------------------------------------
+Library Configuration
+------------------------------------------
+To run openwebbeans applications in the Java EE based application server,
+you could add the JSR-299 API and JSR-330 API into the server common classpath, and
+implementation, plugins and dependent jars into your "WEB-INF/lib" directory
+of the Java EE Web Application.
+
+In this release, we can not support the OpenWebBeans as an integrated
+functionality of the Java EE Application Servers. So, you have to manage the
+configuration of the OpenWebBeans within your application's "web.xml" file. A sample "web.xml"
+file can be found in the "config" directory. To use EJB functionality, you also have to
+add OWB specific interceptor into your EJB beans. Look at the EJB section of this readme
+for further details.
+
+---------------------------------------------
+OpenWebBeans Properties File
+---------------------------------------------
+OpenWebBeans uses a default configuration file to configure some of its
+properties. Default configuration files are embedded into OWB implementation
+jar files. Instead of opening the jars file and changing configuration properties, simply add
+an "openwebbeans.properties" file into a "META-INF/openwebbeans" folder of your application
+classpath. This will override the values from the default configuration.
+You can specify a property 'configuraion.ordinal' in this file to define the overlay order.
+A properties file with higher 'configuration.ordinal' value will applied later and thus
+have a higher precedence. If you don't specify a 'configuration.ordinal' a value of 100 is assumed;
+This allows to have multiple openwebbeans.properties files e.g. a common one in an EAR lib
+(with configuration.ordinal=100) and more specific ones for each WebApp in your EAR (with a
+configuration.ordinal of e.g. 101).
+
+Each plugin developer can provide their own SPI implementation class and own configuration values. If you would like
+to use those implementation classes or configuration values, you have to override the default configuration file as explained
+in the above paragraph, i.e, putting "openwebbeans.properties" file into "META-INF/openwebbeans" folder of your application.
+It is recommended to use a 'configuration.ordinal' between 50 and 99 for custom SPI implementations.
+
+Below are OpenWebBeans' default configuration properties from our openwebbeans-impl.jar file and our plugins such as
+our OpenEJB plugin.
+
+Override default value of ResourceInjectionService
+-------------------------------------------------
+org.apache.webbeans.spi.ResourceInjectionService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService
+
+OpenWebBeans uses the "OpenEjbResourceInjectionService" class to inject resources into the managed bean instances.
+
+Configuration Names and Their Default Values :
+
+- "org.apache.webbeans.spi.ContainerLifecycle"
+ Description : Implementation of org.apache.webbeans.spi.ContainerLifecycle. All magic starts from here.
+ Values : org.apache.webbeans.lifecycle.DefaultLifecycle, OR CUSTOM
+ Default : org.apache.webbeans.lifecycle.DefaultLifecycle
+
+- "org.apache.webbeans.spi.JNDIService"
+ Description : Configures JNDI provider implementation.
+ Values : org.apache.webbeans.spi.se.DefaultJndiService OR CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultJndiService
+
+- "org.apache.webbeans.spi.conversation.ConversationService"
+ Description : Implementation of conversation.
+ Values : org.apache.webbeans.spi.conversation.jsf.DefaultConversationService OR CUSTOM
+ Default : org.apache.webbeans.spi.conversation.jsf.DefaultConversationService
+
+- "org.apache.webbeans.spi.ScannerService"
+ Description : Default implementation of org.apache.webbeans.spi.ScannerService. It is used for scanning application deployment
+ for finding bean classes and configuration files.
+ Values : org.apache.webbeans.spi.ee.deployer.DefaultScannerService OR CUSTOM
+ Default : org.apache.webbeans.spi.ee.deployer.DefaultScannerService
+
+- "org.apache.webbeans.spi.SecurityService"
+ Description : Implementation of org.apache.webbeans.spi.SecurityService. It is used for getting current "Principal".
+ Values : org.apache.webbeans.spi.se.DefaultSecurityService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultSecurityService
+
+- "org.apache.webbeans.spi.ValidatorService"
+ Description : Implementation of org.apache.webbeans.spi.ValidatorService. It is used for getting "ValidatorFactory" and "Validator".
+ Values : org.apache.webbeans.spi.se.DefaultValidatorService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultValidatorService
+
+- "org.apache.webbeans.spi.TransactionService"
+ Description : Implementation of org.apache.webbeans.spi.TransactionService. It is used for getting "TransactionManager" and "Transaction".
+ Values : org.apache.webbeans.spi.se.DefaultTransactionService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultTransactionService
+
+- "org.apache.webbeans.spi.ResourceInjectionService"
+ Description : Implementation of org.apache.webbeans.spi.ResourceInjectionService. It is used for injection Java EE enviroment resource into the
+ Managed Bean instances.
+ Values : org.apache.webbeans.se.DefaultResourceInjectionService or CUSTOM
+ Default : org.apache.webbeans.se.DefaultResourceInjectionService
+
+- "org.apache.webbeans.spi.JNDIService.jmsConnectionFactoryJndi"
+ Description : Configures JMS ConnectionFactory object jndi name
+ Values : Server specific JNDI name
+ Default : ConnectionFactory
+
+- "org.apache.webbeans.conversation.Conversation.periodicDelay"
+ Description : Conversation removing thread periodic delay
+ Values : Configured in millisecond
+ Default : 150000 ms
+
+- "org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService"
+ Description : Use EJB functionality or not. If use OpenEJB configures to true
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.spi.FailOverService"
+ Description : Implementation of the org.apache.webbeans.spi.FailOverService. It is used for enabling passivation/failover beans.
+ Values : org.apache.webbeans.web.failover.DefaultOwbFailOverService or CUSTOM
+ Default : org.apache.webbeans.web.failover.DefaultOwbFailOverService
+
+- "org.apache.webbeans.web.failover.issupportfailover"
+ Description : Support failover of beans or not
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.web.failover.issupportpassivation"
+ Description : Support passivation of beans or not
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.forceNoCheckedExceptions"
+ Description : The interceptors spec defines that @PostConstruct & Co must not throw checked Exceptions. Setting this configuration to 'false' disables this check.
+ Values : false, true
+ Default : true
+
+- "org.apache.webbeans.spi.SecurityService"
+ Description : Service to provide methods which must be guarded via doPrivileged blocks.
+ Values : org.apache.webbeans.corespi.security.SimpleSercurityService or org.apache.webbeans.corespi.security.ManagedSecurityService
+ Default : org.apache.webbeans.corespi.security.SimpleSercurityService
+
+
+---------------------------------------------
+EJB Support via Embeddable OpenEJB Container in Tomcat 6.X
+---------------------------------------------
+
+Configuration Steps:
+--------------------------------------------
+1* Download Tomcat 6.X version
+2* Configure OpenEJB. Look at URL http://openejb.apache.org/tomcat.html for installation.
+3* Copy JSR-330 API to Tomcat /lib folder.
+4* Copy JSR-299 API to Tomcat /lib folder
+5* Put all dependent libraries of the OpenWebBeans OpenEJB Plugin
+ - openwebbeans-ejb
+ - openwebbeans-impl and its dependencies
+
+You could look at ejb-sample.war for "WEB-INF/lib" libraries as an example to develop custom applications.
+The source of this project is also available.
+
+To use EJB functionality, you will use OpenEJB collapse-ear support. In this configuration,
+your EJB beans live within your "war" bundle.
+
+How to Develop EJB Applications
+---------------------------------------------
+1* Add "META-INF/openwebbeans.properties" into your application classpath.
+2* Add "org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService=true" to use EJB functionality.
+ So OWB container looks for EJBs.
+3* Add "org.apache.webbeans.resource.spi.ResourceService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService to
+use OpenEJB Resource injections.
+4* Add "openwebbeans-ejb", plugin into your web application classpath.
+5* If you want to use other plugins, add respective plugins into your application classpath. For example, if you wish to use
+JSF framework, you add "openwebbeans-jsf" plugin.
+6* Add OWB related interceptor into your EJB Beans. This is called "org.apache.webbeans.ejb.interceptor.OpenWebBeansEjbInterceptor"
+This is needed for OWB injections.
+7* Update your application's "web.xml" to add OWB specific configuration.
+
+---------------------------------------------
+How to Run Samples
+---------------------------------------------
+
+In this release, there are several sample applications located in the "/samples" directory
+of the distribution. You can run those samples via simple maven command.
+
+1) "Guess Application" : Simple usage of the OWB + JSF.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+2) "Hotel Reservation Application" : Show usage of JSF + JPA + OWB
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+3) "EJB Sample Application" : Shows the usage of EJBs with embeddable OpenEJB in Tomcat. Firstly
+configure OpenEJB with Tomcat as explained above.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+4) "EJB Telephone Application" : Shows the usage of OpenEJB resource injection service.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+5) "JMS Injection Sample" : Show JMS injections. JMS injection currently uses
+ ConnectionFactory as JMS connection factory jndi name. You can change this
+ via configuration file. Look above explanation for how to configure JMS jndi. Also,
+ JMS injection requires to use of a JMS provider. Generally Java EE servers contains
+ default JMS provider. It can be run on JBoss and Geronimo. It uses Queue with jndi_name = "queue/A".
+ So you have to create a queue destination in your JMS provider with name "queue/A" to run example.
+ If you want to change queue jndi name, then look at source and change it from "WEB-INF/beans.xml" file.
+
+6) "Conversation Sample" : Shows usage of JSF conversations.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+7) "JSF2 Sample" : Shows usage of JSF2 Ajax.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section. It requires
+to use JSF2 runtime.
+
+
+8) "Standalone Sample" : Shows usage of OpenWebBeans in Standalone Swing Application.
+Look at "OpenWebBeans in Java SE" section.
+
+Configuring and Running the Applications:
+--------------------------------------------
+See section Compile and Run Samples via Jetty&Tomcat Plugin.
+
+--------------------------------------------
+Maven Install and Package From the Source
+--------------------------------------------
+
+Maven Version : Apache Maven 2.2.1 or later
+
+First you have to download the "source" version of the OpenWebBeans project that
+contains the all source code of the OpenWebBeans.
+
+To install the Maven artifacts of the project from the source, Maven must be installed
+in your runtime. After Maven installation, just run the following command in the top level
+directory that contains the main "pom.xml" :
+
+> mvn clean install
+
+This command will install all the Maven artifacts into your local Maven repository.
+
+If you wish to package all artifacts of the project, just run the following command
+in in the top level directory that contains the main "pom.xml" :
+
+> mvn clean package
+
+This command will package the project artifacts from the source and put these artifacts into the each modules
+respective "target" directory.
+
+-------------------------------------------
+Compile and Run Samples via Tomcat&Jetty Plugin
+-------------------------------------------
+This section shows how to run samples in Jetty or OpenEJB Embedded Tomcat.
+
+------------------------------------------
+Samples Run within Jetty Plugin
+------------------------------------------
+You can compile and run "guess","jsf2","conversation-sample" and "reservation "samples via maven Jetty plugin.
+Go to the source bundle "samples/" directory. In the "guess/" or "reservation/" directory, run
+the following maven commands. It will start up maven Jetty container. It bundles all of the
+required jars into the WEB-INF/lib folder. You are not required to add any jar to the classpath.
+
+Samples : Guess and Reservation
+------------------------------
+Go to the source folder of projects and run
+
+> mvn clean install -Pjetty
+> mvn jetty:run -Pjetty
+
+Guess URL : http://localhost:8080/guess
+Reservation URL : http://localhost:8080/reservation
+
+Samples : Conversation Sample and JSF2
+-------------------------------------
+Go to the source folder of projects and run
+
+>mvn clean install
+>mvn jetty:run
+
+Conversation Sample URL : http://localhost:8080/conversation-sample
+JSF2 Sample URL : http://localhost:8080/jsf2sample
+
+------------------------------------------
+Samples Run within Tomcat Plugin
+------------------------------------------
+OpenEJB samples are run with Maven Tomcat Plugin.
+
+Tomcat Plugin uses http://localhost:8080/manager application to deploy war file
+into your embeddable EJB Tomcat container. There must be an tomcat-users.xml
+file in the "conf" directory of the server that contains manager role and username.
+
+>Start Tomcat server if not started
+>mvn tomcat:deploy
+
+Ejb Sample URL : http://localhost:8080/ejb-sample
+Ejb Telephone URL : http://localhost:8080/ejb-telephone
+
+Example tomcat-users.xml file
+------------------------------------------
+<tomcat-users>
+<role rolename="manager"/>
+<user username="admin" password="" roles="manager"/>
+</tomcat-users>
+
+-----------------------------------------
+Deploy JMS Sample
+-----------------------------------------
+Simple drops jms-sample.war file into your application deploy location.
+
+JMS Sample Example URL : Hit the url http://localhost:8080/jms-sample/sender.jsf for sending JMS messages
+ Hit the url http://localhost:8080/jms-sample/receiver.jsf for receiving JMS messages
+
+-----------------------------------------
+OpenWebBeans in Java SE
+----------------------------------------
+OpenWebBeans can be used in Java SE environments such as Java Swing
+applications. A Standalone Sample is provided to show how to use OpenWebBeans
+in Java SE.
+
+Go to the source directory of the standalone sample:
+>mvn clean package;
+>cd target;
+>jar -xvf standalone-sample.jar
+>java -jar standalone-sample-1.1.5-SNAPSHOT.jar
+>Enjoy :)
+
+-----------------------------------------------
+OpenWebBeans User and Development Mailing Lists
+-----------------------------------------------
+Please mail to the user mailing list with any questions or advice
+about the OpenWebBeans.
+
+User Mailing List : [users@openwebbeans.apache.org]
+
+You can also join the discussions happening in the dev list
+
+Dev Mailing List : [dev@openwebbeans.apache.org]
+
+-------------------------------------------
+OpenWebBeans JIRA Page
+-------------------------------------------
+Please logs bugs into the "https://issues.apache.org/jira/browse/OWB".
+
+------------------------------------------
+OpenWebBeans Wiki and Blog Page
+-----------------------------------------
+Wiki: http://cwiki.apache.org/OWB/
+Introduction to OpenWebBeans : http://cwiki.apache.org/OWB/introduction-to-openwebbeans.html
+Blog : http://blogs.apache.org/owb
+
+-----------------------------------------
+OpenWebBeans Web Page
+----------------------------------------
+You can reach the OpenWebBeans web page at
+http://openwebbeans.apache.org
+---------------------------------------
+
+Your Apache OpenWebBeans Team
+
+Enjoy!
diff --git a/owb_1.2.x/readme/README_1_1_6.txt b/owb_1.2.x/readme/README_1_1_6.txt
new file mode 100644
index 0000000..f484da1
--- /dev/null
+++ b/owb_1.2.x/readme/README_1_1_6.txt
@@ -0,0 +1,1097 @@
+-------------------------------
+Apache OpenWebBeans 1.1.6
+-------------------------------
+Welcome!
+Thanks for downloading and using OpenWebBeans.
+This document is a "Getting Started Guide" for OpenWebBeans.
+
+This document is based on the 1.1.6 release of Apache OpenWebBeans.
+
+--------------------------------
+What is Apache OpenWebBeans?
+--------------------------------
+OpenWebBeans is an Apache License V 2.0 licensed implementation of the JSR-299,
+Contexts and Dependency Injection for the Java EE platform.
+
+It also already incorporates some features which are part of JSR-346 (CDI-1.1)
+but doesn't need API changes as we still use the JCDI-1.0 API. The
+incorporated CDI-1.1 features are mostly parts which are not well
+defined in the CDI-1.0 specification, like Serialisation checks, etc.
+
+Our project's web page can be found at:
+http://openwebbeans.apache.org
+
+The projects WIKI page can be found at:
+https://cwiki.apache.org/confluence/display/OWB/Index
+
+
+--------------------------------
+OpenWebBeans 1.1.6 Release Features
+--------------------------------
+
+- The 1.1.6 release supports the following features
+-----------------------------------
+* Managed Beans Support
+* Session Beans Support (via Embeddable OpenEJB container in Tomcat)
+* Producer Method Support
+* Producer Field Support
+* Java EE Resource Injection Support
+* JMS OpenWebBeans Support(OWB Specific)
+* Inheritance, Stereotype Inheritances
+* Specialization Support
+* Event Support
+* Decorator and Interceptor Support
+* Lookup and Dependency Injection Support
+* Java EE Plugin Support (via ServetContextListener interface)
+* Portable Integration Support
+* Passivation Capability of Beans
+* @Alternative support
+* OSGi environment support with an own plugable bundle ClassPath scanner
+* vastly improved Interceptor performance
+* plugable SecurityManager integration doubles speed if no SecurityManager is being used
+* improved Serialization handling
+* improved CreationalContext handling
+* revised internal logging
+* upgrade to JPA-2 and JSF-2 support
+* support for direct CDI usage in tomcat-6 and tomcat-7 environments
+* optional lenient lifecycle interceptor checking
+* automatically detect if BeanManager#isInUse()
+* improved Serialization checks from the CDI-1.1 specification
+
+
+
+Noteable differences to CDI spec behaviour
+--------------------------------------------
+
+In a few special cases Apache OpenWebBeans might behave a little bit different than
+other CDI implementations. This is to some degree caused by the JSR-299 spec being
+not clear about some special topics so we needed to interpret the wording on our own.
+This mainly concerns the area of section 12.1 Bean Archives (BDA) which doesn't work
+out when it comes to OSGi containers and likes.
+In Apache OpenWebBeans, a settings configured in a beans.xml file of a BDA is not
+only effective for this very bean archive but for the whole BeanManager in control
+of the Application. This is especially the case for <alternatives> and
+<interceptors>! An Alternative, Interceptor or Decorator enabled in one BDA is active
+for the whole Application. This behaviour will most likely also be the default behaviour
+in the CDI-1.1 JSR-346 specification.
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.6
+-------------------------------------------
+
+Bug
+
+ [OWB-694] - Misleading exception message "Wrong termination object"
+ [OWB-696] - check for unproxyable API types should get moved to the validateBeans phase
+ [OWB-697] - Non-Static Loggers leads to NonSerizializableException
+ [OWB-698] - InjectableBeanManager not serializable
+ [OWB-703] - getBeans cache key algorithm must be unique
+ [OWB-707] - tomcat-sample and tomcat7-sample are just broken.
+ [OWB-708] - PrincipalBean doesn't get found
+ [OWB-709] - webbeans-tomcat6 must honour WEB-INF/classes/META-INF/beans.xml
+
+Improvement
+
+ [OWB-695] - Cause missing in AnnotationDB$CrossReferenceException
+ [OWB-701] - Support ASM for Bean Proxies
+ [OWB-702] - Add serialization unit tests to openwebbeans-web to catch future regressions
+ [OWB-704] - use method filter in javassist proxies instead of "manual" filtering
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.5
+-------------------------------------------
+
+Bug
+
+ * [OWB-498] - Java EE Resource Injections for CDI Interceptors & Decorators
+ * [OWB-605] - tomcat plugins must register WebBeansConfigurationListener as first Listener
+ * [OWB-663] - Maven dependencies between impl and spi
+ * [OWB-666] - invalid check in AnnotationManager#checkStereoTypeClass
+ * [OWB-667] - Bean queries have strange behavior (difference between Open Web Beans and the Reference Implementation)
+ * [OWB-669] - Bean fail over is not in sync with specs
+ * [OWB-672] - Decorators creates Stackoverflow or NPE if under heavy load
+ * [OWB-673] - injecttarget are not updated after ProcessInjectionTarget event
+ * [OWB-676] - CdiTest OwbContainer fails if WebContainerLifecycle is being used
+ * [OWB-677] - improve getBeans cache key algorithm
+ * [OWB-680] - drop unused getInstance() methods from our services
+ * [OWB-681] - remove deprecated methods from BeanManagerImpl
+ * [OWB-682] - get rid of OWB InterceptorType and usejavax.enterprise.inject.spi.InterceptionType instead
+ * [OWB-683] - remove obsolete Methods from our Bean implementations and handlers
+ * [OWB-685] - OwbApplicationFactory doesn't set Application
+ * [OWB-686] - OWBApplicationFactory wrappedApp should be consistent between getter and setter and volatile
+ * [OWB-687] - clean up non-static loggers
+ * [OWB-688] - fix non-serializable fields in Serializable classes
+ * [OWB-689] - OWBInjector should be stateless
+ * [OWB-690] - WebContextsService cleanup should get reworked
+ * [OWB-693] - webbeans-web shall not declare StandaloneResourceInjectionService
+
+Improvement
+
+ * [OWB-674] - rewrite owb logger api
+ * [OWB-684] - move from ancient 'ContextTypes' definition to standadrd scope annotations
+
+Task
+
+ * [OWB-678] - Check for unused classes and remove them
+ * [OWB-691] - Sonar cleanup before the 1.1.5 release
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.4
+-------------------------------------------
+
+Bug
+
+ * [OWB-567] - Lookup of Provider results in NullPointerException on get()
+ * [OWB-574] - NewBean doesn't support EJBs
+ * [OWB-580] - ObserverMethodImpl needs support for EJB's whose Bean Types do not include the EJB class
+ * [OWB-602] - OpenWebBeans OpenEJB integration OSGi bundle declares the wrong version for the javax.transaction package
+ * [OWB-617] - NullPointerException in InstanceBean#createInstance
+ * [OWB-628] - Event injection doesn't work in observer methods.
+ * [OWB-633] - define stereotypes & thirdparty
+ * [OWB-634] - @Interceptors added by extension ignored
+ * [OWB-636] - Samples point to parent pom file that doesn't exist
+ * [OWB-643] - it isn't possible to add/remove @Alternative during the bootstrapping process
+ * [OWB-644] - wrong config entry for LoaderService
+ * [OWB-645] - InjectionPoint is null when using @Produces. NullPointerException caused by CDI container providing a null InjectionPoint into a producer method.
+ * [OWB-646] - Failover does not work (again)
+ * [OWB-648] - regression on tck org.jboss.jsr299.tck.tests.lookup.injectionpoint.InjectableReferenceTest
+ * [OWB-649] - exceptions in EJB's are wrapped in InvocationTargetException
+ * [OWB-655] - CDI doesn´t inject stateless EJB by abstract class.
+ * [OWB-658] - BeanManager.getBeans(Type, Annotation...) can not be used to query all known beans
+ * [OWB-659] - An annotated interface class is being seen as a manage bean.
+ * [OWB-660] - WebBeansContext #activateContext for SessionScoped.class doesn't set the ThreadLocal
+
+Improvement
+
+ * [OWB-596] - Provide info about injetion point for "Passivation capable beans must satisfy passivation capable dependencies ..."
+ * [OWB-604] - more details for exceptions during bootstrapping
+ * [OWB-635] - support callbacks (@PostContrcut, @PreDestroy) in Extensions
+ * [OWB-637] - [perf] ELContextStore.destroyDependents() creates unnecessary HashMap$KeyIterator instances
+ * [OWB-638] - [PERF] Avoid unnecessary AbstractList$Itr instances
+ * [OWB-639] - [perf] InjectionResolver.getBeanCacheKey creates many StringBuilder instances
+ * [OWB-641] - the jee5-ejb-resource module should support @EJB(mappedName)
+ * [OWB-647] - [PERF] Avoid unnecessary StringBuilder instances - improve checkNullInstance, checkScopeType, ... methods
+ * [OWB-653] - remove @ViewScoped support
+ * [OWB-657] - review startup performance
+ * [OWB-661] - hashCode, equals and toString() of our built in Qualifier Literals should be implemented ourselfs
+
+Task
+
+ * [OWB-656] - remove webbeans-openejb
+ * [OWB-662] - remove obsolete class WebBeansAnnotation
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.3
+-------------------------------------------
+
+Bug
+
+ * [OWB-515] - interceptors don't support inheritance without an overridden method annotated with @AroundInvoke
+ * [OWB-565] - missing check for producer methods
+ * [OWB-625] - BeanManager.resolve throw java.util.NoSuchElementException with an empty set parameter
+ * [OWB-629] - NoClassDefFoundError for optional dependencies
+ * [OWB-630] - AmbiguousResolutionException thrown for Decorators that Decorate multiple beans where any of those beans are passivation capable.
+ * [OWB-631] - openwebbeans-resource misses openwebbeans.properties
+
+Improvement
+
+ * [OWB-475] - support for optional beans
+ * [OWB-627] - Automatically destroy @Dependent contextual instances created with Instance<T>
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.2
+-------------------------------------------
+
+Bug
+
+ * [OWB-562] - non-enabled alternative beans with passivating scope fail validation during deployment
+ * [OWB-589] - " ... requires a passivation capable dependency ..." for producer method with return type String and non serializable injected dependency
+ * [OWB-597] - StackOverFlow when injecting product in same bean where @Produces is placed
+ * [OWB-615] - remove @Overrides for interfaces to be java5 compatible
+ * [OWB-616] - javax.el.ExpressionFactory has final methods! CDI doesn't allow that. - Test on final **PRIVATE** methods too?
+ * [OWB-618] - we sometimes invoke a dispose method without having created the bean upfront
+ * [OWB-619] - @New beans must only exist if there is at least one injection point for them
+ * [OWB-620] - any disabled bean of passivating scope will wrongly be detected as 'not passivatable'
+ * [OWB-622] - beanmanager injection in afterBeanDiscovery method parameter
+ * [OWB-624] - AnnotatedTypes registered in BeforeBeanDiscovery might get processed twice
+
+Improvement
+
+ * [OWB-623] - Relax check on @AroundInvoke Interceptors 'throws Exception'
+
+New Feature
+
+ * [OWB-621] - Alternative configuration method for buggy container or pre servlet api 2.5 container
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.1
+-------------------------------------------
+
+Bug
+
+ * [OWB-406] - BaseEjbBean.removedStatefulInstance used by multiple instances/EjbBeanProxyHandlers
+ * [OWB-447] - unnecessary contextual/non-contextual distinction in OpenWebBeansEJBIntercpetor
+ * [OWB-449] - EJB interceptor has incorrect/unnecessary use of business method checks
+ * [OWB-483] - Problem with mulitple custom interceptors and passivation
+ * [OWB-512] - ApplicationContext and SingletonContext in WebContextsService
+ * [OWB-554] - DelegateHandler wraps Beans exceptions
+ * [OWB-558] - PassivationCapable bean id's for Producer Fields do not take into account generics
+ * [OWB-561] - Multiple contexts with the same Scope are not handled properly -- causing tck failures
+ * [OWB-563] - producers of passivating beans fail when the declared return type is not serializable but the actual return type is
+ * [OWB-566] - ProcessInjectionTarget event gets fired too early
+ * [OWB-571] - fix site build under maven3 and upgrade logo
+ * [OWB-573] - Invalid checking of Interceptor serialization capabilities for non-Passivation capable EJBs
+ * [OWB-576] - FileNotFoundException on WebSphere
+ * [OWB-577] - FileNotFoundException on WebSphere
+ * [OWB-578] - Allow DI for OpenWebBeansConfiguration properties
+ * [OWB-579] - check for non-proxyiable methods should exclude synthetic methods
+ * [OWB-581] - Decorator interface check needs configurable exclusions
+ * [OWB-584] - check for declared name consistency for specializes beans is wrong
+ * [OWB-585] - ProcessSessionBean doesn't deal with generic type quite right (CDITCK-215)
+ * [OWB-586] - Interceptors added by portable extensions don't work
+ * [OWB-587] - Use business interface for producer and disposer methods of Session beans
+ * [OWB-588] - PrincipalBean is misspelled
+ * [OWB-590] - Seam Persistence does not work with OWB - AfterBeanDiscovery.addBean will be ignored
+ * [OWB-591] - EJB @Specializes inheritance
+ * [OWB-593] - Interceptor binding added on an interceptor class at ProcessAnnotatedType phase is not considered
+ * [OWB-595] - Use case "Faces Request Generates Non-Faces Response" locks conversation forever (-> BusyConversationException)
+ * [OWB-598] - InjectionResolver crashes with a NPE when injecting a method parameter
+ * [OWB-599] - move getBeanXmls() back to Set<URL>
+ * [OWB-600] - cache information about non intercepted methdos in ProxyHandlers
+ * [OWB-601] - WebContextsService only works if ServletContext is given
+ * [OWB-608] - openwebbeans-el10 plugin misses openwebbeans.properties
+ * [OWB-614] - add LICENSE and NOTICE files to all our samples
+
+Improvement
+
+ * [OWB-555] - ClassUtil methods contain spelling, camelcase, etc., type errors
+ * [OWB-557] - #setAccessible(false) isn't needed
+ * [OWB-560] - upgrade the TCK to 1.0.4.SP1
+ * [OWB-564] - CdiTestOpenWebBeansContainer - check if a std.-context is active before destroying it
+ * [OWB-582] - Support for Java 1.5 (needed for WebSphere 6.1)
+ * [OWB-583] - Support for Servlet API 2.4 (needed for WebSphere 6.1)
+ * [OWB-594] - create a configurable mapping Scope->ProxyMethodHandlerImplementation
+ * [OWB-607] - upgrade our samples to newest available dependencies
+ * [OWB-610] - upgrade to apache parent pom 10
+ * [OWB-611] - adding ASF trademark documentation to our official site build
+ * [OWB-612] - upgrade various maven plugins
+ * [OWB-613] - Exclude Samples WARs Publishing with Maven
+
+Task
+
+ * [OWB-592] - EJB Specialization utility method
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.0
+-------------------------------------------
+
+Bug
+
+ * [OWB-295] - resolve bugs in Javassist Proxy
+ * [OWB-417] - BaseEjbBean.destroyComponentInstance() should call direct container remove API, not call an @Remove annotated method
+ * [OWB-422] - Support needed for PrePassivate, PostActivate, and AroundTimeout via EJBInterceptor.
+ * [OWB-444] - Using Static Loggers in Shared ClassLoader
+ * [OWB-452] - set active flag to false then context is destroyed
+ * [OWB-456] - When multiple interceptors are defined for a bean OWB does NOT correctly remove the overridden base Interceptors
+ * [OWB-469] - JSR299TCK: Security Error / Passivation errors during readObject
+ * [OWB-470] - OWBInjector does not work correctly for EJB Beans
+ * [OWB-471] - Possible StackOverflowException from defineProducerMethods in WebBeansAnnotatedTypeUtil
+ * [OWB-473] - bundles that use javasissist to proxy their contents need to import some javassist packages
+ * [OWB-474] - InjectionTargetBean#injectSuperResources is missing
+ * [OWB-477] - Two instances of using ObjectInputStream that may not have visibility into application classloader
+ * [OWB-480] - Avoid a couple NPEs
+ * [OWB-482] - Small issues
+ * [OWB-486] - ResourceBean tries to proxy final classes before testing them for being final
+ * [OWB-489] - AnnotatedTypes added with BeforeBeanDiscovery.addAnnotatedType method are ignored
+ * [OWB-490] - ProcessObserverMethod Type parameters are inverted (CDITCK-174)
+ * [OWB-491] - Decorators init needs to scan superclasses for more interfaces. cf CDITCK-178
+ * [OWB-492] - events don't get sent to private @Observes methods
+ * [OWB-493] - ProcessProducerMethod and ProcessProducerField type parameters are reversed in filtering (?) CDITCK-168
+ * [OWB-494] - Subclasses with non-overriden observer methods not recognized as beans with observer methods
+ * [OWB-496] - Don't replace the ProxyFactory classloaderProvider without the intention to do so
+ * [OWB-499] - WEB-INF/beans.xml of a war will not activate Bean Archive behaviour
+ * [OWB-502] - Only cache the ContextService once, in the SingletonService
+ * [OWB-504] - OwbApplicationFactory getWrapped should return wrapped application factory
+ * [OWB-505] - OwbApplicationFactory should not be installed by default
+ * [OWB-509] - Unwrap InvocationTargetException in ResourceProxyHandler.invokie
+ * [OWB-510] - return null instead of an unusable proxy if a resource is missing
+ * [OWB-511] - Delegate actualInstance serialization behavior in ResourceProxyHandler
+ * [OWB-514] - Leak in ELContextStore
+ * [OWB-519] - broken wls support
+ * [OWB-521] - ProducerMethodBean could theoretically produce a NPE
+ * [OWB-522] - Missing updateTimeout in one of begin methods for conversation
+ * [OWB-523] - @SessionScoped bean failover does not work
+ * [OWB-524] - OWB classpath scanning of non-jars doesn't work if the classpath contains spaces
+ * [OWB-527] - JspFactory.getDefaultFactory() is synchronized, We can cache the return value to improve performance
+ * [OWB-529] - lazy initialized class members should be volatile
+ * [OWB-530] - multi massive execution of our Interceptor test unveils a concurrency problem
+ * [OWB-531] - cleanup WebBeansELResolver#getValue
+ * [OWB-533] - concurrency bottleneck due to use of our logger
+ * [OWB-534] - Injection of @PersistenceContext does not work with abstract/base classes
+ * [OWB-541] - replace WeakHashMap with a standard one in InterceptorHandler
+ * [OWB-542] - Disposer is called twice on Dependent beans when injected into a managed object that is called from a JSP
+ * [OWB-543] - get rid of checked Exceptions in our SPI
+ * [OWB-545] - Cleanup our SecurityManager integration
+ * [OWB-546] - @Typed gets ignored if we use a AnnotatedType from an Extension @Observing ProcessAnnotatedType
+ * [OWB-547] - WebContextsService throws NPE on asynchronous app startup
+ * [OWB-548] - missing null check in DefaultContextsService#stopApplicationContext
+ * [OWB-550] - duplicated observer methods in case of @Specializes
+
+Improvement
+
+ * [OWB-209] - remove all <repositories> from our poms
+ * [OWB-254] - suppress initialising contextual handling for configurable URIs.
+ * [OWB-335] - implement a sample for @ViewScoped in reservation
+ * [OWB-393] - remove old XML configuration code
+ * [OWB-448] - More changes for decorator and interceptor passivation support
+ * [OWB-461] - source code quality
+ * [OWB-472] - archive centric beans.xml enabling
+ * [OWB-478] - make OWB build maven-3 aware
+ * [OWB-485] - AmbiguousResolutionException doesn't print details about the injection point
+ * [OWB-500] - improved app-server support
+ * [OWB-503] - Reduce static synchronized hashmap usage
+ * [OWB-506] - Upgrade our samples to Apache MyFaces-2.0.3 and OpenJPA-2.0.1
+ * [OWB-507] - our samples should be prepared for EE as default
+ * [OWB-508] - Dependent scope proxies are needed to wrap the build-in beans returned from the services if they are not serializable yet
+ * [OWB-516] - Get TCK standalone 1.0.4 CR2
+ * [OWB-517] - Conversation Log Improvement
+ * [OWB-518] - log all bean-archive markers
+ * [OWB-520] - spi for the webbeans-jee5-ejb-resource plugin
+ * [OWB-525] - create a findbugs filter file in our build-tools resource
+ * [OWB-526] - remove usage of java.net.URLs from ScannerService and drop scannotation
+ * [OWB-535] - free ScannerService resources once we don't need it anymore
+ * [OWB-536] - revisit our Logger usage in our Bean impls
+ * [OWB-537] - clear() AnnotatedElementFactory after the deployment
+ * [OWB-539] - fill AnnotatedTypeImpl lazily
+ * [OWB-540] - StandaloneResourceInjectionService should cache info about classes which don't contain EE resource injection points
+ * [OWB-544] - improve BeanManager#getContext performance
+
+New Feature
+
+ * [OWB-433] - add a configuration flag for switching to a lenient lifecycle interceptor checking
+ * [OWB-501] - owb ee 5 resource integration
+ * [OWB-528] - Use ApplicationWrapper as parent of OwbApplication in JSF 2 plugin
+ * [OWB-532] - create a new BeanManager#isInUse()
+ * [OWB-538] - lazy loading of not explicitly marked (via annotation or registered by extension) Dependent beans
+
+Question
+
+ * [OWB-383] - static fields in CreationalContext
+
+TCK Challenge
+
+ * [OWB-484] - Running TCK 1.0.1 Final and Respective Corrections
+
+Task
+
+ * [OWB-19] - Geronimo Integration
+ * [OWB-428] - implementation of equals and hashCode for AbstractOwbBean
+ * [OWB-453] - add a flag to disable context activation in EJB interceptor
+
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0
+-------------------------------------------
+
+Bug
+
+ * [OWB-318] - multiple methods with same EJB @interceptors(foo.class) in same bean class get multiple interceptor instances
+ * [OWB-384] - OWB needs to call 299-defined PrePassivate, PostActivate, and AroundTimeout interceptors for EJBs
+ * [OWB-422] - Support needed for PrePassivate, PostActivate, and AroundTimeout via EJBInterceptor.
+ * [OWB-429] - OpenWebBeansEjbPlugin Class Hierarchy
+ * [OWB-438] - Cached Normal Scoped Proxy instances
+ * [OWB-439] - EjbPlugin session bean proxy creation thread safe problem
+ * [OWB-445] - we must not use javassist ProxyFactory#setHandler(MethodHandler)
+ * [OWB-446] - EJB lifecycle callbacks not stacked correctly
+ * [OWB-450] - NullPointerException in DependentScopedBeanInterceptorHandler when it has a NullCreationalContext (normally from a EE component).
+ * [OWB-454] - ClassUtil.callInstanceMethod() doesn't propogate original exception
+ * [OWB-455] - IllegalArgument method calling remove method of EJB during destroy
+ * [OWB-456] - When multiple interceptors are defined for a bean OWB does NOT correctly remove the overriden base Interceptors
+ * [OWB-457] - we must not create a SessionContext for static resource reqeusts
+ * [OWB-460] - fix owb-openejb and owb-ejb artifactIds
+ * [OWB-464] - InjectionPointImpl using wrong class loader during serialize/deserialize, dropping qualifiers, and omiting qualifier values.
+ * [OWB-466] - Ensure removal of all ThreadLocal values
+
+Improvement
+
+ * [OWB-177] - Handling of InterceptionType#POST_ACTIVATE, PRE_PASSIVATE and AROUND_TIMEOUT is missing
+ * [OWB-407] - detailed information about exceptions
+ * [OWB-451] - Allow InterceptorUtil#callAroundInvokes to propogate a callers 'creational context key'
+ * [OWB-459] - upgrade to newer library versions
+ * [OWB-463] - EjbDefinitionUtility.defineEjbBeanProxy() should be able to create proxies for no-interface local beans
+ * [OWB-465] - enhance EJB common code for crude @LocalBean support
+
+TCK Challenge
+
+ * [OWB-394] - Any idea why our BeforeBeanDiscovery.addInterceptorBinding() has different signature?
+
+Task
+
+ * [OWB-453] - add a flag to disable context activation in EJB interceptor
+ * [OWB-462] - Refactor AnnotationUtil.hasAnnotationMember()
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0-alpha-2
+-------------------------------------------
+Bug
+
+ * [OWB-303] - upgrade Javassist to a newer version
+ * [OWB-338] - our internal SessionContext and ConversationContext must support Session serialization
+ * [OWB-385] - implement passivation of managed beans in ServletContextListener
+ * [OWB-401] - ELContextStore not cleaned up for some JSP EL lookups
+ * [OWB-402] - OpenWebBeansJsfPlugin does not recognize @ManagedBean
+ * [OWB-404] - Contexts must not get stored in a static Map in BeanManager
+ * [OWB-405] - AnnotatedElementFactory must not use static cache maps
+ * [OWB-408] - NPE in WebBeansELResolver
+ * [OWB-415] - EjbBeanProxyHandler for dependent ejb must save ejb instance
+ * [OWB-416] - BaseEJBBean.destroyComponentInstance() tries to call multiple remove methods
+ * [OWB-418] - EjbBeanProxyHandler must be 1:1 with proxy instances for dependent SFSB
+ * [OWB-419] - fix @Dependent handling in ELResolver
+ * [OWB-420] - SingletonContext is mapped to @ConversationScoped
+ * [OWB-421] - defined-in-class EJB lifecycle callbacks masked by our Interceptor
+ * [OWB-426] - Tweak EJBPlugin to work with Standalone Tests
+ * [OWB-431] - Generic Type Inheritance not resolved correctly
+ * [OWB-434] - ThreadLocal<SingletonContext> doen't get cleaned up
+ * [OWB-436] - AbstractContext bean instance creation is not thread safe
+ * [OWB-437] - Improve AbstractContext synchronization
+ * [OWB-440] - WebBeansDecoratorConfig.getDecoratorStack always returns new Decorators
+ * [OWB-442] - our EJB proxies are broken when multiple local interfaces are used on a single class
+ * [OWB-443] - Normal-scoped EJB not removed by container during Contextual.destroy()
+
+Improvement
+
+ * [OWB-57] - cleanup problems found by maven-findbugs-plugin
+ * [OWB-195] - Give warning to the developer related with non- portable operations
+ * [OWB-409] - create a name for OWB our faces-config.xml
+ * [OWB-410] - lazy initialisation of ejbInterceptors
+ * [OWB-411] - cache calls to isNormalScope()
+ * [OWB-412] - Allow container specific extensions to WebConfigurationListener access to the lifecycle
+ * [OWB-413] - cache calls to ClassUtils#getObjectMethodNames()
+ * [OWB-414] - improve Interceptor performance
+ * [OWB-425] - improve performance of owb-el-resolver
+ * [OWB-427] - improve read-performance of AbstractOwbBean
+ * [OWB-430] - improve performance of WebBeansPhaseListener
+ * [OWB-432] - Create Singleton Service SPI
+ * [OWB-441] - new configuration properties mechanism
+
+Sub-task
+
+ * [OWB-193] - If an interceptor or decorator has any scope other than @Dependent, non-portable behavior results.
+ * [OWB-194] - If an interceptor or decorator has a name, non-portable behavior results.
+ * [OWB-196] - If an interceptor or decorator is an alternative, non-portable behavior results.
+ * [OWB-197] - If a stereotype declares any other qualifier an- notation, non-portable behavior results.
+ * [OWB-198] - If a stereotype is annotated @Typed, non-portable behavior results.
+
+
+TCK Challenge
+
+ * [OWB-424] - Adding Document for How to Configure and Run TCK (standalone and web profile TCKs)
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0-alpha-1
+-------------------------------------------
+Bug
+
+ * [OWB-216] - Update pom.xml svn links
+ * [OWB-231] - exception using abstract decorators
+ * [OWB-245] - Using parameterized type varaibles fails for Producer Method injection
+ * [OWB-259] - Implement spec 11.5.5. ProcessModule event
+ * [OWB-289] - Owb return 2 beans for Indirect specialized producer beans
+ * [OWB-302] - InjectionPoint injections (both method and field based) in Decorators result in null
+ * [OWB-312] - Add dopriv's to allow OWB to function with java 2 security enabled
+ * [OWB-317] - creationalContext in InvocationContextImpl is always null
+ * [OWB-318] - multiple methods with same EJB @interceptors(foo.class) in same bean class get multiple interceptor instances
+ * [OWB-327] - annotating an Interceptor with @ApplictionScoped leads to OutOfMemory
+ * [OWB-329] - Interceptor instances get created each time the interceptor gets called
+ * [OWB-332] - Destroy Depdent Of Producer Method Beans when Invocation Completes
+ * [OWB-333] - InjectionTarget and Producer Handling
+ * [OWB-334] - cid is missing when using redirect for a jsf 2.0 application
+ * [OWB-336] - injected BeanManager must be Serializable
+ * [OWB-337] - events must not get broadcasted to beans which have no active Context
+ * [OWB-339] - Injecting Non-Contextual Beans Causes NPE in WebBeansUtil
+ * [OWB-340] - BeanManagerImpl.createInjectionTarget() Throws Exception When No Constructor Found
+ * [OWB-341] - CreationalContext#incompleteInstance should get cleaned after create()
+ * [OWB-342] - InterceptorHandler crashes with NullPointerException after deserialisation
+ * [OWB-343] - upgrade JPA spec from 1.0-PFD2 to 1.0 final revision
+ * [OWB-345] - Remove duplicate dependencies
+ * [OWB-351] - OWB picks up @SessionScoped contextual instances from expired sessions
+ * [OWB-352] - Thread Safety Problem in our InterceptorHandlers, aka proxies
+ * [OWB-353] - NPE in removeDependents@CreationalContextImpl
+ * [OWB-354] - WebContextService may throw NPE in tiered classloading environmemt
+ * [OWB-357] - WebbeansFinder should index first on ClassLoader, not singleton type
+ * [OWB-359] - ownerCreationalContext sometimes causes NPE in InterceptorDataImpl.createNewInstance()
+ * [OWB-361] - underlying EJB method not actually in our interceptors stack
+ * [OWB-362] - InvocationTargetException when invoking Stateless SessionBean
+ * [OWB-363] - Intermittent bug with ApplicationScope disposers not being called
+ * [OWB-366] - ContextNotActiveException fired from AppScope/NormalScopedBeanInterceptorHandler when a proxied object finalized
+ * [OWB-368] - The 299 spec (that I have) uses receive=IF_EXISTS but OWB uses notifyObserver=IF_EXISTS.
+ * [OWB-369] - Static ContextsService in ContextFactory causes wrong webContextService used for multiple applications
+ * [OWB-370] - Intransient Conversation context get rdestroyed randomly by destroyWithRespectToTimout
+ * [OWB-371] - no lifecycle interceptors for non-contextual EJB
+ * [OWB-372] - creational context not cleaned up for non-contextual EJB interceptions
+ * [OWB-373] - build crashes with missing artifact error
+ * [OWB-374] - migrate jsf2sample from sun to MyFaces
+ * [OWB-376] - [patch] Guess example broken with Jetty plugin 6.x due to EL 2.2
+ * [OWB-377] - revise logging
+ * [OWB-378] - ejb at bottom of decorator stack doesn't handle changed method
+ * [OWB-380] - NormalScopedBeanInterceptorHandler throws NPE when handling 3rd party Contexts
+ * [OWB-381] - NPE thrown from AbstractInjectable if dependent producer returns null
+ * [OWB-382] - injecting a @Dependent bean into a passivatation scoped bean causes a NonSerializableException
+ * [OWB-387] - DependentContext Interceptor Double Call for PostConstruct
+ * [OWB-390] - fix broken links in our 'site'
+ * [OWB-396] - fix poms to work with maven 3
+ * [OWB-398] - DelegateHandler cached too agressively
+ * [OWB-399] - Proxy objects could not be correctly deserialized by using javassist 3.11. we need to update to 3.12
+ * [OWB-400] - starting OWB as part of an EAR in geronimo causes a exception due to missing 'bundle' protocol
+
+Improvement
+
+ * [OWB-116] - Update Business Method Definition
+ * [OWB-118] - Supports Decorators for Other Delegate Injections
+ * [OWB-136] - fix 'broken' license headers in our java files
+ * [OWB-170] - Address findbug issues in webbeans-impl
+ * [OWB-183] - Improve webbeans-doc module to get a documentation more user friendly
+ * [OWB-214] - get rid of javax.transaction.Transaction dependency in webbeans-impl
+ * [OWB-237] - NoSuchElementException when WebBeansConfigurationListener is absent
+ * [OWB-275] - remove unused imports and cleanup code
+ * [OWB-286] - java.lang.NoClassDefFoundError: javax/validation/Validator
+ * [OWB-313] - create caching strategies for resolving Bean<T> for BeanManager and EL invocations
+ * [OWB-314] - cache resolved instances in NormalScopedBeanMethodHandlers of @ApplicationScoped beans
+ * [OWB-315] - cache resolved instances in NormalScopedBeanMethodHandlers of @SessionScoped beans
+ * [OWB-319] - Strange logging when writing non-Serializable SessionScoped bean
+ * [OWB-320] - Remove Java EE Dependencies from WebBeans Core
+ * [OWB-322] - Create new EJB project and separate common EJB classes from OpenEJB plugin
+ * [OWB-325] - Relocate SPI Classes to SPI Module. Change JSR299, JSR330 as optional pom dependency.
+ * [OWB-326] - improve producer tests
+ * [OWB-328] - improve logger performance
+ * [OWB-330] - reduce BeanManagerImpl#getManager() calls inside the same functions
+ * [OWB-331] - Cache Interceptor & Decorator Stack oon Interceptor Handler
+ * [OWB-346] - Make EJB samples running
+ * [OWB-347] - Using InjectableBeanManager in TCK
+ * [OWB-349] - ignore exception during type hierarchy scan
+ * [OWB-350] - Support Interceptor for non-contextual EJBs
+ * [OWB-355] - OpenEjbBean should look for @Remove methods
+ * [OWB-356] - EjbPlugin only looks for DeployementInfo once, so new deployed application won't be discovered
+ * [OWB-358] - provide property to skip injection in @PostConstruct of OpenWebBeansEjbInterceptor
+ * [OWB-360] - Add BeanManager to a ServletContext attribute
+ * [OWB-364] - Reduce the amount of info level logging
+ * [OWB-365] - make injection optional in OWBEJBInterceptor
+ * [OWB-375] - Performance: OWB logging performs operations when logging disabled.
+ * [OWB-379] - upgrade to final atinject-spec artifact
+ * [OWB-386] - upgarde CDI TCK to 1.0.2.CR1
+ * [OWB-389] - atinject-tck upgrade to final 1.0 release
+ * [OWB-397] - Add helper method and some debug to WebBeansFinder
+
+New Feature
+
+ * [OWB-316] - Implement a generic TestContainer for CDI implementations
+ * [OWB-323] - Provide methods to pass classloader into ServiceLoader and WebBeansFinder for use in tiered classloader situations
+ * [OWB-324] - Add Tomcat Plugin
+ * [OWB-348] - Adding Interceptor and Decorator Support for EJB Beans
+ * [OWB-395] - OpenWebBeans Tomcat 7 Support
+
+TCK Challenge
+
+ * [OWB-388] - Pass TCK 1.0.2 CR1 Web Profile
+
+Task
+
+ * [OWB-6] - Scope passivation
+ * [OWB-14] - Update WebBeans Lifecycle for Servlet Beans
+ * [OWB-46] - Injection into non-contextual objects
+ * [OWB-204] - Update Samples for JSF2 Usage
+ * [OWB-220] - Update site.xml links and bread crumbs to point to non-incubator.
+ * [OWB-310] - Drop dom4j and use jre builtin xml parsers for processing beans.xml
+ * [OWB-391] - create a owb-build-tools project to maintain project specific checkstyle rules, etc.
+
+Test
+
+ * [OWB-56] - Integrate the official JSR-299 TCK test suite
+ * [OWB-222] - Update website download link, and fix relative URL translation
+ * [OWB-367] - Add a unit test for IF_EXISTS
+
+
+----------------------------------------------
+Required Platform
+----------------------------------------------
+Java Version : Java SE >= 5.0
+Java EE Must : Java EE >= 5.0
+
+---------------------------------------------
+How to Configure OpenWebBeans
+---------------------------------------------
+
+This section explains a content of the distribution bundle, OWB plugins and its
+dependent libraries.
+
+---------------------------------------------
+1.1.6 Distribution Content
+---------------------------------------------
+There are several jars in the OpenWebBeans 1.0.0 distribution;
+
+ - openwebbeans-impl-1.1.6.jar --> Includes Core Dependency Injection Service.
+ - openwebbeans-ejb-1.1.6.jar --> EJB Plugin(Supports EJBs in OpenEJB embedded in Tomcat).
+ - openwebbeans-jms-1.1.6.jar --> JMS Plugin(Supports injection of JMS related artifacts,i.e, ConnectionFactory, Session, Connection etc.)
+ - openwebbeans-jsf-1.1.6.jar --> JSF-2.0 Plugin(JSF Conversation Scoped Support).
+ - openwebbeans-jsf12-1.1.6.jar --> JSF-1.2 Plugin(JSF Conversation Scoped Support).
+ - openwebbeans-resource-1.1.6.jar --> Java EE Resource Injection for Web Projects (Includes @PersistenceContext,@PersistenceUnit
+ and @Resource injection into the Managed Beans. @Resource injections use java:/comp/env of the
+ Web application component. @PersistenceContext is based on extended EntityManager.
+ - openwebbeans-spi-1.1.6.jar --> OpenWebBeans Server Provider Interfaces. They are implemented by runtime environments that would
+ like to use OpenWebBeans as a JSR-299 implementation.
+ - samples --> Includes source code of the samples. Samples are mavenized project therefore you can easily build and run
+ them from your environment that has maven runtime.
+ - openwebbeans-osgi-1.1.6.jar --> ClassPath ScannerService SPI implementation for OSGI environments like Apache Geronimo-3
+ - openwebbeans-web-1.1.6.jar --> Basic Servlet integration
+ - openwebbeans-tomcat6-1.1.6.jar --> Support for deeper integration into Apache Tomcat-6
+ - openwebbeans-tomcat7-1.1.6.jar --> Support for deeper integration into Apache Tomcat-7
+
+
+
+
+------------------------------------------
+How OWB Plugins Work
+------------------------------------------
+
+OpenWebBeans has been developed with a plugin architecture. The Core dependency injection service
+is provided with openwebbeans-impl. If you need further service functionality,
+you have to add respective plugin jars into the application classpath. OpenWebBeans
+uses the Java SE 6.0 java.util.ServiceLoader mechanism to pickup plugins at runtime.
+If you run under Java SE 5.0, an similar hand written implementation will be used.
+Please do not confuse OWB plugins with portable Extensions! OWB plugins are for
+internal use only whereas portable CDI Extensions will run on any JSR-299 container.
+
+Current Plugins:
+---------------------
+Look at "1.1.6 Distribution Content" above.
+
+------------------------------------------
+Dependent Libraries
+------------------------------------------
+
+Third Party jars:
+-----------------
+They are necessary at runtime in the Core Implementation.
+
+javassist : Version 3.12.0.GA
+scannotation : Version 1.0.2 (if not running in an OSGi environment like Apache Geronimo-3)
+
+Java EE APIs jars(Container Provider Libraries) :
+-------------------------------------------------
+Generally full Java EE servers provides these jars. But web containers like Tomcat or Jetty
+do not contain some of them, such as JPA, JSF, Validation API etc. So, if you do not want to bundle
+these libraries within your application classpath, you have to include these libraries in your
+server common classpath.
+
+jcdi-api (JSR-299 Specification API)
+atinject-api (JSR-330 Specification API)
+servlet-2.5 or servlet 3.0 (Servlet Specification API)
+ejb-3.1 (EJB Specification API)
+el-2.2 (Expression Langauge Specification API)
+jsf-2.0 (Java Server Faces API)
+jsr-250 (Annotation API)
+interceptor-1.1 (Interceptor API)
+jta-1.1 (Java Transaction API)
+jsp.2.1 or jsp-2.2 (Java Server Pages API)
+jpa-2.0 (Java Persistence API)
+jaxws-2.1 or jaxws-2.2 (Java Web Service API)
+jms-1.1 or jms-1.2 (Java Messaging Service API)
+validation (Validation Specification)
+
+Dependencies of OpenWebBeans Maven Modules&Plugins
+--------------------------------------------------
+
+openwebbeans-impl :
+------------------
+Third party : javassist, scannotation, openwebbeans-spi
+Container Provided : jcdi-api, at-inject, servlet, el, jsr-250, interceptor, jta, jsp, validation
+
+openwebbeans-ejb:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : OpenWebBeans EJB plugin is based on OpenEJB in Tomcat. Therefore, if you install OpenEJB
+ within Tomcat correctly, there is no need to add any additional libraries. Look at the
+ OpenEJB in Tomcat configuration section.
+
+openwebbeans-jms:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : jms
+
+openwebbeans-jsf:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : jsf
+
+NOTE : We are trying to decrease dependent libraries of the our core, i.e, openwebbeans-impl.
+At 1.1.6, dependent third party libraries will be decreased. We have a plan to create profile
+plugins, therefore each profile plugin provides its own dependent libraries. For example, in
+fully Java EE Profile Plugin, Transaction API is supported but this will not be the case
+for Java Web Profile Plugin or Java SE Profile Plugin. Stay Tuned!
+
+Currently, as you have seen above, openwebbeans-impl depends on some Java EE/Runtime
+provided libraries (servlet, jsp, el etc). In the future, with OpenWebBeans profiling support,
+openwebbeans-impl will not depend on any Java EE APIs. Those APIs will be provided
+by OpenWebBeans profiles/plugins that openwebbeans-impl will be used. Therefore,
+you will able to use OpenWebBeans in your own runtime environment easily by writing
+your own plugins and contributing it to OpenWebBeans :)
+
+------------------------------------------
+Library Configuration
+------------------------------------------
+To run openwebbeans applications in the Java EE based application server,
+you could add the JSR-299 API and JSR-330 API into the server common classpath, and
+implementation, plugins and dependent jars into your "WEB-INF/lib" directory
+of the Java EE Web Application.
+
+In this release, we can not support the OpenWebBeans as an integrated
+functionality of the Java EE Application Servers. So, you have to manage the
+configuration of the OpenWebBeans within your application's "web.xml" file. A sample "web.xml"
+file can be found in the "config" directory. To use EJB functionality, you also have to
+add OWB specific interceptor into your EJB beans. Look at the EJB section of this readme
+for further details.
+
+---------------------------------------------
+OpenWebBeans Properties File
+---------------------------------------------
+OpenWebBeans uses a default configuration file to configure some of its
+properties. Default configuration files are embedded into OWB implementation
+jar files. Instead of opening the jars file and changing configuration properties, simply add
+an "openwebbeans.properties" file into a "META-INF/openwebbeans" folder of your application
+classpath. This will override the values from the default configuration.
+You can specify a property 'configuraion.ordinal' in this file to define the overlay order.
+A properties file with higher 'configuration.ordinal' value will applied later and thus
+have a higher precedence. If you don't specify a 'configuration.ordinal' a value of 100 is assumed;
+This allows to have multiple openwebbeans.properties files e.g. a common one in an EAR lib
+(with configuration.ordinal=100) and more specific ones for each WebApp in your EAR (with a
+configuration.ordinal of e.g. 101).
+
+Each plugin developer can provide their own SPI implementation class and own configuration values. If you would like
+to use those implementation classes or configuration values, you have to override the default configuration file as explained
+in the above paragraph, i.e, putting "openwebbeans.properties" file into "META-INF/openwebbeans" folder of your application.
+It is recommended to use a 'configuration.ordinal' between 50 and 99 for custom SPI implementations.
+
+Below are OpenWebBeans' default configuration properties from our openwebbeans-impl.jar file and our plugins such as
+our OpenEJB plugin.
+
+Override default value of ResourceInjectionService
+-------------------------------------------------
+org.apache.webbeans.spi.ResourceInjectionService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService
+
+OpenWebBeans uses the "OpenEjbResourceInjectionService" class to inject resources into the managed bean instances.
+
+Configuration Names and Their Default Values :
+
+- "org.apache.webbeans.spi.ContainerLifecycle"
+ Description : Implementation of org.apache.webbeans.spi.ContainerLifecycle. All magic starts from here.
+ Values : org.apache.webbeans.lifecycle.DefaultLifecycle, OR CUSTOM
+ Default : org.apache.webbeans.lifecycle.DefaultLifecycle
+
+- "org.apache.webbeans.spi.JNDIService"
+ Description : Configures JNDI provider implementation.
+ Values : org.apache.webbeans.spi.se.DefaultJndiService OR CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultJndiService
+
+- "org.apache.webbeans.spi.conversation.ConversationService"
+ Description : Implementation of conversation.
+ Values : org.apache.webbeans.spi.conversation.jsf.DefaultConversationService OR CUSTOM
+ Default : org.apache.webbeans.spi.conversation.jsf.DefaultConversationService
+
+- "org.apache.webbeans.spi.ScannerService"
+ Description : Default implementation of org.apache.webbeans.spi.ScannerService. It is used for scanning application deployment
+ for finding bean classes and configuration files.
+ Values : org.apache.webbeans.spi.ee.deployer.DefaultScannerService OR CUSTOM
+ Default : org.apache.webbeans.spi.ee.deployer.DefaultScannerService
+
+- "org.apache.webbeans.spi.SecurityService"
+ Description : Implementation of org.apache.webbeans.spi.SecurityService. It is used for getting current "Principal".
+ Values : org.apache.webbeans.spi.se.DefaultSecurityService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultSecurityService
+
+- "org.apache.webbeans.spi.ValidatorService"
+ Description : Implementation of org.apache.webbeans.spi.ValidatorService. It is used for getting "ValidatorFactory" and "Validator".
+ Values : org.apache.webbeans.spi.se.DefaultValidatorService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultValidatorService
+
+- "org.apache.webbeans.spi.TransactionService"
+ Description : Implementation of org.apache.webbeans.spi.TransactionService. It is used for getting "TransactionManager" and "Transaction".
+ Values : org.apache.webbeans.spi.se.DefaultTransactionService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultTransactionService
+
+- "org.apache.webbeans.spi.ResourceInjectionService"
+ Description : Implementation of org.apache.webbeans.spi.ResourceInjectionService. It is used for injection Java EE enviroment resource into the
+ Managed Bean instances.
+ Values : org.apache.webbeans.se.DefaultResourceInjectionService or CUSTOM
+ Default : org.apache.webbeans.se.DefaultResourceInjectionService
+
+- "org.apache.webbeans.spi.JNDIService.jmsConnectionFactoryJndi"
+ Description : Configures JMS ConnectionFactory object jndi name
+ Values : Server specific JNDI name
+ Default : ConnectionFactory
+
+- "org.apache.webbeans.conversation.Conversation.periodicDelay"
+ Description : Conversation removing thread periodic delay
+ Values : Configured in millisecond
+ Default : 150000 ms
+
+- "org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService"
+ Description : Use EJB functionality or not. If use OpenEJB configures to true
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.spi.FailOverService"
+ Description : Implementation of the org.apache.webbeans.spi.FailOverService. It is used for enabling passivation/failover beans.
+ Values : org.apache.webbeans.web.failover.DefaultOwbFailOverService or CUSTOM
+ Default : org.apache.webbeans.web.failover.DefaultOwbFailOverService
+
+- "org.apache.webbeans.web.failover.issupportfailover"
+ Description : Support failover of beans or not
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.web.failover.issupportpassivation"
+ Description : Support passivation of beans or not
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.forceNoCheckedExceptions"
+ Description : The interceptors spec defines that @PostConstruct & Co must not throw checked Exceptions. Setting this configuration to 'false' disables this check.
+ Values : false, true
+ Default : true
+
+- "org.apache.webbeans.spi.SecurityService"
+ Description : Service to provide methods which must be guarded via doPrivileged blocks.
+ Values : org.apache.webbeans.corespi.security.SimpleSercurityService or org.apache.webbeans.corespi.security.ManagedSecurityService
+ Default : org.apache.webbeans.corespi.security.SimpleSercurityService
+
+
+---------------------------------------------
+EJB Support via Embeddable OpenEJB Container in Tomcat 6.X
+---------------------------------------------
+
+Configuration Steps:
+--------------------------------------------
+1* Download Tomcat 6.X version
+2* Configure OpenEJB. Look at URL http://openejb.apache.org/tomcat.html for installation.
+3* Copy JSR-330 API to Tomcat /lib folder.
+4* Copy JSR-299 API to Tomcat /lib folder
+5* Put all dependent libraries of the OpenWebBeans OpenEJB Plugin
+ - openwebbeans-ejb
+ - openwebbeans-impl and its dependencies
+
+You could look at ejb-sample.war for "WEB-INF/lib" libraries as an example to develop custom applications.
+The source of this project is also available.
+
+To use EJB functionality, you will use OpenEJB collapse-ear support. In this configuration,
+your EJB beans live within your "war" bundle.
+
+How to Develop EJB Applications
+---------------------------------------------
+1* Add "META-INF/openwebbeans.properties" into your application classpath.
+2* Add "org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService=true" to use EJB functionality.
+ So OWB container looks for EJBs.
+3* Add "org.apache.webbeans.resource.spi.ResourceService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService to
+use OpenEJB Resource injections.
+4* Add "openwebbeans-ejb", plugin into your web application classpath.
+5* If you want to use other plugins, add respective plugins into your application classpath. For example, if you wish to use
+JSF framework, you add "openwebbeans-jsf" plugin.
+6* Add OWB related interceptor into your EJB Beans. This is called "org.apache.webbeans.ejb.interceptor.OpenWebBeansEjbInterceptor"
+This is needed for OWB injections.
+7* Update your application's "web.xml" to add OWB specific configuration.
+
+---------------------------------------------
+How to Run Samples
+---------------------------------------------
+
+In this release, there are several sample applications located in the "/samples" directory
+of the distribution. You can run those samples via simple maven command.
+
+1) "Guess Application" : Simple usage of the OWB + JSF.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+2) "Hotel Reservation Application" : Show usage of JSF + JPA + OWB
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+3) "EJB Sample Application" : Shows the usage of EJBs with embeddable OpenEJB in Tomcat. Firstly
+configure OpenEJB with Tomcat as explained above.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+4) "EJB Telephone Application" : Shows the usage of OpenEJB resource injection service.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+5) "JMS Injection Sample" : Show JMS injections. JMS injection currently uses
+ ConnectionFactory as JMS connection factory jndi name. You can change this
+ via configuration file. Look above explanation for how to configure JMS jndi. Also,
+ JMS injection requires to use of a JMS provider. Generally Java EE servers contains
+ default JMS provider. It can be run on JBoss and Geronimo. It uses Queue with jndi_name = "queue/A".
+ So you have to create a queue destination in your JMS provider with name "queue/A" to run example.
+ If you want to change queue jndi name, then look at source and change it from "WEB-INF/beans.xml" file.
+
+6) "Conversation Sample" : Shows usage of JSF conversations.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+7) "JSF2 Sample" : Shows usage of JSF2 Ajax.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section. It requires
+to use JSF2 runtime.
+
+
+8) "Standalone Sample" : Shows usage of OpenWebBeans in Standalone Swing Application.
+Look at "OpenWebBeans in Java SE" section.
+
+Configuring and Running the Applications:
+--------------------------------------------
+See section Compile and Run Samples via Jetty&Tomcat Plugin.
+
+--------------------------------------------
+Maven Install and Package From the Source
+--------------------------------------------
+
+Maven Version : Apache Maven 2.2.1 or later
+
+First you have to download the "source" version of the OpenWebBeans project that
+contains the all source code of the OpenWebBeans.
+
+To install the Maven artifacts of the project from the source, Maven must be installed
+in your runtime. After Maven installation, just run the following command in the top level
+directory that contains the main "pom.xml" :
+
+> mvn clean install
+
+This command will install all the Maven artifacts into your local Maven repository.
+
+If you wish to package all artifacts of the project, just run the following command
+in in the top level directory that contains the main "pom.xml" :
+
+> mvn clean package
+
+This command will package the project artifacts from the source and put these artifacts into the each modules
+respective "target" directory.
+
+-------------------------------------------
+Compile and Run Samples via Tomcat&Jetty Plugin
+-------------------------------------------
+This section shows how to run samples in Jetty or OpenEJB Embedded Tomcat.
+
+------------------------------------------
+Samples Run within Jetty Plugin
+------------------------------------------
+You can compile and run "guess","jsf2","conversation-sample" and "reservation "samples via maven Jetty plugin.
+Go to the source bundle "samples/" directory. In the "guess/" or "reservation/" directory, run
+the following maven commands. It will start up maven Jetty container. It bundles all of the
+required jars into the WEB-INF/lib folder. You are not required to add any jar to the classpath.
+
+Samples : Guess and Reservation
+------------------------------
+Go to the source folder of projects and run
+
+> mvn clean install -Pjetty
+> mvn jetty:run -Pjetty
+
+Guess URL : http://localhost:8080/guess
+Reservation URL : http://localhost:8080/reservation
+
+Samples : Conversation Sample and JSF2
+-------------------------------------
+Go to the source folder of projects and run
+
+>mvn clean install
+>mvn jetty:run
+
+Conversation Sample URL : http://localhost:8080/conversation-sample
+JSF2 Sample URL : http://localhost:8080/jsf2sample
+
+------------------------------------------
+Samples Run within Tomcat Plugin
+------------------------------------------
+OpenEJB samples are run with Maven Tomcat Plugin.
+
+Tomcat Plugin uses http://localhost:8080/manager application to deploy war file
+into your embeddable EJB Tomcat container. There must be an tomcat-users.xml
+file in the "conf" directory of the server that contains manager role and username.
+
+>Start Tomcat server if not started
+>mvn tomcat:deploy
+
+Ejb Sample URL : http://localhost:8080/ejb-sample
+Ejb Telephone URL : http://localhost:8080/ejb-telephone
+
+Example tomcat-users.xml file
+------------------------------------------
+<tomcat-users>
+<role rolename="manager"/>
+<user username="admin" password="" roles="manager"/>
+</tomcat-users>
+
+-----------------------------------------
+Deploy JMS Sample
+-----------------------------------------
+Simple drops jms-sample.war file into your application deploy location.
+
+JMS Sample Example URL : Hit the url http://localhost:8080/jms-sample/sender.jsf for sending JMS messages
+ Hit the url http://localhost:8080/jms-sample/receiver.jsf for receiving JMS messages
+
+-----------------------------------------
+OpenWebBeans in Java SE
+----------------------------------------
+OpenWebBeans can be used in Java SE environments such as Java Swing
+applications. A Standalone Sample is provided to show how to use OpenWebBeans
+in Java SE.
+
+Go to the source directory of the standalone sample:
+>mvn clean package;
+>cd target;
+>jar -xvf standalone-sample.jar
+>java -jar standalone-sample-1.1.6-SNAPSHOT.jar
+>Enjoy :)
+
+-----------------------------------------------
+OpenWebBeans User and Development Mailing Lists
+-----------------------------------------------
+Please mail to the user mailing list with any questions or advice
+about the OpenWebBeans.
+
+User Mailing List : [users@openwebbeans.apache.org]
+
+You can also join the discussions happening in the dev list
+
+Dev Mailing List : [dev@openwebbeans.apache.org]
+
+-------------------------------------------
+OpenWebBeans JIRA Page
+-------------------------------------------
+Please logs bugs into the "https://issues.apache.org/jira/browse/OWB".
+
+------------------------------------------
+OpenWebBeans Wiki and Blog Page
+-----------------------------------------
+Wiki: http://cwiki.apache.org/OWB/
+Introduction to OpenWebBeans : http://cwiki.apache.org/OWB/introduction-to-openwebbeans.html
+Blog : http://blogs.apache.org/owb
+
+-----------------------------------------
+OpenWebBeans Web Page
+----------------------------------------
+You can reach the OpenWebBeans web page at
+http://openwebbeans.apache.org
+---------------------------------------
+
+Your Apache OpenWebBeans Team
+
+Enjoy!
diff --git a/owb_1.2.x/readme/README_1_2_0.txt b/owb_1.2.x/readme/README_1_2_0.txt
new file mode 100644
index 0000000..dd1486a
--- /dev/null
+++ b/owb_1.2.x/readme/README_1_2_0.txt
@@ -0,0 +1,1273 @@
+-------------------------------
+Apache OpenWebBeans 1.2.0
+-------------------------------
+Welcome!
+
+Thanks for downloading and using OpenWebBeans.
+This document is a "Getting Started Guide" for OpenWebBeans.
+
+This document is based on the 1.2.0 release of Apache OpenWebBeans.
+
+--------------------------------
+What is Apache OpenWebBeans?
+--------------------------------
+OpenWebBeans is an Apache License V 2.0 licensed implementation of the JSR-299,
+Contexts and Dependency Injection for the Java EE platform.
+
+It also already incorporates some features which are part of JSR-346 (CDI-1.1)
+but doesn't need API changes as we still use the JCDI-1.0 API. The
+incorporated CDI-1.1 features are mostly parts which are not well
+defined in the CDI-1.0 specification, like Serialisation checks, etc.
+
+Our project's web page can be found at:
+http://openwebbeans.apache.org
+
+The projects WIKI page can be found at:
+https://cwiki.apache.org/confluence/display/OWB/Index
+
+
+
+--------------------------------
+OpenWebBeans 1.2.0 Release Features
+--------------------------------
+
+- The 1.2.0 release supports the following features
+-----------------------------------
+* Managed Beans Support
+* Session Beans Support (via Embeddable OpenEJB container in Tomcat)
+* Producer Method Support
+* Producer Field Support
+* Java EE Resource Injection Support
+* JMS OpenWebBeans Support(OWB Specific)
+* Inheritance, Stereotype Inheritances
+* Specialization Support
+* Event Support
+* Decorator and Interceptor Support
+* Lookup and Dependency Injection Support
+* Java EE Plugin Support (via ServetContextListener interface)
+* Portable Integration Support
+* Passivation Capability of Beans
+* @Alternative support
+* OSGi environment support with an own plugable bundle ClassPath scanner
+* vastly improved Interceptor performance
+* plugable SecurityManager integration doubles speed if no SecurityManager is being used
+* improved Serialization handling
+* improved CreationalContext handling
+* revised internal logging
+* upgrade to JPA-2 and JSF-2 support
+* support for direct CDI usage in tomcat-6 and tomcat-7 environments
+* optional lenient lifecycle interceptor checking
+* automatically detect if BeanManager#isInUse()
+* improved Serialization checks from the CDI-1.1 specification
+
+
+
+Noteable differences to CDI spec behaviour
+--------------------------------------------
+
+In a few special cases Apache OpenWebBeans might behave a little bit different than
+other CDI implementations. This is to some degree caused by the JSR-299 spec being
+not clear about some special topics so we needed to interpret the wording on our own.
+This mainly concerns the area of section 12.1 Bean Archives (BDA) which doesn't work
+out when it comes to OSGi containers and likes.
+In Apache OpenWebBeans, a settings configured in a beans.xml file of a BDA is not
+only effective for this very bean archive but for the whole BeanManager in control
+of the Application. This is especially the case for <alternatives> and
+<interceptors>! An Alternative, Interceptor or Decorator enabled in one BDA is active
+for the whole Application. This behaviour will most likely also be the default behaviour
+in the CDI-1.1 JSR-346 specification.
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.2.0
+-------------------------------------------
+
+Bug
+
+ [OWB-151] - @Dependent beans not interceptable
+ [OWB-187] - Interceptors with lifecycle and @AroundInvoke permitted to have bindingtypes containing method-level annotations
+ [OWB-306] - overrridden @AroundInvoke and lifecycle interceptors are still run
+ [OWB-392] - AbstractInjectable#dependentInstanceOfProducerMethods must not be static nor public
+ [OWB-423] - OpenWebBeansEjbInterceptor is LATE in establishing the request context for an EJB
+ [OWB-468] - Make BeansDeployer.deployFromClassPath(ScannerService) resilient to ClassNotFoundException and NoClassDefFoundError's
+ [OWB-497] - Don't break deployment if java can't read all the annotations
+ [OWB-513] - proxies should be inactive after a container shutdown
+ [OWB-549] - Security review needed for ClassUtil
+ [OWB-556] - bean with interceptor + @PreDestroy causes a NullPointerException
+ [OWB-568] - Decorater for generic Interfaces does not work
+ [OWB-569] - OpenWebBeans uses the Java Reflection API to discover program element types and annotations in addition to the AnnotatedType
+ [OWB-570] - Interceptors must support retry
+ [OWB-572] - OwbParametrizedTypeImpl s equals method is broken
+ [OWB-575] - ResourceProxyHandler.invoke should unwrap and throw the underlying cause of the InvocationTargetException
+ [OWB-665] - invocation order of @PostConstruct interceptors
+ [OWB-714] - EmptyStackException when accessing an instance that is created by a producer method that has an InjectionPoint as parameter.
+ [OWB-722] - @Typed not respected for beans using generics
+ [OWB-728] - AbstractProducer stores CreationalContext
+ [OWB-729] - review CreationalContext in Interceptor and Decorator creation
+ [OWB-730] - remove InjectionTargetWrapper
+ [OWB-733] - CLONE - ClassLoader leak in WebBeansUtil.isScopeTypeNormalCache
+ [OWB-739] - CLONE - Ambiguous producer methods and fields are not detected due to bug in AbstractProducerBean equals and hashCode
+ [OWB-740] - NPE while removing dependent beans
+ [OWB-748] - Implement CDI-132
+ [OWB-749] - Move Interceptor stuff to InterceptorManager
+ [OWB-750] - OWB annotationlitteral use instanceof to implement equals and not annotationType()
+ [OWB-754] - fix PassivationCapable detection
+ [OWB-759] - Decorator position not well managed if the decorator is abstract
+ [OWB-764] - constructor with multiple InjectionPoints cause Exception
+ [OWB-767] - DefaultBDABeansXmlScanner synchronizes without visibility guarantees
+ [OWB-768] - add support for proxying protected methods in NormalScopedProxyFactory
+ [OWB-769] - Serialisation support for our new InterceptorDecoratorProxies
+ [OWB-775] - error on shutdown doesn't cleanup WebBeansFinder map
+ [OWB-776] - private and protected producer methods do not properly de-reference the contextual instance
+ [OWB-777] - InjectableMethod must unwrap normalscoping proxies
+ [OWB-778] - InterceptorBean must unwrap InjectionTargetExceptions
+ [OWB-784] - WebContextsService bypasses spi contract of ContextsService
+ [OWB-788] - deployment error when a @Specializes bean is disabled via an Extension
+ [OWB-791] - only one generic is handled for injections of ManagedBeans
+ [OWB-793] - "Ambigious" typo
+ [OWB-794] - AbstractOwbBean#toString doesn't reflect ParameterizedTypes
+ [OWB-801] - null instance shouldn't be destroyed (copy)
+ [OWB-802] - #annotationType() of javax.enterprise:cdi-api not compatible with AbstractAnnotationLiteral
+ [OWB-803] - Forever loop when abstract decorator does not implement invoked method
+ [OWB-805] - CLONE - @Alternative is ignored when using the Provider interface.
+ [OWB-806] - CLONE - Overloaded EJB Observer methods fail to deploy
+ [OWB-807] - performance issue with owb-arquillian-standalone
+ [OWB-813] - CLONE - #annotationType() of javax.enterprise:cdi-api not compatible with AbstractAnnotationLiteral
+ [OWB-817] - the jsf module(s) are bound to a specific el version
+ [OWB-818] - StandaloneResourceInjectionService can lead to injection of 'null'
+ [OWB-822] - ejb should be tested first and not after having defined a managed bean
+ [OWB-823] - EJBs support ee injections
+ [OWB-824] - annotated field events should get the associated annotatedfield
+ [OWB-825] - don't fire the same PAT event for a bean intercepted by itself (ejb interceptor style)
+ [OWB-828] - broken proxies in case of bridge methods
+ [OWB-829] - generate our proxies with 2 $$
+ [OWB-831] - filtering producers by annotated type is too strict (java type should be enough) since it prevents extensions to add producers
+ [OWB-832] - ejb producers should use ejb view methods
+ [OWB-833] - disposal injection points shouldn't be listed in getInjectionPoints() method
+ [OWB-834] - self interceptors have lifecycle methods
+ [OWB-835] - even resource should be serializable
+ [OWB-836] - auto interception ignored when no other reason to proxy the class
+ [OWB-837] - lifecycle interceptors can't catch exceptions
+ [OWB-838] - putting bean dependent instances first in dependent objects
+ [OWB-839] - interceptor lifecycle methods (@postConstruct,...) should be ignored for method interceptors
+ [OWB-840] - don't create decorators if the asked instance if the delegate
+ [OWB-842] - lazy mode for @New on ejbs
+ [OWB-845] - @Disposes not validated
+ [OWB-848] - deserialization of normal-scoped proxies for PassivationCapable beans fails
+ [OWB-849] - org.apache.webbeans.portable.ProviderBasedProxyProducer uses the wrong classloader
+ [OWB-850] - all provider based producer can't be proxied -> handling dependent scope
+ [OWB-855] - NPE when no default constructor is found
+ [OWB-856] - Currently in OpenWebBeans one can add exactly one AnnotatedType
+ [OWB-857] - NullPointerException on passivation
+ [OWB-858] - AnnotatedTypeImpl not thread safe
+ [OWB-861] - Decorator building fails when decorator has inheritance
+ [OWB-862] - allow independent bootstrapping
+
+Improvement
+
+ [OWB-479] - detect loops in producer beans vs. producer method parameters at deployment time
+ [OWB-488] - move WebBeansConfigurationException messages to message bundles
+ [OWB-551] - Reduce static synchronized hashmap usage even further
+ [OWB-603] - Incorporate enhanced BeanArchive handling of the preliminary CDI-1.1 specification
+ [OWB-632] - re-visit WebBeansUtil#isPassivationCapable
+ [OWB-715] - Remove EL22 implementation from Core to Own Project
+ [OWB-717] - Remove Failover implementation from Web to Own Project
+ [OWB-727] - introduce a static INSTANCE for DefaultLiteral, AnyLiteral, etc
+ [OWB-735] - remove CreationalContextWrapper
+ [OWB-744] - change the name of all Bean<T> implementations to reflect this fact
+ [OWB-753] - remove lazy Bean initialisation
+ [OWB-765] - Implement BeanAttributes
+ [OWB-766] - Use CreationalContextImpl to pass info about InjectionPoint, Event, etc
+ [OWB-772] - typo in exception message wrt passivation capable dependencies
+ [OWB-779] - ScannerService using xbean
+ [OWB-797] - AnnotationManager checks the same annotations again
+ [OWB-819] - check injectable reference for normal-scoped beans
+ [OWB-852] - Improve getContextsService performance
+
+New Feature
+
+ [OWB-321] - Conversation beans could not be populated to non-faces request by a JSF redirect navigation rule
+ [OWB-495] - create a jetty integration plugin
+ [OWB-606] - create bundles for standard use cases like JSF-webapp, standalone, etc
+ [OWB-671] - Automatically register FailOverFilter if failover is activated
+ [OWB-710] - openwebbeans-arquillian container
+ [OWB-756] - implement BeanAttributes and ProcessBeanAttritubes
+ [OWB-830] - Implement Instance#destory
+
+Task
+
+ [OWB-692] - remove ContextsFactory
+ [OWB-726] - upgrade trunk (OWB-1.2.x) to target java 1.6
+ [OWB-781] - Remove all Javassist and Scannotation related parts from OWB
+ [OWB-859] - Remove checkstyle double-checked locking rule
+
+Wish
+
+ [OWB-344] - implement Decorators and Interceptors as subclassing
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.8
+-------------------------------------------
+
+Bug
+
+ [OWB-700] - ProcessInjectionTarget.setInjectionTarget() has no effect when trying to post process beans
+ [OWB-723] - Interceptors doesn't work for beans got from stereotype annotated producer methods
+ [OWB-736] - NPE while removing dependent beans
+ [OWB-742] - @Alternative is ignored when using the Provider interface.
+ [OWB-743] - Overloaded EJB Observer methods fail to deploy
+ [OWB-751] - OWB annotation litterals implementation uses only instanceof in equals implementation
+ [OWB-760] - CLONE - Decorator position not well managed if the decorator is abstract
+ [OWB-761] - position in DelegateHandler shouldn't be static
+ [OWB-785] - WebContextsService isn't compatible with actor-frameworks
+ [OWB-790] - owb-1.1.x - deployment error when a @Specializes bean is disabled via an Extension
+
+New Feature
+
+ [OWB-789] - owb-1.1.x - openwebbeans-arquillian container
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.7
+-------------------------------------------
+
+Bug
+
+ [OWB-711] - Specialization does not deactivate Observer methods in parent class
+ [OWB-713] - Static observer methods of superclasses are not called when a method with the same name and parameters exists in the subclass
+ [OWB-718] - Decorator can't call two methods of the delegate object in the same method
+ [OWB-719] - @Named qualifier is not adhering to CDI spec default naming conventions
+ [OWB-720] - injections using generic not well managed
+ [OWB-722] - @Typed not respected for beans using generics
+ [OWB-724] - Ambiguous producer methods and fields are not detected due to bug in AbstractProducerBean equals and hashCode
+ [OWB-725] - Beans containing a producerMethod are using the wrong CreationalContext
+ [OWB-732] - ClassLoader leak in WebBeansUtil.isScopeTypeNormalCache
+ [OWB-734] - CLONE - AbstractProducer stores CreationalContext
+
+Task
+
+ [OWB-712] - Enable console output for checkstyle
+ [OWB-721] - create a branch for OWB-1.1.x maintenance and switch trunk to 1.2.0-SNAPSHOT
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.6
+-------------------------------------------
+
+Bug
+
+ [OWB-694] - Misleading exception message "Wrong termination object"
+ [OWB-696] - check for unproxyable API types should get moved to the validateBeans phase
+ [OWB-697] - Non-Static Loggers leads to NonSerizializableException
+ [OWB-698] - InjectableBeanManager not serializable
+ [OWB-703] - getBeans cache key algorithm must be unique
+ [OWB-707] - tomcat-sample and tomcat7-sample are just broken.
+ [OWB-708] - PrincipalBean doesn't get found
+ [OWB-709] - webbeans-tomcat6 must honour WEB-INF/classes/META-INF/beans.xml
+
+Improvement
+
+ [OWB-695] - Cause missing in AnnotationDB$CrossReferenceException
+ [OWB-701] - Support ASM for Bean Proxies
+ [OWB-702] - Add serialization unit tests to openwebbeans-web to catch future regressions
+ [OWB-704] - use method filter in javassist proxies instead of "manual" filtering
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.5
+-------------------------------------------
+
+Bug
+
+ * [OWB-498] - Java EE Resource Injections for CDI Interceptors & Decorators
+ * [OWB-605] - tomcat plugins must register WebBeansConfigurationListener as first Listener
+ * [OWB-663] - Maven dependencies between impl and spi
+ * [OWB-666] - invalid check in AnnotationManager#checkStereoTypeClass
+ * [OWB-667] - Bean queries have strange behavior (difference between Open Web Beans and the Reference Implementation)
+ * [OWB-669] - Bean fail over is not in sync with specs
+ * [OWB-672] - Decorators creates Stackoverflow or NPE if under heavy load
+ * [OWB-673] - injecttarget are not updated after ProcessInjectionTarget event
+ * [OWB-676] - CdiTest OwbContainer fails if WebContainerLifecycle is being used
+ * [OWB-677] - improve getBeans cache key algorithm
+ * [OWB-680] - drop unused getInstance() methods from our services
+ * [OWB-681] - remove deprecated methods from BeanManagerImpl
+ * [OWB-682] - get rid of OWB InterceptorType and usejavax.enterprise.inject.spi.InterceptionType instead
+ * [OWB-683] - remove obsolete Methods from our Bean implementations and handlers
+ * [OWB-685] - OwbApplicationFactory doesn't set Application
+ * [OWB-686] - OWBApplicationFactory wrappedApp should be consistent between getter and setter and volatile
+ * [OWB-687] - clean up non-static loggers
+ * [OWB-688] - fix non-serializable fields in Serializable classes
+ * [OWB-689] - OWBInjector should be stateless
+ * [OWB-690] - WebContextsService cleanup should get reworked
+ * [OWB-693] - webbeans-web shall not declare StandaloneResourceInjectionService
+
+Improvement
+
+ * [OWB-674] - rewrite owb logger api
+ * [OWB-684] - move from ancient 'ContextTypes' definition to standadrd scope annotations
+
+Task
+
+ * [OWB-678] - Check for unused classes and remove them
+ * [OWB-691] - Sonar cleanup before the 1.1.5 release
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.4
+-------------------------------------------
+
+Bug
+
+ * [OWB-567] - Lookup of Provider results in NullPointerException on get()
+ * [OWB-574] - NewBean doesn't support EJBs
+ * [OWB-580] - ObserverMethodImpl needs support for EJB's whose Bean Types do not include the EJB class
+ * [OWB-602] - OpenWebBeans OpenEJB integration OSGi bundle declares the wrong version for the javax.transaction package
+ * [OWB-617] - NullPointerException in InstanceBean#createInstance
+ * [OWB-628] - Event injection doesn't work in observer methods.
+ * [OWB-633] - define stereotypes & thirdparty
+ * [OWB-634] - @Interceptors added by extension ignored
+ * [OWB-636] - Samples point to parent pom file that doesn't exist
+ * [OWB-643] - it isn't possible to add/remove @Alternative during the bootstrapping process
+ * [OWB-644] - wrong config entry for LoaderService
+ * [OWB-645] - InjectionPoint is null when using @Produces. NullPointerException caused by CDI container providing a null InjectionPoint into a producer method.
+ * [OWB-646] - Failover does not work (again)
+ * [OWB-648] - regression on tck org.jboss.jsr299.tck.tests.lookup.injectionpoint.InjectableReferenceTest
+ * [OWB-649] - exceptions in EJB's are wrapped in InvocationTargetException
+ * [OWB-655] - CDI doesn´t inject stateless EJB by abstract class.
+ * [OWB-658] - BeanManager.getBeans(Type, Annotation...) can not be used to query all known beans
+ * [OWB-659] - An annotated interface class is being seen as a manage bean.
+ * [OWB-660] - WebBeansContext #activateContext for SessionScoped.class doesn't set the ThreadLocal
+
+Improvement
+
+ * [OWB-596] - Provide info about injetion point for "Passivation capable beans must satisfy passivation capable dependencies ..."
+ * [OWB-604] - more details for exceptions during bootstrapping
+ * [OWB-635] - support callbacks (@PostContrcut, @PreDestroy) in Extensions
+ * [OWB-637] - [perf] ELContextStore.destroyDependents() creates unnecessary HashMap$KeyIterator instances
+ * [OWB-638] - [PERF] Avoid unnecessary AbstractList$Itr instances
+ * [OWB-639] - [perf] InjectionResolver.getBeanCacheKey creates many StringBuilder instances
+ * [OWB-641] - the jee5-ejb-resource module should support @EJB(mappedName)
+ * [OWB-647] - [PERF] Avoid unnecessary StringBuilder instances - improve checkNullInstance, checkScopeType, ... methods
+ * [OWB-653] - remove @ViewScoped support
+ * [OWB-657] - review startup performance
+ * [OWB-661] - hashCode, equals and toString() of our built in Qualifier Literals should be implemented ourselfs
+
+Task
+
+ * [OWB-656] - remove webbeans-openejb
+ * [OWB-662] - remove obsolete class WebBeansAnnotation
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.3
+-------------------------------------------
+
+Bug
+
+ * [OWB-515] - interceptors don't support inheritance without an overridden method annotated with @AroundInvoke
+ * [OWB-565] - missing check for producer methods
+ * [OWB-625] - BeanManager.resolve throw java.util.NoSuchElementException with an empty set parameter
+ * [OWB-629] - NoClassDefFoundError for optional dependencies
+ * [OWB-630] - AmbiguousResolutionException thrown for Decorators that Decorate multiple beans where any of those beans are passivation capable.
+ * [OWB-631] - openwebbeans-resource misses openwebbeans.properties
+
+Improvement
+
+ * [OWB-475] - support for optional beans
+ * [OWB-627] - Automatically destroy @Dependent contextual instances created with Instance<T>
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.2
+-------------------------------------------
+
+Bug
+
+ * [OWB-562] - non-enabled alternative beans with passivating scope fail validation during deployment
+ * [OWB-589] - " ... requires a passivation capable dependency ..." for producer method with return type String and non serializable injected dependency
+ * [OWB-597] - StackOverFlow when injecting product in same bean where @Produces is placed
+ * [OWB-615] - remove @Overrides for interfaces to be java5 compatible
+ * [OWB-616] - javax.el.ExpressionFactory has final methods! CDI doesn't allow that. - Test on final **PRIVATE** methods too?
+ * [OWB-618] - we sometimes invoke a dispose method without having created the bean upfront
+ * [OWB-619] - @New beans must only exist if there is at least one injection point for them
+ * [OWB-620] - any disabled bean of passivating scope will wrongly be detected as 'not passivatable'
+ * [OWB-622] - beanmanager injection in afterBeanDiscovery method parameter
+ * [OWB-624] - AnnotatedTypes registered in BeforeBeanDiscovery might get processed twice
+
+Improvement
+
+ * [OWB-623] - Relax check on @AroundInvoke Interceptors 'throws Exception'
+
+New Feature
+
+ * [OWB-621] - Alternative configuration method for buggy container or pre servlet api 2.5 container
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.1
+-------------------------------------------
+
+Bug
+
+ * [OWB-406] - BaseEjbBean.removedStatefulInstance used by multiple instances/EjbBeanProxyHandlers
+ * [OWB-447] - unnecessary contextual/non-contextual distinction in OpenWebBeansEJBIntercpetor
+ * [OWB-449] - EJB interceptor has incorrect/unnecessary use of business method checks
+ * [OWB-483] - Problem with mulitple custom interceptors and passivation
+ * [OWB-512] - ApplicationContext and SingletonContext in WebContextsService
+ * [OWB-554] - DelegateHandler wraps Beans exceptions
+ * [OWB-558] - PassivationCapable bean id's for Producer Fields do not take into account generics
+ * [OWB-561] - Multiple contexts with the same Scope are not handled properly -- causing tck failures
+ * [OWB-563] - producers of passivating beans fail when the declared return type is not serializable but the actual return type is
+ * [OWB-566] - ProcessInjectionTarget event gets fired too early
+ * [OWB-571] - fix site build under maven3 and upgrade logo
+ * [OWB-573] - Invalid checking of Interceptor serialization capabilities for non-Passivation capable EJBs
+ * [OWB-576] - FileNotFoundException on WebSphere
+ * [OWB-577] - FileNotFoundException on WebSphere
+ * [OWB-578] - Allow DI for OpenWebBeansConfiguration properties
+ * [OWB-579] - check for non-proxyiable methods should exclude synthetic methods
+ * [OWB-581] - Decorator interface check needs configurable exclusions
+ * [OWB-584] - check for declared name consistency for specializes beans is wrong
+ * [OWB-585] - ProcessSessionBean doesn't deal with generic type quite right (CDITCK-215)
+ * [OWB-586] - Interceptors added by portable extensions don't work
+ * [OWB-587] - Use business interface for producer and disposer methods of Session beans
+ * [OWB-588] - PrincipalBean is misspelled
+ * [OWB-590] - Seam Persistence does not work with OWB - AfterBeanDiscovery.addBean will be ignored
+ * [OWB-591] - EJB @Specializes inheritance
+ * [OWB-593] - Interceptor binding added on an interceptor class at ProcessAnnotatedType phase is not considered
+ * [OWB-595] - Use case "Faces Request Generates Non-Faces Response" locks conversation forever (-> BusyConversationException)
+ * [OWB-598] - InjectionResolver crashes with a NPE when injecting a method parameter
+ * [OWB-599] - move getBeanXmls() back to Set<URL>
+ * [OWB-600] - cache information about non intercepted methdos in ProxyHandlers
+ * [OWB-601] - WebContextsService only works if ServletContext is given
+ * [OWB-608] - openwebbeans-el10 plugin misses openwebbeans.properties
+ * [OWB-614] - add LICENSE and NOTICE files to all our samples
+
+Improvement
+
+ * [OWB-555] - ClassUtil methods contain spelling, camelcase, etc., type errors
+ * [OWB-557] - #setAccessible(false) isn't needed
+ * [OWB-560] - upgrade the TCK to 1.0.4.SP1
+ * [OWB-564] - CdiTestOpenWebBeansContainer - check if a std.-context is active before destroying it
+ * [OWB-582] - Support for Java 1.5 (needed for WebSphere 6.1)
+ * [OWB-583] - Support for Servlet API 2.4 (needed for WebSphere 6.1)
+ * [OWB-594] - create a configurable mapping Scope->ProxyMethodHandlerImplementation
+ * [OWB-607] - upgrade our samples to newest available dependencies
+ * [OWB-610] - upgrade to apache parent pom 10
+ * [OWB-611] - adding ASF trademark documentation to our official site build
+ * [OWB-612] - upgrade various maven plugins
+ * [OWB-613] - Exclude Samples WARs Publishing with Maven
+
+Task
+
+ * [OWB-592] - EJB Specialization utility method
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.1.0
+-------------------------------------------
+
+Bug
+
+ * [OWB-295] - resolve bugs in Javassist Proxy
+ * [OWB-417] - BaseEjbBean.destroyComponentInstance() should call direct container remove API, not call an @Remove annotated method
+ * [OWB-422] - Support needed for PrePassivate, PostActivate, and AroundTimeout via EJBInterceptor.
+ * [OWB-444] - Using Static Loggers in Shared ClassLoader
+ * [OWB-452] - set active flag to false then context is destroyed
+ * [OWB-456] - When multiple interceptors are defined for a bean OWB does NOT correctly remove the overridden base Interceptors
+ * [OWB-469] - JSR299TCK: Security Error / Passivation errors during readObject
+ * [OWB-470] - OWBInjector does not work correctly for EJB Beans
+ * [OWB-471] - Possible StackOverflowException from defineProducerMethods in WebBeansAnnotatedTypeUtil
+ * [OWB-473] - bundles that use javasissist to proxy their contents need to import some javassist packages
+ * [OWB-474] - InjectionTargetBean#injectSuperResources is missing
+ * [OWB-477] - Two instances of using ObjectInputStream that may not have visibility into application classloader
+ * [OWB-480] - Avoid a couple NPEs
+ * [OWB-482] - Small issues
+ * [OWB-486] - ResourceBean tries to proxy final classes before testing them for being final
+ * [OWB-489] - AnnotatedTypes added with BeforeBeanDiscovery.addAnnotatedType method are ignored
+ * [OWB-490] - ProcessObserverMethod Type parameters are inverted (CDITCK-174)
+ * [OWB-491] - Decorators init needs to scan superclasses for more interfaces. cf CDITCK-178
+ * [OWB-492] - events don't get sent to private @Observes methods
+ * [OWB-493] - ProcessProducerMethod and ProcessProducerField type parameters are reversed in filtering (?) CDITCK-168
+ * [OWB-494] - Subclasses with non-overriden observer methods not recognized as beans with observer methods
+ * [OWB-496] - Don't replace the ProxyFactory classloaderProvider without the intention to do so
+ * [OWB-499] - WEB-INF/beans.xml of a war will not activate Bean Archive behaviour
+ * [OWB-502] - Only cache the ContextService once, in the SingletonService
+ * [OWB-504] - OwbApplicationFactory getWrapped should return wrapped application factory
+ * [OWB-505] - OwbApplicationFactory should not be installed by default
+ * [OWB-509] - Unwrap InvocationTargetException in ResourceProxyHandler.invokie
+ * [OWB-510] - return null instead of an unusable proxy if a resource is missing
+ * [OWB-511] - Delegate actualInstance serialization behavior in ResourceProxyHandler
+ * [OWB-514] - Leak in ELContextStore
+ * [OWB-519] - broken wls support
+ * [OWB-521] - ProducerMethodBean could theoretically produce a NPE
+ * [OWB-522] - Missing updateTimeout in one of begin methods for conversation
+ * [OWB-523] - @SessionScoped bean failover does not work
+ * [OWB-524] - OWB classpath scanning of non-jars doesn't work if the classpath contains spaces
+ * [OWB-527] - JspFactory.getDefaultFactory() is synchronized, We can cache the return value to improve performance
+ * [OWB-529] - lazy initialized class members should be volatile
+ * [OWB-530] - multi massive execution of our Interceptor test unveils a concurrency problem
+ * [OWB-531] - cleanup WebBeansELResolver#getValue
+ * [OWB-533] - concurrency bottleneck due to use of our logger
+ * [OWB-534] - Injection of @PersistenceContext does not work with abstract/base classes
+ * [OWB-541] - replace WeakHashMap with a standard one in InterceptorHandler
+ * [OWB-542] - Disposer is called twice on Dependent beans when injected into a managed object that is called from a JSP
+ * [OWB-543] - get rid of checked Exceptions in our SPI
+ * [OWB-545] - Cleanup our SecurityManager integration
+ * [OWB-546] - @Typed gets ignored if we use a AnnotatedType from an Extension @Observing ProcessAnnotatedType
+ * [OWB-547] - WebContextsService throws NPE on asynchronous app startup
+ * [OWB-548] - missing null check in DefaultContextsService#stopApplicationContext
+ * [OWB-550] - duplicated observer methods in case of @Specializes
+
+Improvement
+
+ * [OWB-209] - remove all <repositories> from our poms
+ * [OWB-254] - suppress initialising contextual handling for configurable URIs.
+ * [OWB-335] - implement a sample for @ViewScoped in reservation
+ * [OWB-393] - remove old XML configuration code
+ * [OWB-448] - More changes for decorator and interceptor passivation support
+ * [OWB-461] - source code quality
+ * [OWB-472] - archive centric beans.xml enabling
+ * [OWB-478] - make OWB build maven-3 aware
+ * [OWB-485] - AmbiguousResolutionException doesn't print details about the injection point
+ * [OWB-500] - improved app-server support
+ * [OWB-503] - Reduce static synchronized hashmap usage
+ * [OWB-506] - Upgrade our samples to Apache MyFaces-2.0.3 and OpenJPA-2.0.1
+ * [OWB-507] - our samples should be prepared for EE as default
+ * [OWB-508] - Dependent scope proxies are needed to wrap the build-in beans returned from the services if they are not serializable yet
+ * [OWB-516] - Get TCK standalone 1.0.4 CR2
+ * [OWB-517] - Conversation Log Improvement
+ * [OWB-518] - log all bean-archive markers
+ * [OWB-520] - spi for the webbeans-jee5-ejb-resource plugin
+ * [OWB-525] - create a findbugs filter file in our build-tools resource
+ * [OWB-526] - remove usage of java.net.URLs from ScannerService and drop scannotation
+ * [OWB-535] - free ScannerService resources once we don't need it anymore
+ * [OWB-536] - revisit our Logger usage in our Bean impls
+ * [OWB-537] - clear() AnnotatedElementFactory after the deployment
+ * [OWB-539] - fill AnnotatedTypeImpl lazily
+ * [OWB-540] - StandaloneResourceInjectionService should cache info about classes which don't contain EE resource injection points
+ * [OWB-544] - improve BeanManager#getContext performance
+
+New Feature
+
+ * [OWB-433] - add a configuration flag for switching to a lenient lifecycle interceptor checking
+ * [OWB-501] - owb ee 5 resource integration
+ * [OWB-528] - Use ApplicationWrapper as parent of OwbApplication in JSF 2 plugin
+ * [OWB-532] - create a new BeanManager#isInUse()
+ * [OWB-538] - lazy loading of not explicitly marked (via annotation or registered by extension) Dependent beans
+
+Question
+
+ * [OWB-383] - static fields in CreationalContext
+
+TCK Challenge
+
+ * [OWB-484] - Running TCK 1.0.1 Final and Respective Corrections
+
+Task
+
+ * [OWB-19] - Geronimo Integration
+ * [OWB-428] - implementation of equals and hashCode for AbstractOwbBean
+ * [OWB-453] - add a flag to disable context activation in EJB interceptor
+
+
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0
+-------------------------------------------
+
+Bug
+
+ * [OWB-318] - multiple methods with same EJB @interceptors(foo.class) in same bean class get multiple interceptor instances
+ * [OWB-384] - OWB needs to call 299-defined PrePassivate, PostActivate, and AroundTimeout interceptors for EJBs
+ * [OWB-422] - Support needed for PrePassivate, PostActivate, and AroundTimeout via EJBInterceptor.
+ * [OWB-429] - OpenWebBeansEjbPlugin Class Hierarchy
+ * [OWB-438] - Cached Normal Scoped Proxy instances
+ * [OWB-439] - EjbPlugin session bean proxy creation thread safe problem
+ * [OWB-445] - we must not use javassist ProxyFactory#setHandler(MethodHandler)
+ * [OWB-446] - EJB lifecycle callbacks not stacked correctly
+ * [OWB-450] - NullPointerException in DependentScopedBeanInterceptorHandler when it has a NullCreationalContext (normally from a EE component).
+ * [OWB-454] - ClassUtil.callInstanceMethod() doesn't propogate original exception
+ * [OWB-455] - IllegalArgument method calling remove method of EJB during destroy
+ * [OWB-456] - When multiple interceptors are defined for a bean OWB does NOT correctly remove the overriden base Interceptors
+ * [OWB-457] - we must not create a SessionContext for static resource reqeusts
+ * [OWB-460] - fix owb-openejb and owb-ejb artifactIds
+ * [OWB-464] - InjectionPointImpl using wrong class loader during serialize/deserialize, dropping qualifiers, and omiting qualifier values.
+ * [OWB-466] - Ensure removal of all ThreadLocal values
+
+Improvement
+
+ * [OWB-177] - Handling of InterceptionType#POST_ACTIVATE, PRE_PASSIVATE and AROUND_TIMEOUT is missing
+ * [OWB-407] - detailed information about exceptions
+ * [OWB-451] - Allow InterceptorUtil#callAroundInvokes to propogate a callers 'creational context key'
+ * [OWB-459] - upgrade to newer library versions
+ * [OWB-463] - EjbDefinitionUtility.defineEjbBeanProxy() should be able to create proxies for no-interface local beans
+ * [OWB-465] - enhance EJB common code for crude @LocalBean support
+
+TCK Challenge
+
+ * [OWB-394] - Any idea why our BeforeBeanDiscovery.addInterceptorBinding() has different signature?
+
+Task
+
+ * [OWB-453] - add a flag to disable context activation in EJB interceptor
+ * [OWB-462] - Refactor AnnotationUtil.hasAnnotationMember()
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0-alpha-2
+-------------------------------------------
+Bug
+
+ * [OWB-303] - upgrade Javassist to a newer version
+ * [OWB-338] - our internal SessionContext and ConversationContext must support Session serialization
+ * [OWB-385] - implement passivation of managed beans in ServletContextListener
+ * [OWB-401] - ELContextStore not cleaned up for some JSP EL lookups
+ * [OWB-402] - OpenWebBeansJsfPlugin does not recognize @ManagedBean
+ * [OWB-404] - Contexts must not get stored in a static Map in BeanManager
+ * [OWB-405] - AnnotatedElementFactory must not use static cache maps
+ * [OWB-408] - NPE in WebBeansELResolver
+ * [OWB-415] - EjbBeanProxyHandler for dependent ejb must save ejb instance
+ * [OWB-416] - BaseEJBBean.destroyComponentInstance() tries to call multiple remove methods
+ * [OWB-418] - EjbBeanProxyHandler must be 1:1 with proxy instances for dependent SFSB
+ * [OWB-419] - fix @Dependent handling in ELResolver
+ * [OWB-420] - SingletonContext is mapped to @ConversationScoped
+ * [OWB-421] - defined-in-class EJB lifecycle callbacks masked by our Interceptor
+ * [OWB-426] - Tweak EJBPlugin to work with Standalone Tests
+ * [OWB-431] - Generic Type Inheritance not resolved correctly
+ * [OWB-434] - ThreadLocal<SingletonContext> doen't get cleaned up
+ * [OWB-436] - AbstractContext bean instance creation is not thread safe
+ * [OWB-437] - Improve AbstractContext synchronization
+ * [OWB-440] - WebBeansDecoratorConfig.getDecoratorStack always returns new Decorators
+ * [OWB-442] - our EJB proxies are broken when multiple local interfaces are used on a single class
+ * [OWB-443] - Normal-scoped EJB not removed by container during Contextual.destroy()
+
+Improvement
+
+ * [OWB-57] - cleanup problems found by maven-findbugs-plugin
+ * [OWB-195] - Give warning to the developer related with non- portable operations
+ * [OWB-409] - create a name for OWB our faces-config.xml
+ * [OWB-410] - lazy initialisation of ejbInterceptors
+ * [OWB-411] - cache calls to isNormalScope()
+ * [OWB-412] - Allow container specific extensions to WebConfigurationListener access to the lifecycle
+ * [OWB-413] - cache calls to ClassUtils#getObjectMethodNames()
+ * [OWB-414] - improve Interceptor performance
+ * [OWB-425] - improve performance of owb-el-resolver
+ * [OWB-427] - improve read-performance of AbstractOwbBean
+ * [OWB-430] - improve performance of WebBeansPhaseListener
+ * [OWB-432] - Create Singleton Service SPI
+ * [OWB-441] - new configuration properties mechanism
+
+Sub-task
+
+ * [OWB-193] - If an interceptor or decorator has any scope other than @Dependent, non-portable behavior results.
+ * [OWB-194] - If an interceptor or decorator has a name, non-portable behavior results.
+ * [OWB-196] - If an interceptor or decorator is an alternative, non-portable behavior results.
+ * [OWB-197] - If a stereotype declares any other qualifier an- notation, non-portable behavior results.
+ * [OWB-198] - If a stereotype is annotated @Typed, non-portable behavior results.
+
+
+TCK Challenge
+
+ * [OWB-424] - Adding Document for How to Configure and Run TCK (standalone and web profile TCKs)
+
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version 1.0.0-alpha-1
+-------------------------------------------
+Bug
+
+ * [OWB-216] - Update pom.xml svn links
+ * [OWB-231] - exception using abstract decorators
+ * [OWB-245] - Using parameterized type varaibles fails for Producer Method injection
+ * [OWB-259] - Implement spec 11.5.5. ProcessModule event
+ * [OWB-289] - Owb return 2 beans for Indirect specialized producer beans
+ * [OWB-302] - InjectionPoint injections (both method and field based) in Decorators result in null
+ * [OWB-312] - Add dopriv's to allow OWB to function with java 2 security enabled
+ * [OWB-317] - creationalContext in InvocationContextImpl is always null
+ * [OWB-318] - multiple methods with same EJB @interceptors(foo.class) in same bean class get multiple interceptor instances
+ * [OWB-327] - annotating an Interceptor with @ApplictionScoped leads to OutOfMemory
+ * [OWB-329] - Interceptor instances get created each time the interceptor gets called
+ * [OWB-332] - Destroy Depdent Of Producer Method Beans when Invocation Completes
+ * [OWB-333] - InjectionTarget and Producer Handling
+ * [OWB-334] - cid is missing when using redirect for a jsf 2.0 application
+ * [OWB-336] - injected BeanManager must be Serializable
+ * [OWB-337] - events must not get broadcasted to beans which have no active Context
+ * [OWB-339] - Injecting Non-Contextual Beans Causes NPE in WebBeansUtil
+ * [OWB-340] - BeanManagerImpl.createInjectionTarget() Throws Exception When No Constructor Found
+ * [OWB-341] - CreationalContext#incompleteInstance should get cleaned after create()
+ * [OWB-342] - InterceptorHandler crashes with NullPointerException after deserialisation
+ * [OWB-343] - upgrade JPA spec from 1.0-PFD2 to 1.0 final revision
+ * [OWB-345] - Remove duplicate dependencies
+ * [OWB-351] - OWB picks up @SessionScoped contextual instances from expired sessions
+ * [OWB-352] - Thread Safety Problem in our InterceptorHandlers, aka proxies
+ * [OWB-353] - NPE in removeDependents@CreationalContextImpl
+ * [OWB-354] - WebContextService may throw NPE in tiered classloading environmemt
+ * [OWB-357] - WebbeansFinder should index first on ClassLoader, not singleton type
+ * [OWB-359] - ownerCreationalContext sometimes causes NPE in InterceptorDataImpl.createNewInstance()
+ * [OWB-361] - underlying EJB method not actually in our interceptors stack
+ * [OWB-362] - InvocationTargetException when invoking Stateless SessionBean
+ * [OWB-363] - Intermittent bug with ApplicationScope disposers not being called
+ * [OWB-366] - ContextNotActiveException fired from AppScope/NormalScopedBeanInterceptorHandler when a proxied object finalized
+ * [OWB-368] - The 299 spec (that I have) uses receive=IF_EXISTS but OWB uses notifyObserver=IF_EXISTS.
+ * [OWB-369] - Static ContextsService in ContextFactory causes wrong webContextService used for multiple applications
+ * [OWB-370] - Intransient Conversation context get rdestroyed randomly by destroyWithRespectToTimout
+ * [OWB-371] - no lifecycle interceptors for non-contextual EJB
+ * [OWB-372] - creational context not cleaned up for non-contextual EJB interceptions
+ * [OWB-373] - build crashes with missing artifact error
+ * [OWB-374] - migrate jsf2sample from sun to MyFaces
+ * [OWB-376] - [patch] Guess example broken with Jetty plugin 6.x due to EL 2.2
+ * [OWB-377] - revise logging
+ * [OWB-378] - ejb at bottom of decorator stack doesn't handle changed method
+ * [OWB-380] - NormalScopedBeanInterceptorHandler throws NPE when handling 3rd party Contexts
+ * [OWB-381] - NPE thrown from AbstractInjectable if dependent producer returns null
+ * [OWB-382] - injecting a @Dependent bean into a passivatation scoped bean causes a NonSerializableException
+ * [OWB-387] - DependentContext Interceptor Double Call for PostConstruct
+ * [OWB-390] - fix broken links in our 'site'
+ * [OWB-396] - fix poms to work with maven 3
+ * [OWB-398] - DelegateHandler cached too agressively
+ * [OWB-399] - Proxy objects could not be correctly deserialized by using javassist 3.11. we need to update to 3.12
+ * [OWB-400] - starting OWB as part of an EAR in geronimo causes a exception due to missing 'bundle' protocol
+
+Improvement
+
+ * [OWB-116] - Update Business Method Definition
+ * [OWB-118] - Supports Decorators for Other Delegate Injections
+ * [OWB-136] - fix 'broken' license headers in our java files
+ * [OWB-170] - Address findbug issues in webbeans-impl
+ * [OWB-183] - Improve webbeans-doc module to get a documentation more user friendly
+ * [OWB-214] - get rid of javax.transaction.Transaction dependency in webbeans-impl
+ * [OWB-237] - NoSuchElementException when WebBeansConfigurationListener is absent
+ * [OWB-275] - remove unused imports and cleanup code
+ * [OWB-286] - java.lang.NoClassDefFoundError: javax/validation/Validator
+ * [OWB-313] - create caching strategies for resolving Bean<T> for BeanManager and EL invocations
+ * [OWB-314] - cache resolved instances in NormalScopedBeanMethodHandlers of @ApplicationScoped beans
+ * [OWB-315] - cache resolved instances in NormalScopedBeanMethodHandlers of @SessionScoped beans
+ * [OWB-319] - Strange logging when writing non-Serializable SessionScoped bean
+ * [OWB-320] - Remove Java EE Dependencies from WebBeans Core
+ * [OWB-322] - Create new EJB project and separate common EJB classes from OpenEJB plugin
+ * [OWB-325] - Relocate SPI Classes to SPI Module. Change JSR299, JSR330 as optional pom dependency.
+ * [OWB-326] - improve producer tests
+ * [OWB-328] - improve logger performance
+ * [OWB-330] - reduce BeanManagerImpl#getManager() calls inside the same functions
+ * [OWB-331] - Cache Interceptor & Decorator Stack oon Interceptor Handler
+ * [OWB-346] - Make EJB samples running
+ * [OWB-347] - Using InjectableBeanManager in TCK
+ * [OWB-349] - ignore exception during type hierarchy scan
+ * [OWB-350] - Support Interceptor for non-contextual EJBs
+ * [OWB-355] - OpenEjbBean should look for @Remove methods
+ * [OWB-356] - EjbPlugin only looks for DeployementInfo once, so new deployed application won't be discovered
+ * [OWB-358] - provide property to skip injection in @PostConstruct of OpenWebBeansEjbInterceptor
+ * [OWB-360] - Add BeanManager to a ServletContext attribute
+ * [OWB-364] - Reduce the amount of info level logging
+ * [OWB-365] - make injection optional in OWBEJBInterceptor
+ * [OWB-375] - Performance: OWB logging performs operations when logging disabled.
+ * [OWB-379] - upgrade to final atinject-spec artifact
+ * [OWB-386] - upgarde CDI TCK to 1.0.2.CR1
+ * [OWB-389] - atinject-tck upgrade to final 1.0 release
+ * [OWB-397] - Add helper method and some debug to WebBeansFinder
+
+New Feature
+
+ * [OWB-316] - Implement a generic TestContainer for CDI implementations
+ * [OWB-323] - Provide methods to pass classloader into ServiceLoader and WebBeansFinder for use in tiered classloader situations
+ * [OWB-324] - Add Tomcat Plugin
+ * [OWB-348] - Adding Interceptor and Decorator Support for EJB Beans
+ * [OWB-395] - OpenWebBeans Tomcat 7 Support
+
+TCK Challenge
+
+ * [OWB-388] - Pass TCK 1.0.2 CR1 Web Profile
+
+Task
+
+ * [OWB-6] - Scope passivation
+ * [OWB-14] - Update WebBeans Lifecycle for Servlet Beans
+ * [OWB-46] - Injection into non-contextual objects
+ * [OWB-204] - Update Samples for JSF2 Usage
+ * [OWB-220] - Update site.xml links and bread crumbs to point to non-incubator.
+ * [OWB-310] - Drop dom4j and use jre builtin xml parsers for processing beans.xml
+ * [OWB-391] - create a owb-build-tools project to maintain project specific checkstyle rules, etc.
+
+Test
+
+ * [OWB-56] - Integrate the official JSR-299 TCK test suite
+ * [OWB-222] - Update website download link, and fix relative URL translation
+ * [OWB-367] - Add a unit test for IF_EXISTS
+
+
+----------------------------------------------
+Required Platform
+----------------------------------------------
+Java Version : Java SE >= 5.0
+Java EE Must : Java EE >= 5.0
+
+---------------------------------------------
+How to Configure OpenWebBeans
+---------------------------------------------
+
+This section explains a content of the distribution bundle, OWB plugins and its
+dependent libraries.
+
+---------------------------------------------
+1.1.6 Distribution Content
+---------------------------------------------
+There are several jars in the OpenWebBeans 1.0.0 distribution;
+
+ - openwebbeans-impl-1.1.6.jar --> Includes Core Dependency Injection Service.
+ - openwebbeans-ejb-1.1.6.jar --> EJB Plugin(Supports EJBs in OpenEJB embedded in Tomcat).
+ - openwebbeans-jms-1.1.6.jar --> JMS Plugin(Supports injection of JMS related artifacts,i.e, ConnectionFactory, Session, Connection etc.)
+ - openwebbeans-jsf-1.1.6.jar --> JSF-2.0 Plugin(JSF Conversation Scoped Support).
+ - openwebbeans-jsf12-1.1.6.jar --> JSF-1.2 Plugin(JSF Conversation Scoped Support).
+ - openwebbeans-resource-1.1.6.jar --> Java EE Resource Injection for Web Projects (Includes @PersistenceContext,@PersistenceUnit
+ and @Resource injection into the Managed Beans. @Resource injections use java:/comp/env of the
+ Web application component. @PersistenceContext is based on extended EntityManager.
+ - openwebbeans-spi-1.1.6.jar --> OpenWebBeans Server Provider Interfaces. They are implemented by runtime environments that would
+ like to use OpenWebBeans as a JSR-299 implementation.
+ - samples --> Includes source code of the samples. Samples are mavenized project therefore you can easily build and run
+ them from your environment that has maven runtime.
+ - openwebbeans-osgi-1.1.6.jar --> ClassPath ScannerService SPI implementation for OSGI environments like Apache Geronimo-3
+ - openwebbeans-web-1.1.6.jar --> Basic Servlet integration
+ - openwebbeans-tomcat6-1.1.6.jar --> Support for deeper integration into Apache Tomcat-6
+ - openwebbeans-tomcat7-1.1.6.jar --> Support for deeper integration into Apache Tomcat-7
+
+
+
+
+------------------------------------------
+How OWB Plugins Work
+------------------------------------------
+
+OpenWebBeans has been developed with a plugin architecture. The Core dependency injection service
+is provided with openwebbeans-impl. If you need further service functionality,
+you have to add respective plugin jars into the application classpath. OpenWebBeans
+uses the Java SE 6.0 java.util.ServiceLoader mechanism to pickup plugins at runtime.
+If you run under Java SE 5.0, an similar hand written implementation will be used.
+Please do not confuse OWB plugins with portable Extensions! OWB plugins are for
+internal use only whereas portable CDI Extensions will run on any JSR-299 container.
+
+Current Plugins:
+---------------------
+Look at "1.1.6 Distribution Content" above.
+
+------------------------------------------
+Dependent Libraries
+------------------------------------------
+
+Third Party jars:
+-----------------
+They are necessary at runtime in the Core Implementation.
+
+javassist : Version 3.12.0.GA
+scannotation : Version 1.0.2 (if not running in an OSGi environment like Apache Geronimo-3)
+
+Java EE APIs jars(Container Provider Libraries) :
+-------------------------------------------------
+Generally full Java EE servers provides these jars. But web containers like Tomcat or Jetty
+do not contain some of them, such as JPA, JSF, Validation API etc. So, if you do not want to bundle
+these libraries within your application classpath, you have to include these libraries in your
+server common classpath.
+
+jcdi-api (JSR-299 Specification API)
+atinject-api (JSR-330 Specification API)
+servlet-2.5 or servlet 3.0 (Servlet Specification API)
+ejb-3.1 (EJB Specification API)
+el-2.2 (Expression Langauge Specification API)
+jsf-2.0 (Java Server Faces API)
+jsr-250 (Annotation API)
+interceptor-1.1 (Interceptor API)
+jta-1.1 (Java Transaction API)
+jsp.2.1 or jsp-2.2 (Java Server Pages API)
+jpa-2.0 (Java Persistence API)
+jaxws-2.1 or jaxws-2.2 (Java Web Service API)
+jms-1.1 or jms-1.2 (Java Messaging Service API)
+validation (Validation Specification)
+
+Dependencies of OpenWebBeans Maven Modules&Plugins
+--------------------------------------------------
+
+openwebbeans-impl :
+------------------
+Third party : javassist, scannotation, openwebbeans-spi
+Container Provided : jcdi-api, at-inject, servlet, el, jsr-250, interceptor, jta, jsp, validation
+
+openwebbeans-ejb:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : OpenWebBeans EJB plugin is based on OpenEJB in Tomcat. Therefore, if you install OpenEJB
+ within Tomcat correctly, there is no need to add any additional libraries. Look at the
+ OpenEJB in Tomcat configuration section.
+
+openwebbeans-jms:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : jms
+
+openwebbeans-jsf:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : jsf
+
+NOTE : We are trying to decrease dependent libraries of the our core, i.e, openwebbeans-impl.
+At 1.1.6, dependent third party libraries will be decreased. We have a plan to create profile
+plugins, therefore each profile plugin provides its own dependent libraries. For example, in
+fully Java EE Profile Plugin, Transaction API is supported but this will not be the case
+for Java Web Profile Plugin or Java SE Profile Plugin. Stay Tuned!
+
+Currently, as you have seen above, openwebbeans-impl depends on some Java EE/Runtime
+provided libraries (servlet, jsp, el etc). In the future, with OpenWebBeans profiling support,
+openwebbeans-impl will not depend on any Java EE APIs. Those APIs will be provided
+by OpenWebBeans profiles/plugins that openwebbeans-impl will be used. Therefore,
+you will able to use OpenWebBeans in your own runtime environment easily by writing
+your own plugins and contributing it to OpenWebBeans :)
+
+------------------------------------------
+Library Configuration
+------------------------------------------
+To run openwebbeans applications in the Java EE based application server,
+you could add the JSR-299 API and JSR-330 API into the server common classpath, and
+implementation, plugins and dependent jars into your "WEB-INF/lib" directory
+of the Java EE Web Application.
+
+In this release, we can not support the OpenWebBeans as an integrated
+functionality of the Java EE Application Servers. So, you have to manage the
+configuration of the OpenWebBeans within your application's "web.xml" file. A sample "web.xml"
+file can be found in the "config" directory. To use EJB functionality, you also have to
+add OWB specific interceptor into your EJB beans. Look at the EJB section of this readme
+for further details.
+
+---------------------------------------------
+OpenWebBeans Properties File
+---------------------------------------------
+OpenWebBeans uses a default configuration file to configure some of its
+properties. Default configuration files are embedded into OWB implementation
+jar files. Instead of opening the jars file and changing configuration properties, simply add
+an "openwebbeans.properties" file into a "META-INF/openwebbeans" folder of your application
+classpath. This will override the values from the default configuration.
+You can specify a property 'configuraion.ordinal' in this file to define the overlay order.
+A properties file with higher 'configuration.ordinal' value will applied later and thus
+have a higher precedence. If you don't specify a 'configuration.ordinal' a value of 100 is assumed;
+This allows to have multiple openwebbeans.properties files e.g. a common one in an EAR lib
+(with configuration.ordinal=100) and more specific ones for each WebApp in your EAR (with a
+configuration.ordinal of e.g. 101).
+
+Each plugin developer can provide their own SPI implementation class and own configuration values. If you would like
+to use those implementation classes or configuration values, you have to override the default configuration file as explained
+in the above paragraph, i.e, putting "openwebbeans.properties" file into "META-INF/openwebbeans" folder of your application.
+It is recommended to use a 'configuration.ordinal' between 50 and 99 for custom SPI implementations.
+
+Below are OpenWebBeans' default configuration properties from our openwebbeans-impl.jar file and our plugins such as
+our OpenEJB plugin.
+
+Override default value of ResourceInjectionService
+-------------------------------------------------
+org.apache.webbeans.spi.ResourceInjectionService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService
+
+OpenWebBeans uses the "OpenEjbResourceInjectionService" class to inject resources into the managed bean instances.
+
+Configuration Names and Their Default Values :
+
+- "org.apache.webbeans.spi.ContainerLifecycle"
+ Description : Implementation of org.apache.webbeans.spi.ContainerLifecycle. All magic starts from here.
+ Values : org.apache.webbeans.lifecycle.DefaultLifecycle, OR CUSTOM
+ Default : org.apache.webbeans.lifecycle.DefaultLifecycle
+
+- "org.apache.webbeans.spi.JNDIService"
+ Description : Configures JNDI provider implementation.
+ Values : org.apache.webbeans.spi.se.DefaultJndiService OR CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultJndiService
+
+- "org.apache.webbeans.spi.conversation.ConversationService"
+ Description : Implementation of conversation.
+ Values : org.apache.webbeans.spi.conversation.jsf.DefaultConversationService OR CUSTOM
+ Default : org.apache.webbeans.spi.conversation.jsf.DefaultConversationService
+
+- "org.apache.webbeans.spi.ScannerService"
+ Description : Default implementation of org.apache.webbeans.spi.ScannerService. It is used for scanning application deployment
+ for finding bean classes and configuration files.
+ Values : org.apache.webbeans.spi.ee.deployer.DefaultScannerService OR CUSTOM
+ Default : org.apache.webbeans.spi.ee.deployer.DefaultScannerService
+
+- "org.apache.webbeans.spi.SecurityService"
+ Description : Implementation of org.apache.webbeans.spi.SecurityService. It is used for getting current "Principal".
+ Values : org.apache.webbeans.spi.se.DefaultSecurityService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultSecurityService
+
+- "org.apache.webbeans.spi.ValidatorService"
+ Description : Implementation of org.apache.webbeans.spi.ValidatorService. It is used for getting "ValidatorFactory" and "Validator".
+ Values : org.apache.webbeans.spi.se.DefaultValidatorService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultValidatorService
+
+- "org.apache.webbeans.spi.TransactionService"
+ Description : Implementation of org.apache.webbeans.spi.TransactionService. It is used for getting "TransactionManager" and "Transaction".
+ Values : org.apache.webbeans.spi.se.DefaultTransactionService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultTransactionService
+
+- "org.apache.webbeans.spi.ResourceInjectionService"
+ Description : Implementation of org.apache.webbeans.spi.ResourceInjectionService. It is used for injection Java EE enviroment resource into the
+ Managed Bean instances.
+ Values : org.apache.webbeans.se.DefaultResourceInjectionService or CUSTOM
+ Default : org.apache.webbeans.se.DefaultResourceInjectionService
+
+- "org.apache.webbeans.spi.JNDIService.jmsConnectionFactoryJndi"
+ Description : Configures JMS ConnectionFactory object jndi name
+ Values : Server specific JNDI name
+ Default : ConnectionFactory
+
+- "org.apache.webbeans.conversation.Conversation.periodicDelay"
+ Description : Conversation removing thread periodic delay
+ Values : Configured in millisecond
+ Default : 150000 ms
+
+- "org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService"
+ Description : Use EJB functionality or not. If use OpenEJB configures to true
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.spi.FailOverService"
+ Description : Implementation of the org.apache.webbeans.spi.FailOverService. It is used for enabling passivation/failover beans.
+ Values : org.apache.webbeans.web.failover.DefaultOwbFailOverService or CUSTOM
+ Default : org.apache.webbeans.web.failover.DefaultOwbFailOverService
+
+- "org.apache.webbeans.web.failover.issupportfailover"
+ Description : Support failover of beans or not
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.web.failover.issupportpassivation"
+ Description : Support passivation of beans or not
+ Values : false, true
+ Default : false
+
+- "org.apache.webbeans.forceNoCheckedExceptions"
+ Description : The interceptors spec defines that @PostConstruct & Co must not throw checked Exceptions. Setting this configuration to 'false' disables this check.
+ Values : false, true
+ Default : true
+
+- "org.apache.webbeans.spi.SecurityService"
+ Description : Service to provide methods which must be guarded via doPrivileged blocks.
+ Values : org.apache.webbeans.corespi.security.SimpleSercurityService or org.apache.webbeans.corespi.security.ManagedSecurityService
+ Default : org.apache.webbeans.corespi.security.SimpleSercurityService
+
+
+---------------------------------------------
+EJB Support via Embeddable OpenEJB Container in Tomcat 6.X
+---------------------------------------------
+
+Configuration Steps:
+--------------------------------------------
+1* Download Tomcat 6.X version
+2* Configure OpenEJB. Look at URL http://openejb.apache.org/tomcat.html for installation.
+3* Copy JSR-330 API to Tomcat /lib folder.
+4* Copy JSR-299 API to Tomcat /lib folder
+5* Put all dependent libraries of the OpenWebBeans OpenEJB Plugin
+ - openwebbeans-ejb
+ - openwebbeans-impl and its dependencies
+
+You could look at ejb-sample.war for "WEB-INF/lib" libraries as an example to develop custom applications.
+The source of this project is also available.
+
+To use EJB functionality, you will use OpenEJB collapse-ear support. In this configuration,
+your EJB beans live within your "war" bundle.
+
+How to Develop EJB Applications
+---------------------------------------------
+1* Add "META-INF/openwebbeans.properties" into your application classpath.
+2* Add "org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService=true" to use EJB functionality.
+ So OWB container looks for EJBs.
+3* Add "org.apache.webbeans.resource.spi.ResourceService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService to
+use OpenEJB Resource injections.
+4* Add "openwebbeans-ejb", plugin into your web application classpath.
+5* If you want to use other plugins, add respective plugins into your application classpath. For example, if you wish to use
+JSF framework, you add "openwebbeans-jsf" plugin.
+6* Add OWB related interceptor into your EJB Beans. This is called "org.apache.webbeans.ejb.interceptor.OpenWebBeansEjbInterceptor"
+This is needed for OWB injections.
+7* Update your application's "web.xml" to add OWB specific configuration.
+
+---------------------------------------------
+How to Run Samples
+---------------------------------------------
+
+In this release, there are several sample applications located in the "/samples" directory
+of the distribution. You can run those samples via simple maven command.
+
+1) "Guess Application" : Simple usage of the OWB + JSF.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+2) "Hotel Reservation Application" : Show usage of JSF + JPA + OWB
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+3) "EJB Sample Application" : Shows the usage of EJBs with embeddable OpenEJB in Tomcat. Firstly
+configure OpenEJB with Tomcat as explained above.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+4) "EJB Telephone Application" : Shows the usage of OpenEJB resource injection service.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+5) "JMS Injection Sample" : Show JMS injections. JMS injection currently uses
+ ConnectionFactory as JMS connection factory jndi name. You can change this
+ via configuration file. Look above explanation for how to configure JMS jndi. Also,
+ JMS injection requires to use of a JMS provider. Generally Java EE servers contains
+ default JMS provider. It can be run on JBoss and Geronimo. It uses Queue with jndi_name = "queue/A".
+ So you have to create a queue destination in your JMS provider with name "queue/A" to run example.
+ If you want to change queue jndi name, then look at source and change it from "WEB-INF/beans.xml" file.
+
+6) "Conversation Sample" : Shows usage of JSF conversations.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+7) "JSF2 Sample" : Shows usage of JSF2 Ajax.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section. It requires
+to use JSF2 runtime.
+
+
+8) "Standalone Sample" : Shows usage of OpenWebBeans in Standalone Swing Application.
+Look at "OpenWebBeans in Java SE" section.
+
+Configuring and Running the Applications:
+--------------------------------------------
+See section Compile and Run Samples via Jetty&Tomcat Plugin.
+
+--------------------------------------------
+Maven Install and Package From the Source
+--------------------------------------------
+
+Maven Version : Apache Maven 2.2.1 or later
+
+First you have to download the "source" version of the OpenWebBeans project that
+contains the all source code of the OpenWebBeans.
+
+To install the Maven artifacts of the project from the source, Maven must be installed
+in your runtime. After Maven installation, just run the following command in the top level
+directory that contains the main "pom.xml" :
+
+> mvn clean install
+
+This command will install all the Maven artifacts into your local Maven repository.
+
+If you wish to package all artifacts of the project, just run the following command
+in in the top level directory that contains the main "pom.xml" :
+
+> mvn clean package
+
+This command will package the project artifacts from the source and put these artifacts into the each modules
+respective "target" directory.
+
+-------------------------------------------
+Compile and Run Samples via Tomcat&Jetty Plugin
+-------------------------------------------
+This section shows how to run samples in Jetty or OpenEJB Embedded Tomcat.
+
+------------------------------------------
+Samples Run within Jetty Plugin
+------------------------------------------
+You can compile and run "guess","jsf2","conversation-sample" and "reservation "samples via maven Jetty plugin.
+Go to the source bundle "samples/" directory. In the "guess/" or "reservation/" directory, run
+the following maven commands. It will start up maven Jetty container. It bundles all of the
+required jars into the WEB-INF/lib folder. You are not required to add any jar to the classpath.
+
+Samples : Guess and Reservation
+------------------------------
+Go to the source folder of projects and run
+
+> mvn clean install -Pjetty
+> mvn jetty:run -Pjetty
+
+Guess URL : http://localhost:8080/guess
+Reservation URL : http://localhost:8080/reservation
+
+Samples : Conversation Sample and JSF2
+-------------------------------------
+Go to the source folder of projects and run
+
+>mvn clean install
+>mvn jetty:run
+
+Conversation Sample URL : http://localhost:8080/conversation-sample
+JSF2 Sample URL : http://localhost:8080/jsf2sample
+
+------------------------------------------
+Samples Run within Tomcat Plugin
+------------------------------------------
+OpenEJB samples are run with Maven Tomcat Plugin.
+
+Tomcat Plugin uses http://localhost:8080/manager application to deploy war file
+into your embeddable EJB Tomcat container. There must be an tomcat-users.xml
+file in the "conf" directory of the server that contains manager role and username.
+
+>Start Tomcat server if not started
+>mvn tomcat:deploy
+
+Ejb Sample URL : http://localhost:8080/ejb-sample
+Ejb Telephone URL : http://localhost:8080/ejb-telephone
+
+Example tomcat-users.xml file
+------------------------------------------
+<tomcat-users>
+<role rolename="manager"/>
+<user username="admin" password="" roles="manager"/>
+</tomcat-users>
+
+-----------------------------------------
+Deploy JMS Sample
+-----------------------------------------
+Simple drops jms-sample.war file into your application deploy location.
+
+JMS Sample Example URL : Hit the url http://localhost:8080/jms-sample/sender.jsf for sending JMS messages
+ Hit the url http://localhost:8080/jms-sample/receiver.jsf for receiving JMS messages
+
+-----------------------------------------
+OpenWebBeans in Java SE
+----------------------------------------
+OpenWebBeans can be used in Java SE environments such as Java Swing
+applications. A Standalone Sample is provided to show how to use OpenWebBeans
+in Java SE.
+
+Go to the source directory of the standalone sample:
+>mvn clean package;
+>cd target;
+>jar -xvf standalone-sample.jar
+>java -jar standalone-sample-1.1.6-SNAPSHOT.jar
+>Enjoy :)
+
+-----------------------------------------------
+OpenWebBeans User and Development Mailing Lists
+-----------------------------------------------
+Please mail to the user mailing list with any questions or advice
+about the OpenWebBeans.
+
+User Mailing List : [users@openwebbeans.apache.org]
+
+You can also join the discussions happening in the dev list
+
+Dev Mailing List : [dev@openwebbeans.apache.org]
+
+-------------------------------------------
+OpenWebBeans JIRA Page
+-------------------------------------------
+Please logs bugs into the "https://issues.apache.org/jira/browse/OWB".
+
+------------------------------------------
+OpenWebBeans Wiki and Blog Page
+-----------------------------------------
+Wiki: http://cwiki.apache.org/OWB/
+Introduction to OpenWebBeans : http://cwiki.apache.org/OWB/introduction-to-openwebbeans.html
+Blog : http://blogs.apache.org/owb
+
+-----------------------------------------
+OpenWebBeans Web Page
+----------------------------------------
+You can reach the OpenWebBeans web page at
+http://openwebbeans.apache.org
+---------------------------------------
+
+Your Apache OpenWebBeans Team
+
+Enjoy!
diff --git a/owb_1.2.x/readme/README_M1.txt b/owb_1.2.x/readme/README_M1.txt
new file mode 100644
index 0000000..6edfba6
--- /dev/null
+++ b/owb_1.2.x/readme/README_M1.txt
@@ -0,0 +1,165 @@
+--------------------------------
+What is OpenWebBeans?
+--------------------------------
+OpenWebBeans is an ASL-License implementation of the JSR-299, Java Context and Dependency Injection Specification.
+
+Project web page could be found at the URL :
+http://incubator.apache.org/projects/openwebbeans.html
+
+--------------------------------
+OpenWebBeans M1 Release Content
+--------------------------------
+
+- M1 Release Supports the followings
+-----------------------------------
+* Simple WebBeans Support
+* Producer Method Support
+* Event Support
+* Decorator and Interceptor Support
+* Experimental XML Configuration Support
+* Lookup and Dependency Injection Support
+* Java EE Plugin Support (via ServetContextListener interface)
+* Experimental JPA injection support.
+
+- M1 Release Does not Supports the followings
+--------------------------------------------
+* Enterprise WebBeans Support
+* JMS WebBeans Support
+* Producer Field Support
+* Servlet Injection Support
+* Inheritance, Stereotype Inheritance and Realization Support
+* Full Common Annotations Support
+* Passivation Scope and Serialization Operations
+* Full Support for XML Configuration
+* Java EE Container Integration Support (SPI)
+
+---------------------------------------------
+Release Notes - OpenWebBeans - Version M1
+Bug
+
+ * [OWB-33] - bug in EJBInterceptComponentTest#testMultipleInterceptedComponent
+ * [OWB-34] - bug in ExceptionComponentTest
+ * [OWB-38] - Review all usages of catch(Throwable)
+ * [OWB-54] - Update Bean.getBindings Contract
+ * [OWB-61] - Refactor the annotations to match the new package schema.
+ * [OWB-62] - Refactor web-beans.xml to beans.xml
+
+Improvement
+
+ * [OWB-31] - various XML definition improvements
+ * [OWB-35] - cut back overly exception handling in ClassUtil
+ * [OWB-41] - M1-Release Corrections
+ * [OWB-58] - Dependent Context unused instance variable named : owner
+
+Task
+
+ * [OWB-7] - Manager initialization
+ * [OWB-9] - Check Client Proxy Implementation
+ * [OWB-17] - Test Events
+ * [OWB-20] - Compilation errors while building either webbeans-api or webbeans-impl modules
+ * [OWB-21] - No main pom.xml for OpenWebBeans
+ * [OWB-23] - pom.xml files are not well organized. A compilation erro while compiling inside Eclipse
+ * [OWB-27] - 5.2. Primitive types and null values
+ * [OWB-30] - 5.10. Instance resolution, check Unproxiable Api Type control
+ * [OWB-32] - Enabling more maven reports for site creation
+ * [OWB-44] - Object toString method check on the Proxy
+ * [OWB-60] - code cleanup unify getStereotype vs getStereoType in the sources
+ * [OWB-63] - M1-Release Content
+ * [OWB-70] - Change API copied from JBoss Impl.
+ * [OWB-72] - add hsqldb license to our NOTICE, LEGAL, etc
+ * [OWB-73] - add license headers to all XML files
+
+Test
+
+ * [OWB-22] - Unit tests failures in WebBeans-Impl module
+ * [OWB-36] - create a test for WebBeansScanner
+ * [OWB-40] - create test cases for XML constructor injection
+
+
+---------------------------------------------
+How to Configure The OpenWebBeans
+---------------------------------------------
+
+There are two important jars for OpenWebBeans;
+
+ - openwebbeans-api-1.0.0-incubating-M1.jar
+ - openwebbeans-impl-1.0.0-incubating-M1.jar
+
+There are also third party dependent libraries. These dependent library jars
+are located in the directory "/lib/thirdparty" in the distribution.
+
+Java EE APIs jars that are used by the project are located in the directory
+"lib/javaee" directory in the distribution. You could put the necessary Java EE
+jars into the server classpath if the server is not contains these jars already.
+
+To run openwebbeans applications in the Java EE based application server,
+you could add OpenWebBeans API, Implementation and dependent jars into
+the common classpath of the Java EE Application Server or your "WEB-INF/lib"
+directory of the Java EE Web Application.
+
+In this release, we can not support the OpenWebBeans as an integrated
+functionality of the Java EE Application Servers. So, you have to manage the
+configuration of the OpenWebBeans within your "web.xml" file. A sample "web.xml"
+file can be found in the "config" directory.
+
+---------------------------------------------
+How to Run The Samples
+---------------------------------------------
+
+In this release, there is a sample application located in the "/samples" directory
+of the distribution.
+
+Name of the binary file is the "samples/guess.war", you can deploy it
+into the any Java EE web container. Source is included in the "source" distribution of the
+OpenWebBeans.
+
+--------------------------------------------
+Configuration of the Samples
+--------------------------------------------
+
+"Third party" and "OpenWebBeans" jars are included within the WAR deployment(In WEB-INF/lib).
+But it still requires the "lib/javaee" Java EE API jars for running sucessfully.
+If your server does not include any of them, simply take the necessary jar from the "lib/javaee" and
+put it into your server classpath.
+
+After that;
+
+Hit the url : http://localhost:8080/guess
+
+--------------------------------------------
+Maven Install and Package From the Source
+--------------------------------------------
+
+Firstly you have to download the "source/all" version of the OpenWebBeans project that
+contains the all source codes of the OpenWebBeans.
+
+To install the Maven artifacts of the project from the source, Maven must be installed
+in your runtime. After Maven installation, just run the following command in the top level
+directory that contains the main "pom.xml" :
+
+> mvn clean install
+
+This command will install all the Maven artifacts into your local Maven repository.
+
+If you wish to package all artifacts of the project, just run the following command
+in in the top level directory that contains the main "pom.xml" :
+
+> mvn clean package
+
+This command will package the project artifacts from the source and put these artifacts into the each modules
+respective "target" directory.
+
+-------------------------------------------
+OpenWebBeans User Mail List
+-------------------------------------------
+
+Please mail to the user mailing list about any questions or advice
+about the OpenWebBeans.
+
+User Mailing List : [openwebbeans-users@incubator.apache.org]
+
+-------------------------------------------
+OpenWebBeans JIRA Page
+-------------------------------------------
+
+Please logs the bugs into the "https://issues.apache.org/jira/browse/OWB".
diff --git a/owb_1.2.x/readme/README_M2.txt b/owb_1.2.x/readme/README_M2.txt
new file mode 100644
index 0000000..35eaa8e
--- /dev/null
+++ b/owb_1.2.x/readme/README_M2.txt
@@ -0,0 +1,232 @@
+-------------------------------
+Apache OpenWebBeans M2
+-------------------------------
+This readme file contains the information regarding to the M2 of the
+Apache OpenWebBeans project.
+
+--------------------------------
+What is OpenWebBeans?
+--------------------------------
+OpenWebBeans is an ASL-License implementation of the JSR-299, Java Context and Dependency Injection Specification.
+
+Project web page could be found at the URL :
+http://incubator.apache.org/projects/openwebbeans.html
+
+--------------------------------
+OpenWebBeans M2 Release Content
+--------------------------------
+
+- M2 Release Supports the followings
+-----------------------------------
+* Simple WebBeans Support
+* Producer Method Support
+* Producer Field Support
+* JMS WebBeans Support
+* Inheritance, Stereotype Inheritances and Realization Support
+* Specialization Support
+* Event Support
+* Decorator and Interceptor Support
+* Experimental XML Configuration Support
+* Lookup and Dependency Injection Support
+* Java EE Plugin Support (via ServetContextListener interface)
+* JPA Persistence Context injection support.(Currently does not support JTA based persistence context.)
+
+- M2 Release Does not Supports the followings
+--------------------------------------------
+* Enterprise WebBeans Support
+* Servlet Injection Support
+* Full Common Annotations Support
+* Passivation Scope and Serialization Operations
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version M2
+-------------------------------------------
+Sub-task
+
+ * [OWB-26] - Inline webbeans decleration
+ * [OWB-48] - Simple Beans Stereotyping
+ * [OWB-49] - Producer Method Stereotyping
+ * [OWB-50] - Implementation of the Contextual Interface
+ * [OWB-51] - Implementation of the CreationalContext
+ * [OWB-67] - Producer Field Implementation via XML
+ * [OWB-71] - support @PersistenceUnit JPA injection
+
+Bug
+
+ * [OWB-42] - Dependent Context Inifinite Recursion
+ * [OWB-78] - exception when running OpenWebBeans + MyFaces apps in jetty
+ * [OWB-79] - wrong Exception about already defined WebBeansXMLConfigurator
+ * [OWB-80] - according to the spec: Manager#getContext(scope) must throw a ContextNotActiveException if no active context exists.
+ * [OWB-81] - acc 2 Spec: JNDI name has to be java:app/Manager
+ * [OWB-82] - acc 2 Spec: Manager.addContext() has to throw IllegalArgumentException if there is more then 1active context
+ * [OWB-83] - allow passivation of scopes @SessionScoped and @ConversationScoped
+ * [OWB-84] - defining a bean @Serializable will case javaassist exceptions
+ * [OWB-85] - WebBeansELResolver sets the "propertyResolved" flag to true regardless of the resolvation success
+ * [OWB-90] - cannot find beans when working locally with jetty:run
+ * [OWB-94] - Spec requires CreationalContext<?> instead of <T> in Manager#getInstanceToInject
+
+Improvement
+
+ * [OWB-45] - EL Name Resolution
+ * [OWB-55] - Update Context API Contract and implementation
+ * [OWB-76] - change dependency scopes to fit J2EE _and_ standalone concerns
+ * [OWB-89] - make MetaDataDiscoveryService independent from scannotation
+ * [OWB-91] - facor out all JPA specific parts into an own maven module
+ * [OWB-93] - OWB TCKs should switch to released jsr-299 TCK artifacts
+
+New Feature
+
+ * [OWB-75] - create SPI integration support
+
+Task
+
+ * [OWB-3] - Stereotype Inheritance
+ * [OWB-4] - JMS Components
+ * [OWB-10] - Injection Point MetaData
+ * [OWB-11] - Update WebBeans Lifecycle for SimpleWebBeans
+ * [OWB-24] - Producer Field Implementation
+ * [OWB-25] - Chapter-4 Inheritance and Realization
+ * [OWB-28] - 5.4.1. Unproxyable API types
+ * [OWB-29] - 5.9. Dynamic lookup, Instance and Obtains Support
+ * [OWB-52] - Support for @Obtains via Instance interface
+ * [OWB-69] - Add Manager#parse Implementation
+ * [OWB-87] - move all non-JSF specific parts of Conversations handling to an own general package
+ * [OWB-88] - facor out all JSF specific parts into an own maven module
+
+Test
+
+ * [OWB-15] - Test Interceptors
+ * [OWB-16] - Test Decorators
+ * [OWB-18] - Test Conversation Context
+
+
+---------------------------------------------
+How to Configure The OpenWebBeans
+---------------------------------------------
+
+There are several jars for OpenWebBeans distribution;
+
+ - openwebbeans-api-1.0.0-incubating-M2.jar --> Includes JSR-299 API
+ - openwebbeans-impl-1.0.0-incubating-M2.jar --> Includes Core Dependency Injection Service
+ - openwebbeans-ejb-1.0.0-incubating-M2.jar --> EJB Plugin(In early stage)
+ - openwebbeans-jms-1.0.0-incubating-M2.jar --> JMS Plugin
+ - openwebbeans-jpa-1.0.0-incubating-M2.jar --> JPA Plugin(Non JTA Entity Manager Support)
+ - openwebbeans-jsf-1.0.0-incubating-M2.jar --> JSF Plugin(JSF Conversation Scoped Support)
+ - openwebbeans-geronimo-incubating-M2.jar --> Geronimo Integration(In early stage JTA Entity Manager Support via OpenEJB)
+
+
+OpenWebBeans has been developing as a plugin way. Core dependency injection service
+is provided with the API and IMPL jars. If you need the other functionality, you have to add
+respective plugin jars into the application classpath.
+
+There are also third party dependent libraries. These dependent library jars
+are located in the directory "/lib/thirdparty" in the distribution.
+
+Java EE APIs jars that are used by the project are located in the directory
+"lib/javaee" directory in the distribution. You could put the necessary Java EE
+jars into the server classpath if the server is not contains these jars already.
+
+To run openwebbeans applications in the Java EE based application server,
+you could add OpenWebBeans API, Implementation and dependent jars into
+the common classpath of the Java EE Application Server or your "WEB-INF/lib"
+directory of the Java EE Web Application.
+
+In this release, we can not support the OpenWebBeans as an integrated
+functionality of the Java EE Application Servers. So, you have to manage the
+configuration of the OpenWebBeans within your "web.xml" file. A sample "web.xml"
+file can be found in the "config" directory.
+
+---------------------------------------------
+How to Run The Samples
+---------------------------------------------
+
+In this release, there are two sample applications located in the "/samples" directory
+of the distribution.
+
+1) Guess Application : Name of the binary file is the "samples/guess.war".
+Source is included in the "source" distribution of the OpenWebBeans.
+
+2) Hotel Reservation Application : Full blown web application that is developed with JPA,
+JSF and OpenWebBeans. Name of the war file is "samples/reservation.war". Source is
+included in the "source" distribution of the OpenWebBeans.
+
+Configuring and Running the Applications:
+--------------------------------------------
+Simple put the "war" file into the any compatible web container.
+
+Library Dependencies
+--------------------------------------------
+"Third party" jars are included within the WAR deployment(In WEB-INF/lib).
+But it still requires the "lib/javaee" Java EE API jars for running sucessfully.
+If your server does not include any of them, simply take the necessary jar from the "lib/javaee" and
+put it into your server classpath.
+
+
+Guess Example URL : Hit the url : http://localhost:8080/guess
+Hotel Reservation Example URL : Hit the url http://localhost:8080/reservation
+
+--------------------------------------------
+Maven Install and Package From the Source
+--------------------------------------------
+
+Firstly you have to download the "source/all" version of the OpenWebBeans project that
+contains the all source codes of the OpenWebBeans.
+
+To install the Maven artifacts of the project from the source, Maven must be installed
+in your runtime. After Maven installation, just run the following command in the top level
+directory that contains the main "pom.xml" :
+
+> mvn clean install
+
+This command will install all the Maven artifacts into your local Maven repository.
+
+If you wish to package all artifacts of the project, just run the following command
+in in the top level directory that contains the main "pom.xml" :
+
+> mvn clean package
+
+This command will package the project artifacts from the source and put these artifacts into the each modules
+respective "target" directory.
+
+-------------------------------------------
+Compile and Run Samples via Jetty Plugin
+-------------------------------------------
+You can compile and run samples via maven Jetty plugin.
+Go to the source bundle "samples/" directory. In the "guess/" or "reservation/" directory, run
+the following maven commands. It will start up maven Jetty container. It bundles all of the
+required jars into the WEB-INF/lib folder. You are not required to add any jar to the classpath.
+
+> mvn clean install -Pjetty
+> mvn jetty:run -Pjetty
+
+Hit the above URLs to run the samples in the web browser.
+
+-----------------------------------------------
+OpenWebBeans User and Development Mailing Lists
+-----------------------------------------------
+Please mail to the user mailing list about any questions or advice
+about the OpenWebBeans.
+
+User Mailing List : [openwebbeans-users@incubator.apache.org]
+
+You can also join the discussions happening in the dev list
+
+Dev Mailing List : [opwnwebbeans-dev@incubator.apache.org]
+
+-------------------------------------------
+OpenWebBeans JIRA Page
+-------------------------------------------
+Please logs bugs into the "https://issues.apache.org/jira/browse/OWB".
+
+------------------------------------------
+OpenWebBeans Wiki and Blog Page
+-----------------------------------------
+Wiki: http://cwiki.apache.org/OWB/
+Introduction to OpenWebBeans : http://cwiki.apache.org/OWB/introduction-to-openwebbeans.html
+Blog : http://blogs.apache.org/owb
+
+-----------------------------------------
+OpenWebBeans Web Page
+----------------------------------------
+You can reach the OpenWebBeans web page at
+http://incubator.apache.org/openwebbeans.
diff --git a/owb_1.2.x/readme/README_M3.txt b/owb_1.2.x/readme/README_M3.txt
new file mode 100644
index 0000000..a29088c
--- /dev/null
+++ b/owb_1.2.x/readme/README_M3.txt
@@ -0,0 +1,400 @@
+-------------------------------
+Apache OpenWebBeans M3
+-------------------------------
+This readme file contains an information regarding to the "M3" version of the
+Apache OpenWebBeans project.
+
+--------------------------------
+What is an OpenWebBeans?
+--------------------------------
+OpenWebBeans is an ASL-License implementation of the JSR-299, Contexts and Dependency Injection for the Java EE platform.
+
+Project web page could be found at the URL :
+"http://incubator.apache.org/projects/openwebbeans.html"
+
+--------------------------------
+OpenWebBeans M3 Release Features
+--------------------------------
+
+- M3 Release Supports the followings
+-----------------------------------
+* Managed Beans Support
+* Session Beans Support (via Embeddable OpenEJB container in Tomcat)
+* Producer Method Support
+* Producer Field Support
+* Java EE Resource Injection Support
+* JMS OpenWebBeans Support(OWB Specific)
+* Inheritance, Stereotype Inheritances
+* Specialization Support
+* Event Support
+* Decorator and Interceptor Support
+* Lookup and Dependency Injection Support
+* Java EE Plugin Support (via ServetContextListener interface)
+* Portable Integration Support
+
+- M3 Release Does not Supports the followings
+--------------------------------------------
+* Injection into other Java EE 6 non-contextual components
+* Passivation Capability of Beans
+* Using @Alternative instead of @DeploymentType
+* Does not fully integrated with Geronimo
+ (You have to configure your application to use OWB functionality,
+ e.g configure web.xml, adding interceptor to EJBs etc.)
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version M3
+-------------------------------------------
+Sub-task
+
+ * [OWB-74] - support @PersistenceContext JPA injection
+
+Bug
+
+ * [OWB-59] - Review the handling of ConversationScope timeouts
+ * [OWB-95] - rename exceptions to fit specification
+ * [OWB-121] - remove JMS specific namings from OpenWebBeansPlugin
+ * [OWB-123] - remove StereoType restrictions
+ * [OWB-124] - ClassCastExceptoin during deployment
+ * [OWB-132] - atinject license header formatting breaks build
+
+Improvement
+
+ * [OWB-65] - Java EE Namespace Support
+ * [OWB-92] - facor out all EJB specific parts into an own maven module
+ * [OWB-96] - EntityManager WebBeans Component
+ * [OWB-105] - Improve Injection Resolver for Generic Classes
+ * [OWB-108] - Update InjectionPoint interface
+ * [OWB-109] - Update Instance Interface
+ * [OWB-110] - Update Creational Context Interface
+ * [OWB-111] - Update Contextual Interface
+ * [OWB-112] - Check Usage of Creational Context
+ * [OWB-113] - Dependent Context Active State
+ * [OWB-114] - Check Contextual Reference Object Return Type
+ * [OWB-117] - Updates Event For Last Draft
+
+New Feature
+
+ * [OWB-5] - EJB Web Beans
+ * [OWB-43] - Constructor Parameter Injection For primitive/wrappers
+ * [OWB-130] - implement JSR-330 annotations for OWB
+ * [OWB-131] - integrate new JSR-330 annotations within OWB
+
+Task
+
+ * [OWB-2] - XML Configuration
+ * [OWB-8] - Common Annotations
+ * [OWB-12] - Update WebBeans Lifecycle for EJB Beans
+ * [OWB-13] - Update WebBeans Lifecycle for JMS Beans
+ * [OWB-47] - Java EE Resource Injection Support
+ * [OWB-64] - Asynhronous Event Support via JMS
+ * [OWB-66] - Schema Validation
+ * [OWB-68] - Support for Child Managers
+ * [OWB-115] - Contextual Reference Validity
+ * [OWB-119] - Cover Chapter11 SPI Implementations
+ * [OWB-120] - Implement Chapter12 Initialization Events
+
+----------------------------------------------
+Required Platform
+----------------------------------------------
+Java Version : Java SE >= 6.0
+Java EE Must : Java EE >= 5.0
+
+---------------------------------------------
+How to Configure The OpenWebBeans
+---------------------------------------------
+
+This section explains a content of the distribution bundle, OWB plugins and its
+dependent libraries.
+
+---------------------------------------------
+M3 Bundle Content
+---------------------------------------------
+There are several jars in the OpenWebBeans M3 distribution;
+
+ - atinject-api-1.0.0-incubating-M3.jar --> Includes JSR-330 API
+ - openwebbeans-api-1.0.0-incubating-M3.jar --> Includes JSR-299 API
+ - openwebbeans-impl-1.0.0-incubating-M3.jar --> Includes Core Dependency Injection Service
+ - openwebbeans-ejb-1.0.0-incubating-M3.jar --> EJB Plugin(Supports EJBs in OpenEJB embedded in Tomcat)
+ - openwebbeans-jms-1.0.0-incubating-M3.jar --> JMS Plugin(Supports injection of JMS related artifacts)
+ - openwebbeans-jpa-1.0.0-incubating-M3.jar --> JPA Plugin(Non JTA Entity Manager Support)This is @Deprecated,use Resource Plugin.
+ - openwebbeans-jsf-1.0.0-incubating-M3.jar --> JSF Plugin(JSF Conversation Scoped Support)
+ - openwebbeans-resource-1.0.0-incubating-M3.jar --> Java EE Resource Injection Plugin
+ - openwebbeans-geronimo-incubating-M3.jar --> Geronimo Integration(In early stage,includes supports for OpenEJB resource injections)
+
+
+------------------------------------------
+How OWB Plugins Work
+------------------------------------------
+
+OpenWebBeans has been developing as a plugin way. Core dependency injection service
+is provided with the JSR-299 API and Core mplementation jars. If you need further service functionality,
+you have to add respective plugin jars into the application classpath. Plugin functionality uses Java SE 6.0
+"java.util.ServiceLoader" utility.
+
+------------------------------------------
+Dependent Libraries
+------------------------------------------
+
+Third Party jars:
+They are necessary at runtime in the Core Implementation.
+
+log4j: Version 1.2.14
+dom4j: Version 1.6.1
+javassist : Version 3.8.0.GA
+scannotation : Version 1.0.2
+
+Java EE APIs jars :
+Generally full Java EE servers provides these jars. But web containers like Tomcat or Jetty
+does not contain some of them, such as JPA, JSF api etc. So, if you do not want to bundle
+these libraries within your application classpath, you have to put these libraries into your
+server common classpath if it does not contain as built-in.
+
+servlet-2.5 --> Core implementation
+ejb-3.0 --> EJB Plugin
+el-1.0 --> JSR-299 API, Core Implementation
+jsf-1.2 --> JSF Plugin
+jsr-250 --> Core implementation
+interceptor-3.0 --> JSR-299 API, Core implementation
+jta-1.1 --> Core implementation
+jsp-2.1 --> Core implementation
+jpa-3.0 --> Resource Plugin
+jaxws-2.1 --> Resource Plugin
+jms-1.1 --> JMS Plugin
+
+------------------------------------------
+Library Configuration
+------------------------------------------
+To run openwebbeans applications in the Java EE based application server,
+you could add JSR-299 API and JSR-330 API into the server common classpath, and
+implementation, plugins and dependent jars into your "WEB-INF/lib" directory
+of the Java EE Web Application.
+
+In this release, we can not support the OpenWebBeans as an integrated
+functionality of the Java EE Application Servers. So, you have to manage the
+configuration of the OpenWebBeans within your application's "web.xml" file. A sample "web.xml"
+file can be found in the "config" directory. To use EJB functionality, you also have to
+add OWB specific interceptor into your EJB beans. Look at EJB section for further details.
+
+---------------------------------------------
+OpenWebBeans Properties File
+---------------------------------------------
+OpenWebBeans uses a default configuration file to configure some of its
+properties. Default configuration file is embedded into the OWB implementation
+jar file. Instead of opening this jar file and changing configuration properties, simply add
+"openwebbeans.properties" file into a "META-INF/" folder of your application
+classpath. This will override the default configuration.
+
+Belows are all configuration properties of the OpenWebBeans:
+
+- "org.apache.webbeans.spi.JNDIService" : Configures JNDI provider implementation.
+ Values : org.apache.webbeans.spi.ee.JNDIServiceEnterpriseImpl, org.apache.webbeans.spi.se.JNDIServiceStaticImpl
+ Default: org.apache.webbeans.spi.se.JNDIServiceStaticImpl
+
+- "org.apache.webbeans.spi.JNDIService.jmsConnectionFactoryJndi" : Configures JMS ConnectionFactory object jndi name
+ Values : Server specific JNDI name
+ Default: ConnectionFactory
+
+- "org.apache.webbeans.conversation.Conversation.periodicDelay" : Conversation removing thread periodic delay
+ Values : Configured in millisecond
+ Default: 150000 ms
+
+- "org.apache.webbeans.spi.TransactionService" : Transaction Service implementation for getting transaction manager and transaction
+ Values : org.apache.webbeans.spi.ee.TransactionServiceJndiImpl, org.apache.webbeans.spi.se.TransactionServiceNonJTA
+ Default: org.apache.webbeans.spi.ee.TransactionServiceJndiImpl
+
+- "org.apache.webbeans.resource.spi.ResourceService" : Java EE Resource Injection Service
+ Values : org.apache.webbeans.resource.spi.se.ResourceServiceImpl, org.apache.webbeans.spi.ee.openejb.resource.OpenEjbResourceServiceImpl
+ Default: org.apache.webbeans.resource.spi.se.ResourceServiceImpl
+
+- "org.apache.webbeans.spi.deployer.MetaDataDiscoveryService" : Discovers annotations and configuration files
+ Values : Implementation of org.apache.webbeans.spi.deployer.MetaDataDiscoveryService SPI
+ Default: org.apache.webbeans.spi.ee.deployer.WarMetaDataDiscoveryImpl for war and Collapsed ear in OpenEJB in Tomcat.
+
+- "org.apache.webbeans.spi.deployer.UseEjbMetaDataDiscoveryService" : Use EJB functionality or not. If use OpenEJB configures to true
+ Values : false, true
+ Default: false
+
+- "org.apache.webbeans.useOwbSpecificXmlConfig" : Use OWB specific XML configuration. OWB also supports its own XML configuration.
+ In future, you can configure beans via OWB specific XML configuration. Default is ok for the time being.
+ Values : false, true
+ Default: false
+
+- "org.apache.webbeans.fieldInjection.useOwbSpecificInjection" : Use @Inject on injection fields or not. If this set to true
+ you can inject object into beans without @Inject.
+ Values : false, true
+ Default: false
+
+- "org.apache.webbeans.spi.conversation.ConversationService": Implementation of conversation.
+ Values : Any custom implementation of org.apache.webbeans.spi.conversation.ConversationService
+ Default: org.apache.webbeans.spi.conversation.jsf.JSFConversationServiceImpl
+
+---------------------------------------------
+EJB Support via Embeddable OpenEJB Container in Tomcat 6.X
+---------------------------------------------
+
+Configuration Steps:
+--------------------------------------------
+1* Download Tomcat 6.X version
+2* Configure OpenEJB. Look at URL http://openejb.apache.org/tomcat.html for installation.
+3* Copy "atinject-api-1.0.0-incubating-M3.jar" to Tomcat /lib folder.
+4* Copy "openwebbeans-api-1.0.0-incubating-M3.jar"
+5* Look at ejb-sample.war for "WEB-INF/lib" libraries to develop custom application.
+ You can also look at a source of the project.
+
+To use EJB functionality, you will use OpenEJB collapse-ear support. In this configuration,
+your EJB beans live within your "war" bundle.
+
+How to Develop EJB Applications
+---------------------------------------------
+1* Add "META-INF/openwebbeans.properties" into your application classpath.
+2* Add "org.apache.webbeans.spi.deployer.UseEjbMetaDataDiscoveryService=true" to use EJB functionality.
+ So OWB container looks for EJBs.
+3* Add "org.apache.webbeans.resource.spi.ResourceService=org.apache.webbeans.spi.ee.openejb.resource.OpenEjbResourceServiceImpl" to
+use OpenEJB Resource injections.
+4* Add "openwebbeans-ejb", "openwebbeans-resource" and "openwebbeans-geronimo" plugins into your web application classpath.
+It adds EJB, Resource and Open EJB Resource plugins into your application.
+5* If you want to use other plugins, add respective plugins into your application classpath. For example, if you wish to use
+JSF framework, you add "openwebbeans-jsf" plugin.
+6* Add OWB related interceptor into your EJB Beans. This is called "org.apache.webbeans.ejb.interceptor.OpenWebBeansEjbInterceptor"
+This is needed for OWB injections.
+7* Update your application's "web.xml" to add OWB specific configuration.
+
+---------------------------------------------
+How to Run Samples
+---------------------------------------------
+
+In this release, there are four sample applications located in the "/samples" directory
+of the distribution. "Guess","Reservation" and "Ejb Sample" applications contains pure
+sources. You have to execute mvn builds to run them. "Jms Sample" contains war file.
+You can directly deploy it into the container.
+
+1) "Guess Application" : Simple usage of the OWB + JSF.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+2) "Hotel Reservation Application" : Show usage of JSF + JPA + OWB
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+3) "EJB Sample Application" : Shows the usage of EJBs with embeddable OpenEJB in Tomcat. Firstly
+configure OpenEJB with Tomcat as explained above.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section
+
+4) "JMS Injection Sample" : Show JMS injections. JMS injection currently uses
+ ConnectionFactory as JMS connection factory jndi name. You can change this
+ via configuration file. Look above explanation for how to configure JMS jndi. Also,
+ JMS injection requires to use of a JMS provider. Generally Java EE servers contains
+ default JMS provider. It can be run on JBoss and Geronimo. Simple drops "samples/jms-sample.war"
+ into Java EE server deploy folder. Also it uses Queue with jndi_name = "queue/A". So you have to
+ create a queue destination in your JMS provider with name "queue/A" to run example. If you
+ want to change queue jndi name, then look at source and change it from "WEB-INF/beans.xml" file.
+
+Configuring and Running the Applications:
+--------------------------------------------
+See section Compile and Run Samples via Jetty&Tomcat Plugin.
+
+Library Dependencies
+--------------------------------------------
+"Third party" jars are included within the WAR deployment(In WEB-INF/lib).
+But it still requires the "lib/javaee" Java EE API jars for running sucessfully.
+If your server does not include any of them, simply take the necessary jar from the "lib/javaee" and
+put it into your server classpath.
+
+--------------------------------------------
+Maven Install and Package From the Source
+--------------------------------------------
+
+Maven Version : Apache Maven 2.2.1
+
+Firstly you have to download the "source/all" version of the OpenWebBeans project that
+contains the all source codes of the OpenWebBeans.
+
+To install the Maven artifacts of the project from the source, Maven must be installed
+in your runtime. After Maven installation, just run the following command in the top level
+directory that contains the main "pom.xml" :
+
+> mvn clean install
+
+This command will install all the Maven artifacts into your local Maven repository.
+
+If you wish to package all artifacts of the project, just run the following command
+in in the top level directory that contains the main "pom.xml" :
+
+> mvn clean package
+
+This command will package the project artifacts from the source and put these artifacts into the each modules
+respective "target" directory.
+
+-------------------------------------------
+Compile and Run Samples via Tomcat&Jetty Plugin
+-------------------------------------------
+
+Samples Run within Jetty Plugin
+------------------------------------------
+You can compile and run "guess" and "reservation "samples via maven Jetty plugin.
+Go to the source bundle "samples/" directory. In the "guess/" or "reservation/" directory, run
+the following maven commands. It will start up maven Jetty container. It bundles all of the
+required jars into the WEB-INF/lib folder. You are not required to add any jar to the classpath.
+
+> mvn clean install -Pjetty
+> mvn jetty:run -Pjetty
+
+Guess URL : http://localhost:8080/guess
+Reservation URL : http://localhost:8080/reservation
+
+Samples Run within Tomcat Plugin
+------------------------------------------
+You can also compile and run "ejb-sample" example via Tomcat plugin. Tomcat
+plugin uses http://localhost:8080/manager application to deploy war file
+into your embeddable EJB Tomcat container. There must be an tomcat-users.xml
+file in the "conf" directory of the server that contains manager role and username.
+
+>Start Tomcat server if not started
+>mvn tomcat:deploy
+
+Ejb Sample URL : http://localhost:8080/ejb-sample
+
+Example tomcat-users.xml file
+------------------------------------------
+<tomcat-users>
+<role rolename="manager"/>
+<user username="admin" password="" roles="manager"/>
+</tomcat-users>
+
+-----------------------------------------
+Deploy JMS Sample
+-----------------------------------------
+Simple drops jms-sample.war file into your application deploy location.
+
+JMS Sample Example URL : Hit the url http://localhost:8080/jms-sample/sender.jsf for sending JMS messages
+ Hit the url http://localhost:8080/jms-sample/receiver.jsf for receiving JMS messages
+
+-----------------------------------------------
+OpenWebBeans User and Development Mailing Lists
+-----------------------------------------------
+Please mail to the user mailing list about any questions or advice
+about the OpenWebBeans.
+
+User Mailing List : [openwebbeans-users@incubator.apache.org]
+
+You can also join the discussions happening in the dev list
+
+Dev Mailing List : [opwnwebbeans-dev@incubator.apache.org]
+
+-------------------------------------------
+OpenWebBeans JIRA Page
+-------------------------------------------
+Please logs bugs into the "https://issues.apache.org/jira/browse/OWB".
+
+------------------------------------------
+OpenWebBeans Wiki and Blog Page
+-----------------------------------------
+Wiki: http://cwiki.apache.org/OWB/
+Introduction to OpenWebBeans : http://cwiki.apache.org/OWB/introduction-to-openwebbeans.html
+Blog : http://blogs.apache.org/owb
+
+-----------------------------------------
+OpenWebBeans Web Page
+----------------------------------------
+You can reach the OpenWebBeans web page at
+http://incubator.apache.org/openwebbeans.
diff --git a/owb_1.2.x/readme/README_M4.txt b/owb_1.2.x/readme/README_M4.txt
new file mode 100644
index 0000000..f7e1d27
--- /dev/null
+++ b/owb_1.2.x/readme/README_M4.txt
@@ -0,0 +1,658 @@
+-------------------------------
+Apache OpenWebBeans M4
+-------------------------------
+Welcome! Thanks for downloading and using OpenWebBeans. This document is a
+"Getting Started Guide" for OpenWebBeans.
+
+This document is based on the M4 release of the OpenWebBeans.
+
+NOTE : Final release version of OpenWebBeans will be 1.0.0.
+
+--------------------------------
+What is Apache OpenWebBeans?
+--------------------------------
+OpenWebBeans is an ASL 2.0-licensed implementation of the JSR-299, Contexts and Dependency Injection for the Java EE platform.
+
+Project's web page can be found at:
+"http://openwebbeans.apache.org"
+
+--------------------------------
+OpenWebBeans M4 Release Features
+--------------------------------
+
+- M4 release supports the following features
+-----------------------------------
+* Managed Beans Support
+* Session Beans Support (via Embeddable OpenEJB container in Tomcat)
+* Producer Method Support
+* Producer Field Support
+* Java EE Resource Injection Support
+* JMS OpenWebBeans Support(OWB Specific)
+* Inheritance, Stereotype Inheritances
+* Specialization Support
+* Event Support
+* Decorator and Interceptor Support
+* Lookup and Dependency Injection Support
+* Java EE Plugin Support (via ServetContextListener interface)
+* Portable Integration Support
+* Passivation Capability of Beans
+* @Alternative support in drop of @DeploymentType
+
+- M4 release does not supports the following features
+--------------------------------------------
+* Injection into other Java EE 6 non-contextual components
+ - Currently, it is not possible to use injection into Servlets, Filters etc.
+ that are not contextual beans.
+* Does not fully integrate with Geronimo
+ (You have to configure your application to use OWB functionality,
+ e.g configure web.xml, adding interceptor to EJBs etc.)
+
+-------------------------------------------
+Release Notes - OpenWebBeans - Version M4
+-------------------------------------------
+Sub-task
+
+ * [OWB-140] - Remove javax.enterprise.event.Observer
+
+Bug
+
+ * [OWB-122] - use the latest TCK suite for webbeans-tck
+ * [OWB-126] - remove old rules and formattings for handling of beans.xml
+ * [OWB-127] - @Stateful EJBs have to be handled as being passivation capable
+ * [OWB-128] - OWB crashes while parsing methods with generic parameters
+ * [OWB-129] - OWB crashes on creating disposer method
+ * [OWB-141] - Conversation.isLongRunning() was removed in favor of Conversation.isTransient()
+ * [OWB-142] - If an injection point declares no qualifier, then @Default should be assumed.
+ * [OWB-143] - Decorator matching looks for all bean qualifiers in the list of delegate qualifiers
+ * [OWB-144] - upgrade OWB TCK from webbeans to weld
+ * [OWB-146] - A new extract of openwebbeans on a fresh system has difficulty resolving dependencies and repositories.
+ * [OWB-147] - component->comp typo interceptor stack copy
+ * [OWB-148] - create a test case for the BeforeShutDown event
+ * [OWB-149] - BeforeShutDown (in current code) should be BeforeShutdown to match spec.
+ * [OWB-150] - remove ActivityManager from OWB
+ * [OWB-152] - @New needs a value parameter for the Class it should create
+ * [OWB-153] - javax.enterprise.inject.spi.Decorator#getDelegateBindings() must be renamed to getDelegateQualifiers();
+ * [OWB-154] - remove Bean#getDeploymentType()
+ * [OWB-155] - Conversation#isLongRunning() logic must be converted to isTransient();
+ * [OWB-156] - ProcessSessionBean SPI interface needs to be updated to the latest spec
+ * [OWB-157] - Interceptors register all annotations as Interceptor Bindings
+ * [OWB-158] - interceptor stack does not honor beans.xml ordering
+ * [OWB-159] - interceptor/bean binding relationship is inverted in WebBeansInterceptor.hasBinding()
+ * [OWB-160] - interceptor bindings at class-level added to stack twice
+ * [OWB-161] - Producer fields do not honor generics
+ * [OWB-162] - WebBeansJSFFilter is cutting off included ViewParams
+ * [OWB-163] - Conversations are not scoped to a particular session
+ * [OWB-165] - Missing bean interception stack during TagHandler expression evaluation
+ * [OWB-166] - Interceptor bindings, that are defined on stereotypes are not applied to beans
+ * [OWB-167] - Buildin Bean types should be decoratable
+ * [OWB-168] - cid parameter is not propagated for redirects caused by ajax requests and on <h:link/>
+ * [OWB-169] - PrimitiveProducerTest creates a NullPointerException
+ * [OWB-171] - CID during GET requests must be set on UIViewRoot earlier than before render response
+ * [OWB-172] - Producer field type that is a type variable leads to a NPE rather than definition error (Section 3.4)
+ * [OWB-173] - Singleton context is not set as ThreadLocal on every request
+ * [OWB-175] - SingletonContext not available in in multithreaded SE environments, which use the StandaloneLifeCycle
+ * [OWB-176] - InterceptionType.AROUND_TIMEOUT is missing
+ * [OWB-179] - PluginLoader need to actually startUp each plugin at load time
+ * [OWB-180] - remove e.printStackTrace() and use proper logging
+ * [OWB-181] - TCK requires to create newInstance of hidden constructors
+ * [OWB-182] - Even if @PreDestroy is used in an Interceptor, it doesn't need an InvoicationContext parameter
+ * [OWB-184] - BeanManager itself needs to be added as managed bean
+ * [OWB-185] - Managed beans with non-default constructors lead to InstantiationException when creating the proxy
+ * [OWB-189] - @Interceptors-defined interceptors run after JCDI interceptors
+ * [OWB-192] - Bean Api Types Does not contain Object.class
+ * [OWB-199] - Bug in ProducerMethod primitive return type resolution
+ * [OWB-200] - @Type annotation does not work correctly
+ * [OWB-201] - @New must use its value field while creating New bean
+ * [OWB-206] - proxies only get injected for the 1st instance of a bean
+ * [OWB-207] - <interceptors> may now be defined in multiple beans.xml
+ * [OWB-208] - the atinject-tck must use our genonimo-cdi interface instead of javax.inject:javax.inject
+ * [OWB-210] - creating a proxy fails for beans which have the same interface defined multiple times in their declaration chain
+ * [OWB-211] - JSFUtil.getViewId() crashes if viewRoot is not yet set
+ * [OWB-215] - after leaving the incubator a new location for the site needs to be configured
+ * [OWB-217] - IllegalStateException must be thrown on Already Begin or End Conversations
+ * [OWB-224] - we need to destroy() our Contextual instances on a Conversation timeout
+ * [OWB-225] - BeforeBeanDiscoveryImpl is not currently implemented
+ * [OWB-227] - handle errors set via AfterBeanDiscovery#addDefinitionError
+ * [OWB-228] - move faces-config from webbeans-impl to webbeans-jsf module
+ * [OWB-232] - exceptions with non-OWB XML don't contain interceptor/decorator classnames
+ * [OWB-233] - Circular Dependent Between Beans
+ * [OWB-240] - check on existing conversation is missing in Conversation#begin(String id)
+ * [OWB-241] - Conversation scoped bean instance gets destroyed for every ELResolver.getValue
+ * [OWB-244] - OWB injects a new object for @disposes injection point for dependent scope
+ * [OWB-246] - BeanManager#getReference must create a bean with resolved dependencies
+ * [OWB-247] - notifying an ObserverMethod with Reception.ALWAYS must not cause a getReference() if the bean already exists
+ * [OWB-249] - ObserverMethods should not use the contextual instance directly but the proxy instead
+ * [OWB-251] - Proxies created with JavassistProxyFactory do not intercept private functions
+ * [OWB-252] - Decorators stack not treated as a true stack
+ * [OWB-253] - Caching of Bean Proxies
+ * [OWB-258] - InjectionPoint meta-data injection into dependent beans not work correctly
+ * [OWB-260] - Handle Interceptors and Decorators properly when both are applied to a bean
+ * [OWB-261] - Implement BeanManager#getPassivationCapableBean(String id)
+ * [OWB-262] - Beans defined via TextContext XML get added twice
+ * [OWB-263] - BeanManagerImpl#isPassivatingScope need to additionally consider Scopes added via BeforeBeanDiscovery#addScope()
+ * [OWB-266] - transitive interceptor bindings not applied to Bean subclasses
+ * [OWB-267] - interceptor bindings in a stereotype are not inherited by subclass
+ * [OWB-269] - NPE when using WebApplicationLifeCycle in Test
+ * [OWB-270] - openwebbeans-resouce must not contain EJB dependencies
+ * [OWB-271] - method-level interceptor bindings not inherited properly
+ * [OWB-272] - memory leak and huge cpu consumption in latest snapshot
+ * [OWB-273] - Given class is not annotated with @Alternative Exception when try to enable alternative producer/producer field beans
+ * [OWB-274] - interceptor and decorator don't read re-Annotated meta data
+ * [OWB-279] - Indirect specialization (4.3.1) throws InconsistentSpecializationException
+ * [OWB-283] - serializable check on Interceptor and Decorator stack should check for null
+ * [OWB-284] - OWB could not find default bean if alternative specialized bean is not enabled.
+ * [OWB-285] - Interceptor and Decorator instances must be @Dependent scoped
+ * [OWB-289] - Owb return 2 beans for Indirect specialized producer beans
+ * [OWB-291] - InterceptorHandler crashes with ClassCastException when getting serialized
+ * [OWB-292] - InterceptorHandler crashes with NullPointerException if no creationalContext is present
+ * [OWB-294] - manually added scopes doesn't get detected correctly in AbstractOwbBean
+ * [OWB-296] - DependentCreationalContext doesn't properly serialize it's Contextual<T>
+ * [OWB-297] - DelegateInjection point should not be required to be an interface.
+ * [OWB-298] - When checking that the delegate implements all decorated types, we must not check for Serializable
+ * [OWB-299] - WebBeansUtil's checkDecoratorResolverParams does not always check that the annotations passed are qualifiers
+ * [OWB-301] - WebBeansDecorators getDecoratedTypes returns the types of the wrapped bean instead of its list of decorated types
+ * [OWB-304] - Beans from a ProducerMethods don't get injected anymore
+ * [OWB-305] - exceptions become InvocationTargetException when propogated up interceptor stack
+ * [OWB-307] - InvocationContext.setParameters() and primitive vs. wrapped types
+ * [OWB-308] - minor clean up on specialization code path
+ * [OWB-309] - signature check for @Interceptors-enabled interceptors is too strict
+ * [OWB-311] - @ExcludeClassInterceptors doesn't remove in all cases
+
+Improvement
+
+ * [OWB-98] - Check ManagedBean Public Field
+ * [OWB-99] - Interceptors and decorators may not declare producer methods.
+ * [OWB-100] - Update for Disposal Methods
+ * [OWB-101] - Update @New Binding Type for Taking Class Member Method
+ * [OWB-102] - Initializer Methods Validation for Generic Methods
+ * [OWB-103] - Inconsistent Specialization Extra Check For Injection Points
+ * [OWB-104] - Check Inherited Member for producer methods and fields
+ * [OWB-164] - Consistent logging in WebBeansInterceptorConfig
+ * [OWB-174] - ApplicationContext available in StandaloneLifeCycle
+ * [OWB-186] - Upgrade OWB to the JPA-2 spec
+ * [OWB-188] - remove webbeans-jpa and cleanup webbeans-resource
+ * [OWB-190] - Make the TestLifeCycles available in webbeans-impl
+ * [OWB-191] - Convert logging to use keyed, formatted strings from a ResourceBundle to allow for translation.
+ * [OWB-202] - upgrade webbeans-jsf to JSF-2
+ * [OWB-203] - Improve logging of webbeans-resource if a PersistenceUnit cannot be found
+ * [OWB-212] - Improve logging for various failures in Producer and Disposal methods
+ * [OWB-213] - Update Interceptor Project Dependency to 1.1
+ * [OWB-248] - upgrade to apache-parent 6 (from 4)
+ * [OWB-250] - Update Extensions Event Calling More TypeSafe & Adding more tests for Extensions
+ * [OWB-255] - injection point errors at deployment don't tell you the injection point!
+ * [OWB-264] - Location of redirect in faces-config.xml files is causing warnings.
+ * [OWB-265] - Some of the resources in the bundle needed to be removed or updated.
+ * [OWB-268] - Implementation of BeanManager#createInjectionTarget
+ * [OWB-276] - Improve consistency of Asserts referencing null clazz.
+ * [OWB-278] - Remove DEBUG messages from resource bundle since they don't need to be translated.
+ * [OWB-280] - Update Bean Class Hierarchy
+ * [OWB-281] - Create Resource Bean (Section 3.5), update resource plugin handling
+ * [OWB-282] - Adding Default SPI Implementation for 3.6. Update names of Default service implementations.
+ * [OWB-287] - DefaultScannerService should skip WAR checks if no context is given
+ * [OWB-290] - provide SPI for Servlet ContainerLifecycle for better testing support
+ * [OWB-293] - upgrade OWB samples to MyFaces Core v2.0.0-beta-2
+ * [OWB-300] - Currently OWB requires log4j for logging. This patch provides a means of choosing other loggers.
+
+New Feature
+
+ * [OWB-135] - implement API changes from spec version PFD2
+ * [OWB-137] - implement BusyConversationException use case
+ * [OWB-138] - implement NonexistentConversationException use case
+ * [OWB-226] - create a way to dynamically add Extensions to our tests
+ * [OWB-229] - add support for the JSF2 javax.faces.bean.ViewScoped annotation
+ * [OWB-230] - Enable/Disable Configuration of JSF2 Extensions
+ * [OWB-277] - Owb on Google App Engine
+
+Task
+
+ * [OWB-106] - Update code for new deployment type handling.
+ * [OWB-107] - Check EL Name Ambigious
+ * [OWB-145] - Refactor InterceptorHandler filter methods
+ * [OWB-205] - Update Samples for MyFaces 1.2 Latest Version
+ * [OWB-218] - Work on (Section 2.5 - Bean EL names) of coverege-cdi.html of RI TCK
+ * [OWB-219] - Work on (Section 2.6 - Alternatives) of coverege-cdi.html of RI TCK
+ * [OWB-221] - Work on (Section 2.7 - Stereotypes) of coverege-cdi.html of RI TCK
+ * [OWB-223] - Work on (Section 3.1 - Managed beans) of coverege-cdi.html of RI TCK
+ * [OWB-234] - Update geronimo-cdi to geronimo-jcdi, update geronimo-interceptor specs
+ * [OWB-235] - Pass TCK Event Tests
+ * [OWB-242] - Update Interceptor Project Dependency to 1.1 with EA1-SNAPSHOT Version
+ * [OWB-243] - Ensure serialized access to conversation scope by blocking or rejecting concurrent requests
+ * [OWB-256] - Define SPI Maven Module
+ * [OWB-257] - Delete webbeans-geronimo module
+
+Wish
+
+ * [OWB-236] - OWB docs online
+
+----------------------------------------------
+Required Platform
+----------------------------------------------
+Java Version : Java SE >= 6.0
+Java EE Must : Java EE >= 5.0
+
+---------------------------------------------
+How to Configure The OpenWebBeans
+---------------------------------------------
+
+This section explains a content of the distribution bundle, OWB plugins and its
+dependent libraries.
+
+---------------------------------------------
+M4 Distribution Content
+---------------------------------------------
+There are several jars in the OpenWebBeans M4 distribution;
+
+ - openwebbeans-impl-1.0.0-M4.jar --> Includes Core Dependency Injection Service.
+ - openwebbeans-ejb-1.0.0-M4.jar --> EJB Plugin(Supports EJBs in OpenEJB embedded in Tomcat).
+ - openwebbeans-jms-1.0.0-M4.jar --> JMS Plugin(Supports injection of JMS related artifacts,i.e, ConnectionFactory, Session, Connection etc.)
+ - openwebbeans-jsf-1.0.0-M4.jar --> JSF Plugin(JSF Conversation Scoped Support).
+ - openwebbeans-resource-1.0.0-M4.jar --> Java EE Resource Injection for Web Projects (Includes @PersistenceContext,@PersistenceUnit
+ and @Resource injection into the Managed Beans. @Resource injections use java:/comp/env of the
+ Web application component. @PersistenceContext is based on extended EntityManager.
+ - openwebbeans-spi-1.0.0-M4.jar --> OpenWebBeans Server Provider Interfaces. They are implemented by runtime environments that would
+ like to use OpenWebBeans as a JSR-299 implementation.
+ - samples --> Includes source code of the samples. Samples are mavenized project therefore you can easily build and run
+ them from your environment that has maven runtime.
+
+
+------------------------------------------
+How OWB Plugins Work
+------------------------------------------
+
+OpenWebBeans has been developing as a plugin way. Core dependency injection service
+is provided with the Core implementation jar,i.e, openwebbeans-impl. If you need further service functionality,
+you have to add respective plugin jars into the application classpath. Plugin functionality uses Java SE 6.0
+"java.util.ServiceLoader" utility.
+
+Current Plugins:
+---------------------
+Look at "M4 Distribution Content" above.
+
+------------------------------------------
+Dependent Libraries
+------------------------------------------
+
+Third Party jars:
+-----------------
+They are necessary at runtime in the Core Implementation.
+
+log4j: Version 1.2.14
+dom4j: Version 1.6.1
+javassist : Version 3.11.0.GA
+scannotation : Version 1.0.2
+
+Java EE APIs jars(Container Provider Libraries) :
+-------------------------------------------------
+Generally full Java EE servers provides these jars. But web containers like Tomcat or Jetty
+does not contain some of them, such as JPA, JSF, Validation API etc. So, if you do not want to bundle
+these libraries within your application classpath, you have to put these libraries into your
+server common classpath if it does not contain.
+
+jcdi-api (JSR-299 Specification API)
+atinject-api (JSR-330 Specification API)
+servlet-2.5 or servlet 3.0 (Servlet Specification API)
+ejb-3.1 (EJB Specification API)
+el-2.2 (Expression Langauge Specification API)
+jsf-2.0 (Java Server Faces API)
+jsr-250 (Annotation API)
+interceptor-1.1 (Interceptor API)
+jta-1.1 (Java Transaction API)
+jsp.2.1 or jsp-2.2 (Java Server Pages API)
+jpa-2.0 (Java Persistence API)
+jaxws-2.1 or jaxws-2.2 (Java Web Service API)
+jms-1.1 or jms-1.2 (Java Messaging Service API)
+validation (Validation Specification)
+
+Dependencies of OpenWebBeans Maven Modules&Plugins
+--------------------------------------------------
+
+openwebbeans-impl :
+------------------
+Third party : log4j, dom4j, javassist, scannotation, openwebbeans-spi
+Container Provided : jcdi-api, at-inject, servlet, el, jsr-250, interceptor, jta, jsp, validation
+
+openwebbeans-ejb:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : OpenWebBeans EJB plugin is based on OpenEJB in Tomcat. Therefore, if you install OpenEJB
+ within Tomcat correctly, there is no need to add any additional libraries. Look at the
+ OpenEJB in Tomcat configuration section.
+
+openwebbeans-jms:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : jms
+
+openwebbeans-jsf:
+-----------------
+Third party : openwebbeans-impl and its dependencies
+Container Provided : jsf
+
+NOTE : We are trying to decrease dependent libraries of the our core, i.e, openwebbeans-impl.
+At 1.0.0, dependent third party libraries will be decreased. We have a plan to create profile
+plugins, therefore each profile plugin provides its own dependent libraries. For example, in
+fully Java EE Profile Plugin, Transaction API is supported but this will not be the case
+for Java Web Profile Plugin or Java SE Profile Plugin. Stay Tune!
+
+Currently, as you have seen above, openwebbeans-impl depends on some Java EE/Runtime
+provided libraries (servlet, jsp, el etc). In the future, with OpenWebBeans profiling support,
+openwebbeans-impl will not depend on any Java EE APIs. Those APIs will be provided
+by OpenWebBeans profiles/plugins that openwebbeans-impl will be used. Therefore,
+you will able to use OpenWebBeans in your own runtime environment easily by writing
+your own plugins and contributing it to OpenWebBeans :)
+
+------------------------------------------
+Library Configuration
+------------------------------------------
+To run openwebbeans applications in the Java EE based application server,
+you could add JSR-299 API and JSR-330 API into the server common classpath, and
+implementation, plugins and dependent jars into your "WEB-INF/lib" directory
+of the Java EE Web Application.
+
+In this release, we can not support the OpenWebBeans as an integrated
+functionality of the Java EE Application Servers. So, you have to manage the
+configuration of the OpenWebBeans within your application's "web.xml" file. A sample "web.xml"
+file can be found in the "config" directory. To use EJB functionality, you also have to
+add OWB specific interceptor into your EJB beans. Look at the EJB section of this readme
+for further details.
+
+---------------------------------------------
+OpenWebBeans Properties File
+---------------------------------------------
+OpenWebBeans uses a default configuration file to configure some of its
+properties. Default configuration file is embedded into the OWB implementation
+jar file. Instead of opening this jar file and changing configuration properties, simply add
+"openwebbeans.properties" file into a "META-INF/openwebbeans" folder of your application
+classpath. This will override the default configuration.
+
+Belows are default configuration properties of the OpenWebBeans that is embedded into openwebbeans-impl jar file.
+
+Each plugin or developer can provide its own SPI implementation class and its own configuration values. If you woud like
+to use those implementation classes or configuration values, you have to override default configuration file as explained
+in the above paragraph, i.e, putting "openwebbeans.properties" file into "META-INF/openwebbeans" folder of your application.
+
+For example : You add "META-INF/openwebbeans/openwebbeans.properties" in your application classpath. And you add the following
+key-value pair to use. And this service implementation is provided by your plugin, for example OpenWebBeans OpenEJB plugin.
+
+Override default value of ResourceInjectionService
+-------------------------------------------------
+org.apache.webbeans.spi.ResourceInjectionService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService
+
+OpenWebBeans uses the "OpenEjbResourceInjectionService" class to inject resources into the managed bean instances.
+
+Configuration Names and Their Default Values :
+
+- "org.apache.webbeans.spi.ContainerLifecycle"
+ Description : Implementation of org.apache.webbeans.spi.ContainerLifecycle. All magic starts from here.
+ Values : org.apache.webbeans.lifecycle.DefaultLifecycle, OR CUSTOM
+ Default : org.apache.webbeans.lifecycle.DefaultLifecycle
+
+- "org.apache.webbeans.spi.JNDIService"
+ Description : Configures JNDI provider implementation.
+ Values : org.apache.webbeans.spi.se.DefaultJndiService OR CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultJndiService
+
+- "org.apache.webbeans.spi.conversation.ConversationService"
+ Description : Implementation of conversation.
+ Values : org.apache.webbeans.spi.conversation.jsf.DefaultConversationService OR CUSTOM
+ Default : org.apache.webbeans.spi.conversation.jsf.DefaultConversationService
+
+- "org.apache.webbeans.spi.ScannerService"
+ Description : Default implementation of org.apache.webbeans.spi.ScannerService. It is used for scanning application deployment
+ for finding bean classes and configuration files.
+ Values : org.apache.webbeans.spi.ee.deployer.DefaultScannerService OR CUSTOM
+ Default : org.apache.webbeans.spi.ee.deployer.DefaultScannerService
+
+- "org.apache.webbeans.spi.SecurityService"
+ Description : Implementation of org.apache.webbeans.spi.SecurityService. It is used for getting current "Principal".
+ Values : org.apache.webbeans.spi.se.DefaultSecurityService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultSecurityService
+
+- "org.apache.webbeans.spi.ValidatorService"
+ Description : Implementation of org.apache.webbeans.spi.ValidatorService. It is used for getting "ValidatorFactory" and "Validator".
+ Values : org.apache.webbeans.spi.se.DefaultValidatorService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultValidatorService
+
+- "org.apache.webbeans.spi.TransactionService"
+ Description : Implementation of org.apache.webbeans.spi.TransactionService. It is used for getting "TransactionManager" and "Transaction".
+ Values : org.apache.webbeans.spi.se.DefaultTransactionService or CUSTOM
+ Default : org.apache.webbeans.spi.se.DefaultTransactionService
+
+- "org.apache.webbeans.spi.ResourceInjectionService"
+ Description : Implementation of org.apache.webbeans.spi.ResourceInjectionService. It is used for injection Java EE enviroment resource into the
+ Managed Bean instances.
+ Values : org.apache.webbeans.se.DefaultResourceInjectionService or CUSTOM
+ Default : org.apache.webbeans.se.DefaultResourceInjectionService
+
+- "org.apache.webbeans.spi.JNDIService.jmsConnectionFactoryJndi"
+ Description : Configures JMS ConnectionFactory object jndi name
+ Values : Server specific JNDI name
+ Default : ConnectionFactory
+
+- "org.apache.webbeans.conversation.Conversation.periodicDelay"
+ Description : Conversation removing thread periodic delay
+ Values : Configured in millisecond
+ Default : 150000 ms
+
+- "org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService"
+ Description : Use EJB functionality or not. If use OpenEJB configures to true
+ Values : false, true
+ Default : false
+
+---------------------------------------------
+EJB Support via Embeddable OpenEJB Container in Tomcat 6.X
+---------------------------------------------
+
+Configuration Steps:
+--------------------------------------------
+1* Download Tomcat 6.X version
+2* Configure OpenEJB. Look at URL http://openejb.apache.org/tomcat.html for installation.
+3* Copy JSR-330 API to Tomcat /lib folder.
+4* Copy JSR-299 API to Tomcat /lib folder
+5* Put all dependent libraries of the OpenWebBeans OpenEJB Plugin
+ - openwebbeans-ejb
+ - openwebbeans-impl and its dependencies
+
+You could look at ejb-sample.war for "WEB-INF/lib" libraries to develop custom application.
+You can also look at a source of the project.
+
+To use EJB functionality, you will use OpenEJB collapse-ear support. In this configuration,
+your EJB beans live within your "war" bundle.
+
+How to Develop EJB Applications
+---------------------------------------------
+1* Add "META-INF/openwebbeans.properties" into your application classpath.
+2* Add "org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService=true" to use EJB functionality.
+ So OWB container looks for EJBs.
+3* Add "org.apache.webbeans.resource.spi.ResourceService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService to
+use OpenEJB Resource injections.
+4* Add "openwebbeans-ejb", plugin into your web application classpath.
+5* If you want to use other plugins, add respective plugins into your application classpath. For example, if you wish to use
+JSF framework, you add "openwebbeans-jsf" plugin.
+6* Add OWB related interceptor into your EJB Beans. This is called "org.apache.webbeans.ejb.interceptor.OpenWebBeansEjbInterceptor"
+This is needed for OWB injections.
+7* Update your application's "web.xml" to add OWB specific configuration.
+
+---------------------------------------------
+How to Run Samples
+---------------------------------------------
+
+In this release, there are several sample applications located in the "/samples" directory
+of the distribution. You can run those samples via simple maven command.
+
+1) "Guess Application" : Simple usage of the OWB + JSF.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+2) "Hotel Reservation Application" : Show usage of JSF + JPA + OWB
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+3) "EJB Sample Application" : Shows the usage of EJBs with embeddable OpenEJB in Tomcat. Firstly
+configure OpenEJB with Tomcat as explained above.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+4) "EJB Telephone Application" : Shows the usage of OpenEJB resource injection service.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+5) "JMS Injection Sample" : Show JMS injections. JMS injection currently uses
+ ConnectionFactory as JMS connection factory jndi name. You can change this
+ via configuration file. Look above explanation for how to configure JMS jndi. Also,
+ JMS injection requires to use of a JMS provider. Generally Java EE servers contains
+ default JMS provider. It can be run on JBoss and Geronimo. It uses Queue with jndi_name = "queue/A".
+ So you have to create a queue destination in your JMS provider with name "queue/A" to run example.
+ If you want to change queue jndi name, then look at source and change it from "WEB-INF/beans.xml" file.
+
+6) "Conversation Sample" : Shows usage of JSF conversations.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section.
+
+7) "JSF2 Sample" : Shows usage of JSF2 Ajax.
+It can be run in the jetty web container via maven jetty plugin from source.
+Look at "Compile and Run Samples via Jetty&Tomcat Plugin" section. It requires
+to use JSF2 runtime.
+
+
+8) "Standalone Sample" : Shows usage of OpenWebBeans in Stadnalone Swing Application.
+Look at "OpenWebBeans in Java SE" section.
+
+Configuring and Running the Applications:
+--------------------------------------------
+See section Compile and Run Samples via Jetty&Tomcat Plugin.
+
+--------------------------------------------
+Maven Install and Package From the Source
+--------------------------------------------
+
+Maven Version : Apache Maven 2.2.1 or later
+
+Firstly you have to download the "source" version of the OpenWebBeans project that
+contains the all source codes of the OpenWebBeans.
+
+To install the Maven artifacts of the project from the source, Maven must be installed
+in your runtime. After Maven installation, just run the following command in the top level
+directory that contains the main "pom.xml" :
+
+> mvn clean install
+
+This command will install all the Maven artifacts into your local Maven repository.
+
+If you wish to package all artifacts of the project, just run the following command
+in in the top level directory that contains the main "pom.xml" :
+
+> mvn clean package
+
+This command will package the project artifacts from the source and put these artifacts into the each modules
+respective "target" directory.
+
+-------------------------------------------
+Compile and Run Samples via Tomcat&Jetty Plugin
+-------------------------------------------
+This section shows how to run samples in Jetty or OpenEJB Embedded Tomcat.
+
+------------------------------------------
+Samples Run within Jetty Plugin
+------------------------------------------
+You can compile and run "guess","jsf2","conversation-sample" and "reservation "samples via maven Jetty plugin.
+Go to the source bundle "samples/" directory. In the "guess/" or "reservation/" directory, run
+the following maven commands. It will start up maven Jetty container. It bundles all of the
+required jars into the WEB-INF/lib folder. You are not required to add any jar to the classpath.
+
+Samples : Guess and Reservation
+------------------------------
+Go to the source folder of projects and run
+
+> mvn clean install -Pjetty
+> mvn jetty:run -Pjetty
+
+Guess URL : http://localhost:8080/guess
+Reservation URL : http://localhost:8080/reservation
+
+Samples : Conversation Sample and JSF2
+-------------------------------------
+Go to the source folder of projects and run
+
+>mvn clean install
+>mvn jetty:run
+
+Conversation Sample URL : http://localhost:8080/conversation-sample
+JSF2 Sample URL : http://localhost:8080/jsf2sample
+
+------------------------------------------
+Samples Run within Tomcat Plugin
+------------------------------------------
+OpenEJB samples are run with Maven Tomcat Plugin.
+
+Tomcat Plugin uses http://localhost:8080/manager application to deploy war file
+into your embeddable EJB Tomcat container. There must be an tomcat-users.xml
+file in the "conf" directory of the server that contains manager role and username.
+
+>Start Tomcat server if not started
+>mvn tomcat:deploy
+
+Ejb Sample URL : http://localhost:8080/ejb-sample
+Ejb Telephone URL : http://localhost:8080/ejb-telephone
+
+Example tomcat-users.xml file
+------------------------------------------
+<tomcat-users>
+<role rolename="manager"/>
+<user username="admin" password="" roles="manager"/>
+</tomcat-users>
+
+-----------------------------------------
+Deploy JMS Sample
+-----------------------------------------
+Simple drops jms-sample.war file into your application deploy location.
+
+JMS Sample Example URL : Hit the url http://localhost:8080/jms-sample/sender.jsf for sending JMS messages
+ Hit the url http://localhost:8080/jms-sample/receiver.jsf for receiving JMS messages
+
+-----------------------------------------
+OpenWebBeans in Java SE
+----------------------------------------
+OpenWebBeans can perfeclty use in Java SE environment like Java Swing
+applications. Standalone Samples is provided to show how to use OpenWebBeans
+in Java SE.
+
+Go to the source directory of the standalone sample:
+>mvn clean package;
+>cd target;
+>jar -xvf standalone-sample.jar
+>java -jar standalone-sample-1.0.0-SNAPSHOT.jar
+>Enjoy :)
+
+-----------------------------------------------
+OpenWebBeans User and Development Mailing Lists
+-----------------------------------------------
+Please mail to the user mailing list about any questions or advice
+about the OpenWebBeans.
+
+User Mailing List : [users@openwebbeans.apache.org]
+
+You can also join the discussions happening in the dev list
+
+Dev Mailing List : [dev@openwebbeans.apache.org]
+
+-------------------------------------------
+OpenWebBeans JIRA Page
+-------------------------------------------
+Please logs bugs into the "https://issues.apache.org/jira/browse/OWB".
+
+------------------------------------------
+OpenWebBeans Wiki and Blog Page
+-----------------------------------------
+Wiki: http://cwiki.apache.org/OWB/
+Introduction to OpenWebBeans : http://cwiki.apache.org/OWB/introduction-to-openwebbeans.html
+Blog : http://blogs.apache.org/owb
+
+-----------------------------------------
+OpenWebBeans Web Page
+----------------------------------------
+You can reach the OpenWebBeans web page at
+http://openwebbeans.apache.org
+---------------------------------------
+
+OpenWebBeans Team
+
+Enjoy!
diff --git a/owb_1.2.x/readme/TCK_RUNNING.txt b/owb_1.2.x/readme/TCK_RUNNING.txt
new file mode 100644
index 0000000..7036f3c
--- /dev/null
+++ b/owb_1.2.x/readme/TCK_RUNNING.txt
@@ -0,0 +1,97 @@
+-----------------------------------------------------
+INTRODUCTION
+-----------------------------------------------------
+
+This document explains how to configure TCK artifacts
+to run standalone and web profile tcks.
+
+----------------------------------------------------
+REQUIREMENTS
+----------------------------------------------------
+
+1* Apache Tomcat 6 latest version.
+2* Copy the following jars into Tomcat lib/ folder
+ - geronimo-atinject_1.0_spec-1.0.jar
+ - geronimo-interceptor_1.1_spec-1.0.jar
+ - geronimo-jcdi_1.0_spec-1.0.jar
+ - openwebbeans-spi-1.0.0-SNAPSHOT.jar
+ - openwebbeans-tomcat6-1.0.0-SNAPSHOT.jar
+
+--------------------------------------------------
+TCK Configuration Files
+--------------------------------------------------
+There are two XML files that need to be updated for
+standalone and web profile testing.
+
+###################################################
+Standalone TCK Configuration
+###################################################
+
+############### jboss-test-harness.properties in webbeans-tck###############################
+org.jboss.jsr299.tck.spi.Managers=org.apache.webbeans.test.tck.ManagersImpl
+org.jboss.jsr299.tck.spi.Beans=org.apache.webbeans.test.tck.BeansImpl
+org.jboss.jsr299.tck.spi.Contexts=org.apache.webbeans.test.tck.ContextsImpl
+org.jboss.testharness.spi.StandaloneContainers=org.apache.webbeans.test.tck.StandaloneContainersImpl
+org.jboss.testharness.spi.Containers=org.apache.webbeans.test.tck.ContainersImpl
+org.jboss.jsr299.tck.spi.EL=org.apache.webbeans.test.tck.ELImpl
+org.jboss.testharness.standalone=true
+############################################################################################
+
+############## openwebbeans.properties in webbeans-tck######################################
+org.apache.webbeans.spi.JNDIService=org.apache.webbeans.corespi.se.DefaultJndiService
+org.apache.webbeans.spi.ScannerService=org.apache.webbeans.test.tck.mock.TCKMetaDataDiscoveryImpl
+org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService=true
+############################################################################################
+
+###################################################
+Web Profile TCK
+###################################################
+
+############### jboss-test-harness.properties in webbeans-tck###############################
+org.jboss.jsr299.tck.spi.Managers=org.apache.webbeans.test.tck.ManagersImpl
+org.jboss.jsr299.tck.spi.Beans=org.apache.webbeans.test.tck.BeansImpl
+org.jboss.jsr299.tck.spi.Contexts=org.apache.webbeans.test.tck.ContextsImpl
+org.jboss.testharness.spi.StandaloneContainers=org.apache.webbeans.test.tck.StandaloneContainersImpl
+org.jboss.testharness.spi.Containers=org.apache.webbeans.test.tck.ContainersImpl
+org.jboss.jsr299.tck.spi.EL=org.apache.webbeans.test.tck.ELImpl
+org.jboss.testharness.standalone=false
+org.jboss.testharness.libraryDirectory=target/dependency/lib
+org.jboss.testharness.runIntegrationTests=true
+org.jboss.testharness.api.TestLauncher=org.jboss.testharness.impl.runner.servlet.ServletTestLauncher
+############################################################################################
+
+############## openwebbeans.properties in webbeans-tck######################################
+org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService=false
+############################################################################################
+
+###########################################
+Running Standalone TCK From Maven
+###########################################
+1* Do the above configuration
+2* Run "mvn clean test -Ptck" from webbeans-tck root
+
+##########################################
+Running WebProfile TCK From Maven
+##########################################
+1* Do the above configuration
+2* Open webbeans-tck/pom.xml
+3* Change "standalone-suite.xml" with "webprofile-suite.xml" in "maven-surefire-plugin"
+4* Change "tomcat.home" with your Apache 6 path in "maven-surefire-plugin"
+5* Run "mvn clean test -Ptck" from webbeans-tck root
+
+##############################################################
+Running and Debugging TCK Tests in Eclipse with TestNG Plugin
+##############################################################
+1* Download and setup TestNG plugin from testng.org/doc/eclipse.html
+2* Import webbeans-tck and other projects into Eclipse
+3* Open Run/Debug Configuration... in Eclipse
+4* Right Click to TestNG and Click New
+5* In opened window, select webbeans-tck as "Project" and standalone-suite.xml
+or webprofile-suite.xml as "Suite" file
+6* In opened window, click "Arguments" tab and add "-Dtomcat.home=/path/to/your/tomcat"
+in "VM Arguments"
+7* Click Debug
+
+-------------------------------------------------------------------------------------
+ENJOY!
+-------------------------------------------------------------------------------------
diff --git a/owb_1.2.x/samples/conversation-sample/LICENSE b/owb_1.2.x/samples/conversation-sample/LICENSE
new file mode 100644
index 0000000..86efaae
--- /dev/null
+++ b/owb_1.2.x/samples/conversation-sample/LICENSE
@@ -0,0 +1,202 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
\ No newline at end of file
diff --git a/owb_1.2.x/samples/conversation-sample/NOTICE b/owb_1.2.x/samples/conversation-sample/NOTICE
new file mode 100644
index 0000000..f5a2e59
--- /dev/null
+++ b/owb_1.2.x/samples/conversation-sample/NOTICE
@@ -0,0 +1,6 @@
+Apache OpenWebBeans
+Copyright 2008, 2010 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/owb_1.2.x/samples/conversation-sample/pom.xml b/owb_1.2.x/samples/conversation-sample/pom.xml
new file mode 100644
index 0000000..5239058
--- /dev/null
+++ b/owb_1.2.x/samples/conversation-sample/pom.xml
@@ -0,0 +1,130 @@
+<?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.
+-->
+<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>
+ <description>Sample JSF2 Application</description>
+ <parent>
+ <artifactId>samples</artifactId>
+ <groupId>org.apache.openwebbeans</groupId>
+ <version>1.2.5</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.apache.openwebbeans.samples</groupId>
+ <artifactId>conversation-sample</artifactId>
+ <packaging>war</packaging>
+ <name>JSF Conversation Sample</name>
+
+ <properties>
+ <deploy.skip>true</deploy.skip>
+ </properties>
+
+ <dependencies>
+
+ <!-- JSR-299 Impl -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ </dependency>
+
+ <!-- Interceptor API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+ </dependency>
+
+ <!-- JSF Plugin -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-jsf12</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- EL Plugin -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-el10</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- Web Plugin -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-web</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- MyFaces API -->
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>1.2.8</version>
+ </dependency>
+
+ <!-- MyFaces IMPL -->
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <version>1.2.8</version>
+ </dependency>
+
+ <!-- JSF Facelet -->
+ <dependency>
+ <groupId>com.sun.facelets</groupId>
+ <artifactId>jsf-facelets</artifactId>
+ <version>1.1.14</version>
+ </dependency>
+
+ <!-- JSR-299 API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ </dependency>
+
+ <!-- JSR-330 API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ </dependency>
+
+ <!-- SPI API -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>conversation-sample</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <version>6.1.18</version>
+ <configuration>
+ <contextPath>${project.build.finalName}</contextPath>
+ <scanIntervalSeconds>3</scanIntervalSeconds>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/owb_1.2.x/samples/conversation-sample/src/main/java/org/apache/webbeans/samples/conversation/Item.java b/owb_1.2.x/samples/conversation-sample/src/main/java/org/apache/webbeans/samples/conversation/Item.java
new file mode 100644
index 0000000..a080607
--- /dev/null
+++ b/owb_1.2.x/samples/conversation-sample/src/main/java/org/apache/webbeans/samples/conversation/Item.java
@@ -0,0 +1,76 @@
+/*
+ * 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.webbeans.samples.conversation;
+
+import java.io.Serializable;
+
+public class Item implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private String name;
+
+ private long price;
+
+ public Item()
+ {
+
+ }
+
+ public Item(String name, long price)
+ {
+ this.name = name;
+ this.price = price;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * @return the price
+ */
+ public long getPrice()
+ {
+ return price;
+ }
+
+ /**
+ * @param price the price to set
+ */
+ public void setPrice(long price)
+ {
+ this.price = price;
+ }
+
+
+
+}
diff --git a/owb_1.2.x/samples/conversation-sample/src/main/java/org/apache/webbeans/samples/conversation/Products.java b/owb_1.2.x/samples/conversation-sample/src/main/java/org/apache/webbeans/samples/conversation/Products.java
new file mode 100644
index 0000000..b5bf229
--- /dev/null
+++ b/owb_1.2.x/samples/conversation-sample/src/main/java/org/apache/webbeans/samples/conversation/Products.java
@@ -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.webbeans.samples.conversation;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Named;
+
+@Named
+@ApplicationScoped
+public class Products implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private List<Item> products = new ArrayList<Item>();
+
+ public Products()
+ {
+
+ }
+
+ @PostConstruct
+ public void afterInit()
+ {
+ for(int i=1;i<6;i++)
+ {
+ Item item = new Item("Item-" + i,i*1500L);
+ products.add(item);
+ }
+ }
+
+ @PreDestroy
+ public void preDestroy()
+ {
+ products.clear();
+ }
+
+ /**
+ * @return the products
+ */
+ public List<Item> getProducts()
+ {
+ return products;
+ }
+
+
+}
diff --git a/owb_1.2.x/samples/conversation-sample/src/main/java/org/apache/webbeans/samples/conversation/ShoppingBean.java b/owb_1.2.x/samples/conversation-sample/src/main/java/org/apache/webbeans/samples/conversation/ShoppingBean.java
new file mode 100644
index 0000000..16dc3ea
--- /dev/null
+++ b/owb_1.2.x/samples/conversation-sample/src/main/java/org/apache/webbeans/samples/conversation/ShoppingBean.java
@@ -0,0 +1,118 @@
+/*
+ * 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.webbeans.samples.conversation;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.context.Conversation;
+import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.inject.New;
+import javax.enterprise.inject.Produces;
+import javax.faces.component.UIData;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@Named
+@ConversationScoped
+public class ShoppingBean implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private @Inject Products products;
+
+ private @Inject Conversation conversation;
+
+ private List<Item> items = new ArrayList<Item>();
+
+ private UIData uiTable;
+
+
+ public ShoppingBean()
+ {
+
+ }
+
+ @Inject
+ public ShoppingBean(@New Item defaultItem)
+ {
+ defaultItem.setName("Default Item");
+ defaultItem.setPrice(1000L);
+
+ items.add(defaultItem);
+ }
+
+
+ public String startShopping()
+ {
+ this.conversation.begin();
+
+ return null;
+ }
+
+ public String checkout()
+ {
+ this.conversation.end();
+
+ return null;
+ }
+
+ public Conversation getConversation()
+ {
+ return this.conversation;
+ }
+
+ @Produces @Named("selectedItems")
+ public List<Item> listSelectedItems()
+ {
+ return this.items;
+ }
+
+ public String buy()
+ {
+ Item item = (Item) uiTable.getRowData();
+ this.items.add(item);
+
+ return null;
+ }
+
+ @Produces @Named("allProducts")
+ public List<Item> listAllProducts()
+ {
+ return this.products.getProducts();
+ }
+
+ /**
+ * @return the uiTable
+ */
+ public UIData getUiTable()
+ {
+ return uiTable;
+ }
+
+ /**
+ * @param uiTable the uiTable to set
+ */
+ public void setUiTable(UIData uiTable)
+ {
+ this.uiTable = uiTable;
+ }
+
+}
diff --git a/owb_1.2.x/samples/conversation-sample/src/main/resources/META-INF/beans.xml b/owb_1.2.x/samples/conversation-sample/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000..85b6e63
--- /dev/null
+++ b/owb_1.2.x/samples/conversation-sample/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+<beans/>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/conversation-sample/src/main/resources/META-INF/openwebbeans/openwebbeans.properties b/owb_1.2.x/samples/conversation-sample/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
new file mode 100644
index 0000000..4ac002c
--- /dev/null
+++ b/owb_1.2.x/samples/conversation-sample/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
@@ -0,0 +1,27 @@
+#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.
+#---------------------------------------------------------------
+# The default configuration for OpenWebBeans
+#
+# The default configuration is intended for a JDK and a simple ServletContainer
+# like jetty, resin or tomcat.
+#
+#---------------------------------------------------------------
+
+#general configuration section
+
+org.apache.webbeans.spi.adaptor.ELAdaptor=org.apache.webbeans.el10.EL10Adaptor
diff --git a/owb_1.2.x/samples/conversation-sample/src/main/webapp/META-INF/MANIFEST.MF b/owb_1.2.x/samples/conversation-sample/src/main/webapp/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..5e94951
--- /dev/null
+++ b/owb_1.2.x/samples/conversation-sample/src/main/webapp/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
diff --git a/owb_1.2.x/samples/conversation-sample/src/main/webapp/WEB-INF/beans.xml b/owb_1.2.x/samples/conversation-sample/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 0000000..85b6e63
--- /dev/null
+++ b/owb_1.2.x/samples/conversation-sample/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+<beans/>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/conversation-sample/src/main/webapp/WEB-INF/faces-config.xml b/owb_1.2.x/samples/conversation-sample/src/main/webapp/WEB-INF/faces-config.xml
new file mode 100644
index 0000000..965ce7d
--- /dev/null
+++ b/owb_1.2.x/samples/conversation-sample/src/main/webapp/WEB-INF/faces-config.xml
@@ -0,0 +1,40 @@
+<?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.
+-->
+
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+
+ <navigation-rule>
+ <from-view-id>/buy.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>toListingPage</from-outcome>
+ <to-view-id>/listing.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+ </navigation-rule>
+
+ <application>
+ <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
+ </application>
+
+
+</faces-config>
diff --git a/owb_1.2.x/samples/conversation-sample/src/main/webapp/WEB-INF/web.xml b/owb_1.2.x/samples/conversation-sample/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..71db0f4
--- /dev/null
+++ b/owb_1.2.x/samples/conversation-sample/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,43 @@
+<?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.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ version="2.5">
+
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+
+ <listener>
+ <listener-class>
+ org.apache.webbeans.servlet.WebBeansConfigurationListener</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+
+</web-app>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/conversation-sample/src/main/webapp/buy.xhtml b/owb_1.2.x/samples/conversation-sample/src/main/webapp/buy.xhtml
new file mode 100644
index 0000000..f0ebf55
--- /dev/null
+++ b/owb_1.2.x/samples/conversation-sample/src/main/webapp/buy.xhtml
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<!--
+
+ 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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+xmlns:h="http://java.sun.com/jsf/html"
+xmlns:f="http://java.sun.com/jsf/core">
+<head>
+ <title>OpenWebBeans :: Examples</title>
+</head>
+<body>
+
+ <div>
+ <h3>Shopping Card Example</h3>
+ <ul>
+ <li>When user clicks <b style="color:red;">"Starts Shopping"</b> button, new conversation is started. When user clicks <b style="color:red;">"Checkout"</b> button, conversation ends.</li>
+ <li>When user clicks <b style="color:red;">"Add Item"</b> link in the table, it adds new item to the buyer's shopping card.</li>
+ <li>When user clicks <b style="color:red;">"Show Items"</b> button, it shows contents of buyer shopping card.</li>
+ <li>When user clicks <b style="color:red;">"To Listing Page"</b> button, it shows content of buyer shopping card in a new page.</li>
+ </ul>
+ </div>
+
+ <h:form id="form">
+
+ <div>
+ <h:outputText value="Current Conversation Id : " style="color:red;"/>
+ <h:outputText value="#{shoppingBean.conversation.id}" id="conversation" style="font-weight:bold;" />
+ </div>
+
+ <div style="margin-top: 10px;">
+ <h:commandButton id="button1" value="Starts Shopping" action="#{shoppingBean.startShopping}">
+ </h:commandButton>
+
+ <h:commandButton id="button3" value="To Listing Page" action="toListingPage">
+ </h:commandButton>
+
+ <h:commandButton id="button4" value="Checkout" action="#{shoppingBean.checkout}">
+ </h:commandButton>
+
+ </div>
+
+ <div style="margin-top: 10px;">
+ <h3>Products Details</h3>
+ <h:dataTable cellpadding="1" cellspacing="5" value="#{allProducts}" var="item" binding="#{shoppingBean.uiTable}">
+
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Product Name" />
+ </f:facet>
+ <h:outputText value="#{item.name}" />
+ </h:column>
+
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Product Price" />
+ </f:facet>
+ <h:outputText value="#{item.price}" />
+ </h:column>
+
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="" />
+ </f:facet>
+ <h:commandLink action="#{shoppingBean.buy}" value="Add Item to Card" />
+ </h:column>
+
+ </h:dataTable>
+ </div>
+
+ <div style="margin-top: 10px;">
+ <h3>Current Shopping Card Content</h3>
+ <h:dataTable cellpadding="1" cellspacing="5" value="#{selectedItems}" var="item">
+
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Product Name" />
+ </f:facet>
+ <h:outputText value="#{item.name}" />
+ </h:column>
+
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Product Price" />
+ </f:facet>
+ <h:outputText value="#{item.price}" />
+ </h:column>
+
+ </h:dataTable>
+ </div>
+
+
+ </h:form>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/conversation-sample/src/main/webapp/index.jsp b/owb_1.2.x/samples/conversation-sample/src/main/webapp/index.jsp
new file mode 100644
index 0000000..f4ea325
--- /dev/null
+++ b/owb_1.2.x/samples/conversation-sample/src/main/webapp/index.jsp
@@ -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.
+-->
+<html>
+<head>
+<meta HTTP-EQUIV="REFRESH" content="0; url=buy.jsf">
+</head>
+</html>
diff --git a/owb_1.2.x/samples/conversation-sample/src/main/webapp/listing.xhtml b/owb_1.2.x/samples/conversation-sample/src/main/webapp/listing.xhtml
new file mode 100644
index 0000000..8307107
--- /dev/null
+++ b/owb_1.2.x/samples/conversation-sample/src/main/webapp/listing.xhtml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<!--
+
+ 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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+xmlns:h="http://java.sun.com/jsf/html"
+xmlns:f="http://java.sun.com/jsf/core">
+<head>
+ <title>OpenWebBeans :: Examples</title>
+</head>
+<body>
+
+ <div style="margin-top: 10px;">
+ <h3>Current Shopping Card Content</h3>
+ <h:dataTable cellpadding="1" cellspacing="5" value="#{selectedItems}" var="item">
+
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Product Name" />
+ </f:facet>
+ <h:outputText value="#{item.name}" />
+ </h:column>
+
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Product Price" />
+ </f:facet>
+ <h:outputText value="#{item.price}" />
+ </h:column>
+
+ </h:dataTable>
+ </div>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/ejb-sample/LICENSE b/owb_1.2.x/samples/ejb-sample/LICENSE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-sample/LICENSE
@@ -0,0 +1,201 @@
+ 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.
diff --git a/owb_1.2.x/samples/ejb-sample/NOTICE b/owb_1.2.x/samples/ejb-sample/NOTICE
new file mode 100644
index 0000000..f5a2e59
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-sample/NOTICE
@@ -0,0 +1,6 @@
+Apache OpenWebBeans
+Copyright 2008, 2010 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/owb_1.2.x/samples/ejb-sample/pom.xml b/owb_1.2.x/samples/ejb-sample/pom.xml
new file mode 100644
index 0000000..68fdaa1
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-sample/pom.xml
@@ -0,0 +1,195 @@
+<?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.
+-->
+<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">
+ <parent>
+ <artifactId>samples</artifactId>
+ <groupId>org.apache.openwebbeans</groupId>
+ <version>1.2.5</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.openwebbeans.samples</groupId>
+ <artifactId>ejb-sample</artifactId>
+ <packaging>war</packaging>
+ <name>Sample Ejb Demo On OpenEJB in Tomcat</name>
+ <description>Sample Ejb Demo</description>
+
+ <properties>
+ <deploy.skip>true</deploy.skip>
+ </properties>
+
+ <build>
+ <finalName>ejb-sample</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>tomcat-maven-plugin</artifactId>
+ <version>1.1</version>
+ <configuration>
+ <url>http://localhost:8080/manager</url>
+ </configuration>
+ </plugin>
+ </plugins>
+
+ </build>
+
+ <dependencies>
+
+ <!-- JSF Facelet -->
+ <dependency>
+ <groupId>com.sun.facelets</groupId>
+ <artifactId>jsf-facelets</artifactId>
+ <version>1.1.14</version>
+ </dependency>
+
+ <!-- JSR-299 Implementation -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <!-- JSR-299 API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- JSR-330 API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- SPI API -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- JSF Plugin -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-jsf12</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- EL Plugin -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-el10</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Web Plugin -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-web</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- MyFaces API -->
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>1.2.8</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Servlet API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_2.5_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- MyFaces IMPL -->
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <version>1.2.8</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- EJB API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-ejb_3.1_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- EJB PLugin-->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-ejb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- Resource PLugin-->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-resource</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Validator -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-validation_1.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Interceptor API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- JPA API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jpa_2.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/owb_1.2.x/samples/ejb-sample/src/main/java/org/apache/webbeans/sample/bean/EchoManaged.java b/owb_1.2.x/samples/ejb-sample/src/main/java/org/apache/webbeans/sample/bean/EchoManaged.java
new file mode 100644
index 0000000..b311d3a
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-sample/src/main/java/org/apache/webbeans/sample/bean/EchoManaged.java
@@ -0,0 +1,88 @@
+/*
+ * 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.webbeans.sample.bean;
+
+import javax.ejb.EJB;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.Bean;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.PersistenceUnit;
+
+import org.apache.webbeans.sample.ejb.Echo;
+import org.apache.webbeans.sample.injection.InjectionTargetBean;
+
+
+@RequestScoped
+@Named("echo")
+public class EchoManaged
+{
+ private @Inject @Default Echo echo;
+
+ private @Inject BeanManager manager;
+
+ private @EJB(name="EchoBean/org.apache.webbeans.sample.ejb.Echo") Echo nonContextual;
+
+ private String text;
+
+ private String name;
+
+ private @Produces @Default @PersistenceUnit(unitName="myDataBase") EntityManagerFactory emf;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String echo()
+ {
+ Bean<?> b = manager.getBeans("injected").iterator().next();
+ InjectionTargetBean bean = (InjectionTargetBean)manager.getReference(b, InjectionTargetBean.class, manager.createCreationalContext(b));
+
+ System.out.println("EMF --> " + bean.getFactory().equals(this.emf));
+
+ //Call for contextual
+ this.text = echo.echo(name);
+ //Call for noncontextual
+ this.nonContextual.echo(name);
+
+ return null;
+ }
+
+ public String getText()
+ {
+ return text;
+ }
+
+ public void setText(String text)
+ {
+ this.text = text;
+ }
+
+
+}
diff --git a/owb_1.2.x/samples/ejb-sample/src/main/java/org/apache/webbeans/sample/decorator/EchoDecorator.java b/owb_1.2.x/samples/ejb-sample/src/main/java/org/apache/webbeans/sample/decorator/EchoDecorator.java
new file mode 100644
index 0000000..5bc4731
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-sample/src/main/java/org/apache/webbeans/sample/decorator/EchoDecorator.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.sample.decorator;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+import org.apache.webbeans.sample.ejb.Echo;
+
+@Decorator
+public class EchoDecorator implements Echo
+{
+ private @Inject @Delegate Echo echo;
+
+ @Override
+ public String echo(String name)
+ {
+ System.out.println("Parameter is " + name);
+
+ return this.echo.echo(name);
+ }
+
+}
diff --git a/owb_1.2.x/samples/ejb-sample/src/main/java/org/apache/webbeans/sample/ejb/Echo.java b/owb_1.2.x/samples/ejb-sample/src/main/java/org/apache/webbeans/sample/ejb/Echo.java
new file mode 100644
index 0000000..ea21e2b
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-sample/src/main/java/org/apache/webbeans/sample/ejb/Echo.java
@@ -0,0 +1,27 @@
+/*
+ * 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.webbeans.sample.ejb;
+
+import javax.ejb.Local;
+
+@Local
+public interface Echo
+{
+ public String echo(String name);
+}
diff --git a/owb_1.2.x/samples/ejb-sample/src/main/java/org/apache/webbeans/sample/ejb/EchoBean.java b/owb_1.2.x/samples/ejb-sample/src/main/java/org/apache/webbeans/sample/ejb/EchoBean.java
new file mode 100644
index 0000000..7f0d388
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-sample/src/main/java/org/apache/webbeans/sample/ejb/EchoBean.java
@@ -0,0 +1,48 @@
+/*
+ * 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.webbeans.sample.ejb;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.ejb.Stateless;
+import javax.enterprise.context.Dependent;
+
+@Stateless
+@Dependent
+public class EchoBean implements Echo
+{
+ @Override
+ @LogInterceptorBinding
+ public String echo(String name)
+ {
+ return "Hello " + name;
+ }
+
+ @PostConstruct
+ public void postConstruct()
+ {
+ System.out.println("Post construct call in " + EchoBean.class.getName() + " via EJB interceptor");
+ }
+
+ @PreDestroy
+ public void preDestroy()
+ {
+ System.out.println("PreDestroy construct call in " + EchoBean.class.getName() + " via EJB interceptor");
+ }
+}
diff --git a/owb_1.2.x/samples/ejb-sample/src/main/java/org/apache/webbeans/sample/ejb/LogInterceptor.java b/owb_1.2.x/samples/ejb-sample/src/main/java/org/apache/webbeans/sample/ejb/LogInterceptor.java
new file mode 100644
index 0000000..fb374d0
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-sample/src/main/java/org/apache/webbeans/sample/ejb/LogInterceptor.java
@@ -0,0 +1,52 @@
+/*
+ * 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.webbeans.sample.ejb;
+
+import java.util.Date;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+@Interceptor @LogInterceptorBinding
+public class LogInterceptor
+{
+
+ @AroundInvoke
+ public Object log(InvocationContext context) throws Exception
+ {
+ System.out.println("Calling method : " + context.getMethod().getName() + " at time " + new Date());
+ return context.proceed();
+ }
+
+ @PostConstruct
+ public void postConstruct(InvocationContext context)
+ {
+ System.out.println("Post Construct with OWB interceptor");
+ }
+
+ @PreDestroy
+ public void preDestroy(InvocationContext context)
+ {
+ System.out.println("Pre Destroy with OWB interceptor");
+ }
+
+}
diff --git a/owb_1.2.x/samples/ejb-sample/src/main/java/org/apache/webbeans/sample/ejb/LogInterceptorBinding.java b/owb_1.2.x/samples/ejb-sample/src/main/java/org/apache/webbeans/sample/ejb/LogInterceptorBinding.java
new file mode 100644
index 0000000..0b0271e
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-sample/src/main/java/org/apache/webbeans/sample/ejb/LogInterceptorBinding.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.sample.ejb;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.interceptor.InterceptorBinding;
+
+@InterceptorBinding
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.TYPE, ElementType.METHOD })
+public @interface LogInterceptorBinding
+{
+
+}
\ No newline at end of file
diff --git a/owb_1.2.x/samples/ejb-sample/src/main/java/org/apache/webbeans/sample/injection/InjectionTargetBean.java b/owb_1.2.x/samples/ejb-sample/src/main/java/org/apache/webbeans/sample/injection/InjectionTargetBean.java
new file mode 100644
index 0000000..bbe3529
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-sample/src/main/java/org/apache/webbeans/sample/injection/InjectionTargetBean.java
@@ -0,0 +1,48 @@
+/*
+ * 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.webbeans.sample.injection;
+
+import javax.annotation.Resource;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Default;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.persistence.EntityManagerFactory;
+import javax.sql.DataSource;
+
+@RequestScoped
+@Named("injected")
+public class InjectionTargetBean
+{
+ @Inject @Default EntityManagerFactory emf;
+
+ @Resource(name="My DataSource") DataSource dataSource;
+
+ public InjectionTargetBean()
+ {
+
+ }
+
+ public EntityManagerFactory getFactory()
+ {
+ System.out.println("DataSource ds : " + dataSource);
+
+ return this.emf;
+ }
+}
diff --git a/owb_1.2.x/samples/ejb-sample/src/main/java/org/apache/webbeans/sample/util/FacesMessageUtil.java b/owb_1.2.x/samples/ejb-sample/src/main/java/org/apache/webbeans/sample/util/FacesMessageUtil.java
new file mode 100644
index 0000000..0c0be80
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-sample/src/main/java/org/apache/webbeans/sample/util/FacesMessageUtil.java
@@ -0,0 +1,41 @@
+/*
+ * 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.webbeans.sample.util;
+
+import javax.enterprise.context.Dependent;
+import javax.inject.Named;
+import javax.faces.application.FacesMessage;
+import javax.faces.application.FacesMessage.Severity;
+import javax.faces.context.FacesContext;
+
+@Named(value="facesMessage")
+@Dependent
+public class FacesMessageUtil
+{
+ public FacesMessageUtil()
+ {
+
+ }
+
+ public void addMessage(Severity severity,String summary, String detail)
+ {
+ FacesMessage message = new FacesMessage(severity,summary,detail);
+ FacesContext.getCurrentInstance().addMessage(null, message);
+ }
+}
diff --git a/owb_1.2.x/samples/ejb-sample/src/main/resources/META-INF/beans.xml b/owb_1.2.x/samples/ejb-sample/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000..8953836
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-sample/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,29 @@
+<?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.
+-->
+<beans>
+ <interceptors>
+ <class>org.apache.webbeans.sample.ejb.LogInterceptor</class>
+ </interceptors>
+
+ <decorators>
+ <class>org.apache.webbeans.sample.decorator.EchoDecorator</class>
+ </decorators>
+
+</beans>
diff --git a/owb_1.2.x/samples/ejb-sample/src/main/resources/META-INF/openwebbeans/openwebbeans.properties b/owb_1.2.x/samples/ejb-sample/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
new file mode 100644
index 0000000..f33553a
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-sample/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
@@ -0,0 +1,35 @@
+#Licensed to the Apache Software Foundation (ASF) under one
+#or more contributor license agreements. See the NOTICE file
+#distributed with this work for additional information
+#regarding copyright ownership. The ASF licenses this file
+#to you under the Apache License, Version 2.0 (the
+#"License"); you may not use this file except in compliance
+#with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+#Unless required by applicable law or agreed to in writing,
+#software distributed under the License is distributed on an
+#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#KIND, either express or implied. See the License for the
+#specific language governing permissions and limitations
+#under the License.
+#---------------------------------------------------------------
+# The default configuration for OpenWebBeans
+#
+# The default configuration is intended for a JDK and a simple ServletContainer
+# like jetty, resin or tomcat.
+#
+#---------------------------------------------------------------
+
+#general configuration section
+
+#use embedded openejb metadata discovery
+org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService=true
+
+#use resource service
+org.apache.webbeans.spi.ResourceInjectionService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService
+
+org.apache.webbeans.spi.adaptor.ELAdaptor=org.apache.webbeans.el10.EL10Adaptor
+
+org.apache.webbeans.spi.JNDIService=org.apache.webbeans.corespi.se.DefaultJndiService
diff --git a/owb_1.2.x/samples/ejb-sample/src/main/resources/META-INF/persistence.xml b/owb_1.2.x/samples/ejb-sample/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..bbae3d5
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-sample/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,35 @@
+<?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.
+-->
+
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+ version="1.0">
+
+ <persistence-unit name="myDataBase" transaction-type="RESOURCE_LOCAL">
+ <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+
+ <properties>
+ <property name="openjpa.jdbc.DBDictionary" value="hsql" />
+ <property name="openjpa.ConnectionDriverName" value="org.hsqldb.jdbcDriver" />
+ <property name="openjpa.ConnectionURL" value="jdbc:hsqldb:mem:test" />
+ <property name="openjpa.ConnectionUserName" value="sa" />
+ <property name="openjpa.ConnectionPassword" value="" />
+ </properties>
+
+ </persistence-unit>
+</persistence>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/ejb-sample/src/main/webapp/WEB-INF/beans.xml b/owb_1.2.x/samples/ejb-sample/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 0000000..4f2dd7e
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-sample/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,30 @@
+<?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.
+-->
+<WebBeans xmlns="urn:java:ee"
+ xmlns:myapp="urn:java:org.apache.webbeans.sample.bindings"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:java:ee http://java.sun.com/jee/beans-1.0.xsd">
+
+ <Deploy>
+ <Standard/>
+ <Production/>
+ </Deploy>
+
+</WebBeans>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/ejb-sample/src/main/webapp/WEB-INF/faces-config.xml b/owb_1.2.x/samples/ejb-sample/src/main/webapp/WEB-INF/faces-config.xml
new file mode 100644
index 0000000..3aabb64
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-sample/src/main/webapp/WEB-INF/faces-config.xml
@@ -0,0 +1,32 @@
+<?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.
+-->
+
+<faces-config
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
+ version="1.2">
+
+ <application>
+ <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
+ </application>
+
+
+</faces-config>
diff --git a/owb_1.2.x/samples/ejb-sample/src/main/webapp/WEB-INF/web.xml b/owb_1.2.x/samples/ejb-sample/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..500950a
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-sample/src/main/webapp/WEB-INF/web.xml
@@ -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.
+-->
+<web-app id="WebApp_ID" version="2.5"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+ <display-name>ejb-sample</display-name>
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+ <listener>
+ <listener-class>org.apache.webbeans.servlet.WebBeansConfigurationListener</listener-class>
+ </listener>
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ </welcome-file-list>
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ </login-config>
+ <ejb-local-ref>
+ <ejb-ref-name>Echo</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <local>org.apache.webbeans.sample.ejb.Echo</local>
+ </ejb-local-ref>
+</web-app>
diff --git a/owb_1.2.x/samples/ejb-sample/src/main/webapp/echo.xhtml b/owb_1.2.x/samples/ejb-sample/src/main/webapp/echo.xhtml
new file mode 100644
index 0000000..14ff5c9
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-sample/src/main/webapp/echo.xhtml
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+
+ 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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<head>
+ <title>OpenWebBeans :: Examples :: EJB Sample</title>
+</head>
+
+<body>
+
+ <div id="container">
+ <div id="content">
+ <h:messages globalOnly="false" showSummary="true" infoStyle="font-weight:bold;"></h:messages>
+
+ <h:form id="form">
+
+ <div style="border:1px solid black;margin: 25px 75px;">
+
+ <h:panelGrid columns="2">
+
+ <h:outputLabel for="text">
+ <h:outputText value="Your Name : "></h:outputText>
+ </h:outputLabel>
+ <h:inputText id="text" value="#{echo.name}" required="true" requiredMessage="Please give a name!"></h:inputText>
+
+ <h:commandButton action="#{echo.echo}" value="Echo..."></h:commandButton>
+
+ <f:verbatim/>
+ <h:outputText value="#{echo.text}"></h:outputText>
+
+ </h:panelGrid>
+ </div>
+ </h:form>
+ </div>
+
+ </div>
+</body>
+</html>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/ejb-sample/src/main/webapp/index.html b/owb_1.2.x/samples/ejb-sample/src/main/webapp/index.html
new file mode 100644
index 0000000..27b8b1a
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-sample/src/main/webapp/index.html
@@ -0,0 +1,21 @@
+<html>
+<!--
+
+ 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.
+-->
+<head>
+ <meta http-equiv="Refresh" content="0; URL=echo.jsf">
+</head>
+</html>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/ejb-telephone/LICENSE b/owb_1.2.x/samples/ejb-telephone/LICENSE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-telephone/LICENSE
@@ -0,0 +1,201 @@
+ 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.
diff --git a/owb_1.2.x/samples/ejb-telephone/NOTICE b/owb_1.2.x/samples/ejb-telephone/NOTICE
new file mode 100644
index 0000000..f5a2e59
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-telephone/NOTICE
@@ -0,0 +1,6 @@
+Apache OpenWebBeans
+Copyright 2008, 2010 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/owb_1.2.x/samples/ejb-telephone/pom.xml b/owb_1.2.x/samples/ejb-telephone/pom.xml
new file mode 100644
index 0000000..1d97bf8
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-telephone/pom.xml
@@ -0,0 +1,184 @@
+<?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.
+-->
+<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">
+ <parent>
+ <artifactId>samples</artifactId>
+ <groupId>org.apache.openwebbeans</groupId>
+ <version>1.2.5</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.openwebbeans.samples</groupId>
+ <artifactId>ejb-telephone</artifactId>
+ <packaging>war</packaging>
+ <name>Telephone Ejb Demo On OpenEJB in Tomcat</name>
+ <description>Telephone Ejb Demo</description>
+
+ <properties>
+ <deploy.skip>true</deploy.skip>
+ </properties>
+
+ <build>
+ <finalName>ejb-telephone</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>tomcat-maven-plugin</artifactId>
+ <version>1.1</version>
+ <configuration>
+ <url>http://localhost:8080/manager</url>
+ </configuration>
+ </plugin>
+ </plugins>
+
+ </build>
+
+ <dependencies>
+
+ <!-- JSF Facelet -->
+ <dependency>
+ <groupId>com.sun.facelets</groupId>
+ <artifactId>jsf-facelets</artifactId>
+ <version>1.1.14</version>
+ </dependency>
+
+ <!-- JSR-299 Implementation -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <!-- JSR-299 API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- JSR-330 API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- SPI API -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- JSF Plugin -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-jsf12</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- EL Plugin -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-el10</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- Web Plugin -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-web</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- MyFaces API -->
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>1.2.8</version>
+ </dependency>
+
+ <!-- Servlet API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_2.5_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- MyFaces IMPL -->
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <version>1.2.8</version>
+ </dependency>
+
+ <!-- EJB API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-ejb_3.1_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- EJB PLugin-->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-ejb</artifactId>
+ </dependency>
+
+ <!-- Resource PLugin-->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-resource</artifactId>
+ </dependency>
+
+ <!-- Interceptor API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- JPA API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jpa_2.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Validator -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-validation_1.0_spec</artifactId>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/owb_1.2.x/samples/ejb-telephone/src/main/java/org/apache/webbeans/telephone/OperationBean.java b/owb_1.2.x/samples/ejb-telephone/src/main/java/org/apache/webbeans/telephone/OperationBean.java
new file mode 100644
index 0000000..e350d73
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-telephone/src/main/java/org/apache/webbeans/telephone/OperationBean.java
@@ -0,0 +1,167 @@
+/*
+ * 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.webbeans.telephone;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.enterprise.context.RequestScoped;
+import javax.faces.application.FacesMessage;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.webbeans.telephone.ejbs.Telephone;
+import org.apache.webbeans.telephone.entity.Record;
+import org.apache.webbeans.telephone.util.FacesMessageUtil;
+
+@Named("operation")
+@RequestScoped
+public class OperationBean
+{
+ private @Inject Telephone operation;
+
+ private @Inject FacesMessageUtil messageUtil;
+
+ private String name;
+
+ private String surname;
+
+ private String telephone;
+
+ private boolean business;
+
+ private List<Record> records = new ArrayList<Record>();
+
+ public OperationBean()
+ {
+
+ }
+
+ @PostConstruct
+ public void afterConstruct()
+ {
+ System.out.println("After instance creation!");
+ }
+
+ @PreDestroy
+ public void beforeDestroy()
+ {
+ System.out.println("Before instance destroy!");
+ }
+
+ public String addRecord()
+ {
+ this.operation.addRecord(name, surname, telephone, business);
+
+ this.messageUtil.addMessage(FacesMessage.SEVERITY_INFO, "Record added", "Record added");
+
+ return null;
+ }
+
+ public String showList()
+ {
+ this.records = this.operation.getRecords();
+
+ return null;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * @return the surname
+ */
+ public String getSurname()
+ {
+ return surname;
+ }
+
+ /**
+ * @param surname the surname to set
+ */
+ public void setSurname(String surname)
+ {
+ this.surname = surname;
+ }
+
+ /**
+ * @return the telephone
+ */
+ public String getTelephone()
+ {
+ return telephone;
+ }
+
+ /**
+ * @param telephone the telephone to set
+ */
+ public void setTelephone(String telephone)
+ {
+ this.telephone = telephone;
+ }
+
+ /**
+ * @return the business
+ */
+ public boolean isBusiness()
+ {
+ return business;
+ }
+
+ /**
+ * @param business the business to set
+ */
+ public void setBusiness(boolean business)
+ {
+ this.business = business;
+ }
+
+ /**
+ * @return the records
+ */
+ public List<Record> getRecords()
+ {
+ return records;
+ }
+
+ /**
+ * @param records the records to set
+ */
+ public void setRecords(List<Record> records)
+ {
+ this.records = records;
+ }
+
+
+}
diff --git a/owb_1.2.x/samples/ejb-telephone/src/main/java/org/apache/webbeans/telephone/ejbs/Telephone.java b/owb_1.2.x/samples/ejb-telephone/src/main/java/org/apache/webbeans/telephone/ejbs/Telephone.java
new file mode 100644
index 0000000..caecdab
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-telephone/src/main/java/org/apache/webbeans/telephone/ejbs/Telephone.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.telephone.ejbs;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.apache.webbeans.telephone.entity.Record;
+
+@Local
+public interface Telephone
+{
+ public Record addRecord(String name, String surname, String telephone, boolean business);
+
+ public List<Record> getRecords();
+}
diff --git a/owb_1.2.x/samples/ejb-telephone/src/main/java/org/apache/webbeans/telephone/ejbs/TelephoneBean.java b/owb_1.2.x/samples/ejb-telephone/src/main/java/org/apache/webbeans/telephone/ejbs/TelephoneBean.java
new file mode 100644
index 0000000..442a183
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-telephone/src/main/java/org/apache/webbeans/telephone/ejbs/TelephoneBean.java
@@ -0,0 +1,63 @@
+/*
+ * 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.webbeans.telephone.ejbs;
+
+import java.util.List;
+
+import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.enterprise.context.Dependent;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+
+import org.apache.webbeans.telephone.entity.Record;
+
+@Stateless
+@Dependent
+public class TelephoneBean implements Telephone
+{
+ private @PersistenceContext(name="pu") EntityManager entityManager;
+
+ @Override
+ public Record addRecord(String name, String surname, String telephone, boolean business)
+ {
+ Record record = new Record();
+ record.setName(name);
+ record.setSurname(surname);
+ record.setNumber(telephone);
+ record.setBusiness(business);
+
+ entityManager.persist(record);
+
+ return record;
+ }
+
+ @Override
+ @TransactionAttribute(TransactionAttributeType.SUPPORTS)
+ @SuppressWarnings("unchecked")
+ public List<Record> getRecords()
+ {
+ Query query = this.entityManager.createQuery("select c from Record c");
+ return (List<Record>)query.getResultList();
+
+ }
+
+}
diff --git a/owb_1.2.x/samples/ejb-telephone/src/main/java/org/apache/webbeans/telephone/entity/Record.java b/owb_1.2.x/samples/ejb-telephone/src/main/java/org/apache/webbeans/telephone/entity/Record.java
new file mode 100644
index 0000000..c5cc2e0
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-telephone/src/main/java/org/apache/webbeans/telephone/entity/Record.java
@@ -0,0 +1,131 @@
+/*
+ * 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.webbeans.telephone.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+@Entity
+public class Record
+{
+ @Id
+ @GeneratedValue
+ private int id;
+
+ @Column
+ private String name;
+
+ @Column
+ private String surname;
+
+ @Column
+ private String number;
+
+ @Column
+ private boolean business;
+
+ public Record()
+ {
+
+ }
+
+ /**
+ * @return the id
+ */
+ public int getId()
+ {
+ return id;
+ }
+
+ /**
+ * @param id the id to set
+ */
+ public void setId(int id)
+ {
+ this.id = id;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * @return the surname
+ */
+ public String getSurname()
+ {
+ return surname;
+ }
+
+ /**
+ * @param surname the surname to set
+ */
+ public void setSurname(String surname)
+ {
+ this.surname = surname;
+ }
+
+ /**
+ * @return the number
+ */
+ public String getNumber()
+ {
+ return number;
+ }
+
+ /**
+ * @param number the number to set
+ */
+ public void setNumber(String number)
+ {
+ this.number = number;
+ }
+
+ /**
+ * @return the business
+ */
+ public boolean isBusiness()
+ {
+ return business;
+ }
+
+ /**
+ * @param business the business to set
+ */
+ public void setBusiness(boolean business)
+ {
+ this.business = business;
+ }
+
+
+}
diff --git a/owb_1.2.x/samples/ejb-telephone/src/main/java/org/apache/webbeans/telephone/util/FacesMessageUtil.java b/owb_1.2.x/samples/ejb-telephone/src/main/java/org/apache/webbeans/telephone/util/FacesMessageUtil.java
new file mode 100644
index 0000000..fdf86a9
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-telephone/src/main/java/org/apache/webbeans/telephone/util/FacesMessageUtil.java
@@ -0,0 +1,42 @@
+/*
+ * 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.webbeans.telephone.util;
+
+import javax.enterprise.context.Dependent;
+import javax.inject.Named;
+import javax.faces.application.FacesMessage;
+import javax.faces.application.FacesMessage.Severity;
+import javax.faces.context.FacesContext;
+
+@Named(value="facesMessage")
+@Dependent
+public class FacesMessageUtil
+{
+
+ public FacesMessageUtil()
+ {
+
+ }
+
+ public void addMessage(Severity severity,String summary, String detail)
+ {
+ FacesMessage message = new FacesMessage(severity,summary,detail);
+ FacesContext.getCurrentInstance().addMessage(null, message);
+ }
+}
diff --git a/owb_1.2.x/samples/ejb-telephone/src/main/resources/META-INF/beans.xml b/owb_1.2.x/samples/ejb-telephone/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000..85b6e63
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-telephone/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+<beans/>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/ejb-telephone/src/main/resources/META-INF/openwebbeans/openwebbeans.properties b/owb_1.2.x/samples/ejb-telephone/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
new file mode 100644
index 0000000..d054c75
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-telephone/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
@@ -0,0 +1,31 @@
+#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.
+#---------------------------------------------------------------
+# The default configuration for OpenWebBeans
+#
+# The default configuration is intended for a JDK and a simple ServletContainer
+# like jetty, resin or tomcat.
+#
+#---------------------------------------------------------------
+
+#use embedded openejb metadata discovery
+org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService=true
+
+#use resource service
+org.apache.webbeans.spi.ResourceService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService
+org.apache.webbeans.spi.adaptor.ELAdaptor=org.apache.webbeans.el10.EL10Adaptor
+org.apache.webbeans.spi.JNDIService=org.apache.webbeans.corespi.se.DefaultJndiService
diff --git a/owb_1.2.x/samples/ejb-telephone/src/main/resources/META-INF/persistence.xml b/owb_1.2.x/samples/ejb-telephone/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..23b254c
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-telephone/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,35 @@
+<?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.
+-->
+
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+ version="1.0">
+
+ <persistence-unit name="pu" transaction-type="JTA">
+
+ <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+ <jta-data-source>My DataSource</jta-data-source>
+ <class>org.apache.webbeans.telephone.entity.Record</class>
+
+ <properties>
+ <property name="openjpa.Log" value="DefaultLevel=TRACE"/>
+ <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+ </properties>
+
+ </persistence-unit>
+</persistence>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/ejb-telephone/src/main/webapp/META-INF/MANIFEST.MF b/owb_1.2.x/samples/ejb-telephone/src/main/webapp/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..254272e
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-telephone/src/main/webapp/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
diff --git a/owb_1.2.x/samples/ejb-telephone/src/main/webapp/WEB-INF/beans.xml b/owb_1.2.x/samples/ejb-telephone/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 0000000..85b6e63
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-telephone/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+<beans/>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/ejb-telephone/src/main/webapp/WEB-INF/faces-config.xml b/owb_1.2.x/samples/ejb-telephone/src/main/webapp/WEB-INF/faces-config.xml
new file mode 100644
index 0000000..3aabb64
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-telephone/src/main/webapp/WEB-INF/faces-config.xml
@@ -0,0 +1,32 @@
+<?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.
+-->
+
+<faces-config
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
+ version="1.2">
+
+ <application>
+ <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
+ </application>
+
+
+</faces-config>
diff --git a/owb_1.2.x/samples/ejb-telephone/src/main/webapp/WEB-INF/web.xml b/owb_1.2.x/samples/ejb-telephone/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..937eb37
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-telephone/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,46 @@
+<?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.
+-->
+<web-app id="WebApp_ID" version="2.5"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+ <display-name>telephone</display-name>
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+ <listener>
+ <listener-class>org.apache.webbeans.servlet.WebBeansConfigurationListener</listener-class>
+ </listener>
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ </welcome-file-list>
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ </login-config>
+</web-app>
diff --git a/owb_1.2.x/samples/ejb-telephone/src/main/webapp/contact.xhtml b/owb_1.2.x/samples/ejb-telephone/src/main/webapp/contact.xhtml
new file mode 100644
index 0000000..683cd63
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-telephone/src/main/webapp/contact.xhtml
@@ -0,0 +1,116 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+
+ 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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<head>
+ <title>OpenWebBeans :: Examples :: Telephone EJB Sample</title>
+</head>
+
+<body>
+
+ <div id="container">
+ <div id="content">
+ <h:messages globalOnly="false" showSummary="true" infoStyle="font-weight:bold;color:red;"></h:messages>
+
+ <h3>OpenEJB, Tomcat and OpenWebBeans Telephone Directory Sample</h3>
+
+ <h:form id="form">
+
+ <div style="border:1px solid black;margin: 25px 75px;">
+
+ <h:panelGrid columns="2">
+
+ <h:outputLabel for="text">
+ <h:outputText value="Name : "></h:outputText>
+ </h:outputLabel>
+ <h:inputText id="text" value="#{operation.name}" required="true" requiredMessage="Please give a name!"></h:inputText>
+
+ <h:outputLabel for="surname">
+ <h:outputText value="Surname : "></h:outputText>
+ </h:outputLabel>
+ <h:inputText id="surname" value="#{operation.surname}" required="true" requiredMessage="Please give a surname!"></h:inputText>
+
+ <h:outputLabel for="telephone">
+ <h:outputText value="Telephone : "></h:outputText>
+ </h:outputLabel>
+ <h:inputText id="telephone" value="#{operation.telephone}" required="true" requiredMessage="Please give a telephone!"></h:inputText>
+
+ <h:outputLabel for="chk">
+ <h:outputText value="Business Telephone : "></h:outputText>
+ </h:outputLabel>
+ <h:selectBooleanCheckbox value="#{operation.business}" />
+
+ <h:commandButton action="#{operation.addRecord}" value="Add New Record"></h:commandButton>
+ <h:commandButton action="#{operation.showList}" value="Show All Records"></h:commandButton>
+
+ </h:panelGrid>
+ </div>
+
+ <div>
+ <h3>Telephone Lists</h3>
+ <h:dataTable value="#{operation.records}" var="record" cellspacing="5">
+
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Record Id" />
+ </f:facet>
+ <h:outputText value="#{record.id}" />
+ </h:column>
+
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Name" />
+ </f:facet>
+ <h:outputText value="#{record.name}" />
+ </h:column>
+
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Surname" />
+ </f:facet>
+ <h:outputText value="#{record.surname}" />
+ </h:column>
+
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Telephone" />
+ </f:facet>
+ <h:outputText value="#{record.number}" />
+ </h:column>
+
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Business" />
+ </f:facet>
+ <h:selectBooleanCheckbox value="#{record.business}" />
+ </h:column>
+
+
+ </h:dataTable>
+
+ </div>
+
+ </h:form>
+ </div>
+
+ </div>
+</body>
+</html>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/ejb-telephone/src/main/webapp/index.html b/owb_1.2.x/samples/ejb-telephone/src/main/webapp/index.html
new file mode 100644
index 0000000..f736c92
--- /dev/null
+++ b/owb_1.2.x/samples/ejb-telephone/src/main/webapp/index.html
@@ -0,0 +1,21 @@
+<html>
+<!--
+
+ 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.
+-->
+<head>
+ <meta http-equiv="Refresh" content="0; URL=contact.jsf">
+</head>
+</html>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/guess/LICENSE b/owb_1.2.x/samples/guess/LICENSE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/owb_1.2.x/samples/guess/LICENSE
@@ -0,0 +1,201 @@
+ 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.
diff --git a/owb_1.2.x/samples/guess/NOTICE b/owb_1.2.x/samples/guess/NOTICE
new file mode 100644
index 0000000..f5a2e59
--- /dev/null
+++ b/owb_1.2.x/samples/guess/NOTICE
@@ -0,0 +1,6 @@
+Apache OpenWebBeans
+Copyright 2008, 2010 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/owb_1.2.x/samples/guess/pom.xml b/owb_1.2.x/samples/guess/pom.xml
new file mode 100644
index 0000000..9ec5aa9
--- /dev/null
+++ b/owb_1.2.x/samples/guess/pom.xml
@@ -0,0 +1,136 @@
+<?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.
+-->
+<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">
+ <parent>
+ <artifactId>samples</artifactId>
+ <groupId>org.apache.openwebbeans</groupId>
+ <version>1.2.5</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.openwebbeans.samples</groupId>
+ <artifactId>guess</artifactId>
+ <packaging>war</packaging>
+ <name>Sample Guess Application</name>
+ <description>Simple login application</description>
+
+ <properties>
+ <deploy.skip>true</deploy.skip>
+ </properties>
+
+ <build>
+ <finalName>guess</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <version>6.1.18</version>
+ <configuration>
+ <scanIntervalSeconds>10</scanIntervalSeconds>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+
+ <!-- JSF Facelet -->
+ <dependency>
+ <groupId>com.sun.facelets</groupId>
+ <artifactId>jsf-facelets</artifactId>
+ <version>1.1.14</version>
+ </dependency>
+
+ <!-- MyFaces API -->
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>1.2.8</version>
+ </dependency>
+
+ <!-- JSF Plugin -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-jsf12</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- EL Plugin -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-el10</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- Servlet API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_2.5_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- JSR-299 implementation per application -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ </dependency>
+
+ <!-- Web Plugin -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-web</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- JSR-299 API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ </dependency>
+
+ <!-- JSR-330 API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ </dependency>
+
+ <!-- SPI API -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ </dependency>
+
+ <!-- Interceptor API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+ </dependency>
+
+ <!-- MyFaces IMPL -->
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <version>1.2.8</version>
+ </dependency>
+
+
+ </dependencies>
+</project>
diff --git a/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/bean/AppObject.java b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/bean/AppObject.java
new file mode 100644
index 0000000..d24af70
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/bean/AppObject.java
@@ -0,0 +1,28 @@
+/*
+ * 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.webbeans.sample.bean;
+
+public class AppObject
+{
+ public boolean config = false;
+ public AppObject()
+ {
+ config = true;
+ }
+}
diff --git a/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/bean/ApplicationScopeProducer.java b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/bean/ApplicationScopeProducer.java
new file mode 100644
index 0000000..c40d07e
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/bean/ApplicationScopeProducer.java
@@ -0,0 +1,46 @@
+/*
+ * 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.webbeans.sample.bean;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+import org.apache.webbeans.sample.bindings.AppScopeBinding;
+
+public class ApplicationScopeProducer
+{
+
+ @AppScopeBinding
+ @Produces
+ @ApplicationScoped
+ @Named
+ public AppObject newObject()
+ {
+ AppObject object = new AppObject();
+ System.out.println("Creating AppObject : " + object.toString());
+ return object;
+ }
+
+ public void dispose(@Disposes @AppScopeBinding AppObject object)
+ {
+ System.out.println("Disposing AppObject : " + object.toString());
+ }
+}
diff --git a/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/bean/LoginBean.java b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/bean/LoginBean.java
new file mode 100644
index 0000000..53b90d2
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/bean/LoginBean.java
@@ -0,0 +1,128 @@
+/*
+ * 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.webbeans.sample.bean;
+
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Default;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.enterprise.inject.Produces;
+import javax.faces.application.FacesMessage;
+
+import org.apache.webbeans.sample.bindings.AppScopeBinding;
+import org.apache.webbeans.sample.bindings.LoggedInUser;
+import org.apache.webbeans.sample.dependent.LoginCheck;
+import org.apache.webbeans.sample.event.LoggedInEvent;
+import org.apache.webbeans.sample.model.User;
+import org.apache.webbeans.sample.util.FacesMessageUtil;
+
+@RequestScoped
+@Named
+public class LoginBean
+{
+ private User user = null;
+
+ private String userName;
+
+ private String password;
+
+ private @Inject @Default LoginCheck loginCheck;
+
+ private @Inject @Default FacesMessageUtil messageUtil;
+
+ private @Inject @Any Event<LoggedInEvent> event;
+
+ private @Inject @AppScopeBinding AppObject applicationScopedString;
+
+ public LoginBean()
+ {
+
+ }
+
+ public String login()
+ {
+ if(loginCheck.checkLogin(this.userName, this.password))
+ {
+ user = new User();
+ user.setUserName(this.userName);
+ user.setPassword(this.password);
+
+ event.fire(new LoggedInEvent(this.user));
+
+ return "loginSuccess";
+ }
+ else
+ {
+ messageUtil.addMessage(FacesMessage.SEVERITY_ERROR, "Login Failed", "Login failed");
+ return null;
+ }
+ }
+
+ public void afterLoggedIn(@Observes LoggedInEvent event)
+ {
+ messageUtil.addMessage(FacesMessage.SEVERITY_INFO, "Login Successfull", "Login Successfull");
+ System.out.println("Application scoped string : " + applicationScopedString);
+ }
+
+
+ @Produces @SessionScoped @LoggedInUser @Named(value="currentUser")
+ public User getLoggedInUser()
+ {
+ return this.user;
+ }
+
+ /**
+ * @return the userName
+ */
+ public String getUserName()
+ {
+ return userName;
+ }
+
+ /**
+ * @param userName the userName to set
+ */
+ public void setUserName(String userName)
+ {
+ this.userName = userName;
+ }
+
+ /**
+ * @return the password
+ */
+ public String getPassword()
+ {
+ return password;
+ }
+
+ /**
+ * @param password the password to set
+ */
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
+
+
+}
diff --git a/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/bean/LogoutBean.java b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/bean/LogoutBean.java
new file mode 100644
index 0000000..b2ad638
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/bean/LogoutBean.java
@@ -0,0 +1,48 @@
+/*
+ * 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.webbeans.sample.bean;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpSession;
+
+import org.apache.webbeans.sample.bindings.LoggedInUser;
+import org.apache.webbeans.sample.model.User;
+
+@Named
+public class LogoutBean
+{
+ private @Inject @LoggedInUser User user;
+
+ public LogoutBean()
+ {
+
+ }
+
+ public String logout()
+ {
+ System.out.println("Logged out User : " + user.getUserName());
+
+ HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(true);
+ session.invalidate();
+
+ return "login";
+ }
+}
diff --git a/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/bindings/AppScopeBinding.java b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/bindings/AppScopeBinding.java
new file mode 100644
index 0000000..a79799c
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/bindings/AppScopeBinding.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.sample.bindings;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.FIELD,ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER})
+public @interface AppScopeBinding
+{
+
+}
diff --git a/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/bindings/JmsBinding.java b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/bindings/JmsBinding.java
new file mode 100644
index 0000000..fabbdd2
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/bindings/JmsBinding.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.sample.bindings;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.FIELD,ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER})
+public @interface JmsBinding
+{
+
+}
diff --git a/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/bindings/LoggedInUser.java b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/bindings/LoggedInUser.java
new file mode 100644
index 0000000..ce12a14
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/bindings/LoggedInUser.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.sample.bindings;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.FIELD,ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER})
+public @interface LoggedInUser
+{
+
+}
diff --git a/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/conversation/ShoppingCardBean.java b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/conversation/ShoppingCardBean.java
new file mode 100644
index 0000000..b994622
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/conversation/ShoppingCardBean.java
@@ -0,0 +1,112 @@
+/*
+ * 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.webbeans.sample.conversation;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.Conversation;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Default;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.faces.application.FacesMessage;
+
+import org.apache.webbeans.sample.model.conversation.ConversationModel;
+import org.apache.webbeans.sample.util.FacesMessageUtil;
+
+@RequestScoped
+@Named
+public class ShoppingCardBean implements Serializable
+{
+ private static final long serialVersionUID = 7914095399647910625L;
+
+ private @Inject @Default Conversation conversation;
+
+ private @Inject @Default ConversationModel model;
+
+ private @Inject @Default FacesMessageUtil messageUtil;
+
+ private String book;
+
+ public String startConversation()
+ {
+ conversation.begin();
+
+ messageUtil.addMessage(FacesMessage.SEVERITY_INFO, "Conversation with id : " + conversation.getId() + " is started", null);
+
+ return null;
+ }
+
+ public String addNewBook()
+ {
+ model.getList().add(this.book);
+
+ StringBuffer buffer = new StringBuffer("Your shopping card contents : [");
+
+ for(String b : model.getList())
+ {
+ buffer.append("," + b);
+ }
+
+ messageUtil.addMessage(FacesMessage.SEVERITY_INFO, buffer.toString() + "]", null);
+
+
+ return null;
+ }
+
+ public String getBooks()
+ {
+ StringBuffer buffer = new StringBuffer("Your shopping card contents : [");
+
+ for(String b : model.getList())
+ {
+ buffer.append("," + b);
+ }
+
+ return buffer.toString();
+
+ }
+
+ public String endConversation()
+ {
+ messageUtil.addMessage(FacesMessage.SEVERITY_INFO, "Conversation with id : " + conversation.getId() + " is ended", null);
+
+ conversation.end();
+
+ return null;
+ }
+
+ /**
+ * @return the book
+ */
+ public String getBook()
+ {
+ return book;
+ }
+
+ /**
+ * @param book the book to set
+ */
+ public void setBook(String book)
+ {
+ this.book = book;
+ }
+
+
+}
diff --git a/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/dependent/LoginCheck.java b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/dependent/LoginCheck.java
new file mode 100644
index 0000000..5c1ba05
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/dependent/LoginCheck.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.sample.dependent;
+
+import javax.enterprise.context.Dependent;
+
+
+@Dependent
+public class LoginCheck
+{
+
+ public boolean checkLogin(String userName, String password)
+ {
+ if(userName.equals("admin") && password.equals("admin"))
+ {
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/event/LoggedInEvent.java b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/event/LoggedInEvent.java
new file mode 100644
index 0000000..94fd070
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/event/LoggedInEvent.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.sample.event;
+
+import org.apache.webbeans.sample.model.User;
+
+public class LoggedInEvent
+{
+ private User user;
+
+ public LoggedInEvent(User user)
+ {
+ this.user = user;
+ }
+
+ public User getUser()
+ {
+ return this.user;
+ }
+}
diff --git a/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/guess/Highest.java b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/guess/Highest.java
new file mode 100644
index 0000000..b35a624
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/guess/Highest.java
@@ -0,0 +1,42 @@
+/*
+ * 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.webbeans.sample.guess;
+
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+public @interface Highest
+{
+
+}
diff --git a/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/guess/JSFNumberGuess.java b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/guess/JSFNumberGuess.java
new file mode 100644
index 0000000..6ac6b43
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/guess/JSFNumberGuess.java
@@ -0,0 +1,242 @@
+/*
+ * 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.webbeans.sample.guess;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.Default;
+import javax.inject.Named;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+import javax.inject.Inject;
+
+@Named(value = "game")
+@SessionScoped
+public class JSFNumberGuess implements Serializable
+{
+ private static final long serialVersionUID = 2264057893898002872L;
+
+ private int no;
+ private boolean correct = false;
+ private int guess = 1;
+ private int smallRange;
+ private int maxRange;
+ private int remainder;
+ private @Inject @Default BeanManager manager;
+
+ public JSFNumberGuess()
+ {
+
+ }
+
+ @Inject
+ public JSFNumberGuess(@NextNumber Integer number, @Highest Integer maxNumber)
+ {
+ this.no = number;
+ this.smallRange = 1;
+ this.maxRange = maxNumber;
+ this.remainder = 10;
+ }
+
+ public String clear()
+ {
+ Annotation[] anns = new Annotation[1];
+ anns[0] = new AnnotationLiteral<NextNumber>()
+ {
+ };
+
+ Annotation[] anns2 = new Annotation[1];
+ anns2[0] = new AnnotationLiteral<Highest>()
+ {
+ };
+
+ Set<Bean<?>> beans = manager.getBeans(Integer.class, anns);
+ Bean<?> bean = beans.iterator().next();
+ this.no = (Integer)manager.getReference(bean, null, manager.createCreationalContext(bean));
+ //this.no = manager.getInstanceByType(Integer.class, anns);
+ setSmallRange(1);
+ beans = manager.getBeans(Integer.class, anns2);
+ bean = beans.iterator().next();
+ setMaxRange((Integer)manager.getReference(bean, null, manager.createCreationalContext(bean)));
+ //setMaxRange(manager.getInstanceByType(Integer.class, anns2));
+ setRemainder(10);
+ setGuess(1);
+ setCorrect(false);
+
+ return null;
+ }
+
+ public String checkNumber()
+ {
+ if (correct)
+ {
+ FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Game is over! Please restart the game..."));
+ return null;
+ }
+
+ if (guess > no)
+ {
+ maxRange = guess - 1;
+ }
+ if (guess < no)
+ {
+ smallRange = guess + 1;
+ }
+ if (guess == no)
+ {
+ correct = true;
+ FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Correct! Please restart the game..."));
+
+ return null;
+ }
+
+ if (remainder == 0)
+ {
+ FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Game is over! Please restart the game..."));
+ this.correct = false;
+
+ return null;
+ }
+ else
+ {
+ remainder-=1;
+ }
+
+ return null;
+ }
+
+ /**
+ * @return the no
+ */
+ public int getNo()
+ {
+ return no;
+ }
+
+ /**
+ * @param no the no to set
+ */
+ public void setNo(int no)
+ {
+ this.no = no;
+ }
+
+ /**
+ * @return the correct
+ */
+ public boolean isCorrect()
+ {
+ return correct;
+ }
+
+ /**
+ * @param correct the correct to set
+ */
+ public void setCorrect(boolean correct)
+ {
+ this.correct = correct;
+ }
+
+ /**
+ * @return the guess
+ */
+ public int getGuess()
+ {
+ return guess;
+ }
+
+ /**
+ * @param guess the guess to set
+ */
+ public void setGuess(int guess)
+ {
+ this.guess = guess;
+ }
+
+ /**
+ * @return the smallRange
+ */
+ public int getSmallRange()
+ {
+ return smallRange;
+ }
+
+ /**
+ * @param smallRange the smallRange to set
+ */
+ public void setSmallRange(int smallRange)
+ {
+ this.smallRange = smallRange;
+ }
+
+ /**
+ * @return the maxRange
+ */
+ public int getMaxRange()
+ {
+ return maxRange;
+ }
+
+ /**
+ * @param maxRange the maxRange to set
+ */
+ public void setMaxRange(int maxRange)
+ {
+ this.maxRange = maxRange;
+ }
+
+ /**
+ * @return the remainder
+ */
+ public int getRemainder()
+ {
+ return remainder;
+ }
+
+ /**
+ * @param remainder the remainder to set
+ */
+ public void setRemainder(int remainder)
+ {
+ this.remainder = remainder;
+ }
+
+ /**
+ * @return the manager
+ */
+ public BeanManager getManager()
+ {
+ return manager;
+ }
+
+ /**
+ * @param manager the manager to set
+ */
+ public void setManager(BeanManager manager)
+ {
+ this.manager = manager;
+ }
+
+}
diff --git a/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/guess/NextNumber.java b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/guess/NextNumber.java
new file mode 100644
index 0000000..2dcbca2
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/guess/NextNumber.java
@@ -0,0 +1,42 @@
+/*
+ * 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.webbeans.sample.guess;
+
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+public @interface NextNumber
+{
+
+}
diff --git a/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/guess/NumberProducer.java b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/guess/NumberProducer.java
new file mode 100644
index 0000000..334a846
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/guess/NumberProducer.java
@@ -0,0 +1,54 @@
+/*
+ * 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.webbeans.sample.guess;
+
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Named;
+import javax.enterprise.inject.Produces;
+
+@SessionScoped
+@Named
+public class NumberProducer implements Serializable
+{
+ private static final long serialVersionUID = 2504578502938734869L;
+ private int number = 100;
+
+ public NumberProducer()
+ {
+
+ }
+
+ @Produces
+ @NextNumber
+ public Integer next()
+ {
+ return Integer.valueOf(new java.util.Random().nextInt(101));
+ }
+
+ @Produces
+ @Highest
+ public Integer getNumber()
+ {
+ return number;
+ }
+
+}
\ No newline at end of file
diff --git a/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/model/User.java b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/model/User.java
new file mode 100644
index 0000000..2e525b9
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/model/User.java
@@ -0,0 +1,75 @@
+/*
+ * 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.webbeans.sample.model;
+
+import java.io.Serializable;
+
+import javax.enterprise.inject.Model;
+
+/**
+ * Simple model object for loginned users.
+ */
+@Model
+public class User implements Serializable
+{
+ private static final long serialVersionUID = 4953743986412127075L;
+
+ /**User name*/
+ private String userName;
+
+ /**Password*/
+ private String password;
+
+ public User()
+ {
+
+ }
+
+ /**
+ * @return the userName
+ */
+ public String getUserName()
+ {
+ return userName;
+ }
+
+ /**
+ * @param userName the userName to set
+ */
+ public void setUserName(String userName)
+ {
+ this.userName = userName;
+ }
+
+ /**
+ * @return the password
+ */
+ public String getPassword()
+ {
+ return password;
+ }
+
+ /**
+ * @param password the password to set
+ */
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
+}
diff --git a/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/model/conversation/ConversationModel.java b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/model/conversation/ConversationModel.java
new file mode 100644
index 0000000..02a7afe
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/model/conversation/ConversationModel.java
@@ -0,0 +1,45 @@
+/*
+ * 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.webbeans.sample.model.conversation;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.context.ConversationScoped;
+import javax.inject.Named;
+
+@ConversationScoped
+@Named
+public class ConversationModel implements Serializable
+{
+ private static final long serialVersionUID = -5042442586067259214L;
+
+ private List<String> list = new ArrayList<String>();
+
+ public void addNewBook(String name)
+ {
+ list.add(name);
+ }
+
+ public List<String> getList()
+ {
+ return this.list;
+ }
+}
diff --git a/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/observer/LoggedInObserver.java b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/observer/LoggedInObserver.java
new file mode 100644
index 0000000..9a2e2c0
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/observer/LoggedInObserver.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.sample.observer;
+
+
+import javax.enterprise.event.Observes;
+
+import org.apache.webbeans.sample.event.LoggedInEvent;
+import org.apache.webbeans.sample.model.User;
+
+
+public class LoggedInObserver
+{
+
+ public void afterLogin(@Observes LoggedInEvent event)
+ {
+ User user = event.getUser();
+ System.out.println("User with user name : " + user.getUserName());
+ System.out.println("User with password : " + user.getPassword());
+ }
+
+}
diff --git a/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/util/FacesMessageUtil.java b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/util/FacesMessageUtil.java
new file mode 100644
index 0000000..6a0d86b
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/main/java/org/apache/webbeans/sample/util/FacesMessageUtil.java
@@ -0,0 +1,42 @@
+/*
+ * 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.webbeans.sample.util;
+
+import javax.enterprise.context.Dependent;
+import javax.inject.Named;
+import javax.faces.application.FacesMessage;
+import javax.faces.application.FacesMessage.Severity;
+import javax.faces.context.FacesContext;
+
+@Named(value="facesMessage")
+@Dependent
+public class FacesMessageUtil
+{
+
+ public FacesMessageUtil()
+ {
+
+ }
+
+ public void addMessage(Severity severity,String summary, String detail)
+ {
+ FacesMessage message = new FacesMessage(severity,summary,detail);
+ FacesContext.getCurrentInstance().addMessage(null, message);
+ }
+}
diff --git a/owb_1.2.x/samples/guess/src/main/resources/META-INF/beans.xml b/owb_1.2.x/samples/guess/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000..4f271e9
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,29 @@
+<?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.
+-->
+<beans xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+ <interceptors>
+ </interceptors>
+
+ <decorators>
+ </decorators>
+</beans>
+
diff --git a/owb_1.2.x/samples/guess/src/main/resources/META-INF/openwebbeans/openwebbeans.properties b/owb_1.2.x/samples/guess/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
new file mode 100644
index 0000000..f51be4e
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
@@ -0,0 +1,28 @@
+#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.
+#---------------------------------------------------------------
+# The default configuration for OpenWebBeans
+#
+# The default configuration is intended for a JDK and a simple ServletContainer
+# like jetty, resin or tomcat.
+#
+#---------------------------------------------------------------
+
+#general configuration section
+
+org.apache.webbeans.spi.adaptor.ELAdaptor=org.apache.webbeans.el10.EL10Adaptor
+
diff --git a/owb_1.2.x/samples/guess/src/main/webapp/WEB-INF/beans.xml b/owb_1.2.x/samples/guess/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 0000000..4f271e9
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,29 @@
+<?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.
+-->
+<beans xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+ <interceptors>
+ </interceptors>
+
+ <decorators>
+ </decorators>
+</beans>
+
diff --git a/owb_1.2.x/samples/guess/src/main/webapp/WEB-INF/faces-config.xml b/owb_1.2.x/samples/guess/src/main/webapp/WEB-INF/faces-config.xml
new file mode 100644
index 0000000..07d5658
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/main/webapp/WEB-INF/faces-config.xml
@@ -0,0 +1,56 @@
+<?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.
+-->
+
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+
+
+ <navigation-rule>
+ <from-view-id>/home.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>login</from-outcome>
+ <to-view-id>/login.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+
+ <navigation-rule>
+ <from-view-id>/login.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>loginSuccess</from-outcome>
+ <to-view-id>/home.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+
+ <navigation-rule>
+ <from-view-id>/conversation.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>toRedirect</from-outcome>
+ <to-view-id>/redirect.jsf?book=alis</to-view-id>
+ <redirect/>
+ </navigation-case>
+ </navigation-rule>
+
+ <application>
+ <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
+ </application>
+
+
+</faces-config>
diff --git a/owb_1.2.x/samples/guess/src/main/webapp/WEB-INF/web.xml b/owb_1.2.x/samples/guess/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..a8d8359
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,46 @@
+<?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.
+-->
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
+ <display-name>guess</display-name>
+
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ </welcome-file-list>
+
+ <listener>
+ <listener-class>org.apache.webbeans.servlet.WebBeansConfigurationListener</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+
+</web-app>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/guess/src/main/webapp/conversation.xhtml b/owb_1.2.x/samples/guess/src/main/webapp/conversation.xhtml
new file mode 100644
index 0000000..508de83
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/main/webapp/conversation.xhtml
@@ -0,0 +1,59 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+
+ 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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<head>
+ <title>OpenWebBeans :: Examples :: Conversation</title>
+</head>
+
+<body>
+
+ <div id="container">
+ <div id="content">
+ <h:messages globalOnly="false" showSummary="true" infoStyle="font-weight:bold;"></h:messages>
+
+ <h:form>
+
+ <div style="border:1px solid black;margin: 25px 75px;">
+
+ <h:panelGrid columns="2">
+
+ <h:outputLabel for="book">
+ <h:outputText value="Book Name : "></h:outputText>
+ </h:outputLabel>
+ <h:inputText id="book" value="#{shoppingCardBean.book}" required="true" requiredMessage="Please give a book name!"></h:inputText>
+
+ <h:panelGroup>
+ <h:commandButton action="#{shoppingCardBean.startConversation}" immediate="true" value="Start Conversation"></h:commandButton>
+ <h:commandButton action="#{shoppingCardBean.endConversation}" immediate="true" value="End Conversation"></h:commandButton>
+ <h:commandButton action="toRedirect" immediate="true" value="Redirect"></h:commandButton>
+ </h:panelGroup>
+
+ <h:commandButton action="#{shoppingCardBean.addNewBook}" value="Add New Book"></h:commandButton>
+
+ </h:panelGrid>
+ </div>
+ </h:form>
+ </div>
+
+ </div>
+</body>
+</html>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/guess/src/main/webapp/home.xhtml b/owb_1.2.x/samples/guess/src/main/webapp/home.xhtml
new file mode 100644
index 0000000..d714d99
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/main/webapp/home.xhtml
@@ -0,0 +1,69 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+
+ 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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<head>
+ <title>OpenWebBeans :: Examples</title>
+</head>
+
+<body>
+
+ <div id="container">
+ <div id="content">
+ <h:form>
+
+ <div align="right">
+ <h:commandLink value="Logout" action="#{logoutBean.logout}" immediate="true"></h:commandLink>
+ </div>
+
+ <h2>
+ <h:outputText value="Hello #{currentUser.userName} #{currentUser.password}"></h:outputText>
+ </h2>
+
+ <h1>Please guess a number...</h1>
+
+ <div style="color: red">
+ <h:messages id="messages" globalOnly="true"/>
+ <h:outputText id="higher" value="Higher..." rendered="#{game.no gt game.guess}"/>
+ <h:outputText id="lower" value="Lower..." rendered="#{game.no lt game.guess}"/>
+ </div>
+
+ <div>
+ Please guess a number between #{game.smallRange} and #{game.maxRange}. Your remaining guesses : #{game.remainder}.
+ </div>
+
+ <div>
+ Your guessed number:
+ <h:inputText id="inputGuess" value="#{game.guess}" required="true" size="3">
+ <f:validateLongRange maximum="#{game.maxRange}" minimum="#{game.smallRange}"/>
+ </h:inputText>
+ <h:commandButton id="GuessButton" value="Guess Number" action="#{game.checkNumber}"/>
+ <h:commandButton id="Restart" value="Restart" action="#{game.clear}" immediate="true"/>
+ </div>
+
+ <div>
+ <h:message id="message" for="inputGuess" style="color: red"/>
+ </div>
+ </h:form>
+ </div>
+ </div>
+</body>
+</html>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/guess/src/main/webapp/index.html b/owb_1.2.x/samples/guess/src/main/webapp/index.html
new file mode 100644
index 0000000..74f485a
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/main/webapp/index.html
@@ -0,0 +1,21 @@
+<html>
+<!--
+
+ 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.
+-->
+<head>
+ <meta http-equiv="Refresh" content="0; URL=login.jsf">
+</head>
+</html>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/guess/src/main/webapp/login.xhtml b/owb_1.2.x/samples/guess/src/main/webapp/login.xhtml
new file mode 100644
index 0000000..011d455
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/main/webapp/login.xhtml
@@ -0,0 +1,64 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+
+ 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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<head>
+ <title>OpenWebBeans :: Examples</title>
+</head>
+
+<body>
+
+ <div id="container">
+ <div id="content">
+ <h:messages globalOnly="false" showSummary="true"></h:messages>
+
+ <h:form id="form">
+
+ <div align="center">
+ <h3>OpenWebBeans Examples</h3>
+ <span style="color:red;">User name : admin, Password : admin</span>
+ </div>
+
+ <div align="center" style="border:1px solid black;">
+
+ <h:panelGrid columns="2">
+
+ <h:outputLabel for="userName">
+ <h:outputText value="User Name : "></h:outputText>
+ </h:outputLabel>
+ <h:inputText id="userName" value="#{loginBean.userName}"></h:inputText>
+
+ <h:outputLabel for="password">
+ <h:outputText value="Password : "></h:outputText>
+ </h:outputLabel>
+ <h:inputSecret id="password" value="#{loginBean.password}"></h:inputSecret>
+
+ <h:commandButton action="#{loginBean.login}" value="Login"></h:commandButton>
+ <h:commandButton onclick="document.getElementById('form').reset(); return false;" value="Reset"></h:commandButton>
+
+ </h:panelGrid>
+ </div>
+ </h:form>
+ </div>
+
+ </div>
+</body>
+</html>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/guess/src/main/webapp/redirect.xhtml b/owb_1.2.x/samples/guess/src/main/webapp/redirect.xhtml
new file mode 100644
index 0000000..f531d3b
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/main/webapp/redirect.xhtml
@@ -0,0 +1,51 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+
+ 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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<head>
+ <title>OpenWebBeans :: Examples :: Conversation</title>
+</head>
+
+<body>
+
+ <div id="container">
+ <div id="content">
+ <h:messages globalOnly="false" showSummary="true" infoStyle="font-weight:bold;"></h:messages>
+
+ <h:form id="form">
+
+ <div style="border:1px solid black;margin: 25px 75px;">
+
+ <h:panelGrid columns="2">
+
+ <h:outputLabel>
+ <h:outputText value="Redirected Books : "></h:outputText>
+ </h:outputLabel>
+ <h:outputText value="#{shoppingCardBean.books}" />
+
+ </h:panelGrid>
+ </div>
+ </h:form>
+ </div>
+
+ </div>
+</body>
+</html>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/guess/src/site/apt/index.apt b/owb_1.2.x/samples/guess/src/site/apt/index.apt
new file mode 100644
index 0000000..6c33fb4
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/site/apt/index.apt
@@ -0,0 +1,16 @@
+~~ 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.
+OpenWebBeans Guess Sample
+
+ This module contains a number guessing sample for the JSR-299
+ Java Contexts and Dependency Injection framework.
+
diff --git a/owb_1.2.x/samples/guess/src/site/site.xml b/owb_1.2.x/samples/guess/src/site/site.xml
new file mode 100644
index 0000000..bd9ff05
--- /dev/null
+++ b/owb_1.2.x/samples/guess/src/site/site.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<project name="OpenWebBeans-Samples-Guess">
+ <publishDate format="dd MMM yyyy" />
+ <version position="left"/>
+
+ <body>
+ <breadcrumbs>
+ <item name="Apache" href="http://apache.org"/>
+ <item name="OpenWebBeans" href="http://openwebbeans.apache.org"/>
+ <item name="Samples" href="http://openwebbeans.apache.org/${project.version}/samples"/>
+ <item name="Samples" href="http://openwebbeans.apache.org/${project.version}/samples/guess"/>
+ </breadcrumbs>
+
+ <menu name="Overview">
+ <item name="Introduction" href="index.html" />
+ </menu>
+
+ <menu ref="reports"/>
+ </body>
+</project>
+
diff --git a/owb_1.2.x/samples/jms-sample/LICENSE b/owb_1.2.x/samples/jms-sample/LICENSE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/owb_1.2.x/samples/jms-sample/LICENSE
@@ -0,0 +1,201 @@
+ 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.
diff --git a/owb_1.2.x/samples/jms-sample/NOTICE b/owb_1.2.x/samples/jms-sample/NOTICE
new file mode 100644
index 0000000..c6cfacb
--- /dev/null
+++ b/owb_1.2.x/samples/jms-sample/NOTICE
@@ -0,0 +1,5 @@
+Apache OpenWebBeans
+Copyright 2008, 2010 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
diff --git a/owb_1.2.x/samples/jms-sample/pom.xml b/owb_1.2.x/samples/jms-sample/pom.xml
new file mode 100644
index 0000000..a869cdb
--- /dev/null
+++ b/owb_1.2.x/samples/jms-sample/pom.xml
@@ -0,0 +1,119 @@
+<?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.
+-->
+<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">
+ <parent>
+ <artifactId>samples</artifactId>
+ <groupId>org.apache.openwebbeans</groupId>
+ <version>1.2.5</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.openwebbeans.samples</groupId>
+ <artifactId>jms-sample</artifactId>
+ <packaging>war</packaging>
+ <name>Sample Jms Injection Demo</name>
+ <description>Sample Jms Injection Demo</description>
+
+ <properties>
+ <deploy.skip>true</deploy.skip>
+ </properties>
+
+ <build>
+ <finalName>jms-sample</finalName>
+ </build>
+
+ <dependencies>
+
+ <!-- JSF Facelet -->
+ <dependency>
+ <groupId>com.sun.facelets</groupId>
+ <artifactId>jsf-facelets</artifactId>
+ <version>1.1.14</version>
+ </dependency>
+
+ <!-- JSF Plugin -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-jsf</artifactId>
+ </dependency>
+
+ <!-- Web Plugin -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-web</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- MyFaces API -->
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Servlet API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_2.5_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- JMS API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ <version>1.1.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- JMS Plugin -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-jms</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- JSR-299 API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- JSR-330 API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- SPI API -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+
+ </dependencies>
+
+</project>
diff --git a/owb_1.2.x/samples/jms-sample/src/main/java/org/apache/webbeans/sample/bindings/JmsBinding.java b/owb_1.2.x/samples/jms-sample/src/main/java/org/apache/webbeans/sample/bindings/JmsBinding.java
new file mode 100644
index 0000000..fabbdd2
--- /dev/null
+++ b/owb_1.2.x/samples/jms-sample/src/main/java/org/apache/webbeans/sample/bindings/JmsBinding.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.sample.bindings;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.FIELD,ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER})
+public @interface JmsBinding
+{
+
+}
diff --git a/owb_1.2.x/samples/jms-sample/src/main/java/org/apache/webbeans/sample/jms/JmsReceiverBean.java b/owb_1.2.x/samples/jms-sample/src/main/java/org/apache/webbeans/sample/jms/JmsReceiverBean.java
new file mode 100644
index 0000000..9a39294
--- /dev/null
+++ b/owb_1.2.x/samples/jms-sample/src/main/java/org/apache/webbeans/sample/jms/JmsReceiverBean.java
@@ -0,0 +1,123 @@
+/*
+ * 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.webbeans.sample.jms;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.QueueConnection;
+import javax.jms.QueueReceiver;
+import javax.jms.TextMessage;
+
+import org.apache.webbeans.sample.bindings.JmsBinding;
+
+@SessionScoped
+@Named("receiver")
+public class JmsReceiverBean implements MessageListener,Serializable
+{
+ private static final long serialVersionUID = 5704416477431590842L;
+
+ private @Inject @JmsBinding QueueReceiver queueReceiver;
+
+ private @Inject @JmsBinding QueueConnection queueConnection;
+
+ private String message;
+
+ private boolean receive = false;
+
+ private List<String> messages = new ArrayList<String>();
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ public void setMessage(String message)
+ {
+ this.message = message;
+ }
+
+ public void startReceive()
+ {
+ try
+ {
+ if(!receive)
+ {
+ this.receive = true;
+ this.queueConnection.start();
+ }
+
+ queueReceiver.setMessageListener(this);
+ }
+ catch (JMSException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void onMessage(Message message)
+ {
+ TextMessage me = (TextMessage) message;
+ try
+ {
+ this.message = me.getText();
+ this.messages.add(this.message);
+ }
+ catch (JMSException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public String refresh()
+ {
+ return null;
+ }
+
+ public boolean isReceive()
+ {
+ return receive;
+ }
+
+ public void setReceive(boolean receive)
+ {
+ this.receive = receive;
+ }
+
+ public List<String> getMessages()
+ {
+ return messages;
+ }
+
+ public void setMessages(List<String> messages)
+ {
+ this.messages = messages;
+ }
+
+
+
+}
diff --git a/owb_1.2.x/samples/jms-sample/src/main/java/org/apache/webbeans/sample/jms/JmsSenderBean.java b/owb_1.2.x/samples/jms-sample/src/main/java/org/apache/webbeans/sample/jms/JmsSenderBean.java
new file mode 100644
index 0000000..78b5792
--- /dev/null
+++ b/owb_1.2.x/samples/jms-sample/src/main/java/org/apache/webbeans/sample/jms/JmsSenderBean.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.sample.jms;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.jms.JMSException;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.jms.TextMessage;
+
+import org.apache.webbeans.sample.bindings.JmsBinding;
+
+@RequestScoped
+@Named("sender")
+public class JmsSenderBean
+{
+ private @Inject @JmsBinding QueueSender queueSender;
+
+ private @Inject @JmsBinding QueueSession queueSession;
+
+ private String text;
+
+ public JmsSenderBean()
+ {
+
+ }
+
+ public String addMessage()
+ {
+ try
+ {
+ TextMessage message = queueSession.createTextMessage(this.text);
+ queueSender.send(message);
+ }
+ catch (JMSException e)
+ {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ /**
+ * @return the text
+ */
+ public String getText()
+ {
+ return text;
+ }
+
+ /**
+ * @param text the text to set
+ */
+ public void setText(String text)
+ {
+ this.text = text;
+ }
+
+
+}
diff --git a/owb_1.2.x/samples/jms-sample/src/main/resources/META-INF/beans.xml b/owb_1.2.x/samples/jms-sample/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000..7d56d3d
--- /dev/null
+++ b/owb_1.2.x/samples/jms-sample/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+<beans/>
diff --git a/owb_1.2.x/samples/jms-sample/src/main/resources/META-INF/openwebbeans/openwebbeans.properties b/owb_1.2.x/samples/jms-sample/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
new file mode 100644
index 0000000..7190d91
--- /dev/null
+++ b/owb_1.2.x/samples/jms-sample/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
@@ -0,0 +1,28 @@
+#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.
+#---------------------------------------------------------------
+# The default configuration for OpenWebBeans
+#
+# The default configuration is intended for a JDK and a simple ServletContainer
+# like jetty, resin or tomcat.
+#
+#---------------------------------------------------------------
+
+#general configuration section
+
+#JNDI Enterprise Implementation
+org.apache.webbeans.spi.JNDIService=org.apache.webbeans.corespi.ee.JNDIServiceEnterpriseImpl
diff --git a/owb_1.2.x/samples/jms-sample/src/main/webapp/WEB-INF/beans.xml b/owb_1.2.x/samples/jms-sample/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 0000000..f550a37
--- /dev/null
+++ b/owb_1.2.x/samples/jms-sample/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,37 @@
+<?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.
+-->
+<WebBeans xmlns="urn:java:ee"
+ xmlns:myapp="urn:java:org.apache.webbeans.sample.bindings"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:java:ee http://java.sun.com/jee/beans-1.0.xsd">
+
+ <Deploy>
+ <Standard/>
+ <Production/>
+ </Deploy>
+
+ <Queue>
+ <Resource>
+ <name>queue/A</name>
+ </Resource>
+ <myapp:JmsBinding/>
+ </Queue>
+
+</WebBeans>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/jms-sample/src/main/webapp/WEB-INF/faces-config.xml b/owb_1.2.x/samples/jms-sample/src/main/webapp/WEB-INF/faces-config.xml
new file mode 100644
index 0000000..3aabb64
--- /dev/null
+++ b/owb_1.2.x/samples/jms-sample/src/main/webapp/WEB-INF/faces-config.xml
@@ -0,0 +1,32 @@
+<?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.
+-->
+
+<faces-config
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
+ version="1.2">
+
+ <application>
+ <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
+ </application>
+
+
+</faces-config>
diff --git a/owb_1.2.x/samples/jms-sample/src/main/webapp/WEB-INF/web.xml b/owb_1.2.x/samples/jms-sample/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..672c5db
--- /dev/null
+++ b/owb_1.2.x/samples/jms-sample/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,47 @@
+<?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.
+-->
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
+ <display-name>guess</display-name>
+
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ </welcome-file-list>
+
+ <listener>
+ <listener-class>org.apache.webbeans.servlet.WebBeansConfigurationListener</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+
+</web-app>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/jms-sample/src/main/webapp/index.html b/owb_1.2.x/samples/jms-sample/src/main/webapp/index.html
new file mode 100644
index 0000000..4981e10
--- /dev/null
+++ b/owb_1.2.x/samples/jms-sample/src/main/webapp/index.html
@@ -0,0 +1,21 @@
+<html>
+<!--
+
+ 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.
+-->
+<head>
+ <meta http-equiv="Refresh" content="0; URL=sender.jsf">
+</head>
+</html>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/jms-sample/src/main/webapp/receiver.xhtml b/owb_1.2.x/samples/jms-sample/src/main/webapp/receiver.xhtml
new file mode 100644
index 0000000..ff29a45
--- /dev/null
+++ b/owb_1.2.x/samples/jms-sample/src/main/webapp/receiver.xhtml
@@ -0,0 +1,79 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+
+ 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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<head>
+ <title>OpenWebBeans :: Examples :: JMS Sample :: Receiver</title>
+</head>
+
+<body>
+
+ <div id="container">
+ <div id="content">
+ <h:messages globalOnly="false" showSummary="true" infoStyle="font-weight:bold;"></h:messages>
+
+ <h:form id="form">
+
+ <div style="border:1px solid black;margin: 25px 75px;">
+
+ <h2 style="color:red;font-weight:bold;font-size:14px">Register Listener</h2>
+
+ <h:panelGrid columns="2" cellpadding="5">
+ <h:commandButton action="#{receiver.startReceive}" value="Register JMSListener" disabled="#{receiver.receive}"/>
+ <h:commandButton action="#{receiver.refresh}" value="Refresh Recieved Message List"/>
+ </h:panelGrid>
+
+ </div>
+
+ <div style="border:1px solid black;margin: 25px 75px;">
+
+ <h2 style="color:red;font-weight:bold;font-size:14px">Last Message Content</h2>
+
+ <h:outputText value="JMS Last Message : " style="color:red;font-weight:bold;font-size:14px;"></h:outputText>
+ <h:outputText value="#{receiver.message}"/>
+ </div>
+
+ <div style="border:1px solid black;margin: 25px 75px;">
+
+ <h2 style="color:red;font-weight:bold;font-size:14px">JMS Received Message List</h2>
+
+ <h:dataTable value="#{receiver.messages}" var="data">
+
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Message Content" />
+ </f:facet>
+
+ <h:outputText value="#{data}" />
+
+ </h:column>
+
+ </h:dataTable>
+
+ </div>
+
+
+ </h:form>
+ </div>
+
+ </div>
+</body>
+</html>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/jms-sample/src/main/webapp/sender.xhtml b/owb_1.2.x/samples/jms-sample/src/main/webapp/sender.xhtml
new file mode 100644
index 0000000..19ced85
--- /dev/null
+++ b/owb_1.2.x/samples/jms-sample/src/main/webapp/sender.xhtml
@@ -0,0 +1,53 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+
+ 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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<head>
+ <title>OpenWebBeans :: Examples :: JMS Sample :: Sender</title>
+</head>
+
+<body>
+
+ <div id="container">
+ <div id="content">
+ <h:messages globalOnly="false" showSummary="true" infoStyle="font-weight:bold;"></h:messages>
+
+ <h:form id="form">
+
+ <div style="border:1px solid black;margin: 25px 75px;">
+
+ <h:panelGrid columns="2">
+
+ <h:outputLabel for="text">
+ <h:outputText value="JMS Send Message Text : "></h:outputText>
+ </h:outputLabel>
+ <h:inputText id="text" value="#{sender.text}" required="true" requiredMessage="Please give a JMS Message text!"></h:inputText>
+
+ <h:commandButton action="#{sender.addMessage}" value="Send Message to a Queue"></h:commandButton>
+
+ </h:panelGrid>
+ </div>
+ </h:form>
+ </div>
+
+ </div>
+</body>
+</html>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/jsf2sample/LICENSE b/owb_1.2.x/samples/jsf2sample/LICENSE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/owb_1.2.x/samples/jsf2sample/LICENSE
@@ -0,0 +1,201 @@
+ 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.
diff --git a/owb_1.2.x/samples/jsf2sample/NOTICE b/owb_1.2.x/samples/jsf2sample/NOTICE
new file mode 100644
index 0000000..f5a2e59
--- /dev/null
+++ b/owb_1.2.x/samples/jsf2sample/NOTICE
@@ -0,0 +1,6 @@
+Apache OpenWebBeans
+Copyright 2008, 2010 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/owb_1.2.x/samples/jsf2sample/README b/owb_1.2.x/samples/jsf2sample/README
new file mode 100644
index 0000000..b4d4d88
--- /dev/null
+++ b/owb_1.2.x/samples/jsf2sample/README
@@ -0,0 +1,26 @@
+INTRODUCTION
+---------------------
+This examples shows the usage of MyFaces JSF2 + OpenWebBeans in Tomcat 7.
+
+HOW TO
+--------------------
+1* Checkout http://svn.apache.org/repos/asf/tomcat/tc7.0.x/tags/TOMCAT_7_0_0_RC4/ and run "ant" in trunk
+ This will create a Tomcat 7.
+2* Update Tomcat conf/tomcat-users.xml
+ - Updates "conf/tomcat-users.xml" with the following content,
+ <role rolename="manager-script"/>
+ <user username="admin" password="" roles="manager-script"/>
+
+ This will be necessary to run "mvn tomcat:deploy" command.
+
+3* Run "mvn clean tomcat:deploy"
+ This command will deploy the application into Tomcat.
+
+4* Open Web Browser and write
+ - http://localhost:8080/jsf2sample/
+ Shows the AJAX functionality of JSF2 specification.
+ - http://localhost:8080/jsf2sample/conversation.jsf
+ Show the usage of JSF conversations.
+
+5* Enjoy!
+
diff --git a/owb_1.2.x/samples/jsf2sample/pom.xml b/owb_1.2.x/samples/jsf2sample/pom.xml
new file mode 100644
index 0000000..fd57c6d
--- /dev/null
+++ b/owb_1.2.x/samples/jsf2sample/pom.xml
@@ -0,0 +1,129 @@
+<!--
+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.
+-->
+<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>
+ <description>Sample JSF2 Application</description>
+ <parent>
+ <artifactId>samples</artifactId>
+ <groupId>org.apache.openwebbeans</groupId>
+ <version>1.2.5</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.apache.openwebbeans.samples</groupId>
+ <artifactId>jsf2sample</artifactId>
+ <packaging>war</packaging>
+ <name>Sample JSF2 Application</name>
+
+ <properties>
+ <deploy.skip>true</deploy.skip>
+ </properties>
+
+ <dependencies>
+
+ <!-- JSR-299 Impl -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-resource</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- Interceptor API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+ </dependency>
+
+ <!-- JSF Plugin -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-jsf</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- Web Plugin -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-web</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- JSF API -->
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>${myfaces2.version}</version>
+ </dependency>
+
+ <!-- JSF Impl -->
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <version>${myfaces2.version}</version>
+ </dependency>
+
+ <!-- JSR 299 API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ </dependency>
+
+ <!-- JSR 330 API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ </dependency>
+
+ <!-- SPI API -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- JSTL -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ <version>1.2</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>jsf2sample</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>tomcat-maven-plugin</artifactId>
+ <version>1.1</version>
+ <configuration>
+ <url>http://localhost:8080/manager/text</url>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/owb_1.2.x/samples/jsf2sample/src/main/java/org/apache/webbeans/jsf2/ConversationBean.java b/owb_1.2.x/samples/jsf2sample/src/main/java/org/apache/webbeans/jsf2/ConversationBean.java
new file mode 100644
index 0000000..aa36ea9
--- /dev/null
+++ b/owb_1.2.x/samples/jsf2sample/src/main/java/org/apache/webbeans/jsf2/ConversationBean.java
@@ -0,0 +1,120 @@
+/*
+ * 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.webbeans.jsf2;
+
+import javax.enterprise.context.Conversation;
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@Named
+@RequestScoped
+public class ConversationBean
+{
+ private @Inject Conversation conversation;
+
+ private @Inject @Named("mynumber") int current;
+
+ private String message;
+
+ public ConversationBean()
+ {
+
+ }
+
+ public String startConversation()
+ {
+ conversation.begin();
+
+ message = "Conversation is started with id : " + this.conversation.getId();
+
+ return null;
+ }
+
+ public String next()
+ {
+ return "next";
+ }
+
+ public String stopConversation()
+ {
+ conversation.end();
+
+ current = 10;
+
+ message = "Conversation is ended";
+
+ return null;
+ }
+
+ /**
+ * @return the message
+ */
+ public String getMessage()
+ {
+ return message;
+ }
+
+ /**
+ * @param message the message to set
+ */
+ public void setMessage(String message)
+ {
+ this.message = message;
+ }
+
+ /**
+ * @return the conversation
+ */
+ public Conversation getConversation()
+ {
+ return conversation;
+ }
+
+ /**
+ * @param conversation the conversation to set
+ */
+ public void setConversation(Conversation conversation)
+ {
+ this.conversation = conversation;
+ }
+
+ /**
+ * @return the current
+ */
+ public int getCurrent()
+ {
+ return current;
+ }
+
+ /**
+ * @param current the current to set
+ */
+ public void setCurrent(int current)
+ {
+ this.current = current;
+ }
+
+ public String conversationLive()
+ {
+ return null;
+ }
+
+
+}
diff --git a/owb_1.2.x/samples/jsf2sample/src/main/java/org/apache/webbeans/jsf2/ConversationData.java b/owb_1.2.x/samples/jsf2sample/src/main/java/org/apache/webbeans/jsf2/ConversationData.java
new file mode 100644
index 0000000..0e94510
--- /dev/null
+++ b/owb_1.2.x/samples/jsf2sample/src/main/java/org/apache/webbeans/jsf2/ConversationData.java
@@ -0,0 +1,43 @@
+/*
+ * 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.webbeans.jsf2;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+@ConversationScoped
+public class ConversationData implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private int i = 10;
+
+ public ConversationData()
+ {
+ }
+
+ @Produces @Named("mynumber")
+ public int getNumber()
+ {
+ return i++;
+ }
+}
diff --git a/owb_1.2.x/samples/jsf2sample/src/main/java/org/apache/webbeans/jsf2/Counter.java b/owb_1.2.x/samples/jsf2sample/src/main/java/org/apache/webbeans/jsf2/Counter.java
new file mode 100644
index 0000000..af741b8
--- /dev/null
+++ b/owb_1.2.x/samples/jsf2sample/src/main/java/org/apache/webbeans/jsf2/Counter.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.jsf2;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface Counter
+{
+
+}
diff --git a/owb_1.2.x/samples/jsf2sample/src/main/java/org/apache/webbeans/jsf2/CounterBean.java b/owb_1.2.x/samples/jsf2sample/src/main/java/org/apache/webbeans/jsf2/CounterBean.java
new file mode 100644
index 0000000..db14251
--- /dev/null
+++ b/owb_1.2.x/samples/jsf2sample/src/main/java/org/apache/webbeans/jsf2/CounterBean.java
@@ -0,0 +1,39 @@
+/*
+ * 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.webbeans.jsf2;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+@SessionScoped
+public class CounterBean implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private int counter;
+
+ @Produces @Named("count") @Counter
+ public int count()
+ {
+ return counter ++;
+ }
+}
diff --git a/owb_1.2.x/samples/jsf2sample/src/main/java/org/apache/webbeans/jsf2/HelloJsfBean.java b/owb_1.2.x/samples/jsf2sample/src/main/java/org/apache/webbeans/jsf2/HelloJsfBean.java
new file mode 100644
index 0000000..563d160
--- /dev/null
+++ b/owb_1.2.x/samples/jsf2sample/src/main/java/org/apache/webbeans/jsf2/HelloJsfBean.java
@@ -0,0 +1,58 @@
+/*
+ * 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.webbeans.jsf2;
+
+import javax.enterprise.context.RequestScoped;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ActionListener;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@Named("helloBean")
+@RequestScoped
+public class HelloJsfBean implements ActionListener
+{
+ private @Inject @Counter int count;
+
+ /**
+ * @return the count
+ */
+ public int getCount()
+ {
+ return count;
+ }
+
+ /**
+ * @param count the count to set
+ */
+ public void setCount(int count)
+ {
+ this.count = count;
+ }
+
+
+ @Override
+ public void processAction(ActionEvent event) throws AbortProcessingException
+ {
+
+ }
+
+
+}
diff --git a/owb_1.2.x/samples/jsf2sample/src/main/resources/META-INF/beans.xml b/owb_1.2.x/samples/jsf2sample/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000..85b6e63
--- /dev/null
+++ b/owb_1.2.x/samples/jsf2sample/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+<beans/>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/jsf2sample/src/main/webapp/WEB-INF/beans.xml b/owb_1.2.x/samples/jsf2sample/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 0000000..85b6e63
--- /dev/null
+++ b/owb_1.2.x/samples/jsf2sample/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+<beans/>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/jsf2sample/src/main/webapp/WEB-INF/web.xml b/owb_1.2.x/samples/jsf2sample/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..f2ec2e3
--- /dev/null
+++ b/owb_1.2.x/samples/jsf2sample/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,42 @@
+<?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.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ version="2.5">
+
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+
+ <listener>
+ <listener-class>
+ org.apache.webbeans.servlet.WebBeansConfigurationListener</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.xhtml</url-pattern>
+ </servlet-mapping>
+
+</web-app>
diff --git a/owb_1.2.x/samples/jsf2sample/src/main/webapp/conversation.xhtml b/owb_1.2.x/samples/jsf2sample/src/main/webapp/conversation.xhtml
new file mode 100644
index 0000000..d6ce681
--- /dev/null
+++ b/owb_1.2.x/samples/jsf2sample/src/main/webapp/conversation.xhtml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<!--
+
+ 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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html">
+<h:head>
+ <title>JSF2 Ajax with OpenWebBeans Demo</title>
+</h:head>
+<h:body>
+
+ <div>
+ <h3>JSF2 Conversation Demo</h3>
+ <p>
+ Number will be increased each time user press <b>Show Number</b> button if conversation is in progress. Initial number set to <b>10</b>
+ </p>
+ </div>
+
+ <ul>
+ <li><h4>Click <b style="color: red;">Start Conversation</b> to start conversation </h4></li>
+ <li><h4>Click <b style="color: red;">End Conversation</b> to end conversation </h4></li>
+ <li><h4>Click <b style="color: red;">Show Number</b> to show number in the current conversation </h4></li>
+ </ul>
+
+ <h:form id="form">
+
+ <h:outputScript name="jsf.js" library="javax.faces" target="body"></h:outputScript>
+
+ <div>
+ <h:outputText value="Current Number : " style="color:red;"/>
+ <h:outputText value="#{conversationBean.current}" id="status" style="font-weight:bold;" />
+ </div>
+
+ <div style="margin-top: 10px;">
+ <h:outputText value="#{conversationBean.message}" id="message" style="font-weight:bold;" />
+ </div>
+
+ <div style="margin-top: 10px;">
+ <h:commandButton id="button1" value="Start Conversation" action="#{conversationBean.startConversation}">
+ </h:commandButton>
+
+ <h:commandButton id="button2" value="End Conversation" action="#{conversationBean.stopConversation}">
+ </h:commandButton>
+
+ <h:commandButton id="button3" value="Show Number" action="#{conversationBean.conversationLive}">
+ </h:commandButton>
+ </div>
+
+ </h:form>
+
+</h:body>
+</html>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/jsf2sample/src/main/webapp/counter.xhtml b/owb_1.2.x/samples/jsf2sample/src/main/webapp/counter.xhtml
new file mode 100644
index 0000000..6c97133
--- /dev/null
+++ b/owb_1.2.x/samples/jsf2sample/src/main/webapp/counter.xhtml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<!--
+
+ 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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html">
+<h:head>
+ <title>JSF2 Ajax with OpenWebBeans Demo</title>
+</h:head>
+<h:body>
+
+ <h3>JSF2 Ajax Demo :: Click <b>Count</b> button to inrease your count</h3>
+
+ <h:form id="form">
+
+ <h:outputScript name="jsf.js" library="javax.faces" target="body"></h:outputScript>
+
+ <div>
+ <h:commandButton id="button1" value="Count..." actionListener="#{helloBean.processAction}"
+ onclick="jsf.ajax.request(this,event, {execute:'form:button1',render:'form:status'});return false;">
+ </h:commandButton>
+
+ </div>
+
+ <div>
+ <h:outputText value="Counter Number : " />
+ <h:outputText value="#{helloBean.count}" id="status" />
+ </div>
+ </h:form>
+
+</h:body>
+</html>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/jsf2sample/src/main/webapp/index.html b/owb_1.2.x/samples/jsf2sample/src/main/webapp/index.html
new file mode 100644
index 0000000..44a8db1
--- /dev/null
+++ b/owb_1.2.x/samples/jsf2sample/src/main/webapp/index.html
@@ -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.
+-->
+<html>
+<head>
+<meta HTTP-EQUIV="REFRESH" content="0; url=counter.jsf">
+</head>
+</html>
diff --git a/owb_1.2.x/samples/pom.xml b/owb_1.2.x/samples/pom.xml
new file mode 100644
index 0000000..793492b
--- /dev/null
+++ b/owb_1.2.x/samples/pom.xml
@@ -0,0 +1,107 @@
+<?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.
+-->
+<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>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>1.2.5</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>samples</artifactId>
+ <packaging>pom</packaging>
+ <name>OWB Samples</name>
+ <description>Apache OpenWebBeans Samples contains samples project for openwebbeans.</description>
+
+ <properties>
+ <deploy.skip>false</deploy.skip>
+ <myfaces2.version>2.0.7</myfaces2.version>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>${deploy.skip}</skip> <!-- we don't deploy our samples upstream -->
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <archiveClasses>true</archiveClasses>
+ <archive>
+ <!-- Do not include META-INF/maven to avoid long file problems on windows -->
+ <addMavenDescriptor>false</addMavenDescriptor>
+ </archive>
+
+ <!--
+ HACK: Include legal files explicity, otherwise they will end up in the wrong path
+ or in another jar file in the war.
+
+ NOTE: targetPath is broken for webResources (as documented)
+ -->
+ <webResources>
+ <resource>
+ <directory>.</directory>
+ <targetPath>META-INF</targetPath>
+ <includes>
+ <include>LICENSE</include>
+ <include>NOTICE</include>
+ </includes>
+ </resource>
+ </webResources>
+ <archive>
+ <manifestEntries>
+ <Specification-Title>${project.name}</Specification-Title>
+ <Specification-Version>${project.version}</Specification-Version>
+ <Specification-Vendor>${project.organization.name}</Specification-Vendor>
+ <Implementation-Title>${project.name}</Implementation-Title>
+ <Implementation-Version>${project.version}</Implementation-Version>
+ <Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
+ <Implementation-Vendor-Id>org.apache</Implementation-Vendor-Id>
+ </manifestEntries>
+ <!-- add the generated manifest to the war -->
+ <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
+
+ </archive>
+
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+ <modules>
+ <module>guess</module>
+ <module>conversation-sample</module>
+ <module>jsf2sample</module>
+ <module>ejb-sample</module>
+ <module>ejb-telephone</module>
+ <module>jms-sample</module>
+ <module>reservation</module>
+ <module>tomcat-sample</module>
+ <module>tomcat7-sample</module>
+ <module>standalone-sample</module>
+ </modules>
+</project>
diff --git a/owb_1.2.x/samples/reservation/LICENSE b/owb_1.2.x/samples/reservation/LICENSE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/LICENSE
@@ -0,0 +1,201 @@
+ 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.
diff --git a/owb_1.2.x/samples/reservation/NOTICE b/owb_1.2.x/samples/reservation/NOTICE
new file mode 100644
index 0000000..f5a2e59
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/NOTICE
@@ -0,0 +1,6 @@
+Apache OpenWebBeans
+Copyright 2008, 2010 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/owb_1.2.x/samples/reservation/pom.xml b/owb_1.2.x/samples/reservation/pom.xml
new file mode 100644
index 0000000..90d229c
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/pom.xml
@@ -0,0 +1,303 @@
+<?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.
+-->
+<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">
+ <parent>
+ <artifactId>samples</artifactId>
+ <groupId>org.apache.openwebbeans</groupId>
+ <version>1.2.5</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.openwebbeans.samples</groupId>
+ <artifactId>reservation</artifactId>
+ <packaging>war</packaging>
+ <name>Sample Hotel Reservation Application</name>
+ <description>Simple hotel reservation application</description>
+
+ <properties>
+ <deploy.skip>true</deploy.skip>
+ </properties>
+
+ <build>
+ <finalName>reservation</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>openjpa-maven-plugin</artifactId>
+ <version>1.2</version>
+ <configuration>
+ <includes>org/apache/webbeans/reservation/entity/*.class</includes>
+ <addDefaultConstructor>true</addDefaultConstructor>
+ <enforcePropertyRestrictions>true</enforcePropertyRestrictions>
+ <sqlAction>build</sqlAction>
+ <sqlFile>${project.build.directory}/database.sql</sqlFile>
+ </configuration>
+ <executions>
+ <execution>
+ <id>mappingtool</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>enhance</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <dependencies>
+
+ <!-- My Faces API -->
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Servlet Api -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_2.5_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- JPA API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jpa_2.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- HSQLDB -->
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.8.0.7</version>
+ </dependency>
+
+ <!-- EL API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-el_2.2_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Common Validator -->
+ <dependency>
+ <groupId>commons-validator</groupId>
+ <artifactId>commons-validator</artifactId>
+ <version>1.3.1</version>
+ </dependency>
+
+ <!-- Interceptor API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- OWB Resource for Injections -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-resource</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- OWB Impl -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- JSF Plugin -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-jsf</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- EL Plugin -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-el10</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+
+ <!-- Web Plugin -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-web</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>jetty</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <version>6.1.22</version>
+ <configuration>
+ <scanIntervalSeconds>10</scanIntervalSeconds>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <!-- MyFaces IMPL -->
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <scope>compile</scope>
+ </dependency>
+
+ <!-- OpenJPA -->
+ <dependency>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa</artifactId>
+ <version>2.0.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <scope>compile</scope>
+ </dependency>
+
+ <!-- Interceptor API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+ <scope>compile</scope>
+ </dependency>
+
+ <!-- OWB Resource for Injections -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-resource</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <!-- OWB Impl -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <scope>compile</scope>
+ </dependency>
+
+ <!-- JSF Plugin -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-jsf</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <!-- EL Plugin -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-el10</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+
+ <!-- Web Plugin -->
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-web</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <!-- JPA API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jpa_2.0_spec</artifactId>
+ <scope>compile</scope>
+ </dependency>
+
+ </dependencies>
+ </profile>
+ </profiles>
+</project>
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/beans/LoginBean.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/beans/LoginBean.java
new file mode 100644
index 0000000..d4227db
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/beans/LoginBean.java
@@ -0,0 +1,143 @@
+/*
+ * 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.webbeans.reservation.beans;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Any;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.commons.validator.GenericValidator;
+import org.apache.webbeans.reservation.bindings.DatabaseLogin;
+import org.apache.webbeans.reservation.controller.LoginController;
+import org.apache.webbeans.reservation.entity.User;
+import org.apache.webbeans.reservation.events.LoggedInEvent;
+import org.apache.webbeans.reservation.util.JSFUtility;
+
+/**
+ * Contains login related managed bean functionality.
+ */
+@RequestScoped
+@Named
+public class LoginBean
+{
+ /**User name*/
+ private String userName;
+
+ /**Password*/
+ private String password;
+
+ /**Inject of the event instance*/
+ private @Inject @Any Event<LoggedInEvent> loggedInEvent;
+
+ /**Database related login controller*/
+ private @Inject @DatabaseLogin LoginController loginController;
+
+ /**
+ * Check user login.
+ *
+ * @return navigation result
+ */
+ public String login()
+ {
+ if(GenericValidator.isBlankOrNull(userName) || GenericValidator.isBlankOrNull(password))
+ {
+ JSFUtility.addErrorMessage("User name and password fields can not be empty", "");
+
+ return null;
+ }
+
+ User result = loginController.checkLogin(userName, password);
+
+ if(result == null)
+ {
+ JSFUtility.addErrorMessage("Login failed!,User name or password is not correct. Try again!", "");
+
+ return null;
+ }
+
+ User user = result;
+
+ //Fire Event
+ LoggedInEvent event = new LoggedInEvent(user);
+ loggedInEvent.fire(event);
+
+
+ if(user.isAdmin())
+ {
+ return "adminHome";
+ }
+
+ return "userHome";
+ }
+
+ /**
+ * Check user logout.
+ *
+ * @return navigation result
+ */
+ public String logout()
+ {
+ return null;
+ }
+
+ /**
+ * @return the userName
+ */
+ public String getUserName()
+ {
+ return userName;
+ }
+
+ /**
+ * This method got introduced to test OWB-595
+ * @return null and always throws a RuntimeException
+ */
+ public String createError()
+ {
+ throw new RuntimeException("Just to show OWB-595");
+ }
+
+ /**
+ * @param userName the userName to set
+ */
+ public void setUserName(String userName)
+ {
+ this.userName = userName;
+ }
+
+ /**
+ * @return the password
+ */
+ public String getPassword()
+ {
+ return password;
+ }
+
+ /**
+ * @param password the password to set
+ */
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
+
+
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/beans/LogoutBean.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/beans/LogoutBean.java
new file mode 100644
index 0000000..b507872
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/beans/LogoutBean.java
@@ -0,0 +1,51 @@
+/*
+ * 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.webbeans.reservation.beans;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Named;
+import javax.servlet.http.HttpSession;
+
+import org.apache.webbeans.reservation.util.JSFUtility;
+
+@RequestScoped
+@Named
+public class LogoutBean
+{
+
+ /**
+ * Logs out from the system.
+ *
+ * @return navigate output
+ */
+ public String logout()
+ {
+ HttpSession session = JSFUtility.getCurrentSession();
+
+ if(session != null)
+ {
+ session.invalidate();
+ }
+
+ JSFUtility.addInfoMessage("You have successfully logged out!", "");
+
+ return "login";
+ }
+
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/beans/RegisterBean.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/beans/RegisterBean.java
new file mode 100644
index 0000000..99ff1d5
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/beans/RegisterBean.java
@@ -0,0 +1,180 @@
+/*
+ * 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.webbeans.reservation.beans;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Default;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.apache.commons.logging.Log;
+import org.apache.webbeans.reservation.bindings.ApplicationLog;
+import org.apache.webbeans.reservation.controller.RegisterController;
+import org.apache.webbeans.reservation.util.JSFUtility;
+
+@Named(value="register")
+@RequestScoped
+public class RegisterBean
+{
+ private @Inject @ApplicationLog Log logger;
+
+ private String name;
+
+ private String surname;
+
+ private Integer age;
+
+ private String userName;
+
+ private String password;
+
+ private boolean admin;
+
+ private @Inject @Default RegisterController personController;
+
+ private @Inject @Default BeanManager manager;
+
+ public RegisterBean()
+ {
+
+ }
+
+ public String register()
+ {
+
+ logger.info("Registering the new user with user name : " + userName);
+
+ personController.registerUser(userName, password, name, surname, age, admin);
+
+ JSFUtility.addInfoMessage("User with name : " + userName + " is registered successfully.", "");
+
+ return "login";
+
+ }
+
+ @PostConstruct
+ public void init()
+ {
+ Bean<?> bean = manager.getBeans("logger").iterator().next();
+
+ logger = (Log)manager.getReference(bean, null, manager.createCreationalContext(bean));
+ }
+
+
+ /**
+ * @return the name
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * @return the surname
+ */
+ public String getSurname()
+ {
+ return surname;
+ }
+
+ /**
+ * @param surname the surname to set
+ */
+ public void setSurname(String surname)
+ {
+ this.surname = surname;
+ }
+
+ /**
+ * @return the age
+ */
+ public Integer getAge()
+ {
+ return age;
+ }
+
+ /**
+ * @param age the age to set
+ */
+ public void setAge(Integer age)
+ {
+ this.age = age;
+ }
+
+ /**
+ * @return the userName
+ */
+ public String getUserName()
+ {
+ return userName;
+ }
+
+ /**
+ * @param userName the userName to set
+ */
+ public void setUserName(String userName)
+ {
+ this.userName = userName;
+ }
+
+ /**
+ * @return the password
+ */
+ public String getPassword()
+ {
+ return password;
+ }
+
+ /**
+ * @param password the password to set
+ */
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
+
+ /**
+ * @return the admin
+ */
+ public boolean isAdmin()
+ {
+ return admin;
+ }
+
+ /**
+ * @param admin the admin to set
+ */
+ public void setAdmin(boolean admin)
+ {
+ this.admin = admin;
+ }
+
+
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/beans/admin/AdminBean.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/beans/admin/AdminBean.java
new file mode 100644
index 0000000..e806a10
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/beans/admin/AdminBean.java
@@ -0,0 +1,132 @@
+/*
+ * 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.webbeans.reservation.beans.admin;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Default;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.webbeans.reservation.controller.admin.AdminController;
+import org.apache.webbeans.reservation.util.JSFUtility;
+
+/**
+ * Admin JSF Bean.
+ */
+@RequestScoped
+@Named
+public class AdminBean
+{
+ private String name;
+
+ private String city;
+
+ private String country;
+
+ private Number star;
+
+ private @Inject @Default AdminController adminController;
+
+ /**
+ * Add new hotel
+ *
+ * @return navigation case
+ */
+ public String addNewHotel()
+ {
+ adminController.createNewHotel(name, star.intValue(), city, country);
+
+ JSFUtility.addInfoMessage("Hotel '" + name + "' is successfully created", "");
+
+ setCity(null);
+ setCountry(null);
+ setName(null);
+ setStar(null);
+
+
+ return null;
+
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * @return the city
+ */
+ public String getCity()
+ {
+ return city;
+ }
+
+ /**
+ * @param city the city to set
+ */
+ public void setCity(String city)
+ {
+ this.city = city;
+ }
+
+ /**
+ * @return the country
+ */
+ public String getCountry()
+ {
+ return country;
+ }
+
+ /**
+ * @param country the country to set
+ */
+ public void setCountry(String country)
+ {
+ this.country = country;
+ }
+
+ /**
+ * @return the star
+ */
+ public Number getStar()
+ {
+ return star;
+ }
+
+ /**
+ * @param star the star to set
+ */
+ public void setStar(Number star)
+ {
+ this.star = star;
+ }
+
+
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/beans/admin/AdminListBean.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/beans/admin/AdminListBean.java
new file mode 100644
index 0000000..b5b5182
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/beans/admin/AdminListBean.java
@@ -0,0 +1,175 @@
+/*
+ * 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.webbeans.reservation.beans.admin;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.Default;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.faces.component.html.HtmlDataTable;
+
+import org.apache.webbeans.reservation.controller.admin.AdminController;
+import org.apache.webbeans.reservation.entity.Hotel;
+import org.apache.webbeans.reservation.util.JSFUtility;
+
+@Named
+@SessionScoped
+public class AdminListBean implements Serializable
+{
+
+ private static final long serialVersionUID = 2552807646330035889L;
+
+ private List<Hotel> hotels = new ArrayList<Hotel>();
+
+ private HtmlDataTable model;
+
+ private @Inject @Default AdminController controller;
+
+ private Hotel selected;
+
+ private boolean renderedDetailPanel = false;
+
+
+ public String update()
+ {
+ if(selected == null)
+ {
+ JSFUtility.addErrorMessage("Pleasee select the hotel to update", "");
+
+ return null;
+ }
+
+ controller.updateHotel(selected.getId(), selected.getName(), selected.getStar(), selected.getCity(), selected.getCountry());
+
+ JSFUtility.addInfoMessage("Hotel with name " + selected.getName()+ " is succesfully updated." , "");
+
+
+ return null;
+ }
+
+ public String delete()
+ {
+ selected = (Hotel)model.getRowData();
+
+ if(selected == null)
+ {
+ JSFUtility.addErrorMessage("Pleasee select the hotel to delete", "");
+
+ return null;
+ }
+
+ controller.deleteHotel(selected.getId());
+
+ JSFUtility.addInfoMessage("Hotel with name " + selected.getName()+ " is succesfully deleted." , "");
+
+ this.selected.setCity(null);
+ this.selected.setCountry(null);
+ this.selected.setName(null);
+ this.selected.setStar(0);
+
+
+
+ return null;
+ }
+
+ public String getForUpdate()
+ {
+ Hotel hotel = (Hotel) model.getRowData();
+
+ this.selected = hotel;
+
+ setRenderedDetailPanel(true);
+
+
+ return null;
+ }
+
+ /**
+ * @return the hotels
+ */
+ public List<Hotel> getHotels()
+ {
+ hotels = controller.getHotels();
+
+ return hotels;
+ }
+
+ /**
+ * @param hotels the hotels to set
+ */
+ public void setHotels(List<Hotel> hotels)
+ {
+ this.hotels = hotels;
+ }
+
+ /**
+ * @return the model
+ */
+ public HtmlDataTable getModel()
+ {
+ return model;
+ }
+
+ /**
+ * @param model the model to set
+ */
+ public void setModel(HtmlDataTable model)
+ {
+ this.model = model;
+ }
+
+ /**
+ * @return the selected
+ */
+ public Hotel getSelected()
+ {
+ return selected;
+ }
+
+ /**
+ * @param selected the selected to set
+ */
+ public void setSelected(Hotel selected)
+ {
+ this.selected = selected;
+ }
+
+ /**
+ * @return the renderedDetailPanel
+ */
+ public boolean isRenderedDetailPanel()
+ {
+ return renderedDetailPanel;
+ }
+
+ /**
+ * @param renderedDetailPanel the renderedDetailPanel to set
+ */
+ public void setRenderedDetailPanel(boolean renderedDetailPanel)
+ {
+ this.renderedDetailPanel = renderedDetailPanel;
+ }
+
+
+
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/beans/admin/AdminListUser.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/beans/admin/AdminListUser.java
new file mode 100644
index 0000000..d527784
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/beans/admin/AdminListUser.java
@@ -0,0 +1,120 @@
+/*
+ * 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.webbeans.reservation.beans.admin;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Default;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.faces.component.html.HtmlDataTable;
+
+import org.apache.webbeans.reservation.controller.admin.AdminController;
+import org.apache.webbeans.reservation.entity.Hotel;
+import org.apache.webbeans.reservation.entity.User;
+
+@Named
+@RequestScoped
+public class AdminListUser
+{
+ private List<User> users = new ArrayList<User>();
+
+ private @Inject @Default AdminController controller;
+
+ private HtmlDataTable model;
+
+ private List<Hotel> hotels = new ArrayList<Hotel>();
+
+ public AdminListUser()
+ {
+
+ }
+
+ public String getReservations()
+ {
+ User user = (User) model.getRowData();
+
+ Set<Hotel> set = this.controller.getReservationsWithUser(user.getId());
+ for(Hotel hotel : set)
+ {
+ hotels.add(hotel);
+ }
+
+ return null;
+ }
+
+ /**
+ * @return the users
+ */
+ public List<User> getUsers()
+ {
+ this.users = this.controller.getUsers();
+
+ return this.users;
+ }
+
+ /**
+ * @param users the users to set
+ */
+ public void setUsers(List<User> users)
+ {
+ this.users = users;
+ }
+
+ /**
+ * @return the model
+ */
+ public HtmlDataTable getModel()
+ {
+ return model;
+ }
+
+ /**
+ * @param model the model to set
+ */
+ public void setModel(HtmlDataTable model)
+ {
+ this.model = model;
+ }
+
+ /**
+ * @return the hotels
+ */
+ public List<Hotel> getHotels()
+ {
+
+ return hotels;
+
+ }
+
+ /**
+ * @param hotels the hotels to set
+ */
+ public void setHotels(List<Hotel> hotels)
+ {
+ this.hotels = hotels;
+ }
+
+
+
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/beans/user/UserListBean.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/beans/user/UserListBean.java
new file mode 100644
index 0000000..b470771
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/beans/user/UserListBean.java
@@ -0,0 +1,105 @@
+/*
+ * 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.webbeans.reservation.beans.user;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Default;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.faces.component.html.HtmlDataTable;
+
+import org.apache.webbeans.reservation.controller.user.UserController;
+import org.apache.webbeans.reservation.entity.Reservation;
+import org.apache.webbeans.reservation.session.SessionTracker;
+import org.apache.webbeans.reservation.util.JSFUtility;
+
+@Named("listReservationBean")
+@RequestScoped
+public class UserListBean
+{
+
+ private List<Reservation> reservations = new ArrayList<Reservation>();
+
+ private HtmlDataTable model = null;
+
+ private @Inject @Default UserController controller;
+
+ private @Inject @Default SessionTracker tracker;
+
+ public UserListBean()
+ {
+
+ }
+
+ public String delete()
+ {
+ Reservation res = (Reservation)model.getRowData();
+
+ controller.deleteReservation(res.getId());
+
+ JSFUtility.addInfoMessage("Reservation is succesfully delete", "");
+
+
+ return null;
+ }
+
+ public String showReservations()
+ {
+ return "toReservePage";
+ }
+
+ /**
+ * @return the reservations
+ */
+ public List<Reservation> getReservations()
+ {
+ this.reservations = this.controller.getReservations(tracker.getUser().getId());
+
+ return reservations;
+ }
+
+ /**
+ * @param reservations the reservations to set
+ */
+ public void setReservations(List<Reservation> reservations)
+ {
+ this.reservations = reservations;
+ }
+
+ /**
+ * @return the model
+ */
+ public HtmlDataTable getModel()
+ {
+ return model;
+ }
+
+ /**
+ * @param model the model to set
+ */
+ public void setModel(HtmlDataTable model)
+ {
+ this.model = model;
+ }
+
+
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/beans/user/UserReservationBean.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/beans/user/UserReservationBean.java
new file mode 100644
index 0000000..7d59b01
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/beans/user/UserReservationBean.java
@@ -0,0 +1,296 @@
+/*
+ * 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.webbeans.reservation.beans.user;
+
+import java.io.Serializable;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.context.Conversation;
+import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.inject.Default;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.faces.component.html.HtmlDataTable;
+import javax.faces.model.SelectItem;
+
+import org.apache.webbeans.reservation.controller.admin.AdminController;
+import org.apache.webbeans.reservation.controller.user.UserController;
+import org.apache.webbeans.reservation.entity.Hotel;
+import org.apache.webbeans.reservation.model.ReservationModel;
+import org.apache.webbeans.reservation.session.SessionTracker;
+import org.apache.webbeans.reservation.util.JSFUtility;
+
+@Named
+@ConversationScoped
+public class UserReservationBean implements Serializable
+{
+ private static final long serialVersionUID = -5860989760497059459L;
+
+ private List<SelectItem> reservations = new ArrayList<SelectItem>();
+
+ private @Inject @Default UserController controller;
+
+ private List<Hotel> hotels = new ArrayList<Hotel>();
+
+ private @Inject @Default AdminController adminController;
+
+ private String reservationDate;
+
+ private HtmlDataTable model;
+
+ private @Inject @Default Conversation conversation;
+
+ private @Inject @Default SessionTracker tracker;
+
+ private Integer[] itemSelected = new Integer[0];
+
+ private Map<String, ReservationModel> models = new HashMap<String, ReservationModel>();
+
+ public UserReservationBean()
+ {
+ }
+
+
+ public String addReservation()
+ {
+ if(getReservationDate() == null)
+ {
+ JSFUtility.addErrorMessage("Reservation date can not be empty!", "");
+ return null;
+ }
+
+ Date date = null;
+ try
+ {
+ date = new SimpleDateFormat("dd/MM/yyyy").parse(getReservationDate());
+
+ }
+ catch(Exception e)
+ {
+
+ JSFUtility.addErrorMessage("Please give a date with dd/MM/yyyy", "");
+ return null;
+ }
+
+ if(conversation.isTransient())
+ {
+ conversation.begin();
+
+ JSFUtility.addInfoMessage("Reservation conversation with started with id : " + conversation.getId(), "");
+ }
+
+ Hotel hotel = (Hotel)model.getRowData();
+
+ SelectItem item = new SelectItem();
+ item.setValue(hotel.getId());
+ item.setLabel(hotel.getName());
+
+ if(contains(item.getValue()) != null)
+ {
+ JSFUtility.addErrorMessage("Given hotel is already added", "");
+
+ return null;
+ }
+
+ reservations.add(item);
+
+
+ ReservationModel model = new ReservationModel(item,date);
+ models.put(item.getValue().toString(), model);
+
+ return null;
+ }
+
+ private SelectItem contains(Object id)
+ {
+ for(SelectItem i : reservations)
+ {
+ if(i.getValue().toString().equals(id.toString()))
+ {
+ return i;
+ }
+ }
+
+ return null;
+
+ }
+
+ public String delete()
+ {
+ if(this.itemSelected.length == 0)
+ {
+ JSFUtility.addErrorMessage("Please select reservation to remove", "");
+
+ return null;
+ }
+
+ for(Integer i : this.itemSelected)
+ {
+ SelectItem item = contains(i);
+ if(item != null)
+ {
+ this.reservations.remove(item);
+
+ this.models.remove(item);
+ }
+ }
+
+
+ return null;
+ }
+
+ public String checkout()
+ {
+ if(conversation.isTransient())
+ {
+ JSFUtility.addErrorMessage("Conversation is not running! Please add hotel for reservation", "");
+ this.reservations.clear();
+ this.reservationDate = null;
+ }
+ else
+ {
+ this.controller.addReservation(models,tracker.getUser().getId());
+
+ conversation.end();
+
+ JSFUtility.addInfoMessage("Reservation are completed succesfully. Conversation with id "+conversation.getId() + " is ended ", "");
+
+ this.reservations.clear();
+
+ this.reservationDate = null;
+ }
+
+ return null;
+ }
+
+
+ /**
+ * @return the reservations
+ */
+ public List<SelectItem> getReservations()
+ {
+ return reservations;
+ }
+
+
+ public String clear()
+ {
+ this.reservations.clear();
+
+ this.reservationDate = null;
+
+ if(!conversation.isTransient())
+ {
+ this.conversation.end();
+ JSFUtility.addInfoMessage("Reservation are deleted succesfully. Conversation with id "+conversation.getId() + "is ended ", "");
+ }
+
+ return null;
+ }
+
+ /**
+ * @param reservations the reservations to set
+ */
+ public void setReservations(List<SelectItem> reservations)
+ {
+ this.reservations = reservations;
+ }
+
+
+ /**
+ * @return the hotels
+ */
+ public List<Hotel> getHotels()
+ {
+ this.hotels = this.adminController.getHotels();
+
+ return hotels;
+ }
+
+
+ /**
+ * @param hotels the hotels to set
+ */
+ public void setHotels(List<Hotel> hotels)
+ {
+ this.hotels = hotels;
+ }
+
+
+ /**
+ * @return the reservationDate
+ */
+ public String getReservationDate()
+ {
+ return reservationDate;
+ }
+
+
+ /**
+ * @param reservationDate the reservationDate to set
+ */
+ public void setReservationDate(String reservationDate)
+ {
+ this.reservationDate = reservationDate;
+ }
+
+
+ /**
+ * @return the model
+ */
+ public HtmlDataTable getModel()
+ {
+ return model;
+ }
+
+
+ /**
+ * @param model the model to set
+ */
+ public void setModel(HtmlDataTable model)
+ {
+ this.model = model;
+ }
+
+
+ /**
+ * @return the itemSelected
+ */
+ public Integer[] getItemSelected()
+ {
+
+ return itemSelected;
+ }
+
+
+ /**
+ * @param itemSelected the itemSelected to set
+ */
+ public void setItemSelected(Integer[] itemSelected)
+ {
+ this.itemSelected = itemSelected;
+ }
+
+
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/beans/user/UserUpdateBean.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/beans/user/UserUpdateBean.java
new file mode 100644
index 0000000..eb5b280
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/beans/user/UserUpdateBean.java
@@ -0,0 +1,169 @@
+/*
+ * 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.webbeans.reservation.beans.user;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Default;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.webbeans.reservation.controller.user.UserController;
+import org.apache.webbeans.reservation.entity.User;
+import org.apache.webbeans.reservation.session.SessionTracker;
+import org.apache.webbeans.reservation.util.JSFUtility;
+
+@Named
+@RequestScoped
+public class UserUpdateBean
+{
+ private String name;
+
+ private String surname;
+
+ private int age;
+
+ private String userName;
+
+ private String password;
+
+ private @Inject @Default UserController controller;
+
+ private @Inject @Default SessionTracker tracker;
+
+ public UserUpdateBean()
+ {
+
+ }
+
+ public String showInfo()
+ {
+ //Just show how can access session webbeans
+ User user = this.controller.getUser(tracker.getUser().getId());
+
+ setName(user.getName());
+ setSurname(user.getSurname());
+ setAge(user.getAge());
+ setUserName(user.getUserName());
+ setPassword(user.getPassword());
+
+ return "toUpdatePage";
+ }
+
+ public String clear()
+ {
+ setName("");
+ setSurname("");
+ setAge(0);
+ setUserName("");
+ setPassword("");
+
+ return null;
+ }
+
+ public String update()
+ {
+ this.controller.updateUserInfo(tracker.getUser().getId(), name, surname, age, userName, password);
+
+ JSFUtility.addInfoMessage("Personal information is succesfully updated.", "");
+
+ return null;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * @return the surname
+ */
+ public String getSurname()
+ {
+ return surname;
+ }
+
+ /**
+ * @param surname the surname to set
+ */
+ public void setSurname(String surname)
+ {
+ this.surname = surname;
+ }
+
+ /**
+ * @return the age
+ */
+ public int getAge()
+ {
+ return age;
+ }
+
+ /**
+ * @param age the age to set
+ */
+ public void setAge(int age)
+ {
+ this.age = age;
+ }
+
+ /**
+ * @return the userName
+ */
+ public String getUserName()
+ {
+ return userName;
+ }
+
+ /**
+ * @param userName the userName to set
+ */
+ public void setUserName(String userName)
+ {
+ this.userName = userName;
+ }
+
+ /**
+ * @return the password
+ */
+ public String getPassword()
+ {
+ return password;
+ }
+
+ /**
+ * @param password the password to set
+ */
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
+
+
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/bindings/ApplicationLog.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/bindings/ApplicationLog.java
new file mode 100644
index 0000000..ea1aae1
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/bindings/ApplicationLog.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.reservation.bindings;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.PARAMETER;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( {FIELD, METHOD, TYPE,PARAMETER})
+public @interface ApplicationLog
+{
+
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/bindings/DatabaseLogin.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/bindings/DatabaseLogin.java
new file mode 100644
index 0000000..4b3cb64
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/bindings/DatabaseLogin.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.reservation.bindings;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.PARAMETER;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( {FIELD, METHOD, TYPE,PARAMETER})
+public @interface DatabaseLogin
+{
+
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/bindings/EntityManagerQualifier.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/bindings/EntityManagerQualifier.java
new file mode 100644
index 0000000..6474b7b
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/bindings/EntityManagerQualifier.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.reservation.bindings;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.PARAMETER;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( {FIELD, METHOD, TYPE,PARAMETER})
+public @interface EntityManagerQualifier
+{
+
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/bindings/intercep/Transactional.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/bindings/intercep/Transactional.java
new file mode 100644
index 0000000..a0c0ef9
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/bindings/intercep/Transactional.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.reservation.bindings.intercep;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.interceptor.InterceptorBinding;
+
+@InterceptorBinding
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.TYPE, ElementType.METHOD })
+public @interface Transactional
+{
+
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/controller/LoginController.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/controller/LoginController.java
new file mode 100644
index 0000000..1e56d8f
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/controller/LoginController.java
@@ -0,0 +1,89 @@
+/*
+ * 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.webbeans.reservation.controller;
+
+import java.util.GregorianCalendar;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.commons.validator.GenericValidator;
+import org.apache.webbeans.reservation.bindings.DatabaseLogin;
+import org.apache.webbeans.reservation.bindings.EntityManagerQualifier;
+import org.apache.webbeans.reservation.bindings.intercep.Transactional;
+import org.apache.webbeans.reservation.controller.api.ILoginController;
+import org.apache.webbeans.reservation.entity.User;
+
+@DatabaseLogin
+@RequestScoped
+@Named
+public class LoginController implements ILoginController
+{
+ private Logger logger = Logger.getLogger(LoginController.class.getName());
+
+ /**Injection of the request scope entity manager*/
+ private @Inject @EntityManagerQualifier EntityManager entityManager;
+
+ /**
+ * Returns true if user exist else false
+ *
+ * @param userName user name
+ * @param password user password
+ * @return true if user exist else false
+ */
+ @Override
+ @Transactional
+ public User checkLogin(String userName, String password)
+ {
+ if(GenericValidator.isBlankOrNull(userName) || GenericValidator.isBlankOrNull(password))
+ {
+ logger.log(Level.WARNING, "UserName and Password is null");
+
+ return null;
+ }
+
+ Query query = entityManager.createQuery("select p from User p where " +
+ "p.userName=:userName and " +
+ "p.password=:password");
+
+ query.setParameter("userName", userName);
+ query.setParameter("password", password);
+
+ User value = null;
+ try
+ {
+ value =(User)query.getSingleResult();
+ value.setLastLoginDate(GregorianCalendar.getInstance().getTime());
+ }
+ catch(Exception e)
+ {
+ return null;
+ }
+
+
+ return value;
+ }
+
+
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/controller/RegisterController.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/controller/RegisterController.java
new file mode 100644
index 0000000..a483ff9
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/controller/RegisterController.java
@@ -0,0 +1,75 @@
+/*
+ * 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.webbeans.reservation.controller;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.validator.GenericValidator;
+import org.apache.webbeans.reservation.bindings.ApplicationLog;
+import org.apache.webbeans.reservation.bindings.EntityManagerQualifier;
+import org.apache.webbeans.reservation.bindings.intercep.Transactional;
+import org.apache.webbeans.reservation.controller.api.IRegisterController;
+import org.apache.webbeans.reservation.entity.User;
+import org.apache.webbeans.reservation.util.CalendarUtil;
+
+/**
+ * Controller responsible for registering operations.
+ */
+@RequestScoped
+public class RegisterController implements IRegisterController
+{
+ private @Inject @ApplicationLog Log logger;
+
+ private @Inject @EntityManagerQualifier EntityManager entityManager;
+
+ /**
+ * Register the user.
+ */
+ @Override
+ @Transactional
+ public User registerUser(String userName, String password, String name, String surname , int age, boolean admin)
+ {
+ logger.debug("Register a new user with user name : " + userName);
+
+ if(GenericValidator.isBlankOrNull(userName) || GenericValidator.isBlankOrNull(password))
+ {
+ logger.debug("Registering is failed. User name and password can not be null");
+ return null;
+ }
+
+ User user = new User();
+
+ user.setUserName(userName);
+ user.setPassword(password);
+ user.setName(name);
+ user.setSurname(surname);
+ user.setAge(age);
+ user.setRegisterDate(CalendarUtil.getCurrentDate());
+ user.setAdmin(admin);
+
+ entityManager.persist(user);
+
+
+ return user;
+ }
+
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/controller/admin/AdminController.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/controller/admin/AdminController.java
new file mode 100644
index 0000000..eb103b1
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/controller/admin/AdminController.java
@@ -0,0 +1,165 @@
+/*
+ * 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.webbeans.reservation.controller.admin;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.validator.GenericValidator;
+import org.apache.webbeans.reservation.bindings.ApplicationLog;
+import org.apache.webbeans.reservation.bindings.EntityManagerQualifier;
+import org.apache.webbeans.reservation.bindings.intercep.Transactional;
+import org.apache.webbeans.reservation.entity.Hotel;
+import org.apache.webbeans.reservation.entity.Reservation;
+import org.apache.webbeans.reservation.entity.User;
+
+/**
+ * Contains admin related activities.
+ */
+@Named
+@RequestScoped
+public class AdminController
+{
+ private @Inject @ApplicationLog Log logger;
+
+ private @Inject @EntityManagerQualifier EntityManager entityManager;
+
+ @Transactional
+ public void createNewHotel(String name, int star, String city, String country)
+ {
+
+ if(GenericValidator.isBlankOrNull(name) ||
+ GenericValidator.isBlankOrNull(city) ||
+ GenericValidator.isBlankOrNull(country))
+ {
+ logger.debug("Some of the parameters are missing to define hotel.");
+
+ return;
+ }
+
+ Hotel hotel = new Hotel();
+ hotel.setCity(city);
+ hotel.setCountry(country);
+ hotel.setName(name);
+ hotel.setStar(star);
+
+ entityManager.persist(hotel);
+
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<Hotel> getHotels()
+ {
+ Query query = this.entityManager.createQuery("select h from Hotel h");
+
+ return (List<Hotel>)query.getResultList();
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<User> getUsers()
+ {
+ Query query = this.entityManager.createQuery("select u from User u");
+
+ return (List<User>)query.getResultList();
+
+ }
+
+ /**
+ * Returns hotel with given id.
+ *
+ * @param id hotel id
+ * @return hotel
+ */
+ public Hotel getHotelWithId(int id)
+ {
+ Hotel hotel = this.entityManager.find(Hotel.class, id);
+
+ return hotel;
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<User> getReservationsWithHotel(int hotelId)
+ {
+ Query query = this.entityManager.createQuery("select u from User u join fetch u.reservations r where r.id=:id");
+ query.setParameter("id", hotelId);
+
+ List<User> users = query.getResultList();
+
+ return users;
+ }
+
+ public Set<Hotel> getReservationsWithUser(int userId)
+ {
+ Query query = this.entityManager.createQuery("select u from User u where u.id=:id");
+ query.setParameter("id", userId);
+
+ User user = (User)query.getSingleResult();
+
+ Set<Hotel> hotels = new HashSet<Hotel>();
+
+ Set<Reservation> reservations = user.getReservations();
+
+ for(Reservation reserve : reservations)
+ {
+ hotels.add(reserve.getHotel());
+ }
+
+ return hotels;
+ }
+
+
+ @Transactional
+ public void updateHotel(int id, String name, int star, String city, String country)
+ {
+ Hotel hotel = this.entityManager.find(Hotel.class, id);
+
+ hotel.setName(name);
+ hotel.setStar(star);
+ hotel.setCountry(country);
+ hotel.setCity(city);
+ }
+
+ @Transactional
+ @SuppressWarnings("unchecked")
+ public void deleteHotel(int id)
+ {
+ Hotel hotel = this.entityManager.find(Hotel.class, id);
+
+ this.entityManager.remove(hotel);
+
+ Query query = this.entityManager.createQuery("select r from Reservation r where r.hotel.id=:id");
+ query.setParameter("id",hotel.getId());
+
+ List<Reservation> res = query.getResultList();
+
+ for(Reservation r : res)
+ {
+ this.entityManager.remove(r);
+ }
+
+ }
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/controller/api/ILoginController.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/controller/api/ILoginController.java
new file mode 100644
index 0000000..d8c1fd7
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/controller/api/ILoginController.java
@@ -0,0 +1,28 @@
+/*
+ * 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.webbeans.reservation.controller.api;
+
+
+import org.apache.webbeans.reservation.entity.User;
+
+public interface ILoginController
+{
+ public User checkLogin(String userName, String password);
+
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/controller/api/IRegisterController.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/controller/api/IRegisterController.java
new file mode 100644
index 0000000..a7e59a9
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/controller/api/IRegisterController.java
@@ -0,0 +1,27 @@
+/*
+ * 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.webbeans.reservation.controller.api;
+
+import org.apache.webbeans.reservation.entity.User;
+
+public interface IRegisterController
+{
+ public User registerUser(String userName, String password, String name, String surname , int age, boolean admin);
+
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/controller/user/UserController.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/controller/user/UserController.java
new file mode 100644
index 0000000..6d792d0
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/controller/user/UserController.java
@@ -0,0 +1,138 @@
+/*
+ * 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.webbeans.reservation.controller.user;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.enterprise.context.RequestScoped;
+import javax.faces.model.SelectItem;
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+
+import org.apache.commons.logging.Log;
+import org.apache.webbeans.reservation.bindings.ApplicationLog;
+import org.apache.webbeans.reservation.bindings.EntityManagerQualifier;
+import org.apache.webbeans.reservation.bindings.intercep.Transactional;
+import org.apache.webbeans.reservation.entity.Hotel;
+import org.apache.webbeans.reservation.entity.Reservation;
+import org.apache.webbeans.reservation.entity.User;
+import org.apache.webbeans.reservation.model.ReservationModel;
+
+@RequestScoped
+public class UserController
+{
+ private @Inject @EntityManagerQualifier EntityManager entityManager;
+
+ private @Inject @ApplicationLog Log logger;
+
+ public UserController()
+ {
+
+ }
+
+ @PostConstruct
+ public void postConstruct()
+ {
+ System.out.println("Post Construct Sample .... " + UserController.class.getName() + " is instantiated");
+
+ }
+
+ @PreDestroy
+ public void preDestroy()
+ {
+ System.out.println("Pre Destroy Construct Sample .... " + UserController.class.getName() + " is destroyed by the container");
+ }
+
+ public User getUser(int id)
+ {
+ User user = this.entityManager.find(User.class, id);
+
+ return user;
+ }
+
+ @Transactional
+ public void updateUserInfo(int userId, String name, String surname, int age, String userName, String password)
+ {
+ logger.debug("Updating user with id : " + userId);
+
+ User user = this.entityManager.find(User.class, userId);
+
+ user.setName(name);
+ user.setSurname(surname);
+ user.setAge(age);
+ user.setUserName(userName);
+ user.setPassword(password);
+ }
+
+ @Transactional
+ public void addReservation(Map<String, ReservationModel> reservations, int userId)
+ {
+ User user = this.entityManager.find(User.class, userId);
+
+ Set<String> keys = reservations.keySet();
+
+ for(String item : keys)
+ {
+ ReservationModel rm = reservations.get(item);
+ SelectItem si = rm.getItem();
+ Hotel hotel = this.entityManager.find(Hotel.class, si.getValue());
+
+ Reservation reservation = new Reservation();
+
+ user.addHotel(reservation);
+
+ reservation.setHotel(hotel);
+ reservation.setReservationDate(rm.getDate());
+
+ this.entityManager.persist(reservation);
+ }
+
+ }
+
+ @Transactional
+ public void deleteReservation(int reservsitonId)
+ {
+ Reservation res = this.entityManager.find(Reservation.class, reservsitonId);
+ User user = res.getUser();
+
+ user.getReservations().remove(res);
+
+ this.entityManager.remove(res);
+ }
+
+ public List<Reservation> getReservations(int id)
+ {
+ User user = this.entityManager.find(User.class, id);
+
+ Set<Reservation> res = user.getReservations();
+
+ List<Reservation> l = new ArrayList<Reservation>();
+ for(Reservation r : res)
+ {
+ l.add(r);
+ }
+
+ return l;
+ }
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/entity/Hotel.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/entity/Hotel.java
new file mode 100644
index 0000000..0398bb1
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/entity/Hotel.java
@@ -0,0 +1,136 @@
+/*
+ * 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.webbeans.reservation.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Version;
+
+@Entity
+public class Hotel
+{
+ @Id
+ @GeneratedValue
+ private int id;
+
+ @Column(length=100,nullable=false)
+ private String name;
+
+ @Column
+ private int star;
+
+ @Column(nullable=false, length=100)
+ private String city;
+
+ @Column(nullable=false, length=100)
+ private String country;
+
+ @Version
+ private int version;
+
+ public Hotel()
+ {
+
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * @return the star
+ */
+ public int getStar()
+ {
+ return star;
+ }
+
+ /**
+ * @param star the star to set
+ */
+ public void setStar(int star)
+ {
+ this.star = star;
+ }
+
+ /**
+ * @return the city
+ */
+ public String getCity()
+ {
+ return city;
+ }
+
+ /**
+ * @param city the city to set
+ */
+ public void setCity(String city)
+ {
+ this.city = city;
+ }
+
+ /**
+ * @return the country
+ */
+ public String getCountry()
+ {
+ return country;
+ }
+
+ /**
+ * @param country the country to set
+ */
+ public void setCountry(String country)
+ {
+ this.country = country;
+ }
+
+ /**
+ * @return the id
+ */
+ public int getId()
+ {
+ return id;
+ }
+
+ /**
+ * @return the version
+ */
+ protected int getVersion()
+ {
+ return version;
+ }
+
+
+
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/entity/Reservation.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/entity/Reservation.java
new file mode 100644
index 0000000..79baa46
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/entity/Reservation.java
@@ -0,0 +1,129 @@
+/*
+ * 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.webbeans.reservation.entity;
+
+import java.util.Date;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToOne;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Version;
+
+@Entity
+public class Reservation
+{
+ @Id
+ @GeneratedValue
+ private int id;
+
+ @ManyToOne
+ private User user;
+
+ @OneToOne
+ private Hotel hotel;
+
+ @Temporal(TemporalType.DATE)
+ private Date reservationDate;
+
+ @Version
+ private int version;
+
+ public Reservation()
+ {
+
+ }
+
+ /**
+ * @return the user
+ */
+ public User getUser()
+ {
+ return user;
+ }
+
+ /**
+ * @param user the user to set
+ */
+ public void setUser(User user)
+ {
+ this.user = user;
+ }
+
+ /**
+ * @return the reservationDate
+ */
+ public Date getReservationDate()
+ {
+ return reservationDate;
+ }
+
+ /**
+ * @param reservationDate the reservationDate to set
+ */
+ public void setReservationDate(Date reservationDate)
+ {
+ this.reservationDate = reservationDate;
+ }
+
+ /**
+ * @return the version
+ */
+ public int getVersion()
+ {
+ return version;
+ }
+
+ /**
+ * @param version the version to set
+ */
+ public void setVersion(int version)
+ {
+ this.version = version;
+ }
+
+ /**
+ * @return the id
+ */
+ public int getId()
+ {
+ return id;
+ }
+
+ /**
+ * @return the hotel
+ */
+ public Hotel getHotel()
+ {
+ return hotel;
+ }
+
+ /**
+ * @param hotel the hotel to set
+ */
+ public void setHotel(Hotel hotel)
+ {
+ this.hotel = hotel;
+ }
+
+
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/entity/User.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/entity/User.java
new file mode 100644
index 0000000..4b13d71
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/entity/User.java
@@ -0,0 +1,256 @@
+/*
+ * 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.webbeans.reservation.entity;
+
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Version;
+
+@Entity
+public class User
+{
+ @Id
+ @GeneratedValue
+ private int id;
+
+ @Column(length=64,nullable=false)
+ private String name;
+
+ @Column(length=64,nullable=false)
+ private String surname;
+
+ @Column
+ private int age;
+
+ @Column(length=50,nullable=false,unique=true)
+ private String userName;
+
+ @Column(nullable=false,length=20)
+ private String password;
+
+ @Temporal(value=TemporalType.DATE)
+ private Date registerDate;
+
+ @OneToMany(mappedBy="user",cascade={CascadeType.ALL})
+ private Set<Reservation> reservations = new HashSet<Reservation>();
+
+ @Version
+ private int version;
+
+ @Column
+ private boolean admin;
+
+
+ @Temporal(value=TemporalType.TIMESTAMP)
+ private Date lastLoginDate;
+
+ public User()
+ {
+
+ }
+
+
+ /**
+ * @return the name
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * @return the surname
+ */
+ public String getSurname()
+ {
+ return surname;
+ }
+
+ /**
+ * @param surname the surname to set
+ */
+ public void setSurname(String surname)
+ {
+ this.surname = surname;
+ }
+
+ /**
+ * @return the age
+ */
+ public int getAge()
+ {
+ return age;
+ }
+
+ /**
+ * @param age the age to set
+ */
+ public void setAge(int age)
+ {
+ this.age = age;
+ }
+
+ /**
+ * @return the reservations
+ */
+ public Set<Reservation> getReservations()
+ {
+ return reservations;
+ }
+
+ /**
+ * @param reservations the reservations to set
+ */
+ public void setReservations(Set<Reservation> reservations)
+ {
+ this.reservations = reservations;
+ }
+
+ /**
+ * @return the id
+ */
+ public int getId()
+ {
+ return id;
+ }
+
+ public void addHotel(Reservation hotel)
+ {
+ this.reservations.add(hotel);
+
+ hotel.setUser(this);
+ }
+
+ /**
+ * @return the password
+ */
+ public String getPassword()
+ {
+ return password;
+ }
+
+ /**
+ * @param password the password to set
+ */
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
+
+
+ /**
+ * @return the userName
+ */
+ public String getUserName()
+ {
+ return userName;
+ }
+
+
+ /**
+ * @param userName the userName to set
+ */
+ public void setUserName(String userName)
+ {
+ this.userName = userName;
+ }
+
+
+ /**
+ * @return the version
+ */
+ public int getVersion()
+ {
+ return version;
+ }
+
+
+ /**
+ * @return the registerDate
+ */
+ public Date getRegisterDate()
+ {
+ return registerDate;
+ }
+
+
+ /**
+ * @param registerDate the registerDate to set
+ */
+ public void setRegisterDate(Date registerDate)
+ {
+ this.registerDate = registerDate;
+ }
+
+
+ /**
+ * @return the admin
+ */
+ public boolean isAdmin()
+ {
+ return admin;
+ }
+
+
+ /**
+ * @param admin the admin to set
+ */
+ public void setAdmin(boolean admin)
+ {
+ this.admin = admin;
+ }
+
+
+ /**
+ * @return the lastLoginDate
+ */
+ public Date getLastLoginDate()
+ {
+ return lastLoginDate;
+ }
+
+
+ /**
+ * @param lastLoginDate the lastLoginDate to set
+ */
+ public void setLastLoginDate(Date lastLoginDate)
+ {
+ this.lastLoginDate = lastLoginDate;
+ }
+
+
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/events/LoggedInEvent.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/events/LoggedInEvent.java
new file mode 100644
index 0000000..8a5c85e
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/events/LoggedInEvent.java
@@ -0,0 +1,41 @@
+/*
+ * 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.webbeans.reservation.events;
+
+
+import org.apache.webbeans.reservation.entity.User;
+
+/**
+ * Events that is fired when user logged into the system.
+ */
+public class LoggedInEvent
+{
+ private User user;
+
+ public LoggedInEvent(User user)
+ {
+ this.user = user;
+ }
+
+
+ public User getUser()
+ {
+ return this.user;
+ }
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/intercept/LoginDecorator.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/intercept/LoginDecorator.java
new file mode 100644
index 0000000..cf690f3
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/intercept/LoginDecorator.java
@@ -0,0 +1,51 @@
+/*
+ * 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.webbeans.reservation.intercept;
+
+
+import javax.decorator.Delegate;
+import javax.decorator.Decorator;
+import javax.inject.Inject;
+
+import org.apache.commons.logging.Log;
+import org.apache.webbeans.reservation.bindings.ApplicationLog;
+import org.apache.webbeans.reservation.bindings.DatabaseLogin;
+import org.apache.webbeans.reservation.controller.api.ILoginController;
+import org.apache.webbeans.reservation.entity.User;
+
+@Decorator
+public class LoginDecorator implements ILoginController
+{
+ @Inject @Delegate @DatabaseLogin ILoginController decorator;
+
+ private @Inject @ApplicationLog Log logger;
+
+ /* (non-Javadoc)
+ * @see org.apache.webbeans.reservation.controller.LoginController#checkLogin(java.lang.String, java.lang.String)
+ */
+ @Override
+ public User checkLogin(String userName, String password)
+ {
+ logger.info("Login process is started. Use tries to login with user name : " + userName );
+
+ return decorator.checkLogin(userName, password);
+ }
+
+
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/intercept/TransactionalInterceptor.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/intercept/TransactionalInterceptor.java
new file mode 100644
index 0000000..437d62d
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/intercept/TransactionalInterceptor.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.reservation.intercept;
+
+import javax.inject.Inject;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityTransaction;
+
+import org.apache.commons.logging.Log;
+import org.apache.webbeans.reservation.bindings.ApplicationLog;
+import org.apache.webbeans.reservation.bindings.EntityManagerQualifier;
+import org.apache.webbeans.reservation.bindings.intercep.Transactional;
+
+@Interceptor
+@Transactional
+public class TransactionalInterceptor
+{
+ private @Inject @EntityManagerQualifier EntityManager entityManager;
+
+ private @Inject @ApplicationLog Log logger;
+
+ @AroundInvoke
+ public Object invoke(InvocationContext context) throws Exception
+ {
+ EntityTransaction transaction = entityManager.getTransaction();
+
+ try
+ {
+ if(!transaction.isActive())
+ {
+ transaction.begin();
+ }
+
+ return context.proceed();
+
+ }
+ catch(Exception e)
+ {
+ logger.error("Exception in transactional method call", e);
+
+ if(transaction != null)
+ {
+ transaction.rollback();
+ }
+
+ throw e;
+
+ }
+ finally
+ {
+ if(transaction != null && transaction.isActive())
+ {
+ transaction.commit();
+ }
+ }
+
+ }
+
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/model/ReservationModel.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/model/ReservationModel.java
new file mode 100644
index 0000000..dce75b2
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/model/ReservationModel.java
@@ -0,0 +1,70 @@
+/*
+ * 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.webbeans.reservation.model;
+
+import java.util.Date;
+
+import javax.faces.model.SelectItem;
+
+public class ReservationModel
+{
+ private SelectItem item;
+
+ private Date date;
+
+ public ReservationModel(SelectItem item, Date date)
+ {
+ this.item = item;
+ this.date = date;
+ }
+
+ /**
+ * @return the item
+ */
+ public SelectItem getItem()
+ {
+ return item;
+ }
+
+ /**
+ * @param item the item to set
+ */
+ public void setItem(SelectItem item)
+ {
+ this.item = item;
+ }
+
+ /**
+ * @return the date
+ */
+ public Date getDate()
+ {
+ return date;
+ }
+
+ /**
+ * @param date the date to set
+ */
+ public void setDate(Date date)
+ {
+ this.date = date;
+ }
+
+
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/security/JSFSecurityPhaseListener.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/security/JSFSecurityPhaseListener.java
new file mode 100644
index 0000000..9a8c9de
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/security/JSFSecurityPhaseListener.java
@@ -0,0 +1,86 @@
+/*
+ * 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.webbeans.reservation.security;
+
+import java.io.IOException;
+
+import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+
+import org.apache.webbeans.reservation.entity.User;
+import org.apache.webbeans.reservation.session.SessionTracker;
+
+public class JSFSecurityPhaseListener implements PhaseListener
+{
+
+ private static final long serialVersionUID = -1308051590485364148L;
+
+ @Override
+ public void afterPhase(PhaseEvent event)
+ {
+ FacesContext context = event.getFacesContext();
+ String pathInfo = context.getExternalContext().getRequestServletPath();
+
+ if(pathInfo.startsWith("/admin") || pathInfo.startsWith("/user"))
+ {
+ SessionTracker tracker = null;
+ User user = null;
+ try
+ {
+ tracker = (SessionTracker)context.getApplication().evaluateExpressionGet(context, "#{sessionTracker}", SessionTracker.class);
+ user = tracker.getUser();
+
+ }
+ catch(Exception e)
+ {
+ //Tracker is null
+ System.out.println("Context is not active");
+ }
+
+ if(tracker == null || user == null)
+ {
+ try
+ {
+ context.getExternalContext().redirect(context.getExternalContext().getRequestContextPath() + "/login.jsf");
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ }
+
+
+ }
+
+ @Override
+ public void beforePhase(PhaseEvent event)
+ {
+ }
+
+ @Override
+ public PhaseId getPhaseId()
+ {
+ return PhaseId.RESTORE_VIEW;
+ }
+
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/session/SessionTracker.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/session/SessionTracker.java
new file mode 100644
index 0000000..10cbf9b
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/session/SessionTracker.java
@@ -0,0 +1,65 @@
+/*
+ * 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.webbeans.reservation.session;
+
+
+import java.io.Serializable;
+
+
+import org.apache.webbeans.reservation.entity.User;
+import org.apache.webbeans.reservation.events.LoggedInEvent;
+
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.event.Observes;
+import javax.inject.Named;
+
+@SessionScoped
+@Named
+public class SessionTracker implements Serializable
+{
+ private static final long serialVersionUID = 6365740106065427860L;
+
+ private User user;
+
+ /**
+ * When event fires, this observer method is called
+ * by the {@link javax.enterprise.inject.spi.BeanManager} interface.
+ *
+ * @param loggedInEvent event
+ */
+ public void userAdded(@Observes LoggedInEvent loggedInEvent)
+ {
+ this.user = loggedInEvent.getUser();
+ }
+
+ public User getUser()
+ {
+ return this.user;
+ }
+
+ /**
+ * @param user the user to set
+ */
+ public void setUser(User user)
+ {
+ this.user = user;
+ }
+
+
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/CalendarUtil.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/CalendarUtil.java
new file mode 100644
index 0000000..f292bb2
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/CalendarUtil.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.reservation.util;
+
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+public class CalendarUtil
+{
+
+ /**
+ * Gets date.
+ *
+ * @return the date
+ */
+ public static Date getCurrentDate()
+ {
+ return GregorianCalendar.getInstance().getTime();
+ }
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/EntityManagerUtil.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/EntityManagerUtil.java
new file mode 100644
index 0000000..bbf4f2d
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/EntityManagerUtil.java
@@ -0,0 +1,48 @@
+/*
+ * 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.webbeans.reservation.util;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+@RequestScoped
+public class EntityManagerUtil
+{
+ private @PersistenceContext(unitName="reservation") EntityManager entityManager;
+
+ public EntityManagerUtil()
+ {
+
+ }
+
+ @Produces @RequestScoped @org.apache.webbeans.reservation.bindings.EntityManagerQualifier
+ public EntityManager createEntityManager()
+ {
+ return entityManager;
+ }
+
+ public void dispose(@Disposes @org.apache.webbeans.reservation.bindings.EntityManagerQualifier EntityManager entityManager)
+ {
+ entityManager.close();
+ }
+
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/JSFUtility.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/JSFUtility.java
new file mode 100644
index 0000000..07fb851
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/JSFUtility.java
@@ -0,0 +1,84 @@
+/*
+ * 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.webbeans.reservation.util;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.application.FacesMessage.Severity;
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpSession;
+
+/**
+ * Simple JSF Utility methods.
+ */
+public class JSFUtility
+{
+
+ /**
+ * Getting current faces context
+ *
+ * @return current context
+ */
+ public static FacesContext getCurrentContext()
+ {
+ return FacesContext.getCurrentInstance();
+ }
+
+ /**
+ * Gets current http session
+ *
+ * @return current http session
+ */
+ public static HttpSession getCurrentSession()
+ {
+ HttpSession session = (HttpSession) getCurrentContext().getExternalContext().getSession(false);
+
+ return session;
+ }
+
+ /**
+ * Creates and adds error message.
+ *
+ * @param summary summary
+ * @param detail detail
+ */
+ public static void addInfoMessage(String summary, String detail)
+ {
+ addMessage(summary, detail, FacesMessage.SEVERITY_INFO);
+ }
+
+ /**
+ * Creates and adds error message.
+ *
+ * @param summary summary
+ * @param detail detail
+ */
+ public static void addErrorMessage(String summary, String detail)
+ {
+ addMessage(summary, detail, FacesMessage.SEVERITY_ERROR);
+ }
+
+
+ private static void addMessage(String summary, String detail, Severity severity)
+ {
+ FacesMessage facesMessage = new FacesMessage(severity,summary,detail);
+
+ getCurrentContext().addMessage(null, facesMessage);
+
+ }
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/LogUtil.java b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/LogUtil.java
new file mode 100644
index 0000000..c65b7de
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/LogUtil.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.reservation.util;
+
+import javax.inject.Named;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.webbeans.reservation.bindings.ApplicationLog;
+
+public class LogUtil
+{
+
+ @Produces @ApplicationLog @Named
+ public Log getLogger(InjectionPoint injectionPoint)
+ {
+ Class<?> clazz = injectionPoint.getMember().getDeclaringClass();
+
+ return LogFactory.getLog(clazz);
+ }
+
+}
diff --git a/owb_1.2.x/samples/reservation/src/main/resources/META-INF/beans.xml b/owb_1.2.x/samples/reservation/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000..b8cc112
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,30 @@
+<?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.
+-->
+<WebBeans xmlns="urn:java:ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:java:ee http://java.sun.com/jee/beans-1.0.xsd">
+ <decorators>
+ <class>org.apache.webbeans.reservation.intercept.LoginDecorator</class>
+ </decorators>
+
+ <interceptors>
+ <class>org.apache.webbeans.reservation.intercept.TransactionalInterceptor</class>
+ </interceptors>
+</WebBeans>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/reservation/src/main/resources/META-INF/persistence.xml b/owb_1.2.x/samples/reservation/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..8eae3a3
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,41 @@
+<?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.
+-->
+
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+ version="1.0">
+
+ <persistence-unit name="reservation" transaction-type="RESOURCE_LOCAL">
+ <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+
+ <class>org.apache.webbeans.reservation.entity.Hotel</class>
+ <class>org.apache.webbeans.reservation.entity.User</class>
+ <class>org.apache.webbeans.reservation.entity.Reservation</class>
+
+ <properties>
+ <property name="openjpa.jdbc.DBDictionary" value="hsql" />
+ <property name="openjpa.ConnectionDriverName" value="org.hsqldb.jdbcDriver" />
+ <property name="openjpa.ConnectionURL" value="jdbc:hsqldb:mem:test" />
+ <property name="openjpa.ConnectionUserName" value="sa" />
+ <property name="openjpa.ConnectionPassword" value="" />
+ <property name="openjpa.Log" value="DefaultLevel=TRACE"/>
+ <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+ </properties>
+
+ </persistence-unit>
+</persistence>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/reservation/src/main/webapp/META-INF/MANIFEST.MF b/owb_1.2.x/samples/reservation/src/main/webapp/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..254272e
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/webapp/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
diff --git a/owb_1.2.x/samples/reservation/src/main/webapp/WEB-INF/beans.xml b/owb_1.2.x/samples/reservation/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 0000000..1526988
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<WebBeans xmlns="urn:java:ee"
+ xmlns:myapp="urn:java:org.apache.webbeans.reservation.intercept"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:java:ee http://java.sun.com/jee/beans-1.0.xsd">
+</WebBeans>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/reservation/src/main/webapp/WEB-INF/faces-config.xml b/owb_1.2.x/samples/reservation/src/main/webapp/WEB-INF/faces-config.xml
new file mode 100644
index 0000000..39f8aaf
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/webapp/WEB-INF/faces-config.xml
@@ -0,0 +1,66 @@
+<?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.
+-->
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">
+ <navigation-rule>
+ <from-view-id>*</from-view-id>
+ <navigation-case>
+ <from-outcome>register</from-outcome>
+ <to-view-id>/register.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>*</from-view-id>
+ <navigation-case>
+ <from-outcome>login</from-outcome>
+ <to-view-id>/login.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/login.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>adminHome</from-outcome>
+ <to-view-id>/admin/menu.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>userHome</from-outcome>
+ <to-view-id>/user/menu.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>*</from-view-id>
+ <navigation-case>
+ <from-outcome>toUpdatePage</from-outcome>
+ <to-view-id>/user/updateInfo.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>*</from-view-id>
+ <navigation-case>
+ <from-outcome>toReservePage</from-outcome>
+ <to-view-id>/user/listReservations.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+
+ <lifecycle>
+ <phase-listener>org.apache.webbeans.reservation.security.JSFSecurityPhaseListener</phase-listener>
+ </lifecycle>
+</faces-config>
diff --git a/owb_1.2.x/samples/reservation/src/main/webapp/WEB-INF/web.xml b/owb_1.2.x/samples/reservation/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..f7315e6
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,50 @@
+<?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.
+-->
+<web-app id="WebApp_ID" version="2.5"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+ <display-name>guess</display-name>
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+ <listener>
+ <listener-class>org.apache.webbeans.servlet.WebBeansConfigurationListener</listener-class>
+ </listener>
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.xhtml</url-pattern>
+ </servlet-mapping>
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ </welcome-file-list>
+ <error-page>
+ <exception-type>java.lang.Exception</exception-type>
+ <location>/src/main/webapp/index.html</location>
+ </error-page>
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ </login-config>
+</web-app>
diff --git a/owb_1.2.x/samples/reservation/src/main/webapp/admin/defineHotel.xhtml b/owb_1.2.x/samples/reservation/src/main/webapp/admin/defineHotel.xhtml
new file mode 100644
index 0000000..8e98fc1
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/webapp/admin/defineHotel.xhtml
@@ -0,0 +1,81 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<head>
+ <title>OpenWebBeans :: Examples :: Reservation</title>
+ <link type="text/css" rel="stylesheet" href="#{facesContext.externalContext.requestContextPath}/main.css"/>
+</head>
+
+<body>
+
+<ui:composition template="/admin/menu.xhtml">
+
+ <ui:define name="caption">
+ <h:outputText value="Define New Hotel" styleClass="captionTitle" />
+ </ui:define>
+
+ <ui:define name="body">
+
+ <h:form id="form">
+
+ <h:panelGrid columns="2" styleClass="table" cellspacing="2" cellpadding="5" columnClasses="leftColumns,rightColumns">
+
+ <h:outputLabel for="name">
+ <h:outputText value="Name" />
+ </h:outputLabel>
+
+ <h:inputText value="#{adminBean.name}" id="name" required="true" requiredMessage="Name is required!"/>
+
+ <h:outputLabel for="star">
+ <h:outputText value="Star" />
+ </h:outputLabel>
+
+ <h:inputText value="#{adminBean.star}" id="star" required="true" requiredMessage="Star is required!" converterMessage="Star must between [1-5]" validatorMessage="Star must between [1-5]">
+ <f:convertNumber integerOnly="true"/>
+ <f:validateLongRange maximum="5" minimum="1"/>
+ </h:inputText>
+
+ <h:outputLabel for="city">
+ <h:outputText value="City" />
+ </h:outputLabel>
+
+ <h:inputText value="#{adminBean.city}" id="city" required="true" requiredMessage="City is required">
+ </h:inputText>
+
+ <h:outputLabel for="country">
+ <h:outputText value="Country" />
+ </h:outputLabel>
+
+ <h:inputText value="#{adminBean.country}" id="country" required="true" requiredMessage="Country name is required!">
+ </h:inputText>
+
+
+ <h:commandButton action="#{adminBean.addNewHotel}" value="Add Hotel" />
+
+ </h:panelGrid>
+ </h:form>
+ </ui:define>
+</ui:composition>
+</body>
+</html>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/reservation/src/main/webapp/admin/listHotels.xhtml b/owb_1.2.x/samples/reservation/src/main/webapp/admin/listHotels.xhtml
new file mode 100644
index 0000000..2cdcae0
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/webapp/admin/listHotels.xhtml
@@ -0,0 +1,117 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<head>
+ <title>OpenWebBeans :: Examples :: Reservation</title>
+ <link type="text/css" rel="stylesheet" href="#{facesContext.externalContext.requestContextPath}/main.css"/>
+</head>
+
+<body>
+
+<ui:composition template="/admin/menu.xhtml">
+
+ <ui:define name="caption">
+ <h:outputText value="List Hotels" styleClass="captionTitle" />
+ </ui:define>
+
+ <ui:define name="body">
+
+ <h:form id="form">
+
+ <h:dataTable id="dt" cellpadding="5" value="#{adminListBean.hotels}" binding="#{adminListBean.model}" var="model" styleClass="table dataTable" rowClasses="oddRow,evenRow">
+
+ <h:column id="dt1">
+ <f:facet name="header">
+ <h:outputText id="col1" value="Name" />
+ </f:facet>
+
+ <h:outputText id="col11" value="#{model.name}" />
+ </h:column>
+
+ <h:column id="dt2">
+ <f:facet name="header">
+ <h:outputText id="col2" value="Star" />
+ </f:facet>
+
+ <h:outputText id="col22" value="#{model.star}" />
+ </h:column>
+
+ <h:column id="dt5">
+ <h:commandLink action="#{adminListBean.getForUpdate}" value="Show Detail" />
+ </h:column>
+
+ <h:column id="dt6">
+ <h:commandLink action="#{adminListBean.delete}" value="Delete" />
+ </h:column>
+
+
+ </h:dataTable>
+
+ </h:form>
+
+ <div class="caption">
+ <h:outputText value="Hotel Details" styleClass="captionTitle" />
+ </div>
+
+ <h:form>
+ <h:panelGrid columns="2" styleClass="table" cellspacing="2" cellpadding="5" columnClasses="leftColumns,rightColumns">
+
+ <h:outputLabel for="name">
+ <h:outputText value="Name" />
+ </h:outputLabel>
+
+ <h:inputText value="#{adminListBean.selected.name}" id="name" required="true" requiredMessage="Name is required!"/>
+
+ <h:outputLabel for="star">
+ <h:outputText value="Star" />
+ </h:outputLabel>
+
+ <h:inputText value="#{adminListBean.selected.star}" id="star" required="true" requiredMessage="Star is required!" converterMessage="Star must between [1-5]" validatorMessage="Star must between [1-5]">
+ <f:validateLongRange maximum="5" minimum="1"/>
+ </h:inputText>
+
+ <h:outputLabel for="city">
+ <h:outputText value="City" id="cityCol" />
+ </h:outputLabel>
+
+ <h:inputText value="#{adminListBean.selected.city}" id="city" required="true" requiredMessage="City is required">
+ </h:inputText>
+
+ <h:outputLabel for="country">
+ <h:outputText id="countryCol" value="Country" />
+ </h:outputLabel>
+
+ <h:inputText value="#{adminListBean.selected.country}" id="country" required="true" requiredMessage="Country name is required!">
+ </h:inputText>
+
+ <f:verbatim></f:verbatim>
+ <h:commandButton action="#{adminListBean.update}" value="Update" />
+
+ </h:panelGrid>
+ </h:form>
+
+ </ui:define>
+</ui:composition>
+</body>
+</html>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/reservation/src/main/webapp/admin/listUsers.xhtml b/owb_1.2.x/samples/reservation/src/main/webapp/admin/listUsers.xhtml
new file mode 100644
index 0000000..17d32ef
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/webapp/admin/listUsers.xhtml
@@ -0,0 +1,143 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<head>
+ <title>OpenWebBeans :: Examples :: Reservation</title>
+ <link type="text/css" rel="stylesheet" href="#{facesContext.externalContext.requestContextPath}/main.css"/>
+</head>
+
+<body>
+
+<ui:composition template="/admin/menu.xhtml">
+
+ <ui:define name="caption">
+ <h:outputText value="List Users" styleClass="captionTitle" />
+ </ui:define>
+
+ <ui:define name="body">
+
+ <h:form id="form">
+
+ <h:dataTable id="dt" cellpadding="5" value="#{adminListUser.users}" binding="#{adminListUser.model}" var="model" styleClass="table dataTable" rowClasses="oddRow,evenRow">
+
+ <h:column id="dt1">
+ <f:facet name="header">
+ <h:outputText id="col1" value="Name" />
+ </f:facet>
+
+ <h:outputText id="col11" value="#{model.name}" />
+ </h:column>
+
+ <h:column id="dt2">
+ <f:facet name="header">
+ <h:outputText id="col2" value="Surname" />
+ </f:facet>
+
+ <h:outputText id="col221" value="#{model.surname}" />
+ </h:column>
+
+ <h:column id="dt3">
+ <f:facet name="header">
+ <h:outputText id="col3" value="Age" />
+ </f:facet>
+
+ <h:outputText id="col222" value="#{model.age}" />
+ </h:column>
+
+ <h:column id="dt4">
+ <f:facet name="header">
+ <h:outputText id="col4" value="User Name" />
+ </f:facet>
+
+ <h:outputText id="col223" value="#{model.userName}" />
+ </h:column>
+
+ <h:column id="dt5">
+ <f:facet name="header">
+ <h:outputText id="col5" value="Password" />
+ </f:facet>
+
+ <h:outputText id="col224" value="#{model.password}" />
+ </h:column>
+
+ <h:column id="dt6">
+ <f:facet name="header">
+ <h:outputText id="col6" value="Registered Date" />
+ </f:facet>
+
+ <h:outputText id="col225" value="#{model.registerDate}" />
+ </h:column>
+
+ <h:column id="dt7">
+ <h:commandLink action="#{adminListUser.getReservations}" value="Show Reservations" />
+ </h:column>
+
+ </h:dataTable>
+
+ <div class="caption">
+ <h:outputText value="List Reservations" styleClass="captionTitle" />
+ </div>
+
+ <h:dataTable id="dt2" cellpadding="5" value="#{adminListUser.hotels}" var="model" styleClass="table dataTable" rowClasses="oddRow,evenRow">
+
+ <h:column id="dt21">
+ <f:facet name="header">
+ <h:outputText id="col1" value="Name" />
+ </f:facet>
+
+ <h:outputText id="col111" value="#{model.name}" />
+ </h:column>
+
+ <h:column id="dt22">
+ <f:facet name="header">
+ <h:outputText id="col222" value="Star" />
+ </f:facet>
+
+ <h:outputText id="col322" value="#{model.star}" />
+ </h:column>
+
+ <h:column id="dt23">
+ <f:facet name="header">
+ <h:outputText id="col2" value="City" />
+ </f:facet>
+
+ <h:outputText id="col42" value="#{model.city}" />
+ </h:column>
+
+ <h:column id="dt24">
+ <f:facet name="header">
+ <h:outputText id="co5l2" value="Country" />
+ </f:facet>
+
+ <h:outputText id="col622" value="#{model.country}" />
+ </h:column>
+
+
+ </h:dataTable>
+
+ </h:form>
+ </ui:define>
+</ui:composition>
+</body>
+</html>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/reservation/src/main/webapp/admin/menu.xhtml b/owb_1.2.x/samples/reservation/src/main/webapp/admin/menu.xhtml
new file mode 100644
index 0000000..aca51df
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/webapp/admin/menu.xhtml
@@ -0,0 +1,79 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<head>
+ <title>OpenWebBeans :: Examples :: Reservation</title>
+ <link type="text/css" rel="stylesheet" href="#{facesContext.externalContext.requestContextPath}/main.css"/>
+</head>
+
+<body>
+
+<div id="main">
+
+ <h:messages globalOnly="false" showSummary="true" infoClass="message infoMessage" errorClass="message errorMessage"></h:messages>
+
+ <div class="logout">
+
+ <h:outputLink value="#{facesContext.externalContext.requestContextPath}/admin/menu.xhtml" style="float:left;">
+ <h:outputText value="Home Page" />
+ </h:outputLink>
+
+ <h:form style="margin-left:10px;float:left;">
+ <h:commandLink action="#{logoutBean.logout}" value="Logout"/>
+ </h:form>
+ </div>
+
+
+ <div class="caption">
+ <h:outputText value="Welcome, "/>
+ <h:outputText value="#{sessionTracker.user.name} #{sessionTracker.user.surname}" style="color:red;font-weight:bold;"/>
+
+ <br/>
+
+ <h:outputText value="Last Login Date : "/>
+ <h:outputText value="#{sessionTracker.user.lastLoginDate}" style="color:red;font-weight:bold;"/>
+
+ <ul style="display: block;margin-top: 15px;clear: both;">
+ <h:outputLink value="#{facesContext.externalContext.requestContextPath}/admin/defineHotel.xhtml" styleClass="menuItem">
+ <h:outputText value="Define New Hotel" />
+ </h:outputLink>
+
+ <h:outputLink value="#{facesContext.externalContext.requestContextPath}/admin/listHotels.xhtml" styleClass="menuItem">
+ <h:outputText value="List Hotels" />
+ </h:outputLink>
+
+ <h:outputLink value="#{facesContext.externalContext.requestContextPath}/admin/listUsers.xhtml" styleClass="menuItem">
+ <h:outputText value="Show User Reservations" />
+ </h:outputLink>
+ </ul>
+
+ <ui:insert name="caption"></ui:insert>
+
+ </div>
+
+ <ui:insert name="body"></ui:insert>
+
+</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/reservation/src/main/webapp/index.html b/owb_1.2.x/samples/reservation/src/main/webapp/index.html
new file mode 100644
index 0000000..61a8bed
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/webapp/index.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <meta http-equiv="Refresh" content="0; URL=login.xhtml">
+</head>
+</html>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/reservation/src/main/webapp/login.xhtml b/owb_1.2.x/samples/reservation/src/main/webapp/login.xhtml
new file mode 100644
index 0000000..d7992f1
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/webapp/login.xhtml
@@ -0,0 +1,77 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+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.
+-->
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<head>
+ <title>OpenWebBeans :: Examples :: Reservation</title>
+ <link type="text/css" rel="stylesheet" href="#{facesContext.externalContext.requestContextPath}/main.css"/>
+</head>
+
+<body>
+
+<div id="main">
+
+
+ <h:messages globalOnly="false" showSummary="true" infoClass="message infoMessage" errorClass="message errorMessage"></h:messages>
+
+
+ <div class="caption">
+ <h:outputText value="User Logged-In Page" />
+ <div align="center" style="font-size: 14px;color: #203360">
+ Apache OpenWebBeans Hotel Reservation Sample Using JPA, JSF and OWB;
+ </div>
+ </div>
+
+ <h:form id="form">
+
+ <h:panelGrid columns="2" styleClass="table" cellspacing="2">
+
+ <h:outputLabel for="userName">
+ <h:outputText value="User Name" />
+ </h:outputLabel>
+
+ <h:inputText id="userName" value="#{loginBean.userName}"></h:inputText>
+
+ <h:outputLabel for="password">
+ <h:outputText value="User Password"></h:outputText>
+ </h:outputLabel>
+
+ <h:inputSecret id="password" value="#{loginBean.password}"></h:inputSecret>
+
+ <h:panelGroup>
+ <h:commandButton action="#{loginBean.login}" value="Login" />
+ <h:commandButton action="false" value="Clear Form" onclick="document.forms[0].reset();document.getElementById('form:userName').focus();return false;" />
+ <h:commandButton action="#{loginBean.createError}" value="Create an Error" />
+ </h:panelGroup>
+
+ <h:outputLink value="#{facesContext.externalContext.requestContextPath}/register.xhtml">
+ <h:outputText value="Not a registered! Register here..." />
+ </h:outputLink>
+
+ </h:panelGrid>
+
+ </h:form>
+</div>
+</body>
+</html>
diff --git a/owb_1.2.x/samples/reservation/src/main/webapp/main.css b/owb_1.2.x/samples/reservation/src/main/webapp/main.css
new file mode 100644
index 0000000..828b6b2
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/webapp/main.css
@@ -0,0 +1,109 @@
+/*
+ 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.
+*/
+
+body{
+
+ font-size: 12px;
+ margin: 0px;
+ padding: 0px;
+ margin: auto;
+ width: 980px;
+}
+
+#main{
+ margin: auto;
+}
+
+.logout{
+ float: right;
+ font-weight: bold;
+ color: black;
+ font-size: 14px;
+}
+
+.caption{
+ padding : 10px;
+ border-bottom: 10px solid black;
+ font-weight: bold;
+ color: gray;
+ text-align: left;
+}
+
+.captionTitle{
+ color: #880000;
+ font-size: 14px;
+}
+
+.menuItem{
+ padding: 10px;
+ font-weight: bold;
+ color: #203360;
+ text-decoration: none;
+}
+
+.table{
+ border : 1px solid black;
+ border-collapse: collapse;
+}
+
+.dataTable{
+
+ margin : 15px 0px;
+}
+
+.oddRow{
+ border: 1px solid black;
+ background-color: #FFF9D7;
+}
+
+.evenRow{
+ border: 1px solid black;
+}
+
+
+.leftColumns{
+ text-align: right;
+}
+
+.rightColumns{
+ text-align: left;
+}
+
+
+.message{
+ margin : 10px 10px 10px 25px;
+ padding : 15px;
+ font-size: 12px;
+ font-weight: bold;
+ display: block;
+ list-style-type: none;
+ list-style-image: none;
+}
+
+.errorMessage{
+ background-color: #FFEBE8;
+ border : 1px solid #DD3C10;
+ color: black;
+}
+
+.infoMessage{
+ background-color:#FFF9D7;
+ border: 1px solid #E2C822;
+ color: #333333;
+}
\ No newline at end of file
diff --git a/owb_1.2.x/samples/reservation/src/main/webapp/register.xhtml b/owb_1.2.x/samples/reservation/src/main/webapp/register.xhtml
new file mode 100644
index 0000000..7bef578
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/webapp/register.xhtml
@@ -0,0 +1,94 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+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.
+-->
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<head>
+ <title>OpenWebBeans :: Examples :: Reservation</title>
+ <link type="text/css" rel="stylesheet" href="#{facesContext.externalContext.requestContextPath}/main.css"/>
+</head>
+
+<body>
+
+<div id="main">
+
+ <h:messages globalOnly="false" showSummary="true" infoClass="message infoMessage" errorClass="message errorMessage"></h:messages>
+
+ <div class="caption">
+ <h:outputText value="New User Register" />
+ </div>
+
+ <h:form id="form">
+
+ <h:panelGrid columns="2" styleClass="table" cellspacing="2" cellpadding="5" columnClasses="leftColumns,rightColumns">
+
+ <h:outputLabel for="name">
+ <h:outputText value="Name" />
+ </h:outputLabel>
+
+ <h:inputText value="#{register.name}" id="name" required="true" requiredMessage="Name is required!"/>
+
+ <h:outputLabel for="surname">
+ <h:outputText value="Surname" />
+ </h:outputLabel>
+
+ <h:inputText value="#{register.surname}" id="surname" required="true" requiredMessage="Surname is required!"/>
+
+ <h:outputLabel for="age">
+ <h:outputText value="Age" />
+ </h:outputLabel>
+
+ <h:inputText value="#{register.age}" id="age" required="true" requiredMessage="Age is required">
+ </h:inputText>
+
+ <h:outputLabel for="userName">
+ <h:outputText value="User Name" />
+ </h:outputLabel>
+
+ <h:inputText value="#{register.userName}" id="userName" required="true" requiredMessage="User name is required and minumum 8 characters!">
+ <f:validateLength minimum="8" maximum="50"/>
+ </h:inputText>
+
+ <h:outputLabel for="password">
+ <h:outputText value="Password" />
+ </h:outputLabel>
+
+ <h:inputSecret value="#{register.password}" id="password" required="true" requiredMessage="Password must be minumum 4 and maximum 8 characters!">
+ <f:validateLength minimum="4" maximum="20"/>
+ </h:inputSecret>
+
+ <h:outputLabel for="admin">
+ <h:outputText value="Admin Authorization" />
+ </h:outputLabel>
+
+ <h:selectBooleanCheckbox value="#{register.admin}">
+ </h:selectBooleanCheckbox>
+
+ <h:commandButton action="#{register.register}" value="Register" />
+ <h:commandButton action="false" value="Clear Form" immediate="true" onclick="document.forms[0].reset();document.getElementById('form:name').focus();return false;" />
+
+ </h:panelGrid>
+ </h:form>
+</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/reservation/src/main/webapp/user/addReservation.xhtml b/owb_1.2.x/samples/reservation/src/main/webapp/user/addReservation.xhtml
new file mode 100644
index 0000000..0fb5d97
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/webapp/user/addReservation.xhtml
@@ -0,0 +1,101 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<head>
+ <title>OpenWebBeans :: Examples :: Reservation</title>
+ <link type="text/css" rel="stylesheet" href="#{facesContext.externalContext.requestContextPath}/main.css"/>
+</head>
+
+<body>
+
+<ui:composition template="/user/menu.xhtml">
+
+ <ui:define name="caption">
+ <h:outputText value="Add Reservation Page" styleClass="captionTitle" />
+ </ui:define>
+
+ <ui:define name="body">
+
+ <h:form id="form">
+
+ <h:panelGrid columns="2" styleClass="table" cellspacing="2" cellpadding="5" columnClasses="leftColumns,rightColumns">
+ <h:outputText value="Reservation Date : " />
+ <h:inputText id="col22date" value="#{userReservationBean.reservationDate}">
+ </h:inputText>
+ </h:panelGrid>
+
+
+ <h:dataTable id="dt" cellpadding="5" value="#{userReservationBean.hotels}" binding="#{userReservationBean.model}" var="model" styleClass="table dataTable" rowClasses="oddRow,evenRow">
+
+ <h:column id="dt1">
+ <f:facet name="header">
+ <h:outputText id="col1" value="Name" />
+ </f:facet>
+
+ <h:outputText id="col11" value="#{model.name}" />
+ </h:column>
+
+ <h:column id="dt2">
+ <f:facet name="header">
+ <h:outputText id="col2" value="Star" />
+ </f:facet>
+
+ <h:outputText id="col22" value="#{model.star}" />
+ </h:column>
+
+ <h:column id="dt5">
+ <h:commandLink action="#{userReservationBean.addReservation}" value="Add Hotel for Reservation" />
+ </h:column>
+
+ </h:dataTable>
+
+ <div class="caption">
+ <h:outputText value="Added Hotels" styleClass="captionTitle" />
+ </div>
+
+ <h:panelGrid columns="2" styleClass="table" cellspacing="2" cellpadding="5" columnClasses="leftColumns,rightColumns">
+
+ <h:outputLabel for="name">
+ <h:outputText value="Name" />
+ </h:outputLabel>
+
+ <h:selectManyListbox style="width:225px;height:75px;" value="#{userReservationBean.itemSelected}">
+ <f:selectItems value="#{userReservationBean.reservations}"/>
+ </h:selectManyListbox>
+
+
+ <h:commandButton action="#{userReservationBean.checkout}" value="Checkout" />
+
+ <h:panelGroup>
+ <h:commandButton action="#{userReservationBean.delete}" value="Delete" />
+ <h:commandButton action="#{userReservationBean.clear}" value="Cancel" />
+ </h:panelGroup>
+
+ </h:panelGrid>
+
+ </h:form>
+ </ui:define>
+</ui:composition>
+</body>
+</html>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/reservation/src/main/webapp/user/listReservations.xhtml b/owb_1.2.x/samples/reservation/src/main/webapp/user/listReservations.xhtml
new file mode 100644
index 0000000..68b44a0
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/webapp/user/listReservations.xhtml
@@ -0,0 +1,95 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<head>
+ <title>OpenWebBeans :: Examples :: Reservation</title>
+ <link type="text/css" rel="stylesheet" href="#{facesContext.externalContext.requestContextPath}/main.css"/>
+</head>
+
+<body>
+
+<ui:composition template="/user/menu.xhtml">
+
+ <ui:define name="caption">
+ <h:outputText value="List Reservations" styleClass="captionTitle" />
+ </ui:define>
+
+ <ui:define name="body">
+
+ <h:form id="form">
+
+ <h:dataTable id="dt" cellpadding="5" value="#{listReservationBean.reservations}" binding="#{listReservationBean.model}" var="model" styleClass="table dataTable" rowClasses="oddRow,evenRow">
+
+ <h:column id="dt1">
+ <f:facet name="header">
+ <h:outputText id="col1" value="Name" />
+ </f:facet>
+
+ <h:outputText id="col11" value="#{model.hotel.name}" />
+ </h:column>
+
+ <h:column id="dt2">
+ <f:facet name="header">
+ <h:outputText id="col2" value="Star" />
+ </f:facet>
+
+ <h:outputText id="col221" value="#{model.hotel.star}" />
+ </h:column>
+
+ <h:column id="dt3">
+ <f:facet name="header">
+ <h:outputText id="col3" value="City" />
+ </f:facet>
+
+ <h:outputText id="col222" value="#{model.hotel.city}" />
+ </h:column>
+
+ <h:column id="dt4">
+ <f:facet name="header">
+ <h:outputText id="col4" value="User Name" />
+ </f:facet>
+
+ <h:outputText id="col223" value="#{model.hotel.country}" />
+ </h:column>
+
+ <h:column id="dt5">
+ <f:facet name="header">
+ <h:outputText id="col5" value="Reservation Date" />
+ </f:facet>
+
+ <h:outputText id="col224" value="#{model.reservationDate}" />
+ </h:column>
+
+
+ <h:column id="dt7">
+ <h:commandLink action="#{listReservationBean.delete}" value="Delete Reservation" />
+ </h:column>
+
+ </h:dataTable>
+
+ </h:form>
+ </ui:define>
+</ui:composition>
+</body>
+</html>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/reservation/src/main/webapp/user/menu.xhtml b/owb_1.2.x/samples/reservation/src/main/webapp/user/menu.xhtml
new file mode 100644
index 0000000..723902d
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/webapp/user/menu.xhtml
@@ -0,0 +1,87 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<head>
+ <title>OpenWebBeans :: Examples :: Reservation</title>
+ <link type="text/css" rel="stylesheet" href="#{facesContext.externalContext.requestContextPath}/main.css"/>
+</head>
+
+<body>
+
+<f:view>
+ <div id="main">
+
+ <h:messages globalOnly="false" showSummary="true" infoClass="message infoMessage" errorClass="message errorMessage"></h:messages>
+
+ <div class="logout">
+
+ <h:outputLink value="#{facesContext.externalContext.requestContextPath}/user/menu.xhtml" style="float:left;">
+ <h:outputText value="Home Page" />
+ </h:outputLink>
+
+ <h:form style="margin-left:10px;float:left;">
+ <h:commandLink action="#{logoutBean.logout}" value="Logout"/>
+ </h:form>
+ </div>
+
+
+ <div class="caption">
+ <h:outputText value="Welcome, "/>
+ <h:outputText value="#{sessionTracker.user.name} #{sessionTracker.user.surname}" style="color:red;font-weight:bold;"/>
+
+ <br/>
+
+ <h:outputText value="Last Login Date : "/>
+ <h:outputText value="#{sessionTracker.user.lastLoginDate}" style="color:red;font-weight:bold;"/>
+
+ <ul style="display: block;margin-top: 15px;">
+
+ <h:form style="float:left;">
+ <h:commandLink action="#{userUpdateBean.showInfo}" value="Update Personal Information" styleClass="menuItem">
+ </h:commandLink>
+ </h:form>
+
+ <h:form style="float:left;">
+ <h:commandLink action="#{listReservationBean.showReservations}" value="Show Reservations" styleClass="menuItem">
+ </h:commandLink>
+ </h:form>
+
+ <h:outputLink value="#{facesContext.externalContext.requestContextPath}/user/addReservation.xhtml" styleClass="menuItem">
+ <f:param name="cid" value="#{cid}"/>
+ <h:outputText value="Add Reservations" />
+ </h:outputLink>
+
+
+ </ul>
+
+ <ui:insert name="caption"></ui:insert>
+
+ </div>
+
+ <ui:insert name="body"></ui:insert>
+
+ </div>
+</f:view>
+</body>
+</html>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/reservation/src/main/webapp/user/updateInfo.xhtml b/owb_1.2.x/samples/reservation/src/main/webapp/user/updateInfo.xhtml
new file mode 100644
index 0000000..4a348b8
--- /dev/null
+++ b/owb_1.2.x/samples/reservation/src/main/webapp/user/updateInfo.xhtml
@@ -0,0 +1,87 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<head>
+ <title>OpenWebBeans :: Examples :: Reservation</title>
+ <link type="text/css" rel="stylesheet" href="#{facesContext.externalContext.requestContextPath}/main.css"/>
+</head>
+
+<body>
+
+<ui:composition template="/user/menu.xhtml">
+
+ <ui:define name="caption">
+ <h:outputText value="Update Personal Information" styleClass="captionTitle" />
+ </ui:define>
+
+ <ui:define name="body">
+
+ <h:form id="form">
+
+ <h:panelGrid columns="2" styleClass="table" cellspacing="2" cellpadding="5" columnClasses="leftColumns,rightColumns">
+
+ <h:outputLabel for="name">
+ <h:outputText value="Name" />
+ </h:outputLabel>
+
+ <h:inputText value="#{userUpdateBean.name}" id="name" required="true" requiredMessage="Name is required!"/>
+
+ <h:outputLabel for="surname">
+ <h:outputText value="Surname" />
+ </h:outputLabel>
+
+ <h:inputText value="#{userUpdateBean.surname}" id="surname" required="true" requiredMessage="Surname is required!"/>
+
+ <h:outputLabel for="age">
+ <h:outputText value="Age" />
+ </h:outputLabel>
+
+ <h:inputText value="#{userUpdateBean.age}" id="age" required="true" requiredMessage="Age is required">
+ </h:inputText>
+
+ <h:outputLabel for="userName">
+ <h:outputText value="User Name" />
+ </h:outputLabel>
+
+ <h:inputText value="#{userUpdateBean.userName}" id="userName" required="true" requiredMessage="User name is required and minumum 8 characters!">
+ <f:validateLength minimum="8" maximum="50"/>
+ </h:inputText>
+
+ <h:outputLabel for="password">
+ <h:outputText value="Password" />
+ </h:outputLabel>
+
+ <h:inputSecret value="#{userUpdateBean.password}" id="password" required="true" requiredMessage="Password must be minumum 4 and maximum 8 characters!">
+ <f:validateLength minimum="4" maximum="20"/>
+ </h:inputSecret>
+
+
+ <h:commandButton action="#{userUpdateBean.update}" value="Update" />
+
+ </h:panelGrid>
+ </h:form>
+ </ui:define>
+</ui:composition>
+</body>
+</html>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/src/site/apt/index.apt b/owb_1.2.x/samples/src/site/apt/index.apt
new file mode 100644
index 0000000..04ed24b
--- /dev/null
+++ b/owb_1.2.x/samples/src/site/apt/index.apt
@@ -0,0 +1,16 @@
+~~ 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.
+OpenWebBeans Samples
+
+ This module contains a few samples for the JSR-299
+ Java Contexts and Dependency Injection framework.
+
diff --git a/owb_1.2.x/samples/src/site/site.xml b/owb_1.2.x/samples/src/site/site.xml
new file mode 100644
index 0000000..01bece5
--- /dev/null
+++ b/owb_1.2.x/samples/src/site/site.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<project name="OpenWebBeans-Samples">
+ <publishDate format="dd MMM yyyy" />
+ <version position="left"/>
+
+ <body>
+ <breadcrumbs>
+ <item name="Apache" href="http://www.apache.org"/>
+ <item name="OpenWebBeans" href="http://openwebbeans.apache.org"/>
+ <item name="Samples" href="http://openwebbeans.apache.org/${project.version}/samples"/>
+ </breadcrumbs>
+
+ <menu ref="modules" />
+
+ <menu ref="reports"/>
+ </body>
+</project>
+
diff --git a/owb_1.2.x/samples/standalone-sample/LICENSE b/owb_1.2.x/samples/standalone-sample/LICENSE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/owb_1.2.x/samples/standalone-sample/LICENSE
@@ -0,0 +1,201 @@
+ 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.
diff --git a/owb_1.2.x/samples/standalone-sample/NOTICE b/owb_1.2.x/samples/standalone-sample/NOTICE
new file mode 100644
index 0000000..f5a2e59
--- /dev/null
+++ b/owb_1.2.x/samples/standalone-sample/NOTICE
@@ -0,0 +1,6 @@
+Apache OpenWebBeans
+Copyright 2008, 2010 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/owb_1.2.x/samples/standalone-sample/pom.xml b/owb_1.2.x/samples/standalone-sample/pom.xml
new file mode 100644
index 0000000..140ca0d
--- /dev/null
+++ b/owb_1.2.x/samples/standalone-sample/pom.xml
@@ -0,0 +1,124 @@
+<?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.
+-->
+<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>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>1.2.5</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>standalone-sample</artifactId>
+ <name>OpenWebBeans Java SE Sample</name>
+ <packaging>jar</packaging>
+ <description>Java SE Sample</description>
+
+ <properties>
+ <deploy.skip>true</deploy.skip>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-el_2.2_spec</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>true</skip> <!-- we don't deploy our samples upstream -->
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>org.apache.webbeans.se.sample.Boot</mainClass>
+ <addClasspath>true</addClasspath>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assembly/dist-binary.xml</descriptor>
+ </descriptors>
+ <finalName>standalone-sample</finalName>
+ <appendAssemblyId>false</appendAssemblyId>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id><!-- this is used for inheritance merges -->
+ <phase>package</phase><!-- append to the packaging phase. -->
+ <goals>
+ <goal>attached</goal><!-- goals == mojos -->
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+
+ </plugins>
+ </build>
+
+</project>
diff --git a/owb_1.2.x/samples/standalone-sample/src/assembly/dist-binary.xml b/owb_1.2.x/samples/standalone-sample/src/assembly/dist-binary.xml
new file mode 100644
index 0000000..a41af89
--- /dev/null
+++ b/owb_1.2.x/samples/standalone-sample/src/assembly/dist-binary.xml
@@ -0,0 +1,60 @@
+<!--
+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.
+-->
+<assembly xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/assembly-1.1.0-SNAPSHOT.xsd">
+
+
+ <id>binary</id>
+ <formats>
+ <format>jar</format>
+ </formats>
+
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <dependencySets>
+
+ <dependencySet>
+ <outputDirectory/>
+ <includes>
+ <include>org.apache.openwebbeans:standalone-sample</include>
+ </includes>
+ </dependencySet>
+
+
+ <dependencySet>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org.apache.openwebbeans:openwebbeans-impl</include>
+ <include>org.apache.openwebbeans:openwebbeans-spi</include>
+ <include>org.apache.geronimo.specs:geronimo-el_2.2_spec</include>
+ <include>org.apache.geronimo.specs:geronimo-interceptor_1.1_spec</include>
+ <include>org.apache.geronimo.specs:geronimo-atinject_1.0_spec</include>
+ <include>org.apache.geronimo.specs:geronimo-jcdi_1.0_spec</include>
+ <include>dom4j:dom4j</include>
+ </includes>
+ <excludes>
+ <exclude>org.apache.openwebbeans:openwebbeans-spi:jar:sources</exclude>
+ <exclude>org.apache.openwebbeans:openwebbeans-impl:jar:sources</exclude>
+ </excludes>
+ </dependencySet>
+
+
+ </dependencySets>
+
+
+</assembly>
diff --git a/owb_1.2.x/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/Boot.java b/owb_1.2.x/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/Boot.java
new file mode 100644
index 0000000..b9eacf8
--- /dev/null
+++ b/owb_1.2.x/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/Boot.java
@@ -0,0 +1,108 @@
+/*
+ * 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.webbeans.se.sample;
+
+import java.awt.BorderLayout;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.swing.JFrame;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.se.sample.gui.LoginWindow;
+import org.apache.webbeans.spi.ContainerLifecycle;
+
+public class Boot
+{
+ private static ContainerLifecycle lifecycle = null;
+
+ private static JFrame frame = null;
+
+ private static void boot(Object startupObject) throws Exception
+ {
+ try
+ {
+ lifecycle = WebBeansContext.getInstance().getService(ContainerLifecycle.class);
+ lifecycle.startApplication(startupObject);
+
+ }
+ catch(Exception e)
+ {
+ throw e;
+ }
+ }
+
+ private static void shutdown(Object endObject) throws Exception
+ {
+ try
+ {
+ lifecycle.stopApplication(endObject);
+
+ }
+ catch(Exception e)
+ {
+ throw e;
+ }
+
+ }
+
+
+ public static void main(String[] args) throws Exception
+ {
+ boot(null);
+
+ frame = new JFrame();
+
+ BeanManager beanManager = lifecycle.getBeanManager();
+ Bean<?> bean = beanManager.getBeans("loginWindow").iterator().next();
+
+ LoginWindow loginWindow = (LoginWindow) lifecycle.getBeanManager().getReference(bean, LoginWindow.class, beanManager.createCreationalContext(bean));
+
+ frame.setTitle("OWB @ Java-SE");
+ frame.add(loginWindow,BorderLayout.CENTER);
+ frame.setLocation(400, 300);
+ frame.addWindowListener(new WindowAdapter(){
+
+ @Override
+ public void windowClosed(WindowEvent e)
+ {
+ try
+ {
+ Boot.shutdown(e);
+ }
+ catch (Exception e1)
+ {
+ e1.printStackTrace();
+ }
+ }
+
+ });
+ frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+ frame.pack();
+ frame.setVisible(true);
+
+ }
+
+ public static JFrame getFrame()
+ {
+ return frame;
+ }
+}
diff --git a/owb_1.2.x/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/Controller.java b/owb_1.2.x/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/Controller.java
new file mode 100644
index 0000000..b0b8d1d
--- /dev/null
+++ b/owb_1.2.x/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/Controller.java
@@ -0,0 +1,25 @@
+/*
+ * 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.webbeans.se.sample;
+
+public class Controller
+{
+
+
+}
diff --git a/owb_1.2.x/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/LoggerFactory.java b/owb_1.2.x/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/LoggerFactory.java
new file mode 100644
index 0000000..cad4349
--- /dev/null
+++ b/owb_1.2.x/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/LoggerFactory.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.se.sample;
+
+public interface LoggerFactory
+{
+ public <T> T getLogger(Class<?> logger, Class<T> loggerType);
+}
diff --git a/owb_1.2.x/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/Login.java b/owb_1.2.x/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/Login.java
new file mode 100644
index 0000000..dc72941
--- /dev/null
+++ b/owb_1.2.x/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/Login.java
@@ -0,0 +1,26 @@
+/*
+ * 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.webbeans.se.sample;
+
+public interface Login
+{
+ public boolean login(String userName, char[] password);
+
+ public void logout();
+}
diff --git a/owb_1.2.x/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/beans/FileLogin.java b/owb_1.2.x/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/beans/FileLogin.java
new file mode 100644
index 0000000..8835370
--- /dev/null
+++ b/owb_1.2.x/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/beans/FileLogin.java
@@ -0,0 +1,75 @@
+/*
+ * 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.webbeans.se.sample.beans;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Properties;
+
+import javax.inject.Singleton;
+
+import org.apache.webbeans.se.sample.Login;
+import org.apache.webbeans.se.sample.bindings.FileLoginBinding;
+
+@FileLoginBinding
+@Singleton
+public class FileLogin implements Login
+{
+ private static Properties properties = null;
+
+ static
+ {
+ properties = new Properties();
+ try
+ {
+ properties.load(FileLogin.class.getResourceAsStream("/login.properties"));
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void logout()
+ {
+
+ }
+
+ @Override
+ public boolean login(String userName, char[] password)
+ {
+ Object value = properties.get(userName);
+ if(value == null)
+ {
+ return false;
+ }
+
+ char[] pass = value.toString().toCharArray();
+
+ if(Arrays.equals(pass, password))
+ {
+ Arrays.fill(pass, '0');
+ return true;
+ }
+
+ return false;
+ }
+
+}
diff --git a/owb_1.2.x/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/beans/JavaLoggerFactory.java b/owb_1.2.x/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/beans/JavaLoggerFactory.java
new file mode 100644
index 0000000..4346b9b
--- /dev/null
+++ b/owb_1.2.x/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/beans/JavaLoggerFactory.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.se.sample.beans;
+
+import java.util.logging.Logger;
+
+import javax.inject.Singleton;
+
+import org.apache.webbeans.se.sample.LoggerFactory;
+import org.apache.webbeans.se.sample.bindings.JavaLogger;
+
+@JavaLogger
+@Singleton
+public class JavaLoggerFactory implements LoggerFactory
+{
+
+ @Override
+ public <T> T getLogger(Class<?> clazz, Class<T> type)
+ {
+ Object logger = Logger.getLogger(clazz.getName());
+
+ return type.cast(logger);
+ }
+}
diff --git a/owb_1.2.x/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/bindings/FileLoginBinding.java b/owb_1.2.x/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/bindings/FileLoginBinding.java
new file mode 100644
index 0000000..d8abaeb
--- /dev/null
+++ b/owb_1.2.x/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/bindings/FileLoginBinding.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.se.sample.bindings;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface FileLoginBinding
+{
+
+}
diff --git a/owb_1.2.x/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/bindings/JavaLogger.java b/owb_1.2.x/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/bindings/JavaLogger.java
new file mode 100644
index 0000000..e5d2bc8
--- /dev/null
+++ b/owb_1.2.x/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/bindings/JavaLogger.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.se.sample.bindings;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface JavaLogger
+{
+
+}
diff --git a/owb_1.2.x/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/gui/LoginWindow.java b/owb_1.2.x/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/gui/LoginWindow.java
new file mode 100644
index 0000000..22eed35
--- /dev/null
+++ b/owb_1.2.x/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/gui/LoginWindow.java
@@ -0,0 +1,130 @@
+/*
+ * 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.webbeans.se.sample.gui;
+
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Arrays;
+import java.util.logging.Logger;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JPasswordField;
+import javax.swing.JTextField;
+
+import org.apache.webbeans.se.sample.Boot;
+import org.apache.webbeans.se.sample.LoggerFactory;
+import org.apache.webbeans.se.sample.Login;
+import org.apache.webbeans.se.sample.bindings.FileLoginBinding;
+import org.apache.webbeans.se.sample.bindings.JavaLogger;
+
+@Named
+public class LoginWindow extends JPanel
+{
+ private static final long serialVersionUID = 3330746610475053600L;
+
+ @Inject @FileLoginBinding Login loginBean;
+
+ private JLabel lblUserName;
+
+ private JLabel lblPassword;
+
+ private JTextField txtUserName;
+
+ private JPasswordField txtPassword;
+
+ private JButton btnLogin;
+
+ private JButton btnCancel;
+
+ private Logger logger = null;
+
+ @Inject
+ public LoginWindow(@JavaLogger LoggerFactory loggerFactory)
+ {
+ logger = loggerFactory.getLogger(LoginWindow.class, Logger.class);
+
+ setBorder(BorderFactory.createTitledBorder("Login Information"));
+ initialize();
+ }
+
+ public void initialize()
+ {
+ GridLayout gridLayout = new GridLayout(3,2,3,5);
+ setLayout(gridLayout);
+
+ lblUserName = new JLabel("User Name : ");
+ add(lblUserName);
+
+ txtUserName = new JTextField(10);
+ add(txtUserName);
+
+ lblPassword = new JLabel("Password : ");
+ add(lblPassword);
+
+ txtPassword = new JPasswordField(10);
+ add(txtPassword);
+
+ btnLogin = new JButton("Login");
+ add(btnLogin);
+
+ btnLogin.addActionListener(new ActionListener(){
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ LoginWindow.this.logger.info("Starting to login with user name : " + txtUserName.getText().trim());
+
+ char[] passwd = txtPassword.getPassword();
+ boolean result = LoginWindow.this.loginBean.login(txtUserName.getText().trim(), passwd);
+ Arrays.fill(passwd, '0');
+
+ if(!result)
+ {
+ JOptionPane.showMessageDialog(null, "Wrong password or user name, try again with 'gurkan:erdogdu','mark:struberg','david.blevins'");
+ }
+ else
+ {
+ JOptionPane.showMessageDialog(null, "This demo shows simple usage of OpenWebBeans in Java Swing client. OpenWebBeans, 2009");
+ }
+ }
+
+ });
+
+ btnCancel = new JButton("Cancel");
+
+ btnCancel.addActionListener(new ActionListener(){
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ Boot.getFrame().dispose();
+ }
+
+ });
+
+ add(btnCancel);
+ }
+}
diff --git a/owb_1.2.x/samples/standalone-sample/src/main/resources/META-INF/beans.xml b/owb_1.2.x/samples/standalone-sample/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000..536e386
--- /dev/null
+++ b/owb_1.2.x/samples/standalone-sample/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,17 @@
+ <!--
+
+ 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.
+ -->
+ <beans></beans>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/standalone-sample/src/main/resources/login.properties b/owb_1.2.x/samples/standalone-sample/src/main/resources/login.properties
new file mode 100644
index 0000000..d4b2ec9
--- /dev/null
+++ b/owb_1.2.x/samples/standalone-sample/src/main/resources/login.properties
@@ -0,0 +1,19 @@
+#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.
+gurkan=erdogdu
+mark=struberg
+david=blevins
\ No newline at end of file
diff --git a/owb_1.2.x/samples/tomcat-sample/LICENSE b/owb_1.2.x/samples/tomcat-sample/LICENSE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/owb_1.2.x/samples/tomcat-sample/LICENSE
@@ -0,0 +1,201 @@
+ 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.
diff --git a/owb_1.2.x/samples/tomcat-sample/NOTICE b/owb_1.2.x/samples/tomcat-sample/NOTICE
new file mode 100644
index 0000000..f5a2e59
--- /dev/null
+++ b/owb_1.2.x/samples/tomcat-sample/NOTICE
@@ -0,0 +1,6 @@
+Apache OpenWebBeans
+Copyright 2008, 2010 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/owb_1.2.x/samples/tomcat-sample/pom.xml b/owb_1.2.x/samples/tomcat-sample/pom.xml
new file mode 100644
index 0000000..fb6c9a1
--- /dev/null
+++ b/owb_1.2.x/samples/tomcat-sample/pom.xml
@@ -0,0 +1,140 @@
+<?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.
+-->
+<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>
+ <description>Sample JSF2 Application</description>
+ <parent>
+ <artifactId>samples</artifactId>
+ <groupId>org.apache.openwebbeans</groupId>
+ <version>1.2.5</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.apache.openwebbeans.samples</groupId>
+ <artifactId>tomcat-sample</artifactId>
+ <packaging>war</packaging>
+ <name>Tomcat Sample</name>
+
+ <properties>
+ <deploy.skip>true</deploy.skip>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_2.5_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+
+ </dependencies>
+
+ <build>
+ <finalName>tomcat-sample</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>tomcat-maven-plugin</artifactId>
+ <version>1.1</version>
+ <configuration>
+ <url>http://localhost:8080/manager</url>
+ <addContextWarDependencies>true</addContextWarDependencies>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+ <version>${geronimo_interceptor.version}</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-web</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-ee-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-tomcat6</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <version>${geronimo_cdi.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <version>${geronimo_atinject.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-el10</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/owb_1.2.x/samples/tomcat-sample/src/main/java/org/apache/webbeans/samples/tomcat/CurrentDateProvider.java b/owb_1.2.x/samples/tomcat-sample/src/main/java/org/apache/webbeans/samples/tomcat/CurrentDateProvider.java
new file mode 100644
index 0000000..0143dd8
--- /dev/null
+++ b/owb_1.2.x/samples/tomcat-sample/src/main/java/org/apache/webbeans/samples/tomcat/CurrentDateProvider.java
@@ -0,0 +1,41 @@
+/*
+ * 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.webbeans.samples.tomcat;
+
+import java.security.Principal;
+import java.util.Date;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+
+public class CurrentDateProvider
+{
+ private @Inject Principal principal;
+
+ @Produces
+ public Date getCurrentDate()
+ {
+ return new Date();
+ }
+
+ public Principal getPrincipal()
+ {
+ return principal;
+ }
+}
diff --git a/owb_1.2.x/samples/tomcat-sample/src/main/java/org/apache/webbeans/samples/tomcat/InjectorServlet.java b/owb_1.2.x/samples/tomcat-sample/src/main/java/org/apache/webbeans/samples/tomcat/InjectorServlet.java
new file mode 100644
index 0000000..eab3662
--- /dev/null
+++ b/owb_1.2.x/samples/tomcat-sample/src/main/java/org/apache/webbeans/samples/tomcat/InjectorServlet.java
@@ -0,0 +1,62 @@
+/*
+ * 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.webbeans.samples.tomcat;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class InjectorServlet extends HttpServlet
+{
+ private static final long serialVersionUID = 1L;
+
+ private @Inject CurrentDateProvider dateProvider;
+
+ private @Inject BeanManager beanManager;
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ {
+ PrintWriter writer = resp.getWriter();
+ writer.write("==================Injection of Bean Instance into Servlet==================" + "\n\n");
+ writer.write("Caller Principal name injection into DateProvider instance : " + dateProvider.getPrincipal().getName() + "\n\n");
+ writer.write("Current Date : " + dateProvider.toString());
+ writer.write("\n");
+
+ writer.write("==================Injection of BeanManager into Servlet==================" + "\n\n");
+ if(beanManager != null)
+ {
+ writer.write("Injection of @Inject BeanManager into servlet is successfull");
+ }
+ else
+ {
+ writer.write("Injection of @Inject BeanManager into servlet has failed");
+ }
+
+ }
+
+
+
+}
diff --git a/owb_1.2.x/samples/tomcat-sample/src/main/java/org/apache/webbeans/samples/tomcat/MyFilter.java b/owb_1.2.x/samples/tomcat-sample/src/main/java/org/apache/webbeans/samples/tomcat/MyFilter.java
new file mode 100644
index 0000000..1fbb1a9
--- /dev/null
+++ b/owb_1.2.x/samples/tomcat-sample/src/main/java/org/apache/webbeans/samples/tomcat/MyFilter.java
@@ -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.webbeans.samples.tomcat;
+
+import java.io.IOException;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+
+public class MyFilter implements Filter
+{
+ private @Inject BeanManager manager;
+
+ @Override
+ public void destroy()
+ {
+
+
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2) throws IOException, ServletException
+ {
+ Set<Bean<?>> beans = manager.getBeans(CurrentDateProvider.class);
+ System.out.println("Total found beans : " + beans.size());
+ Bean<CurrentDateProvider> provider = (Bean<CurrentDateProvider>)beans.iterator().next();
+ CurrentDateProvider instance = (CurrentDateProvider) manager.getReference(provider, CurrentDateProvider.class, manager.createCreationalContext(provider));
+
+ System.out.println("Current time is : " + instance.getCurrentDate());
+
+ arg2.doFilter(arg0, arg1);
+
+ }
+
+ @Override
+ public void init(FilterConfig arg0) throws ServletException
+ {
+
+
+ }
+
+}
diff --git a/owb_1.2.x/samples/tomcat-sample/src/main/resources/META-INF/beans.xml b/owb_1.2.x/samples/tomcat-sample/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000..85b6e63
--- /dev/null
+++ b/owb_1.2.x/samples/tomcat-sample/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+<beans/>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/tomcat-sample/src/main/resources/META-INF/openwebbeans/openwebbeans.properties b/owb_1.2.x/samples/tomcat-sample/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
new file mode 100644
index 0000000..baaa875
--- /dev/null
+++ b/owb_1.2.x/samples/tomcat-sample/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
@@ -0,0 +1,27 @@
+#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.
+#---------------------------------------------------------------
+# The default configuration for OpenWebBeans
+#
+# The default configuration is intended for a JDK and a simple ServletContainer
+# like jetty, resin or tomcat.
+#
+#---------------------------------------------------------------
+
+#general configuration section
+org.apache.webbeans.spi.adaptor.ELAdaptor=org.apache.webbeans.el10.EL10Adaptor
+
diff --git a/owb_1.2.x/samples/tomcat-sample/src/main/webapp/META-INF/MANIFEST.MF b/owb_1.2.x/samples/tomcat-sample/src/main/webapp/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..5e94951
--- /dev/null
+++ b/owb_1.2.x/samples/tomcat-sample/src/main/webapp/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
diff --git a/owb_1.2.x/samples/tomcat-sample/src/main/webapp/META-INF/context.xml b/owb_1.2.x/samples/tomcat-sample/src/main/webapp/META-INF/context.xml
new file mode 100644
index 0000000..eb128a4
--- /dev/null
+++ b/owb_1.2.x/samples/tomcat-sample/src/main/webapp/META-INF/context.xml
@@ -0,0 +1,19 @@
+<!--
+
+ 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.
+-->
+<Context>
+ <Listener className="org.apache.webbeans.web.tomcat.ContextLifecycleListener" />
+</Context>
diff --git a/owb_1.2.x/samples/tomcat-sample/src/main/webapp/WEB-INF/beans.xml b/owb_1.2.x/samples/tomcat-sample/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 0000000..85b6e63
--- /dev/null
+++ b/owb_1.2.x/samples/tomcat-sample/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+<beans/>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/tomcat-sample/src/main/webapp/WEB-INF/web.xml b/owb_1.2.x/samples/tomcat-sample/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..76a64e2
--- /dev/null
+++ b/owb_1.2.x/samples/tomcat-sample/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,54 @@
+<?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.
+-->
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+ <filter>
+ <filter-name>injectorfilter</filter-name>
+ <filter-class>org.apache.webbeans.samples.tomcat.MyFilter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>injectorfilter</filter-name>
+ <servlet-name>injector</servlet-name>
+ <dispatcher>REQUEST</dispatcher>
+ </filter-mapping>
+ <servlet>
+ <servlet-name>injector</servlet-name>
+ <servlet-class>org.apache.webbeans.samples.tomcat.InjectorServlet</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>injector</servlet-name>
+ <url-pattern>/injector</url-pattern>
+ </servlet-mapping>
+ <security-constraint>
+ <display-name>injector</display-name>
+ <web-resource-collection>
+ <web-resource-name>injector</web-resource-name>
+ <url-pattern>/injector/*</url-pattern>
+ </web-resource-collection>
+ <auth-constraint>
+ <role-name>manager</role-name>
+ </auth-constraint>
+ </security-constraint>
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ <realm-name>sample</realm-name>
+ </login-config>
+ <security-role>
+ <role-name>manager</role-name>
+ </security-role>
+</web-app>
diff --git a/owb_1.2.x/samples/tomcat7-sample/LICENSE b/owb_1.2.x/samples/tomcat7-sample/LICENSE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/owb_1.2.x/samples/tomcat7-sample/LICENSE
@@ -0,0 +1,201 @@
+ 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.
diff --git a/owb_1.2.x/samples/tomcat7-sample/NOTICE b/owb_1.2.x/samples/tomcat7-sample/NOTICE
new file mode 100644
index 0000000..f5a2e59
--- /dev/null
+++ b/owb_1.2.x/samples/tomcat7-sample/NOTICE
@@ -0,0 +1,6 @@
+Apache OpenWebBeans
+Copyright 2008, 2010 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/owb_1.2.x/samples/tomcat7-sample/pom.xml b/owb_1.2.x/samples/tomcat7-sample/pom.xml
new file mode 100644
index 0000000..4a324ef
--- /dev/null
+++ b/owb_1.2.x/samples/tomcat7-sample/pom.xml
@@ -0,0 +1,105 @@
+<!--
+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.
+-->
+<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>
+ <description>Sample Tomcat7 Application</description>
+ <parent>
+ <artifactId>samples</artifactId>
+ <groupId>org.apache.openwebbeans</groupId>
+ <version>1.2.5</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.apache.openwebbeans.samples</groupId>
+ <artifactId>tomcat7-sample</artifactId>
+ <packaging>war</packaging>
+ <name>Tomcat 7 Sample</name>
+
+ <properties>
+ <deploy.skip>true</deploy.skip>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-web</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_3.0_spec</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-ee-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-resource</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>tomcat-sample</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>tomcat-maven-plugin</artifactId>
+ <version>1.1</version>
+ <configuration>
+ <url>http://localhost:8080/manager/text</url>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/owb_1.2.x/samples/tomcat7-sample/src/main/java/org/apache/webbeans/samples/tomcat/CurrentDateProvider.java b/owb_1.2.x/samples/tomcat7-sample/src/main/java/org/apache/webbeans/samples/tomcat/CurrentDateProvider.java
new file mode 100644
index 0000000..0143dd8
--- /dev/null
+++ b/owb_1.2.x/samples/tomcat7-sample/src/main/java/org/apache/webbeans/samples/tomcat/CurrentDateProvider.java
@@ -0,0 +1,41 @@
+/*
+ * 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.webbeans.samples.tomcat;
+
+import java.security.Principal;
+import java.util.Date;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+
+public class CurrentDateProvider
+{
+ private @Inject Principal principal;
+
+ @Produces
+ public Date getCurrentDate()
+ {
+ return new Date();
+ }
+
+ public Principal getPrincipal()
+ {
+ return principal;
+ }
+}
diff --git a/owb_1.2.x/samples/tomcat7-sample/src/main/java/org/apache/webbeans/samples/tomcat/InjectorServlet.java b/owb_1.2.x/samples/tomcat7-sample/src/main/java/org/apache/webbeans/samples/tomcat/InjectorServlet.java
new file mode 100644
index 0000000..eab3662
--- /dev/null
+++ b/owb_1.2.x/samples/tomcat7-sample/src/main/java/org/apache/webbeans/samples/tomcat/InjectorServlet.java
@@ -0,0 +1,62 @@
+/*
+ * 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.webbeans.samples.tomcat;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class InjectorServlet extends HttpServlet
+{
+ private static final long serialVersionUID = 1L;
+
+ private @Inject CurrentDateProvider dateProvider;
+
+ private @Inject BeanManager beanManager;
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ {
+ PrintWriter writer = resp.getWriter();
+ writer.write("==================Injection of Bean Instance into Servlet==================" + "\n\n");
+ writer.write("Caller Principal name injection into DateProvider instance : " + dateProvider.getPrincipal().getName() + "\n\n");
+ writer.write("Current Date : " + dateProvider.toString());
+ writer.write("\n");
+
+ writer.write("==================Injection of BeanManager into Servlet==================" + "\n\n");
+ if(beanManager != null)
+ {
+ writer.write("Injection of @Inject BeanManager into servlet is successfull");
+ }
+ else
+ {
+ writer.write("Injection of @Inject BeanManager into servlet has failed");
+ }
+
+ }
+
+
+
+}
diff --git a/owb_1.2.x/samples/tomcat7-sample/src/main/java/org/apache/webbeans/samples/tomcat/MyFilter.java b/owb_1.2.x/samples/tomcat7-sample/src/main/java/org/apache/webbeans/samples/tomcat/MyFilter.java
new file mode 100644
index 0000000..f5e98d2
--- /dev/null
+++ b/owb_1.2.x/samples/tomcat7-sample/src/main/java/org/apache/webbeans/samples/tomcat/MyFilter.java
@@ -0,0 +1,70 @@
+/*
+ * 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.webbeans.samples.tomcat;
+
+import java.io.IOException;
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+import org.apache.webbeans.annotation.DefaultLiteral;
+
+public class MyFilter implements Filter
+{
+ private @Inject BeanManager manager;
+
+ @Override
+ public void destroy()
+ {
+
+
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2) throws IOException, ServletException
+ {
+ Set<Bean<?>> beans = manager.getBeans(CurrentDateProvider.class, new Annotation[]{new DefaultLiteral()});
+ System.out.println("Total found beans : " + beans.size());
+ Bean<CurrentDateProvider> provider = (Bean<CurrentDateProvider>)beans.iterator().next();
+ CurrentDateProvider instance = (CurrentDateProvider) manager.getReference(provider, CurrentDateProvider.class, manager.createCreationalContext(provider));
+
+ System.out.println("Current time is : " + instance.getCurrentDate());
+
+ arg2.doFilter(arg0, arg1);
+
+ }
+
+ @Override
+ public void init(FilterConfig arg0) throws ServletException
+ {
+
+
+ }
+
+}
diff --git a/owb_1.2.x/samples/tomcat7-sample/src/main/resources/META-INF/beans.xml b/owb_1.2.x/samples/tomcat7-sample/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000..85b6e63
--- /dev/null
+++ b/owb_1.2.x/samples/tomcat7-sample/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+<beans/>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/tomcat7-sample/src/main/webapp/META-INF/MANIFEST.MF b/owb_1.2.x/samples/tomcat7-sample/src/main/webapp/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..254272e
--- /dev/null
+++ b/owb_1.2.x/samples/tomcat7-sample/src/main/webapp/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
diff --git a/owb_1.2.x/samples/tomcat7-sample/src/main/webapp/WEB-INF/beans.xml b/owb_1.2.x/samples/tomcat7-sample/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 0000000..85b6e63
--- /dev/null
+++ b/owb_1.2.x/samples/tomcat7-sample/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+<beans/>
\ No newline at end of file
diff --git a/owb_1.2.x/samples/tomcat7-sample/src/main/webapp/WEB-INF/web.xml b/owb_1.2.x/samples/tomcat7-sample/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..b00aa24
--- /dev/null
+++ b/owb_1.2.x/samples/tomcat7-sample/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,54 @@
+<?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.
+-->
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+ <filter>
+ <filter-name>injectorfilter</filter-name>
+ <filter-class>org.apache.webbeans.samples.tomcat.MyFilter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>injectorfilter</filter-name>
+ <servlet-name>injector</servlet-name>
+ <dispatcher>REQUEST</dispatcher>
+ </filter-mapping>
+ <servlet>
+ <servlet-name>injector</servlet-name>
+ <servlet-class>org.apache.webbeans.samples.tomcat.InjectorServlet</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>injector</servlet-name>
+ <url-pattern>/injector</url-pattern>
+ </servlet-mapping>
+ <security-constraint>
+ <display-name>injector</display-name>
+ <web-resource-collection>
+ <web-resource-name>injector</web-resource-name>
+ <url-pattern>/injector/*</url-pattern>
+ </web-resource-collection>
+ <auth-constraint>
+ <role-name>manager-script</role-name>
+ </auth-constraint>
+ </security-constraint>
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ <realm-name>sample</realm-name>
+ </login-config>
+ <security-role>
+ <role-name>manager-script</role-name>
+ </security-role>
+</web-app>
diff --git a/owb_1.2.x/src/site/apt/contributing.apt b/owb_1.2.x/src/site/apt/contributing.apt
new file mode 100644
index 0000000..63a5ced
--- /dev/null
+++ b/owb_1.2.x/src/site/apt/contributing.apt
@@ -0,0 +1,84 @@
+~~ 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.
+Contributing to OpenWebBeans
+
+ We are always looking for new contributors to the project.
+
+
+* Mailing Lists
+
+ Please join our discussions about the project in our mailing lists by
+ sending an informal email to
+
+----------------
+user-subscribe@openwebbeans.apache.org
+----------------
+
+ for any usage specific questions, and
+
+----------------
+dev-subscribe@openwebbeans.apache.org
+----------------
+
+ for bugs and feature discussions.
+
+
+* Issue Tracking
+
+ Bug reports and feature requests will be maintained via JIRA at
+
+ {{{https://issues.apache.org/jira/browse/OWB}https://issues.apache.org/jira/browse/OWB}}
+
+
+* Source Repository
+
+ The sources of Apache OpenWebBeans are maintained in the Apache Software Foundation
+ Subversion repository.
+
+ The sources can be checked out read only with the following command:
+
+----------------
+svn co http://svn.apache.org/repos/asf/openwebbeans/trunk openwebbeans
+----------------
+
+ If you have commit rights, then you should use
+
+----------------
+svn co https://svn.apache.org/repos/asf/openwebbeans/trunk openwebbeans
+----------------
+
+
+* Building OpenWebBeans
+
+ Apache OpenWebBeans can be built by using Apache Maven. Just go into the
+ source directory and execute
+
+----------------
+mvn clean install
+----------------
+
+ The following maven profiles exist in our build to trigger additional
+ build steps and configuration:
+
+ * tck - for executing the JSR-299 standalone TCK
+
+ * jsr330-tck - for executing the JSR-330 TCK
+
+ * doc - for building the documentation PDF from docbook
+
+ []
+
+ To activate all of them use
+
+----------------
+mvn clean install -Ptck -Pjsr330-tck -Pdoc
+----------------
diff --git a/owb_1.2.x/src/site/apt/documentation.apt b/owb_1.2.x/src/site/apt/documentation.apt
new file mode 100644
index 0000000..258d66c
--- /dev/null
+++ b/owb_1.2.x/src/site/apt/documentation.apt
@@ -0,0 +1,28 @@
+~~ 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.
+Initial Documentation for OpenWebBeans
+
+ This is an initial documentation for Apache OpenWebBeans. Although it is not yet complete,
+ it is a good point for getting started.
+
+* Getting Started
+
+ * {{{http://openwebbeans.apache.org/1.0.0-SNAPSHOT/documents/userguide.pdf}OpenWebBeans User Guide}}
+
+* WIKI
+
+ We maintain a WIKI for developing the OpenWebBeans documentation.
+
+ * {{{https://cwiki.apache.org/OWB/index.html}OpenWebBeans WIKI}}
+
+ If you like to contribute to our documentation, then please register yourself
+ and ask for edit permission on our dev mailing list.
diff --git a/owb_1.2.x/src/site/apt/examples/guess.apt b/owb_1.2.x/src/site/apt/examples/guess.apt
new file mode 100644
index 0000000..0031e8c
--- /dev/null
+++ b/owb_1.2.x/src/site/apt/examples/guess.apt
@@ -0,0 +1,14 @@
+~~ 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.
+OpenWebBeans Number guess example
+
+ This small example shows how to create a JSF application with WebBeans
diff --git a/owb_1.2.x/src/site/apt/extensions/index.apt b/owb_1.2.x/src/site/apt/extensions/index.apt
new file mode 100644
index 0000000..859017f
--- /dev/null
+++ b/owb_1.2.x/src/site/apt/extensions/index.apt
@@ -0,0 +1,26 @@
+~~ 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.
+Extensions over the JSR-299 Specification
+
+ This section contains a list of functionality in OpenWebBeans
+ which is not covered by the official specification.
+
+ OpenWebBeans is fully compatible with the JSR-299 standard if
+ the default configuration is being used. Nevertheless some parts
+ of the behaviour may be changed and some functionality is
+ additionally available.
+
+ Please note that using the mentioned functionality can cause
+ that your application may not be run on other WebBeans implementations.
+
+ OpenWebBeans may be configured that a WARNING message will be logged
+ whenever any of this additional functionality is being used.
diff --git a/owb_1.2.x/src/site/apt/index.apt b/owb_1.2.x/src/site/apt/index.apt
new file mode 100644
index 0000000..3196a1d
--- /dev/null
+++ b/owb_1.2.x/src/site/apt/index.apt
@@ -0,0 +1,82 @@
+~~ 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.
+Welcome to Apache OpenWebBeans
+
+
+* What is OpenWebBeans?
+
+ OpenWebBeans is an Apache License v2.0 implementation of the JSR-299
+ "Contexts and Dependency Injection for the Java (TM) EE platform" specification.
+
+ In addition to the implementation of the specification, the project provides a set
+ of WebBeans components and integration plugins exposing functionality of other
+ Apache Software Foundation projects.
+
+ Apache OpenWebBeans is based on a plugin architecture. The OpenWebBeans Core is
+ strictly Java SE only. Additional functionality, like JSF-1 support, JSF-2 support
+ JPA support, JMS support, etc can be added by simply dropping the respective
+ OpenWebBeans plugin JAR into your classpath.
+
+
+* Recent News
+
+ * 2011-12-10 OpenWebBeans 1.1.3 has been released - this is a bugfix release
+
+ * 2011-10-17 OpenWebBeans 1.1.2 has been released - this is a bugfix release
+
+ * 2011-10-04 Apache TomEE release includes OWB as CDI container
+
+ * 2011-0-29 - Trademark Rules & Logo download page added
+
+ * 2011-08-04 - Added backward compat support for Java5 for running OWB with older EE containers
+
+ * 2001-05-19 - We got a new Logo, designed by Adonis Raduca and sponsored by Irian.at
+
+ * 2011-04-09 - New PMC members: Gerhard Petracek, David Jencks
+
+ * 2011-03-30 - 1.1.0 released
+
+ * 2010-11-07 - New Committer: David Jencks
+
+ * 2010-10-08 - New Committers: Paul J Reder, Rohit Kelapure
+
+ * 2010-09-03 - alpha-2 released
+
+ * 2010-08-03 - New committer: Gerhard Petracek
+
+ * 2010-07-10 - alpha-1 released
+
+ * 2010-03-05 - M4 released
+
+ * 2010-03-05 - New committer: Ying Wang
+
+ * 2009-11-17 - New committer: Eric Covener
+
+ * 2009-11-10 - New committer: Joe Bergmark
+
+ * 2009-09-30 - M3 is released
+
+ * 2009-09-14 - New committer: David Blevins
+
+ * 2009-07-07 - New committer: James Carman
+
+ * 2009-06-09 - M2 is released
+
+ * 2009-02-16 - M1 is released
+
+ * 2009-01-18 - New committer: Mark Struberg
+
+ * 2008-12-24 - New committer: Mohammad Nour El-Din
+
+ * 2008-11-23 - Source code is available in project SVN.
+
+
diff --git a/owb_1.2.x/src/site/apt/irc.apt b/owb_1.2.x/src/site/apt/irc.apt
new file mode 100644
index 0000000..d29bcf0
--- /dev/null
+++ b/owb_1.2.x/src/site/apt/irc.apt
@@ -0,0 +1,28 @@
+~~ 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.
+IRC Channel
+
+ There is an IRC Channel for discussing project related things.
+ The official Apache OpenWebBeans related channel is register at
+
+----------------
+irc.freenode.org
+----------------
+
+ with channel name
+
+----------------
+#openwebbeans
+----------------
+
+
+
diff --git a/owb_1.2.x/src/site/apt/jsr299.apt b/owb_1.2.x/src/site/apt/jsr299.apt
new file mode 100644
index 0000000..05e3013
--- /dev/null
+++ b/owb_1.2.x/src/site/apt/jsr299.apt
@@ -0,0 +1,29 @@
+~~ 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.
+JSR-299 Contexts and Dependency Injection for the Java EE platform
+
+ The purpose of the WebBeans specification is to unify the JSF managed bean component model
+ with the EJB component model, resulting in a significantly simplified programming model
+ for web-based applications.
+
+ Over the time, JSR-299 has evolved into a IOC framework which is more web agnostic.
+ The JSR-299 specification has finally changed it's name to
+ "Contexts and Dependency Injection for the Java (TM) EE platform" to better reflect
+ it's comprehensive features.
+
+ While the specification is targeted to Java EE environments,
+ Apache OpenWebBeans also works very well even in pure Java SE applications!
+
+
+* Official Resources
+
+ * {{{http://www.jcp.org/en/jsr/detail?id=299}Java Specification Request 299}}
diff --git a/owb_1.2.x/src/site/apt/jsr330.apt b/owb_1.2.x/src/site/apt/jsr330.apt
new file mode 100644
index 0000000..e264709
--- /dev/null
+++ b/owb_1.2.x/src/site/apt/jsr330.apt
@@ -0,0 +1,25 @@
+~~ 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.
+JSR-330 Dependency Injection for Java
+
+ The purpose of the JSR-330 'atinject' specification is to provide basic dependency
+ injection annotations for Java.
+
+ It is nowadays to a large degree the basic foundation of the JSR-299 specification.
+ Please note that JSR-330 only defines the very basic annotation syntax and almost
+ no behavior!
+
+* Official Resources
+
+ * {{{http://www.jcp.org/en/jsr/detail?id=330}Java Specification Request 330}}
+
+ * {{{http://code.google.com/p/atinject/}official atinject project page}}
diff --git a/owb_1.2.x/src/site/apt/trademarks.apt b/owb_1.2.x/src/site/apt/trademarks.apt
new file mode 100644
index 0000000..ffe6a16
--- /dev/null
+++ b/owb_1.2.x/src/site/apt/trademarks.apt
@@ -0,0 +1,30 @@
+~~ 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.
+Apache OpenWebBeans Trademark Rules
+
+ Apache, ASF, OpenWebBeans, Apache OpenWebBeans and OWB are trademarks of the Apache Software Foundation.
+
+
+ For more information about ASF trademark rules, please visit the official
+ {{{http://www.apache.org/foundation/marks/}Apache Software Foundation Trademarks}} page.
+
+
+Apache OpenWebBeans Logos
+
+ The following logos are official project logos and might be used in presentations and articles
+ according to the {{{http://www.apache.org/foundation/marks/#guidelines}Apache Software Foundation Trademark Rules}}.
+
+ * {{{./images/logos/openwebbeans_vert.png}Vertical OpenWebBeans Logo}}
+
+ * {{{./images/logos/openwebbeans_hor.png}Horizontal OpenWebBeans Logo}}
+
+ * {{{./images/logos/openwebbeans_small.png}Small OpenWebBeans Logo}}
diff --git a/owb_1.2.x/src/site/fml/faq.fml b/owb_1.2.x/src/site/fml/faq.fml
new file mode 100644
index 0000000..d1477af
--- /dev/null
+++ b/owb_1.2.x/src/site/fml/faq.fml
@@ -0,0 +1,66 @@
+<?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.
+-->
+<faqs title="Frequently Asked Questions" toplink="false">
+ <part id="general">
+ <title>General</title>
+
+ <faq id="whats-webbeans">
+ <question>
+ What is OpenWebBeans?
+ </question>
+ <answer>
+ <p>OpenWebBenas is an implementation of JSR-299</p>
+ </answer>
+ </faq>
+
+ <faq id="whats-canbe">
+ <question>
+ What Java Classes can be WebBeans?
+ </question>
+ <answer>
+ <p>From the Spec:</p>
+ <source>
+ Speaking more abstractly, a bean is a source of contextual objects which define
+ application state and/or logic. These objects are called contextual instances of the bean.
+ </source>
+ </answer>
+ </faq>
+
+ </part>
+
+ <part id="install">
+
+ <title>Installation and Integration</title>
+
+ <faq id="how-run">
+ <question>
+ How do I run OpenWebBeans?
+ </question>
+ <answer>
+ <p>OpenWebBeans may be executed in a Java EE 6, Java EE 5 or Java SE environments.
+ If the application executes in a Java SE environment, an embeddable EJB
+ Lite container has to provide Java EE services such as transaction management and persistence.</p>
+ </answer>
+ </faq>
+
+ </part>
+
+</faqs>
+
diff --git a/owb_1.2.x/src/site/resources/documents/userguide.pdf b/owb_1.2.x/src/site/resources/documents/userguide.pdf
new file mode 100644
index 0000000..4524fbf
--- /dev/null
+++ b/owb_1.2.x/src/site/resources/documents/userguide.pdf
Binary files differ
diff --git a/owb_1.2.x/src/site/resources/images/logos/openwebbeans_hor.png b/owb_1.2.x/src/site/resources/images/logos/openwebbeans_hor.png
new file mode 100644
index 0000000..53a4e8d
--- /dev/null
+++ b/owb_1.2.x/src/site/resources/images/logos/openwebbeans_hor.png
Binary files differ
diff --git a/owb_1.2.x/src/site/resources/images/logos/openwebbeans_small.png b/owb_1.2.x/src/site/resources/images/logos/openwebbeans_small.png
new file mode 100644
index 0000000..d1ba391
--- /dev/null
+++ b/owb_1.2.x/src/site/resources/images/logos/openwebbeans_small.png
Binary files differ
diff --git a/owb_1.2.x/src/site/resources/images/logos/openwebbeans_vert.png b/owb_1.2.x/src/site/resources/images/logos/openwebbeans_vert.png
new file mode 100644
index 0000000..da78da3
--- /dev/null
+++ b/owb_1.2.x/src/site/resources/images/logos/openwebbeans_vert.png
Binary files differ
diff --git a/owb_1.2.x/src/site/site.xml b/owb_1.2.x/src/site/site.xml
new file mode 100644
index 0000000..eb47128
--- /dev/null
+++ b/owb_1.2.x/src/site/site.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+<project name="OpenWebBeans">
+ <bannerLeft>
+ <name>Apache OpenWebBeans</name>
+ <src>http://openwebbeans.apache.org/owb/images/logos/openwebbeans_hor.png</src>
+ <href>http://openwebbeans.apache.org</href>
+ </bannerLeft>
+
+ <bannerRight>
+ <name>Apache Banner</name>
+ <src>http://www.apache.org/images/asf-logo.gif</src>
+ <href>http://www.apache.org</href>
+ </bannerRight>
+
+ <publishDate format="dd MMM yyyy" />
+ <version position="left"/>
+
+ <body>
+ <breadcrumbs>
+ <item name="Apache" href="http://www.apache.org"/>
+ <item name="OpenWebBeans" href="http://openwebbeans.apache.org"/>
+ </breadcrumbs>
+
+ <menu name="Overview">
+ <item name="Introduction" href="index.html" />
+ <item name="JSR-299" href="jsr299.html" />
+ <item name="JSR-330" href="jsr330.html" />
+ </menu>
+
+ <menu name="OpenWebBeans">
+ <item name="Contributing" href="contributing.html" />
+ <item name="IRC" href="irc.html" />
+ <item name="Documentation" href="documentation.html"/>
+ <item name="FAQ" href="faq.html" />
+ <item name="Extensions" href="extensions/index.html" />
+ <item name="Logos & Trademarks" href="trademarks.html" />
+ <item name="Download Apache OWB" href="http://www.apache.org/dyn/closer.cgi/openwebbeans/" />
+ </menu>
+
+ <menu ref="modules" />
+
+ <menu ref="reports"/>
+ </body>
+</project>
diff --git a/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/pom.xml b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/pom.xml
new file mode 100644
index 0000000..3caa64c
--- /dev/null
+++ b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/pom.xml
@@ -0,0 +1,92 @@
+<?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.
+ -->
+
+<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>
+ <groupId>org.apache.openwebbeans.arquillian</groupId>
+ <artifactId>owb-arquillian-parent</artifactId>
+ <version>1.2.5</version>
+ </parent>
+ <artifactId>owb-arquillian-standalone</artifactId>
+ <packaging>jar</packaging>
+
+ <name>OpenWebBeans-Standalone Arquillian connector</name>
+ <description>
+ Arquillian container for Apache OpenWebBeans standalone.
+ This is intended for running in unit tests.
+ </description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-el_2.2_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-container-spi</artifactId>
+ <version>${arquillian.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.test</groupId>
+ <artifactId>arquillian-test-spi</artifactId>
+ <version>${arquillian.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.testenricher</groupId>
+ <artifactId>arquillian-testenricher-cdi</artifactId>
+ <version>${arquillian.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <scope>compile</scope>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ <scope>compile</scope>
+ <optional>true</optional>
+ </dependency>
+ </dependencies>
+
+
+</project>
diff --git a/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbArquillianExtension.java b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbArquillianExtension.java
new file mode 100644
index 0000000..ad4fa18
--- /dev/null
+++ b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbArquillianExtension.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.arquillian.standalone;
+
+import org.jboss.arquillian.container.spi.client.container.DeployableContainer;
+import org.jboss.arquillian.core.spi.LoadableExtension;
+
+/**
+ */
+public class OwbArquillianExtension implements LoadableExtension
+{
+ @Override
+ public void register(ExtensionBuilder builder)
+ {
+ builder.service(DeployableContainer.class, OwbStandaloneContainer.class)
+ .observer(OwbLifecycleHandler.class);
+ }
+}
diff --git a/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbArquillianLifecycle.java b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbArquillianLifecycle.java
new file mode 100644
index 0000000..253f5a7
--- /dev/null
+++ b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbArquillianLifecycle.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.arquillian.standalone;
+
+
+import org.apache.webbeans.lifecycle.AbstractLifeCycle;
+import org.apache.webbeans.spi.ScannerService;
+
+/**
+ *
+ */
+public class OwbArquillianLifecycle extends AbstractLifeCycle
+{
+
+
+ public OwbArquillianLifecycle(ScannerService scannerService)
+ {
+ super();
+
+ // we replace the ScannerService which shall get used
+ this.scannerService = scannerService;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbArquillianScannerService.java b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbArquillianScannerService.java
new file mode 100644
index 0000000..7a1cdc6
--- /dev/null
+++ b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbArquillianScannerService.java
@@ -0,0 +1,291 @@
+/*
+ * 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.webbeans.arquillian.standalone;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLStreamHandler;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.webbeans.spi.BDABeansXmlScanner;
+import org.apache.webbeans.spi.ScannerService;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ArchivePath;
+import org.jboss.shrinkwrap.api.Filters;
+import org.jboss.shrinkwrap.api.Node;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.ArchiveAsset;
+import org.jboss.shrinkwrap.api.asset.Asset;
+import org.jboss.shrinkwrap.api.asset.FileAsset;
+import org.jboss.shrinkwrap.api.exporter.ZipExporter;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+
+/**
+ *
+ */
+public class OwbArquillianScannerService implements ScannerService
+{
+
+ private final static String WEB_INF_CLASS_FOLDER = "/WEB-INF/classes/";
+
+ private boolean beansXmlBdaScanningEnabled;
+ private Archive archive;
+
+ private UrlSet beansXmls = new UrlSet();
+ private Set<Class<?>> beanClasses = new HashSet<Class<?>>();
+
+
+ public OwbArquillianScannerService()
+ {
+ this.beansXmlBdaScanningEnabled = false;
+ }
+
+ @Override
+ public BDABeansXmlScanner getBDABeansXmlScanner()
+ {
+ return null;
+ }
+
+ @Override
+ public void init(Object object)
+ {
+ // nothing to do
+ }
+
+ public void setArchive(Archive archive)
+ {
+ this.archive = archive;
+ }
+
+ @Override
+ public void scan()
+ {
+ if (archive == null)
+ {
+ return;
+ }
+
+ final String archiveName = archive.getName();
+ if (archiveName.endsWith(".jar"))
+ {
+ scanJarArchive(archive);
+ }
+ else if (archiveName.endsWith(".war"))
+ {
+ scanWebArchive(archive);
+ }
+ else
+ {
+ throw new IllegalStateException("Scanning of Archive " + archive.getClass().getName() + "Not yet implemented");
+ }
+ }
+
+ @Override
+ public Set<URL> getBeanXmls()
+ {
+ return beansXmls;
+ }
+
+ @Override
+ public Set<Class<?>> getBeanClasses()
+ {
+ return beanClasses;
+ }
+
+ @Override
+ public void release()
+ {
+ beansXmls.clear();
+ beanClasses.clear();
+ }
+
+ @Override
+ public boolean isBDABeansXmlScanningEnabled()
+ {
+ return beansXmlBdaScanningEnabled;
+ }
+
+ // --------- private implementation -----------
+
+ private void scanWebArchive(final Archive<?> archive)
+ {
+ URL webBeansXmlUrl = getBeanXmlUrl(archive, "WEB-INF/beans.xml");
+ if (webBeansXmlUrl != null)
+ {
+ beansXmls.add(webBeansXmlUrl);
+ }
+
+ URL metainfBeansXmlUrl = getBeanXmlUrl(archive, WEB_INF_CLASS_FOLDER + "META-INF/beans.xml");
+ if (metainfBeansXmlUrl != null)
+ {
+ beansXmls.add(metainfBeansXmlUrl);
+ }
+
+ if (metainfBeansXmlUrl != null || webBeansXmlUrl != null)
+ {
+ // in this case we need to scan the WEB-INF/classses folder for .class files
+ Map<ArchivePath, Node> classes = archive.getContent(Filters.include(WEB_INF_CLASS_FOLDER + ".*\\.class"));
+ scanClasses(classes, WEB_INF_CLASS_FOLDER);
+ }
+
+
+ // and now scan all the jars in the WAR
+ Map<ArchivePath, Node> jars = archive.getContent(Filters.include("/WEB-INF/lib/.*\\.jar"));
+ for (Map.Entry<ArchivePath, Node> jarEntry : jars.entrySet())
+ {
+ Asset asset = jarEntry.getValue().getAsset();
+ if (asset instanceof FileAsset)
+ {
+ FileAsset fileAsset = (FileAsset) asset;
+ if (fileAsset.getSource().getName().endsWith(".jar"))
+ {
+ Archive<?> fileArchive = ShrinkWrap.createFromZipFile(JavaArchive.class, fileAsset.getSource());
+ asset = new ArchiveAsset(fileArchive, ZipExporter.class);
+ }
+ }
+ if (asset instanceof ArchiveAsset)
+ {
+ ArchiveAsset archiveAsset = (ArchiveAsset) asset;
+ JavaArchive jarArchive = (JavaArchive) archiveAsset.getArchive();
+ scanJarArchive(jarArchive);
+ }
+ }
+
+ }
+
+ private void scanJarArchive(final Archive<?> archive)
+ {
+ URL beansXmlUrl = getBeanXmlUrl(archive, "META-INF/beans.xml");
+
+ if (beansXmlUrl == null)
+ {
+ // this is not a CDI archive
+ return;
+ }
+
+ // otherwise we store it for later use
+ beansXmls.add(beansXmlUrl);
+
+ // and now add all classes
+ Map<ArchivePath, Node> classes = archive.getContent(Filters.include(".*\\.class"));
+ scanClasses(classes, null);
+ }
+
+ /**
+ *
+ * @param classes the scanned classes
+ * @param classBasePath the base class in which the classes are, or null if they are directly in the root
+ */
+ private void scanClasses(Map<ArchivePath, Node> classes, String classBasePath)
+ {
+ for (Map.Entry<ArchivePath, Node> classEntry : classes.entrySet())
+ {
+ String className = classEntry.getKey().get();
+
+ if (classBasePath != null && className.startsWith(WEB_INF_CLASS_FOLDER))
+ {
+ className = className.substring(WEB_INF_CLASS_FOLDER.length());
+ }
+
+ // cut off leading slashes
+ if (className.startsWith("/"))
+ {
+ className = className.substring(1);
+ }
+
+ // cut off ".class"
+ className = className.substring(0, className.length() - ".class".length());
+
+ className = className.replace('/', '.');
+
+
+ try
+ {
+ Class<?> beanClass = Class.forName(className);
+ beanClasses.add(beanClass);
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ throw new RuntimeException("Could not scan class", cnfe);
+ }
+ }
+ }
+
+ private URL getBeanXmlUrl(Archive archive, String beansXmlPath)
+ {
+ final Node beansXml = archive.get(beansXmlPath);
+
+ if (beansXml == null)
+ {
+ return null;
+ }
+
+ try
+ {
+ String urlLocation = "archive://" + archive.getName() + "/" + beansXmlPath;
+
+ return new URL(null, urlLocation, new URLStreamHandler()
+ {
+ @Override
+ protected URLConnection openConnection(URL u) throws IOException
+ {
+ return new URLConnection(u)
+ {
+ @Override
+ public void connect() throws IOException
+ {}
+
+ @Override
+ public InputStream getInputStream() throws IOException
+ {
+ return beansXml.getAsset().openStream();
+ }
+ };
+ };
+ });
+ }
+ catch (Exception e)
+ {
+ RuntimeException runtimeException;
+ if (e instanceof RuntimeException)
+ {
+ runtimeException = (RuntimeException) e;
+ }
+ else
+ {
+ runtimeException = new RuntimeException("Error while parsing beans.xml location", e);
+ }
+
+ throw runtimeException;
+ }
+ }
+
+
+ public void clear()
+ {
+ archive = null;
+
+ beansXmls = new UrlSet();
+ beanClasses = new HashSet<Class<?>>();
+ }
+}
diff --git a/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbArquillianSingletonService.java b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbArquillianSingletonService.java
new file mode 100644
index 0000000..7a7b8f5
--- /dev/null
+++ b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbArquillianSingletonService.java
@@ -0,0 +1,77 @@
+/*
+ * 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.webbeans.arquillian.standalone;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.corespi.security.SimpleSecurityService;
+import org.apache.webbeans.spi.ScannerService;
+import org.apache.webbeans.spi.SecurityService;
+import org.apache.webbeans.spi.SingletonService;
+
+/**
+ *
+ */
+public class OwbArquillianSingletonService implements SingletonService<WebBeansContext>
+{
+
+ private final Properties initialConfig;
+
+ private WebBeansContext webBeansContext;
+
+ public OwbArquillianSingletonService(final Properties props)
+ {
+ initialConfig = props;
+ initOwb(props);
+ }
+
+ public synchronized void initOwb()
+ {
+ initOwb(initialConfig);
+ }
+
+ public synchronized void initOwb(final Properties initialConfig)
+ {
+ ScannerService dummyScannerService = new OwbArquillianScannerService();
+
+ Map<Class<?>, Object> initialServices = new HashMap<Class<?>, Object>();
+ initialServices.put(ScannerService.class, dummyScannerService);
+
+ // this is needed because of a dirty hack in the OpenWebBeansConfiguration
+ initialServices.put(SecurityService.class, new SimpleSecurityService());
+
+ webBeansContext = new WebBeansContext(initialServices, initialConfig);
+ webBeansContext.getOpenWebBeansConfiguration().parseConfiguration();
+ }
+
+ @Override
+ public void clear(Object key)
+ {
+ webBeansContext.clear();
+ }
+
+ @Override
+ public WebBeansContext get(Object key)
+ {
+ return webBeansContext;
+ }
+}
diff --git a/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbLifecycleHandler.java b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbLifecycleHandler.java
new file mode 100644
index 0000000..6a5b197
--- /dev/null
+++ b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbLifecycleHandler.java
@@ -0,0 +1,93 @@
+/*
+ * 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.webbeans.arquillian.standalone;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.SessionScoped;
+
+import org.apache.webbeans.spi.ContainerLifecycle;
+import org.apache.webbeans.spi.ContextsService;
+import org.jboss.arquillian.container.spi.event.container.AfterDeploy;
+import org.jboss.arquillian.container.spi.event.container.BeforeUnDeploy;
+import org.jboss.arquillian.core.api.Instance;
+import org.jboss.arquillian.core.api.annotation.Inject;
+import org.jboss.arquillian.core.api.annotation.Observes;
+import org.jboss.arquillian.test.spi.event.suite.After;
+import org.jboss.arquillian.test.spi.event.suite.Before;
+
+/**
+ * Starts and stops the application and the contexts in it.
+ */
+public class OwbLifecycleHandler
+{
+ @Inject
+ private Instance<ContainerLifecycle> lifecycle;
+
+ public void afterDeployment(@Observes AfterDeploy event)
+ {
+ ContextsService service = lifecycle.get().getContextService();
+
+ //service.startContext(ApplicationScoped.class, null);
+ service.startContext(ApplicationScoped.class, null);
+ }
+
+ public void beforeUndeployment(@Observes BeforeUnDeploy event)
+ {
+ ContextsService service = lifecycle.get().getContextService();
+
+ //service.startContext(ApplicationScoped.class, null);
+ service.endContext(ApplicationScoped.class, null);
+ }
+
+ public void beforeMethod(@Observes Before event)
+ {
+ ContainerLifecycle lc = lifecycle.get();
+ if (lc == null)
+ {
+ // this may happen if there was a DeploymentError during CDI boot
+ return;
+ }
+
+ ContextsService service = lc.getContextService();
+
+ service.startContext(RequestScoped.class, null);
+ service.startContext(SessionScoped.class, null);
+ service.startContext(ConversationScoped.class, null);
+ }
+
+ public void afterMethod(@Observes After event)
+ {
+ ContainerLifecycle lc = lifecycle.get();
+ if (lc == null)
+ {
+ // this may happen if there was a DeploymentError during CDI boot
+ return;
+ }
+
+ ContextsService service = lc.getContextService();
+
+ service.endContext(ConversationScoped.class, null);
+ service.endContext(SessionScoped.class, null);
+ service.endContext(RequestScoped.class, null);
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbSWClassLoader.java b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbSWClassLoader.java
new file mode 100644
index 0000000..fdc4990
--- /dev/null
+++ b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbSWClassLoader.java
@@ -0,0 +1,265 @@
+/*
+ * 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.webbeans.arquillian.standalone;
+
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ArchivePath;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.Node;
+import org.jboss.shrinkwrap.api.asset.Asset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+
+import java.io.Closeable;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.net.URLConnection;
+import java.net.URLStreamHandler;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.List;
+
+public class OwbSWClassLoader extends URLClassLoader implements Closeable
+{
+ // Collections.emptyEnumeration only exists in java7++
+ private final static Enumeration EMPTY_ENUMERATION = new Enumeration()
+ {
+ @Override
+ public boolean hasMoreElements()
+ {
+ return false;
+ }
+
+ @Override
+ public Object nextElement()
+ {
+ return null;
+ }
+ };
+
+ private final List<InputStream> openedStreams = new ArrayList<InputStream>();
+ private final String prefix;
+ private final boolean useOnlyArchiveResources;
+ private final Archive<?> archive;
+ private final Collection<String> useOnlyArchiveResourcesExcludes;
+
+ public OwbSWClassLoader(final ClassLoader parent, final Archive<?> archive, final boolean useOnlyArchiveResources, final Collection<String> useOnlyArchiveResourcesExcludes)
+ {
+ super(new URL[0], parent);
+
+ this.useOnlyArchiveResources = useOnlyArchiveResources;
+ this.useOnlyArchiveResourcesExcludes = useOnlyArchiveResourcesExcludes;
+ this.archive = archive;
+
+ if (WebArchive.class.isInstance(archive))
+ {
+ prefix = "/WEB-INF/classes";
+ }
+ else
+ {
+ prefix = "";
+ }
+
+ try
+ { // add it to find classes if used this way
+ addURL(new URL(null, "archive:" + archive.getName() + "/", new ArchiveStreamHandler()));
+ }
+ catch (final MalformedURLException e)
+ {
+ throw new RuntimeException("Could not create URL for archive: " + archive.getName(), e);
+ }
+ }
+
+ @Override
+ public URL getResource(final String name)
+ {
+ if (useOnlyArchiveResources)
+ {
+ final URL url = findResource(name);
+ if (url != null)
+ {
+ return url;
+ } // else user probably used the fact the test is embedded
+ }
+ return super.getResource(name);
+ }
+
+ @Override
+ public Enumeration<URL> getResources(final String name) throws IOException
+ {
+ if (useOnlyArchiveResources)
+ {
+ final Enumeration<URL> urls = findResources(name);
+ if (useOnlyArchiveResourcesExcludes.contains(name))
+ {
+ final Collection<URL> returnValue = new ArrayList<URL>(Collections.list(urls));
+ returnValue.addAll(Collections.list(super.getResources(name)));
+ return Collections.enumeration(returnValue);
+ }
+ else if (urls.hasMoreElements())
+ {
+ return urls;
+ } // else user probably used the fact the test is embedded
+ }
+ return super.getResources(name);
+ }
+
+ @Override
+ public URL findResource(final String name)
+ {
+ final Node node = findNode(name);
+ if (node != null)
+ {
+ try
+ {
+ return new URL(null, "archive:" + archive.getName() + "/" + name, new ArchiveStreamHandler());
+ }
+ catch (final MalformedURLException e)
+ {
+ // no-op: let reuse parent method
+ }
+ }
+ if (useOnlyArchiveResources)
+ {
+ return null;
+ }
+ return super.findResource(name);
+ }
+
+ @Override
+ public Enumeration<URL> findResources(final String name) throws IOException
+ {
+ final Node node = findNode(name);
+ if (node != null)
+ {
+ return Collections.enumeration(Collections.singleton(new URL(null, "archive:" + archive.getName() + "/" + name, new ArchiveStreamHandler())));
+ }
+ if (useOnlyArchiveResources)
+ {
+ return EMPTY_ENUMERATION;
+ }
+
+ return super.findResources(name);
+ }
+
+ private Node findNode(final String name)
+ {
+ ArchivePath path = ArchivePaths.create(path(prefix, name));
+ Node node = archive.get(path);
+ if (node == null)
+ {
+ path = ArchivePaths.create(name);
+ node = archive.get(path);
+
+
+ }
+ return node;
+ }
+
+ private String path(final String... parts)
+ {
+ final StringBuilder builder = new StringBuilder(parts[0]);
+ for (int i = 1; i < parts.length; i++)
+ {
+ if (!parts[i - 1].endsWith("/") && !parts[i].startsWith("/"))
+ {
+ builder.append("/");
+ }
+ builder.append(parts[i]);
+ }
+ return builder.toString();
+ }
+
+
+ public void close() throws IOException
+ {
+ synchronized (this)
+ {
+ for (final InputStream stream : openedStreams)
+ {
+ try
+ {
+ stream.close();
+ }
+ catch (final Exception e)
+ {
+ // no-op
+ }
+ }
+ openedStreams.clear();
+ }
+ }
+
+ protected class ArchiveStreamHandler extends URLStreamHandler
+ {
+ @Override
+ protected URLConnection openConnection(final URL u) throws IOException
+ {
+ return new URLConnection(u)
+ {
+ @Override
+ public void connect() throws IOException
+ {
+ // no-op
+ }
+
+ @Override
+ public InputStream getInputStream() throws IOException
+ {
+ final ArchivePath path = convertToArchivePath(u);
+ Node node = archive.get(prefix + path.get());
+ if (node == null && !prefix.isEmpty())
+ { // WEB-INF/lib/x.jar!*
+ node = archive.get(path);
+ }
+
+ // SHRINKWRAP-308
+ if (node == null)
+ {
+ throw new FileNotFoundException("Requested path: " + path + " does not exist in " + archive.toString());
+ }
+
+ final Asset asset = node.getAsset();
+ if (asset == null)
+ {
+ return null;
+ }
+
+ final InputStream input = asset.openStream();
+ synchronized (this)
+ {
+ openedStreams.add(input);
+ }
+ return input;
+
+ }
+
+ private ArchivePath convertToArchivePath(final URL url)
+ {
+ return ArchivePaths.create(url.getPath().replace(archive.getName(), ""));
+ }
+ };
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbStandaloneConfiguration.java b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbStandaloneConfiguration.java
new file mode 100644
index 0000000..cf4b81d
--- /dev/null
+++ b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbStandaloneConfiguration.java
@@ -0,0 +1,101 @@
+/*
+ * 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.webbeans.arquillian.standalone;
+
+import org.jboss.arquillian.container.spi.ConfigurationException;
+import org.jboss.arquillian.container.spi.client.container.ContainerConfiguration;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.Properties;
+
+/**
+ * Validate if the Owb Container is correctly configured
+ */
+public class OwbStandaloneConfiguration implements ContainerConfiguration
+{
+ /**
+ * used to skip classpath resources which are not in the archive,
+ * can be useful when a resource should appear a single time in an app
+ */
+ private boolean useOnlyArchiveResources = false;
+ private String useOnlyArchiveResourcesExcludes = null;
+
+ /**
+ * config
+ */
+ private String properties = null;
+
+ @Override
+ public void validate() throws ConfigurationException
+ {
+ // not needed right now
+ }
+
+ public boolean isUseOnlyArchiveResources()
+ {
+ return useOnlyArchiveResources;
+ }
+
+ public void setUseOnlyArchiveResources(final boolean useOnlyArchiveResources)
+ {
+ this.useOnlyArchiveResources = useOnlyArchiveResources;
+ }
+
+ public String getUseOnlyArchiveResourcesExcludes()
+ {
+ return useOnlyArchiveResourcesExcludes;
+ }
+
+ public void setUseOnlyArchiveResourcesExcludes(final String useOnlyArchiveResourcesExcludes)
+ {
+ this.useOnlyArchiveResourcesExcludes = useOnlyArchiveResourcesExcludes;
+ }
+
+ public String getProperties()
+ {
+ return properties;
+ }
+
+ public void setProperties(final String properties)
+ {
+ this.properties = properties;
+ }
+
+ public Properties properties()
+ {
+ final Properties instance = new Properties();
+ if (properties == null)
+ {
+ return instance;
+ }
+
+ final ByteArrayInputStream bais = new ByteArrayInputStream(properties.getBytes());
+ try
+ {
+ instance.load(bais);
+ }
+ catch (final IOException e)
+ {
+ // no-op
+ }
+
+ return instance;
+ }
+}
diff --git a/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbStandaloneContainer.java b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbStandaloneContainer.java
new file mode 100644
index 0000000..1b70786
--- /dev/null
+++ b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbStandaloneContainer.java
@@ -0,0 +1,183 @@
+/*
+ * 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.webbeans.arquillian.standalone;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.config.WebBeansFinder;
+import org.apache.webbeans.exception.WebBeansDeploymentException;
+import org.apache.webbeans.spi.ContainerLifecycle;
+import org.jboss.arquillian.container.spi.client.container.DeployableContainer;
+import org.jboss.arquillian.container.spi.client.container.DeploymentException;
+import org.jboss.arquillian.container.spi.client.container.LifecycleException;
+import org.jboss.arquillian.container.spi.client.protocol.ProtocolDescription;
+import org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData;
+import org.jboss.arquillian.container.spi.context.annotation.DeploymentScoped;
+import org.jboss.arquillian.core.api.InstanceProducer;
+import org.jboss.arquillian.core.api.annotation.Inject;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.descriptor.api.Descriptor;
+
+import javax.enterprise.inject.spi.BeanManager;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.logging.Logger;
+
+/**
+ */
+public class OwbStandaloneContainer implements DeployableContainer<OwbStandaloneConfiguration>
+{
+ private static final Logger LOG = Logger.getLogger(OwbStandaloneContainer.class.getName());
+
+
+ @Inject
+ @DeploymentScoped
+ private InstanceProducer<ContainerLifecycle> lifecycleProducer;
+
+ @Inject
+ @DeploymentScoped
+ private InstanceProducer<BeanManager> beanManagerProducer;
+
+ private OwbArquillianSingletonService singletonService;
+ private WebBeansContext webBeansContext;
+
+ private final ThreadLocal<ClassLoader> originalLoader = new ThreadLocal<ClassLoader>();
+ private boolean useOnlyArchiveResources;
+ private Collection<String> useOnlyArchiveResourcesExcludes = new ArrayList<String>();
+
+ @Override
+ public Class<OwbStandaloneConfiguration> getConfigurationClass()
+ {
+ return OwbStandaloneConfiguration.class;
+ }
+
+ @Override
+ public ProtocolDescription getDefaultProtocol()
+ {
+ return new ProtocolDescription("Local");
+ }
+
+ @Override
+ public void setup(OwbStandaloneConfiguration owbStandaloneConfiguration)
+ {
+ LOG.fine("OpenWebBeans Arquillian setup started");
+
+ singletonService = new OwbArquillianSingletonService(owbStandaloneConfiguration.properties());
+ WebBeansFinder.setSingletonService(singletonService);
+
+ useOnlyArchiveResources = owbStandaloneConfiguration.isUseOnlyArchiveResources();
+ if (useOnlyArchiveResources && owbStandaloneConfiguration.getUseOnlyArchiveResourcesExcludes() != null)
+ {
+ useOnlyArchiveResourcesExcludes = Arrays.asList(owbStandaloneConfiguration.getUseOnlyArchiveResourcesExcludes().split(","));
+ }
+
+ }
+
+ @Override
+ public void start() throws LifecycleException
+ {
+ LOG.fine("OpenWebBeans Arquillian starting");
+ }
+
+ @Override
+ public ProtocolMetaData deploy(Archive<?> archive) throws DeploymentException
+ {
+ singletonService.initOwb();
+
+ webBeansContext = WebBeansContext.getInstance();
+
+ LOG.fine("OpenWebBeans Arquillian starting deployment");
+
+ ContainerLifecycle lifecycle = webBeansContext.getService(ContainerLifecycle.class);
+
+ lifecycleProducer.set(lifecycle);
+ beanManagerProducer.set(lifecycle.getBeanManager());
+
+ OwbArquillianScannerService dummyScannerService = (OwbArquillianScannerService) webBeansContext.getScannerService();
+ dummyScannerService.setArchive(archive);
+
+ final ClassLoader parentLoader = Thread.currentThread().getContextClassLoader();
+ originalLoader.set(parentLoader);
+ Thread.currentThread().setContextClassLoader(new OwbSWClassLoader(parentLoader, archive, useOnlyArchiveResources, useOnlyArchiveResourcesExcludes));
+
+ try
+ {
+ lifecycle.startApplication(null);
+ }
+ catch (WebBeansDeploymentException e)
+ {
+ throw new DeploymentException(e.getMessage(), e);
+ }
+
+ return new ProtocolMetaData();
+ }
+
+ @Override
+ public void undeploy(Archive<?> archive) throws DeploymentException
+ {
+ LOG.fine("OpenWebBeans Arquillian undeploying");
+
+ OwbArquillianScannerService dummyScannerService = (OwbArquillianScannerService) webBeansContext.getScannerService();
+ dummyScannerService.clear();
+ ContainerLifecycle lifecycle = lifecycleProducer.get();
+ if (lifecycle != null)
+ {
+ // end the session lifecycle
+
+ lifecycle.stopApplication(null);
+ }
+
+ final ClassLoader current = Thread.currentThread().getContextClassLoader();
+ if (OwbSWClassLoader.class.isInstance(current))
+ { // should be the case
+ try
+ {
+ OwbSWClassLoader.class.cast(current).close();
+ }
+ catch (final IOException e)
+ {
+ // no-op
+ }
+ }
+ Thread.currentThread().setContextClassLoader(originalLoader.get());
+ originalLoader.remove();
+ }
+
+ @Override
+ public void stop() throws LifecycleException
+ {
+ LOG.fine("OpenWebBeans Arquillian stopping");
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public void deploy(Descriptor descriptor) throws DeploymentException
+ {
+ throw new UnsupportedOperationException("Deployment of Descriptors is not supported in owb-arquillian-standalone!");
+ }
+
+ @Override
+ public void undeploy(Descriptor descriptor) throws DeploymentException
+ {
+ throw new UnsupportedOperationException("Deployment of Descriptors is not supported in owb-arquillian-standalone!");
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/UrlSet.java b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/UrlSet.java
new file mode 100644
index 0000000..bdc71cf
--- /dev/null
+++ b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/UrlSet.java
@@ -0,0 +1,131 @@
+/*
+ * 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.webbeans.arquillian.standalone;
+
+import java.net.URL;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * A {@link java.util.Set} which only takes the externalForm
+ * as key instead the very expensive hashCode.
+ * This is a copy of the impl from openwebbeans-impl since
+ * this Arquillian adaptor also runs with older OWB versions
+ * which do not yet have this class.
+ */
+public class UrlSet implements Set<URL>
+{
+ private Map<String, URL> urlMap = new HashMap<String, URL>();
+
+
+ @Override
+ public boolean add(URL url)
+ {
+ return urlMap.put(url.toExternalForm(), url) == null;
+ }
+
+ @Override
+ public int size()
+ {
+ return urlMap.size();
+ }
+
+ @Override
+ public boolean isEmpty()
+ {
+ return urlMap.isEmpty();
+ }
+
+ @Override
+ public boolean contains(Object o)
+ {
+ if (o instanceof URL && o != null)
+ {
+ return urlMap.containsKey(((URL) o).toExternalForm());
+ }
+
+ return false;
+ }
+
+ @Override
+ public Iterator<URL> iterator()
+ {
+ return urlMap.values().iterator();
+ }
+
+ @Override
+ public Object[] toArray()
+ {
+ return urlMap.values().toArray();
+ }
+
+ @Override
+ public <T> T[] toArray(T[] a)
+ {
+ return urlMap.values().toArray(a);
+ }
+
+ @Override
+ public boolean remove(Object o)
+ {
+ if (o instanceof URL && o != null)
+ {
+ return urlMap.remove(((URL) o).toExternalForm()) != null;
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean containsAll(Collection<?> c)
+ {
+ // not implemented
+ return false;
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends URL> c)
+ {
+ // not implemented
+ return false;
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c)
+ {
+ // not implemented
+ return false;
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c)
+ {
+ // not implemented
+ return false;
+ }
+
+ @Override
+ public void clear()
+ {
+ urlMap.clear();
+ }
+}
diff --git a/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension
new file mode 100644
index 0000000..66e0c3f
--- /dev/null
+++ b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension
@@ -0,0 +1,18 @@
+#Licensed to the Apache Software Foundation (ASF) under one
+#or more contributor license agreements. See the NOTICE file
+#distributed with this work for additional information
+#regarding copyright ownership. The ASF licenses this file
+#to you under the Apache License, Version 2.0 (the
+#"License"); you may not use this file except in compliance
+#with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+#Unless required by applicable law or agreed to in writing,
+#software distributed under the License is distributed on an
+#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#KIND, either express or implied. See the License for the
+#specific language governing permissions and limitations
+#under the License.
+
+org.apache.webbeans.arquillian.standalone.OwbArquillianExtension
diff --git a/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/test/java/org/apache/webbeans/arquillian/test/OwbArquillianJarDeploymentTest.java b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/test/java/org/apache/webbeans/arquillian/test/OwbArquillianJarDeploymentTest.java
new file mode 100644
index 0000000..a8a42ca
--- /dev/null
+++ b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/test/java/org/apache/webbeans/arquillian/test/OwbArquillianJarDeploymentTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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.webbeans.arquillian.test;
+
+import javax.inject.Inject;
+
+import org.apache.webbeans.arquillian.test.beans.SampleUser;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+/**
+ * This test verifies the deployment of a JAR packaging.
+ */
+@RunWith(Arquillian.class)
+public class OwbArquillianJarDeploymentTest
+{
+
+ @Inject
+ private SampleUser sampleUser;
+
+
+ @Deployment
+ public static JavaArchive deploy()
+ {
+ JavaArchive testJar = ShrinkWrap
+ .create(JavaArchive.class, "sampleUserTest.jar")
+ .addClass(OwbArquillianJarDeploymentTest.class)
+ .addPackage(SampleUser.class.getPackage())
+ .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+
+ return testJar;
+ }
+
+ @Test
+ public void testOwbArqContainerStartup()
+ {
+ Assert.assertNotNull(sampleUser);
+ Assert.assertEquals("Hans", sampleUser.getFirstName());
+
+ sampleUser.setFirstName("Karl");
+ Assert.assertEquals("Karl", sampleUser.getFirstName());
+ }
+}
diff --git a/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/test/java/org/apache/webbeans/arquillian/test/OwbArquillianWebInfClassesDeploymentTest.java b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/test/java/org/apache/webbeans/arquillian/test/OwbArquillianWebInfClassesDeploymentTest.java
new file mode 100644
index 0000000..f6ef6bb
--- /dev/null
+++ b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/test/java/org/apache/webbeans/arquillian/test/OwbArquillianWebInfClassesDeploymentTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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.webbeans.arquillian.test;
+
+import javax.inject.Inject;
+
+import org.apache.webbeans.arquillian.test.beans.SampleUser;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+/**
+ * This test verifies the deployment of a JAR packaging.
+ */
+@RunWith(Arquillian.class)
+public class OwbArquillianWebInfClassesDeploymentTest
+{
+
+ @Inject
+ private SampleUser sampleUser;
+
+
+ @Deployment
+ public static Archive deploy()
+ {
+ WebArchive testWar = ShrinkWrap
+ .create(WebArchive.class, "sampleUserTest.war")
+ .addClass(OwbArquillianWebInfClassesDeploymentTest.class)
+ .addPackage(SampleUser.class.getPackage())
+ .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
+
+ return testWar;
+ }
+
+ @Test
+ public void testOwbArqContainerStartup()
+ {
+ Assert.assertNotNull(sampleUser);
+ Assert.assertEquals("Hans", sampleUser.getFirstName());
+
+ sampleUser.setFirstName("Karl");
+ Assert.assertEquals("Karl", sampleUser.getFirstName());
+ }
+}
diff --git a/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/test/java/org/apache/webbeans/arquillian/test/OwbArquillianWebJarDeploymentTest.java b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/test/java/org/apache/webbeans/arquillian/test/OwbArquillianWebJarDeploymentTest.java
new file mode 100644
index 0000000..16e36c5
--- /dev/null
+++ b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/test/java/org/apache/webbeans/arquillian/test/OwbArquillianWebJarDeploymentTest.java
@@ -0,0 +1,73 @@
+/*
+ * 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.webbeans.arquillian.test;
+
+import javax.inject.Inject;
+
+import org.apache.webbeans.arquillian.test.beans.SampleUser;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+/**
+ * This test verifies the deployment of a JAR packaging.
+ */
+@RunWith(Arquillian.class)
+public class OwbArquillianWebJarDeploymentTest
+{
+
+ @Inject
+ private SampleUser sampleUser;
+
+
+ @Deployment
+ public static Archive deploy()
+ {
+ JavaArchive testJar = ShrinkWrap
+ .create(JavaArchive.class, "sampleUserTest.jar")
+ .addClass(OwbArquillianWebJarDeploymentTest.class)
+ .addPackage(SampleUser.class.getPackage())
+ .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+
+
+ WebArchive testWar = ShrinkWrap
+ .create(WebArchive.class, "sampleUserTest.war")
+ .addAsLibrary(testJar);
+
+ return testWar;
+ }
+
+ @Test
+ public void testOwbArqContainerStartup()
+ {
+ Assert.assertNotNull(sampleUser);
+ Assert.assertEquals("Hans", sampleUser.getFirstName());
+
+ sampleUser.setFirstName("Karl");
+ Assert.assertEquals("Karl", sampleUser.getFirstName());
+ }
+}
diff --git a/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/test/java/org/apache/webbeans/arquillian/test/VirtualResourceInWebappTest.java b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/test/java/org/apache/webbeans/arquillian/test/VirtualResourceInWebappTest.java
new file mode 100644
index 0000000..f3cec5c
--- /dev/null
+++ b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/test/java/org/apache/webbeans/arquillian/test/VirtualResourceInWebappTest.java
@@ -0,0 +1,69 @@
+/*
+ * 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.webbeans.arquillian.test;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+@RunWith(Arquillian.class)
+public class VirtualResourceInWebappTest
+{
+ @Deployment
+ public static Archive<?> war()
+ {
+ return ShrinkWrap.create(WebArchive.class).addAsWebInfResource(new StringAsset("virtual-webapp"), "classes/resource.txt");
+ }
+
+ @Test
+ public void checkResourceIsAvailable() throws IOException
+ {
+ final InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("resource.txt");
+ assertNotNull(is);
+
+ try
+ {
+ assertEquals("virtual-webapp", new BufferedReader(new InputStreamReader(is)).readLine());
+ }
+ finally
+ {
+ try
+ {
+ is.close();
+ }
+ catch (final IOException e)
+ {
+ // no-op
+ }
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/test/java/org/apache/webbeans/arquillian/test/VirtualResourceTest.java b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/test/java/org/apache/webbeans/arquillian/test/VirtualResourceTest.java
new file mode 100644
index 0000000..a7552f0
--- /dev/null
+++ b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/test/java/org/apache/webbeans/arquillian/test/VirtualResourceTest.java
@@ -0,0 +1,69 @@
+/*
+ * 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.webbeans.arquillian.test;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+@RunWith(Arquillian.class)
+public class VirtualResourceTest
+{
+ @Deployment
+ public static Archive<?> jar()
+ {
+ return ShrinkWrap.create(JavaArchive.class).addAsResource(new StringAsset("virtual"), "resource.txt");
+ }
+
+ @Test
+ public void checkResourceIsAvailable() throws IOException
+ {
+ final InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("resource.txt");
+ assertNotNull(is);
+
+ try
+ {
+ assertEquals("virtual", new BufferedReader(new InputStreamReader(is)).readLine());
+ }
+ finally
+ {
+ try
+ {
+ is.close();
+ }
+ catch (final IOException e)
+ {
+ // no-op
+ }
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/test/java/org/apache/webbeans/arquillian/test/beans/SampleUser.java b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/test/java/org/apache/webbeans/arquillian/test/beans/SampleUser.java
new file mode 100644
index 0000000..529c43d
--- /dev/null
+++ b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/test/java/org/apache/webbeans/arquillian/test/beans/SampleUser.java
@@ -0,0 +1,48 @@
+/*
+ * 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.webbeans.arquillian.test.beans;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.SessionScoped;
+import java.io.Serializable;
+
+/**
+ * A sample User to get injected into an Arquillian test
+ */
+@SessionScoped
+public class SampleUser implements Serializable
+{
+ private String firstName;
+
+ @PostConstruct
+ public void init()
+ {
+ firstName = "Hans";
+ }
+
+ public String getFirstName()
+ {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName)
+ {
+ this.firstName = firstName;
+ }
+}
diff --git a/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/test/resources/META-INF/beans.xml b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/test/resources/META-INF/beans.xml
new file mode 100644
index 0000000..85b6e63
--- /dev/null
+++ b/owb_1.2.x/webbeans-arquillian/owb-arquillian-standalone/src/test/resources/META-INF/beans.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+<beans/>
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-arquillian/pom.xml b/owb_1.2.x/webbeans-arquillian/pom.xml
new file mode 100644
index 0000000..4744bcf
--- /dev/null
+++ b/owb_1.2.x/webbeans-arquillian/pom.xml
@@ -0,0 +1,96 @@
+<?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.
+-->
+<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>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>1.2.5</version>
+ </parent>
+ <groupId>org.apache.openwebbeans.arquillian</groupId>
+ <artifactId>owb-arquillian-parent</artifactId>
+ <packaging>pom</packaging>
+ <name>OWB Arquillian Parent</name>
+ <modules>
+ <module>owb-arquillian-standalone</module>
+ </modules>
+
+ <properties>
+ <arquillian.version>1.0.3.Final</arquillian.version>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-bom</artifactId>
+ <version>${arquillian.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+<!--
+ <dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-build</artifactId>
+ <version>${arquillian.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+-->
+ </dependencies>
+
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.arquillian.core</groupId>
+ <artifactId>arquillian-core-spi</artifactId>
+ <version>${arquillian.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-container-spi</artifactId>
+ <version>${arquillian.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.junit</groupId>
+ <artifactId>arquillian-junit-container</artifactId>
+ <version>${arquillian.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.shrinkwrap</groupId>
+ <artifactId>shrinkwrap-api</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+
+ </dependencies>
+
+
+</project>
diff --git a/owb_1.2.x/webbeans-clustering/pom.xml b/owb_1.2.x/webbeans-clustering/pom.xml
new file mode 100644
index 0000000..27b949a
--- /dev/null
+++ b/owb_1.2.x/webbeans-clustering/pom.xml
@@ -0,0 +1,98 @@
+<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">
+<!--
+
+ 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.
+-->
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>1.2.5</version>
+ </parent>
+
+ <artifactId>openwebbeans-clustering</artifactId>
+ <name>Clustering Plugin</name>
+ <description>Clustering plugin</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_2.5_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-web</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ow2.asm</groupId>
+ <artifactId>asm-all</artifactId>
+ <version>4.1</version>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-el_2.2_spec</artifactId>
+ <optional>true</optional>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+ <optional>true</optional>
+ <scope>test</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+
+ </dependencies>
+
+</project>
diff --git a/owb_1.2.x/webbeans-clustering/src/main/java/org/apache/webbeans/web/failover/DefaultOwbFailOverService.java b/owb_1.2.x/webbeans-clustering/src/main/java/org/apache/webbeans/web/failover/DefaultOwbFailOverService.java
new file mode 100644
index 0000000..733b683
--- /dev/null
+++ b/owb_1.2.x/webbeans-clustering/src/main/java/org/apache/webbeans/web/failover/DefaultOwbFailOverService.java
@@ -0,0 +1,392 @@
+/*
+ * 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.webbeans.web.failover;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInput;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.UUID;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.enterprise.context.Conversation;
+import javax.enterprise.inject.spi.Bean;
+import javax.servlet.http.HttpSession;
+
+import org.apache.webbeans.config.OpenWebBeansConfiguration;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.ConversationContext;
+import org.apache.webbeans.context.SessionContext;
+import org.apache.webbeans.conversation.ConversationManager;
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.spi.FailOverService;
+import org.apache.webbeans.web.context.SessionContextManager;
+import org.apache.webbeans.web.context.WebContextsService;
+
+/**
+ * Default implementation of the {@link FailOverService}.
+ */
+public class DefaultOwbFailOverService implements FailOverService
+{
+ private static final Logger LOGGER = WebBeansLoggerFacade.getLogger(DefaultOwbFailOverService.class);
+
+ public static final String CONFIG_IS_SUPPORT_FAILOVER = "org.apache.webbeans.web.failover.issupportfailover";
+ public static final String CONFIG_IS_SUPPORT_PASSIVATE = "org.apache.webbeans.web.failover.issupportpassivation";
+ public static final String CONFIG_RESOURCES_SERIALIZATION_HANDLER = "org.apache.webbeans.web.failover.resources.serialization.handler.v10";
+
+ public static final String ATTRIBUTE_SESSION_CONTEXT = "sessionContext";
+ public static final String ATTRIBUTE_CONVERSATION_CONTEXT_MAP = "conversatzionContextMap";
+
+ private static final String JVM_ID = UUID.randomUUID().toString() + "_" + System.currentTimeMillis();
+
+ private final WebBeansContext webBeansContext = WebBeansContext.currentInstance();
+
+ private ThreadLocal<Boolean> passivation = new ThreadLocal<Boolean>();
+ private boolean supportFailOver;
+ private boolean supportPassivation;
+ private SerializationHandlerV10 handler;
+
+ public DefaultOwbFailOverService()
+ {
+ OpenWebBeansConfiguration config = webBeansContext.getOpenWebBeansConfiguration();
+
+ String value;
+
+ value = config.getProperty(CONFIG_IS_SUPPORT_FAILOVER);
+ if (value != null && value.equalsIgnoreCase("true"))
+ {
+ supportFailOver = true;
+ }
+
+ value = config.getProperty(CONFIG_IS_SUPPORT_PASSIVATE);
+ if (value != null && value.equalsIgnoreCase("true"))
+ {
+ supportPassivation = true;
+ }
+
+ if (supportFailOver || supportPassivation)
+ {
+ value = config.getProperty(CONFIG_RESOURCES_SERIALIZATION_HANDLER);
+
+ if (value != null)
+ {
+ try
+ {
+ handler = (SerializationHandlerV10) Class.forName(value).newInstance();
+ }
+ catch (Exception e)
+ {
+ LOGGER.log(Level.SEVERE, "DefaultOwbFailOverService could not instanciate: [" + value + "]", e);
+ }
+ }
+ }
+
+ if (LOGGER.isLoggable(Level.FINE))
+ {
+ LOGGER.log(Level.FINE, "IsSupportFailOver: [{0}]", String.valueOf(supportFailOver));
+ LOGGER.log(Level.FINE, "IsSupportPassivation: [{0}]", String.valueOf(supportPassivation));
+ }
+ }
+
+ @Override
+ public void sessionIsIdle(HttpSession session)
+ {
+ if (session != null)
+ {
+ FailOverBag bag = (FailOverBag) session.getAttribute(FailOverBag.SESSION_ATTRIBUTE_NAME);
+
+ if (bag == null)
+ {
+ bag = new FailOverBag(session.getId(), getJvmId());
+ }
+
+ bag.setSessionInUse(false);
+
+ storeBeansInFailOverBag(bag, session);
+
+ addFailOverBagToSession(bag, session);
+ addActivationListenerToSession(session);
+ }
+
+ passivation.remove();
+ passivation.set(null);
+ }
+
+ @Override
+ public void sessionIsInUse(HttpSession session)
+ {
+ if (session != null)
+ {
+ FailOverBag bag = (FailOverBag) session.getAttribute(FailOverBag.SESSION_ATTRIBUTE_NAME);
+
+ if (bag != null)
+ {
+ bag.setSessionInUse(true);
+ }
+
+ addActivationListenerToSession(session);
+ }
+ }
+
+ @Override
+ public void sessionDidActivate(HttpSession session)
+ {
+ FailOverBag bag = (FailOverBag) session.getAttribute(FailOverBag.SESSION_ATTRIBUTE_NAME);
+
+ if (bag != null)
+ {
+ if (bag.isSessionInUse())
+ {
+ if (LOGGER.isLoggable(Level.FINE))
+ {
+ LOGGER.log(Level.FINE, "Skip restore beans for session [" + bag.getSessionId() + "] because session is in use.");
+ }
+ }
+ else
+ {
+ if (LOGGER.isLoggable(Level.FINE))
+ {
+ LOGGER.log(Level.FINE, "Restore beans for session [{0}]", session.getId());
+ }
+
+ restoreBeansFromFailOverBag(bag, session);
+ }
+ }
+ }
+
+ @Override
+ public void sessionWillPassivate(HttpSession session)
+ {
+ sessionIsIdle(session);
+
+ passivation.set(true);
+ }
+
+ /**
+ * Adds the {@link FailOverSessionActivationListener} to the current {@link HttpSession}.
+ * It must not be manually registered when we store it as session attribute.
+ *
+ * @param session The current {@link HttpSession}.
+ */
+ protected void addActivationListenerToSession(HttpSession session)
+ {
+ if (session.getAttribute(FailOverSessionActivationListener.SESSION_ATTRIBUTE_NAME) == null)
+ {
+ session.setAttribute(FailOverSessionActivationListener.SESSION_ATTRIBUTE_NAME, new FailOverSessionActivationListener());
+ }
+ }
+
+ /**
+ * Store the {@link FailOverBag} as attribute to the current {@link HttpSession}.
+ * So when the session is fail over to other JVM or local disk, the
+ * attribute could also be serialized.
+ *
+ * @param bag The {@link FailOverBag}.
+ * @param session The current {@link HttpSession}.
+ */
+ protected void addFailOverBagToSession(FailOverBag bag, HttpSession session)
+ {
+ try
+ {
+ session.setAttribute(FailOverBag.SESSION_ATTRIBUTE_NAME, bag);
+
+ if (LOGGER.isLoggable(Level.FINE))
+ {
+ LOGGER.log(Level.FINE, "Successfully added FailOverBag to session [" + bag.getSessionId() + "].");
+ }
+ }
+ catch (Exception e)
+ {
+ String message = "Could not add FailOverBag to session [" + bag.getSessionId() + "].";
+ LOGGER.log(Level.SEVERE, message, e);
+
+ throw new WebBeansException(message, e);
+ }
+ }
+
+ /**
+ * Stores the session and conversation contexts in the {@link FailOverBag}.
+ *
+ * @param bag The {@link FailOverBag}.
+ * @param session The current {@link HttpSession}.
+ */
+ protected void storeBeansInFailOverBag(FailOverBag bag, HttpSession session)
+ {
+ // store the session context
+ SessionContextManager sessionManager =
+ ((WebContextsService) webBeansContext.getContextsService()).getSessionContextManager();
+ SessionContext sessionContext = sessionManager.getSessionContextWithSessionId(session.getId());
+ bag.put(ATTRIBUTE_SESSION_CONTEXT, sessionContext);
+
+ // store all conversation contexts
+ ConversationManager conversationManager = webBeansContext.getConversationManager();
+ bag.put(ATTRIBUTE_CONVERSATION_CONTEXT_MAP, conversationManager.getConversationMapWithSessionId(session.getId()));
+
+ if (LOGGER.isLoggable(Level.FINE))
+ {
+ LOGGER.log(Level.FINE, "Beans for session [" + bag.getSessionId() + "] successfully stored in FailOverBag.");
+ }
+ }
+
+ /**
+ * Restores the session and conversation contexts from the given {@link FailOverBag}.
+ *
+ * @param bag The {@link FailOverBag}.
+ * @param session The current {@link HttpSession}.
+ */
+ @SuppressWarnings("unchecked")
+ protected void restoreBeansFromFailOverBag(FailOverBag bag, HttpSession session)
+ {
+ try
+ {
+ // restore session context
+ SessionContext sessionContext = (SessionContext) bag.get(ATTRIBUTE_SESSION_CONTEXT);
+
+ if (sessionContext != null)
+ {
+ SessionContextManager sessionManager =
+ ((WebContextsService) webBeansContext.getContextsService()).getSessionContextManager();
+
+ sessionManager.addNewSessionContext(session.getId(), sessionContext);
+ sessionContext.setActive(true);
+ }
+
+ // restore conversation contexts
+ Map<Conversation, ConversationContext> conversationContextMap =
+ (Map<Conversation, ConversationContext>) bag.get(ATTRIBUTE_CONVERSATION_CONTEXT_MAP);
+
+ if (conversationContextMap != null && !conversationContextMap.isEmpty())
+ {
+ ConversationManager conversationManager = webBeansContext.getConversationManager();
+ Iterator<Conversation> iterator = conversationContextMap.keySet().iterator();
+
+ while (iterator.hasNext())
+ {
+ Conversation conversation = iterator.next();
+ ConversationContext context = conversationContextMap.get(conversation);
+ conversationManager.addConversationContext(conversation, context);
+ }
+ }
+
+ if (LOGGER.isLoggable(Level.FINE))
+ {
+ LOGGER.log(Level.FINE, "Beans for session [" + bag.getSessionId() + "] from [" + bag.getJvmId() + "] successfully restored.");
+ }
+ }
+ catch (Exception e)
+ {
+ String message = "Could not restore beans for session [" + bag.getSessionId()
+ + "] from [" + bag.getJvmId() + "]";
+ LOGGER.log(Level.SEVERE, message, e);
+
+ throw new WebBeansException(message, e);
+ }
+ }
+
+ /**
+ * Except the EJB remote stub, it is hard to handle other types of
+ * resources. Here we delegate serialization/deserialization to the
+ * application provided SerializationHandler.
+ */
+ @Override
+ public Object handleResource(Bean<?> bean, Object resourceObject, ObjectInput in, ObjectOutput out)
+ {
+ if (handler != null)
+ {
+ return handler.handleResource(bean, resourceObject, in, out,
+ (isPassivation()) ? SerializationHandlerV10.TYPE_PASSIVATION : SerializationHandlerV10.TYPE_FAILOVER);
+ }
+ return NOT_HANDLED;
+ }
+
+ /**
+ * Get object input stream. Note, the stream should support deserialize
+ * javassist objects.
+ *
+ * @deprecated as we do not use Javassist anymore this is not needed anymore!
+ *
+ * @return custom object input stream.
+ */
+ @Override
+ public ObjectInputStream getObjectInputStream(InputStream in) throws IOException
+ {
+ return new ObjectInputStream(in);
+ }
+
+ /**
+ * Get object output stream. Note, the stream should support deserialize
+ * javassist objects.
+ *
+ * @deprecated as we do not use Javassist anymore this is not needed anymore!
+ *
+ * @return custom object output stream.
+ */
+ @Override
+ public ObjectOutputStream getObjectOutputStream(OutputStream out) throws IOException
+ {
+ return new ObjectOutputStream(out);
+ }
+
+ @Override
+ public String getJvmId()
+ {
+ return JVM_ID;
+ }
+
+ @Override
+ public boolean isSupportFailOver()
+ {
+ return supportFailOver;
+ }
+
+ @Override
+ public void enableFailOverSupport(boolean supportFailOver)
+ {
+ this.supportFailOver = supportFailOver;
+ }
+
+ @Override
+ public boolean isSupportPassivation()
+ {
+ return supportPassivation;
+ }
+
+ @Override
+ public void enablePassivationSupport(boolean supportPassivation)
+ {
+ this.supportPassivation = supportPassivation;
+ }
+
+ public boolean isPassivation()
+ {
+ if (passivation.get() == null)
+ {
+ passivation.set(false);
+ }
+
+ return passivation.get();
+ }
+}
diff --git a/owb_1.2.x/webbeans-clustering/src/main/java/org/apache/webbeans/web/failover/FailOverBag.java b/owb_1.2.x/webbeans-clustering/src/main/java/org/apache/webbeans/web/failover/FailOverBag.java
new file mode 100644
index 0000000..68d0491
--- /dev/null
+++ b/owb_1.2.x/webbeans-clustering/src/main/java/org/apache/webbeans/web/failover/FailOverBag.java
@@ -0,0 +1,174 @@
+/*
+ * 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.webbeans.web.failover;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.spi.FailOverService;
+
+/**
+ * Bag which holds all required informations for the fail over.
+ */
+public class FailOverBag implements Serializable, Externalizable
+{
+ public static final String SESSION_ATTRIBUTE_NAME = "o.a.owb.FAIL_OVER_BAG";
+
+ private static final Logger LOGGER = WebBeansLoggerFacade.getLogger(FailOverBag.class);
+ private static final long serialVersionUID = -6314819837009653190L;
+
+ private transient FailOverService failOverService;
+
+ private Map<String, Object> items;
+ private boolean sessionInUse;
+ private String sessionId;
+ private String jvmId;
+
+ /**
+ * Used by serialization.
+ */
+ public FailOverBag()
+ {
+ WebBeansContext webBeansContext = WebBeansContext.currentInstance();
+
+ this.failOverService = webBeansContext.getService(FailOverService.class);
+ this.items = new HashMap<String, Object>();
+ }
+
+ public FailOverBag(String sessionId, String jvmId)
+ {
+ WebBeansContext webBeansContext = WebBeansContext.currentInstance();
+
+ this.failOverService = webBeansContext.getService(FailOverService.class);
+ this.items = new HashMap<String, Object>();
+ this.sessionId = sessionId;
+ this.jvmId = jvmId;
+ }
+
+ public void put(String name, Object item)
+ {
+ items.put(name, item);
+ }
+
+ public Object get(String name)
+ {
+ return items.get(name);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ sessionInUse = in.readBoolean();
+ sessionId = (String) in.readObject();
+ jvmId = (String) in.readObject();
+
+ if (sessionInUse)
+ {
+ if (LOGGER.isLoggable(Level.FINE))
+ {
+ LOGGER.log(Level.FINE, "Skip bean de-serialization because session with id [" + sessionId + "] is in use.");
+ }
+
+ return;
+ }
+
+ byte[] buffer = (byte[]) in.readObject();
+ ByteArrayInputStream bais = new ByteArrayInputStream(buffer);
+ ObjectInputStream ois = failOverService.getObjectInputStream(bais);
+
+ items = (Map<String, Object>) ois.readObject();
+
+ ois.close();
+ }
+
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ out.writeBoolean(sessionInUse);
+ out.writeObject(sessionId);
+ out.writeObject(jvmId);
+
+ if (sessionInUse)
+ {
+ if (LOGGER.isLoggable(Level.FINE))
+ {
+ LOGGER.log(Level.FINE, "Skip bean serialization because session with id [" + sessionId + "] is in use.");
+ }
+
+ return;
+ }
+
+ // In old times (< OWB-1.2.0) We could not directly use java object stream since we were using javassist.
+ // Thus we had to serialize the bag by use javassist object stream.
+ // this is needed anymore since owb-1.2.0!
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = failOverService.getObjectOutputStream(baos);
+ oos.writeObject(items);
+ oos.flush();
+
+ out.writeObject(baos.toByteArray());
+
+ oos.close();
+ baos.close();
+ }
+
+ public boolean isSessionInUse()
+ {
+ return sessionInUse;
+ }
+
+ public void setSessionInUse(boolean sessionInUse)
+ {
+ this.sessionInUse = sessionInUse;
+ }
+
+ public String getSessionId()
+ {
+ return sessionId;
+ }
+
+ public void setSessionId(String sessionId)
+ {
+ this.sessionId = sessionId;
+ }
+
+ public String getJvmId()
+ {
+ return jvmId;
+ }
+
+ public void setJvmId(String jvmId)
+ {
+ this.jvmId = jvmId;
+ }
+}
diff --git a/owb_1.2.x/webbeans-clustering/src/main/java/org/apache/webbeans/web/failover/FailOverFilter.java b/owb_1.2.x/webbeans-clustering/src/main/java/org/apache/webbeans/web/failover/FailOverFilter.java
new file mode 100644
index 0000000..73996cd
--- /dev/null
+++ b/owb_1.2.x/webbeans-clustering/src/main/java/org/apache/webbeans/web/failover/FailOverFilter.java
@@ -0,0 +1,90 @@
+/*
+ * 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.webbeans.web.failover;
+
+import java.io.IOException;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.spi.FailOverService;
+
+/**
+ * {@link Filter} which handles the bean fail over.
+ * This extra {@link Filter} is required because
+ * {@link javax.servlet.ServletRequestListener#requestDestroyed(javax.servlet.ServletRequestEvent)}
+ * will be called after Tomcats session replication and is not in sync with the specs.
+ */
+public class FailOverFilter implements Filter
+{
+ protected FailOverService failoverService;
+
+ /**
+ * Default constructor.
+ */
+ public FailOverFilter()
+ {
+ WebBeansContext webBeansContext = WebBeansContext.currentInstance();
+ failoverService = webBeansContext.getService(FailOverService.class);
+ }
+
+ @Override
+ public void destroy()
+ {
+ //do nothing
+ }
+
+ @Override
+ public void doFilter(ServletRequest request, ServletResponse response,
+ FilterChain chain) throws IOException, ServletException
+ {
+ try
+ {
+ chain.doFilter(request, response);
+ }
+ finally
+ {
+ if (failoverService != null
+ && failoverService.isSupportFailOver()
+ && request instanceof HttpServletRequest)
+ {
+ HttpServletRequest httpRequest = (HttpServletRequest) request;
+ HttpSession session = httpRequest.getSession(false);
+
+ if (session != null)
+ {
+ failoverService.sessionIsIdle(session);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void init(FilterConfig config) throws ServletException
+ {
+ //do nothing
+ }
+}
diff --git a/owb_1.2.x/webbeans-clustering/src/main/java/org/apache/webbeans/web/failover/FailOverSessionActivationListener.java b/owb_1.2.x/webbeans-clustering/src/main/java/org/apache/webbeans/web/failover/FailOverSessionActivationListener.java
new file mode 100644
index 0000000..491ea82
--- /dev/null
+++ b/owb_1.2.x/webbeans-clustering/src/main/java/org/apache/webbeans/web/failover/FailOverSessionActivationListener.java
@@ -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.webbeans.web.failover;
+
+import java.io.Serializable;
+
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionActivationListener;
+import javax.servlet.http.HttpSessionEvent;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.spi.FailOverService;
+
+/**
+ * {@link HttpSessionActivationListener} which informs the {@link FailOverService}
+ * about session activation and passivation.
+ *
+ * It must NOT be manually registered because the {@link FailOverService}
+ * store it as session attribute and therefore it will be executed automatically.
+ */
+public class FailOverSessionActivationListener implements HttpSessionActivationListener, Serializable
+{
+ public static final String SESSION_ATTRIBUTE_NAME = "o.a.owb.SESSION_ACTIVATION_LISTENER";
+
+ private static final long serialVersionUID = -5690043082210295824L;
+
+ @Override
+ public void sessionWillPassivate(HttpSessionEvent event)
+ {
+ WebBeansContext webBeansContext = WebBeansContext.currentInstance();
+ FailOverService failOverService = webBeansContext.getService(FailOverService.class);
+
+ if (failOverService != null && failOverService.isSupportPassivation())
+ {
+ HttpSession session = event.getSession();
+ failOverService.sessionWillPassivate(session);
+ }
+ }
+
+ @Override
+ public void sessionDidActivate(HttpSessionEvent event)
+ {
+ WebBeansContext webBeansContext = WebBeansContext.currentInstance();
+ FailOverService failOverService = webBeansContext.getService(FailOverService.class);
+
+ if (failOverService != null && (failOverService.isSupportFailOver() || failOverService.isSupportPassivation()))
+ {
+ HttpSession session = event.getSession();
+ failOverService.sessionDidActivate(session);
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-clustering/src/main/java/org/apache/webbeans/web/failover/SerializationHandlerV10.java b/owb_1.2.x/webbeans-clustering/src/main/java/org/apache/webbeans/web/failover/SerializationHandlerV10.java
new file mode 100644
index 0000000..b9b4d46
--- /dev/null
+++ b/owb_1.2.x/webbeans-clustering/src/main/java/org/apache/webbeans/web/failover/SerializationHandlerV10.java
@@ -0,0 +1,64 @@
+/*
+ * 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.webbeans.web.failover;
+
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+import javax.enterprise.inject.spi.Bean;
+
+/**
+ * Application could implement this interface and register with failover service to handle
+ * serialization/deserialization of resource beans. Failover serivce will invoke this
+ * handleResource Method then.
+ *
+ */
+public interface SerializationHandlerV10
+{
+ /**
+ * failover case.
+ */
+ public final static int TYPE_FAILOVER = 0;
+
+ /**
+ * passivation case.
+ */
+ public final static int TYPE_PASSIVATION = 1;
+
+ /**
+ * Application provided custom handler for serialize
+ * and deserialize resource beans.
+ *
+ * @param bean The resource bean.
+ * @param resourceObject The resource bean instance
+ * @param in The input object stream
+ * @param out The output object stream
+ * @param type TYPE_FAILOVER or TYPE_PASSIVATION
+ *
+ * @return NOT_HANDLED if not handled by handler.
+ */
+ public Object handleResource(
+ Bean<?> bean,
+ Object resourceObject,
+ ObjectInput in,
+ ObjectOutput out,
+ int type
+ );
+
+}
diff --git a/owb_1.2.x/webbeans-clustering/src/main/resources/META-INF/openwebbeans/openwebbeans.properties b/owb_1.2.x/webbeans-clustering/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
new file mode 100644
index 0000000..7d70a63
--- /dev/null
+++ b/owb_1.2.x/webbeans-clustering/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
@@ -0,0 +1,30 @@
+#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.
+#---------------------------------------------------------------
+# The Clustering configuration for OpenWebBeans
+#
+#---------------------------------------------------------------
+configuration.ordinal=20
+
+################################ Failover Service #############################################
+org.apache.webbeans.spi.FailOverService=org.apache.webbeans.web.failover.DefaultOwbFailOverService
+org.apache.webbeans.web.failover.issupportfailover=true
+org.apache.webbeans.web.failover.issupportpassivation=true
+
+# we need to enable conversation support
+org.apache.webbeans.application.supportsConversation=true
+##############################################################################################
diff --git a/owb_1.2.x/webbeans-clustering/src/test/java/org/apache/webbeans/web/failover/tests/AbstractUnitTest.java b/owb_1.2.x/webbeans-clustering/src/test/java/org/apache/webbeans/web/failover/tests/AbstractUnitTest.java
new file mode 100644
index 0000000..e053786
--- /dev/null
+++ b/owb_1.2.x/webbeans-clustering/src/test/java/org/apache/webbeans/web/failover/tests/AbstractUnitTest.java
@@ -0,0 +1,145 @@
+/*
+ * 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.webbeans.web.failover.tests;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.Extension;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.config.WebBeansFinder;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.lifecycle.test.OpenWebBeansTestLifeCycle;
+import org.apache.webbeans.lifecycle.test.OpenWebBeansTestMetaDataDiscoveryService;
+import org.apache.webbeans.spi.ContainerLifecycle;
+import org.apache.webbeans.util.WebBeansUtil;
+import org.junit.Assert;
+
+
+public abstract class AbstractUnitTest
+{
+ private OpenWebBeansTestLifeCycle testLifecycle;
+ private List<Extension> extensions = new ArrayList<Extension>();
+ private WebBeansContext webBeansContext;
+
+ protected AbstractUnitTest()
+ {
+
+ }
+
+ protected void startContainer(Collection<Class<?>> beanClasses)
+ {
+ startContainer(beanClasses, null);
+ }
+
+ protected void startContainer(Collection<Class<?>> beanClasses, Collection<String> beanXmls)
+ {
+ WebBeansFinder.clearInstances(WebBeansUtil.getCurrentClassLoader());
+ //Creates a new container
+ testLifecycle = new OpenWebBeansTestLifeCycle();
+
+ webBeansContext = WebBeansContext.getInstance();
+ for (Extension ext : extensions)
+ {
+ webBeansContext.getExtensionLoader().addExtension(ext);
+ }
+
+ //Deploy bean classes
+ OpenWebBeansTestMetaDataDiscoveryService discoveryService = (OpenWebBeansTestMetaDataDiscoveryService)webBeansContext.getScannerService();
+ discoveryService.deployClasses(beanClasses);
+ if (beanXmls != null)
+ {
+ discoveryService.deployXMLs(beanXmls);
+ }
+
+ //Start application
+ try
+ {
+ testLifecycle.startApplication(null);
+ }
+ catch (Exception e)
+ {
+ throw new WebBeansConfigurationException(e);
+ }
+
+ }
+
+ protected ContainerLifecycle getLifecycle()
+ {
+ return testLifecycle;
+ }
+
+ protected void shutDownContainer()
+ {
+ //Shwtdown application
+ if(this.testLifecycle != null)
+ {
+ this.testLifecycle.stopApplication(null);
+ }
+ }
+
+ protected WebBeansContext getWebBeansContext()
+ {
+ return this.webBeansContext;
+ }
+
+ protected BeanManager getBeanManager()
+ {
+ return this.webBeansContext.getBeanManagerImpl();
+ }
+
+ @SuppressWarnings("unchecked")
+ protected <T> T getInstance(Class<T> type, Annotation... qualifiers)
+ {
+ Set<Bean<?>> beans = getBeanManager().getBeans(type, qualifiers);
+ Assert.assertNotNull(beans);
+
+ Bean<?> bean = getBeanManager().resolve(beans);
+
+ return (T) getBeanManager().getReference(bean, type, getBeanManager().createCreationalContext(bean));
+ }
+
+ protected String getXmlPath(String packageName, String fileName)
+ {
+ StringBuilder prefix = new StringBuilder(packageName.replace('.', '/'));
+ prefix.append("/");
+ prefix.append(fileName);
+ prefix.append(".xml");
+
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ return loader.getResource(prefix.toString()).toExternalForm();
+ }
+
+ /**
+ * Add a CDI Extension which should get used in the test case.
+ * Use this function instead of defining test Extensions via the usual
+ * META-INF/services/javax.enterprise.inject.spi.Extension file!
+ *
+ * @param ext the {@link Extension} which should get loaded
+ */
+ public void addExtension(Extension ext) {
+ this.extensions.add(ext);
+ }
+}
diff --git a/owb_1.2.x/webbeans-clustering/src/test/java/org/apache/webbeans/web/failover/tests/ConversationScopedBean.java b/owb_1.2.x/webbeans-clustering/src/test/java/org/apache/webbeans/web/failover/tests/ConversationScopedBean.java
new file mode 100644
index 0000000..eb2fb38
--- /dev/null
+++ b/owb_1.2.x/webbeans-clustering/src/test/java/org/apache/webbeans/web/failover/tests/ConversationScopedBean.java
@@ -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.webbeans.web.failover.tests;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.Conversation;
+import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+
+@ConversationScoped
+public class ConversationScopedBean implements Serializable
+{
+ private static final long serialVersionUID = -1494676081508377549L;
+
+ @Inject private BeanManager beanManager;
+ @Inject private Conversation conversation;
+
+ private String text;
+
+ public void beginConversation()
+ {
+ if (conversation.isTransient())
+ {
+ conversation.begin();
+ }
+ }
+
+ public void endConversation()
+ {
+ if (!conversation.isTransient())
+ {
+ conversation.end();
+ }
+ }
+
+ public boolean isBeanManagerNotNull()
+ {
+ return beanManager != null;
+ }
+
+ public String getText()
+ {
+ return text;
+ }
+
+ public void setText(String text)
+ {
+ this.text = text;
+ }
+}
diff --git a/owb_1.2.x/webbeans-clustering/src/test/java/org/apache/webbeans/web/failover/tests/DefaultOwbFailOverServiceTest.java b/owb_1.2.x/webbeans-clustering/src/test/java/org/apache/webbeans/web/failover/tests/DefaultOwbFailOverServiceTest.java
new file mode 100644
index 0000000..15ab519
--- /dev/null
+++ b/owb_1.2.x/webbeans-clustering/src/test/java/org/apache/webbeans/web/failover/tests/DefaultOwbFailOverServiceTest.java
@@ -0,0 +1,341 @@
+/*
+ * 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.webbeans.web.failover.tests;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+import javax.enterprise.context.Conversation;
+import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.servlet.http.HttpSession;
+
+import org.apache.webbeans.context.ConversationContext;
+import org.apache.webbeans.conversation.ConversationImpl;
+import org.apache.webbeans.conversation.ConversationManager;
+import org.apache.webbeans.spi.ConversationService;
+import org.apache.webbeans.spi.FailOverService;
+import org.apache.webbeans.web.failover.DefaultOwbFailOverService;
+import org.apache.webbeans.web.failover.FailOverBag;
+import org.apache.webbeans.web.failover.FailOverSessionActivationListener;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class DefaultOwbFailOverServiceTest extends AbstractUnitTest
+{
+ private static final String SESSION_SCOPED_SAMPLE_TEXT = "session_sample";
+ private static final String CONVERSATION_SCOPED_SAMPLE_TEXT = "conversatzion_sample";
+
+ @Before
+ public void before()
+ {
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(ConversationScopedBean.class);
+ classes.add(SessionScopedBean.class);
+
+ startContainer(classes);
+ }
+
+ @After
+ public void after()
+ {
+ shutDownContainer();
+ }
+
+ /**
+ * Tests that the {@link FailOverBag} and {@link FailOverSessionActivationListener} will be added to the session.
+ */
+ @Test
+ public void sessionIsIdle()
+ {
+ // ----- setup
+ HttpSession session = new MockHttpSession();
+
+ DefaultOwbFailOverService failoverService =
+ (DefaultOwbFailOverService) getWebBeansContext().getService(FailOverService.class);
+
+ failoverService.enableFailOverSupport(true);
+ failoverService.enablePassivationSupport(true);
+
+
+
+ // ----- execute
+ failoverService.sessionIsIdle(session);
+
+
+
+ // ----- assert
+ FailOverSessionActivationListener listener = (FailOverSessionActivationListener)
+ session.getAttribute(FailOverSessionActivationListener.SESSION_ATTRIBUTE_NAME);
+ FailOverBag failOverBag = (FailOverBag)
+ session.getAttribute(FailOverBag.SESSION_ATTRIBUTE_NAME);
+
+ Assert.assertNotNull(listener);
+ Assert.assertNotNull(failOverBag);
+ Assert.assertFalse(failOverBag.isSessionInUse());
+ Assert.assertFalse(failoverService.isPassivation());
+ }
+
+ /**
+ * Tests that <code>sessionInUse</code> will be set and that the
+ * {@link FailOverSessionActivationListener} will be added to the session.
+ */
+ @Test
+ public void sessionIsInUse()
+ {
+ // ----- setup
+ HttpSession session = new MockHttpSession();
+
+ // put bag manually to session
+ FailOverBag failOverBag = new FailOverBag(session.getId(), "");
+ session.setAttribute(FailOverBag.SESSION_ATTRIBUTE_NAME, failOverBag);
+
+ DefaultOwbFailOverService failoverService =
+ (DefaultOwbFailOverService) getWebBeansContext().getService(FailOverService.class);
+
+ failoverService.enableFailOverSupport(true);
+ failoverService.enablePassivationSupport(true);
+
+
+
+ // ----- execute
+ failoverService.sessionIsInUse(session);
+
+
+
+ // ----- assert
+ FailOverSessionActivationListener listener = (FailOverSessionActivationListener)
+ session.getAttribute(FailOverSessionActivationListener.SESSION_ATTRIBUTE_NAME);
+
+ Assert.assertNotNull(listener);
+ Assert.assertTrue(failOverBag.isSessionInUse());
+ Assert.assertFalse(failoverService.isPassivation());
+ }
+
+ /**
+ * Tests that the {@link FailOverBag} and {@link FailOverSessionActivationListener} will be added to the session.
+ */
+ @Test
+ public void sessionWillPassivate()
+ {
+ // ----- setup
+ HttpSession session = new MockHttpSession();
+
+ DefaultOwbFailOverService failoverService =
+ (DefaultOwbFailOverService) getWebBeansContext().getService(FailOverService.class);
+
+ failoverService.enableFailOverSupport(true);
+ failoverService.enablePassivationSupport(true);
+
+
+
+ // ----- execute
+ failoverService.sessionWillPassivate(session);
+
+
+
+ // ----- assert
+ FailOverSessionActivationListener listener = (FailOverSessionActivationListener)
+ session.getAttribute(FailOverSessionActivationListener.SESSION_ATTRIBUTE_NAME);
+ FailOverBag failOverBag = (FailOverBag)
+ session.getAttribute(FailOverBag.SESSION_ATTRIBUTE_NAME);
+
+ Assert.assertNotNull(listener);
+ Assert.assertNotNull(failOverBag);
+ Assert.assertFalse(failOverBag.isSessionInUse());
+ Assert.assertTrue(failoverService.isPassivation());
+ }
+
+ /**
+ * Tests that the session context will be stored and restored
+ * successfully from the {@link FailOverBag}.
+ *
+ * @throws Exception When store/restore the session context fails.
+ */
+ @Test
+ public void restoreSessionContext() throws Exception
+ {
+ // ----- setup
+ HttpSession session = new MockHttpSession();
+
+ DefaultOwbFailOverService failoverService =
+ (DefaultOwbFailOverService) getWebBeansContext().getService(FailOverService.class);
+
+ failoverService.enableFailOverSupport(true);
+ failoverService.enablePassivationSupport(true);
+
+
+
+ // ----- execute
+ getWebBeansContext().getContextsService().startContext(SessionScoped.class, session);
+
+ // set sample text
+ getInstance(SessionScopedBean.class).setText(SESSION_SCOPED_SAMPLE_TEXT);
+
+ // store beans in session
+ failoverService.sessionIsIdle(session);
+
+ // serialize / deserialize and store deserialized bag back to session
+ FailOverBag failOverBag;
+ failOverBag = (FailOverBag) session.getAttribute(FailOverBag.SESSION_ATTRIBUTE_NAME);
+ failOverBag = (FailOverBag) serialize(failOverBag);
+
+ session.setAttribute(FailOverBag.SESSION_ATTRIBUTE_NAME, failOverBag);
+
+ // remove sample text
+ getInstance(SessionScopedBean.class).setText(null);
+
+ getWebBeansContext().getContextsService().endContext(SessionScoped.class, session);
+
+ // restore beans from session
+ failoverService.sessionDidActivate(session);
+
+ getWebBeansContext().getContextsService().startContext(SessionScoped.class, session);
+
+
+
+ // ----- assert
+ Assert.assertEquals(SESSION_SCOPED_SAMPLE_TEXT, getInstance(SessionScopedBean.class).getText());
+ }
+
+ /**
+ * Tests that the conversation contexts will be stored and restored
+ * successfully from the {@link FailOverBag}.
+ *
+ * @throws Exception When store/restore the session context fails.
+ */
+ @Test
+ public void restoreConversationContexts() throws Exception
+ {
+ // ----- setup
+ HttpSession session = new MockHttpSession();
+
+ DefaultOwbFailOverService failoverService =
+ (DefaultOwbFailOverService) getWebBeansContext().getService(FailOverService.class);
+
+ failoverService.enableFailOverSupport(true);
+ failoverService.enablePassivationSupport(true);
+
+
+
+ // ----- execute
+ // create conversation
+ ConversationContext conversationContext = new ConversationContext();
+ conversationContext.setActive(true);
+
+ Conversation conversation = new ConversationImpl(session.getId(), getWebBeansContext());
+ conversation.begin();
+
+ ConversationManager conversationManager = getWebBeansContext().getConversationManager();
+ conversationManager.addConversationContext(conversation, conversationContext);
+
+ getWebBeansContext().registerService(ConversationService.class, new MockConversationService(session, conversation));
+
+ // set sample text
+ getInstance(ConversationScopedBean.class, conversationContext).setText(CONVERSATION_SCOPED_SAMPLE_TEXT);
+
+ // store beans in session
+ failoverService.sessionIsIdle(session);
+
+ // serialize / deserialize and store deserialized bag back to session
+ FailOverBag failOverBag;
+ failOverBag = (FailOverBag) session.getAttribute(FailOverBag.SESSION_ATTRIBUTE_NAME);
+ failOverBag = (FailOverBag) serialize(failOverBag);
+
+ session.setAttribute(FailOverBag.SESSION_ATTRIBUTE_NAME, failOverBag);
+
+ // remove sample text
+ getInstance(ConversationScopedBean.class, conversationContext).setText(null);
+
+ getWebBeansContext().getContextsService().endContext(ConversationScoped.class, conversationContext);
+
+ // restore beans from session
+ failoverService.sessionDidActivate(session);
+
+
+
+ // ----- assert
+ // get and activate conversation
+ Map<Conversation, ConversationContext> conversationMap =
+ conversationManager.getConversationMapWithSessionId(session.getId());
+
+ Conversation propogatedConversation =
+ conversationManager.getPropogatedConversation(conversation.getId(), session.getId());
+
+ ConversationContext propogatedConversationContext = conversationMap.get(propogatedConversation);
+ propogatedConversationContext.setActive(true);
+
+ ConversationScopedBean beanInstance = getInstance(ConversationScopedBean.class, propogatedConversationContext);
+
+ Assert.assertEquals(CONVERSATION_SCOPED_SAMPLE_TEXT, beanInstance.getText());
+ Assert.assertTrue(beanInstance.isBeanManagerNotNull());
+ }
+
+ /**
+ * Tests that the {@link FailOverSessionActivationListener} is serializable.
+ *
+ * @throws Exception If serialization fails.
+ */
+ @Test
+ public void serializeSessionActivationListener() throws Exception
+ {
+ serialize(new FailOverSessionActivationListener());
+ }
+
+ private Serializable serialize(Serializable serializable) throws IOException, ClassNotFoundException
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+
+ oos.writeObject(serializable);
+ oos.close();
+
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ ObjectInputStream ois = new ObjectInputStream(bais);
+
+ Object deserializedObject = ois.readObject();
+
+ ois.close();
+
+ return (Serializable) deserializedObject;
+ }
+
+ public <T> T getInstance(Class<T> type, Context context)
+ {
+ Set<Bean<?>> beans = getBeanManager().getBeans(type);
+ @SuppressWarnings("unchecked")
+ Bean<T> bean = (Bean<T>) getBeanManager().resolve(beans);
+ CreationalContext<T> creationalContext = getBeanManager().createCreationalContext(bean);
+
+ return context.get(bean, creationalContext);
+ }
+}
diff --git a/owb_1.2.x/webbeans-clustering/src/test/java/org/apache/webbeans/web/failover/tests/MockConversationService.java b/owb_1.2.x/webbeans-clustering/src/test/java/org/apache/webbeans/web/failover/tests/MockConversationService.java
new file mode 100644
index 0000000..4c70b54
--- /dev/null
+++ b/owb_1.2.x/webbeans-clustering/src/test/java/org/apache/webbeans/web/failover/tests/MockConversationService.java
@@ -0,0 +1,54 @@
+/*
+ * 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.webbeans.web.failover.tests;
+
+import javax.enterprise.context.Conversation;
+import javax.servlet.http.HttpSession;
+
+import org.apache.webbeans.spi.ConversationService;
+
+public class MockConversationService implements ConversationService
+{
+ private final String conversationId;
+ private final String sessionId;
+
+
+ public MockConversationService() {
+ this.conversationId = "0815";
+ this.sessionId = "dummySession";
+ }
+
+ public MockConversationService(HttpSession session, Conversation conversation)
+ {
+ this.sessionId = session.getId();
+ this.conversationId = conversation.getId();
+ }
+
+ @Override
+ public String getConversationId()
+ {
+ return conversationId;
+ }
+
+ @Override
+ public String getConversationSessionId()
+ {
+ return sessionId;
+ }
+}
diff --git a/owb_1.2.x/webbeans-clustering/src/test/java/org/apache/webbeans/web/failover/tests/MockHttpSession.java b/owb_1.2.x/webbeans-clustering/src/test/java/org/apache/webbeans/web/failover/tests/MockHttpSession.java
new file mode 100644
index 0000000..db6decb
--- /dev/null
+++ b/owb_1.2.x/webbeans-clustering/src/test/java/org/apache/webbeans/web/failover/tests/MockHttpSession.java
@@ -0,0 +1,136 @@
+/*
+ * 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.webbeans.web.failover.tests;
+
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionContext;
+
+public class MockHttpSession implements HttpSession
+{
+ public static final String SESSION_ID = "testSessionId";
+
+ private Map<String, Object> attributes = new HashMap<String, Object>();
+
+ @Override
+ public Object getAttribute(String key)
+ {
+ return attributes.get(key);
+ }
+
+ @Override
+ public Enumeration getAttributeNames()
+ {
+ return null;
+ }
+
+ @Override
+ public long getCreationTime()
+ {
+ return 0;
+ }
+
+ @Override
+ public String getId()
+ {
+ return SESSION_ID;
+ }
+
+ @Override
+ public long getLastAccessedTime()
+ {
+ return 0;
+ }
+
+ @Override
+ public int getMaxInactiveInterval()
+ {
+ return 0;
+ }
+
+ @Override
+ public ServletContext getServletContext()
+ {
+ return null;
+ }
+
+ @Override
+ public HttpSessionContext getSessionContext()
+ {
+ return null;
+ }
+
+ @Override
+ public Object getValue(String arg0)
+ {
+ return null;
+ }
+
+ @Override
+ public String[] getValueNames()
+ {
+ return null;
+ }
+
+ @Override
+ public void invalidate()
+ {
+
+ }
+
+ @Override
+ public boolean isNew()
+ {
+ return false;
+ }
+
+ @Override
+ public void putValue(String arg0, Object arg1)
+ {
+
+ }
+
+ @Override
+ public void removeAttribute(String key)
+ {
+ attributes.remove(key);
+ }
+
+ @Override
+ public void removeValue(String arg0)
+ {
+
+ }
+
+ @Override
+ public void setAttribute(String key, Object value)
+ {
+ attributes.put(key, value);
+ }
+
+ @Override
+ public void setMaxInactiveInterval(int arg0)
+ {
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-clustering/src/test/java/org/apache/webbeans/web/failover/tests/MockServletContext.java b/owb_1.2.x/webbeans-clustering/src/test/java/org/apache/webbeans/web/failover/tests/MockServletContext.java
new file mode 100644
index 0000000..8a767ff
--- /dev/null
+++ b/owb_1.2.x/webbeans-clustering/src/test/java/org/apache/webbeans/web/failover/tests/MockServletContext.java
@@ -0,0 +1,180 @@
+/*
+ * 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.webbeans.web.failover.tests;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:struberg@yahoo.de">Mark Struberg</a>
+ */
+public class MockServletContext implements ServletContext
+{
+ @Override
+ public Object getAttribute(String name)
+ {
+ return null;
+ }
+
+ @Override
+ public ServletContext getContext(String uripath)
+ {
+ return null;
+ }
+
+ @Override
+ public String getContextPath()
+ {
+ return null;
+ }
+
+ @Override
+ public int getMajorVersion()
+ {
+ return 0;
+ }
+
+ @Override
+ public int getMinorVersion()
+ {
+ return 0;
+ }
+
+ @Override
+ public String getMimeType(String file)
+ {
+ return null;
+ }
+
+ @Override
+ public Set getResourcePaths(String path)
+ {
+ return null;
+ }
+
+ @Override
+ public URL getResource(String path) throws MalformedURLException
+ {
+ return null;
+ }
+
+ @Override
+ public InputStream getResourceAsStream(String path)
+ {
+ return null;
+ }
+
+ @Override
+ public RequestDispatcher getRequestDispatcher(String path)
+ {
+ return null;
+ }
+
+ @Override
+ public RequestDispatcher getNamedDispatcher(String name)
+ {
+ return null;
+ }
+
+ @Override
+ public Servlet getServlet(String name) throws ServletException
+ {
+ return null;
+ }
+
+ @Override
+ public Enumeration getServlets()
+ {
+ return null;
+ }
+
+ @Override
+ public Enumeration getServletNames()
+ {
+ return null;
+ }
+
+ @Override
+ public void log(String msg)
+ {
+ }
+
+ @Override
+ public void log(Exception exception, String msg)
+ {
+ }
+
+ @Override
+ public void log(String message, Throwable throwable)
+ {
+ }
+
+ @Override
+ public String getRealPath(String path)
+ {
+ return null;
+ }
+
+ @Override
+ public String getServerInfo()
+ {
+ return null;
+ }
+
+ @Override
+ public String getInitParameter(String name)
+ {
+ return null;
+ }
+
+ @Override
+ public Enumeration getInitParameterNames()
+ {
+ return null;
+ }
+
+ @Override
+ public Enumeration getAttributeNames()
+ {
+ return null;
+ }
+
+ @Override
+ public void setAttribute(String name, Object object)
+ {
+ }
+
+ @Override
+ public void removeAttribute(String name)
+ {
+ }
+
+ @Override
+ public String getServletContextName()
+ {
+ return null;
+ }
+}
diff --git a/owb_1.2.x/webbeans-clustering/src/test/java/org/apache/webbeans/web/failover/tests/MockServletRequest.java b/owb_1.2.x/webbeans-clustering/src/test/java/org/apache/webbeans/web/failover/tests/MockServletRequest.java
new file mode 100644
index 0000000..1088d16
--- /dev/null
+++ b/owb_1.2.x/webbeans-clustering/src/test/java/org/apache/webbeans/web/failover/tests/MockServletRequest.java
@@ -0,0 +1,360 @@
+/*
+ * 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.webbeans.web.failover.tests;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.security.Principal;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:struberg@yahoo.de">Mark Struberg</a>
+ */
+public class MockServletRequest implements HttpServletRequest
+{
+
+ @Override
+ public Object getAttribute(String name)
+ {
+ return null;
+ }
+
+ @Override
+ public Enumeration getAttributeNames()
+ {
+ return null;
+ }
+
+ @Override
+ public String getCharacterEncoding()
+ {
+ return null;
+ }
+
+ @Override
+ public void setCharacterEncoding(String env) throws UnsupportedEncodingException
+ {
+ }
+
+ @Override
+ public int getContentLength()
+ {
+ return 0;
+ }
+
+ @Override
+ public String getContentType()
+ {
+ return null;
+ }
+
+ @Override
+ public ServletInputStream getInputStream() throws IOException
+ {
+ return null;
+ }
+
+ @Override
+ public String getParameter(String name)
+ {
+ return null;
+ }
+
+ @Override
+ public Enumeration getParameterNames()
+ {
+ return null;
+ }
+
+ @Override
+ public String[] getParameterValues(String name)
+ {
+ return new String[0];
+ }
+
+ @Override
+ public Map getParameterMap()
+ {
+ return null;
+ }
+
+ @Override
+ public String getProtocol()
+ {
+ return null;
+ }
+
+ @Override
+ public String getScheme()
+ {
+ return null;
+ }
+
+ @Override
+ public String getServerName()
+ {
+ return null;
+ }
+
+ @Override
+ public int getServerPort()
+ {
+ return 0;
+ }
+
+ @Override
+ public BufferedReader getReader() throws IOException
+ {
+ return null;
+ }
+
+ @Override
+ public String getRemoteAddr()
+ {
+ return null;
+ }
+
+ @Override
+ public String getRemoteHost()
+ {
+ return null;
+ }
+
+ @Override
+ public void setAttribute(String name, Object o)
+ {
+ }
+
+ @Override
+ public void removeAttribute(String name)
+ {
+ }
+
+ @Override
+ public Locale getLocale()
+ {
+ return null;
+ }
+
+ @Override
+ public Enumeration getLocales()
+ {
+ return null;
+ }
+
+ @Override
+ public boolean isSecure()
+ {
+ return false;
+ }
+
+ @Override
+ public RequestDispatcher getRequestDispatcher(String path)
+ {
+ return null;
+ }
+
+ @Override
+ public String getRealPath(String path)
+ {
+ return null;
+ }
+
+ @Override
+ public int getRemotePort()
+ {
+ return 0;
+ }
+
+ @Override
+ public String getLocalName()
+ {
+ return null;
+ }
+
+ @Override
+ public String getLocalAddr()
+ {
+ return null;
+ }
+
+ @Override
+ public int getLocalPort()
+ {
+ return 0;
+ }
+
+ @Override
+ public String getAuthType()
+ {
+ return null;
+ }
+
+ @Override
+ public Cookie[] getCookies()
+ {
+ return new Cookie[0];
+ }
+
+ @Override
+ public long getDateHeader(String name)
+ {
+ return 0;
+ }
+
+ @Override
+ public String getHeader(String name)
+ {
+ return null;
+ }
+
+ @Override
+ public Enumeration getHeaders(String name)
+ {
+ return null;
+ }
+
+ @Override
+ public Enumeration getHeaderNames()
+ {
+ return null;
+ }
+
+ @Override
+ public int getIntHeader(String name)
+ {
+ return 0;
+ }
+
+ @Override
+ public String getMethod()
+ {
+ return null;
+ }
+
+ @Override
+ public String getPathInfo()
+ {
+ return null;
+ }
+
+ @Override
+ public String getPathTranslated()
+ {
+ return null;
+ }
+
+ @Override
+ public String getContextPath()
+ {
+ return null;
+ }
+
+ @Override
+ public String getQueryString()
+ {
+ return null;
+ }
+
+ @Override
+ public String getRemoteUser()
+ {
+ return null;
+ }
+
+ @Override
+ public boolean isUserInRole(String role)
+ {
+ return false;
+ }
+
+ @Override
+ public Principal getUserPrincipal()
+ {
+ return null;
+ }
+
+ @Override
+ public String getRequestedSessionId()
+ {
+ return null;
+ }
+
+ @Override
+ public String getRequestURI()
+ {
+ return null;
+ }
+
+ @Override
+ public StringBuffer getRequestURL()
+ {
+ return null;
+ }
+
+ @Override
+ public String getServletPath()
+ {
+ return null;
+ }
+
+ @Override
+ public HttpSession getSession(boolean create)
+ {
+ return null;
+ }
+
+ @Override
+ public HttpSession getSession()
+ {
+ return null;
+ }
+
+ @Override
+ public boolean isRequestedSessionIdValid()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isRequestedSessionIdFromCookie()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isRequestedSessionIdFromURL()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isRequestedSessionIdFromUrl()
+ {
+ return false;
+ }
+}
diff --git a/owb_1.2.x/webbeans-clustering/src/test/java/org/apache/webbeans/web/failover/tests/SessionScopedBean.java b/owb_1.2.x/webbeans-clustering/src/test/java/org/apache/webbeans/web/failover/tests/SessionScopedBean.java
new file mode 100644
index 0000000..89b7333
--- /dev/null
+++ b/owb_1.2.x/webbeans-clustering/src/test/java/org/apache/webbeans/web/failover/tests/SessionScopedBean.java
@@ -0,0 +1,41 @@
+/*
+ * 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.webbeans.web.failover.tests;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+
+@SessionScoped
+public class SessionScopedBean implements Serializable
+{
+ private static final long serialVersionUID = -448758698909502562L;
+
+ private String text;
+
+ public String getText()
+ {
+ return text;
+ }
+
+ public void setText(String text)
+ {
+ this.text = text;
+ }
+}
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-clustering/src/test/resources/META-INF/openwebbeans/openwebbeans.properties b/owb_1.2.x/webbeans-clustering/src/test/resources/META-INF/openwebbeans/openwebbeans.properties
new file mode 100644
index 0000000..f469f3b
--- /dev/null
+++ b/owb_1.2.x/webbeans-clustering/src/test/resources/META-INF/openwebbeans/openwebbeans.properties
@@ -0,0 +1,27 @@
+#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.
+#---------------------------------------------------------------
+# The Clustering TEST configuration for OpenWebBeans
+#
+#---------------------------------------------------------------
+configuration.ordinal=120
+
+################################### Default Conversation Service ###############################
+#Default implementation of org.apache.webbeans.corespi.ConversationService.
+org.apache.webbeans.spi.ConversationService=org.apache.webbeans.web.failover.tests.MockConversationService
+################################################################################################
+
diff --git a/owb_1.2.x/webbeans-doc/pom.xml b/owb_1.2.x/webbeans-doc/pom.xml
new file mode 100644
index 0000000..4d57518
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/pom.xml
@@ -0,0 +1,126 @@
+<?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.
+ -->
+
+<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>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>1.2.5</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>openwebbeans-doc</artifactId>
+
+ <name>Documentation</name>
+ <packaging>jar</packaging>
+ <description>
+ Project for building the Apache OpenWebBeans Documentation
+ </description>
+
+ <profiles>
+ <profile>
+ <id>doc</id>
+ <build>
+ <plugins>
+ <!-- Maven docbook configuration -->
+ <plugin>
+ <groupId>com.agilejava.docbkx</groupId>
+ <artifactId>docbkx-maven-plugin</artifactId>
+ <version>2.0.8</version>
+ <executions>
+ <execution>
+ <id>single-pdf-page</id>
+ <goals>
+ <goal>generate-pdf</goal>
+ </goals>
+ <configuration>
+ <calloutGraphicsPath>src/docbkx/resources/images/callouts/</calloutGraphicsPath>
+ <admonGraphicsPath>src/docbkx/resources/images/admons/</admonGraphicsPath>
+ <imgSrcPath>src/docbkx/resources/images/</imgSrcPath>
+ <foCustomization>${basedir}/src/docbkx/resources/xsl/fopdf.xsl</foCustomization>
+ <draftMode>1</draftMode>
+ <postProcess>
+ <copy todir="${basedir}/target/site">
+ <fileset dir="${basedir}/target/docbkx">
+ <include name="**/*.pdf" />
+ </fileset>
+ </copy>
+ </postProcess>
+ </configuration>
+ <phase>generate-sources</phase>
+ </execution>
+ <execution>
+ <id>single-html-page</id>
+ <goals>
+ <goal>generate-html</goal>
+ </goals>
+ <configuration>
+ <imgSrcPath>images/</imgSrcPath>
+ <chunkedOutput>false</chunkedOutput>
+ <targetDirectory>${basedir}/target/docbkx/html-single</targetDirectory>
+ <htmlStylesheet>css/html.css</htmlStylesheet>
+ <htmlCustomization>${basedir}/src/docbkx/resources/xsl/html.xsl</htmlCustomization>
+ <!--
+ Just because it's sometimes time costly, I
+ delete only this directory to allow re
+ generation by docbkx plugin During documentation
+ phase, it's useful because it allows a quick and
+ nice overview without costly pdf generation and
+ all packaging.
+ -->
+ <preProcess>
+ <delete dir="${basedir}/target/docbkx/html-single" />
+ </preProcess>
+ <postProcess>
+ <copy todir="${basedir}/target/site/html-single">
+ <fileset dir="${basedir}/target/docbkx/html-single">
+ <include name="**/*.html" />
+ </fileset>
+ </copy>
+ <copy todir="${basedir}/target/site/html-single">
+ <fileset dir="${basedir}/src/docbkx/resources">
+ <include name="**/*.css" />
+ <include name="**/*.png" />
+ <include name="**/*.gif" />
+ <include name="**/*.jpg" />
+ </fileset>
+ </copy>
+ </postProcess>
+ </configuration>
+ <phase>generate-sources</phase>
+ </execution>
+ </executions>
+ <configuration>
+ <xincludeSupported>true</xincludeSupported>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>org.docbook</groupId>
+ <artifactId>docbook-xml</artifactId>
+ <version>4.4</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/common/abstract.xml b/owb_1.2.x/webbeans-doc/src/docbkx/common/abstract.xml
new file mode 100644
index 0000000..7432568
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/common/abstract.xml
@@ -0,0 +1,34 @@
+<?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.
+ -->
+<!DOCTYPE abstract PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
+
+ <!ENTITY % entities SYSTEM "../entities.ent" >
+ %entities;
+]>
+
+<abstract>
+ <para>
+ &productname; will be an ASL-licensed implementation of the Web Beans
+ Specification which is defined as JSR-299.
+ </para>
+ <para>
+ In addition to the implementation of the specification, the project aims
+ to create a new set of WebBeans components exposing functionality of
+ other Apache Foundation projects.
+ </para>
+</abstract>
+
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/common/legalnotes.xml b/owb_1.2.x/webbeans-doc/src/docbkx/common/legalnotes.xml
new file mode 100644
index 0000000..03c1888
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/common/legalnotes.xml
@@ -0,0 +1,47 @@
+<?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.
+ -->
+<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
+
+ <!ENTITY % entities SYSTEM "../entities.ent" >
+ %entities;
+]>
+
+<appendix id="legal.notes">
+ <title>Legal notes</title>
+ <para>
+ <productname class="registered">&productnamecomplete;</productname> is a registered trademark.
+ </para>
+ <para>
+ All rights, including in respect of the translation, printing and
+ duplication of this document or parts thereof, are retained.
+ No part of this document may be reproduced or processed with or
+ without electronic means, in any form, without the prior written permission of
+ <orgname>&companyname;</orgname>.
+ This includes for training purposes.
+ </para>
+ <para>
+ <productname class="trade">Java</productname>
+ and all Java-based trademarks and logos are trademarks or registered trademarks of
+ <orgname>Sun Microsystems, Inc</orgname>.
+ in the United States and other countries.
+ </para>
+ <para>
+ All other brand names, designs, service marks and trademarks (whether or not registered)
+ referenced or used herein are the property of their respective owners.
+ </para>
+</appendix>
+
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/common/thirdparty.xml b/owb_1.2.x/webbeans-doc/src/docbkx/common/thirdparty.xml
new file mode 100644
index 0000000..095c246
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/common/thirdparty.xml
@@ -0,0 +1,73 @@
+<?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.
+ -->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
+
+ <!ENTITY % entities SYSTEM "../entities.ent" >
+ %entities;
+]>
+
+<refentry id="thirdparty">
+ <indexterm zone="thirdparty">
+ <primary>Requirements</primary>
+ <secondary>3rd party libraries</secondary>
+ </indexterm>
+ <indexterm zone="thirdparty">
+ <primary>Licenses</primary>
+ </indexterm>
+ <refnamediv>
+ <refname>
+ Third Party Libraries and Licenses
+ </refname>
+ <refpurpose>
+ Third party libraries were chosen for their wide
+ acceptance, feature set, stability and ease of use.
+ </refpurpose>
+ </refnamediv>
+
+ <refsection>
+ <title>Third Party Libraries used by &productname; and their respective Licenses
+ </title>
+ <para>
+ The &productname; uses the following 3rd party libraries:
+ <informaltable frame="all">
+
+ <tgroup cols="3" align="left" colsep="1" rowsep="1">
+ <colspec colname="lib" colwidth="2*" align="left" />
+ <colspec colname="version" colwidth="1*" align="center" />
+ <colspec colname="license" colwidth="3*" align="left" />
+ <thead>
+ <row>
+ <entry>Library</entry>
+ <entry>Version</entry>
+ <entry>License</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ Apache <classname>openejb-core</classname>
+ </entry>
+ <entry>3.1.2</entry>
+ <entry>Apache Software License 2.0</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </para>
+ </refsection>
+</refentry>
+
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/entities.ent b/owb_1.2.x/webbeans-doc/src/docbkx/entities.ent
new file mode 100644
index 0000000..d5b7ecd
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/entities.ent
@@ -0,0 +1,33 @@
+<!ENTITY productversion "1.0.0">
+<!ENTITY productname "<application>OWB</application>">
+<!ENTITY productnamecomplete "<application>Apache OpenWebBeans</application>">
+<!ENTITY companyname "The Apache Software Foundation">
+<!ENTITY departmentname "##TODO##">
+<!ENTITY companyaddress1 "<street>##TODO##</street>">
+<!ENTITY companyaddress2 "<country>##TODO##</country>-<postcode>##TODO##</postcode> <city>##TODO##</city>">
+<!ENTITY copyrightyear "<year>2009</year>">
+<!ENTITY legalnotice "
+ <para>
+ 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
+ </para>
+ <para role='center'>
+ http://www.apache.org/licenses/LICENSE-2.0
+ </para>
+ <para>
+ 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.
+ </para>">
+
+
+
+
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/css/apache.css b/owb_1.2.x/webbeans-doc/src/docbkx/resources/css/apache.css
new file mode 100644
index 0000000..3c089e4
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/css/apache.css
@@ -0,0 +1,374 @@
+/*
+ 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.
+*/
+/* General formatting */
+html {
+ padding-right: 0px;
+ padding-left: 0px;
+ padding-bottom: 0px;
+ margin: 0px;
+ color: #333333;
+ padding-top: 0px;
+ font-family: Arial, Helvetica, sans-serif;
+ border: dotted 0px red;
+}
+
+body {
+ font-size: 12px;
+ font-family: Arial, Helvetica, sans-serif;
+ color: #333333;
+ background: #FFFFFF;
+ border: dotted 0px blue;
+ height: auto;
+ overflow: auto;
+ margin-top: 0px;
+ margin-left: 0px;
+ margin-right: 0px;
+ padding-right: 0px;
+ padding-left: 0px;
+ padding-bottom: 0px;
+ padding-top: 0px;
+}
+
+a,
+a:link,
+a:active {
+ color: #003399;
+ text-decoration: underline;
+}
+
+a:visited {
+ color: #991B00;
+ text-decoration: underline;
+}
+
+a:hover {
+ color: #6699FF;
+ text-decoration: underline;
+}
+
+a.navigation {
+ text-decoration: none;
+ color: #333333;
+}
+
+a.navigation:hover {
+ text-decoration: underline;
+ background-color: transparent;
+ color: #003399;
+}
+
+table {
+ margin-bottom: 8;
+ margin-top: 2;
+}
+
+table.admon {
+ width: 500px;
+ border: 1px solid #333333;
+ margin-left: 150px;
+ margin-right: 150px;
+ margin-bottom: 10px;
+ margin-top: 10px;
+ vertical-align: top;
+ background-color: #F0F0F0;
+}
+
+td {
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 12px;
+}
+
+td.name {
+ width: 25%;
+}
+
+td.desc {
+ width: 75%;
+}
+
+img {
+ border: none;
+ margin-bottom: 1px;
+ margin-left: 1px;
+ margin-right: 1px;
+ margin-top: 1px;
+}
+
+pre.screen {
+ background: #F0F0F0;
+ width: 700px;
+ padding-bottom: 2px;
+ padding-left: 2px;
+ padding-right: 2px;
+ padding-top: 2px;
+ margin-left: 10px;
+}
+
+pre.programlisting {
+ background: #F0F0F0;
+ border: thin dashed;
+ width: 800px;
+ padding-bottom: 5px;
+ padding-left: 5px;
+ padding-right: 5px;
+ padding-top: 5px;
+ margin-left: 40px;
+}
+
+code.replaceable {
+ font-style: normal;
+ font-weight: bolder;
+}
+
+DIV.example-output {
+ padding-left: 15px;
+ border-style: solid;
+ border-width: 0px;
+ border-left-width: 2px;
+ border-color: black;
+}
+
+div.example-source {
+ background: #F0F0F0;
+}
+
+div.refentry div.titlepage {
+ margin-left: 20px;
+}
+
+div.refentry div.titlepage h1.title {
+ margin-left: -20px;
+ margin-bottom: 0px;
+ font-size: 36pt;
+}
+
+div.biblioentry .title,
+div.bibliography .subtitle {
+ font-size: 12px;
+ font-family: Arial, Helvetica, sans-serif;
+ color: #333333;
+}
+
+div.table,
+div.informaltable {
+ padding-left: 10px;
+}
+
+div.navheader {
+ padding-top: 0px;
+ background-color: #F4F4F4;
+ padding-left: 10px;
+ padding-right: 10px;
+ font-weight: bold;
+ color: #333333;
+ text-decoration: none;
+ border-bottom: 1px solid black;
+ margin-bottom: 10px;
+ padding-bottom: 0px;
+}
+
+div.navfooter {
+ background-color: #F4F4F4;
+ border-top: 1px solid black;
+ margin-top: 10px;
+ padding-top: 0px;
+ margin-bottom: 0px;
+ padding-bottom: 0px;
+ padding-left: 10px;
+ padding-right: 10px;
+ font-size: 9px;
+ color: #8B8B8B;
+ text-decoration: none;
+}
+
+div.copyrightfooter {
+ background-color: #c6bec6;
+ margin-top: 0px;
+ padding-top: 0px;
+ padding-left: 10px;
+ padding-right: 10px;
+ padding-bottom: 2px;
+}
+
+div.copyrightfooter p {
+ margin-top: 0px;
+ padding-top: 10px;
+}
+
+div.refentry,
+div.preface,
+div.chapter,
+div.appendix,
+div.reference,
+div.part,
+div.bibliography,
+div.glossary,
+div.index,
+div.colophon,
+div.legalnotice,
+div.sect1,
+div.sect2,
+div.sect3,
+div.section
+ {
+ margin-left: 10px;
+ margin-right: 10px;
+}
+
+div.book {
+ margin-left: 10px;
+ margin-right: 10px;
+ margin-top: 5px;
+}
+
+p {
+ max-width: 800px;
+ font-size: 12px;
+}
+
+p.publisher {
+ text-align: center;
+}
+
+.company {
+ font-size: 9px;
+ color: #DF0141;
+ text-decoration: none
+}
+
+.contact {
+ font-size: 11px;
+ color: #0000CC;
+ text-decoration: none
+}
+
+.copy {
+ color: #BEBEBE;
+ text-decoration: none
+}
+
+.legal {
+ color: #8B8B8B;
+ text-decoration: none
+}
+
+.subtitle {
+ color: #990000;
+ font-weight: bold;
+ text-decoration: none;
+
+ border: 1px solid #aaaaaa;
+ background-color: #dddddd;
+}
+
+.title {
+ font-size: 16px;
+ color: #990000;
+ font-weight: bold;
+ text-decoration: none;
+
+ border: 1px solid #999999;
+ background-color: #eeeeee;
+}
+
+.epigraph {
+ font-style: italic;
+ text-align: right;
+}
+
+.topnav {
+ font-weight: bold;
+ color: #333333;
+ text-decoration: none;
+}
+
+.topnav:Hover {
+ font-weight: bold;
+ color: #333333;
+ text-decoration: none
+}
+
+.topnav:Visited {
+ font-weight: bold;
+ color: #333333
+}
+
+.copyright {
+ color: #7F7F7F;
+ font-size: 9px;
+}
+
+/* Navigation header formatting */
+.navheadtitle {
+ font-weight: bold;
+ font-size: 14px color : #333333;
+ text-decoration: none;
+ margin-top: 5px;
+ margin-bottom: 2px;
+}
+
+.navheadsubtitle {
+ font-weight: normal;
+ font-size: 10px color : #333333;
+ text-decoration: none;
+ margin-bottom: 2px;
+}
+
+.navhead hr.top-nav-sep {
+ display: none;
+}
+
+.navhead .slidestitle {
+ font-weight: normal;
+ font-size: 10pt;
+ font-style: italic;
+}
+
+/* Navigation footer formatting */
+.navfoot {
+ font-size: 9px;
+ color: #8B8B8B;
+ text-decoration: none;
+ border-top: 1px solid black;
+ margin-top: 10px;
+ padding-top: 4px;
+}
+
+.navfoot hr.bottom-nav-sep {
+ display: none;
+}
+
+/* General navigation formatting */
+.link-text {
+ font-weight: bold;
+ font-size: 10pt;
+}
+
+.link-text a {
+ text-decoration: none;
+}
+
+.link-text a:link {
+ color: blue;
+}
+
+.link-text a:visited {
+ color: blue;
+}
+
+.no-link-text {
+ color: #7F7F7F;
+}
+/* EOF */
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/css/highlight.css b/owb_1.2.x/webbeans-doc/src/docbkx/resources/css/highlight.css
new file mode 100644
index 0000000..3044487
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/css/highlight.css
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/css/html.css b/owb_1.2.x/webbeans-doc/src/docbkx/resources/css/html.css
new file mode 100644
index 0000000..9cfdbf5
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/css/html.css
@@ -0,0 +1,16 @@
+/*
+ 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.
+*/
+@IMPORT url("apache.css");
+@IMPORT url("highlight.css");
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/blank.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/blank.png
new file mode 100644
index 0000000..764bf4f
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/blank.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/caution.gif b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/caution.gif
new file mode 100644
index 0000000..d9f5e5b
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/caution.gif
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/caution.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/caution.png
new file mode 100644
index 0000000..549c472
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/caution.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/caution.tif b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/caution.tif
new file mode 100644
index 0000000..b727be8
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/caution.tif
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/draft.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/draft.png
new file mode 100644
index 0000000..0084708
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/draft.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/home.gif b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/home.gif
new file mode 100644
index 0000000..5bd0760
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/home.gif
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/home.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/home.png
new file mode 100644
index 0000000..cbb711d
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/home.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/important.gif b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/important.gif
new file mode 100644
index 0000000..6795d9a
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/important.gif
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/important.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/important.png
new file mode 100644
index 0000000..bf67f22
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/important.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/important.tif b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/important.tif
new file mode 100644
index 0000000..4da159d
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/important.tif
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/next.gif b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/next.gif
new file mode 100644
index 0000000..7e1c777
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/next.gif
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/next.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/next.png
new file mode 100644
index 0000000..45835bf
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/next.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/note.gif b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/note.gif
new file mode 100644
index 0000000..f329d35
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/note.gif
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/note.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/note.png
new file mode 100644
index 0000000..bf67f22
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/note.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/note.tif b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/note.tif
new file mode 100644
index 0000000..4da159d
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/note.tif
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/prev.gif b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/prev.gif
new file mode 100644
index 0000000..2cb2319
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/prev.gif
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/prev.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/prev.png
new file mode 100644
index 0000000..cf24654
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/prev.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/tip.gif b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/tip.gif
new file mode 100644
index 0000000..823f2b4
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/tip.gif
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/tip.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/tip.png
new file mode 100644
index 0000000..bf67f22
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/tip.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/tip.tif b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/tip.tif
new file mode 100644
index 0000000..4da159d
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/tip.tif
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/toc-blank.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/toc-blank.png
new file mode 100644
index 0000000..6ffad17
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/toc-blank.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/toc-minus.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/toc-minus.png
new file mode 100644
index 0000000..abbb020
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/toc-minus.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/toc-plus.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/toc-plus.png
new file mode 100644
index 0000000..941312c
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/toc-plus.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/up.gif b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/up.gif
new file mode 100644
index 0000000..333b5e3
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/up.gif
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/up.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/up.png
new file mode 100644
index 0000000..07634de
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/up.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/warning.gif b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/warning.gif
new file mode 100644
index 0000000..3adf191
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/warning.gif
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/warning.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/warning.png
new file mode 100644
index 0000000..549c472
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/warning.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/warning.tif b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/warning.tif
new file mode 100644
index 0000000..b727be8
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/admons/warning.tif
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/apache-incubator-logo.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/apache-incubator-logo.png
new file mode 100644
index 0000000..81fb31e
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/apache-incubator-logo.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/asf-logo.gif b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/asf-logo.gif
new file mode 100644
index 0000000..22eb9d7
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/asf-logo.gif
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/1.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/1.png
new file mode 100644
index 0000000..7d47343
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/1.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/10.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/10.png
new file mode 100644
index 0000000..997bbc8
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/10.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/11.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/11.png
new file mode 100644
index 0000000..ce47dac
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/11.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/12.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/12.png
new file mode 100644
index 0000000..31daf4e
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/12.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/13.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/13.png
new file mode 100644
index 0000000..14021a8
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/13.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/14.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/14.png
new file mode 100644
index 0000000..64014b7
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/14.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/15.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/15.png
new file mode 100644
index 0000000..0d65765
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/15.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/2.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/2.png
new file mode 100644
index 0000000..5d09341
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/2.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/3.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/3.png
new file mode 100644
index 0000000..ef7b700
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/3.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/4.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/4.png
new file mode 100644
index 0000000..adb8364
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/4.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/5.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/5.png
new file mode 100644
index 0000000..4d7eb46
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/5.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/6.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/6.png
new file mode 100644
index 0000000..0ba694a
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/6.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/7.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/7.png
new file mode 100644
index 0000000..472e96f
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/7.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/8.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/8.png
new file mode 100644
index 0000000..5e60973
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/8.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/9.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/9.png
new file mode 100644
index 0000000..a0676d2
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/callouts/9.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/openwebbeans.png b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/openwebbeans.png
new file mode 100644
index 0000000..da78da3
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/images/openwebbeans.png
Binary files differ
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/customcommon/en.xml b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/customcommon/en.xml
new file mode 100644
index 0000000..3bde095
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/customcommon/en.xml
@@ -0,0 +1,31 @@
+<?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.
+ -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+ <xsl:param name="local.l10n.xml" select="document('')"/>
+ <l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
+ <l:l10n language="en">
+ <l:context name="xref">
+ <l:template name="page.citation" text=" (p. %p)"/>
+ </l:context>
+ <l:context name="glossary">
+ <l:template name="see" text="see %t"/>
+ <l:template name="seealso" text="See also %t"/>
+ </l:context>
+ </l:l10n>
+ </l:i18n>
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/customhtml/admon.xsl b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/customhtml/admon.xsl
new file mode 100644
index 0000000..01de5cf
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/customhtml/admon.xsl
@@ -0,0 +1,80 @@
+<?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.
+ -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+ <xsl:template match="*" mode="admon.graphic.width">
+ <xsl:param name="node" select="."/>
+ <xsl:text>40</xsl:text>
+ </xsl:template>
+
+ <xsl:template name="graphical.admonition">
+ <xsl:variable name="admon.type">
+ <xsl:choose>
+ <xsl:when test="local-name(.)='note'">Note</xsl:when>
+ <xsl:when test="local-name(.)='warning'">Warning</xsl:when>
+ <xsl:when test="local-name(.)='caution'">Caution</xsl:when>
+ <xsl:when test="local-name(.)='tip'">Tip</xsl:when>
+ <xsl:when test="local-name(.)='important'">Important</xsl:when>
+ <xsl:otherwise>Note</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="alt">
+ <xsl:call-template name="gentext">
+ <xsl:with-param name="key" select="$admon.type"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <div class="{name(.)}">
+ <xsl:if test="$admon.style != ''">
+ <xsl:attribute name="style">
+ <xsl:value-of select="$admon.style"/>
+ </xsl:attribute>
+ </xsl:if>
+ <table border="0" class="admon">
+ <xsl:attribute name="summary">
+ <xsl:value-of select="$admon.type"/>
+ <xsl:if test="title">
+ <xsl:text>: </xsl:text>
+ <xsl:value-of select="title"/>
+ </xsl:if>
+ </xsl:attribute>
+ <tr>
+ <td rowspan="2" align="center" valign="top">
+ <xsl:attribute name="width">
+ <xsl:apply-templates select="." mode="admon.graphic.width"/>
+ </xsl:attribute>
+ <img alt="[{$alt}]">
+ <xsl:attribute name="src">
+ <xsl:call-template name="admon.graphic"/>
+ </xsl:attribute>
+ </img>
+ </td>
+ <th align="left">
+ <xsl:call-template name="anchor"/>
+ <xsl:if test="$admon.textlabel != 0 or title">
+ <xsl:apply-templates select="." mode="object.title.markup"/>
+ </xsl:if>
+ </th>
+ </tr>
+ <tr>
+ <td align="left" valign="top">
+ <xsl:apply-templates/>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/customhtml/autoidx.xsl b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/customhtml/autoidx.xsl
new file mode 100644
index 0000000..a8bb09a
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/customhtml/autoidx.xsl
@@ -0,0 +1,131 @@
+<?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.
+ -->
+<!DOCTYPE xsl:stylesheet [
+
+<!ENTITY lowercase "'abcdefghijklmnopqrstuvwxyz'">
+<!ENTITY uppercase "'ABCDEFGHIJKLMNOPQRSTUVWXYZ'">
+
+<!ENTITY primary 'normalize-space(concat(primary/@sortas, primary[not(@sortas)]))'>
+<!ENTITY secondary 'normalize-space(concat(secondary/@sortas, secondary[not(@sortas)]))'>
+<!ENTITY tertiary 'normalize-space(concat(tertiary/@sortas, tertiary[not(@sortas)]))'>
+
+<!ENTITY section '(ancestor-or-self::set
+ |ancestor-or-self::book
+ |ancestor-or-self::part
+ |ancestor-or-self::reference
+ |ancestor-or-self::partintro
+ |ancestor-or-self::chapter
+ |ancestor-or-self::appendix
+ |ancestor-or-self::preface
+ |ancestor-or-self::article
+ |ancestor-or-self::section
+ |ancestor-or-self::sect1
+ |ancestor-or-self::sect2
+ |ancestor-or-self::sect3
+ |ancestor-or-self::sect4
+ |ancestor-or-self::sect5
+ |ancestor-or-self::refentry
+ |ancestor-or-self::refsect1
+ |ancestor-or-self::refsect2
+ |ancestor-or-self::refsect3
+ |ancestor-or-self::simplesect
+ |ancestor-or-self::bibliography
+ |ancestor-or-self::glossary
+ |ancestor-or-self::index
+ |ancestor-or-self::webpage)[last()]'>
+
+<!ENTITY section.id 'generate-id(§ion;)'>
+<!ENTITY sep '" "'>
+<!ENTITY scope 'count(ancestor::node()|$scope) = count(ancestor::node())
+ and ($role = @role or $type = @type or
+ (string-length($role) = 0 and string-length($type) = 0))'>
+]>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+ <xsl:key name="letter" match="indexterm"
+ use="translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;)"/>
+
+ <xsl:key name="primary" match="indexterm" use="&primary;"/>
+
+ <xsl:key name="secondary" match="indexterm"
+ use="concat(&primary;, &sep;, &secondary;)"/>
+
+ <xsl:key name="tertiary" match="indexterm"
+ use="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;)"/>
+
+ <xsl:key name="endofrange" match="indexterm[@class='endofrange']" use="@startref"/>
+
+ <xsl:key name="primary-section" match="indexterm[not(secondary) and not(see)]"
+ use="concat(&primary;, &sep;, §ion.id;)"/>
+
+ <xsl:key name="secondary-section" match="indexterm[not(tertiary) and not(see)]"
+ use="concat(&primary;, &sep;, &secondary;, &sep;, §ion.id;)"/>
+
+ <xsl:key name="tertiary-section" match="indexterm[not(see)]"
+ use="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, §ion.id;)"/>
+
+ <xsl:key name="see-also" match="indexterm[seealso]"
+ use="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, seealso)"/>
+
+ <xsl:key name="see" match="indexterm[see]"
+ use="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, see)"/>
+
+ <xsl:key name="sections" match="*[@id]" use="@id"/>
+
+ <xsl:template match="indexterm" mode="reference">
+ <xsl:param name="scope" select="."/>
+ <xsl:param name="role" select="''"/>
+ <xsl:param name="type" select="''"/>
+ <xsl:param name="separator" select="', '"/>
+
+ <xsl:value-of select="$separator"/>
+ <xsl:choose>
+ <xsl:when test="@zone and string(@zone)">
+ <xsl:call-template name="reference">
+ <xsl:with-param name="zones" select="normalize-space(@zone)"/>
+ <xsl:with-param name="scope" select="$scope"/>
+ <xsl:with-param name="role" select="$role"/>
+ <xsl:with-param name="type" select="$type"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <a>
+ <xsl:variable name="title">
+ <xsl:choose>
+ <xsl:when test="§ion;/titleabbrev and $index.prefer.titleabbrev != 0">
+ <xsl:apply-templates select="§ion;" mode="titleabbrev.markup"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="§ion;" mode="title.markup"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:attribute name="href">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="object" select="§ion;"/>
+ <xsl:with-param name="context" select="//index[&scope;][1]"/>
+ </xsl:call-template>
+ </xsl:attribute>
+
+ <xsl:value-of select="$title"/>
+ <!-- text only -->
+ </a>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/customhtml/component.xsl b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/customhtml/component.xsl
new file mode 100644
index 0000000..6dd319d
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/customhtml/component.xsl
@@ -0,0 +1,45 @@
+<?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.
+ -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+ <xsl:template match="chapter">
+ <div class="{name(.)}">
+ <xsl:call-template name="language.attribute"/>
+ <xsl:if test="$generate.id.attributes != 0">
+ <xsl:attribute name="id">
+ <xsl:call-template name="object.id"/>
+ </xsl:attribute>
+ </xsl:if>
+
+ <xsl:call-template name="component.separator"/>
+ <xsl:call-template name="chapter.titlepage"/>
+ <xsl:apply-templates/>
+ <xsl:variable name="toc.params">
+ <xsl:call-template name="find.path.params">
+ <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="contains($toc.params, 'toc')">
+ <xsl:call-template name="component.toc">
+ <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
+ </xsl:call-template>
+ <xsl:call-template name="component.toc.separator"/>
+ </xsl:if>
+ <xsl:call-template name="process.footnotes"/>
+ </div>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/customhtml/highlight.xsl b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/customhtml/highlight.xsl
new file mode 100644
index 0000000..9a1b8c9
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/customhtml/highlight.xsl
@@ -0,0 +1,82 @@
+<?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.
+ -->
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xslthl="http://xslthl.sf.net"
+ exclude-result-prefixes="xslthl"
+ version="1.0">
+
+ <xsl:template match="a/@*|img/@*|xslthl:number/@*|a|img|xslthl:number">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()" />
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match='xslthl:keyword'>
+ <span class="hl-keyword">
+ <xsl:apply-templates />
+ </span>
+ </xsl:template>
+
+ <xsl:template match='xslthl:string'>
+ <span class="hl-string">
+ <xsl:apply-templates />
+ </span>
+ </xsl:template>
+
+ <xsl:template match='xslthl:comment'>
+ <span class="hl-comment">
+ <xsl:apply-templates />
+ </span>
+ </xsl:template>
+
+ <xsl:template match='xslthl:tag'>
+ <span class="hl-tag">
+ <xsl:apply-templates />
+ </span>
+ </xsl:template>
+
+ <xsl:template match='xslthl:attribute'>
+ <span class="hl-attribute">
+ <xsl:apply-templates />
+ </span>
+ </xsl:template>
+
+ <xsl:template match='xslthl:value'>
+ <span class="hl-value">
+ <xsl:apply-templates />
+ </span>
+ </xsl:template>
+
+ <xsl:template match='xslthl:html'>
+ <span class="hl-html">
+ <xsl:apply-templates />
+ </span>
+ </xsl:template>
+
+ <xsl:template match='xslthl:xslt'>
+ <span class="hl-xslt">
+ <xsl:apply-templates />
+ </span>
+ </xsl:template>
+
+ <xsl:template match='xslthl:section'>
+ <span class="hl-section">
+ <xsl:apply-templates />
+ </span>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/customhtml/inline.xsl b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/customhtml/inline.xsl
new file mode 100644
index 0000000..72adde0
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/customhtml/inline.xsl
@@ -0,0 +1,44 @@
+<?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.
+ -->
+<!DOCTYPE xsl:stylesheet [
+ <!ENTITY comment.block.parents "parent::answer|parent::appendix|parent::article|parent::bibliodiv|
+ parent::bibliography|parent::blockquote|parent::caution|parent::chapter|
+ parent::glossary|parent::glossdiv|parent::important|parent::index|
+ parent::indexdiv|parent::listitem|parent::note|parent::orderedlist|
+ parent::partintro|parent::preface|parent::procedure|parent::qandadiv|
+ parent::qandaset|parent::question|parent::refentry|parent::refnamediv|
+ parent::refsect1|parent::refsect2|parent::refsect3|parent::refsection|
+ parent::refsynopsisdiv|parent::sect1|parent::sect2|parent::sect3|parent::sect4|
+ parent::sect5|parent::section|parent::setindex|parent::sidebar|
+ parent::simplesect|parent::taskprerequisites|parent::taskrelated|
+ parent::tasksummary|parent::warning">
+]>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xlink='http://www.w3.org/1999/xlink'
+ xmlns:suwl="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.UnwrapLinks"
+ exclude-result-prefixes="xlink suwl"
+ version='1.0'>
+
+ <xsl:template match="database">
+ <xsl:call-template name="inline.monoseq"/>
+ </xsl:template>
+
+ <xsl:template match="replaceable" priority="1">
+ <xsl:call-template name="inline.monoseq"/>
+ </xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/customhtml/sections.xsl b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/customhtml/sections.xsl
new file mode 100644
index 0000000..694319a
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/customhtml/sections.xsl
@@ -0,0 +1,116 @@
+<?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.
+ -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+ <xsl:template match="section">
+ <xsl:variable name="depth" select="count(ancestor::section)+1"/>
+ <div class="{name(.)}">
+ <xsl:call-template name="language.attribute"/>
+ <xsl:call-template name="section.titlepage"/>
+ <xsl:variable name="toc.params">
+ <xsl:call-template name="find.path.params">
+ <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:apply-templates/>
+ <!-- ToC -->
+ <xsl:if
+ test="contains($toc.params, 'toc') and $depth <= $generate.section.toc.level">
+ <xsl:call-template name="section.toc">
+ <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
+ </xsl:call-template>
+ <xsl:call-template name="section.toc.separator"/>
+ </xsl:if>
+ <xsl:call-template name="process.chunk.footnotes"/>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="sect1">
+ <div class="{name(.)}">
+ <xsl:call-template name="language.attribute"/>
+ <xsl:choose>
+ <xsl:when test="@renderas = 'sect2'">
+ <xsl:call-template name="sect2.titlepage"/>
+ </xsl:when>
+ <xsl:when test="@renderas = 'sect3'">
+ <xsl:call-template name="sect3.titlepage"/>
+ </xsl:when>
+ <xsl:when test="@renderas = 'sect4'">
+ <xsl:call-template name="sect4.titlepage"/>
+ </xsl:when>
+ <xsl:when test="@renderas = 'sect5'">
+ <xsl:call-template name="sect5.titlepage"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="sect1.titlepage"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates/>
+ <!-- ToC -->
+ <xsl:variable name="toc.params">
+ <xsl:call-template name="find.path.params">
+ <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if
+ test="contains($toc.params, 'toc') and $generate.section.toc.level >= 1">
+ <xsl:call-template name="section.toc">
+ <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
+ </xsl:call-template>
+ <xsl:call-template name="section.toc.separator"/>
+ </xsl:if>
+ <xsl:call-template name="process.chunk.footnotes"/>
+ </div>
+ </xsl:template>
+
+
+ <xsl:template match="sect2">
+ <div class="{name(.)}">
+ <xsl:call-template name="language.attribute"/>
+ <xsl:choose>
+ <xsl:when test="@renderas = 'sect1'">
+ <xsl:call-template name="sect1.titlepage"/>
+ </xsl:when>
+ <xsl:when test="@renderas = 'sect3'">
+ <xsl:call-template name="sect3.titlepage"/>
+ </xsl:when>
+ <xsl:when test="@renderas = 'sect4'">
+ <xsl:call-template name="sect4.titlepage"/>
+ </xsl:when>
+ <xsl:when test="@renderas = 'sect5'">
+ <xsl:call-template name="sect5.titlepage"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="sect2.titlepage"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:variable name="toc.params">
+ <xsl:call-template name="find.path.params">
+ <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="contains($toc.params, 'toc') and $generate.section.toc.level >= 2">
+ <xsl:call-template name="section.toc">
+ <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
+ </xsl:call-template>
+ <xsl:call-template name="section.toc.separator"/>
+ </xsl:if>
+ <xsl:apply-templates/>
+ <xsl:call-template name="process.chunk.footnotes"/>
+ </div>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/customhtml/titlepage.xsl b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/customhtml/titlepage.xsl
new file mode 100644
index 0000000..db07e08
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/customhtml/titlepage.xsl
@@ -0,0 +1,328 @@
+<?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.
+ -->
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:exsl="http://exslt.org/common"
+ version="1.0"
+ exclude-result-prefixes="exsl">
+
+ <xsl:template name="user.header.content">
+ <xsl:param name="node" select="." />
+ <xsl:call-template name="add.header.logo"/>
+ </xsl:template>
+
+ <xsl:template name="add.header.logo">
+ <div class="navheader">
+ <table>
+ <tr>
+ <td width="20%" align="left"><img src="{$document.logo.src}" border="0" alt="{$document.logo.alt}"/></td>
+ <td width="60%"> </td>
+ <td width="20%" align="right"><img src="{$apache.logo.src}" border="0" alt="{$apache.logo.alt}"/></td>
+ </tr>
+ </table>
+ </div>
+ </xsl:template>
+
+ <xsl:template name="book.titlepage.recto">
+ <xsl:choose>
+ <xsl:when test="bookinfo/title">
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/title" />
+ </xsl:when>
+ <xsl:when test="info/title">
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/title" />
+ </xsl:when>
+ <xsl:when test="title">
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="title" />
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/productname" />
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/productname" />
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/revhistory" />
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/revhistory" />
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/author" />
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/author" />
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/abstract" />
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/abstract" />
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/legalnotice" />
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/legalnotice" />
+ </xsl:template>
+
+ <xsl:template name="book.titlepage">
+ <div class="titlepage">
+ <xsl:variable name="recto.content">
+ <xsl:call-template name="book.titlepage.before.recto"/>
+ <xsl:call-template name="book.titlepage.recto"/>
+ </xsl:variable>
+ <xsl:variable name="recto.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count > 0)">
+ <div><xsl:copy-of select="$recto.content"/></div>
+ </xsl:if>
+ <xsl:variable name="verso.content">
+ <xsl:call-template name="book.titlepage.before.verso"/>
+ <xsl:call-template name="book.titlepage.verso"/>
+ </xsl:variable>
+ <xsl:variable name="verso.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count > 0)">
+ <div><xsl:copy-of select="$verso.content"/></div>
+ </xsl:if>
+ <xsl:call-template name="book.titlepage.separator"/>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="*" mode="book.titlepage.recto.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode" />
+ </xsl:template>
+
+ <xsl:template match="*" mode="book.titlepage.verso.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode" />
+ </xsl:template>
+
+ <xsl:template match="title" mode="book.titlepage.recto.auto.mode">
+ <div xsl:use-attribute-sets="book.titlepage.recto.style">
+ <xsl:call-template name="title.mainpage">
+ </xsl:call-template>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="productname" mode="book.titlepage.recto.auto.mode">
+ <div xsl:use-attribute-sets="book.titlepage.recto.style">
+ <xsl:call-template name="productname.mainpage">
+ </xsl:call-template>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="revhistory" mode="book.titlepage.recto.auto.mode">
+ <div xsl:use-attribute-sets="book.titlepage.recto.style">
+ <xsl:call-template name="revhistory.mainpage">
+ </xsl:call-template>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="author" mode="book.titlepage.recto.auto.mode">
+ <div xsl:use-attribute-sets="book.titlepage.recto.style">
+ <xsl:call-template name="author.mainpage">
+ </xsl:call-template>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="abstract" mode="book.titlepage.recto.auto.mode">
+ <div xsl:use-attribute-sets="book.titlepage.recto.style">
+ <xsl:apply-templates select="."
+ mode="book.titlepage.recto.mode" />
+ </div>
+ </xsl:template>
+
+ <xsl:template match="legalnotice" mode="book.titlepage.recto.auto.mode">
+ <div xsl:use-attribute-sets="book.titlepage.recto.style">
+ <xsl:call-template name="legalnotice.mainpage">
+ </xsl:call-template>
+ </div>
+ </xsl:template>
+
+ <xsl:template name="title.mainpage">
+ <xsl:variable name="id">
+ <xsl:choose>
+ <xsl:when test="contains(local-name(..), 'info')">
+ <xsl:call-template name="object.id">
+ <xsl:with-param name="object" select="../.."/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="object.id">
+ <xsl:with-param name="object" select=".."/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <h1 class="subtitle">
+ <a name="{$id}"/>
+ <xsl:choose>
+ <xsl:when test="$show.revisionflag != 0 and @revisionflag">
+ <span class="{@revisionflag}">
+ <xsl:apply-templates mode="titlepage.mode"/>
+ </span>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="titlepage.mode"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="//bookinfo//subtitle">
+ <xsl:call-template name="gentext.space"/>
+ :
+ <xsl:call-template name="gentext.space"/>
+ <xsl:apply-templates select="//bookinfo//subtitle" mode="mainpage"/>
+ </xsl:if>
+ </h1>
+ </xsl:template>
+
+ <xsl:template match="subtitle" mode="mainpage">
+ <xsl:apply-templates mode="titlepage.mode"/>
+ </xsl:template>
+
+ <xsl:template name="revhistory.mainpage">
+ <xsl:variable name="id">
+ <xsl:call-template name="object.id"/>
+ </xsl:variable>
+ <xsl:variable name="title">
+ <xsl:call-template name="gentext">
+ <xsl:with-param name="key">RevHistory</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <div class="{name(.)}">
+ <b>
+ <xsl:call-template name="gentext">
+ <xsl:with-param name="key" select="'RevHistory'"/>
+ </xsl:call-template>
+ </b>
+ <table border="1" cellpadding="1" cellspacing="0" width="800" summary="Revision history">
+ <tr>
+ <th align="left" valign="top">
+ <p>Version</p>
+ </th>
+ <th align="left" valign="top">
+ <p>Date</p>
+ </th>
+ <th align="left" valign="top">
+ <p>Author</p>
+ </th>
+ <th align="left" valign="top">
+ <p>Reason of modification</p>
+ </th>
+ </tr>
+
+ <xsl:apply-templates mode="titlepage.mode"/>
+ </table>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="revhistory/revision" mode="titlepage.mode">
+ <xsl:variable name="revnumber" select="revnumber" />
+ <xsl:variable name="revdate" select="date" />
+ <xsl:variable name="revauthor" select="authorinitials" />
+ <xsl:variable name="revremark" select="revremark|revdescription" />
+ <tr>
+ <td align="left">
+ <p>
+ <xsl:choose>
+ <xsl:when test="$revnumber">
+ <xsl:apply-templates select="$revnumber[1]" mode="titlepage.mode" />
+ </xsl:when>
+ <xsl:otherwise>
+
+ </xsl:otherwise>
+ </xsl:choose>
+ </p>
+ </td>
+ <td align="left">
+ <p>
+ <xsl:choose>
+ <xsl:when test="$revdate[1]">
+ <xsl:apply-templates select="$revdate[1]" mode="titlepage.mode" />
+ </xsl:when>
+ <xsl:otherwise>
+
+ </xsl:otherwise>
+ </xsl:choose>
+ </p>
+ </td>
+ <td align="left">
+ <p>
+ <xsl:choose>
+ <xsl:when test="$revauthor">
+ <xsl:for-each select="$revauthor">
+ <xsl:apply-templates select="." mode="titlepage.mode" />
+ <xsl:if test="position() != last()">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+
+ </xsl:otherwise>
+ </xsl:choose>
+ </p>
+ </td>
+ <td align="left">
+ <p>
+ <xsl:choose>
+ <xsl:when test="$revremark">
+ <xsl:apply-templates select="$revremark[1]" mode="titlepage.mode" />
+ </xsl:when>
+ <xsl:otherwise>
+
+ </xsl:otherwise>
+ </xsl:choose>
+ </p>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template name="productname.mainpage">
+ <p class="{name(.)}">
+ This document is part of the
+ <xsl:apply-templates mode="titlepage.mode" />
+ <xsl:call-template name="gentext.space" />
+ <xsl:if test="//bookinfo//productnumber">
+ <xsl:apply-templates select="//bookinfo//productnumber" />
+ </xsl:if>
+ <xsl:call-template name="gentext.space" />
+ release.
+ </p>
+ <br />
+ </xsl:template>
+
+ <xsl:template name="author.mainpage">
+ <div class="{name(.)}">
+ <b class="{name(.)}">Contact person:</b>
+ <xsl:call-template name="gentext.space" />
+ <xsl:call-template name="person.name" />
+ <xsl:call-template name="gentext.space" />
+ <xsl:apply-templates mode="titlepage.mode"
+ select="./email" />
+ </div>
+ </xsl:template>
+
+ <xsl:template name="legalnotice.mainpage">
+ <xsl:variable name="id">
+ <xsl:call-template name="object.id" />
+ </xsl:variable>
+ <hr />
+ <div class="copyright">
+ <a name="{$id}" />
+ <xsl:apply-templates mode="titlepage.mode" />
+ </div>
+ </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/custompdf/admon.xsl b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/custompdf/admon.xsl
new file mode 100644
index 0000000..3c74a78
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/custompdf/admon.xsl
@@ -0,0 +1,96 @@
+<?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.
+ -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ version='1.0'>
+
+ <!-- === Parameter === -->
+ <!-- 1 = Admonition are presented with a generated text label such as Note or Warning -->
+ <xsl:param name="admon.textlabel" select="1"/>
+ <xsl:param name="admon.graphics" select="1"></xsl:param>
+
+ <!-- Admonition Title -->
+ <xsl:attribute-set name="admonition.title.properties">
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ <xsl:attribute name="hyphenate">false</xsl:attribute>
+ <xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
+ </xsl:attribute-set>
+ <!-- Admonition Block -->
+ <xsl:attribute-set name="graphical.admonition.properties">
+ <xsl:attribute name="border-style">solid</xsl:attribute>
+ <xsl:attribute name="border-right-width">thin</xsl:attribute>
+ <xsl:attribute name="border-left-width">thin</xsl:attribute>
+ <xsl:attribute name="border-top-width">thin</xsl:attribute>
+ <xsl:attribute name="border-bottom-width">thin</xsl:attribute>
+ <xsl:attribute name="border-right-color">black</xsl:attribute>
+ <xsl:attribute name="border-left-color">black</xsl:attribute>
+ <xsl:attribute name="border-top-color">black</xsl:attribute>
+ <xsl:attribute name="border-bottom-color">black</xsl:attribute>
+ <xsl:attribute name="margin-left">0.25in</xsl:attribute>
+ <xsl:attribute name="margin-right">0.25in</xsl:attribute>
+ <xsl:attribute name="space-before.optimum">1em</xsl:attribute>
+ <xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
+ <xsl:attribute name="space-before.maximum">1.2em</xsl:attribute>
+ <xsl:attribute name="space-after.optimum">1em</xsl:attribute>
+ <xsl:attribute name="space-after.minimum">0.8em</xsl:attribute>
+ <xsl:attribute name="space-after.maximum">1.2em</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- === Template === -->
+ <xsl:template match="*" mode="admon.graphic.width">
+ <xsl:param name="node" select="."/>
+ <xsl:text>40pt</xsl:text>
+ </xsl:template>
+
+ <xsl:template name="graphical.admonition">
+ <xsl:variable name="id">
+ <xsl:call-template name="object.id"/>
+ </xsl:variable>
+ <xsl:variable name="graphic.width">
+ <xsl:apply-templates select="." mode="admon.graphic.width"/>
+ </xsl:variable>
+ <fo:block id="{$id}"
+ xsl:use-attribute-sets="graphical.admonition.properties">
+ <fo:list-block provisional-distance-between-starts="{$graphic.width} + 18pt"
+ provisional-label-separation="18pt">
+ <fo:list-item margin-top="4pt" margin-bottom="4pt" margin-left="4pt" margin-right="4pt">
+ <fo:list-item-label end-indent="label-end()">
+ <fo:block>
+ <fo:external-graphic width="auto" height="auto"
+ content-width="{$graphic.width}" >
+ <xsl:attribute name="src">
+ <xsl:call-template name="admon.graphic"/>
+ </xsl:attribute>
+ </fo:external-graphic>
+ </fo:block>
+ </fo:list-item-label>
+ <fo:list-item-body start-indent="body-start()">
+ <xsl:if test="$admon.textlabel != 0 or title">
+ <fo:block xsl:use-attribute-sets="admonition.title.properties">
+ <xsl:apply-templates select="." mode="object.title.markup"/>
+ </fo:block>
+ </xsl:if>
+ <fo:block xsl:use-attribute-sets="admonition.properties">
+ <xsl:apply-templates/>
+ </fo:block>
+ </fo:list-item-body>
+ </fo:list-item>
+ </fo:list-block>
+ </fo:block>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/custompdf/block.xsl b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/custompdf/block.xsl
new file mode 100644
index 0000000..cfd5d04
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/custompdf/block.xsl
@@ -0,0 +1,33 @@
+<?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.
+ -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ version='1.0'>
+
+<xsl:template match="epigraph">
+ <fo:block text-align="right" margin-left="3.5cm" font-style="italic">
+ <xsl:call-template name="anchor" />
+ <xsl:apply-templates select="para|simpara|formalpara|literallayout" />
+ <xsl:if test="attribution">
+ <fo:inline>
+ <xsl:text>--</xsl:text>
+ <xsl:apply-templates select="attribution" />
+ </fo:inline>
+ </xsl:if>
+ </fo:block>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/custompdf/highlight.xsl b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/custompdf/highlight.xsl
new file mode 100644
index 0000000..1bfd6db
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/custompdf/highlight.xsl
@@ -0,0 +1,60 @@
+<?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.
+ -->
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ xmlns:xslthl="http://xslthl.sf.net"
+ exclude-result-prefixes="xslthl"
+ version="1.0">
+
+ <xsl:template match='xslthl:keyword'>
+ <fo:inline font-weight="bold">
+ <xsl:apply-templates />
+ </fo:inline>
+ </xsl:template>
+
+ <xsl:template match='xslthl:string'>
+ <fo:inline font-weight="bold" font-style="italic">
+ <xsl:apply-templates />
+ </fo:inline>
+ </xsl:template>
+
+ <xsl:template match='xslthl:comment'>
+ <fo:inline font-style="italic" color="green">
+ <xsl:apply-templates />
+ </fo:inline>
+ </xsl:template>
+
+ <xsl:template match='xslthl:tag'>
+ <fo:inline font-weight="bold" color="Maroon">
+ <xsl:apply-templates />
+ </fo:inline>
+ </xsl:template>
+
+ <xsl:template match='xslthl:attribute'>
+ <fo:inline color="red">
+ <xsl:apply-templates />
+ </fo:inline>
+ </xsl:template>
+
+ <xsl:template match='xslthl:value'>
+ <fo:inline color="black">
+ <xsl:apply-templates />
+ </fo:inline>
+ </xsl:template>
+
+
+</xsl:stylesheet>
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/custompdf/inline.xsl b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/custompdf/inline.xsl
new file mode 100644
index 0000000..aa8966b
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/custompdf/inline.xsl
@@ -0,0 +1,50 @@
+<?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.
+ -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ xmlns:xlink='http://www.w3.org/1999/xlink'
+ exclude-result-prefixes="xlink"
+ version='1.0'>
+
+ <xsl:template name="inline.boldermonoseq">
+ <xsl:param name="content">
+ <xsl:apply-templates />
+ </xsl:param>
+ <fo:inline font-style="normal" font-weight="bolder"
+ xsl:use-attribute-sets="monospace.properties">
+ <xsl:if test="@dir">
+ <xsl:attribute name="direction">
+ <xsl:choose>
+ <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
+ <xsl:otherwise>rtl</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:copy-of select="$content" />
+ </fo:inline>
+ </xsl:template>
+
+ <xsl:template match="database">
+ <xsl:call-template name="inline.monoseq" />
+ </xsl:template>
+
+ <xsl:template match="replaceable">
+ <xsl:call-template name="inline.boldermonoseq" />
+ </xsl:template>
+
+
+</xsl:stylesheet>
+
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/custompdf/pagesetup.xsl b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/custompdf/pagesetup.xsl
new file mode 100644
index 0000000..42d85ba
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/custompdf/pagesetup.xsl
@@ -0,0 +1,401 @@
+<?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.
+ -->
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ version="1.0">
+
+ <xsl:template name="header.table">
+ <xsl:param name="pageclass" select="''" />
+ <xsl:param name="sequence" select="''" />
+ <xsl:param name="gentext-key" select="''" />
+ <!-- default is a single table style for all headers -->
+ <!-- Customize it for different page classes or sequence location -->
+ <xsl:choose>
+ <xsl:when test="$pageclass = 'index'">
+ <xsl:attribute name="margin-left">0pt</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:variable name="column1">
+ <xsl:choose>
+ <xsl:when test="$double.sided = 0">1</xsl:when>
+ <xsl:when test="$sequence = 'first' or $sequence = 'odd'">1</xsl:when>
+ <xsl:otherwise>3</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="column3">
+ <xsl:choose>
+ <xsl:when test="$double.sided = 0">3</xsl:when>
+ <xsl:when test="$sequence = 'first' or $sequence = 'odd'">3</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="candidate">
+ <fo:table table-layout="fixed" width="100%">
+ <xsl:call-template name="head.sep.rule">
+ <xsl:with-param name="pageclass" select="$pageclass" />
+ <xsl:with-param name="sequence" select="$sequence" />
+ <xsl:with-param name="gentext-key" select="$gentext-key" />
+ </xsl:call-template>
+ <fo:table-column column-number="1">
+ <xsl:attribute name="column-width">
+ <xsl:text>proportional-column-width(</xsl:text>
+ <xsl:call-template name="header.footer.width">
+ <xsl:with-param name="location">header</xsl:with-param>
+ <xsl:with-param name="position" select="$column1" />
+ </xsl:call-template>
+ <xsl:text>)</xsl:text>
+ </xsl:attribute>
+ </fo:table-column>
+ <fo:table-column column-number="2">
+ <xsl:attribute name="column-width">
+ <xsl:text>proportional-column-width(</xsl:text>
+ <xsl:call-template name="header.footer.width">
+ <xsl:with-param name="location">header</xsl:with-param>
+ <xsl:with-param name="position" select="2" />
+ </xsl:call-template>
+ <xsl:text>)</xsl:text>
+ </xsl:attribute>
+ </fo:table-column>
+ <fo:table-column column-number="3">
+ <xsl:attribute name="column-width">
+ <xsl:text>proportional-column-width(</xsl:text>
+ <xsl:call-template name="header.footer.width">
+ <xsl:with-param name="location">header</xsl:with-param>
+ <xsl:with-param name="position" select="$column3" />
+ </xsl:call-template>
+ <xsl:text>)</xsl:text>
+ </xsl:attribute>
+ </fo:table-column>
+ <fo:table-body>
+ <!-- header-hight (org:14pt) -->
+ <fo:table-row height="50pt">
+ <fo:table-cell text-align="left"
+ display-align="before">
+ <xsl:if test="$fop.extensions = 0">
+ <xsl:attribute name="relative-align">baseline</xsl:attribute>
+ </xsl:if>
+ <fo:block>
+ <xsl:call-template name="header.content">
+ <xsl:with-param name="pageclass" select="$pageclass" />
+ <xsl:with-param name="sequence" select="$sequence" />
+ <xsl:with-param name="position" select="'left'" />
+ <xsl:with-param name="gentext-key" select="$gentext-key" />
+ </xsl:call-template>
+ </fo:block>
+ </fo:table-cell>
+ <fo:table-cell text-align="center"
+ display-align="before">
+ <xsl:if test="$fop.extensions = 0">
+ <xsl:attribute name="relative-align">baseline</xsl:attribute>
+ </xsl:if>
+ <fo:block>
+ <xsl:call-template name="header.content">
+ <xsl:with-param name="pageclass" select="$pageclass" />
+ <xsl:with-param name="sequence" select="$sequence" />
+ <xsl:with-param name="position" select="'center'" />
+ <xsl:with-param name="gentext-key" select="$gentext-key" />
+ </xsl:call-template>
+ </fo:block>
+ </fo:table-cell>
+ <fo:table-cell text-align="right"
+ display-align="before">
+ <xsl:if test="$fop.extensions = 0">
+ <xsl:attribute name="relative-align">baseline</xsl:attribute>
+ </xsl:if>
+ <fo:block>
+ <xsl:call-template name="header.content">
+ <xsl:with-param name="pageclass" select="$pageclass" />
+ <xsl:with-param name="sequence" select="$sequence" />
+ <xsl:with-param name="position" select="'right'" />
+ <xsl:with-param name="gentext-key" select="$gentext-key" />
+ </xsl:call-template>
+ </fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </fo:table-body>
+ </fo:table>
+ </xsl:variable>
+ <xsl:copy-of select="$candidate" />
+ </xsl:template>
+
+ <xsl:template name="header.content">
+ <xsl:param name="pageclass" select="''" />
+ <xsl:param name="sequence" select="''" />
+ <xsl:param name="position" select="''" />
+ <xsl:param name="gentext-key" select="''" />
+ <fo:block xsl:use-attribute-sets="header.title.properties">
+ <!-- sequence can be odd, even, first, blank -->
+ <!-- position can be left, center, right -->
+ <xsl:if test="$position='left'">
+ <!--
+ <xsl:apply-templates select="/" mode="title.markup" />
+ <fo:block />
+ <xsl:apply-templates select="/" mode="subtitle.markup" />
+ <fo:block />
+ -->
+ <fo:block>
+ <fo:external-graphic src="url({$document.logo.src})"
+ width="4.5cm" height="auto"
+ content-width="scale-to-fit" content-height="scale-to-fit" />
+ </fo:block>
+ <xsl:if
+ test="($pageclass !='titlepage' and $pageclass !='lot' and $sequence != 'blank')">
+ <xsl:apply-templates select="." mode="title.markup" />
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="$position='right'">
+ <fo:block>
+ <fo:external-graphic src="url({$apache.logo.src})"
+ width="4.5cm" height="auto"
+ content-width="scale-to-fit" content-height="scale-to-fit" />
+ </fo:block>
+ </xsl:if>
+ </fo:block>
+ </xsl:template>
+
+ <xsl:template name="footer.table">
+ <xsl:param name="pageclass" select="''" />
+ <xsl:param name="sequence" select="''" />
+ <xsl:param name="gentext-key" select="''" />
+ <!-- default is a single table style for all footers -->
+ <!-- Customize it for different page classes or sequence location -->
+ <xsl:choose>
+ <xsl:when test="$pageclass = 'index'">
+ <xsl:attribute name="margin-left">0pt</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:variable name="column1">
+ <xsl:choose>
+ <xsl:when test="$double.sided = 0">1</xsl:when>
+ <xsl:when test="$sequence = 'first' or $sequence = 'odd'">1</xsl:when>
+ <xsl:otherwise>3</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="column3">
+ <xsl:choose>
+ <xsl:when test="$double.sided = 0">3</xsl:when>
+ <xsl:when test="$sequence = 'first' or $sequence = 'odd'">3</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="candidate">
+ <fo:table table-layout="fixed" width="100%">
+ <xsl:call-template name="foot.sep.rule">
+ <xsl:with-param name="pageclass" select="$pageclass" />
+ <xsl:with-param name="sequence" select="$sequence" />
+ <xsl:with-param name="gentext-key" select="$gentext-key" />
+ </xsl:call-template>
+ <fo:table-column column-number="1">
+ <xsl:attribute name="column-width">
+ <xsl:text>proportional-column-width(</xsl:text>
+ <xsl:call-template name="header.footer.width">
+ <xsl:with-param name="location">footer</xsl:with-param>
+ <xsl:with-param name="position" select="$column1" />
+ </xsl:call-template>
+ <xsl:text>)</xsl:text>
+ </xsl:attribute>
+ </fo:table-column>
+ <fo:table-column column-number="2">
+ <xsl:attribute name="column-width">
+ <xsl:text>proportional-column-width(</xsl:text>
+ <xsl:call-template name="header.footer.width">
+ <xsl:with-param name="location">footer</xsl:with-param>
+ <xsl:with-param name="position" select="2" />
+ </xsl:call-template>
+ <xsl:text>)</xsl:text>
+ </xsl:attribute>
+ </fo:table-column>
+ <fo:table-column column-number="3">
+ <xsl:attribute name="column-width">
+ <xsl:text>proportional-column-width(</xsl:text>
+ <xsl:call-template name="header.footer.width">
+ <xsl:with-param name="location">footer</xsl:with-param>
+ <xsl:with-param name="position" select="$column3" />
+ </xsl:call-template>
+ <xsl:text>)</xsl:text>
+ </xsl:attribute>
+ </fo:table-column>
+ <fo:table-body>
+ <fo:table-row height="26pt">
+ <fo:table-cell text-align="left"
+ display-align="before">
+ <xsl:if test="$fop.extensions = 0">
+ <xsl:attribute name="relative-align">before</xsl:attribute>
+ </xsl:if>
+ <fo:block>
+ <xsl:call-template name="footer.content">
+ <xsl:with-param name="pageclass" select="$pageclass" />
+ <xsl:with-param name="sequence" select="$sequence" />
+ <xsl:with-param name="position" select="'left'" />
+ <xsl:with-param name="gentext-key" select="$gentext-key" />
+ </xsl:call-template>
+ </fo:block>
+ </fo:table-cell>
+ <fo:table-cell text-align="center" display-align="before">
+ <xsl:if test="$fop.extensions = 0">
+ <xsl:attribute name="relative-align">before</xsl:attribute>
+ </xsl:if>
+ <fo:block>
+ <xsl:call-template name="footer.content">
+ <xsl:with-param name="pageclass" select="$pageclass" />
+ <xsl:with-param name="sequence" select="$sequence" />
+ <xsl:with-param name="position" select="'center'" />
+ <xsl:with-param name="gentext-key" select="$gentext-key" />
+ </xsl:call-template>
+ </fo:block>
+ </fo:table-cell>
+ <fo:table-cell text-align="right" display-align="before">
+ <xsl:if test="$fop.extensions = 0">
+ <xsl:attribute name="relative-align">before</xsl:attribute>
+ </xsl:if>
+ <fo:block>
+ <xsl:call-template name="footer.content">
+ <xsl:with-param name="pageclass" select="$pageclass" />
+ <xsl:with-param name="sequence" select="$sequence" />
+ <xsl:with-param name="position" select="'right'" />
+ <xsl:with-param name="gentext-key" select="$gentext-key" />
+ </xsl:call-template>
+ </fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </fo:table-body>
+ </fo:table>
+ </xsl:variable>
+ <xsl:copy-of select="$candidate" />
+ </xsl:template>
+
+ <xsl:template name="footer.content">
+ <xsl:param name="pageclass" select="''" />
+ <xsl:param name="sequence" select="''" />
+ <xsl:param name="position" select="''" />
+ <xsl:param name="gentext-key" select="''" />
+ <xsl:variable name="RevInfo">
+ <xsl:choose>
+ <xsl:when test="//revhistory/revision[1]/revnumber">
+ <xsl:text>Version </xsl:text>
+ <xsl:value-of select="//revhistory/revision[1]/revnumber" />
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- nop -->
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <fo:block xsl:use-attribute-sets="footer.title.properties">
+ <!-- pageclass can be front, body, back -->
+ <!-- sequence can be odd, even, first, blank -->
+ <!-- position can be left, center, right -->
+ <xsl:choose>
+ <xsl:when test="$position = 'left'">
+ <xsl:value-of select="$document.copyright"/>
+ </xsl:when>
+ <xsl:when test="$position = 'center'">
+ <xsl:value-of select="$RevInfo" />
+ </xsl:when>
+ <xsl:when test="$position = 'right'">Page: <fo:page-number /></xsl:when>
+ <xsl:otherwise />
+ </xsl:choose>
+ </fo:block>
+ </xsl:template>
+ <!-- ==================================================================== -->
+
+ <xsl:template name="page.number.format">
+ <xsl:param name="element" select="local-name(.)" />
+ <xsl:param name="master-reference" select="1" />
+ </xsl:template>
+
+ <xsl:template name="initial.page.number">
+ <xsl:param name="element" select="local-name(.)"/>
+ <xsl:param name="master-reference" select="''"/>
+ <xsl:choose>
+ <!-- double-sided output -->
+ <xsl:when test="$double.sided != 0">
+ <xsl:choose>
+ <xsl:when test="$element = 'toc'">auto-odd</xsl:when>
+ <xsl:when test="$element = 'book'">1</xsl:when>
+ <xsl:when test="$element = 'preface'">auto-odd</xsl:when>
+ <xsl:when test="$element = 'part' and not(preceding::chapter) and not(preceding::part)">auto-odd</xsl:when>
+ <xsl:when test="($element = 'dedication' or $element = 'article') and
+ not(preceding::chapter or preceding::preface or
+ preceding::appendix or preceding::article or
+ preceding::dedication or parent::part or
+ parent::reference)">auto-odd</xsl:when>
+ <xsl:when test="($element = 'chapter' or $element = 'appendix') and
+ not(preceding::chapter or preceding::appendix or
+ preceding::article or preceding::dedication or
+ parent::part or parent::reference)">auto-odd</xsl:when>
+ <xsl:otherwise>auto-odd</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <!-- single-sided output -->
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$element = 'toc'">auto</xsl:when>
+ <xsl:when test="$element = 'book'">1</xsl:when>
+ <xsl:when test="$element = 'preface'">auto</xsl:when>
+ <xsl:when test="$element = 'part' and not(preceding::chapter) and
+ not(preceding::part)">auto</xsl:when>
+ <xsl:when test="($element = 'dedication' or $element = 'article') and
+ not(preceding::chapter or preceding::preface or
+ preceding::appendix or preceding::article or
+ preceding::dedication or parent::part or
+ parent::reference)">auto</xsl:when>
+ <xsl:when test="($element = 'chapter' or $element = 'appendix') and
+ not(preceding::chapter or preceding::appendix or
+ preceding::article or preceding::dedication or
+ parent::part or parent::reference)">auto</xsl:when>
+ <xsl:otherwise>auto</xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="force.page.count">
+ <xsl:param name="element" select="local-name(.)" />
+ <xsl:param name="master-reference" select="''" />
+ <xsl:choose>
+ <!-- double-sided output -->
+ <xsl:when test="$double.sided != 0">end-on-even</xsl:when>
+ <!-- single-sided output -->
+ <xsl:otherwise>no-force</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="set.flow.properties">
+ <xsl:param name="element" select="local-name(.)" />
+ <xsl:param name="master-reference" select="''" />
+ <!-- This template is called after each <fo:flow> starts. -->
+ <!-- Customize this template to set attributes on fo:flow -->
+ <xsl:choose>
+ <xsl:when test="$fop.extensions != 0 or $passivetex.extensions != 0">
+ <!-- body.start.indent does not work well with these processors -->
+ </xsl:when>
+ <xsl:when
+ test="$master-reference = 'body' or $master-reference = 'lot' or
+ $master-reference = 'front' or $element = 'preface' or
+ ($master-reference = 'back' and $element = 'appendix')">
+ <xsl:attribute name="start-indent">
+ <xsl:value-of select="$body.start.indent" />
+ </xsl:attribute>
+ <xsl:attribute name="end-indent">
+ <xsl:value-of select="$body.end.indent" />
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <!-- ==================================================================== -->
+</xsl:stylesheet>
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/custompdf/table.xsl b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/custompdf/table.xsl
new file mode 100644
index 0000000..7319a83
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/custompdf/table.xsl
@@ -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.
+ -->
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ version="1.0">
+
+ <xsl:template name="table.row.properties">
+
+ <xsl:variable name="tabstyle">
+ <xsl:call-template name="tabstyle" />
+ </xsl:variable>
+
+ <xsl:variable name="bgcolor">
+ <xsl:call-template name="dbfo-attribute">
+ <xsl:with-param name="pis" select="processing-instruction('dbfo')" />
+ <xsl:with-param name="attribute" select="'bgcolor'" />
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="rownum">
+ <xsl:number from="tgroup" count="row" />
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="$bgcolor != ''">
+ <xsl:attribute name="background-color">
+ <xsl:value-of select="$bgcolor" />
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$tabstyle = 'striped'">
+ <xsl:if test="$rownum mod 2 = 0">
+ <xsl:attribute name="background-color">#EFEFEF</xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/custompdf/titlepage.xsl b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/custompdf/titlepage.xsl
new file mode 100644
index 0000000..87948cc
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/custompdf/titlepage.xsl
@@ -0,0 +1,409 @@
+<?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.
+ -->
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:exsl="http://exslt.org/common"
+ version="1.0"
+ exclude-result-prefixes="exsl">
+
+ <xsl:template name="book.titlepage.recto">
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/productname" />
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/productname" />
+ <xsl:choose>
+ <xsl:when test="bookinfo/title">
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/title" />
+ </xsl:when>
+ <xsl:when test="info/title">
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/title" />
+ </xsl:when>
+ <xsl:when test="title">
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="title" />
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="bookinfo/subtitle">
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/subtitle" />
+ </xsl:when>
+ <xsl:when test="info/subtitle">
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/subtitle" />
+ </xsl:when>
+ <xsl:when test="subtitle">
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="subtitle" />
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/address" />
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/address" />
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/legalnotice" />
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/legalnotice" />
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/edition" />
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/edition" />
+ </xsl:template>
+
+ <xsl:template name="book.titlepage.verso">
+ <xsl:apply-templates mode="book.titlepage.verso.auto.mode" select="bookinfo/productname" />
+ <xsl:apply-templates mode="book.titlepage.verso.auto.mode" select="info/productname" />
+ <xsl:apply-templates mode="book.titlepage.verso.auto.mode" select="bookinfo/abstract" />
+ <xsl:apply-templates mode="book.titlepage.verso.auto.mode" select="info/abstract" />
+ <xsl:apply-templates mode="book.titlepage.verso.auto.mode" select="bookinfo/revhistory" />
+ <xsl:apply-templates mode="book.titlepage.verso.auto.mode" select="info/revhistory" />
+ </xsl:template>
+
+ <xsl:template name="book.titlepage">
+ <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ <xsl:variable name="recto.content">
+ <xsl:call-template name="book.titlepage.before.recto" />
+ <xsl:call-template name="book.titlepage.recto" />
+ </xsl:variable>
+ <xsl:variable name="recto.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')">
+ <xsl:value-of select="count(exsl:node-set($recto.content)/*)" />
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if
+ test="(normalize-space($recto.content) != '') or ($recto.elements.count > 0)">
+ <fo:block>
+ <xsl:copy-of select="$recto.content" />
+ </fo:block>
+ </xsl:if>
+ <xsl:variable name="verso.content">
+ <xsl:call-template name="book.titlepage.before.verso" />
+ <xsl:call-template name="book.titlepage.verso" />
+ </xsl:variable>
+ <xsl:variable name="verso.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')">
+ <xsl:value-of select="count(exsl:node-set($verso.content)/*)" />
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if
+ test="(normalize-space($verso.content) != '') or ($verso.elements.count > 0)">
+ <fo:block>
+ <xsl:copy-of select="$verso.content" />
+ </fo:block>
+ </xsl:if>
+ <xsl:call-template name="book.titlepage.separator" />
+ </fo:block>
+ </xsl:template>
+
+ <xsl:template match="*" mode="book.titlepage.recto.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode" />
+ </xsl:template>
+
+ <xsl:template match="*" mode="book.titlepage.verso.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode" />
+ </xsl:template>
+
+ <xsl:template match="productname"
+ mode="book.titlepage.recto.auto.mode">
+ <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ xsl:use-attribute-sets="book.titlepage.recto.style" margin-top="30px"
+ text-align="right" font-size="22pt" font-weight="normal"
+ font-family="{$title.fontset}">
+ <xsl:apply-templates select="."
+ mode="book.titlepage.recto.mode" />
+ </fo:block>
+ </xsl:template>
+
+ <xsl:template match="title" mode="book.titlepage.recto.auto.mode">
+ <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ xsl:use-attribute-sets="book.titlepage.recto.style"
+ text-align="right" font-size="24pt" space-before="40pt"
+ font-weight="bold" font-family="{$title.fontset}">
+ <xsl:call-template name="division.title">
+ <xsl:with-param name="node"
+ select="ancestor-or-self::book[1]" />
+ </xsl:call-template>
+ </fo:block>
+ </xsl:template>
+
+ <xsl:template match="subtitle"
+ mode="book.titlepage.recto.auto.mode">
+ <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ xsl:use-attribute-sets="book.titlepage.recto.style"
+ text-align="right" font-size="20pt" font-weight="normal"
+ font-family="{$title.fontset}">
+ <xsl:apply-templates select="."
+ mode="book.titlepage.recto.mode" />
+ </fo:block>
+ </xsl:template>
+
+ <xsl:attribute-set name="book.titlepage.recto.address.style" />
+ <xsl:template match="address"
+ mode="book.titlepage.recto.auto.mode">
+ <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ xsl:use-attribute-sets="book.titlepage.recto.address.style">
+ <xsl:apply-templates select="."
+ mode="book.titlepage.recto.mode" />
+ </fo:block>
+ </xsl:template>
+ <xsl:template match="address" mode="book.titlepage.recto.mode">
+ <xsl:apply-templates />
+ </xsl:template>
+
+ <xsl:template match="legalnotice"
+ mode="book.titlepage.recto.auto.mode">
+ <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ xsl:use-attribute-sets="book.titlepage.recto.style" text-align="left"
+ font-size="8pt" space-before="18pt" font-weight="normal"
+ font-family="{$body.fontset}" border-bottom-width="0.5pt"
+ border-bottom-style="solid" border-bottom-color="black"
+ border-top-width="0.5pt" border-top-style="solid"
+ border-top-color="black">
+ <xsl:apply-templates select="."
+ mode="book.titlepage.recto.mode" />
+ </fo:block>
+ </xsl:template>
+
+ <xsl:template match="edition"
+ mode="book.titlepage.recto.auto.mode">
+ <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ xsl:use-attribute-sets="book.titlepage.recto.style">
+ <xsl:call-template name="book.recto.edition">
+ </xsl:call-template>
+ </fo:block>
+ </xsl:template>
+
+ <xsl:template match="productname"
+ mode="book.titlepage.verso.auto.mode">
+ <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ xsl:use-attribute-sets="book.titlepage.verso.style">
+ <xsl:call-template name="book.verso.productname">
+ </xsl:call-template>
+ </fo:block>
+ </xsl:template>
+
+ <xsl:template match="abstract"
+ mode="book.titlepage.verso.auto.mode">
+ <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ xsl:use-attribute-sets="book.titlepage.verso.style">
+ <xsl:apply-templates select="."
+ mode="book.titlepage.verso.mode" />
+ </fo:block>
+ </xsl:template>
+
+ <xsl:template match="revhistory"
+ mode="book.titlepage.verso.auto.mode">
+ <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ xsl:use-attribute-sets="book.titlepage.verso.style">
+ <xsl:call-template name="book.verso.revhistory">
+ </xsl:call-template>
+ </fo:block>
+ </xsl:template>
+
+ <xsl:template name="book.recto.edition">
+ </xsl:template>
+
+ <xsl:template match="bookinfo/author" mode="docinfo">
+ <fo:table-row xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ <fo:table-cell>
+ <fo:block> </fo:block>
+ </fo:table-cell>
+ <fo:table-cell>
+ <fo:block> </fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ <fo:table-row xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ <fo:table-cell>
+ <fo:block text-align="left" font-size="11pt"
+ font-weight="normal" font-family="{$body.fontset}">
+ Contact Person
+ </fo:block>
+ </fo:table-cell>
+ <fo:table-cell>
+ <fo:block text-align="left" font-size="11pt"
+ font-weight="normal" font-family="{$body.fontset}">
+ <xsl:call-template name="anchor" />
+ <xsl:call-template name="person.name" />
+ </fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ <xsl:if test="email|affiliation/address/email">
+ <fo:table-row
+ xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ <fo:table-cell>
+ <fo:block> </fo:block>
+ </fo:table-cell>
+ <fo:table-cell>
+ <fo:block text-align="left" font-size="11pt"
+ font-weight="normal" font-family="{$body.fontset}">
+ <xsl:apply-templates
+ select="(email|affiliation/address/email)[1]" />
+ </fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="bookinfo/pubdate|info/pubdate"
+ mode="titlepage.mode" priority="2">
+ <xsl:apply-templates mode="titlepage.mode" />
+ </xsl:template>
+
+ <xsl:template name="book.verso.productname">
+ <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ <fo:block xsl:use-attribute-sets="formal.title.properties"
+ keep-with-next.within-column="always">
+ Purpose and scope of this document
+ </fo:block>
+ <fo:block>
+ This document is part of the
+ <xsl:apply-templates mode="titlepage.mode" />
+ <xsl:call-template name="gentext.space" />
+ <xsl:if test="//productnumber">
+ <xsl:apply-templates select="//productnumber" />
+ </xsl:if>
+ <xsl:call-template name="gentext.space" />
+ release.
+ </fo:block>
+ </fo:block>
+ </xsl:template>
+
+ <xsl:template match="abstract" mode="titlepage.mode">
+ <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ <fo:block xsl:use-attribute-sets="formal.title.properties"
+ keep-with-next.within-column="always">
+ <xsl:apply-templates select="." mode="title.markup" />
+ </fo:block>
+ <xsl:apply-templates mode="titlepage.mode" />
+ </fo:block>
+ </xsl:template>
+
+ <xsl:template name="book.verso.revhistory">
+ <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ <fo:block xsl:use-attribute-sets="formal.title.properties"
+ keep-with-next.within-column="always">
+ Version control
+ </fo:block>
+ <fo:block>
+ This document is updated continuously. Major
+ modifications on content or size will lead to new
+ release numbers, whereas textual revisions are reflected
+ as new level numbers. The following list shows the
+ document's history.
+ </fo:block>
+ </fo:block>
+
+ <xsl:if test="revision">
+ <fo:table xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ table-layout="fixed" width="16cm" space-before="8.25pt"
+ border-width="0.5pt" border-style="solid" border-color="black">
+ <fo:table-column column-number="1" column-width="2cm" />
+ <fo:table-column column-number="2" column-width="3cm" />
+ <fo:table-column column-number="3" column-width="4cm" />
+ <fo:table-column column-number="4" column-width="7.5cm" />
+
+ <fo:table-header background-color="#E0E0E0">
+ <fo:table-row background-color="#E0E0E0">
+ <fo:table-cell padding="2pt">
+ <fo:block text-align="left" font-size="11pt"
+ font-weight="bold">
+ Version
+ </fo:block>
+ </fo:table-cell>
+ <fo:table-cell padding="2pt">
+ <fo:block text-align="left" font-size="11pt"
+ font-weight="bold">
+ Date
+ </fo:block>
+ </fo:table-cell>
+ <fo:table-cell padding="2pt">
+ <fo:block text-align="left" font-size="11pt"
+ font-weight="bold">
+ Author
+ </fo:block>
+ </fo:table-cell>
+ <fo:table-cell padding="2pt">
+ <fo:block text-align="left" font-size="11pt"
+ font-weight="bold">
+ Reason of modification
+ </fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </fo:table-header>
+
+ <fo:table-body start-indent="0pt" end-indent="0pt">
+ <xsl:apply-templates select="."
+ mode="book.verso.revhistory" />
+ </fo:table-body>
+ </fo:table>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="revision" mode="book.verso.revhistory">
+ <xsl:variable name="revnumber" select="revnumber" />
+ <xsl:variable name="revdate" select="date" />
+ <xsl:variable name="revauthor" select="authorinitials" />
+ <xsl:variable name="revremark" select="revremark|revdescription" />
+
+ <fo:table-row xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ border-width="0.5pt" border-style="solid" border-color="black"
+ >
+
+ <xsl:if test="(position() mod 2) = 0">
+ <xsl:attribute name="background-color">#EFEFEF</xsl:attribute>
+ </xsl:if>
+
+ <fo:table-cell padding="2pt">
+ <fo:block text-align="left" font-size="11pt"
+ font-weight="normal" font-family="{$body.fontset}">
+ <xsl:if test="$revnumber">
+ <xsl:apply-templates select="$revnumber[1]" mode="titlepage.mode" />
+ </xsl:if>
+ </fo:block>
+ </fo:table-cell>
+ <fo:table-cell padding="2pt">
+ <fo:block text-align="left" font-size="11pt"
+ font-weight="normal" font-family="{$body.fontset}">
+ <xsl:if test="$revdate">
+ <xsl:apply-templates select="$revdate[1]" mode="titlepage.mode" />
+ </xsl:if>
+ </fo:block>
+ </fo:table-cell>
+ <fo:table-cell padding="2pt">
+ <fo:block text-align="left" font-size="11pt"
+ font-weight="normal" font-family="{$body.fontset}">
+
+ <xsl:for-each select="$revauthor">
+ <xsl:apply-templates select="." mode="titlepage.mode" />
+ <xsl:if test="position() != last()">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </fo:block>
+ </fo:table-cell>
+ <fo:table-cell padding="2pt">
+ <fo:block text-align="left" font-size="11pt"
+ font-weight="normal" font-family="{$body.fontset}">
+ <xsl:if test="$revremark">
+ <xsl:apply-templates select="$revremark[1]" mode="titlepage.mode" />
+ </xsl:if>
+ </fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/fopdf.xsl b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/fopdf.xsl
new file mode 100644
index 0000000..9aaf820
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/fopdf.xsl
@@ -0,0 +1,409 @@
+<?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.
+ -->
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ version="1.0">
+
+ <xsl:import href="urn:docbkx:stylesheet" />
+
+ <!-- ================ Header and Footer data ============== -->
+ <xsl:param name="apache.logo.src" select="concat($img.src.path, 'asf-logo.gif')" />
+ <xsl:param name="apache.logo.alt" select="'Apache Software Foundation'" />
+ <xsl:param name="document.logo.src" select="concat($img.src.path, 'openwebbeans.png')" />
+ <xsl:param name="document.logo.alt" select="'Apache OpenWebBeans'" />
+ <xsl:param name="document.copyright" select="'© 2009 Apache OpenWebBeans'" />
+
+ <!-- ================ Customization Layer =========== -->
+ <xsl:include href="custompdf/pagesetup.xsl" />
+ <xsl:include href="custompdf/admon.xsl" />
+ <xsl:include href="custompdf/block.xsl" />
+ <xsl:include href="custompdf/inline.xsl" />
+ <xsl:include href="custompdf/titlepage.xsl" />
+ <xsl:include href="custompdf/highlight.xsl" />
+
+ <!-- =============== Customized I18n ============== -->
+ <xsl:param name="local.l10n.xml" select="document('customcommon/en.xml')" />
+
+ <!-- =============== Renderer options ============== -->
+ <xsl:param name="xep.extensions" select="0" />
+
+ <xsl:attribute-set name="xep.index.item.properties">
+ <xsl:attribute name="merge-subsequent-page-numbers">true</xsl:attribute>
+ <xsl:attribute name="link-back">true</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- FOP provide only PDF Bookmarks at the moment -->
+ <xsl:param name="fop.extensions">0</xsl:param> <!-- version 0.20.5 or earlier -->
+ <xsl:param name="fop1.extensions">1</xsl:param> <!-- version 0.93 or later -->
+
+ <!-- These extensions are required for table printing and other stuff -->
+ <xsl:param name="use.extensions">1</xsl:param>
+ <xsl:param name="tablecolumns.extension">0</xsl:param>
+ <xsl:param name="callout.extensions">1</xsl:param>
+
+ <!-- === Pagelayout === -->
+ <xsl:param name="paper.type">A4</xsl:param>
+ <xsl:param name="page.margin.inner">2.5cm</xsl:param>
+ <xsl:param name="page.margin.outer">2.5cm</xsl:param>
+ <xsl:param name="page.margin.top">0.7cm</xsl:param>
+ <xsl:param name="page.margin.bottom">0.5cm</xsl:param>
+ <xsl:param name="body.margin.top">3cm</xsl:param>
+ <xsl:param name="body.margin.bottom">1.5cm</xsl:param>
+ <xsl:param name="region.before.extent">2.3cm</xsl:param>
+ <xsl:param name="region.after.extent">1.3cm</xsl:param>
+ <xsl:param name="alignment">left</xsl:param>
+ <xsl:param name="hyphenate">true</xsl:param>
+ <xsl:attribute-set name="normal.para.spacing">
+ <xsl:attribute name="space-before.optimum">1em</xsl:attribute>
+ <xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
+ <xsl:attribute name="space-before.maximum">1.2em</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:param name="header.column.widths" select="'2 0 1'"></xsl:param>
+
+ <!-- === Indentation === -->
+ <xsl:param name="title.margin.left">
+ <xsl:choose>
+ <xsl:when test="$fop.extensions != 0">-2pt</xsl:when>
+ <xsl:when test="$passivetex.extensions != 0">0pt</xsl:when>
+ <xsl:otherwise>0pt</xsl:otherwise>
+ </xsl:choose>
+ </xsl:param>
+ <xsl:param name="body.start.indent">
+ <xsl:choose>
+ <xsl:when test="$fop.extensions != 0">0pt</xsl:when>
+ <xsl:when test="$passivetex.extensions != 0">0pt</xsl:when>
+ <xsl:otherwise>2pt</xsl:otherwise>
+ </xsl:choose>
+ </xsl:param>
+
+ <!-- === Images === -->
+ <xsl:param name="graphic.default.extension">.png</xsl:param>
+ <xsl:param name="default.image.width">15.5cm</xsl:param>
+ <xsl:param name="keep.relative.image.uris">1</xsl:param>
+
+ <!-- === Call Outs === -->
+ <xsl:param name="callout.graphics" select="'1'"></xsl:param>
+ <xsl:param name="callout.graphics.extension">.png</xsl:param>
+
+ <!-- === Admons === -->
+ <xsl:param name="admon.graphics.extension">.png</xsl:param>
+
+ <!-- === Index === -->
+ <xsl:param name="generate.index" select="1"></xsl:param>
+ <xsl:param name="make.index.markup" select="0"></xsl:param>
+ <xsl:attribute-set name="index.div.title.properties">
+ <xsl:attribute name="margin-left">0pt</xsl:attribute>
+ <xsl:attribute name="font-size">16pt</xsl:attribute>
+ <xsl:attribute name="font-family"><xsl:value-of select="$title.fontset"></xsl:value-of></xsl:attribute>
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ <xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
+ <xsl:attribute name="space-before.minimum"><xsl:value-of select="concat($body.font.master,'pt * 0.8')"></xsl:value-of></xsl:attribute>
+ <xsl:attribute name="space-before.optimum"><xsl:value-of select="concat($body.font.master,'pt * 1.2')"></xsl:value-of></xsl:attribute>
+ <xsl:attribute name="space-after.minimum"><xsl:value-of select="concat($body.font.master,'pt * 0.6')"></xsl:value-of></xsl:attribute>
+ <xsl:attribute name="space-after.optimum"><xsl:value-of select="concat($body.font.master,'pt * 0.8')"></xsl:value-of></xsl:attribute>
+ <xsl:attribute name="start-indent">0pt</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="index.entry.properties">
+ <xsl:attribute name="start-indent">0pt</xsl:attribute>
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- === Enumeration and autolabel === -->
+ <xsl:param name="section.autolabel" select="1" />
+ <!--
+ 1 Arabic numeration (1, 2, 3 ...).
+ A or upperalpha Uppercase letter numeration (A, B, C ...).
+ a or loweralpha Lowercase letter numeration (a, b, c ...).
+ I or upperroman Uppercase roman numeration (I, II, III ...).
+ i or lowerroman Lowercase roman letter numeration (i, ii, iii ...).
+ -->
+ <xsl:param name="chapter.autolabel" select="1" />
+ <xsl:param name="section.label.includes.component.label" select="1" />
+ <xsl:param name="label.from.part" select="0" />
+ <xsl:param name="component.label.includes.part.label" select="0" />
+ <!-- === Line deviding header and ruler from textbody === -->
+ <xsl:param name="header.rule" select="1" />
+ <xsl:param name="footer.rule" select="1" />
+
+ <!-- === Header === -->
+ <xsl:attribute-set name="header.content.properties">
+ <xsl:attribute name="font-family">
+ <xsl:value-of select="$body.fontset"></xsl:value-of>
+ </xsl:attribute>
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ <xsl:attribute name="font-variant">small-caps</xsl:attribute>
+ <xsl:attribute name="font-size">11pt</xsl:attribute>
+ <xsl:attribute name="margin-left">
+ <xsl:value-of select="$title.margin.left"></xsl:value-of>
+ </xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- === Footer === -->
+ <xsl:attribute-set name="footer.content.properties">
+ <xsl:attribute name="font-family">
+ <xsl:value-of select="$body.fontset"></xsl:value-of>
+ </xsl:attribute>
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
+ <xsl:attribute name="margin-left">
+ <xsl:value-of select="$title.margin.left"></xsl:value-of>
+ </xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- === Glossary === -->
+ <xsl:param name="glossentry.show.acronym" select="'primary'"></xsl:param>
+
+ <!-- === Refentry === -->
+ <xsl:param name="refentry.generate.name" select="0"></xsl:param>
+ <xsl:param name="refentry.generate.title" select="1"></xsl:param>
+ <xsl:param name="refentry.pagebreak" select="1"></xsl:param>
+
+ <!-- === Varlist === -->
+ <xsl:param name="variablelist.max.termlength">20</xsl:param>
+ <xsl:param name="variablelist.as.blocks" select="1"></xsl:param>
+
+ <!-- === Tables === -->
+ <xsl:attribute-set name="table.cell.padding">
+ <xsl:attribute name="padding-left">2pt</xsl:attribute>
+ <xsl:attribute name="padding-right">2pt</xsl:attribute>
+ <xsl:attribute name="padding-top">2pt</xsl:attribute>
+ <xsl:attribute name="padding-bottom">2pt</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="informal.object.properties">
+ <xsl:attribute name="space-before.minimum">0.5em</xsl:attribute>
+ <xsl:attribute name="space-before.optimum">1em</xsl:attribute>
+ <xsl:attribute name="space-before.maximum">2em</xsl:attribute>
+ <xsl:attribute name="space-after.minimum">0.5em</xsl:attribute>
+ <xsl:attribute name="space-after.optimum">1em</xsl:attribute>
+ <xsl:attribute name="space-after.maximum">2em</xsl:attribute>
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="formal.object.properties">
+ <xsl:attribute name="space-before.minimum">0.5em</xsl:attribute>
+ <xsl:attribute name="space-before.optimum">1em</xsl:attribute>
+ <xsl:attribute name="space-before.maximum">2em</xsl:attribute>
+ <xsl:attribute name="space-after.minimum">0.5em</xsl:attribute>
+ <xsl:attribute name="space-after.optimum">1em</xsl:attribute>
+ <xsl:attribute name="space-after.maximum">2em</xsl:attribute>
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- === ULink === -->
+ <xsl:param name="ulink.footnotes" select="0"></xsl:param>
+ <xsl:param name="ulink.show" select="1"></xsl:param>
+
+ <!-- === XREF === -->
+ <xsl:param name="insert.xref.page.number">
+ yes
+ </xsl:param>
+ <!-- Make xrefs and links blue -->
+ <xsl:attribute-set name="xref.properties">
+ <xsl:attribute name="color">
+ <xsl:if test="local-name() = 'link'
+ or local-name() = 'olink'
+ or local-name() = 'ulink'
+ or local-name() = 'xref'">
+ blue
+ </xsl:if>
+ </xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- === Fonts === -->
+ <xsl:param name="body.font.family" select="'sans-serif'" />
+ <xsl:param name="title.font.family" select="'sans-serif'" />
+ <xsl:param name="monospace.font.family" select="'monospace'" />
+ <xsl:param name="body.font.master">11</xsl:param>
+ <xsl:param name="body.font.size">
+ <xsl:value-of select="$body.font.master" />
+ <xsl:text>pt</xsl:text>
+ </xsl:param>
+ <xsl:param name="footnote.font.size">9pt</xsl:param>
+
+ <!-- === Font-Styles === -->
+ <xsl:attribute-set name="color.properties">
+<!-- <xsl:attribute name="color">#990000</xsl:attribute>-->
+ </xsl:attribute-set>
+ <xsl:attribute-set name="admonition.title.properties" use-attribute-sets="color.properties"></xsl:attribute-set>
+ <xsl:attribute-set name="index.div.title.properties" use-attribute-sets="color.properties"></xsl:attribute-set>
+ <xsl:attribute-set name="refentry.title.properties" use-attribute-sets="color.properties"></xsl:attribute-set>
+ <xsl:attribute-set name="formal.title.properties" use-attribute-sets="color.properties"></xsl:attribute-set>
+ <xsl:attribute-set name="sidebar.title.properties" use-attribute-sets="color.properties"></xsl:attribute-set>
+ <xsl:attribute-set name="margin.note.title.properties" use-attribute-sets="color.properties"></xsl:attribute-set>
+ <xsl:attribute-set name="component.title.properties" use-attribute-sets="color.properties"></xsl:attribute-set>
+ <xsl:attribute-set name="article.appendix.title.properties" use-attribute-sets="color.properties"></xsl:attribute-set>
+ <xsl:attribute-set name="abstract.title.properties" use-attribute-sets="color.properties"></xsl:attribute-set>
+ <xsl:attribute-set name="revhistory.title.properties" use-attribute-sets="color.properties"></xsl:attribute-set>
+ <xsl:attribute-set name="section.title.properties" use-attribute-sets="color.properties"></xsl:attribute-set>
+ <xsl:attribute-set name="header.title.properties" use-attribute-sets="color.properties"></xsl:attribute-set>
+ <xsl:attribute-set name="footer.title.properties" use-attribute-sets="color.properties"></xsl:attribute-set>
+ <!-- Component titles -->
+ <xsl:attribute-set name="component.title.properties" use-attribute-sets="color.properties">
+ <xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
+ <xsl:attribute name="font-size">
+ <xsl:value-of select="$body.font.master * 2"></xsl:value-of>
+ <xsl:text>pt</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="space-before.optimum">14pt</xsl:attribute>
+ <xsl:attribute name="space-before.minimum">12pt</xsl:attribute>
+ <xsl:attribute name="space-before.maximum">14pt</xsl:attribute>
+ <xsl:attribute name="space-after.optimum">
+ <xsl:choose>
+ <xsl:when test="parent::book or parent::part or parent::article or parent::chapter">140pt</xsl:when>
+ <xsl:otherwise>24pt</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="space-after.minimum">
+ <xsl:choose>
+ <xsl:when test="parent::book or parent::part or parent::article">80pt</xsl:when>
+ <xsl:otherwise>16pt</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="space-after.maximum">
+ <xsl:choose>
+ <xsl:when test="parent::book or parent::part or parent::article">160pt</xsl:when>
+ <xsl:otherwise>30pt</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="hyphenate">false</xsl:attribute>
+ <xsl:attribute name="text-align">left</xsl:attribute>
+ <xsl:attribute name="start-indent"><xsl:value-of select="$title.margin.left" /></xsl:attribute>
+ <xsl:attribute name="color">#990000</xsl:attribute>
+ </xsl:attribute-set>
+ <!-- section level 1 -->
+ <xsl:attribute-set name="section.title.level1.properties">
+ <xsl:attribute name="font-size">
+ <xsl:value-of select="$body.font.master * 1.454545"></xsl:value-of>
+ <xsl:text>pt</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ <xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
+ <xsl:attribute name="space-before.optimum">16pt</xsl:attribute>
+ <xsl:attribute name="space-before.minimum">12pt</xsl:attribute>
+ <xsl:attribute name="space-before.maximum">20pt</xsl:attribute>
+ <xsl:attribute name="space-after.optimum">12pt</xsl:attribute>
+ <xsl:attribute name="space-after.minimum">8pt</xsl:attribute>
+ <xsl:attribute name="space-after.maximum">16pt</xsl:attribute>
+ </xsl:attribute-set>
+ <!-- section level 2 -->
+ <xsl:attribute-set name="section.title.level2.properties">
+ <xsl:attribute name="font-size">
+ <xsl:value-of select="$body.font.master * 1.272727"></xsl:value-of>
+ <xsl:text>pt</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ <xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
+ <xsl:attribute name="space-before.optimum">14pt</xsl:attribute>
+ <xsl:attribute name="space-before.minimum">8pt</xsl:attribute>
+ <xsl:attribute name="space-before.maximum">20pt</xsl:attribute>
+ <xsl:attribute name="space-after.optimum">6pt</xsl:attribute>
+ <xsl:attribute name="space-after.minimum">4pt</xsl:attribute>
+ <xsl:attribute name="space-after.maximum">6pt</xsl:attribute>
+ </xsl:attribute-set>
+ <!-- section level 3 -->
+ <xsl:attribute-set name="section.title.level3.properties">
+ <xsl:attribute name="font-size">
+ <xsl:value-of select="$body.font.master * 1.090909"></xsl:value-of>
+ <xsl:text>pt</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ <xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
+ <xsl:attribute name="space-before.optimum">12pt</xsl:attribute>
+ <xsl:attribute name="space-before.minimum">8pt</xsl:attribute>
+ <xsl:attribute name="space-before.maximum">16pt</xsl:attribute>
+ <xsl:attribute name="space-after.optimum">6pt</xsl:attribute>
+ <xsl:attribute name="space-after.minimum">4pt</xsl:attribute>
+ <xsl:attribute name="space-after.maximum">6pt</xsl:attribute>
+ </xsl:attribute-set>
+ <!-- section level 4 -->
+ <xsl:attribute-set name="section.title.level4.properties">
+ <xsl:attribute name="font-size">
+ <xsl:value-of select="$body.font.master * 1.02"></xsl:value-of>
+ <xsl:text>pt</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ <xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
+ <xsl:attribute name="space-before.optimum">12pt</xsl:attribute>
+ <xsl:attribute name="space-before.minimum">8pt</xsl:attribute>
+ <xsl:attribute name="space-before.maximum">16pt</xsl:attribute>
+ <xsl:attribute name="space-after.optimum">6pt</xsl:attribute>
+ <xsl:attribute name="space-after.minimum">4pt</xsl:attribute>
+ <xsl:attribute name="space-after.maximum">6pt</xsl:attribute>
+ </xsl:attribute-set>
+ <!-- refentry -->
+ <xsl:attribute-set name="refentry.title.properties">
+ <xsl:attribute name="font-size">
+ <xsl:value-of select="$body.font.master * 1.8"></xsl:value-of>
+ <xsl:text>pt</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ <xsl:attribute name="font-style">italic</xsl:attribute>
+ <xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
+ <xsl:attribute name="hyphenate">false</xsl:attribute>
+ <xsl:attribute name="space-before.optimum">16pt</xsl:attribute>
+ <xsl:attribute name="space-before.minimum">12pt</xsl:attribute>
+ <xsl:attribute name="space-before.maximum">20pt</xsl:attribute>
+ <xsl:attribute name="space-after.optimum">30pt</xsl:attribute>
+ <xsl:attribute name="space-after.minimum">20pt</xsl:attribute>
+ <xsl:attribute name="space-after.maximum">40pt</xsl:attribute>
+ <xsl:attribute name="start-indent"><xsl:value-of select="$title.margin.left" /></xsl:attribute>
+ </xsl:attribute-set>
+ <!-- Verbatim text formatting (programlistings) -->
+ <xsl:attribute-set name="monospace.verbatim.properties">
+ <xsl:attribute name="font-size"><xsl:value-of
+ select="$body.font.master * 0.8333" /><xsl:text>pt</xsl:text></xsl:attribute>
+ <xsl:attribute name="space-before.minimum">1em</xsl:attribute>
+ <xsl:attribute name="space-before.optimum">1em</xsl:attribute>
+ <xsl:attribute name="space-before.maximum">1em</xsl:attribute>
+ <xsl:attribute name="border-color">#444444</xsl:attribute>
+ <xsl:attribute name="border-style">solid</xsl:attribute>
+ <xsl:attribute name="border-width">0.1pt</xsl:attribute>
+ <xsl:attribute name="padding-top">0.5em</xsl:attribute>
+ <xsl:attribute name="padding-left">0.5em</xsl:attribute>
+ <xsl:attribute name="padding-right">0.5em</xsl:attribute>
+ <xsl:attribute name="padding-bottom">0.5em</xsl:attribute>
+ <xsl:attribute name="margin-left">0.5em</xsl:attribute>
+ <xsl:attribute name="margin-right">0.5em</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- Shade (background) programlistings -->
+ <xsl:param name="shade.verbatim">1</xsl:param>
+ <xsl:attribute-set name="shade.verbatim.style">
+ <xsl:attribute name="background-color">#F0F0F0</xsl:attribute>
+ </xsl:attribute-set>
+
+ <xsl:attribute-set name="book.titlepage.recto.address.style">
+ <xsl:attribute name="font-size"><xsl:value-of select="$body.font.master" /><xsl:text>pt</xsl:text></xsl:attribute>
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
+ <xsl:attribute name="font-family"><xsl:value-of select="$body.fontset" /></xsl:attribute>
+ <xsl:attribute name="text-align">right</xsl:attribute>
+ <xsl:attribute name="space-before.minimum">1em</xsl:attribute>
+ <xsl:attribute name="space-before.optimum">1em</xsl:attribute>
+ <xsl:attribute name="space-before.maximum">1em</xsl:attribute>
+ <xsl:attribute name="space-after.minimum">1em</xsl:attribute>
+ <xsl:attribute name="space-after.optimum">1em</xsl:attribute>
+ <xsl:attribute name="space-after.maximum">1em</xsl:attribute>
+ <xsl:attribute name="hyphenate">false</xsl:attribute>
+ <xsl:attribute name="linefeed-treatment">preserve</xsl:attribute>
+ </xsl:attribute-set>
+
+ <xsl:attribute-set name="normal.para.spacing">
+ <xsl:attribute name="text-align">justify</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- Code highlighting -->
+ <xsl:param name="highlight.source" select="1" />
+
+</xsl:stylesheet>
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/html.xsl b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/html.xsl
new file mode 100644
index 0000000..18cf0fb
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/resources/xsl/html.xsl
@@ -0,0 +1,133 @@
+<?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.
+ -->
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.0">
+
+ <!-- import the docbook-stylesheet without chunking -->
+ <xsl:import href="urn:docbkx:stylesheet" />
+
+ <!-- ================ Customization Layer =========== -->
+ <!--
+ customhtml/component.xsl must be imported not included since the
+ template would not get the right priority otherwise.
+ -->
+ <xsl:import href="customhtml/component.xsl" />
+ <xsl:import href="customhtml/sections.xsl" />
+
+ <xsl:include href="customhtml/admon.xsl" />
+ <xsl:include href="customhtml/autoidx.xsl" />
+ <xsl:include href="customhtml/inline.xsl" />
+ <xsl:include href="customhtml/titlepage.xsl" />
+ <xsl:include href="customhtml/highlight.xsl" />
+
+ <!-- ================ Header and Footer data ============== -->
+ <xsl:param name="apache.logo.src" select="concat($img.src.path, 'asf-logo.gif')" />
+ <xsl:param name="apache.logo.alt" select="'Apache Software Foundation'" />
+ <xsl:param name="document.logo.src" select="concat($img.src.path, 'openwebbeans.png')" />
+ <xsl:param name="document.logo.alt" select="'Apache OpenWebBeans'" />
+ <xsl:param name="document.copyright" select="'© 2009 The Apache OpenWebBeans development community'" />
+
+ <!-- =============== Customized I18n ============== -->
+ <xsl:param name="local.l10n.xml" select="document('customcommon/en.xml')" />
+
+ <!-- ================ Fileextension, rootname and path =========== -->
+ <xsl:param name="html.ext" select="'.html'" />
+ <xsl:param name="root.filename" select="'index'" />
+ <xsl:param name="use.id.as.filename" select="'0'" />
+
+ <!-- ================ Chunking-Level ============================= -->
+ <xsl:param name="chunk.section.depth" select="2" />
+ <!--
+ chunk.first.sections: if non-zero, first-sections will appear on their
+ own page
+ -->
+ <xsl:param name="chunk.first.sections" select="1" />
+
+ <!-- ================ CSS Stylesheet ============================= -->
+ <xsl:param name="css.decoration" select="1" />
+
+ <!-- ================ Enumeration of Sections ==================== -->
+ <xsl:param name="section.autolabel" select="1" />
+ <xsl:param name="section.label.includes.component.label" select="1" />
+
+ <!-- ================ ToC ======================================== -->
+ <xsl:param name="toc.max.depth">
+ 1
+ </xsl:param>
+ <xsl:param name="toc.section.depth">
+ 3
+ </xsl:param>
+ <xsl:param name="generate.section.toc.level" select="1" />
+
+ <!-- ================ Glossary =================================== -->
+ <xsl:param name="glossentry.show.acronym" select="'primary'" />
+ <xsl:param name="glossterm.auto.link" select="1" />
+
+ <!-- ================ Index =================================== -->
+ <xsl:param name="generate.index" select="1" />
+ <xsl:param name="index.on.type" select="0" />
+ <xsl:param name="index.on.role" select="0" />
+ <xsl:param name="index.prefer.titleabbrev" select="1" />
+
+ <!-- ================ Images ================================= -->
+ <xsl:param name="draft.mode" select="'no'" />
+ <!-- ignore scaling-options for html-output -->
+ <xsl:param name="ignore.image.scaling" select="1" />
+ <xsl:param name="graphic.default.extension" select="'.png'" />
+ <xsl:param name="draft.watermark.image" select="concat($img.src.path, 'admons/draft.png')" />
+
+ <!-- ================ Admontation ================================ -->
+ <xsl:param name="admon.graphics" select="1" />
+ <xsl:param name="admon.graphics.extension" select="'.png'" />
+ <xsl:param name="admon.graphics.path" select="concat($img.src.path, 'admons/')" />
+ <!--
+ 1 = Admontation are presented with a generated text label such as Note
+ or Warning
+ -->
+ <xsl:param name="admon.textlabel" select="1" />
+ <xsl:param name="admon.style">
+ <xsl:text><!-- no default margins; use css instead --></xsl:text>
+ </xsl:param>
+
+ <!-- ================ Callout =================================== -->
+ <xsl:param name="callout.graphics" select="'1'" />
+ <xsl:param name="callouts.extension" select="'1'" />
+ <xsl:param name="callout.graphics.extension" select="'.png'" />
+ <xsl:param name="callout.graphics.path" select="concat($img.src.path, 'callouts/')" />
+
+ <!-- ================ Refentry =================================== -->
+ <xsl:param name="refentry.generate.name" select="0" />
+ <xsl:param name="refentry.generate.title" select="1" />
+ <xsl:param name="annotate.toc" select="1" />
+
+ <!-- ================ Navigation ================================= -->
+ <xsl:param name="navig.graphics" select="1" />
+ <xsl:param name="navig.graphics.path" select="concat($img.src.path, 'admons/')" />
+ <xsl:param name="navig.graphics.extension" select="'.gif'" />
+ <xsl:param name="navig.showtitles" select="1" />
+ <xsl:param name="header.rule" select="0" />
+ <xsl:param name="footer.rule" select="0" />
+
+ <!-- ================ Tabledesign ================================ -->
+ <xsl:param name="default.table.width" select="'700'" />
+ <xsl:param name="html.cellspacing" select="'0'" />
+ <xsl:param name="html.cellpadding" select="'1'" />
+
+ <!-- Code highlighting -->
+ <xsl:param name="highlight.source" select="1" />
+
+</xsl:stylesheet>
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/userguide.xml b/owb_1.2.x/webbeans-doc/src/docbkx/userguide.xml
new file mode 100644
index 0000000..af47c50
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/userguide.xml
@@ -0,0 +1,114 @@
+<?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.
+ -->
+
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
+
+ <!ENTITY % entities SYSTEM "entities.ent">
+ %entities;
+]>
+
+<book lang="en"><?dbhtml dir="userguide" ?>
+ <bookinfo>
+ <title>User guide</title>
+ <subtitle>ASL-License implementation of the JSR-299</subtitle>
+ <releaseinfo><!-- State of the document -->published</releaseinfo>
+ <edition><!-- Mandatory! Should be equal to the latest revision-number -->&relversion;</edition>
+ <authorgroup>
+ <author>
+ <firstname>Gurkan</firstname>
+ <surname>Erdogdu</surname>
+ <affiliation>
+ <orgname>The Apache Software Foundation</orgname>
+ <orgdiv>Apache OpenWebBeans</orgdiv>
+ </affiliation>
+ </author>
+ </authorgroup>
+ <revhistory>
+ <revision>
+ <revnumber>0.1</revnumber>
+ <date>2009/11/24</date>
+ <authorinitials>gerdogdu</authorinitials>
+ <revremark>Initial release</revremark>
+ </revision>
+ </revhistory>
+ <author><!-- contact person: -->
+ <firstname>Gurkan</firstname><surname>Erdogdu</surname>
+ <email>gerdogdu at apache dot org</email>
+ </author>
+
+ <!-- Abstract -->
+ <xi:include href="common/abstract.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+ <subjectset><!-- keywords -->
+ <subject>
+ <subjectterm>Documentation</subjectterm>
+ </subject>
+ <subject>
+ <subjectterm>Reference</subjectterm>
+ </subject>
+ </subjectset>
+
+ <pubdate>&date;</pubdate>
+ <productname>&productnamecomplete;</productname>
+ <productnumber>&relversion;</productnumber>
+ <address>
+ <!-- postal address, keep line breaks -->
+ © &companyname;
+ <!--
+ &departmentname;
+ &companyaddress1;
+ &companyaddress2;
+ -->
+ </address>
+ <legalnotice>
+ &legalnotice;
+ </legalnotice>
+ <copyright>
+ <year>&year;</year>
+ <holder>&companyname;</holder>
+ </copyright>
+
+ </bookinfo>
+
+ <xi:include href="userguide/preface.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+ <xi:include href="userguide/about.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+ <xi:include href="userguide/chapter1.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+ <xi:include href="userguide/chapter2.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+ <xi:include href="userguide/chapter3.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+ <xi:include href="userguide/chapter4.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+ <xi:include href="common/legalnotes.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+ <xi:include href="userguide/glossary.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+
+ <index id="chapter.index"/>
+
+</book>
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/userguide/about.xml b/owb_1.2.x/webbeans-doc/src/docbkx/userguide/about.xml
new file mode 100644
index 0000000..c8d5984
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/userguide/about.xml
@@ -0,0 +1,151 @@
+<?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.
+ -->
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
+
+ <!ENTITY % entities SYSTEM "../entities.ent" >
+ %entities;
+]>
+
+<chapter>
+ <chapterinfo id="chapter.about">
+ <keywordset>
+ <keyword>About</keyword>
+ </keywordset>
+ <authorinitials>jlmonteiro</authorinitials>
+ </chapterinfo>
+
+ <title>About OpenWebBeans</title>
+
+ <!-- Begin of Index-Span for chapter-wide index entry -->
+ <indexterm class="startofrange" id="idx.chapter.about">
+ <primary>About</primary>
+ </indexterm>
+
+ <epigraph>
+ <para>
+ This chapter explains what is &productname; and team.
+ </para>
+ </epigraph>
+
+ <bridgehead renderas="sect3">Subtitle formatting</bridgehead>
+
+
+ <para>OpenWebBeans is an ASL-License implementation of the JSR-299, Contexts
+ and Dependency Injection for the Java EE platform.</para>
+
+ <para>
+ The specification can be found here:
+ <ulink url="http://www.jcp.org/en/jsr/detail?id=299">http://www.jcp.org/en/jsr/detail?id=299</ulink>
+ .
+ </para>
+
+ <indexterm class="endofrange" startref="idx.chapter.about"></indexterm>
+
+ <section>
+ <title>The team</title>
+
+ <para>The following team members have been developing the OpenWebBeans.</para>
+
+ <table>
+ <title>Team composition.</title>
+ <tgroup cols="4" align="left" colsep="1" rowsep="1">
+ <colspec colname="id" colwidth="1*" align="left" />
+ <colspec colname="name" colwidth="2*" align="left" />
+ <colspec colname="email" colwidth="2*" align="left" />
+ <colspec colname="roles" colwidth="1*" align="left" />
+
+ <thead>
+ <row>
+ <!-- no way to change bg color without PI -->
+ <?dbhtml bgcolor="#E0E0E0" ?>
+ <?dbfo bgcolor="#E0E0E0" ?>
+
+ <entry>Id</entry>
+ <entry>Name</entry>
+ <entry>Email</entry>
+ <entry>Roles</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><code>gerdogdu</code></entry>
+ <entry>Gurkan Erdogdu</entry>
+ <entry><code>gerdogdu at apache dot org</code></entry>
+ <entry>PMC Chair</entry>
+ </row>
+ <row>
+ <entry><code>kevan</code></entry>
+ <entry>Kevan Miller</entry>
+ <entry><code>kevan dot miller at gmail dot com</code></entry>
+ <entry>PMC</entry>
+ </row>
+ <row>
+ <entry><code>struberg</code></entry>
+ <entry>Mark Struberg</entry>
+ <entry><code>struberg at yahoo dot de</code></entry>
+ <entry>PMC</entry>
+ </row>
+ <row>
+ <entry><code>dblevins</code></entry>
+ <entry>David Blevins</entry>
+ <entry><code>david dot blevins at visi dot com</code></entry>
+ <entry>PMC</entry>
+ </row>
+ <row>
+ <entry><code>bergmark</code></entry>
+ <entry>Joe Bergmark</entry>
+ <entry><code>bergmark at gmail dot com</code></entry>
+ <entry>PMC</entry>
+ </row>
+ <row>
+ <entry><code>covener</code></entry>
+ <entry>Eric Covener</entry>
+ <entry><code>covener at gmail dot com</code></entry>
+ <entry>PMC</entry>
+ </row>
+ <row>
+ <entry><code>matzew</code></entry>
+ <entry>Matthias Wessendorf</entry>
+ <entry><code>matzew at apache dot org</code></entry>
+ <entry>Committer</entry>
+ </row>
+ <row>
+ <entry><code>gpetracek</code></entry>
+ <entry>Gerhard Petracek</entry>
+ <entry><code>gpetracek at apache dot org</code></entry>
+ <entry>PMC</entry>
+ </row>
+ <row>
+ <entry><code>kelapure</code></entry>
+ <entry>Rohit Kelapure</entry>
+ <entry><code>kelapure at apache dot org</code></entry>
+ <entry>Committer</entry>
+ </row>
+ <row>
+ <entry><code>rederpj</code></entry>
+ <entry>Paul J. Reder</entry>
+ <entry><code>rederpj at apache dot org</code></entry>
+ <entry>Committer</entry>
+ </row>
+ </tbody>
+ </tgroup>
+
+ </table>
+
+ </section>
+
+</chapter>
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/userguide/chapter1.xml b/owb_1.2.x/webbeans-doc/src/docbkx/userguide/chapter1.xml
new file mode 100644
index 0000000..2254026
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/userguide/chapter1.xml
@@ -0,0 +1,274 @@
+<?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.
+ -->
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
+
+ <!ENTITY % entities SYSTEM "../entities.ent" >
+ %entities;
+]>
+
+<chapter>
+
+ <chapterinfo id="chapter.intro">
+ <keywordset>
+ <keyword>Introduction</keyword>
+ </keywordset>
+ <authorinitials>jlmonteiro</authorinitials>
+ </chapterinfo>
+ <title>Introduction</title>
+
+ <!-- What is OpenWebBeans -->
+ <section id="whatisopenwebbeans">
+ <title>What is OpenWebBeans?</title>
+ <para>
+ OpenWebBeans is an ASL-licensed implementation of the JSR-299: Contexts and Dependency Injection and JSR-330: Dependency Injection for Java.
+ </para>
+ <section id="features">
+ <title>OpenWebBeans Features</title>
+ <warning><para>Currently OpenWebBeans does not fully implements JSR-299 specification but it is JSR-299 compatible.</para></warning>
+ <para>Currently OpenWebBeans implementation supports the following main features. </para>
+ <itemizedlist spacing="compact">
+ <listitem>
+ <para><emphasis>JSR-330 Support:</emphasis> It supports the JSR-330 based injections.</para>
+ </listitem>
+ <listitem>
+ <para><emphasis>Managed Beans Support:</emphasis> Supports the configuration and injection of Managed Beans</para>
+ </listitem>
+ <listitem>
+ <para><emphasis>Session Beans Support in Embeddable OpenEJB in Tomcat 6.x:</emphasis> It supports Session Beans using in embeddable Apache OpenEJB.</para>
+ </listitem>
+ <listitem>
+ <para><emphasis>Producer Field and Method Support:</emphasis> It supports producer based beans.</para>
+ </listitem>
+ <listitem>
+ <para><emphasis>Injection of @Resource, @PersistenceUnit and @PersistenceContext:</emphasis> Currently it is able to inject these resource types.</para>
+ </listitem>
+ <listitem>
+ <para><emphasis>Java Messaging Service (JMS) Injection Support:</emphasis> It supports injection of JMS Connection Factory, JMS Sessions etc.</para>
+ </listitem>
+ <listitem>
+ <para><emphasis>Event/Observer Support:</emphasis> It supports Event and Observers.</para>
+ </listitem>
+ <listitem>
+ <para><emphasis>Interceptor and Decrotator Support for Managed Beans:</emphasis> It supports interceptors and decorators for managed beans. Currently
+ it does not support @InterceptorBinding style interceptors and decorators on Session beans.</para>
+ </listitem>
+ <listitem>
+ <para><emphasis>Java SE Support:</emphasis> It can be used in Java SE environments like Java Swing applications.</para>
+ </listitem>
+ <listitem>
+ <para><emphasis>Java EE Web Application Support:</emphasis> It can be used in Java EE Web containers like Tomcat, Jetty etc.</para>
+ </listitem>
+ </itemizedlist>
+ </section>
+
+ <section id="modules">
+ <title>OpenWebBeans Plugin Architecture</title>
+ <para>OpenWebBeans have been developing as a small core package and including other pieces as a plugin. Each of the package and plugin
+ modules are followings:</para>
+ <itemizedlist spacing="compact">
+ <listitem>
+ <para>
+ <emphasis>JSR-330 API Package:</emphasis> Contains JSR-330 defined API. It will move into the Geronimo specifications in a near time.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>JSR-299 API Package:</emphasis> Contains JSR-299 defined API. It will move into the Geronimo specifications in a near time.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>OpenWebBeans Implementation(Core) Package:</emphasis> Contains core dependency injection related implementation.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>EJB Plugin:</emphasis> Session Beans injection implementation based on the Apache OpenEJB embeddable in Apache Tomcat
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>OpenWebBeans Geronimo Plugin:</emphasis> Geronimo Java EE Server integration codes.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>OpenWebBeans JMS Plugin:</emphasis> Provides Java Messaging Service (JMS) related artifact injections.(Connection factories, Sessions etc.)
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>OpenWebBeans Resource Plugin:</emphasis> Provides Java EE resource injections. Currently, it supports only for @PersistenceUnit, @PersistenceContext and @Resource annotations.
+ To use @Resource based annotations without OpenEJB, you have to define it explicitly in web.xml via <resource-ref> element.
+ </para>
+ <para>
+ Example:
+ <programlisting language="java"><![CDATA[public class Injector{
+ @Produces @Resource(name="myResource") myResource;
+}]]></programlisting>
+ <programlisting language="xml"><![CDATA[<resource-ref>
+ <resource-name>myResource</resource-name>
+ .....
+</resource-ref>]]></programlisting>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>OpenWebBeans JSF Plugin:</emphasis> Using of dependency injection service in Java Server Faces environment.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>OpenWebBeans JPA Plugin:</emphasis> It is deprecated now. Use OpenWebBeans Resource plugin instead.
+ </para>
+ </listitem>
+ </itemizedlist>
+
+ <section>
+ <title>How to use Plugins?</title>
+ <para>
+ Plugins are discovered by the OpenWebBeans runtime using <code>java.util.ServiceLoader</code> class. Each plugin jar
+ contains META-INF/services folder that contains plugin implementation class. Your sole responsbility to use plugin is to add
+ related <emphasis>Plugin JAR</emphasis> into the application classpath.
+ </para>
+ </section>
+
+ <!-- Section OpenWebBeans SPI -->
+ <section>
+ <title>OpenWebBeans SPI</title>
+ <para>OpenWebBeans interacts with Java EE specific services via SPI interfaces and their specific implementations.
+ There are several SPI interfaces that are configured in the OpenWebBeans default configuration file. You can
+ override and replace those SPI implementation with providing your new implementation. For example, OpenWebBeans SPI
+ <code>org.apache.webbeans.spi.JNDIService</code> interface defines methods to interact with runtime JNDI provider.
+ There are two different JNDIService implementation, one for example</para>
+
+ <programlisting><![CDATA[org.apache.webbeans.spi.JNDIService=org.apache.webbeans.spi.se.JNDIServiceStaticImpl
+org.apache.webbeans.spi.JNDIService=org.apache.webbeans.spi.ee.JNDIServiceEnterpriseImpl]]></programlisting>
+
+ <para>First one is used in Java SE environment as a simple name-value <code>Map</code> implementation whereas
+ the second one contains full blown container provided JNDI context implementation. You would look
+ at <emphasis>OpenWebBeans Configuration</emphasis> section for getting all SPI interfaces and their explanations.</para>
+
+ </section><!-- End of section OpenWebBeans SPI -->
+
+ <!-- Start of configuration section -->
+ <section>
+ <title>OpenWebBeans Configuration</title>
+ <para>OpenWebBeans has some configuration properties. Most of the configuration parameters are included within
+ core jar file. But if you wish to update or replace existing configuration, please continue to reading</para>
+
+ <section>
+ <title>How Configuration Works?</title>
+ <para>OpenWebBeans' configuration is defined with Java properties file. The name of the default properties
+ file is <code>"/META-INF/openwebbeans/openwebbeans-default.properties"</code> and it is included within
+ <code>openwebbeans-impl.jar</code>
+ file.
+ </para>
+
+ <para>
+ If you wish to override or replace the configuration parameters, create a properties file with name
+ <code>"/META-INF/openwebbeans/openwebbeans.properties"</code> and put it into your application classpath. In your
+ properties file, you can override the default configuration parameter values.
+ </para>
+
+ </section>
+
+
+
+ <section>
+ <title>Configuration Parameters</title>
+ <para>OpenWebBeans defines a several comfuration parameters. Those are listed below:</para>
+ <itemizedlist>
+ <listitem>
+ <para><emphasis>org.apache.webbeans.spi.JNDIService:</emphasis> JNDI service SPI interface. Configures JNDI Service implementation for getting
+ objects from JNDI tree.</para>
+ </listitem>
+
+ <listitem>
+ <para><emphasis>org.apache.webbeans.spi.JNDIService.jmsConnectionFactoryJndi:</emphasis> Configures JMS ConnectionFactory object jndi name.</para>
+ </listitem>
+
+ <listitem>
+ <para><emphasis>org.apache.webbeans.conversation.Conversation.periodicDelay:</emphasis> Conversation removing thread periodic delay. Unused
+ conversations are removed by the container periodically.</para>
+ </listitem>
+
+ <listitem>
+ <para><emphasis>org.apache.webbeans.spi.TransactionService:</emphasis> Transaction service SPI interface. Configures Transaction Service provider
+ implementation for getting transaction manager and transaction.</para>
+ </listitem>
+
+ <listitem>
+ <para><emphasis>org.apache.webbeans.resource.spi.ResourceService:</emphasis> Resource service SPI interface. Defines how to inject Java EE based resources
+ like @PersistenceContext, @PersistenceUnit, @WebServiceRef and @Resource.</para>
+ </listitem>
+
+ <listitem>
+ <para><emphasis>org.apache.webbeans.spi.deployer.MetaDataDiscoveryService:</emphasis> Discovery service SPI interfaces. Configures Discovery Service
+ implementation for discovering JSR-299 beans and configuration xmls.</para>
+ </listitem>
+
+ <listitem>
+ <para><emphasis>org.apache.webbeans.spi.deployer.UseEjbMetaDataDiscoveryService:</emphasis> Defines whether or not use EJB session bean discovery. If
+ application is run in the OpenEJB embeddable container, one must define this as true.</para>
+ </listitem>
+
+ <listitem>
+ <para><emphasis>org.apache.webbeans.fieldInjection.useOwbSpecificInjection:</emphasis> Use @Inject annotation at injection fields or not. If it is set to true
+ you can inject objects into beans without @Inject annotation. Not portable!</para>
+ </listitem>
+
+ <listitem>
+ <para><emphasis>org.apache.webbeans.spi.conversation.ConversationService:</emphasis> Conversation Service SPI. Configures Conversation Service
+ implementation for getting conversation related informations. Currently conversation service is implemented for Java Server Faces
+ based applications.</para>
+ </listitem>
+
+ <listitem>
+ <para><emphasis>org.apache.webbeans.application.jsp:</emphasis> Defines configuration parameter to specify that application is full Java
+ Server Pages(JSP) application. If application is JSP, OpenWebBeans register ELResolver with JSP application.</para>
+ </listitem>
+
+ <listitem>
+ <para><emphasis>org.apache.webbeans.spi.lifecycle.Lifecycle:</emphasis> Bootstrap service SPI interface. Defines how OpenWebBeans container is bootstrapped.</para>
+ </listitem>
+
+ </itemizedlist>
+ </section>
+
+ <section>
+ <title>Default Configuration Values</title>
+ <para>OpenWebBeans comes with default configuration parameters are set. As explained above, those default parameter values
+ are defined in the provided jar file of the OpenWebBean. Default parameter values are the following</para>
+
+ <itemizedlist>
+ <listitem>
+ <programlisting><![CDATA[org.apache.webbeans.spi.JNDIService=org.apache.webbeans.spi.se.JNDIServiceStaticImpl]]></programlisting>
+ </listitem>
+
+ </itemizedlist>
+
+ </section>
+
+ </section> <!-- End of Configuration Section -->
+
+ </section>
+
+</section>
+<!-- End of SECTION What is OpenWebBeans -->
+
+</chapter>
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/userguide/chapter2.xml b/owb_1.2.x/webbeans-doc/src/docbkx/userguide/chapter2.xml
new file mode 100644
index 0000000..1ce34e2
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/userguide/chapter2.xml
@@ -0,0 +1,52 @@
+<?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.
+ -->
+
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
+
+ <!ENTITY % entities SYSTEM "../entities.ent">
+ %entities;
+]>
+<chapter id="chapter2">
+ <title>Using OpenWebBeans within Java EE Web</title>
+
+ <!-- What is OpenWebBeans -->
+ <section>
+ <title>OpenWebBeans in 5 Minute</title>
+ <para>
+ In this part of the user guide, we will look at how to configure and use OpenWebBeans in a <emphasis>Java EE
+ Web</emphasis> projects.
+ </para>
+
+ <section>
+ <title>Simple JSP Application</title>
+ <para>TODO</para>
+ </section>
+
+ <section>
+ <title>Using with JSF</title>
+ <para>TODO</para>
+ </section>
+
+ <section>
+ <title>Using with JPA</title>
+ <para>TODO</para>
+ </section>
+
+</section>
+<!-- End of SECTION What is OpenWebBeans -->
+
+</chapter>
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/userguide/chapter3.xml b/owb_1.2.x/webbeans-doc/src/docbkx/userguide/chapter3.xml
new file mode 100644
index 0000000..0edd882
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/userguide/chapter3.xml
@@ -0,0 +1,35 @@
+<?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.
+ -->
+
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
+
+ <!ENTITY % entities SYSTEM "../entities.ent">
+ %entities;
+]>
+<chapter id="chapter3">
+ <title>Using OpenWebBeans within OpenEJB</title>
+
+ <section>
+ <title>OpenWebBeans within OpenEJB</title>
+ <para>
+ TODO
+ </para>
+
+</section>
+<!-- End of SECTION What is OpenWebBeans -->
+
+</chapter>
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/userguide/chapter4.xml b/owb_1.2.x/webbeans-doc/src/docbkx/userguide/chapter4.xml
new file mode 100644
index 0000000..38b057d
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/userguide/chapter4.xml
@@ -0,0 +1,36 @@
+<?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.
+ -->
+
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
+
+ <!ENTITY % entities SYSTEM "../entities.ent">
+ %entities;
+]>
+<chapter id="chapter4">
+ <title>Using OpenWebBeans within Java SE</title>
+
+ <!-- What is OpenWebBeans -->
+ <section>
+ <title>OpenWebBeans in Java SE Environment</title>
+ <para>
+ TODO
+ </para>
+
+</section>
+<!-- End of SECTION What is OpenWebBeans -->
+
+</chapter>
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/userguide/glossary.xml b/owb_1.2.x/webbeans-doc/src/docbkx/userguide/glossary.xml
new file mode 100644
index 0000000..ac4c27c
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/userguide/glossary.xml
@@ -0,0 +1,70 @@
+<?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.
+ -->
+<!DOCTYPE glossary PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
+
+ <!ENTITY % entities SYSTEM "../entities.ent" >
+ %entities;
+]>
+
+<glossary id="chapter.glossary">
+ <title>Glossary</title>
+ <para>This is the glossary of the &productname;</para>
+
+ <!-- ********************************************************************* -->
+ <!-- E -->
+ <!-- ********************************************************************* -->
+ <glossdiv id="glossary.e">
+ <title>E</title>
+ <glossentry id="glossary.ejb">
+ <glossterm>Enterprise JavaBeans</glossterm>
+ <glossdef>
+ <para>
+ Enterprise JavaBeans™ (EJB) is a managed, server-side component
+ architecture for modular construction of enterprise applications.
+ </para>
+ </glossdef>
+ </glossentry>
+ </glossdiv>
+
+ <!-- ********************************************************************* -->
+ <!-- O -->
+ <!-- ********************************************************************* -->
+ <glossdiv id="glossary.o">
+ <title>O</title>
+ <glossentry id="glossary.OpenEJB">
+ <glossterm>Apache OpenEJB</glossterm>
+ <glossdef>
+ <para>
+ OpenEJB is an open source, embeddable and lightweight EJB Container
+ System and EJB Server, released under the Apache 2.0 License. OpenEJB
+ has been integrated with J2EE application servers such as Geronimo[1],
+ and WebObjects[2].
+
+ The role of OpenEJB is to create a runtime environment to run EJBs and let
+ others access them in a unified way. Regardless of which application
+ wants to access the beans, they all do it the same way, by accessing
+ the appropriate Java Naming and Directory Interface (JNDI) context and
+ looking up a home object. Think about JNDI as a catalog of names with
+ objects bound to them. JNDI Initial Context is the starting point when
+ working with the catalog--looking up a name or accessing the object
+ bound to it. OpenEJB can run in two modes: Local (AKA IntraVM) Server
+ and Remote Server.
+ </para>
+ </glossdef>
+ </glossentry>
+ </glossdiv>
+</glossary>
diff --git a/owb_1.2.x/webbeans-doc/src/docbkx/userguide/preface.xml b/owb_1.2.x/webbeans-doc/src/docbkx/userguide/preface.xml
new file mode 100644
index 0000000..e9543cd
--- /dev/null
+++ b/owb_1.2.x/webbeans-doc/src/docbkx/userguide/preface.xml
@@ -0,0 +1,141 @@
+<?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.
+ -->
+<!DOCTYPE preface PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
+
+ <!ENTITY % entities SYSTEM "../entities.ent" >
+ %entities;
+]>
+
+<preface>
+ <title>Preface</title>
+ <para>
+ In this guide we merged all kind of information needed to
+ configure parts of the
+ &productnamecomplete;
+ (from now on simply called
+ &productname;
+ throughout the rest of this document). A comprehensive index has
+ been provided which should help you to quickly find the
+ information you are looking for. We have also included a
+ glossary that contains explanations of terms that are mentioned
+ throughout this guide.
+ </para>
+ <para>
+ We hope that this user guide helps you to increase your
+ knowledge and understanding of
+ &productname;. We are sure that it will make development of applications
+ based on
+ &productname;
+ a lot easier for you. Feedback is always welcome.
+ </para>
+
+ <bridgehead renderas="sect2">Conventions used in this document</bridgehead>
+ <bridgehead renderas="sect3">Typography</bridgehead>
+ <para>
+ the following typographical conventions are used in this
+ document:
+ </para>
+ <variablelist>
+ <varlistentry>
+ <term>
+ <database>database</database>
+ </term>
+ <listitem>
+ <para>
+ used for database elements (tables, fields, keys,
+ views,...)
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <classname>class</classname>
+ ,
+ <interfacename>interface</interfacename>
+ ,
+ <methodname>method</methodname>
+ </term>
+ <listitem>
+ <para>
+ used for (Java) classes, interfaces and methods
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <sgmltag class="emptytag">tag</sgmltag>
+ ,
+ <sgmltag class="attribute">attribute</sgmltag>
+ ,
+ <sgmltag class="attvalue">value</sgmltag>
+ </term>
+ <listitem>
+ <para>
+ used for XML elements (tags, attributes and values)
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <property>
+ property
+ <replaceable>N</replaceable>
+ </property>
+ ,
+ <parameter>
+ parameter
+ <replaceable>N</replaceable>
+ </parameter>
+ </term>
+ <listitem>
+ <para>
+ used for property- and parameternames. The '
+ <replaceable>N</replaceable>
+ ' (or other literal) is a variable part of the name,
+ which usually stands for a running number.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <literal>value</literal>
+ </term>
+ <listitem>
+ <para>
+ used for defined values. This can be a default value
+ an example or the value of a constant.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <code>bean name="myBean"</code>
+ </term>
+ <listitem>
+ <para>used for inline sourcecode examples</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ <para>
+ <programlisting language="xml"><![CDATA[<bean name="beanName" class="fqn.of.the.bean">
+ <property name="beanPropertyName" ref="with its value"/>
+</bean>]]></programlisting>
+ used for longer source code examples
+ </para>
+ <note><para>Indicates a tip, suggestion or general note</para></note>
+ <warning><para>Indicates a warning</para></warning>
+</preface>
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-ee-common/pom.xml b/owb_1.2.x/webbeans-ee-common/pom.xml
new file mode 100644
index 0000000..22862d0
--- /dev/null
+++ b/owb_1.2.x/webbeans-ee-common/pom.xml
@@ -0,0 +1,64 @@
+<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">
+<!--
+
+ 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.
+-->
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>1.2.5</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>openwebbeans-ee-common</artifactId>
+ <name>EE Common plugin</name>
+ <description>Apache OpenWebBeans Java EE Common</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/owb_1.2.x/webbeans-ee-common/src/main/java/org/apache/webbeans/ee/common/beans/PrincipalBean.java b/owb_1.2.x/webbeans-ee-common/src/main/java/org/apache/webbeans/ee/common/beans/PrincipalBean.java
new file mode 100644
index 0000000..76d0bc4
--- /dev/null
+++ b/owb_1.2.x/webbeans-ee-common/src/main/java/org/apache/webbeans/ee/common/beans/PrincipalBean.java
@@ -0,0 +1,47 @@
+/*
+ * 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.webbeans.ee.common.beans;
+
+import java.security.Principal;
+
+import org.apache.webbeans.component.BuiltInOwbBean;
+import org.apache.webbeans.component.SimpleProducerFactory;
+import org.apache.webbeans.component.WebBeansType;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.portable.ProviderBasedProducer;
+
+//used by BeansDeployer (created via reflection)
+public class PrincipalBean extends BuiltInOwbBean<Principal>
+{
+
+ public PrincipalBean(WebBeansContext webBeansContext)
+ {
+ super(webBeansContext,
+ WebBeansType.PRINCIPAL,
+ Principal.class,
+ new SimpleProducerFactory<Principal>(new ProviderBasedProducer<Principal>(webBeansContext, Principal.class, new PrincipalProvider(webBeansContext), true)));
+ }
+
+ @Override
+ public boolean isPassivationCapable()
+ {
+ return true;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-ee-common/src/main/java/org/apache/webbeans/ee/common/beans/PrincipalProvider.java b/owb_1.2.x/webbeans-ee-common/src/main/java/org/apache/webbeans/ee/common/beans/PrincipalProvider.java
new file mode 100644
index 0000000..c69a1e7
--- /dev/null
+++ b/owb_1.2.x/webbeans-ee-common/src/main/java/org/apache/webbeans/ee/common/beans/PrincipalProvider.java
@@ -0,0 +1,63 @@
+/*
+ * 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.webbeans.ee.common.beans;
+
+import java.io.ObjectStreamException;
+import java.io.Serializable;
+import java.security.Principal;
+
+import javax.inject.Provider;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.spi.SecurityService;
+
+public class PrincipalProvider implements Provider<Principal>, Serializable
+{
+
+ private transient WebBeansContext webBeansContext;
+
+ public PrincipalProvider(WebBeansContext webBeansContext)
+ {
+ this.webBeansContext = webBeansContext;
+ }
+
+ @Override
+ public Principal get()
+ {
+ if (webBeansContext == null)
+ {
+ webBeansContext = WebBeansContext.currentInstance();
+ }
+
+ SecurityService securityService = webBeansContext.getService(SecurityService.class);
+ if(securityService == null)
+ {
+ return null;
+ }
+ else
+ {
+ return securityService.getCurrentPrincipal();
+ }
+ }
+
+ Object readResolve() throws ObjectStreamException
+ {
+ return get();
+ }
+}
diff --git a/owb_1.2.x/webbeans-ee-common/src/main/java/org/apache/webbeans/ee/common/services/JNDIServiceEnterpriseImpl.java b/owb_1.2.x/webbeans-ee-common/src/main/java/org/apache/webbeans/ee/common/services/JNDIServiceEnterpriseImpl.java
new file mode 100644
index 0000000..fa0cfb5
--- /dev/null
+++ b/owb_1.2.x/webbeans-ee-common/src/main/java/org/apache/webbeans/ee/common/services/JNDIServiceEnterpriseImpl.java
@@ -0,0 +1,70 @@
+/*
+ * 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.webbeans.ee.common.services;
+
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.spi.JNDIService;
+import org.apache.webbeans.util.JNDIUtil;
+
+/**
+ * SPI Implementation of the JNDIService.
+ * This version performs JNDI handling in J2EE environments where
+ * the java:comp and java:app context can be written
+ *
+ * @see org.apache.webbeans.corespi.se.DefaultJndiService
+ */
+public final class JNDIServiceEnterpriseImpl implements JNDIService
+{
+ public JNDIServiceEnterpriseImpl()
+ {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void bind(String name, Object object) throws WebBeansException
+ {
+ JNDIUtil.bind(name, object);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void unbind(String name) throws WebBeansException
+ {
+ JNDIUtil.unbind(name);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public <T> T getObject(String name, Class<? extends T> expectedClass) throws WebBeansException
+ {
+ return JNDIUtil.lookup(name, expectedClass);
+ }
+
+ @Override
+ public <T> T lookup(String name, Class<? extends T> expectedClass)
+ {
+ return getObject(name, expectedClass);
+ }
+}
diff --git a/owb_1.2.x/webbeans-ee-common/src/main/resources/META-INF/openwebbeans/openwebbeans.properties b/owb_1.2.x/webbeans-ee-common/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
new file mode 100644
index 0000000..9c618bc
--- /dev/null
+++ b/owb_1.2.x/webbeans-ee-common/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
@@ -0,0 +1,35 @@
+#Licensed to the Apache Software Foundation (ASF) under one
+#or more contributor license agreements. See the NOTICE file
+#distributed with this work for additional information
+#regarding copyright ownership. The ASF licenses this file
+#to you under the Apache License, Version 2.0 (the
+#"License"); you may not use this file except in compliance
+#with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+#Unless required by applicable law or agreed to in writing,
+#software distributed under the License is distributed on an
+#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#KIND, either express or implied. See the License for the
+#specific language governing permissions and limitations
+#under the License.
+#---------------------------------------------------------------
+# The default configuration for OpenWebBeans
+#
+# The default configuration is intended for a JDK and a simple ServletContainer
+# like jetty, resin or tomcat.
+#
+#---------------------------------------------------------------
+
+################################################################################################
+################################ COMMON EE SPI CONFIGURATION SECTION ##########################
+################################################################################################
+
+configuration.ordinal=15
+
+
+################################### Default JNDI Service #######################################
+#Default implementation of org.apache.webbeans.corespi.JNDIService.
+org.apache.webbeans.spi.JNDIService=org.apache.webbeans.ee.common.services.JNDIServiceEnterpriseImpl
+################################################################################################
diff --git a/owb_1.2.x/webbeans-ee-common/src/site/site.xml b/owb_1.2.x/webbeans-ee-common/src/site/site.xml
new file mode 100644
index 0000000..ebd855d
--- /dev/null
+++ b/owb_1.2.x/webbeans-ee-common/src/site/site.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<project name="OpenWebBeans">
+ <bannerLeft>
+ <name>Apache OpenWebBeans</name>
+ <src>http://openwebbeans.apache.org/owb/images/logos/openwebbeans_hor.png</src>
+ <href>http://openwebbeans.apache.org</href>
+ </bannerLeft>
+
+ <bannerRight>
+ <name>Apache Banner</name>
+ <src>http://www.apache.org/images/asf-logo.gif</src>
+ <href>http://www.apache.org</href>
+ </bannerRight>
+
+ <publishDate format="dd MMM yyyy" />
+ <version position="left"/>
+
+ <body>
+ <breadcrumbs>
+ <item name="Apache" href="http://www.apache.org"/>
+ <item name="OpenWebBeans" href="http://openwebbeans.apache.org"/>
+ <item name="OWB-EE common" href="http://openwebbeans.apache.org/${project.version}/openwebbeans-ee-common"/>
+ </breadcrumbs>
+
+ <menu ref="reports"/>
+ </body>
+</project>
+
diff --git a/owb_1.2.x/webbeans-ee/pom.xml b/owb_1.2.x/webbeans-ee/pom.xml
new file mode 100644
index 0000000..85e538a
--- /dev/null
+++ b/owb_1.2.x/webbeans-ee/pom.xml
@@ -0,0 +1,97 @@
+<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">
+<!--
+
+ 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.
+-->
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>1.2.5</version>
+ </parent>
+
+ <artifactId>openwebbeans-ee</artifactId>
+ <name>Java EE plugin</name>
+ <description>Apache OpenWebBeans Java EE Utility</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-el_2.2_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_2.5_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jta_1.1_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-validation_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-ee-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/owb_1.2.x/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/UserTransactionBean.java b/owb_1.2.x/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/UserTransactionBean.java
new file mode 100644
index 0000000..6be30bd
--- /dev/null
+++ b/owb_1.2.x/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/UserTransactionBean.java
@@ -0,0 +1,47 @@
+/*
+ * 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.webbeans.ee.beans;
+
+import javax.transaction.UserTransaction;
+
+import org.apache.webbeans.component.BuiltInOwbBean;
+import org.apache.webbeans.component.SimpleProducerFactory;
+import org.apache.webbeans.component.WebBeansType;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.portable.ProviderBasedProducer;
+
+//used by BeansDeployer (created via reflection)
+public class UserTransactionBean extends BuiltInOwbBean<UserTransaction>
+{
+
+ public UserTransactionBean(WebBeansContext webBeansContext)
+ {
+ super(webBeansContext,
+ WebBeansType.USERTRANSACTION,
+ UserTransaction.class,
+ new SimpleProducerFactory<UserTransaction>(
+ new ProviderBasedProducer<UserTransaction>(webBeansContext, UserTransaction.class, new UserTransactionProvider(webBeansContext), true)));
+ }
+
+ @Override
+ public boolean isPassivationCapable()
+ {
+ return true;
+ }
+}
diff --git a/owb_1.2.x/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/UserTransactionProvider.java b/owb_1.2.x/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/UserTransactionProvider.java
new file mode 100644
index 0000000..f629438
--- /dev/null
+++ b/owb_1.2.x/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/UserTransactionProvider.java
@@ -0,0 +1,60 @@
+/*
+ * 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.webbeans.ee.beans;
+
+import javax.inject.Provider;
+import javax.transaction.UserTransaction;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.spi.TransactionService;
+
+import java.io.ObjectStreamException;
+import java.io.Serializable;
+
+public class UserTransactionProvider implements Provider<UserTransaction>, Serializable
+{
+
+ private transient WebBeansContext webBeansContext;
+
+ public UserTransactionProvider(WebBeansContext webBeansContext)
+ {
+ this.webBeansContext = webBeansContext;
+ }
+
+ @Override
+ public UserTransaction get()
+ {
+ if (webBeansContext == null)
+ {
+ webBeansContext = WebBeansContext.currentInstance();
+ }
+
+ TransactionService transactionService = webBeansContext.getService(TransactionService.class);
+ if(transactionService != null)
+ {
+ return transactionService.getUserTransaction();
+ }
+ return null;
+ }
+
+ Object readResolve() throws ObjectStreamException
+ {
+ return get();
+ }
+}
diff --git a/owb_1.2.x/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/ValidatorBean.java b/owb_1.2.x/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/ValidatorBean.java
new file mode 100644
index 0000000..3105159
--- /dev/null
+++ b/owb_1.2.x/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/ValidatorBean.java
@@ -0,0 +1,47 @@
+/*
+ * 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.webbeans.ee.beans;
+
+import javax.validation.Validator;
+
+import org.apache.webbeans.component.BuiltInOwbBean;
+import org.apache.webbeans.component.SimpleProducerFactory;
+import org.apache.webbeans.component.WebBeansType;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.portable.ProviderBasedProducer;
+
+//used by BeansDeployer (created via reflection)
+public class ValidatorBean extends BuiltInOwbBean<Validator>
+{
+
+ public ValidatorBean(WebBeansContext webBeansContext)
+ {
+ super(webBeansContext,
+ WebBeansType.VALIDATION,
+ Validator.class,
+ new SimpleProducerFactory<Validator>(new ProviderBasedProducer<Validator>(webBeansContext, Validator.class, new ValidatorProvider(webBeansContext), true)));
+ }
+
+ @Override
+ public boolean isPassivationCapable()
+ {
+ return true;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/ValidatorFactoryBean.java b/owb_1.2.x/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/ValidatorFactoryBean.java
new file mode 100644
index 0000000..5143fbd
--- /dev/null
+++ b/owb_1.2.x/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/ValidatorFactoryBean.java
@@ -0,0 +1,47 @@
+/*
+ * 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.webbeans.ee.beans;
+
+import javax.validation.ValidatorFactory;
+
+import org.apache.webbeans.component.BuiltInOwbBean;
+import org.apache.webbeans.component.SimpleProducerFactory;
+import org.apache.webbeans.component.WebBeansType;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.portable.ProviderBasedProducer;
+
+//used by BeansDeployer (created via reflection)
+public class ValidatorFactoryBean extends BuiltInOwbBean<ValidatorFactory>
+{
+
+ public ValidatorFactoryBean(WebBeansContext webBeansContext)
+ {
+ super(webBeansContext,
+ WebBeansType.VALIDATIONFACT,
+ ValidatorFactory.class,
+ new SimpleProducerFactory<ValidatorFactory>(
+ new ProviderBasedProducer<ValidatorFactory>(webBeansContext, ValidatorFactory.class, new ValidatorFactoryProvider(webBeansContext), true)));
+ }
+
+ @Override
+ public boolean isPassivationCapable()
+ {
+ return true;
+ }
+}
diff --git a/owb_1.2.x/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/ValidatorFactoryProvider.java b/owb_1.2.x/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/ValidatorFactoryProvider.java
new file mode 100644
index 0000000..0bbf750
--- /dev/null
+++ b/owb_1.2.x/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/ValidatorFactoryProvider.java
@@ -0,0 +1,60 @@
+/*
+ * 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.webbeans.ee.beans;
+
+import javax.inject.Provider;
+import javax.validation.ValidatorFactory;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.spi.ValidatorService;
+
+import java.io.ObjectStreamException;
+import java.io.Serializable;
+
+public class ValidatorFactoryProvider implements Provider<ValidatorFactory>, Serializable
+{
+
+ private transient WebBeansContext webBeansContext;
+
+ public ValidatorFactoryProvider(WebBeansContext webBeansContext)
+ {
+ this.webBeansContext = webBeansContext;
+ }
+
+ @Override
+ public ValidatorFactory get()
+ {
+ if (webBeansContext == null)
+ {
+ webBeansContext = WebBeansContext.currentInstance();
+ }
+
+ ValidatorService validatorService = webBeansContext.getService(ValidatorService.class);
+ if(validatorService != null)
+ {
+ return validatorService.getDefaultValidatorFactory();
+ }
+ return null;
+ }
+
+ Object readResolve() throws ObjectStreamException
+ {
+ return get();
+ }
+}
diff --git a/owb_1.2.x/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/ValidatorProvider.java b/owb_1.2.x/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/ValidatorProvider.java
new file mode 100644
index 0000000..e0e76ac
--- /dev/null
+++ b/owb_1.2.x/webbeans-ee/src/main/java/org/apache/webbeans/ee/beans/ValidatorProvider.java
@@ -0,0 +1,60 @@
+/*
+ * 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.webbeans.ee.beans;
+
+import javax.inject.Provider;
+import javax.validation.Validator;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.spi.ValidatorService;
+
+import java.io.ObjectStreamException;
+import java.io.Serializable;
+
+public class ValidatorProvider implements Provider<Validator>, Serializable
+{
+
+ private transient WebBeansContext webBeansContext;
+
+ public ValidatorProvider(WebBeansContext webBeansContext)
+ {
+ this.webBeansContext = webBeansContext;
+ }
+
+ @Override
+ public Validator get()
+ {
+ if (webBeansContext == null)
+ {
+ webBeansContext = WebBeansContext.currentInstance();
+ }
+
+ ValidatorService validatorService = webBeansContext.getService(ValidatorService.class);
+ if(validatorService != null)
+ {
+ return validatorService.getDefaultValidator();
+ }
+ return null;
+ }
+
+ Object readResolve() throws ObjectStreamException
+ {
+ return get();
+ }
+}
diff --git a/owb_1.2.x/webbeans-ee/src/main/java/org/apache/webbeans/ee/event/TransactionalEventNotifier.java b/owb_1.2.x/webbeans-ee/src/main/java/org/apache/webbeans/ee/event/TransactionalEventNotifier.java
new file mode 100644
index 0000000..bbc9a32
--- /dev/null
+++ b/owb_1.2.x/webbeans-ee/src/main/java/org/apache/webbeans/ee/event/TransactionalEventNotifier.java
@@ -0,0 +1,193 @@
+/*
+ * 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.webbeans.ee.event;
+
+import javax.enterprise.event.TransactionPhase;
+import javax.enterprise.inject.spi.ObserverMethod;
+import javax.transaction.Status;
+import javax.transaction.Synchronization;
+import javax.transaction.Transaction;
+
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.event.EventMetadata;
+import org.apache.webbeans.event.OwbObserverMethod;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.spi.TransactionService;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+@SuppressWarnings("unchecked")
+public class TransactionalEventNotifier
+{
+ private static final Logger logger = WebBeansLoggerFacade.getLogger(TransactionalEventNotifier.class);
+
+ private TransactionalEventNotifier()
+ {
+ // utility class ct
+ }
+
+ /**
+ * This will get called by the EJB integration code
+ */
+ public static void registerTransactionSynchronization(TransactionPhase phase, ObserverMethod<? super Object> observer, Object event, EventMetadata metadata) throws Exception
+ {
+ TransactionService transactionService = WebBeansContext.currentInstance().getService(TransactionService.class);
+
+ Transaction transaction = null;
+ if(transactionService != null)
+ {
+ transaction = transactionService.getTransaction();
+ }
+
+ if(transaction != null)
+ {
+ if (phase.equals(TransactionPhase.AFTER_COMPLETION))
+ {
+ transaction.registerSynchronization(new AfterCompletion(observer, event, metadata));
+ }
+ else if (phase.equals(TransactionPhase.AFTER_SUCCESS))
+ {
+ transaction.registerSynchronization(new AfterCompletionSuccess(observer, event, metadata));
+ }
+ else if (phase.equals(TransactionPhase.AFTER_FAILURE))
+ {
+ transaction.registerSynchronization(new AfterCompletionFailure(observer, event, metadata));
+ }
+ else if (phase.equals(TransactionPhase.BEFORE_COMPLETION))
+ {
+ transaction.registerSynchronization(new BeforeCompletion(observer, event, metadata));
+ }
+ else
+ {
+ throw new IllegalStateException(WebBeansLoggerFacade.getTokenString(OWBLogConst.EXCEPT_0007) + phase);
+ }
+ }
+ }
+
+ private static class AbstractSynchronization<T> implements Synchronization
+ {
+
+ private final ObserverMethod<T> observer;
+ private final T event;
+ private final EventMetadata metadata;
+
+ public AbstractSynchronization(ObserverMethod<T> observer, T event, EventMetadata metadata)
+ {
+ this.observer = observer;
+ this.event = event;
+ this.metadata = metadata;
+ }
+
+ @Override
+ public void beforeCompletion()
+ {
+ // Do nothing
+ }
+
+ @Override
+ public void afterCompletion(int i)
+ {
+ //Do nothing
+ }
+
+ public void notifyObserver()
+ {
+ try
+ {
+ if (observer instanceof OwbObserverMethod)
+ {
+ ((OwbObserverMethod<T>)observer).notify(event, metadata);
+ }
+ else
+ {
+ observer.notify(event);
+ }
+ }
+ catch (Exception e)
+ {
+ logger.log(Level.SEVERE, OWBLogConst.ERROR_0003, e);
+ }
+ }
+ }
+
+ private final static class BeforeCompletion extends AbstractSynchronization
+ {
+ private BeforeCompletion(ObserverMethod observer, Object event, EventMetadata metadata)
+ {
+ super(observer, event, metadata);
+ }
+
+ @Override
+ public void beforeCompletion()
+ {
+ notifyObserver();
+ }
+ }
+
+ private final static class AfterCompletion extends AbstractSynchronization
+ {
+ private AfterCompletion(ObserverMethod observer, Object event, EventMetadata metadata)
+ {
+ super(observer, event, metadata);
+ }
+
+ @Override
+ public void afterCompletion(int i)
+ {
+ notifyObserver();
+ }
+ }
+
+ private final static class AfterCompletionSuccess extends AbstractSynchronization
+ {
+ private AfterCompletionSuccess(ObserverMethod observer, Object event, EventMetadata metadata)
+ {
+ super(observer, event, metadata);
+ }
+
+ @Override
+ public void afterCompletion(int i)
+ {
+ if (i == Status.STATUS_COMMITTED)
+ {
+ notifyObserver();
+ }
+ }
+ }
+
+ private final static class AfterCompletionFailure extends AbstractSynchronization
+ {
+ private AfterCompletionFailure(ObserverMethod observer, Object event, EventMetadata metadata)
+ {
+ super(observer, event, metadata);
+ }
+
+ @Override
+ public void afterCompletion(int i)
+ {
+ if (i != Status.STATUS_COMMITTED)
+ {
+ notifyObserver();
+ }
+ }
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-ee/src/site/site.xml b/owb_1.2.x/webbeans-ee/src/site/site.xml
new file mode 100644
index 0000000..a709f84
--- /dev/null
+++ b/owb_1.2.x/webbeans-ee/src/site/site.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<project name="OpenWebBeans">
+ <bannerLeft>
+ <name>Apache OpenWebBeans</name>
+ <src>http://openwebbeans.apache.org/owb/images/logos/openwebbeans_hor.png</src>
+ <href>http://openwebbeans.apache.org</href>
+ </bannerLeft>
+
+ <bannerRight>
+ <name>Apache Banner</name>
+ <src>http://www.apache.org/images/asf-logo.gif</src>
+ <href>http://www.apache.org</href>
+ </bannerRight>
+
+ <publishDate format="dd MMM yyyy" />
+ <version position="left"/>
+
+ <body>
+ <breadcrumbs>
+ <item name="Apache" href="http://www.apache.org"/>
+ <item name="OpenWebBeans" href="http://openwebbeans.apache.org"/>
+ <item name="OWB-EE" href="http://openwebbeans.apache.org/${project.version}/openwebbeans-ee"/>
+ </breadcrumbs>
+ <menu ref="reports"/>
+ </body>
+</project>
+
diff --git a/owb_1.2.x/webbeans-ejb/pom.xml b/owb_1.2.x/webbeans-ejb/pom.xml
new file mode 100644
index 0000000..05e70a3
--- /dev/null
+++ b/owb_1.2.x/webbeans-ejb/pom.xml
@@ -0,0 +1,72 @@
+<?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.
+ -->
+
+<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>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>1.2.5</version>
+ </parent>
+ <artifactId>openwebbeans-ejb</artifactId>
+ <name>EJB plugin</name>
+ <description>Apache OpenWebBeans Java EE EJB plugin</description>
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-ejb_3.1_spec</artifactId>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/owb_1.2.x/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/component/BaseEjbBean.java b/owb_1.2.x/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/component/BaseEjbBean.java
new file mode 100644
index 0000000..8d8b944
--- /dev/null
+++ b/owb_1.2.x/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/component/BaseEjbBean.java
@@ -0,0 +1,195 @@
+/*
+ * 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.webbeans.ejb.common.component;
+
+import org.apache.webbeans.component.BeanAttributesImpl;
+import org.apache.webbeans.component.EnterpriseBeanMarker;
+import org.apache.webbeans.component.InjectionTargetBean;
+import org.apache.webbeans.component.WebBeansType;
+import org.apache.webbeans.component.spi.BeanAttributes;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.InjectionTargetFactoryImpl;
+import org.apache.webbeans.util.ClassUtil;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.SessionBeanType;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Level;
+
+/**
+ * Defines bean contract for the session beans.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class BaseEjbBean<T> extends InjectionTargetBean<T> implements EnterpriseBeanMarker
+{
+ public static final Object[] OBJECT_EMPTY = new Object[0];
+
+ /**Session bean type*/
+ protected final SessionBeanType ejbType;
+
+ /** Map of proxy instances to the dependent SFSB they've acquired but not yet removed */
+ private Map<Object, Object> dependentSFSBToBeRemoved = new ConcurrentHashMap<Object, Object>();
+
+ /**
+ * Creates a new instance of the session bean.
+ * @param webBeansContext
+ */
+ protected BaseEjbBean(WebBeansContext webBeansContext,
+ SessionBeanType type,
+ AnnotatedType<T> annotatedType,
+ BeanAttributes<T> beanAttributes,
+ Class<T> beanClass,
+ InjectionTargetFactoryImpl<T> factory)
+ {
+ super(webBeansContext, WebBeansType.ENTERPRISE, annotatedType, beanAttributes, beanClass, factory);
+ //type of the ejb
+ this.ejbType = type;
+ }
+
+ protected BaseEjbBean(WebBeansContext webBeansContext,
+ SessionBeanType type,
+ AnnotatedType<T> annotatedType,
+ BeanAttributesImpl<T> beanAttributes,
+ Class<T> beanClass)
+ {
+ super(webBeansContext, WebBeansType.ENTERPRISE, annotatedType, beanAttributes, beanClass);
+ //type of the ejb
+ this.ejbType = type;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.webbeans.component.AbstractBean#isPassivationCapable()
+ */
+ @Override
+ public boolean isPassivationCapable()
+ {
+ if(getEjbType().equals(SessionBeanType.STATEFUL))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Called when we must ask the container to remove a specific
+ * @param proxyInstance The contextual reference
+ * @param ejbInstance The underlying EJB instance to be removed
+ */
+ protected void destroyStatefulSessionBeanInstance(T proxyInstance, Object ejbInstance)
+ {
+ Method removeMeth = null;
+ for (Method m : getRemoveMethods())
+ {
+ // TODO FIXME: This needs to call an API from the EJB
+ // container to remove the EJB instance directly,
+ // not via a remove method. For now, just call 1
+ // remove method directly on the EJB
+ try
+ {
+ removeMeth = proxyInstance.getClass().getMethod(m.getName(), m.getParameterTypes());
+ ClassUtil.callInstanceMethod(removeMeth, proxyInstance, OBJECT_EMPTY);
+ }
+ catch (NoSuchMethodException e)
+ {
+ getLogger().log(Level.SEVERE, "Error calling Stateful Session Bean remove method: ", e);
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ /**
+ * Subclasses can override this.
+ * @return remove methods
+ */
+ public List<Method> getRemoveMethods()
+ {
+ return null;
+ }
+
+ /**
+ * Subclasses must override this to return local interfaces.
+ * @return local business interfaces.
+ */
+ public List<Class<?>> getBusinessLocalInterfaces()
+ {
+ return null;
+ }
+
+ /**
+ * Subclasses must override this to return ejb name
+ * @return ejb name
+ */
+ public String getEjbName()
+ {
+ return null;
+ }
+
+ /**
+ * Gets ejb session type.
+ * @return type of the ejb
+ */
+ public SessionBeanType getEjbType()
+ {
+ return this.ejbType;
+ }
+
+ /**
+ * Keep track of which proxies have gotten EJB objects out of a context
+ * @param dependentSFSB The dependent SFSB acquired from the EJB container
+ * @param proxy The OWB proxy instance whose method handler acquired the dependnet SFSB
+ */
+ public void addDependentSFSB(Object dependentSFSB, Object proxy)
+ {
+ dependentSFSBToBeRemoved.put(proxy, dependentSFSB);
+ }
+
+ /**
+ * Call after observing an @Remove method on an EJB instance
+ * @param proxy the proxy instance the dependent SFSB is associated with
+ */
+ public void removeDependentSFSB(Object proxy)
+ {
+ dependentSFSBToBeRemoved.remove(proxy);
+ }
+
+ /**
+ *
+ * @param proxy an instance of our own proxy
+ * @return the underlying EJB instance associated with the proxy
+ */
+ public Object getDependentSFSBForProxy(Object proxy)
+ {
+ return dependentSFSBToBeRemoved.get(proxy);
+ }
+
+ /**
+ *
+ * @return true if the bean supports a no-interface (bean-class) local view but
+ * the container does not return it in the list of business local interfaces.
+ */
+ public boolean needsBeanLocalViewAddedToTypes()
+ {
+ return false;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/component/EjbBeanBuilder.java b/owb_1.2.x/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/component/EjbBeanBuilder.java
new file mode 100644
index 0000000..765a45a
--- /dev/null
+++ b/owb_1.2.x/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/component/EjbBeanBuilder.java
@@ -0,0 +1,93 @@
+/*
+ * 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.webbeans.ejb.common.component;
+
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.InjectionTarget;
+
+import org.apache.webbeans.component.BeanAttributesImpl;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.ejb.common.util.EjbValidator;
+import org.apache.webbeans.portable.AbstractEjbInjectionTarget;
+import org.apache.webbeans.util.Asserts;
+
+/**
+ * EjbBeanCreatorImpl.
+ *
+ * @version $Rev$ $Date$
+ *
+ * @param <T> ejb class type
+ */
+public abstract class EjbBeanBuilder<T, E extends BaseEjbBean<T>>
+{
+ protected final WebBeansContext webBeansContext;
+ protected final AnnotatedType<T> annotatedType;
+ protected final BeanAttributesImpl<T> beanAttributes;
+
+ public EjbBeanBuilder(WebBeansContext webBeansContext, AnnotatedType<T> annotatedType, BeanAttributesImpl<T> beanAttributes)
+ {
+ Asserts.assertNotNull(webBeansContext, "webBeansContext may not be null");
+ Asserts.assertNotNull(annotatedType, "annotated type may not be null");
+ Asserts.assertNotNull(beanAttributes, "beanAttributes may not be null");
+ this.webBeansContext = webBeansContext;
+ this.annotatedType = annotatedType;
+ this.beanAttributes = beanAttributes;
+ }
+
+ protected InjectionTarget<T> buildInjectionTarget(AnnotatedType<T> annotatedType,
+ Set<InjectionPoint> points,
+ WebBeansContext webBeansContext,
+ List<AnnotatedMethod<?>> postConstructMethods,
+ List<AnnotatedMethod<?>> preDestroyMethods)
+
+ {
+ return new AbstractEjbInjectionTarget<T>(annotatedType, points, webBeansContext)
+ {
+ @Override
+ public T produce(CreationalContext<T> creationalContext)
+ {
+ return getInstance(creationalContext);
+ }
+ };
+ }
+
+ protected final E createBean(Class<T> beanClass)
+ {
+ return createBean(beanClass, webBeansContext.getWebBeansUtil().isBeanEnabled(annotatedType, beanAttributes.getStereotypes()));
+ }
+
+ protected abstract E createBean(Class<T> beanClass, boolean beanEnabled);
+
+ public E getBean()
+ {
+ E bean = createBean(annotatedType.getJavaClass());
+ EjbValidator.validateDecoratorOrInterceptor(bean.getReturnType());
+ EjbValidator.validateEjbScopeType(bean);
+ EjbValidator.validateGenericBeanType(bean.getReturnType(), bean.getScope());
+ return bean;
+ }
+
+ protected abstract T getInstance(CreationalContext<T> creationalContext);
+}
diff --git a/owb_1.2.x/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbConstants.java b/owb_1.2.x/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbConstants.java
new file mode 100644
index 0000000..338ab39
--- /dev/null
+++ b/owb_1.2.x/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbConstants.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.ejb.common.util;
+
+/**
+ * @version $Rev: 889852 $ $Date: 2009-12-12 01:11:53 +0200 (Sat, 12 Dec 2009) $
+ */
+public final class EjbConstants
+{
+ private EjbConstants()
+ {
+
+ }
+
+ public static final String EJB_WEBBEANS_ERROR_PREFIX ="Ejb WebBeans Component ";
+
+ public static final String EJB_WEBBEANS_ERROR_CLASS_PREFIX = EJB_WEBBEANS_ERROR_PREFIX + "with implementation class : ";
+}
diff --git a/owb_1.2.x/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbValidator.java b/owb_1.2.x/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbValidator.java
new file mode 100644
index 0000000..705649f
--- /dev/null
+++ b/owb_1.2.x/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbValidator.java
@@ -0,0 +1,176 @@
+/*
+ * 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.webbeans.ejb.common.util;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.decorator.Decorator;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.ObserverMethod;
+import javax.enterprise.inject.spi.SessionBeanType;
+import javax.interceptor.Interceptor;
+
+import org.apache.webbeans.ejb.common.component.BaseEjbBean;
+import org.apache.webbeans.event.ObserverMethodImpl;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.portable.AnnotatedElementFactory;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.Asserts;
+import org.apache.webbeans.util.ClassUtil;
+
+/**
+ * Validates session beans.
+ *
+ * @version $Rev: 915746 $ $Date: 2010-02-24 12:43:43 +0200 (Wed, 24 Feb 2010) $
+ */
+public final class EjbValidator
+{
+ // No-instaniate
+ private EjbValidator()
+ {
+ // Empty
+ }
+
+ /**
+ * Validates session bean's scope.
+ *
+ * @param ejbBean ejb bean
+ */
+ public static void validateEjbScopeType(BaseEjbBean<?> ejbBean)
+ {
+ Asserts.assertNotNull(ejbBean, "Session Bean can not be null");
+
+ if (ejbBean.getScope() == null)
+ {
+ throw new NullPointerException("Session Bean scope can not be null");
+ }
+
+ if (ejbBean.getEjbType() == null)
+ {
+ throw new NullPointerException("Session Bean type can not be null. It must be one of @Stateless, @Stateful, @Singleton");
+ }
+
+ if (ejbBean.getEjbType().equals(SessionBeanType.STATELESS))
+ {
+ if (!ejbBean.getScope().equals(Dependent.class))
+ {
+ throw new WebBeansConfigurationException("Stateless Session Bean class : " + ejbBean.getReturnType() + " " + "can not define scope other than @Dependent");
+ }
+ }
+ else if (ejbBean.getEjbType().equals(SessionBeanType.SINGLETON))
+ {
+ if (!ejbBean.getScope().equals(Dependent.class) && !ejbBean.getScope().equals(ApplicationScoped.class))
+ {
+ throw new WebBeansConfigurationException("Singleton Session Bean class : " + ejbBean.getReturnType() + " "
+ + "can not define scope other than @Dependent or @ApplicationScoped");
+ }
+ }
+ }
+
+ /**
+ * Validates session bean decorator/interceptor conditions.
+ *
+ * @param ejbClass ejb bean class
+ */
+ public static void validateDecoratorOrInterceptor(Class<?> ejbClass)
+ {
+ Asserts.assertNotNull(ejbClass, "ejbClass parameter can not be null");
+
+ if (AnnotationUtil.hasClassAnnotation(ejbClass, Decorator.class))
+ {
+ throw new WebBeansConfigurationException(EjbConstants.EJB_WEBBEANS_ERROR_CLASS_PREFIX + ejbClass.getName() + " can not annotated with @Decorator");
+
+ }
+
+ if (AnnotationUtil.hasClassAnnotation(ejbClass, Interceptor.class))
+ {
+ throw new WebBeansConfigurationException(EjbConstants.EJB_WEBBEANS_ERROR_CLASS_PREFIX + ejbClass.getName() + " can not annotated with @Interceptor");
+ }
+ }
+
+ /**
+ * Check generic type conditions.
+ * @param ejbClass ebj class
+ * @param scopeType scope type
+ */
+ public static void validateGenericBeanType(Class<?> ejbClass, Class<? extends Annotation> scopeType)
+ {
+ Asserts.assertNotNull(ejbClass, "ejbClass parameter can not be null");
+ Asserts.assertNotNull(ejbClass, "scopeType parameter can not be null");
+
+ if(ClassUtil.isDefinitionContainsTypeVariables(ejbClass))
+ {
+ if(!scopeType.equals(Dependent.class))
+ {
+ throw new WebBeansConfigurationException("Ejb generic bean class : " + ejbClass.getName() + "scope must be @Dependent");
+ }
+ }
+ }
+
+ public static <T> void validateObserverMethods(BaseEjbBean<?> bean, Set<ObserverMethod<T>> observers)
+ {
+ for(ObserverMethod<T> observer : observers)
+ {
+ ObserverMethodImpl<T> obs = (ObserverMethodImpl<T>)observer;
+ AnnotatedMethod<T> method = obs.getObserverMethod();
+ List<?> locals = bean.getBusinessLocalInterfaces();
+ if(locals != null)
+ {
+ Iterator<?> it = locals.iterator();
+ boolean found = false;
+ while(it.hasNext())
+ {
+ Class<?> clazz = (Class<?>)it.next();
+ Method classMethod = bean.getWebBeansContext().getSecurityService().
+ doPrivilegedGetDeclaredMethod(clazz, method.getJavaMember().getName(), method.getJavaMember().getParameterTypes());
+ if(classMethod == null)
+ {
+ continue;
+ }
+ else
+ {
+ //Should only be a single method that matches the names & params
+ AnnotatedElementFactory annotatedElementFactory = bean.getWebBeansContext().getAnnotatedElementFactory();
+ AnnotatedType<T> declaringType = (AnnotatedType<T>) annotatedElementFactory.newAnnotatedType(classMethod.getDeclaringClass());
+ obs.setObserverMethod(annotatedElementFactory.newAnnotatedMethod(classMethod, declaringType));
+ found = true;
+ break;
+ }
+ }
+
+ if(!found)
+ {
+ if(!method.isStatic())
+ {
+ throw new WebBeansConfigurationException("Observer method : " + method.getJavaMember().getName() + " in session bean class : " +
+ bean.getBeanClass() + " must be business method");
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/plugin/OpenWebBeansEjbLCAPluginImpl.java b/owb_1.2.x/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/plugin/OpenWebBeansEjbLCAPluginImpl.java
new file mode 100644
index 0000000..5f40f47
--- /dev/null
+++ b/owb_1.2.x/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/plugin/OpenWebBeansEjbLCAPluginImpl.java
@@ -0,0 +1,60 @@
+/*
+ * 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.webbeans.ejb.plugin;
+
+import java.lang.annotation.Annotation;
+
+import javax.ejb.PrePassivate;
+import javax.ejb.PostActivate;
+import javax.interceptor.AroundTimeout;
+
+import org.apache.webbeans.plugins.OpenWebBeansEjbLCAPlugin;
+import org.apache.webbeans.spi.plugins.AbstractOwbPlugin;
+
+/**
+ * EJB Plugin for EJB related components.
+ * @version $Rev$ $Date$
+ */
+public class OpenWebBeansEjbLCAPluginImpl extends AbstractOwbPlugin implements OpenWebBeansEjbLCAPlugin
+{
+ public OpenWebBeansEjbLCAPluginImpl()
+ {
+ super();
+ }
+
+ @Override
+ public Class<? extends Annotation> getPrePassivateClass()
+ {
+ return PrePassivate.class;
+ }
+
+ @Override
+ public Class<? extends Annotation> getPostActivateClass()
+ {
+ return PostActivate.class;
+ }
+
+ @Override
+ public Class<? extends Annotation> getAroundTimeoutClass()
+ {
+ return AroundTimeout.class;
+ }
+
+}
+
diff --git a/owb_1.2.x/webbeans-ejb/src/site/site.xml b/owb_1.2.x/webbeans-ejb/src/site/site.xml
new file mode 100644
index 0000000..1510dde
--- /dev/null
+++ b/owb_1.2.x/webbeans-ejb/src/site/site.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<project name="OpenWebBeans">
+ <bannerLeft>
+ <name>Apache OpenWebBeans</name>
+ <src>http://openwebbeans.apache.org/owb/images/logos/openwebbeans_hor.png</src>
+ <href>http://openwebbeans.apache.org</href>
+ </bannerLeft>
+
+ <bannerRight>
+ <name>Apache Banner</name>
+ <src>http://www.apache.org/images/asf-logo.gif</src>
+ <href>http://www.apache.org</href>
+ </bannerRight>
+
+ <publishDate format="dd MMM yyyy" />
+ <version position="left"/>
+
+ <body>
+ <breadcrumbs>
+ <item name="Apache" href="http://www.apache.org"/>
+ <item name="OpenWebBeans" href="http://openwebbeans.apache.org"/>
+ <item name="OWB-EJB" href="http://openwebbeans.apache.org/${project.version}/openwebbeans-ejb"/>
+ </breadcrumbs>
+
+ <menu ref="reports"/>
+ </body>
+</project>
+
diff --git a/owb_1.2.x/webbeans-el10/pom.xml b/owb_1.2.x/webbeans-el10/pom.xml
new file mode 100644
index 0000000..903529b
--- /dev/null
+++ b/owb_1.2.x/webbeans-el10/pom.xml
@@ -0,0 +1,71 @@
+<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">
+<!--
+
+ 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.
+-->
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>1.2.5</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>openwebbeans-el10</artifactId>
+ <name>EL 1.0 plugin</name>
+ <description>Apache OpenWebBeans EL 1.0 integration</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-el_1.0_spec</artifactId>
+ <version>1.0.2</version>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/owb_1.2.x/webbeans-el10/src/main/java/org/apache/webbeans/el10/EL10Adaptor.java b/owb_1.2.x/webbeans-el10/src/main/java/org/apache/webbeans/el10/EL10Adaptor.java
new file mode 100644
index 0000000..0586ad4
--- /dev/null
+++ b/owb_1.2.x/webbeans-el10/src/main/java/org/apache/webbeans/el10/EL10Adaptor.java
@@ -0,0 +1,41 @@
+/*
+ * 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.webbeans.el10;
+
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+
+import org.apache.webbeans.spi.adaptor.ELAdaptor;
+
+public class EL10Adaptor implements ELAdaptor
+{
+
+ @Override
+ public ELResolver getOwbELResolver()
+ {
+ return new EL10Resolver();
+ }
+
+ @Override
+ public ExpressionFactory getOwbWrappedExpressionFactory(ExpressionFactory expressionFactory)
+ {
+ return new EL10WrappedExpressionFactory(expressionFactory);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-el10/src/main/java/org/apache/webbeans/el10/EL10Resolver.java b/owb_1.2.x/webbeans-el10/src/main/java/org/apache/webbeans/el10/EL10Resolver.java
new file mode 100644
index 0000000..6d138cc
--- /dev/null
+++ b/owb_1.2.x/webbeans-el10/src/main/java/org/apache/webbeans/el10/EL10Resolver.java
@@ -0,0 +1,166 @@
+/*
+ * 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.webbeans.el10;
+
+import java.beans.FeatureDescriptor;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.ELResolver;
+import javax.el.PropertyNotFoundException;
+import javax.el.PropertyNotWritableException;
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.el.ELContextStore;
+
+public class EL10Resolver extends ELResolver
+{
+ private WebBeansContext webBeansContext;
+
+ public EL10Resolver()
+ {
+ webBeansContext = WebBeansContext.getInstance();
+ }
+
+ @Override
+ public Class<?> getCommonPropertyType(ELContext arg0, Object arg1)
+ {
+
+ return null;
+ }
+
+ @Override
+ public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext arg0, Object arg1)
+ {
+
+ return null;
+ }
+
+ @Override
+ public Class<?> getType(ELContext arg0, Object arg1, Object arg2) throws NullPointerException, PropertyNotFoundException, ELException
+ {
+
+ return null;
+ }
+
+ @Override
+ @SuppressWarnings({"unchecked","deprecation"})
+ public Object getValue(ELContext context, Object base, Object property) throws NullPointerException, PropertyNotFoundException, ELException
+ {
+ BeanManagerImpl beanManager = webBeansContext.getBeanManagerImpl();
+ //we only check root beans
+ // Check if the OWB actually got used in this application
+ if (base != null || !beanManager.isInUse())
+ {
+ return null;
+ }
+
+ //Name of the bean
+ String beanName = (String) property;
+ //Local store, create if not exist
+ ELContextStore elContextStore = ELContextStore.getInstance(true);
+
+ Object contextualInstance = elContextStore.findBeanByName(beanName);
+
+ if(contextualInstance != null)
+ {
+ context.setPropertyResolved(true);
+
+ return contextualInstance;
+ }
+
+ //Get beans
+ Set<Bean<?>> beans = beanManager.getBeans(beanName);
+
+ //Found?
+ if(beans != null && !beans.isEmpty())
+ {
+ //Managed bean
+ Bean<Object> bean = (Bean<Object>)beans.iterator().next();
+
+ if(bean.getScope().equals(Dependent.class))
+ {
+ contextualInstance = getDependentContextualInstance(beanManager, elContextStore, context, bean);
+ }
+ else
+ {
+ // now we check for NormalScoped beans
+ contextualInstance = getNormalScopedContextualInstance(beanManager, elContextStore, context, bean, beanName);
+ }
+ }
+ return contextualInstance;
+ }
+
+ private Object getNormalScopedContextualInstance(BeanManagerImpl manager, ELContextStore store, ELContext context, Bean<Object> bean, String beanName)
+ {
+ CreationalContext<Object> creationalContext = manager.createCreationalContext(bean);
+ Object contextualInstance = manager.getReference(bean, Object.class, creationalContext);
+
+ if (contextualInstance != null)
+ {
+ context.setPropertyResolved(true);
+ //Adding into store
+ store.addNormalScoped(beanName, contextualInstance);
+ }
+
+ return contextualInstance;
+ }
+
+
+ private Object getDependentContextualInstance(BeanManagerImpl manager, ELContextStore store, ELContext context, Bean<Object> bean)
+ {
+ Object contextualInstance = store.getDependent(bean);
+ if(contextualInstance != null)
+ {
+ //Object found on the store
+ context.setPropertyResolved(true);
+ }
+ else
+ {
+ // If no contextualInstance found on the store
+ CreationalContext<Object> creationalContext = manager.createCreationalContext(bean);
+ contextualInstance = manager.getReference(bean, Object.class, creationalContext);
+ if (contextualInstance != null)
+ {
+ context.setPropertyResolved(true);
+ //Adding into store
+ store.addDependent(bean, contextualInstance, creationalContext);
+ }
+ }
+ return contextualInstance;
+ }
+
+ @Override
+ public boolean isReadOnly(ELContext arg0, Object arg1, Object arg2) throws NullPointerException, PropertyNotFoundException, ELException
+ {
+ return false;
+ }
+
+ @Override
+ public void setValue(ELContext arg0, Object arg1, Object arg2, Object arg3) throws NullPointerException, PropertyNotFoundException, PropertyNotWritableException, ELException
+ {
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-el10/src/main/java/org/apache/webbeans/el10/EL10ValueExpression.java b/owb_1.2.x/webbeans-el10/src/main/java/org/apache/webbeans/el10/EL10ValueExpression.java
new file mode 100644
index 0000000..d20c6ba
--- /dev/null
+++ b/owb_1.2.x/webbeans-el10/src/main/java/org/apache/webbeans/el10/EL10ValueExpression.java
@@ -0,0 +1,112 @@
+/*
+ * 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.webbeans.el10;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.PropertyNotFoundException;
+import javax.el.PropertyNotWritableException;
+import javax.el.ValueExpression;
+
+import org.apache.webbeans.el.ELContextStore;
+
+public class EL10ValueExpression extends ValueExpression
+{
+ private static final long serialVersionUID = 1L;
+
+ private ValueExpression valueExpression;
+
+ public EL10ValueExpression(ValueExpression valueExpression)
+ {
+ this.valueExpression = valueExpression;
+ }
+
+
+ @Override
+ public Class<?> getExpectedType()
+ {
+ return this.valueExpression.getExpectedType();
+ }
+
+ @Override
+ public Class<?> getType(ELContext arg0) throws NullPointerException, PropertyNotFoundException, ELException
+ {
+ return this.valueExpression.getType(arg0);
+ }
+
+ @Override
+ public Object getValue(ELContext context) throws NullPointerException, PropertyNotFoundException, ELException
+ {
+ Object value = null;
+ try
+ {
+ value = this.valueExpression.getValue(context);
+
+ }
+ finally
+ {
+ //Destroy dependent store
+ ELContextStore store = ELContextStore.getInstance(false);
+ if(store != null)
+ {
+ store.destroyDependents();
+ }
+ }
+
+ return value;
+ }
+
+
+ @Override
+ public boolean isReadOnly(ELContext arg0) throws NullPointerException, PropertyNotFoundException, ELException
+ {
+ return this.valueExpression.isReadOnly(arg0);
+ }
+
+ @Override
+ public void setValue(ELContext arg0, Object arg1) throws NullPointerException, PropertyNotFoundException, PropertyNotWritableException, ELException
+ {
+ this.valueExpression.setValue(arg0, arg1);
+ }
+
+ @Override
+ public boolean equals(Object arg0)
+ {
+ return this.valueExpression.equals(arg0);
+ }
+
+ @Override
+ public String getExpressionString()
+ {
+ return this.valueExpression.getExpressionString();
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return this.valueExpression.hashCode();
+ }
+
+ @Override
+ public boolean isLiteralText()
+ {
+ return this.valueExpression.isLiteralText();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-el10/src/main/java/org/apache/webbeans/el10/EL10WrappedExpressionFactory.java b/owb_1.2.x/webbeans-el10/src/main/java/org/apache/webbeans/el10/EL10WrappedExpressionFactory.java
new file mode 100644
index 0000000..c6ea0c3
--- /dev/null
+++ b/owb_1.2.x/webbeans-el10/src/main/java/org/apache/webbeans/el10/EL10WrappedExpressionFactory.java
@@ -0,0 +1,65 @@
+/*
+ * 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.webbeans.el10;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.ExpressionFactory;
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
+
+public class EL10WrappedExpressionFactory extends ExpressionFactory
+{
+
+ private ExpressionFactory expressionFactory;
+
+ public EL10WrappedExpressionFactory(ExpressionFactory expressionFactory)
+ {
+ this.expressionFactory = expressionFactory;
+ }
+
+ @Override
+ public Object coerceToType(Object arg0, Class<?> arg1) throws ELException
+ {
+ return this.expressionFactory.coerceToType(arg0, arg1);
+ }
+
+ @Override
+ public MethodExpression createMethodExpression(ELContext arg0, String arg1, Class<?> arg2, Class<?>[] arg3) throws ELException, NullPointerException
+ {
+ return this.expressionFactory.createMethodExpression(arg0, arg1, arg2, arg3);
+ }
+
+ @Override
+ public ValueExpression createValueExpression(Object arg0, Class<?> arg1)
+ {
+ ValueExpression wrapped = this.expressionFactory.createValueExpression(arg0, arg1);
+
+ return new EL10ValueExpression(wrapped);
+ }
+
+ @Override
+ public ValueExpression createValueExpression(ELContext arg0, String arg1, Class<?> arg2) throws NullPointerException, ELException
+ {
+ ValueExpression wrapped = this.expressionFactory.createValueExpression(arg0, arg1, arg2);
+
+ return new EL10ValueExpression(wrapped);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-el10/src/main/resources/META-INF/faces-config.xml b/owb_1.2.x/webbeans-el10/src/main/resources/META-INF/faces-config.xml
new file mode 100644
index 0000000..076b6fc
--- /dev/null
+++ b/owb_1.2.x/webbeans-el10/src/main/resources/META-INF/faces-config.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<faces-config>
+ <application>
+ <el-resolver>org.apache.webbeans.el10.EL10Resolver</el-resolver>
+ </application>
+</faces-config>
diff --git a/owb_1.2.x/webbeans-el10/src/main/resources/META-INF/openwebbeans/openwebbeans.properties b/owb_1.2.x/webbeans-el10/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
new file mode 100644
index 0000000..5dd4f81
--- /dev/null
+++ b/owb_1.2.x/webbeans-el10/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
@@ -0,0 +1,28 @@
+#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.
+#---------------------------------------------------------------
+# The Unified EL-1.0 configuration for OpenWebBeans
+#
+#---------------------------------------------------------------
+
+
+configuration.ordinal= 15
+
+################################### Default EL Adaptor ####################################
+#Default implementation of org.apache.webbeans.spi.adaptor.ELAdaptor
+org.apache.webbeans.spi.adaptor.ELAdaptor=org.apache.webbeans.el10.EL10Adaptor
+################################################################################################
diff --git a/owb_1.2.x/webbeans-el10/src/site/site.xml b/owb_1.2.x/webbeans-el10/src/site/site.xml
new file mode 100644
index 0000000..9060b31
--- /dev/null
+++ b/owb_1.2.x/webbeans-el10/src/site/site.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<project name="OpenWebBeans">
+ <bannerLeft>
+ <name>Apache OpenWebBeans</name>
+ <src>http://openwebbeans.apache.org/owb/images/logos/openwebbeans_hor.png</src>
+ <href>http://openwebbeans.apache.org</href>
+ </bannerLeft>
+
+ <bannerRight>
+ <name>Apache Banner</name>
+ <src>http://www.apache.org/images/asf-logo.gif</src>
+ <href>http://www.apache.org</href>
+ </bannerRight>
+
+ <publishDate format="dd MMM yyyy" />
+ <version position="left"/>
+
+ <body>
+ <breadcrumbs>
+ <item name="Apache" href="http://www.apache.org"/>
+ <item name="OpenWebBeans" href="http://openwebbeans.apache.org"/>
+ <item name="OWB EL-1.0" href="http://openwebbeans.apache.org/${project.version}/openwebbeans-el10"/>
+ </breadcrumbs>
+
+ <menu ref="reports"/>
+ </body>
+</project>
+
diff --git a/owb_1.2.x/webbeans-el22/pom.xml b/owb_1.2.x/webbeans-el22/pom.xml
new file mode 100644
index 0000000..94eb475
--- /dev/null
+++ b/owb_1.2.x/webbeans-el22/pom.xml
@@ -0,0 +1,83 @@
+<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">
+<!--
+
+ 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.
+-->
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>1.2.5</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>openwebbeans-el22</artifactId>
+ <name>EL 2.2 plugin</name>
+ <description>Apache OpenWebBeans EL 2.2 integration</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-el_2.2_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+
+ </dependencies>
+
+</project>
diff --git a/owb_1.2.x/webbeans-el22/src/main/java/org/apache/webbeans/el22/EL22Adaptor.java b/owb_1.2.x/webbeans-el22/src/main/java/org/apache/webbeans/el22/EL22Adaptor.java
new file mode 100644
index 0000000..1796112
--- /dev/null
+++ b/owb_1.2.x/webbeans-el22/src/main/java/org/apache/webbeans/el22/EL22Adaptor.java
@@ -0,0 +1,45 @@
+/*
+ * 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.webbeans.el22;
+
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+
+import org.apache.webbeans.spi.adaptor.ELAdaptor;
+
+public class EL22Adaptor implements ELAdaptor
+{
+ public EL22Adaptor()
+ {
+
+ }
+
+ @Override
+ public ELResolver getOwbELResolver()
+ {
+ return new WebBeansELResolver();
+ }
+
+ @Override
+ public ExpressionFactory getOwbWrappedExpressionFactory(ExpressionFactory expressionFactroy)
+ {
+ return new WrappedExpressionFactory(expressionFactroy);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-el22/src/main/java/org/apache/webbeans/el22/WebBeansELResolver.java b/owb_1.2.x/webbeans-el22/src/main/java/org/apache/webbeans/el22/WebBeansELResolver.java
new file mode 100644
index 0000000..77cd83b
--- /dev/null
+++ b/owb_1.2.x/webbeans-el22/src/main/java/org/apache/webbeans/el22/WebBeansELResolver.java
@@ -0,0 +1,217 @@
+/*
+ * 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.webbeans.el22;
+
+import java.beans.FeatureDescriptor;
+import java.lang.reflect.Type;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.ELResolver;
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+import org.apache.webbeans.component.OwbBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.el.ELContextStore;
+
+/**
+ * JSF or JSP expression language a.k.a EL resolver.
+ *
+ * <p>
+ * EL is registered with the JSF in faces-config.xml if there exist a faces-config.xml
+ * in the application location <code>WEB-INF/</code>. Otherwise it is registered with
+ * JspApplicationContext at start-up.
+ * </p>
+ *
+ * <p>
+ * All <code>@Dependent</code> scoped contextual instances created during an EL
+ * expression evaluation are destroyed when the evaluation completes.
+ * </p>
+ *
+ * @version $Rev: 1307826 $ $Date: 2012-03-31 18:24:37 +0300 (Sat, 31 Mar 2012) $
+ *
+ */
+public class WebBeansELResolver extends ELResolver
+{
+ private WebBeansContext webBeansContext;
+
+ public WebBeansELResolver()
+ {
+ webBeansContext = WebBeansContext.getInstance();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Class<?> getCommonPropertyType(ELContext arg0, Object arg1)
+ {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext arg0, Object arg1)
+ {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Class<?> getType(ELContext arg0, Object arg1, Object arg2) throws ELException
+ {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @SuppressWarnings({"unchecked","deprecation"})
+ public Object getValue(ELContext context, Object base, Object property) throws ELException
+ {
+ BeanManagerImpl beanManager = webBeansContext.getBeanManagerImpl();
+ //we only check root beans
+ // Check if the OWB actually got used in this application
+ if (base != null || !beanManager.isInUse())
+ {
+ return null;
+ }
+
+ //Name of the bean
+ String beanName = (String) property;
+
+ //Local store, create if not exist
+ ELContextStore elContextStore = ELContextStore.getInstance(true);
+
+ Object contextualInstance = elContextStore.findBeanByName(beanName);
+
+ if(contextualInstance != null)
+ {
+ context.setPropertyResolved(true);
+
+ return contextualInstance;
+ }
+
+ //Get beans
+ Set<Bean<?>> beans = beanManager.getBeans(beanName);
+
+ //Found?
+ if(beans != null && !beans.isEmpty())
+ {
+ //Managed bean
+ Bean<Object> bean = (Bean<Object>)beans.iterator().next();
+
+ if(bean.getScope().equals(Dependent.class))
+ {
+ contextualInstance = getDependentContextualInstance(beanManager, elContextStore, context, bean);
+ }
+ else
+ {
+ // now we check for NormalScoped beans
+ contextualInstance = getNormalScopedContextualInstance(beanManager, elContextStore, context, bean, beanName);
+ }
+ }
+ return contextualInstance;
+ }
+
+ protected Object getNormalScopedContextualInstance(BeanManagerImpl manager, ELContextStore store, ELContext context, Bean<Object> bean, String beanName)
+ {
+ CreationalContext<Object> creationalContext = manager.createCreationalContext(bean);
+ Object contextualInstance = manager.getReference(bean, Object.class, creationalContext);
+ if (contextualInstance != null)
+ {
+ context.setPropertyResolved(true);
+ //Adding into store
+ store.addNormalScoped(beanName, contextualInstance);
+ }
+
+ return contextualInstance;
+ }
+
+
+ protected Object getDependentContextualInstance(BeanManagerImpl manager, ELContextStore store, ELContext context, Bean<Object> bean)
+ {
+ Object contextualInstance = store.getDependent(bean);
+ if(contextualInstance != null)
+ {
+ //Object found on the store
+ context.setPropertyResolved(true);
+ }
+ else
+ {
+ // If no contextualInstance found on the store
+ CreationalContext<Object> creationalContext = manager.createCreationalContext(bean);
+ contextualInstance = manager.getReference(bean, bestType(bean), creationalContext);
+ if (contextualInstance != null)
+ {
+ context.setPropertyResolved(true);
+ //Adding into store
+ store.addDependent(bean, contextualInstance, creationalContext);
+ }
+ }
+ return contextualInstance;
+ }
+
+ private static Type bestType(final Bean<?> bean)
+ {
+ if (bean == null)
+ {
+ return Object.class;
+ }
+ final Class<?> bc = bean.getBeanClass();
+ if (bc != null)
+ {
+ return bc;
+ }
+ if (OwbBean.class.isInstance(bean))
+ {
+ return OwbBean.class.cast(bean).getReturnType();
+ }
+ return Object.class;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isReadOnly(ELContext arg0, Object arg1, Object arg2) throws ELException
+ {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setValue(ELContext arg0, Object arg1, Object arg2, Object arg3) throws ELException
+ {
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-el22/src/main/java/org/apache/webbeans/el22/WrappedExpressionFactory.java b/owb_1.2.x/webbeans-el22/src/main/java/org/apache/webbeans/el22/WrappedExpressionFactory.java
new file mode 100644
index 0000000..67f8458
--- /dev/null
+++ b/owb_1.2.x/webbeans-el22/src/main/java/org/apache/webbeans/el22/WrappedExpressionFactory.java
@@ -0,0 +1,63 @@
+/*
+ * 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.webbeans.el22;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.ExpressionFactory;
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
+
+public class WrappedExpressionFactory extends ExpressionFactory
+{
+ private ExpressionFactory expressionFactory;
+
+ public WrappedExpressionFactory(ExpressionFactory expressionFactory)
+ {
+ this.expressionFactory = expressionFactory;
+ }
+
+ @Override
+ public Object coerceToType(Object arg0, Class<?> arg1) throws ELException
+ {
+ return expressionFactory.coerceToType(arg0, arg1);
+ }
+
+ @Override
+ public MethodExpression createMethodExpression(ELContext arg0, String arg1, Class<?> arg2, Class<?>[] arg3) throws ELException, NullPointerException
+ {
+ return expressionFactory.createMethodExpression(arg0, arg1, arg2, arg3);
+ }
+
+ @Override
+ public ValueExpression createValueExpression(Object arg0, Class<?> arg1)
+ {
+ ValueExpression wrapped = expressionFactory.createValueExpression(arg0, arg1);
+
+ return new WrappedValueExpression(wrapped);
+ }
+
+ @Override
+ public ValueExpression createValueExpression(ELContext arg0, String arg1, Class<?> arg2) throws NullPointerException, ELException
+ {
+ ValueExpression wrapped = expressionFactory.createValueExpression(arg0, arg1, arg2);
+
+ return new WrappedValueExpression(wrapped);
+ }
+}
diff --git a/owb_1.2.x/webbeans-el22/src/main/java/org/apache/webbeans/el22/WrappedValueExpression.java b/owb_1.2.x/webbeans-el22/src/main/java/org/apache/webbeans/el22/WrappedValueExpression.java
new file mode 100644
index 0000000..b55f80e
--- /dev/null
+++ b/owb_1.2.x/webbeans-el22/src/main/java/org/apache/webbeans/el22/WrappedValueExpression.java
@@ -0,0 +1,122 @@
+/*
+ * 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.webbeans.el22;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.PropertyNotFoundException;
+import javax.el.PropertyNotWritableException;
+import javax.el.ValueExpression;
+import javax.el.ValueReference;
+
+import org.apache.webbeans.el.ELContextStore;
+
+public class WrappedValueExpression extends ValueExpression
+{
+ private static final long serialVersionUID = 1L;
+
+ private ValueExpression valueExpression;
+
+ public WrappedValueExpression(ValueExpression valueExpression)
+ {
+ this.valueExpression = valueExpression;
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see javax.el.ValueExpression#getValueReference(javax.el.ELContext)
+ */
+ @Override
+ public ValueReference getValueReference(ELContext context)
+ {
+ return valueExpression.getValueReference(context);
+ }
+
+ @Override
+ public Class<?> getExpectedType()
+ {
+ return valueExpression.getExpectedType();
+ }
+
+ @Override
+ public Class<?> getType(ELContext arg0) throws NullPointerException, PropertyNotFoundException, ELException
+ {
+ return valueExpression.getType(arg0);
+ }
+
+ @Override
+ public Object getValue(ELContext context) throws NullPointerException, PropertyNotFoundException, ELException
+ {
+ Object value = null;
+ try
+ {
+ value = valueExpression.getValue(context);
+
+ }
+ finally
+ {
+ //Destroy dependent store
+ ELContextStore store = ELContextStore.getInstance(false);
+ if(store != null)
+ {
+ store.destroyDependents();
+ }
+ }
+
+ return value;
+ }
+
+ @Override
+ public boolean isReadOnly(ELContext arg0) throws NullPointerException, PropertyNotFoundException, ELException
+ {
+ return valueExpression.isReadOnly(arg0);
+ }
+
+ @Override
+ public void setValue(ELContext arg0, Object arg1) throws NullPointerException, PropertyNotFoundException, PropertyNotWritableException, ELException
+ {
+ valueExpression.setValue(arg0, arg1);
+ }
+
+ @Override
+ public boolean equals(Object arg0)
+ {
+ return valueExpression.equals(arg0);
+ }
+
+ @Override
+ public String getExpressionString()
+ {
+ return valueExpression.getExpressionString();
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return valueExpression.hashCode();
+ }
+
+ @Override
+ public boolean isLiteralText()
+ {
+ return valueExpression.isLiteralText();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-el22/src/main/resources/META-INF/faces-config.xml b/owb_1.2.x/webbeans-el22/src/main/resources/META-INF/faces-config.xml
new file mode 100644
index 0000000..926ee4e
--- /dev/null
+++ b/owb_1.2.x/webbeans-el22/src/main/resources/META-INF/faces-config.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<faces-config>
+ <application>
+ <el-resolver>org.apache.webbeans.el22.WebBeansELResolver</el-resolver>
+ </application>
+</faces-config>
diff --git a/owb_1.2.x/webbeans-el22/src/main/resources/META-INF/openwebbeans/openwebbeans.properties b/owb_1.2.x/webbeans-el22/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
new file mode 100644
index 0000000..13da21a
--- /dev/null
+++ b/owb_1.2.x/webbeans-el22/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
@@ -0,0 +1,28 @@
+#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.
+#---------------------------------------------------------------
+# The Unified EL-2.2 configuration for OpenWebBeans
+#
+#---------------------------------------------------------------
+
+
+configuration.ordinal= 15
+
+################################### Default EL Adaptor ####################################
+#Default implementation of org.apache.webbeans.spi.adaptor.ELAdaptor
+org.apache.webbeans.spi.adaptor.ELAdaptor=org.apache.webbeans.el22.EL22Adaptor
+################################################################################################
diff --git a/owb_1.2.x/webbeans-el22/src/site/site.xml b/owb_1.2.x/webbeans-el22/src/site/site.xml
new file mode 100644
index 0000000..e0b2ca8
--- /dev/null
+++ b/owb_1.2.x/webbeans-el22/src/site/site.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<project name="OpenWebBeans">
+ <bannerLeft>
+ <name>Apache OpenWebBeans</name>
+ <src>http://openwebbeans.apache.org/owb/images/logos/openwebbeans_hor.png</src>
+ <href>http://openwebbeans.apache.org</href>
+ </bannerLeft>
+
+ <bannerRight>
+ <name>Apache Banner</name>
+ <src>http://www.apache.org/images/asf-logo.gif</src>
+ <href>http://www.apache.org</href>
+ </bannerRight>
+
+ <publishDate format="dd MMM yyyy" />
+ <version position="left"/>
+
+ <body>
+ <breadcrumbs>
+ <item name="Apache" href="http://www.apache.org"/>
+ <item name="OpenWebBeans" href="http://openwebbeans.apache.org"/>
+ <item name="OWB EL-2.2" href="http://openwebbeans.apache.org/${project.version}/openwebbeans-el22"/>
+ </breadcrumbs>
+
+ <menu ref="reports"/>
+ </body>
+</project>
+
diff --git a/owb_1.2.x/webbeans-el22/src/test/java/org/apache/webbeans/el/test/AbstractUnitTest.java b/owb_1.2.x/webbeans-el22/src/test/java/org/apache/webbeans/el/test/AbstractUnitTest.java
new file mode 100644
index 0000000..dd45e70
--- /dev/null
+++ b/owb_1.2.x/webbeans-el22/src/test/java/org/apache/webbeans/el/test/AbstractUnitTest.java
@@ -0,0 +1,145 @@
+/*
+ * 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.webbeans.el.test;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.Extension;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.config.WebBeansFinder;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.lifecycle.test.OpenWebBeansTestLifeCycle;
+import org.apache.webbeans.lifecycle.test.OpenWebBeansTestMetaDataDiscoveryService;
+import org.apache.webbeans.spi.ContainerLifecycle;
+import org.apache.webbeans.util.WebBeansUtil;
+import org.junit.Assert;
+
+
+public abstract class AbstractUnitTest
+{
+ private OpenWebBeansTestLifeCycle testLifecycle;
+ private List<Extension> extensions = new ArrayList<Extension>();
+ private WebBeansContext webBeansContext;
+
+ protected AbstractUnitTest()
+ {
+
+ }
+
+ protected void startContainer(Collection<Class<?>> beanClasses)
+ {
+ startContainer(beanClasses, null);
+ }
+
+ protected void startContainer(Collection<Class<?>> beanClasses, Collection<String> beanXmls)
+ {
+ WebBeansFinder.clearInstances(WebBeansUtil.getCurrentClassLoader());
+ //Creates a new container
+ testLifecycle = new OpenWebBeansTestLifeCycle();
+
+ webBeansContext = WebBeansContext.getInstance();
+ for (Extension ext : extensions)
+ {
+ webBeansContext.getExtensionLoader().addExtension(ext);
+ }
+
+ //Deploy bean classes
+ OpenWebBeansTestMetaDataDiscoveryService discoveryService = (OpenWebBeansTestMetaDataDiscoveryService)webBeansContext.getScannerService();
+ discoveryService.deployClasses(beanClasses);
+ if (beanXmls != null)
+ {
+ discoveryService.deployXMLs(beanXmls);
+ }
+
+ //Start application
+ try
+ {
+ testLifecycle.startApplication(null);
+ }
+ catch (Exception e)
+ {
+ throw new WebBeansConfigurationException(e);
+ }
+
+ }
+
+ protected ContainerLifecycle getLifecycle()
+ {
+ return testLifecycle;
+ }
+
+ protected void shutDownContainer()
+ {
+ //Shwtdown application
+ if(this.testLifecycle != null)
+ {
+ this.testLifecycle.stopApplication(null);
+ }
+ }
+
+ protected WebBeansContext getWebBeansContext()
+ {
+ return this.webBeansContext;
+ }
+
+ protected BeanManager getBeanManager()
+ {
+ return this.webBeansContext.getBeanManagerImpl();
+ }
+
+ @SuppressWarnings("unchecked")
+ protected <T> T getInstance(Class<T> type, Annotation... qualifiers)
+ {
+ Set<Bean<?>> beans = getBeanManager().getBeans(type, qualifiers);
+ Assert.assertNotNull(beans);
+
+ Bean<?> bean = getBeanManager().resolve(beans);
+
+ return (T) getBeanManager().getReference(bean, type, getBeanManager().createCreationalContext(bean));
+ }
+
+ protected String getXmlPath(String packageName, String fileName)
+ {
+ StringBuilder prefix = new StringBuilder(packageName.replace('.', '/'));
+ prefix.append("/");
+ prefix.append(fileName);
+ prefix.append(".xml");
+
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ return loader.getResource(prefix.toString()).toExternalForm();
+ }
+
+ /**
+ * Add a CDI Extension which should get used in the test case.
+ * Use this function instead of defining test Extensions via the usual
+ * META-INF/services/javax.enterprise.inject.spi.Extension file!
+ *
+ * @param ext the {@link Extension} which should get loaded
+ */
+ public void addExtension(Extension ext) {
+ this.extensions.add(ext);
+ }
+}
diff --git a/owb_1.2.x/webbeans-el22/src/test/java/org/apache/webbeans/el/test/ELPerformanceTest.java b/owb_1.2.x/webbeans-el22/src/test/java/org/apache/webbeans/el/test/ELPerformanceTest.java
new file mode 100644
index 0000000..c7900f2
--- /dev/null
+++ b/owb_1.2.x/webbeans-el22/src/test/java/org/apache/webbeans/el/test/ELPerformanceTest.java
@@ -0,0 +1,122 @@
+/*
+ * 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.webbeans.el.test;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.el22.WebBeansELResolver;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.el.ELContext;
+
+public class ELPerformanceTest extends AbstractUnitTest
+{
+ private final static int THREADS = 100;
+ private final static int ITERATIONS = 200;
+
+
+ private static Logger logger = WebBeansLoggerFacade.getLogger(ELPerformanceTest.class);
+
+ /**
+ * Test our bean creation for thread safety.
+ */
+ @Test
+ public void testBeanCreation() throws Exception
+ {
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+
+ classes.add(SampleBean.class);
+ classes.add(RequestBean.class);
+
+ // we need this to enable the EL resolver at all!
+
+ startContainer(classes);
+
+ List<ParallelBeanStarter> strarters = new ArrayList<ParallelBeanStarter>();
+ WebBeansELResolver resolver = new WebBeansELResolver();
+
+ long start = System.nanoTime();
+
+ for(int i=0; i<THREADS; i++)
+ {
+ ParallelBeanStarter starter = new ParallelBeanStarter(resolver);
+ strarters.add(starter);
+ starter.start();
+ }
+
+ for(ParallelBeanStarter starter : strarters)
+ {
+ starter.join();
+ }
+
+ long end = System.nanoTime();
+
+ logger.log(Level.INFO, "Executing {0} threads with {1} iterations took {2} ns", WebBeansLoggerFacade.args(THREADS, ITERATIONS, end - start));
+
+ shutDownContainer();
+ }
+
+ private static class ParallelBeanStarter extends Thread
+ {
+ private WebBeansELResolver resolver;
+ private ELContext elctx = new MockELContext();
+ private static AtomicInteger n = new AtomicInteger(0);
+
+ public ParallelBeanStarter(WebBeansELResolver resolver)
+ {
+ this.resolver = resolver;
+ }
+
+ @Override
+ public void run()
+ {
+ WebBeansContext.currentInstance().getContextFactory().initRequestContext(null);
+ WebBeansContext.currentInstance().getContextFactory().initSessionContext(null);
+
+ try
+ {
+ for (int i = 0; i < ITERATIONS; i++)
+ {
+ SampleBean sb = (SampleBean) resolver.getValue(elctx , null, "sampleBean");
+ sb.getRb().getY();
+ sb.getX();
+ }
+ }
+ catch(RuntimeException e)
+ {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ Assert.fail("got an exception: " + e.getMessage());
+ throw e;
+ }
+ finally
+ {
+ WebBeansContext.currentInstance().getContextFactory().destroyRequestContext(null);
+ WebBeansContext.currentInstance().getContextFactory().destroySessionContext(null);
+ }
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-el22/src/test/java/org/apache/webbeans/el/test/MockELContext.java b/owb_1.2.x/webbeans-el22/src/test/java/org/apache/webbeans/el/test/MockELContext.java
new file mode 100644
index 0000000..c63a193
--- /dev/null
+++ b/owb_1.2.x/webbeans-el22/src/test/java/org/apache/webbeans/el/test/MockELContext.java
@@ -0,0 +1,47 @@
+/*
+ * 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.webbeans.el.test;
+
+import javax.el.ELContext;
+import javax.el.ELResolver;
+import javax.el.FunctionMapper;
+import javax.el.VariableMapper;
+
+public class MockELContext extends ELContext
+{
+
+ @Override
+ public ELResolver getELResolver()
+ {
+ return null;
+ }
+
+ @Override
+ public FunctionMapper getFunctionMapper()
+ {
+ return null;
+ }
+
+ @Override
+ public VariableMapper getVariableMapper()
+ {
+ return null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-el22/src/test/java/org/apache/webbeans/el/test/RequestBean.java b/owb_1.2.x/webbeans-el22/src/test/java/org/apache/webbeans/el/test/RequestBean.java
new file mode 100644
index 0000000..48a10bb
--- /dev/null
+++ b/owb_1.2.x/webbeans-el22/src/test/java/org/apache/webbeans/el/test/RequestBean.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.el.test;
+
+import javax.enterprise.context.RequestScoped;
+import java.io.Serializable;
+
+@RequestScoped
+public class RequestBean implements Serializable
+{
+ private int y = 323;
+
+ public int getY()
+ {
+ return y;
+ }
+
+ public void setY(int y)
+ {
+ this.y = y;
+ }
+}
diff --git a/owb_1.2.x/webbeans-el22/src/test/java/org/apache/webbeans/el/test/SampleBean.java b/owb_1.2.x/webbeans-el22/src/test/java/org/apache/webbeans/el/test/SampleBean.java
new file mode 100644
index 0000000..ca6564a
--- /dev/null
+++ b/owb_1.2.x/webbeans-el22/src/test/java/org/apache/webbeans/el/test/SampleBean.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.el.test;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@SessionScoped
+@Named
+public class SampleBean implements Serializable
+{
+ private int x=121;
+ private @Inject RequestBean rb;
+
+ public int getX()
+ {
+ return x;
+ }
+
+ public void setX(int x)
+ {
+ this.x = x;
+ }
+
+ public RequestBean getRb()
+ {
+ return rb;
+ }
+
+ public void setRb(RequestBean rb)
+ {
+ this.rb = rb;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/pom.xml b/owb_1.2.x/webbeans-impl/pom.xml
new file mode 100644
index 0000000..d39e212
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/pom.xml
@@ -0,0 +1,162 @@
+<?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.
+-->
+<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>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>1.2.5</version>
+ </parent>
+ <artifactId>openwebbeans-impl</artifactId>
+ <name>OpenWebBeans Core</name>
+ <description>
+ Apache OpenWebBeans Implementation core module
+ </description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-el_2.2_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.xbean</groupId>
+ <artifactId>xbean-finder-shaded</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.xbean</groupId>
+ <artifactId>xbean-asm5-shaded</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <!--
+ additionally create a jar with all the test classes for use
+ in the TCK module
+ -->
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+ <!-- Apache plugins in alphabetical order -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <version>2.4</version>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>cim</report>
+ <report>index</report>
+ <report>issue-tracking</report>
+ <report>mailing-list</report>
+ <report>project-team</report>
+ <report>scm</report>
+ <report>summary</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <profiles>
+ <profile>
+ <id>run-its</id>
+ <build>
+ <plugins>
+ <!-- invoke the integration tests under src/it -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <configuration>
+ <debug>true</debug>
+ <projectsDirectory>src/it</projectsDirectory>
+ <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+ <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
+ <settingsFile>src/it/settings.xml</settingsFile>
+ <pomIncludes>
+ <pomInclude>*/pom.xml</pomInclude>
+ </pomIncludes>
+ <goals>
+ <goal>install</goal>
+ </goals>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>install</goal>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/owb_1.2.x/webbeans-impl/src/it/properties/pom.xml b/owb_1.2.x/webbeans-impl/src/it/properties/pom.xml
new file mode 100644
index 0000000..715bd92
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/it/properties/pom.xml
@@ -0,0 +1,57 @@
+<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">
+<!--
+
+ 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.
+-->
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>@pom.version@</version>
+ </parent>
+
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl-it</artifactId>
+ <version>@pom.version@</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ <version>@pom.version@</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/owb_1.2.x/webbeans-impl/src/it/properties/src/test/java/org/apache/webbeans/test/spi/configuration/ConfigurationTest.java b/owb_1.2.x/webbeans-impl/src/it/properties/src/test/java/org/apache/webbeans/test/spi/configuration/ConfigurationTest.java
new file mode 100644
index 0000000..fc7e328
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/it/properties/src/test/java/org/apache/webbeans/test/spi/configuration/ConfigurationTest.java
@@ -0,0 +1,50 @@
+/*
+ * 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.webbeans.test.spi.configuration;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.config.OpenWebBeansConfiguration;
+import org.apache.webbeans.config.WebBeansContext;
+import org.junit.Test;
+
+public class ConfigurationTest
+{
+ @Test
+ public void testConfigurationParser()
+ {
+ OpenWebBeansConfiguration cfg = WebBeansContext.getInstance().getOpenWebBeansConfiguration();
+
+ // not overloaded
+ String ts = cfg.getProperty("org.apache.webbeans.spi.TransactionService");
+ Assert.assertNotNull(ts);
+ Assert.assertEquals("org.apache.webbeans.corespi.ee.TransactionServiceJndiImpl", ts);
+
+ // overloaded version 1
+ String wbf = cfg.getProperty("org.apache.webbeans.spi.JNDIService");
+ Assert.assertNotNull(wbf);
+ Assert.assertEquals("org.apache.webbeans.corespi.ee.JNDIServiceEnterpriseImpl", wbf);
+
+ // property which is only in the specialised openwebbeans.properties
+ String testProperty = cfg.getProperty("test.property");
+ Assert.assertNotNull(testProperty);
+ Assert.assertEquals("true", testProperty);
+ }
+
+}
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/it/properties/src/test/resources/META-INF/openwebbeans/openwebbeans.properties b/owb_1.2.x/webbeans-impl/src/it/properties/src/test/resources/META-INF/openwebbeans/openwebbeans.properties
new file mode 100644
index 0000000..f81bf1a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/it/properties/src/test/resources/META-INF/openwebbeans/openwebbeans.properties
@@ -0,0 +1,35 @@
+#Licensed to the Apache Software Foundation (ASF) under one
+#or more contributor license agreements. See the NOTICE file
+#distributed with this work for additional information
+#regarding copyright ownership. The ASF licenses this file
+#to you under the Apache License, Version 2.0 (the
+#"License"); you may not use this file except in compliance
+#with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+#Unless required by applicable law or agreed to in writing,
+#software distributed under the License is distributed on an
+#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#KIND, either express or implied. See the License for the
+#specific language governing permissions and limitations
+#under the License.
+
+#---------------------------------------------------------------
+# The overridden OpenWebBeans configuration for J2EE Geronimo
+#
+# This configuration is intended for the Apache Geronimo J2EE server
+#
+# The key is the Interface, the value the implementation of the service
+#
+#---------------------------------------------------------------
+
+# TODO these are currently only preliminary values for testing the mechanism!
+test.property=true
+
+# TODO these are currently only preliminary values for testing the mechanism!
+# use the real EE server JNDI implementation for storing objects in JNDI
+org.apache.webbeans.spi.JNDIService=org.apache.webbeans.corespi.ee.JNDIServiceEnterpriseImpl
+org.apache.webbeans.spi.JPAService=org.apache.webbeans.corespi.ee.geronimo.JPAServiceOpenEjb
+org.apache.webbeans.spi.TransactionService=org.apache.webbeans.corespi.ee.TransactionServiceJndiImpl
+
diff --git a/owb_1.2.x/webbeans-impl/src/it/settings.xml b/owb_1.2.x/webbeans-impl/src/it/settings.xml
new file mode 100644
index 0000000..c4ba787
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/it/settings.xml
@@ -0,0 +1,52 @@
+<?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.
+-->
+
+<settings>
+ <profiles>
+ <profile>
+ <id>it-repo</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <repositories>
+ <repository>
+ <id>local.central</id>
+ <url>file:///@localRepository@</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>local.central</id>
+ <url>file:///@localRepository@</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <properties>
+ <openjpa.version>1.2.0</openjpa.version>
+ <hsqldb.version>1.8.0.8</hsqldb.version>
+ </properties>
+ </profile>
+ </profiles>
+</settings>
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java
new file mode 100644
index 0000000..11d1660
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java
@@ -0,0 +1,871 @@
+/*
+ * 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.webbeans.annotation;
+
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.exception.inject.DefinitionException;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.ArrayUtil;
+import org.apache.webbeans.util.Asserts;
+
+import javax.enterprise.context.NormalScope;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.New;
+import javax.enterprise.inject.Stereotype;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.util.Nonbinding;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Qualifier;
+import javax.inject.Scope;
+import javax.interceptor.InterceptorBinding;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Manages annotation usage by classes in this application.
+ */
+public final class AnnotationManager
+{
+ private Map<Class<? extends Annotation>, Boolean> checkedQualifierAnnotations =
+ new ConcurrentHashMap<Class<? extends Annotation>, Boolean>();
+ private Map<Class<? extends Annotation>, Boolean> checkedStereotypeAnnotations =
+ new ConcurrentHashMap<Class<? extends Annotation>, Boolean>();
+
+ private final BeanManagerImpl beanManagerImpl;
+ private final WebBeansContext webBeansContext;
+
+ private final static Annotation[] ONLY_DEFAULT_ANNOTATION = new Annotation[1];
+ static
+ {
+ ONLY_DEFAULT_ANNOTATION[0] = DefaultLiteral.INSTANCE;
+ }
+
+ // No instantiate
+
+ public AnnotationManager(WebBeansContext context)
+ {
+ webBeansContext = context;
+ beanManagerImpl = context.getBeanManagerImpl();
+ }
+
+ public Annotation getDeclaredScopeAnnotation(Class<?> beanClass)
+ {
+ for (Annotation annotation : beanClass.getDeclaredAnnotations())
+ {
+ if (beanManagerImpl.isScope(annotation.annotationType()))
+ {
+ return annotation;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns true if the annotation is defined in xml or annotated with
+ * {@link javax.interceptor.InterceptorBinding} or an InterceptorBinding
+ * registered via {@link javax.enterprise.inject.spi.BeforeBeanDiscovery}.
+ * False otherwise.
+ *
+ * @param clazz type of the annotation
+ * @return true if the annotation is defined in xml or annotated with
+ * {@link javax.interceptor.InterceptorBinding}, false otherwise
+ */
+ public boolean isInterceptorBindingAnnotation(Class<? extends Annotation> clazz)
+ {
+ Asserts.nullCheckForClass(clazz);
+
+ return clazz.isAnnotationPresent(InterceptorBinding.class)
+ || webBeansContext.getInterceptorsManager().hasInterceptorBindingType(clazz);
+ }
+
+
+ /**
+ * This method searches for all direct and indirect annotations which
+ * represent an {@link InterceptorBinding}.
+ * InterceptorBindings in stereotypes will also be found!
+ *
+ * @return the effective interceptor annotations of the array of given annotations
+ */
+ public Set<Annotation> getInterceptorAnnotations(Set<Annotation> typeAnns)
+ {
+ // use a map to ensure that every annotation type is present only once
+ Map<Class<? extends Annotation>, Annotation> bindings = new HashMap<Class<? extends Annotation>, Annotation>();
+
+ Annotation[] anns = getInterceptorBindingMetaAnnotations(typeAnns);
+
+ for (Annotation ann : anns)
+ {
+ Annotation oldBinding = bindings.get(ann.annotationType());
+ if (oldBinding != null && !AnnotationUtil.isCdiAnnotationEqual(oldBinding, ann))
+ {
+ throw new WebBeansConfigurationException("Illegal interceptor binding: annotation of type "
+ + ann.annotationType().getName()
+ + " is present twice with diffenent values: "
+ + oldBinding.toString() + " and " + ann.toString());
+ }
+ bindings.put(ann.annotationType(), ann);
+ }
+
+ // check for stereotypes _explicitly_ declared on the bean class (not inherited)
+ Annotation[] stereoTypes = getStereotypeMetaAnnotations(typeAnns.toArray(new Annotation[typeAnns.size()]));
+ for (Annotation stereoType : stereoTypes)
+ {
+ if (hasInterceptorBindingMetaAnnotation(stereoType.annotationType().getDeclaredAnnotations()))
+ {
+ Annotation[] steroInterceptorBindings = getInterceptorBindingMetaAnnotations(stereoType.annotationType().getDeclaredAnnotations());
+
+ for (Annotation ann : steroInterceptorBindings)
+ {
+ Annotation oldBinding = bindings.get(ann.annotationType());
+ if (oldBinding != null && !AnnotationUtil.isCdiAnnotationEqual(oldBinding, ann))
+ {
+ throw new WebBeansConfigurationException("Illegal interceptor binding: annotation of type "
+ + ann.annotationType().getName()
+ + " is present twice with diffenent values: "
+ + oldBinding.toString() + " and " + ann.toString());
+ }
+ bindings.put(ann.annotationType(), ann);
+ }
+ }
+ }
+
+ return new HashSet<Annotation>(bindings.values());
+ }
+
+ /**
+ * If any Annotations in the input is an interceptor binding annotation type then return
+ * true, false otherwise.
+ *
+ * @param anns array of Annotations to check
+ * @return true if one or moe of the input annotations are an interceptor binding annotation
+ * type false otherwise
+ */
+ public boolean hasInterceptorBindingMetaAnnotation(Annotation[] anns)
+ {
+ Asserts.assertNotNull(anns, "anns parameter can not be null");
+
+ for (Annotation ann : anns)
+ {
+ if (isInterceptorBindingAnnotation(ann.annotationType()))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Collect the interceptor bindings from an array of annotations, including
+ * transitively defined interceptor bindings.
+ * @param anns An array of annotations
+ * @return an array of interceptor binding annotations, including the input and any transitively declared annotations
+ */
+ public Annotation[] getInterceptorBindingMetaAnnotations(Set<Annotation> anns)
+ {
+ return getInterceptorBindingMetaAnnotations(AnnotationUtil.asArray(anns));
+ }
+
+ /**
+ * Collect the interceptor bindings from an array of annotations, including
+ * transitively defined interceptor bindings.
+ * @param anns An array of annotations
+ * @return an array of interceptor binding annotations, including the input and any transitively declared annotations
+ */
+ public Annotation[] getInterceptorBindingMetaAnnotations(Annotation[] anns)
+ {
+ Asserts.assertNotNull(anns, "anns parameter can not be null");
+ List<Annotation> interAnns = new ArrayList<Annotation>();
+
+ for (Annotation ann : anns)
+ {
+ if (isInterceptorBindingAnnotation(ann.annotationType()))
+ {
+ interAnns.add(ann);
+
+ //check for transitive
+ Annotation[] transitives = getInterceptorBindingMetaAnnotations(ann.annotationType().getDeclaredAnnotations());
+
+ Collections.addAll(interAnns, transitives);
+ }
+ }
+
+ Annotation[] ret = new Annotation[interAnns.size()];
+ ret = interAnns.toArray(ret);
+
+ return ret;
+ }
+
+
+ /**
+ * Returns true if the annotation is defined in xml or annotated with
+ * {@link javax.inject.Qualifier} false otherwise.
+ *
+ * @param clazz type of the annotation
+ * @return true if the annotation is defined in xml or annotated with
+ * {@link javax.inject.Qualifier} false otherwise
+ */
+ public boolean isQualifierAnnotation(Class<? extends Annotation> clazz)
+ {
+ Boolean checkedAnnotationResult = checkedQualifierAnnotations.get(clazz);
+
+ if (checkedAnnotationResult != null)
+ {
+ return checkedAnnotationResult;
+ }
+
+ boolean result = false;
+
+ Asserts.nullCheckForClass(clazz);
+ if (clazz.isAnnotationPresent(Qualifier.class))
+ {
+ result = true;
+ }
+ else if(beanManagerImpl.getAdditionalQualifiers().contains(clazz))
+ {
+ result = true;
+ }
+
+ checkedQualifierAnnotations.put(clazz, result);
+
+ return result;
+ }
+
+ public <X> Annotation[] getAnnotatedMethodFirstParameterQualifierWithGivenAnnotation(
+ AnnotatedMethod<X> annotatedMethod, Class<? extends Annotation> clazz)
+ {
+ Asserts.assertNotNull(annotatedMethod, "annotatedMethod argument can not be null");
+ Asserts.nullCheckForClass(clazz);
+
+ List<Annotation> list = new ArrayList<Annotation>();
+ List<AnnotatedParameter<X>> parameters = annotatedMethod.getParameters();
+ for(AnnotatedParameter<X> parameter : parameters)
+ {
+ if(parameter.isAnnotationPresent(clazz))
+ {
+ Annotation[] anns = AnnotationUtil.asArray(parameter.getAnnotations());
+ for(Annotation ann : anns)
+ {
+ if(isQualifierAnnotation(ann.annotationType()))
+ {
+ list.add(ann);
+ }
+ }
+ }
+ }
+
+ Annotation[] finalAnns = new Annotation[list.size()];
+ finalAnns = list.toArray(finalAnns);
+
+ return finalAnns;
+ }
+
+
+ /**
+ * Gets the method first found parameter qualifiers.
+ *
+ * @param method method
+ * @param clazz checking annotation
+ * @return annotation array
+ */
+ public Annotation[] getMethodFirstParameterQualifierWithGivenAnnotation(Method method, Class<? extends Annotation> clazz)
+ {
+ Asserts.assertNotNull(method, "Method argument can not be null");
+ Asserts.nullCheckForClass(clazz);
+
+ Annotation[][] parameterAnns = method.getParameterAnnotations();
+ List<Annotation> list = new ArrayList<Annotation>();
+ Annotation[] result;
+
+ for (Annotation[] parameters : parameterAnns)
+ {
+ boolean found = false;
+ for (Annotation param : parameters)
+ {
+ Class<? extends Annotation> btype = param.annotationType();
+ if (btype.equals(clazz))
+ {
+ found = true;
+ continue;
+ }
+
+ if (isQualifierAnnotation(btype))
+ {
+ list.add(param);
+ }
+
+ }
+
+ if (found)
+ {
+ result = new Annotation[list.size()];
+ result = list.toArray(result);
+ return result;
+ }
+ }
+ result = AnnotationUtil.EMPTY_ANNOTATION_ARRAY;
+ return result;
+ }
+
+ public Set<Annotation> getQualifierAnnotations(Set<Annotation> annotations)
+ {
+ return new HashSet<Annotation>(Arrays.asList(getQualifierAnnotations(annotations.toArray(new Annotation[annotations.size()]))));
+ }
+
+ /**
+ * Gets the array of qualifier annotations on the given array.
+ *
+ * @param annotations annotation array
+ * @return array containing qualifier anns
+ */
+ public Annotation[] getQualifierAnnotations(Annotation... annotations)
+ {
+ Asserts.assertNotNull(annotations, "Annotations argument can not be null");
+
+ if (annotations.length == 0)
+ {
+ return ONLY_DEFAULT_ANNOTATION;
+ }
+
+ Set<Annotation> set = new HashSet<Annotation>();
+
+ for (Annotation annot : annotations)
+ {
+ if (isQualifierAnnotation(annot.annotationType()))
+ {
+ set.add(annot);
+ }
+ }
+
+ //Add the default qualifier if no others exist. Section 3.10, OWB-142///
+ if(set.size() == 0)
+ {
+ return ONLY_DEFAULT_ANNOTATION;
+ }
+ ////////////////////////////////////////////////////////////////////////
+
+ Annotation[] a = new Annotation[set.size()];
+ a = set.toArray(a);
+
+ return a;
+ }
+
+ public void checkQualifierConditions(Annotation... qualifierAnnots)
+ {
+ Set<Annotation> annSet = ArrayUtil.asSet(qualifierAnnots);
+
+ //check for duplicate annotations
+ if (qualifierAnnots.length != annSet.size())
+ {
+ throw new IllegalArgumentException("Qualifier annotations can not contain duplicate qualifiers:"
+ + Arrays.toString(qualifierAnnots));
+ }
+
+ checkQualifierConditions(annSet);
+ }
+
+ /**
+ * This function obviously cannot check for duplicate annotations.
+ * So this must have been done before!
+ * @param qualifierAnnots
+ */
+ public void checkQualifierConditions(Set<Annotation> qualifierAnnots)
+ {
+ for (Annotation ann : qualifierAnnots)
+ {
+ checkQualifierConditions(ann);
+ }
+ }
+
+ private void checkQualifierConditions(Annotation ann)
+ {
+ Method[] methods = webBeansContext.getSecurityService().doPrivilegedGetDeclaredMethods(ann.annotationType());
+
+ for (Method method : methods)
+ {
+ Class<?> clazz = method.getReturnType();
+ if (clazz.isArray() || clazz.isAnnotation())
+ {
+ if (!AnnotationUtil.hasAnnotation(method.getDeclaredAnnotations(), Nonbinding.class))
+ {
+ throw new WebBeansConfigurationException("@Qualifier : " + ann.annotationType().getName()
+ + " must have @NonBinding valued members for its array-valued and annotation valued members");
+ }
+ }
+ }
+
+ if (!isQualifierAnnotation(ann.annotationType()))
+ {
+ throw new IllegalArgumentException("Qualifier annotations must be annotated with @Qualifier");
+ }
+ }
+
+ /**
+ * Returns true if the annotation is defined in xml or annotated with
+ * {@link javax.enterprise.inject.Stereotype} false otherwise.
+ *
+ * @param clazz type of the annotation
+ * @return true if the annotation is defined in xml or annotated with
+ * {@link javax.enterprise.inject.Stereotype} false otherwise
+ */
+ public boolean isStereoTypeAnnotation(Class<? extends Annotation> clazz)
+ {
+ return isStereoTypeAnnotation(clazz, new HashSet<Class<? extends Annotation>>());
+ }
+
+ private boolean isStereoTypeAnnotation(Class<? extends Annotation> clazz, Set<Class<? extends Annotation>> checkedAnnotations)
+ {
+ Asserts.nullCheckForClass(clazz);
+
+ Boolean checkedAnnotationResult = checkedStereotypeAnnotations.get(clazz);
+
+ if (checkedAnnotationResult != null)
+ {
+ return checkedAnnotationResult;
+ }
+
+ boolean result = false;
+
+ if (clazz.isAnnotationPresent(Stereotype.class))
+ {
+ result = true;
+ }
+ else
+ {
+ for (Annotation annotation: clazz.getAnnotations())
+ {
+ if (checkedAnnotations.contains(annotation.annotationType()))
+ {
+ continue;
+ }
+ checkedAnnotations.add(annotation.annotationType());
+ if (isStereoTypeAnnotation(annotation.annotationType(), checkedAnnotations))
+ {
+ result = true;
+ break;
+ }
+ }
+ }
+
+ checkedStereotypeAnnotations.put(clazz, result);
+
+ return result;
+ }
+
+ public boolean hasStereoTypeMetaAnnotation(Set<Class<? extends Annotation>> anns)
+ {
+ Asserts.assertNotNull(anns, "anns parameter can not be null");
+
+ for (Class<? extends Annotation> ann : anns)
+ {
+ if (isStereoTypeAnnotation(ann))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public boolean hasStereoTypeMetaAnnotation(Annotation[] anns)
+ {
+ Asserts.assertNotNull(anns, "anns parameter can not be null");
+
+ for (Annotation ann : anns)
+ {
+ if (isStereoTypeAnnotation(ann.annotationType()))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public Annotation[] getStereotypeMetaAnnotations(Annotation[] anns)
+ {
+ Asserts.assertNotNull(anns, "anns parameter can not be null");
+ List<Annotation> interAnns = new ArrayList<Annotation>();
+
+ for (Annotation ann : anns)
+ {
+ if (isStereoTypeAnnotation(ann.annotationType()))
+ {
+ interAnns.add(ann);
+
+ //check for transitive
+ Annotation[] transitives = getTransitiveStereoTypes(ann.annotationType().getDeclaredAnnotations());
+ Collections.addAll(interAnns, transitives);
+ }
+ }
+
+ Annotation[] ret = new Annotation[interAnns.size()];
+ ret = interAnns.toArray(ret);
+
+ return ret;
+ }
+
+ /**
+ * Same like {@link #getStereotypeMetaAnnotations(java.util.Set)} but with an array
+ */
+ public Set<Class<? extends Annotation>> getStereotypeMetaAnnotations(Set<Class<? extends Annotation>> stereotypes)
+ {
+ Asserts.assertNotNull(stereotypes, "anns parameter can not be null");
+ Set<Class<? extends Annotation>> interAnns = new HashSet<Class<? extends Annotation>>();
+
+ for (Class<? extends Annotation> ann : stereotypes)
+ {
+ if (isStereoTypeAnnotation(ann))
+ {
+ interAnns.add(ann);
+
+ //check for transitive
+ Annotation[] transitives = getTransitiveStereoTypes(ann.getDeclaredAnnotations());
+
+ for(Annotation transitive : transitives)
+ {
+ interAnns.add(transitive.annotationType());
+ }
+ }
+ }
+ return interAnns;
+ }
+
+ private Annotation[] getTransitiveStereoTypes(Annotation[] anns)
+ {
+ return getStereotypeMetaAnnotations(anns);
+ }
+
+ /**
+ * Returns bean stereotypes.
+ * @return bean stereotypes
+ */
+ public Set<Class<? extends Annotation>> getStereotypes(Set<Class<? extends Annotation>> anns)
+ {
+ Asserts.assertNotNull(anns, "bean parameter can not be null");
+ if (hasStereoTypeMetaAnnotation(anns))
+ {
+ return getStereotypeMetaAnnotations(anns);
+ }
+
+ return Collections.emptySet();
+ }
+
+ /**
+ * Returns true if name exists,false otherwise.
+ * @return true if name exists
+ */
+ public boolean hasNamedOnStereoTypes(Set<Class<? extends Annotation>> stereotypes)
+ {
+ Set<Class<? extends Annotation>> types = getStereotypes(stereotypes);
+
+ for (Class<? extends Annotation> ann : types)
+ {
+ if (AnnotationUtil.hasClassAnnotation(ann, Named.class))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Validates that given class obeys stereotype model
+ * defined by the specification.
+ * @param clazz stereotype class
+ */
+ public void checkStereoTypeClass(Class<? extends Annotation> clazz, Annotation...annotations)
+ {
+ Asserts.nullCheckForClass(clazz);
+
+ boolean scopeTypeFound = false;
+ for (Annotation annotation : annotations)
+ {
+ Class<? extends Annotation> annotType = annotation.annotationType();
+
+ if (annotType.isAnnotationPresent(NormalScope.class) || annotType.isAnnotationPresent(Scope.class))
+ {
+ if (scopeTypeFound)
+ {
+ throw new WebBeansConfigurationException("@StereoType annotation can not contain more " +
+ "than one @Scope/@NormalScope annotation");
+ }
+ else
+ {
+ scopeTypeFound = true;
+ }
+ }
+ else if (annotType.equals(Named.class))
+ {
+ Named name = (Named) annotation;
+ if (!name.value().equals(""))
+ {
+ throw new WebBeansConfigurationException("@StereoType annotation can not define @Named " +
+ "annotation with value");
+ }
+ }
+ }
+ }
+
+ public void checkInterceptorResolverParams(Annotation... interceptorBindings)
+ {
+ if (interceptorBindings == null || interceptorBindings.length == 0)
+ {
+ throw new IllegalArgumentException("Manager.resolveInterceptors() method parameter interceptor bindings " +
+ "array argument can not be empty");
+ }
+
+ Annotation old = null;
+ for (Annotation interceptorBinding : interceptorBindings)
+ {
+ if (!isInterceptorBindingAnnotation(interceptorBinding.annotationType()))
+ {
+ throw new IllegalArgumentException("Manager.resolveInterceptors() method parameter interceptor" +
+ " bindings array can not contain other annotation that is not @InterceptorBinding");
+ }
+
+ if (old == null)
+ {
+ old = interceptorBinding;
+ }
+ else
+ {
+ if (old.equals(interceptorBinding))
+ {
+ throw new IllegalArgumentException("Manager.resolveInterceptors() method parameter interceptor " +
+ "bindings array argument can not define duplicate binding annotation with name : @" +
+ old.getClass().getName());
+ }
+
+ old = interceptorBinding;
+ }
+ }
+ }
+
+ public void checkDecoratorResolverParams(Set<Type> apiTypes, Annotation... qualifiers)
+ {
+ if (apiTypes == null || apiTypes.size() == 0)
+ {
+ throw new IllegalArgumentException("Manager.resolveDecorators() method parameter api types argument " +
+ "can not be empty");
+ }
+
+ Annotation old = null;
+ for (Annotation qualifier : qualifiers)
+ {
+ if (!isQualifierAnnotation(qualifier.annotationType()))
+ {
+ throw new IllegalArgumentException("Manager.resolveDecorators() method parameter qualifiers array " +
+ "can not contain other annotation that is not @Qualifier");
+ }
+ if (old == null)
+ {
+ old = qualifier;
+ }
+ else
+ {
+ if (old.annotationType().equals(qualifier.annotationType()))
+ {
+ throw new IllegalArgumentException("Manager.resolveDecorators() method parameter qualifiers " +
+ "array argument can not define duplicate qualifier annotation with name : @" +
+ old.annotationType().getName());
+ }
+
+ old = qualifier;
+ }
+ }
+
+ }
+
+
+ /**
+ * Check conditions for the new binding.
+ * @param annotations annotations
+ * @return Annotation[] with all binding annotations
+ * @throws WebBeansConfigurationException if New plus any other binding annotation is set
+ */
+ public Annotation[] checkForNewQualifierForDeployment(Type type, Class<?> clazz, String name,
+ Annotation[] annotations)
+ {
+ Asserts.assertNotNull(type, "Type argument can not be null");
+ Asserts.nullCheckForClass(clazz);
+ Asserts.assertNotNull(annotations, "Annotations argument can not be null");
+
+ Annotation[] as = getQualifierAnnotations(annotations);
+ for (Annotation a : annotations)
+ {
+ if (a.annotationType().equals(New.class))
+ {
+ if (as.length > 1)
+ {
+ throw new WebBeansConfigurationException("@New binding annotation can not have any binding "
+ + "annotation in class : " + clazz.getName()
+ + " in field/method : " + name);
+ }
+ }
+ }
+
+ return as;
+ }
+
+ /**
+ * Configures the name of the producer method for specializing the parent.
+ *
+ * @param component producer method component
+ * @param method specialized producer method
+ * @param superMethod overriden super producer method
+ */
+ public boolean isSuperMethodNamed(AbstractOwbBean<?> component,
+ Method method,
+ Method superMethod)
+ {
+ Asserts.assertNotNull(component,"component parameter can not be null");
+ Asserts.assertNotNull(method,"method parameter can not be null");
+ Asserts.assertNotNull(superMethod,"superMethod parameter can not be null");
+
+ boolean hasName = false;
+ if(AnnotationUtil.hasMethodAnnotation(superMethod, Named.class))
+ {
+ hasName = true;
+ }
+ else
+ {
+ Annotation[] anns = getStereotypeMetaAnnotations(superMethod.getAnnotations());
+ for(Annotation ann : anns)
+ {
+ if(ann.annotationType().isAnnotationPresent(Stereotype.class))
+ {
+ hasName = true;
+ break;
+ }
+ }
+ }
+
+ if(hasName)
+ {
+ if(AnnotationUtil.hasMethodAnnotation(method, Named.class))
+ {
+ throw new DefinitionException("Specialized method : " + method.getName() + " in class : "
+ + component.getReturnType().getName() + " may not define @Named annotation");
+ }
+ }
+
+ return hasName;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <X> Method getDisposalWithGivenAnnotatedMethod(AnnotatedType<X> annotatedType, Type beanType, Annotation[] qualifiers)
+ {
+ Set<AnnotatedMethod<? super X>> annotatedMethods = annotatedType.getMethods();
+
+ if(annotatedMethods != null)
+ {
+ for (AnnotatedMethod<? super X> annotatedMethod : annotatedMethods)
+ {
+ AnnotatedMethod<X> annt = (AnnotatedMethod<X>)annotatedMethod;
+ List<AnnotatedParameter<X>> parameters = annt.getParameters();
+ if(parameters != null)
+ {
+ boolean found = false;
+ for(AnnotatedParameter<X> parameter : parameters)
+ {
+ if(parameter.isAnnotationPresent(Disposes.class))
+ {
+ found = true;
+ break;
+ }
+ }
+
+ if(found)
+ {
+ Type type = AnnotationUtil.getAnnotatedMethodFirstParameterWithAnnotation(annotatedMethod, Disposes.class);
+ Annotation[] annots = getAnnotatedMethodFirstParameterQualifierWithGivenAnnotation(annotatedMethod, Disposes.class);
+
+ if(type.equals(beanType))
+ {
+ for(Annotation qualifier : qualifiers)
+ {
+ if(qualifier.annotationType() != Default.class)
+ {
+ for(Annotation ann :annots)
+ {
+ if(!AnnotationUtil.isCdiAnnotationEqual(qualifier, ann))
+ {
+ return null;
+ }
+ }
+ }
+ }
+
+ return annotatedMethod.getJavaMember();
+ }
+ }
+ }
+ }
+ }
+ return null;
+
+ }
+
+ /**
+ * JavaEE components can not inject {@link javax.enterprise.inject.spi.InjectionPoint}.
+ * @param clazz javaee component class info
+ * @throws WebBeansConfigurationException exception if condition is not applied
+ */
+ public void checkInjectionPointForInjectInjectionPoint(Class<?> clazz)
+ {
+ Asserts.nullCheckForClass(clazz);
+ Field[] fields = webBeansContext.getSecurityService().doPrivilegedGetDeclaredFields(clazz);
+ for(Field field : fields)
+ {
+ if(field.getAnnotation(Inject.class) != null)
+ {
+ if(field.getType() == InjectionPoint.class)
+ {
+ Annotation[] anns = getQualifierAnnotations(field.getDeclaredAnnotations());
+ if (AnnotationUtil.hasAnnotation(anns, Default.class))
+ {
+ throw new WebBeansConfigurationException("Java EE Component class : " + clazz + " can not inject InjectionPoint");
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnyLiteral.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnyLiteral.java
new file mode 100644
index 0000000..95fd2ec
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnyLiteral.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.annotation;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.inject.Any;
+
+public class AnyLiteral extends EmptyAnnotationLiteral<Any> implements Any
+{
+ public static final AnyLiteral INSTANCE = new AnyLiteral();
+ public static final Annotation[] ARRAY = new Annotation[]{AnyLiteral.INSTANCE};
+
+ private static final String TOSTRING = "@javax.enterprise.inject.Any()";
+ private static final long serialVersionUID = -8922048102786275371L;
+
+ @Override
+ public String toString()
+ {
+ // implemented for performance reasons
+ return TOSTRING;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/ApplicationScopeLiteral.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/ApplicationScopeLiteral.java
new file mode 100644
index 0000000..9b7ffca
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/ApplicationScopeLiteral.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.annotation;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.util.AnnotationLiteral;
+
+/**
+ * {@link javax.enterprise.context.RequestScoped} literal annotation.
+ *
+ * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
+ * @since 1.0
+ */
+public class ApplicationScopeLiteral extends AnnotationLiteral<ApplicationScoped> implements ApplicationScoped
+{
+
+ private static final long serialVersionUID = 8089948111744513390L;
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/Decorated.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/Decorated.java
new file mode 100644
index 0000000..43df4c2
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/Decorated.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.annotation;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Target({ PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@Qualifier
+public @interface Decorated
+{
+}
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/DefaultLiteral.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/DefaultLiteral.java
new file mode 100644
index 0000000..51bd676
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/DefaultLiteral.java
@@ -0,0 +1,44 @@
+/*
+ * 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.webbeans.annotation;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.inject.Default;
+
+/**
+ * {@link Default} literal annotation.
+ *
+ * @since 1.0
+ */
+public class DefaultLiteral extends EmptyAnnotationLiteral<Default> implements Default
+{
+ public static final DefaultLiteral INSTANCE = new DefaultLiteral();
+ public static final Annotation[] ARRAY = new Annotation[]{DefaultLiteral.INSTANCE};
+
+ private static final String TOSTRING = "@javax.enterprise.inject.Default()";
+ private static final long serialVersionUID = 6788272256977634238L;
+
+ @Override
+ public String toString()
+ {
+ // implemented for performance reasons
+ return TOSTRING;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/DependentScopeLiteral.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/DependentScopeLiteral.java
new file mode 100644
index 0000000..18b98fb
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/DependentScopeLiteral.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.annotation;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.util.AnnotationLiteral;
+
+/**
+ * {@link Dependent} literal annotation.
+ *
+ * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
+ * @since 1.0
+ */
+public class DependentScopeLiteral extends AnnotationLiteral<Dependent> implements Dependent
+{
+
+ private static final long serialVersionUID = -2677299920840834714L;
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/EmptyAnnotationLiteral.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/EmptyAnnotationLiteral.java
new file mode 100644
index 0000000..d7e25de
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/EmptyAnnotationLiteral.java
@@ -0,0 +1,121 @@
+/*
+ * 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.webbeans.annotation;
+
+import javax.enterprise.util.AnnotationLiteral;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+
+/**
+ * Base class for AnnotationLiterals which have no members.
+ * @param <T>
+ */
+public abstract class EmptyAnnotationLiteral<T extends Annotation> extends AnnotationLiteral<T>
+{
+ private Class<T> annotationType;
+
+ protected EmptyAnnotationLiteral()
+ {
+ // Leave this constructor protected, because an EmptyAnnotationLiteral may never directly be instantiated
+ }
+
+ /**
+ * Implemented for compatibility reasons with other cdi-api jar's.
+ * See OWB-802.
+ */
+ @Override
+ public Class<? extends Annotation> annotationType()
+ {
+ if (annotationType == null)
+ {
+ annotationType = getAnnotationType(getClass());
+ }
+ return annotationType;
+ }
+
+ /**
+ * Implemented for performance reasons.
+ * This is needed because an Annotation always returns 0 as hashCode
+ * if there is no method in it.
+ * Contrary to this the generic {@link javax.enterprise.util.AnnotationLiteral#hashCode()}
+ * always does search for methods via reflection and only then returns 0.
+ * Not very well performing ...
+ * @return always 0
+ */
+ @Override
+ public int hashCode()
+ {
+ return 0;
+ }
+
+ /**
+ * Just checks whether the 2 classes have the same annotationType.
+ * We do not need to dynamically evaluate the member values via reflection
+ * as there are no members in this annotation at all.
+ */
+ @Override
+ public boolean equals(final Object other)
+ {
+ // implemented for performance reasons
+ return Annotation.class.isInstance(other) &&
+ Annotation.class.cast(other).annotationType().equals(annotationType());
+ }
+
+ private Class<T> getAnnotationType(Class<?> definedClazz)
+ {
+ Type superClazz = definedClazz.getGenericSuperclass();
+
+ Class<T> clazz = null;
+
+ if (superClazz.equals(Object.class))
+ {
+ throw new RuntimeException("Super class must be parametrized type!");
+ }
+ else if (superClazz instanceof ParameterizedType)
+ {
+ ParameterizedType paramType = (ParameterizedType) superClazz;
+ Type[] actualArgs = paramType.getActualTypeArguments();
+
+ if (actualArgs.length == 1)
+ {
+ //Actual annotation type
+ Type type = actualArgs[0];
+
+ if (type instanceof Class)
+ {
+ clazz = (Class<T>) type;
+ return clazz;
+ }
+ else
+ {
+ throw new RuntimeException("Not class type!");
+ }
+ }
+ else
+ {
+ throw new RuntimeException("More than one parametric type!");
+ }
+ }
+ else
+ {
+ return getAnnotationType((Class<?>) superClazz);
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/Intercepted.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/Intercepted.java
new file mode 100644
index 0000000..ce61f56
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/Intercepted.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.annotation;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Target({ PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@Qualifier
+public @interface Intercepted
+{
+}
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NamedLiteral.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NamedLiteral.java
new file mode 100644
index 0000000..be99c9d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NamedLiteral.java
@@ -0,0 +1,56 @@
+/*
+ * 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.webbeans.annotation;
+
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Named;
+
+/**
+ * Named literal.
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public class NamedLiteral extends AnnotationLiteral<Named> implements Named
+{
+
+ private static final long serialVersionUID = 8867272511520063730L;
+ private String value;
+
+ public NamedLiteral()
+ {
+
+ }
+
+ public NamedLiteral(String value)
+ {
+ this.value = value;
+ }
+
+ @Override
+ public String value()
+ {
+ return value;
+ }
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NewLiteral.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NewLiteral.java
new file mode 100644
index 0000000..4091468
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NewLiteral.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.annotation;
+
+import javax.enterprise.inject.New;
+import javax.enterprise.util.AnnotationLiteral;
+
+/**
+ * {@link New} literal annotation.
+ *
+ * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
+ * @since 1.0
+ */
+public class NewLiteral extends AnnotationLiteral<New> implements New
+{
+ private static final long serialVersionUID = -2981014729208063412L;
+ private Class<?> clazz = null;
+
+ public NewLiteral()
+ {
+ clazz = New.class;
+ }
+
+ public NewLiteral(Class<?> clazz)
+ {
+ this.clazz = clazz;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public Class<?> value()
+ {
+ return clazz;
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/RequestedScopeLiteral.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/RequestedScopeLiteral.java
new file mode 100644
index 0000000..bdace1f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/RequestedScopeLiteral.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.annotation;
+
+import javax.enterprise.context.RequestScoped;
+
+/**
+ * {@link RequestScoped} literal annotation.
+ *
+ * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
+ * @since 1.0
+ */
+public class RequestedScopeLiteral extends EmptyAnnotationLiteral<RequestScoped> implements RequestScoped
+{
+
+ private static final long serialVersionUID = -7333612898060695008L;
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/SessionScopeLiteral.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/SessionScopeLiteral.java
new file mode 100644
index 0000000..4e993f5
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/SessionScopeLiteral.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.annotation;
+
+import javax.enterprise.context.SessionScoped;
+
+/**
+ * {@link javax.enterprise.context.RequestScoped} literal annotation.
+ *
+ * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
+ * @since 1.0
+ */
+public class SessionScopeLiteral extends EmptyAnnotationLiteral<SessionScoped> implements SessionScoped
+{
+
+ private static final long serialVersionUID = -7469945140661485990L;
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/boot/Bootstrap.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/boot/Bootstrap.java
new file mode 100644
index 0000000..c2eab30
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/boot/Bootstrap.java
@@ -0,0 +1,81 @@
+/*
+ * 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.webbeans.boot;
+
+import java.util.Properties;
+import java.util.concurrent.CountDownLatch;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.spi.ContainerLifecycle;
+
+public class Bootstrap
+{
+ private static final Logger log = WebBeansLoggerFacade.getLogger(Bootstrap.class);
+
+ private final CountDownLatch latch = new CountDownLatch(1);
+
+ private ContainerLifecycle containerLifecycle = null;
+
+ private Properties properties = null;
+
+ @SuppressWarnings("deprecated")
+ public void init(Properties properties)
+ {
+ log.info(OWBLogConst.INFO_0006);
+ //this relies on DefaultSingletonService to instantiate the WebBeansContext
+ containerLifecycle = WebBeansContext.getInstance().getService(ContainerLifecycle.class);
+ }
+
+ public void start() throws InterruptedException
+ {
+ log.info(OWBLogConst.INFO_0005);
+ long begin = System.currentTimeMillis();
+
+ containerLifecycle.startApplication(properties);
+ Runtime.getRuntime().addShutdownHook(new Thread(){
+
+ @Override
+ public void run()
+ {
+ latch.countDown();
+ }
+
+ });
+
+ log.log(Level.INFO, OWBLogConst.INFO_0001, Long.toString(System.currentTimeMillis() - begin));
+ latch.await();
+
+ log.info(OWBLogConst.INFO_0008);
+
+ containerLifecycle.stopApplication(properties);
+
+ log.info(OWBLogConst.INFO_0009);
+ }
+
+ public static void main(String []args)
+ {
+ Bootstrap boot = new Bootstrap();
+ boot.init(System.getProperties());
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractOwbBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractOwbBean.java
new file mode 100644
index 0000000..6640457
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractOwbBean.java
@@ -0,0 +1,413 @@
+/*
+ * 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.webbeans.component;
+
+import org.apache.webbeans.component.spi.BeanAttributes;
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.creational.CreationalContextImpl;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.CreationException;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.enterprise.inject.spi.PassivationCapable;
+import javax.enterprise.inject.spi.Producer;
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Abstract implementation of the {@link OwbBean} contract.
+ *
+ * @version $Rev$ $Date$
+ *
+ * @see javax.enterprise.inject.spi.Bean
+ *
+ */
+public abstract class AbstractOwbBean<T>
+ extends BeanAttributesImpl<T>
+ implements OwbBean<T>, PassivationCapable
+{
+ /**Logger instance*/
+ protected Logger logger = null;
+
+ /** Web Beans type */
+ protected WebBeansType webBeansType;
+
+ /** the bean class */
+ private final Class<?> beanClass;
+
+ /**This bean is specialized or not*/
+ protected boolean specializedBean;
+
+ /**This bean is enabled or disabled*/
+ protected boolean enabled = true;
+
+ /**
+ * This string will be used for passivating the Bean.
+ * It will be created on the first use.
+ * @see #getId()
+ */
+ protected String passivatingId = null;
+
+ protected final WebBeansContext webBeansContext;
+
+ protected AbstractOwbBean(WebBeansContext webBeansContext,
+ WebBeansType webBeansType,
+ BeanAttributes<T> beanAttributes,
+ Class<?> beanClass,
+ boolean nullable)
+ {
+ super(beanAttributes, nullable);
+ this.webBeansType = webBeansType;
+ this.beanClass = beanClass;
+ this.webBeansContext = webBeansContext;
+ }
+
+ /**
+ * Get the web beans context this bean is associated with
+ *
+ * @return WebBeansContext this bean is associated with
+ */
+ @Override
+ public WebBeansContext getWebBeansContext()
+ {
+ return webBeansContext;
+ }
+
+ @Override
+ public Class<?> getBeanClass()
+ {
+ return beanClass;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public T create(CreationalContext<T> creationalContext)
+ {
+ try
+ {
+ if(!(creationalContext instanceof CreationalContextImpl))
+ {
+ creationalContext = webBeansContext.getCreationalContextFactory().wrappedCreationalContext(creationalContext, this);
+ }
+
+ final Producer<T> producer = getProducer();
+ final T instance = producer.produce(creationalContext);
+ if (producer instanceof InjectionTarget)
+ {
+ final InjectionTarget<T> injectionTarget = (InjectionTarget<T>)producer;
+ injectionTarget.inject(instance, creationalContext);
+ injectionTarget.postConstruct(instance);
+ }
+ if (getScope().equals(Dependent.class))
+ {
+ ((CreationalContextImpl<T>)creationalContext).addDependent(this, instance);
+ }
+ return instance;
+ }
+ catch (Exception re)
+ {
+ Throwable throwable = getRootException(re);
+
+ if(!(throwable instanceof RuntimeException))
+ {
+ throw new CreationException(throwable);
+ }
+ throw (RuntimeException) throwable;
+ }
+
+ }
+
+ private Throwable getRootException(Throwable throwable)
+ {
+ if(throwable.getCause() == null || throwable.getCause() == throwable)
+ {
+ return throwable;
+ }
+ else
+ {
+ return getRootException(throwable.getCause());
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @param creationalContext the contextual instance has been created in
+ */
+ @Override
+ public void destroy(T instance, CreationalContext<T> creationalContext)
+ {
+ if (getScope().equals(Dependent.class)
+ && creationalContext instanceof CreationalContextImpl
+ && ((CreationalContextImpl<T>)creationalContext).containsDependent(this, instance))
+ {
+ // we just have to call release, because release will destroy us since we are @Dependent
+ creationalContext.release();
+ return;
+ }
+ try
+ {
+ Producer<T> producer = getProducer();
+ if (producer instanceof InjectionTarget)
+ {
+ InjectionTarget<T> injectionTarget = (InjectionTarget<T>)producer;
+ injectionTarget.preDestroy(instance);
+ }
+ producer.dispose(instance);
+ //Destroy dependent instances
+ creationalContext.release();
+ }
+ catch(Exception e)
+ {
+ getLogger().log(Level.SEVERE, WebBeansLoggerFacade.constructMessage(OWBLogConst.FATAL_0001, this), e);
+ }
+ }
+
+ /**
+ * get the unique Id of the bean. This will get used as reference on
+ * passivation.
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public String getId()
+ {
+ if (!isEnabled() || getReturnType().equals(Object.class))
+ {
+ // if the Bean is disabled, either by rule, or by
+ // annotating it @Typed() as Object, then it is not serializable
+ return null;
+ }
+ if (passivatingId == null)
+ {
+ StringBuilder sb = new StringBuilder(webBeansType.toString()).append('#');
+ sb.append(getReturnType()).append('#');
+ for (Annotation qualifier : getQualifiers())
+ {
+ sb.append(qualifier.toString()).append(',');
+ }
+
+ passivatingId = sb.toString();
+ }
+
+ return passivatingId;
+ }
+
+ @Override
+ public boolean isPassivationCapable()
+ {
+ if (isPassivationCapable != null)
+ {
+ return isPassivationCapable;
+ }
+ if(Serializable.class.isAssignableFrom(getReturnType()))
+ {
+ isPassivationCapable = Boolean.TRUE;
+ return true;
+ }
+ isPassivationCapable = Boolean.FALSE;
+ return false;
+ }
+
+ /** cache previously calculated result */
+ private Boolean isPassivationCapable = null;
+
+ /**
+ * Get web bean type of the bean.
+ *
+ * @return web beans type
+ */
+ @Override
+ public WebBeansType getWebBeansType()
+ {
+ return webBeansType;
+ }
+
+ /**
+ * Gets type of the producer method/field or the bean class if it's not a producer.
+ * This basically determines the class which will get created.
+ *
+ * @return type of the producer method
+ * @see #getBeanClass()
+ */
+ @Override
+ public Class<T> getReturnType()
+ {
+ return (Class<T>) getBeanClass();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ return getProducer().getInjectionPoints();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setSpecializedBean(boolean specialized)
+ {
+ specializedBean = specialized;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setEnabled(boolean enabled)
+ {
+ this.enabled = enabled;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isSpecializedBean()
+ {
+ return specializedBean;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isAlternative()
+ {
+ return webBeansContext.getAlternativesManager().isBeanHasAlternative(this);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isEnabled()
+ {
+ return enabled;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder();
+ final String simpleName = getReturnType().getSimpleName();
+ builder.append(simpleName).append(", ");
+ builder.append("Name:").append(getName()).append(", WebBeans Type:").append(getWebBeansType());
+ builder.append(", API Types:[");
+
+ int size = getTypes().size();
+ int index = 1;
+ for(Type clazz : getTypes())
+ {
+ if(clazz instanceof Class)
+ {
+ builder.append(((Class<?>)clazz).getName());
+ }
+ else
+ {
+ ParameterizedType parameterizedType = (ParameterizedType) clazz;
+ Class<?> rawType = (Class<?>) parameterizedType.getRawType();
+ builder.append(rawType.getName());
+ builder.append("<");
+ Type[] actualTypeArguments = parameterizedType.getActualTypeArguments();
+ if (actualTypeArguments.length > 0)
+ {
+ for (Type actualType : actualTypeArguments)
+ {
+ if (Class.class.isInstance(actualType))
+ {
+ builder.append(Class.class.cast(actualType).getName().replace("java.lang.", ""));
+ }
+ else
+ {
+ builder.append(actualType);
+ }
+ builder.append(",");
+ }
+ }
+ builder.delete(builder.length() - 1, builder.length());
+ builder.append(">");
+
+ }
+
+ if(index < size)
+ {
+ builder.append(",");
+ }
+
+ index++;
+ }
+
+ builder.append("], ");
+ builder.append("Qualifiers:[");
+
+ size = getQualifiers().size();
+ index = 1;
+ for(Annotation ann : getQualifiers())
+ {
+ builder.append(ann.annotationType().getName());
+
+ if(index < size)
+ {
+ builder.append(",");
+ }
+
+ index++;
+ }
+
+ builder.append("]");
+
+ return builder.toString();
+ }
+
+ /**
+ * The Logger should really only be used to log errors!
+ */
+ protected synchronized Logger getLogger()
+ {
+ if (logger == null)
+ {
+ logger = WebBeansLoggerFacade.getLogger(getClass());
+ }
+ return logger;
+ }
+
+ @Override
+ public boolean isDependent()
+ {
+ return getScope().equals(Dependent.class);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractProducerBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractProducerBean.java
new file mode 100644
index 0000000..5ba0b86
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractProducerBean.java
@@ -0,0 +1,126 @@
+/*
+ * 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.webbeans.component;
+
+import java.io.Serializable;
+import java.lang.reflect.Modifier;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.PassivationCapable;
+import javax.enterprise.inject.spi.Producer;
+
+import org.apache.webbeans.component.spi.BeanAttributes;
+import org.apache.webbeans.component.spi.ProducerFactory;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.util.WebBeansUtil;
+
+
+/**
+ * Abstract class for producer components.
+ *
+ * @version $Rev$ $Date$
+ * @param <T> bean type info
+ */
+public class AbstractProducerBean<T> extends AbstractOwbBean<T> implements PassivationCapable
+{
+ private Class<T> returnType;
+ private Producer<T> producer;
+
+ /**
+ * Create a new instance.
+ *
+ * @param returnType bean type info
+ * @param ownerBeanClass class which contains this producer method or field
+ */
+ public AbstractProducerBean(Class<?> ownerBeanClass,
+ WebBeansContext webBeansContext,
+ WebBeansType webBeansType,
+ BeanAttributes<T> beanAttributes,
+ Class<T> returnType,
+ ProducerFactory<?> producerFactory)
+ {
+ super(webBeansContext, webBeansType, beanAttributes, ownerBeanClass, !returnType.isPrimitive());
+ this.returnType = returnType;
+ producer = producerFactory.createProducer(this);
+ }
+
+ @Override
+ public Producer<T> getProducer()
+ {
+ return producer;
+ }
+
+ @Override
+ public Class<T> getReturnType()
+ {
+ return returnType;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void dispose(T instance, CreationalContext<T> creationalContext)
+ {
+ // Do nothing
+ }
+
+ /**
+ * Check null control.
+ *
+ * @param instance bean instance
+ */
+ protected void checkNullInstance(Object instance, String producerName)
+ {
+ String errorMessage = "WebBeans producer : %s" +
+ " return type in the component implementation class : %s" +
+ " scope type must be @Dependent to create null instance";
+ WebBeansUtil.checkNullInstance(instance, getScope(), errorMessage, producerName,
+ getBeanClass().getName());
+ }
+
+ /**
+ * Check passivation check.
+ */
+ protected void checkScopeType(String producerName)
+ {
+ String errorMessage = "WebBeans producer : %s" +
+ " return type in the component implementation class : %s" +
+ " with passivating scope @%s" +
+ " must be Serializable";
+ getWebBeansContext().getWebBeansUtil().checkSerializableScopeType(getScope(),
+ Serializable.class.isAssignableFrom(getReturnType()), errorMessage, producerName, getBeanClass().getName(),
+ getScope().getName());
+
+ }
+
+ protected boolean isPassivationCapable(Class<?> returnType, Integer modifiers)
+ {
+ if(Modifier.isFinal(modifiers) && !(Serializable.class.isAssignableFrom(returnType)))
+ {
+ return false;
+ }
+
+ if(returnType.isPrimitive() || Serializable.class.isAssignableFrom(returnType))
+ {
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/BeanAttributesImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/BeanAttributesImpl.java
new file mode 100644
index 0000000..8fd01d4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/BeanAttributesImpl.java
@@ -0,0 +1,152 @@
+/*
+ * 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.webbeans.component;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.spi.Bean;
+
+import org.apache.webbeans.component.spi.BeanAttributes;
+import org.apache.webbeans.util.AnnotationUtil;
+
+public class BeanAttributesImpl<T> implements BeanAttributes<T>
+{
+ private final Set<Type> types;
+ private final Set<Annotation> qualifiers;
+ private final Class<? extends Annotation> scope;
+ private final String name;
+ private final boolean nullable;
+ private final Set<Class<? extends Annotation>> stereotypes;
+ private final boolean alternative;
+
+ /**
+ * TODO This constructor can be removed, when we move to CDI 1.1 since {@link Bean} extends BeanAttributes.
+ */
+ public BeanAttributesImpl(Bean<T> bean)
+ {
+ this(bean.getTypes(),
+ bean.getQualifiers(),
+ bean.getScope(),
+ bean.getName(),
+ bean.isNullable(),
+ bean.getStereotypes(),
+ bean.isAlternative());
+ }
+
+ public BeanAttributesImpl(BeanAttributes<T> beanAttributes, boolean nullable)
+ {
+ this(beanAttributes.getTypes(),
+ beanAttributes.getQualifiers(),
+ beanAttributes.getScope(),
+ beanAttributes.getName(),
+ nullable,
+ beanAttributes.getStereotypes(),
+ beanAttributes.isAlternative());
+ }
+
+ public BeanAttributesImpl(Set<Type> types)
+ {
+ this(types, AnnotationUtil.DEFAULT_AND_ANY_ANNOTATION, Dependent.class, null, false, Collections.<Class<? extends Annotation>>emptySet(), false);
+ }
+
+ public BeanAttributesImpl(Set<Type> types, Set<Annotation> qualifiers)
+ {
+ this(types, qualifiers, Dependent.class, null, false, Collections.<Class<? extends Annotation>>emptySet(), false);
+ }
+
+ public BeanAttributesImpl(Set<Type> types,
+ Set<Annotation> qualifiers,
+ Class<? extends Annotation> scope)
+ {
+ this(types, qualifiers, scope, null, false, Collections.<Class<? extends Annotation>>emptySet(), false);
+ }
+
+ public BeanAttributesImpl(Set<Type> types,
+ Set<Annotation> qualifiers,
+ Class<? extends Annotation> scope,
+ Set<Class<? extends Annotation>> stereotypes)
+ {
+ this(types, qualifiers, scope, null, false, stereotypes, false);
+ }
+
+ public BeanAttributesImpl(Set<Type> types,
+ Set<Annotation> qualifiers,
+ Class<? extends Annotation> scope,
+ String name,
+ boolean nullable,
+ Set<Class<? extends Annotation>> stereotypes,
+ boolean alternative)
+ {
+ this.types = types == null? Collections.<Type>emptySet(): Collections.unmodifiableSet(new HashSet<Type>(types));
+ this.qualifiers = qualifiers == null? Collections.<Annotation>emptySet(): Collections.unmodifiableSet(new HashSet<Annotation>(qualifiers));
+ this.scope = scope;
+ this.name = name;
+ this.nullable = nullable;
+ this.stereotypes = stereotypes == null
+ ? Collections.<Class<? extends Annotation>>emptySet()
+ : Collections.unmodifiableSet(new HashSet<Class<? extends Annotation>>(stereotypes));
+ this.alternative = alternative;
+ }
+
+ @Override
+ public Set<Type> getTypes()
+ {
+ return types;
+ }
+
+ @Override
+ public Set<Annotation> getQualifiers()
+ {
+ return qualifiers;
+ }
+
+ @Override
+ public Class<? extends Annotation> getScope()
+ {
+ return scope;
+ }
+
+ @Override
+ public String getName()
+ {
+ return name;
+ }
+
+ public boolean isNullable()
+ {
+ return nullable;
+ }
+
+ @Override
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return stereotypes;
+ }
+
+ @Override
+ public boolean isAlternative()
+ {
+ return alternative;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/BeanManagerBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/BeanManagerBean.java
new file mode 100644
index 0000000..5161163
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/BeanManagerBean.java
@@ -0,0 +1,50 @@
+/*
+ * 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.webbeans.component;
+
+import java.lang.reflect.Type;
+
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.portable.BeanManagerProducer;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.CollectionUtil;
+
+public class BeanManagerBean extends BuiltInOwbBean<BeanManager>
+{
+ public BeanManagerBean(WebBeansContext webBeansContext)
+ {
+ super(webBeansContext,
+ WebBeansType.MANAGER,
+ new BeanAttributesImpl<BeanManager>(CollectionUtil.<Type>unmodifiableSet(BeanManager.class, Object.class), AnnotationUtil.DEFAULT_AND_ANY_ANNOTATION),
+ BeanManager.class,
+ false,
+ new SimpleProducerFactory<BeanManager>(new BeanManagerProducer(webBeansContext)));
+ }
+
+ /**
+ * @see org.apache.webbeans.component.AbstractOwbBean#isPassivationCapable()
+ */
+ @Override
+ public boolean isPassivationCapable()
+ {
+ return true;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/BeanMetadataBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/BeanMetadataBean.java
new file mode 100644
index 0000000..b3e46f2
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/BeanMetadataBean.java
@@ -0,0 +1,59 @@
+/*
+ * 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.webbeans.component;
+
+import java.lang.reflect.Type;
+
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.util.TypeLiteral;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.portable.MetadataProducer;
+import org.apache.webbeans.util.CollectionUtil;
+
+/**
+ * Implicit metadata bean definition.
+ *
+ * @version $Rev: 1493478 $ $Date: 2013-06-16 11:19:42 +0200 (So, 16 Jun 2013) $
+ */
+public class BeanMetadataBean<T> extends BuiltInOwbBean<Bean<T>>
+{
+
+ @SuppressWarnings("serial")
+ public BeanMetadataBean(WebBeansContext webBeansContext)
+ {
+ super(webBeansContext,
+ WebBeansType.METADATA,
+ new BeanAttributesImpl<Bean<T>>(CollectionUtil.<Type>unmodifiableSet(Bean.class, Contextual.class, Object.class)),
+ new TypeLiteral<Bean<T>>(){}.getRawType(),
+ false,
+ new SimpleProducerFactory<Bean<T>>(new MetadataProducer<Bean<T>>()));
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.webbeans.component.AbstractOwbBean#isPassivationCapable()
+ */
+ @Override
+ public boolean isPassivationCapable()
+ {
+ return true;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/BuiltInOwbBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/BuiltInOwbBean.java
new file mode 100644
index 0000000..6461b09
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/BuiltInOwbBean.java
@@ -0,0 +1,59 @@
+/*
+ * 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.webbeans.component;
+
+import java.lang.reflect.Type;
+
+import javax.enterprise.inject.spi.Producer;
+
+import org.apache.webbeans.util.Asserts;
+import org.apache.webbeans.util.CollectionUtil;
+
+import org.apache.webbeans.component.spi.ProducerFactory;
+import org.apache.webbeans.config.WebBeansContext;
+
+public abstract class BuiltInOwbBean<T> extends AbstractOwbBean<T>
+{
+
+ private Producer<T> producer;
+
+ protected BuiltInOwbBean(WebBeansContext webBeansContext, WebBeansType webBeansType, Class<T> returnType, ProducerFactory<T> producerFactory)
+ {
+ this(webBeansContext, webBeansType, new BeanAttributesImpl<T>(CollectionUtil.<Type>unmodifiableSet(returnType, Object.class)), returnType, false, producerFactory);
+ }
+
+ protected BuiltInOwbBean(
+ WebBeansContext webBeansContext,
+ WebBeansType webBeansType,
+ BeanAttributesImpl<T> beanAttributes,
+ Class<T> returnType,
+ boolean nullable,
+ ProducerFactory<T> producerFactory)
+ {
+ super(webBeansContext, webBeansType, beanAttributes, returnType, nullable);
+ Asserts.assertNotNull(producerFactory, "ProducerFactory may not be null");
+ producer = producerFactory.createProducer(this);
+ }
+
+ @Override
+ public Producer<T> getProducer()
+ {
+ return producer;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/CdiInterceptorBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/CdiInterceptorBean.java
new file mode 100644
index 0000000..495f999
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/CdiInterceptorBean.java
@@ -0,0 +1,62 @@
+/*
+ * 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.webbeans.component;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InterceptionType;
+import javax.enterprise.inject.spi.PassivationCapable;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+
+/**
+ * <p>{@link javax.enterprise.inject.spi.Interceptor}
+ * Bean implementation for CDI-style Beans.
+ * This is Interceptors which got defined using
+ * @{@link javax.interceptor.InterceptorBinding}.</p>
+ */
+public class CdiInterceptorBean<T> extends InterceptorBean<T> implements PassivationCapable
+{
+
+ private Set<Annotation> interceptorBindings;
+
+ public CdiInterceptorBean(WebBeansContext webBeansContext,
+ AnnotatedType<T> annotatedType,
+ BeanAttributesImpl<T> beanAttributes,
+ Class<T> beanClass,
+ Set<Annotation> interceptorBindings,
+ boolean enabled,
+ Map<InterceptionType, Method[]> interceptionMethods,
+ Method aroundConstruct)
+ {
+ super(webBeansContext, annotatedType, beanAttributes, beanClass, interceptionMethods, aroundConstruct);
+ this.interceptorBindings = interceptorBindings;
+ }
+
+ @Override
+ public Set<Annotation> getInterceptorBindings()
+ {
+ return interceptorBindings;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/ConversationBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/ConversationBean.java
new file mode 100644
index 0000000..b00a3e6
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/ConversationBean.java
@@ -0,0 +1,64 @@
+/*
+ * 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.webbeans.component;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collections;
+
+import javax.enterprise.context.Conversation;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.spi.PassivationCapable;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.conversation.ConversationImpl;
+import org.apache.webbeans.portable.ConversationProducer;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.CollectionUtil;
+
+/**
+ * Conversation bean implementation.
+ * @version $Rev$ $Date$
+ *
+ */
+public class ConversationBean extends BuiltInOwbBean<ConversationImpl> implements InterceptedMarker, PassivationCapable
+{
+ /**
+ * Default constructor.
+ * @param webBeansContext
+ */
+ public ConversationBean(WebBeansContext webBeansContext)
+ {
+ super(webBeansContext,
+ WebBeansType.CONVERSATION,
+ new BeanAttributesImpl<ConversationImpl>(
+ CollectionUtil.<Type>unmodifiableSet(Conversation.class, ConversationImpl.class, Object.class),
+ AnnotationUtil.DEFAULT_AND_ANY_ANNOTATION,
+ RequestScoped.class,
+ "javax.enterprise.context.conversation",
+ false,
+ Collections.<Class<? extends Annotation>>emptySet(),
+ false),
+ ConversationImpl.class,
+ false,
+ new SimpleProducerFactory<ConversationImpl>(
+ new ConversationProducer(webBeansContext.getAnnotatedElementFactory().newAnnotatedType(ConversationImpl.class), webBeansContext)));
+ setEnabled(true);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/DecoratorBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/DecoratorBean.java
new file mode 100644
index 0000000..63cd405
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/DecoratorBean.java
@@ -0,0 +1,86 @@
+/*
+ * 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.webbeans.component;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Decorator;
+import javax.enterprise.inject.spi.PassivationCapable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import org.apache.webbeans.component.spi.BeanAttributes;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.DecoratorInjectionTargetFactory;
+
+/**
+ * Decorator Bean implementation.
+ */
+public class DecoratorBean<T> extends InjectionTargetBean<T> implements Decorator<T>, PassivationCapable
+{
+ /**
+ * The Types the decorator itself implements
+ */
+ private Set<Type> decoratedTypes;
+
+ /**
+ * The Type of the @Delegate injection point.
+ */
+ private Type delegateType;
+
+ /**
+ * The Qualifiers of the @Delegate injection point.
+ */
+ private Set<Annotation> delegateQualifiers;
+
+
+ public DecoratorBean(WebBeansContext webBeansContext,
+ WebBeansType webBeansType,
+ AnnotatedType<T> annotatedType,
+ BeanAttributes<T> beanAttributes,
+ Class<T> beanClass)
+ {
+ super(webBeansContext, webBeansType, annotatedType, beanAttributes, beanClass, new DecoratorInjectionTargetFactory<T>(annotatedType, webBeansContext));
+ }
+
+ public void setDecoratorInfo(Set<Type> decoratedTypes, Type delegateType, Set<Annotation> delegateQualifiers)
+ {
+ this.decoratedTypes = decoratedTypes;
+ this.delegateType = delegateType;
+ this.delegateQualifiers = delegateQualifiers;
+ }
+
+ @Override
+ public Set<Type> getDecoratedTypes()
+ {
+ return decoratedTypes;
+ }
+
+ @Override
+ public Type getDelegateType()
+ {
+ return delegateType;
+ }
+
+ @Override
+ public Set<Annotation> getDelegateQualifiers()
+ {
+ return delegateQualifiers;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/DecoratorMetadataBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/DecoratorMetadataBean.java
new file mode 100644
index 0000000..1a3a9db
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/DecoratorMetadataBean.java
@@ -0,0 +1,58 @@
+/*
+ * 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.webbeans.component;
+
+import java.lang.reflect.Type;
+
+import javax.enterprise.inject.spi.Decorator;
+import javax.enterprise.util.TypeLiteral;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.portable.MetadataProducer;
+import org.apache.webbeans.util.CollectionUtil;
+
+/**
+ * Implicit metadata bean definition.
+ *
+ * @version $Rev: 1493478 $ $Date: 2013-06-16 11:19:42 +0200 (So, 16 Jun 2013) $
+ */
+public class DecoratorMetadataBean<T> extends BuiltInOwbBean<Decorator<T>>
+{
+
+ @SuppressWarnings("serial")
+ public DecoratorMetadataBean(WebBeansContext webBeansContext)
+ {
+ super(webBeansContext,
+ WebBeansType.METADATA,
+ new BeanAttributesImpl<Decorator<T>>(CollectionUtil.<Type>unmodifiableSet(Decorator.class, Object.class)),
+ new TypeLiteral<Decorator<T>>(){}.getRawType(),
+ false,
+ new SimpleProducerFactory<Decorator<T>>(new MetadataProducer<Decorator<T>>()));
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.webbeans.component.AbstractOwbBean#isPassivationCapable()
+ */
+ @Override
+ public boolean isPassivationCapable()
+ {
+ return true;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/EjbInterceptorBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/EjbInterceptorBean.java
new file mode 100644
index 0000000..b56fd29
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/EjbInterceptorBean.java
@@ -0,0 +1,61 @@
+/*
+ * 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.webbeans.component;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InterceptionType;
+import javax.enterprise.inject.spi.Interceptor;
+import javax.enterprise.inject.spi.PassivationCapable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+/**
+ * <p>{@link javax.enterprise.inject.spi.Interceptor} Bean implementation for EJB-style Beans.
+ * This is Interceptors which got defined by being referenced via
+ * @{@link javax.interceptor.Interceptors}.</p>
+ */
+public class EjbInterceptorBean<T> extends InterceptorBean<T> implements Interceptor<T>, PassivationCapable
+{
+
+ public EjbInterceptorBean(WebBeansContext webBeansContext,
+ AnnotatedType<T> annotated,
+ BeanAttributesImpl<T> beanAttributes,
+ Class<T> beanClass,
+ Map<InterceptionType, Method[]> interceptionMethods,
+ Method aroundConstruct)
+ {
+ super(webBeansContext, annotated, beanAttributes, beanClass, interceptionMethods, aroundConstruct);
+ }
+
+ /**
+ * @return always an empty Set as this interceptor doesn't have any InterceptorBindings
+ */
+ @Override
+ public Set<Annotation> getInterceptorBindings()
+ {
+ return Collections.emptySet();
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/EnterpriseBeanMarker.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/EnterpriseBeanMarker.java
new file mode 100644
index 0000000..4ecda3e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/EnterpriseBeanMarker.java
@@ -0,0 +1,31 @@
+/*
+ * 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.webbeans.component;
+
+/**
+ * Marker interface for enterprise beans.
+ * All those beans will not get intercepted.
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public interface EnterpriseBeanMarker
+{
+ public boolean isPassivationCapable();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/EventBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/EventBean.java
new file mode 100644
index 0000000..2381a7c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/EventBean.java
@@ -0,0 +1,62 @@
+/*
+ * 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.webbeans.component;
+
+import java.lang.reflect.Type;
+
+import javax.enterprise.event.Event;
+import javax.enterprise.util.TypeLiteral;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.portable.EventProducer;
+import org.apache.webbeans.util.CollectionUtil;
+
+/**
+ * Implicit observable bean definition.
+ *
+ * @version $Rev$ $Date$
+ */
+public class EventBean<T> extends BuiltInOwbBean<Event<T>>
+{
+
+ /**
+ * Creates a new instance of event bean.
+ * @param webBeansContext
+ */
+ @SuppressWarnings("serial")
+ public EventBean(WebBeansContext webBeansContext)
+ {
+ super(webBeansContext,
+ WebBeansType.OBSERVABLE,
+ new BeanAttributesImpl<Event<T>>(CollectionUtil.<Type>unmodifiableSet(new TypeLiteral<Event<T>>() {}.getRawType(), Object.class)),
+ new TypeLiteral<Event<T>>(){}.getRawType(),
+ false,
+ new SimpleProducerFactory<Event<T>>(new EventProducer<T>(webBeansContext)));
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.webbeans.component.AbstractOwbBean#isPassivationCapable()
+ */
+ @Override
+ public boolean isPassivationCapable()
+ {
+ return true;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/ExtensionBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/ExtensionBean.java
new file mode 100644
index 0000000..c0a7a88
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/ExtensionBean.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.component;
+
+import javax.enterprise.context.ApplicationScoped;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.util.AnnotationUtil;
+
+/**
+ * Extension service bean definition.
+ *
+ * @version $Rev$ $Date$
+ *
+ * @param <T> type info
+ */
+public class ExtensionBean<T> extends BuiltInOwbBean<T>
+{
+ /**
+ * Creates a new extesion bean.
+ *
+ * @param returnType return type
+ * @param webBeansContext
+ */
+ public ExtensionBean(WebBeansContext webBeansContext, Class<T> returnType)
+ {
+ super(webBeansContext,
+ WebBeansType.EXTENSION,
+ new BeanAttributesImpl<T>(
+ webBeansContext.getAnnotatedElementFactory().getAnnotatedType(returnType).getTypeClosure(),
+ AnnotationUtil.DEFAULT_AND_ANY_ANNOTATION,
+ ApplicationScoped.class),
+ returnType,
+ false,
+ new ExtensionProducerFactory<T>(webBeansContext.getAnnotatedElementFactory().getAnnotatedType(returnType), webBeansContext));
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/ExtensionProducerFactory.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/ExtensionProducerFactory.java
new file mode 100644
index 0000000..0ee6346
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/ExtensionProducerFactory.java
@@ -0,0 +1,51 @@
+/*
+ * 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.webbeans.component;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Producer;
+
+import org.apache.webbeans.component.spi.ProducerFactory;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.portable.ExtensionProducer;
+
+/**
+ * A factory for {@link javax.enterprise.inject.spi.Producer}s that produce CDI {@link javax.enterprise.inject.spi.Extension}s.
+ *
+ * @version $Rev: 1440403 $ $Date: 2013-01-30 14:27:15 +0100 (Mi, 30 Jan 2013) $
+ */
+public class ExtensionProducerFactory<T> implements ProducerFactory<T>
+{
+
+ private AnnotatedType<?> annotatedType;
+ private WebBeansContext webBeansContext;
+
+ public ExtensionProducerFactory(AnnotatedType<T> annotatedType, WebBeansContext webBeansContext)
+ {
+ this.annotatedType = annotatedType;
+ this.webBeansContext = webBeansContext;
+ }
+
+ @Override
+ public <P> Producer<P> createProducer(Bean<P> bean)
+ {
+ return new ExtensionProducer<P>((AnnotatedType<P>)annotatedType, bean, webBeansContext);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/IBeanHasParent.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/IBeanHasParent.java
new file mode 100644
index 0000000..e3fe4c7
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/IBeanHasParent.java
@@ -0,0 +1,28 @@
+/*
+ * 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.webbeans.component;
+
+import javax.enterprise.context.spi.CreationalContext;
+
+public interface IBeanHasParent<T>
+{
+ public InjectionTargetBean<?> getParent();
+
+ public void dispose(T instance, CreationalContext<T> creationalContext);
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionPointBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionPointBean.java
new file mode 100644
index 0000000..a70eb97
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionPointBean.java
@@ -0,0 +1,50 @@
+/*
+ * 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.webbeans.component;
+
+import java.lang.reflect.Type;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.portable.InjectionPointProducer;
+import org.apache.webbeans.util.CollectionUtil;
+
+public class InjectionPointBean extends BuiltInOwbBean<InjectionPoint>
+{
+ public InjectionPointBean(WebBeansContext webBeansContext)
+ {
+ super(webBeansContext,
+ WebBeansType.INJECTIONPOINT,
+ new BeanAttributesImpl<InjectionPoint>(CollectionUtil.<Type>unmodifiableSet(InjectionPoint.class, Object.class)),
+ InjectionPoint.class,
+ false,
+ new SimpleProducerFactory<InjectionPoint>(new InjectionPointProducer()));
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.webbeans.component.AbstractOwbBean#isPassivationCapable()
+ */
+ @Override
+ public boolean isPassivationCapable()
+ {
+ return true;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionTargetBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionTargetBean.java
new file mode 100644
index 0000000..d3bd657
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionTargetBean.java
@@ -0,0 +1,89 @@
+/*
+ * 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.webbeans.component;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+
+import org.apache.webbeans.component.spi.BeanAttributes;
+import org.apache.webbeans.component.spi.InjectionTargetFactory;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.InjectionTargetFactoryImpl;
+
+import javax.enterprise.inject.spi.InjectionTarget;
+
+import org.apache.webbeans.util.Asserts;
+
+/**
+ * Abstract class for injection target beans.
+ *
+ * @version $Rev$ $Date$
+ * @param <T> bean class
+ */
+public class InjectionTargetBean<T> extends AbstractOwbBean<T>
+{
+ /**Annotated type for bean*/
+ private AnnotatedType<T> annotatedType;
+ private InjectionTarget<T> injectionTarget;
+
+ public InjectionTargetBean(
+ WebBeansContext webBeansContext,
+ WebBeansType webBeansType,
+ AnnotatedType<T> annotatedType,
+ BeanAttributes<T> beanAttributes,
+ Class<T> beanClass)
+ {
+ this(webBeansContext, webBeansType, annotatedType, beanAttributes, beanClass, new InjectionTargetFactoryImpl<T>(annotatedType, webBeansContext));
+ }
+
+ /**
+ * Initializes the InjectionTarget Bean part.
+ */
+ public InjectionTargetBean(WebBeansContext webBeansContext,
+ WebBeansType webBeansType,
+ AnnotatedType<T> annotatedType,
+ BeanAttributes<T> beanAttributes,
+ Class<T> beanClass,
+ InjectionTargetFactory<T> factory)
+ {
+ super(webBeansContext, webBeansType, beanAttributes, beanClass, false);
+ Asserts.assertNotNull(annotatedType, "AnnotatedType may not be null");
+ this.annotatedType = annotatedType;
+ injectionTarget = factory.createInjectionTarget(this);
+ setEnabled(true);
+ }
+
+ @Override
+ public InjectionTarget<T> getProducer()
+ {
+ return injectionTarget;
+ }
+
+ public InjectionTarget<T> getInjectionTarget()
+ {
+ return injectionTarget;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public AnnotatedType<T> getAnnotatedType()
+ {
+ return annotatedType;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceBean.java
new file mode 100644
index 0000000..465216d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceBean.java
@@ -0,0 +1,59 @@
+/*
+ * 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.webbeans.component;
+
+import java.lang.reflect.Type;
+
+import javax.enterprise.inject.Instance;
+import javax.enterprise.util.TypeLiteral;
+import javax.inject.Provider;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.portable.InstanceProducer;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.CollectionUtil;
+
+public class InstanceBean<T> extends BuiltInOwbBean<Instance<T>>
+{
+
+ @SuppressWarnings("serial")
+ public InstanceBean(WebBeansContext webBeansContext)
+ {
+ super(webBeansContext,
+ WebBeansType.INSTANCE,
+ new BeanAttributesImpl<Instance<T>>(CollectionUtil.<Type>unmodifiableSet(
+ new TypeLiteral<Instance<T>>(){}.getRawType(),
+ new TypeLiteral<Provider<T>>() {}.getRawType(),
+ Object.class)),
+ new TypeLiteral<Instance<T>>(){}.getRawType(),
+ false,
+ new SimpleProducerFactory<Instance<T>>(
+ new InstanceProducer<T>(new TypeLiteral<Instance<T>>(){}.getRawType(), AnnotationUtil.DEFAULT_AND_ANY_ANNOTATION, webBeansContext)));
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.webbeans.component.AbstractOwbBean#isPassivationCapable()
+ */
+ @Override
+ public boolean isPassivationCapable()
+ {
+ return true;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptedMarker.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptedMarker.java
new file mode 100644
index 0000000..6adbc47
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptedMarker.java
@@ -0,0 +1,30 @@
+/*
+ * 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.webbeans.component;
+
+/**
+ * Marker interface for beans that
+ * can be intercepted.
+ * @version $Rev$ $Date$
+ *
+ */
+public interface InterceptedMarker
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptedOrDecoratedBeanMetadataBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptedOrDecoratedBeanMetadataBean.java
new file mode 100644
index 0000000..642d0ab
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptedOrDecoratedBeanMetadataBean.java
@@ -0,0 +1,65 @@
+/*
+ * 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.webbeans.component;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.enterprise.util.TypeLiteral;
+
+import org.apache.webbeans.annotation.Decorated;
+import org.apache.webbeans.annotation.Intercepted;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.portable.BeanMetadataProducer;
+import org.apache.webbeans.util.CollectionUtil;
+
+/**
+ * Implicit metadata bean definition.
+ *
+ * @version $Rev: 1493478 $ $Date: 2013-06-16 11:19:42 +0200 (So, 16 Jun 2013) $
+ */
+public class InterceptedOrDecoratedBeanMetadataBean<T> extends BuiltInOwbBean<Bean<T>>
+{
+
+ @SuppressWarnings("serial")
+ public InterceptedOrDecoratedBeanMetadataBean(WebBeansContext webBeansContext)
+ {
+ super(webBeansContext,
+ WebBeansType.METADATA,
+ new BeanAttributesImpl<Bean<T>>(
+ CollectionUtil.<Type>unmodifiableSet(Bean.class, Contextual.class, Object.class),
+ CollectionUtil.<Annotation>unmodifiableSet(new AnnotationLiteral<Intercepted>() {}, new AnnotationLiteral<Decorated>() {})),
+ new TypeLiteral<Bean<T>>(){}.getRawType(),
+ false,
+ new SimpleProducerFactory<Bean<T>>(new BeanMetadataProducer<Bean<T>>()));
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.webbeans.component.AbstractOwbBean#isPassivationCapable()
+ */
+ @Override
+ public boolean isPassivationCapable()
+ {
+ return true;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptorBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptorBean.java
new file mode 100644
index 0000000..2c26608
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptorBean.java
@@ -0,0 +1,300 @@
+/*
+ * 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.webbeans.component;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InterceptionType;
+import javax.enterprise.inject.spi.Interceptor;
+import javax.interceptor.InvocationContext;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.Map;
+
+import org.apache.webbeans.component.spi.BeanAttributes;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.InjectionTargetFactoryImpl;
+import org.apache.webbeans.container.InterceptorInjectionTargetFactory;
+import org.apache.webbeans.util.CDI11s;
+import org.apache.webbeans.util.ExceptionUtil;
+
+/**
+ * <p>Abstract {@link javax.enterprise.inject.spi.Interceptor} Bean implementation.
+ *
+ * <p>Any Interceptor is also an InjectionTarget as they can contain
+ * @Inject InjectionPoints.</p>
+ */
+public abstract class InterceptorBean<T> extends InjectionTargetBean<T> implements Interceptor<T>
+{
+
+ /**
+ * The Methods to be called per interception type.
+ * The method signature must be
+ * <pre>Object <METHOD>(InvocationContext) throws Exception</pre>
+ */
+ private Map<InterceptionType, Method[]> interceptionMethods;
+
+ /**
+ * This is for performance reasons
+ */
+ protected Method aroundInvokeMethod = null;
+ protected Method aroundConstructMethod = null;
+
+ protected InterceptorBean(WebBeansContext webBeansContext,
+ AnnotatedType<T> annotatedType,
+ BeanAttributes<T> beanAttributes,
+ Class<T> beanClass,
+ Map<InterceptionType, Method[]> interceptionMethods,
+ Method aroundConstruct,
+ InjectionTargetFactoryImpl<T> factory)
+ {
+ super(webBeansContext,
+ WebBeansType.INTERCEPTOR,
+ annotatedType,
+ beanAttributes,
+ beanClass,
+ factory);
+ this.interceptionMethods = Collections.unmodifiableMap(interceptionMethods);
+
+ for (Method[] methods: interceptionMethods.values())
+ {
+ for (Method method: methods)
+ {
+ if (!method.isAccessible())
+ {
+ method.setAccessible(true);
+ }
+ }
+ }
+
+ aroundConstructMethod = aroundConstruct;
+ if (aroundConstructMethod != null && !aroundConstructMethod.isAccessible())
+ {
+ aroundConstructMethod.setAccessible(true);
+ }
+
+ Method[] aroundInvokeMethods = interceptionMethods.get(InterceptionType.AROUND_INVOKE);
+ if (aroundInvokeMethods != null && aroundInvokeMethods.length == 1)
+ {
+ aroundInvokeMethod = aroundInvokeMethods[0];
+ }
+ }
+
+ public InterceptorBean(WebBeansContext webBeansContext,
+ AnnotatedType<T> annotatedType,
+ BeanAttributesImpl<T> beanAttributes,
+ Class<T> beanClass,
+ Map<InterceptionType, Method[]> interceptionMethods,
+ Method aroundConstructMethod)
+ {
+ this(webBeansContext, annotatedType, beanAttributes, beanClass, interceptionMethods, aroundConstructMethod,
+ new InterceptorInjectionTargetFactory<T>(annotatedType, webBeansContext));
+ }
+
+ /**
+ * Interceptors are by default @Dependent scoped.
+ */
+ @Override
+ public Class<? extends Annotation> getScope()
+ {
+ return Dependent.class;
+ }
+
+
+ /**
+ * @param interceptionType
+ * @return the underlying interceptor method for the given InterceptionType or <code>null</code>
+ */
+ public Method[] getInterceptorMethods(InterceptionType interceptionType)
+ {
+ return interceptionMethods.get(interceptionType);
+ }
+
+
+ @Override
+ public boolean intercepts(InterceptionType interceptionType)
+ {
+ return interceptionMethods.containsKey(interceptionType) || (interceptionType.equals(CDI11s.AROUND_CONSTRUCT) && aroundConstructMethod != null);
+ }
+
+ @Override
+ public Object intercept(InterceptionType interceptionType, T instance, InvocationContext invocationContext)
+ {
+ try
+ {
+ if (interceptionType.equals(CDI11s.AROUND_CONSTRUCT) && aroundConstructMethod != null)
+ {
+ return aroundConstructMethod.invoke(instance, invocationContext);
+ }
+
+ if (InterceptionType.AROUND_INVOKE == interceptionType && aroundInvokeMethod != null)
+ {
+ return aroundInvokeMethod.invoke(instance, invocationContext);
+ }
+
+ Method[] interceptorMethods = getInterceptorMethods(interceptionType);
+ if (interceptorMethods == null || interceptorMethods.length == 0)
+ {
+ // this very interceptor doesn't support this interception type.
+ // this might happen for lifecycle callback methods
+ // let's continue with the next interceptor
+ return invocationContext.proceed();
+ }
+ else if (interceptorMethods.length == 1)
+ {
+ // directly invoke the interceptor method with the given InvocationContext
+ if (interceptorMethods[0].getParameterTypes().length == 1)
+ {
+ return interceptorMethods[0].invoke(instance, invocationContext);
+ } // else it can be a @PostContruct void pc(); which shouldn't be called from here
+ else
+ {
+ return invocationContext.proceed();
+ }
+ }
+ else
+ {
+ // otherwise we need to wrap the InvocationContext into an own temporary InvocationContext
+ // which handles multiple interceptor methods at a time
+ if (invocationContext instanceof MultiMethodInvocationContext)
+ {
+ // this happens while we recurse through the interceptors which have multiple interceptor-methods
+ MultiMethodInvocationContext mmInvocationContext = (MultiMethodInvocationContext) invocationContext;
+ int methodIndex = mmInvocationContext.getCurrentInterceptorIdx();
+ if (methodIndex < (interceptorMethods.length -1))
+ {
+ return interceptorMethods[methodIndex].invoke(instance, invocationContext);
+ }
+ else
+ {
+ return interceptorMethods[methodIndex].invoke(instance, mmInvocationContext.getWrapped());
+ }
+ }
+ else
+ {
+ // We need to create the wrapper InvocationContext on the first time.
+ // This will internally walk through all the methods
+ MultiMethodInvocationContext mmInvocationContext
+ = new MultiMethodInvocationContext(invocationContext, interceptionType, instance, this);
+ return mmInvocationContext.proceed();
+ }
+ }
+ }
+ catch (InvocationTargetException ite)
+ {
+ throw ExceptionUtil.throwAsRuntimeException(ite.getCause());
+ }
+ catch (Exception e)
+ {
+ throw ExceptionUtil.throwAsRuntimeException(e);
+ }
+ }
+
+ /**
+ * An InvocationContext wraper for handling multiple interceptor methods.
+ * We will first make sure the own interceptor methods get handled and only
+ * then continue with the wrapped InvocationHandler.
+ */
+ public static class MultiMethodInvocationContext implements InvocationContext
+ {
+ private final InvocationContext wrapped;
+ private final Interceptor interceptor;
+ private final InterceptionType interceptionType;
+ private final Object instance;
+ private int currentInterceptorIdx;
+
+ public MultiMethodInvocationContext(InvocationContext wrapped,
+ InterceptionType interceptionType,
+ Object instance,
+ Interceptor interceptor)
+ {
+ this.wrapped = wrapped;
+ this.interceptor = interceptor;
+ this.interceptionType = interceptionType;
+ this.instance = instance;
+ currentInterceptorIdx = 0; // we start with method 0
+ }
+
+ public int getCurrentInterceptorIdx()
+ {
+ // in proceed we +1 to handle index properly whatever the stack is but we need to -1 here to not skip
+ // index 0 when we have multiple interceptors
+ return currentInterceptorIdx - 1;
+ }
+
+ public InvocationContext getWrapped()
+ {
+ return wrapped;
+ }
+
+ @Override
+ public Object proceed() throws Exception
+ {
+ currentInterceptorIdx++;
+ return interceptor.intercept(interceptionType, instance, this);
+ }
+
+
+ @Override
+ public Map<String, Object> getContextData()
+ {
+ return wrapped.getContextData();
+ }
+
+ @Override
+ public Method getMethod()
+ {
+ return wrapped.getMethod();
+ }
+
+ @Override
+ public Object getTarget()
+ {
+ return wrapped.getTarget();
+ }
+
+ @Override
+ public Object getTimer()
+ {
+ return wrapped.getTimer();
+ }
+
+ @Override
+ public Object[] getParameters()
+ {
+ return wrapped.getParameters();
+ }
+
+ @Override
+ public void setParameters(Object[] parameters)
+ {
+ wrapped.setParameters(parameters);
+ }
+
+ // @Override
+ public Constructor getConstructor()
+ {
+ return null;
+ }
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptorMetadataBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptorMetadataBean.java
new file mode 100644
index 0000000..b629e98
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptorMetadataBean.java
@@ -0,0 +1,58 @@
+/*
+ * 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.webbeans.component;
+
+import java.lang.reflect.Type;
+
+import javax.enterprise.inject.spi.Interceptor;
+import javax.enterprise.util.TypeLiteral;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.portable.MetadataProducer;
+import org.apache.webbeans.util.CollectionUtil;
+
+/**
+ * Implicit metadata bean definition.
+ *
+ * @version $Rev: 1493478 $ $Date: 2013-06-16 11:19:42 +0200 (So, 16 Jun 2013) $
+ */
+public class InterceptorMetadataBean<T> extends BuiltInOwbBean<Interceptor<T>>
+{
+
+ @SuppressWarnings("serial")
+ public InterceptorMetadataBean(WebBeansContext webBeansContext)
+ {
+ super(webBeansContext,
+ WebBeansType.METADATA,
+ new BeanAttributesImpl<Interceptor<T>>(CollectionUtil.<Type>unmodifiableSet(Interceptor.class, Object.class)),
+ new TypeLiteral<Interceptor<T>>(){}.getRawType(),
+ false,
+ new SimpleProducerFactory<Interceptor<T>>(new MetadataProducer<Interceptor<T>>()));
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.webbeans.component.AbstractOwbBean#isPassivationCapable()
+ */
+ @Override
+ public boolean isPassivationCapable()
+ {
+ return true;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/JmsBeanMarker.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/JmsBeanMarker.java
new file mode 100644
index 0000000..84cf124
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/JmsBeanMarker.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.component;
+
+public interface JmsBeanMarker
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/ManagedBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/ManagedBean.java
new file mode 100644
index 0000000..46f5765
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/ManagedBean.java
@@ -0,0 +1,62 @@
+/*
+ * 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.webbeans.component;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.PassivationCapable;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.creational.CreationalContextImpl;
+
+/**
+ * Managed bean implementation of the {@link javax.enterprise.inject.spi.Bean}.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ManagedBean<T> extends InjectionTargetBean<T> implements InterceptedMarker, PassivationCapable
+{
+ public ManagedBean(WebBeansContext webBeansContext,
+ WebBeansType webBeansType,
+ AnnotatedType<T> annotated,
+ BeanAttributesImpl<T> beanAttributes,
+ Class<T> beanClass)
+ {
+ super(webBeansContext, webBeansType, annotated, beanAttributes, beanClass);
+ }
+
+ public T create(CreationalContext<T> creationalContext)
+ {
+ if (!(creationalContext instanceof CreationalContextImpl))
+ {
+ creationalContext = webBeansContext.getCreationalContextFactory().wrappedCreationalContext(creationalContext, this);
+ }
+ CreationalContextImpl<T> creationalContextImpl = (CreationalContextImpl<T>)creationalContext;
+ Bean<T> oldBean = creationalContextImpl.putBean(this);
+ try
+ {
+ return super.create(creationalContext);
+ }
+ finally
+ {
+ creationalContextImpl.putBean(oldBean);
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/NewBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/NewBean.java
new file mode 100644
index 0000000..3e587fe
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/NewBean.java
@@ -0,0 +1,27 @@
+/*
+ * 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.webbeans.component;
+
+/**
+ * Marker interface for @New based beans
+ */
+public interface NewBean<T>
+{
+
+}
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/NewManagedBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/NewManagedBean.java
new file mode 100644
index 0000000..26d9079
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/NewManagedBean.java
@@ -0,0 +1,64 @@
+/*
+ * 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.webbeans.component;
+
+import java.util.Set;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.portable.AbstractProducer;
+
+/**
+ * Component definition with {@link javax.enterprise.inject.New} binding annotation.
+ *
+ * <p>
+ * It is defined as concrete java class component.
+ * </p>
+ *
+ */
+public class NewManagedBean<T> extends ManagedBean<T> implements NewBean<T>
+{
+
+ public NewManagedBean(WebBeansContext webBeansContext,
+ WebBeansType webBeansType,
+ AnnotatedType<T> annotatedType,
+ BeanAttributesImpl<T> beanAttributes,
+ Class<T> beanClass,
+ Set<InjectionPoint> injectionPoints)
+ {
+ super(webBeansContext, webBeansType, annotatedType, beanAttributes, beanClass);
+ if (getProducer() instanceof AbstractProducer)
+ {
+ AbstractProducer<T> producer = (AbstractProducer<T>)getProducer();
+ producer.defineInterceptorStack(this, annotatedType, webBeansContext);
+ }
+ }
+
+ /**
+ * always true for New qualifier
+ */
+ @Override
+ public boolean isDependent()
+ {
+ return true;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/OwbBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/OwbBean.java
new file mode 100644
index 0000000..2219aaf
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/OwbBean.java
@@ -0,0 +1,100 @@
+/*
+ * 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.webbeans.component;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Producer;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+/**
+ * OWB specific extension of the {@link Bean} interface.
+ * It is used internally. Do not use it. Instead use {@link AbstractOwbBean}
+ * for extension.
+ *
+ * @version $Rev$ $Date$
+ * <T> bean class
+ */
+public interface OwbBean<T> extends Bean<T>
+{
+ /**
+ * @return the producer for this bean;
+ */
+ public Producer<T> getProducer();
+
+ /**
+ * Returns bean type.
+ *
+ * @return webbeans type
+ * @see WebBeansType
+ */
+ public WebBeansType getWebBeansType();
+
+ /**
+ * Returns bean class type
+ * @return bean class type
+ */
+ public Class<T> getReturnType();
+
+ /**
+ * Set specialized flag.
+ * @param specialized flag
+ */
+ public void setSpecializedBean(boolean specialized);
+
+ /**
+ * Returns true if bean is a specialized bean, false otherwise.
+ * @return true if bean is a specialized bean
+ */
+ public boolean isSpecializedBean();
+
+ /**
+ * Set enableed flag.
+ * @param enabled flag
+ */
+ public void setEnabled(boolean enabled);
+
+ /**
+ * Bean is enabled or not.
+ * @return true if enabled
+ */
+ public boolean isEnabled();
+
+ /**
+ * Gets id of the bean.
+ * @return id of the bean
+ */
+ public String getId();
+
+ /**
+ * True if passivation capable false otherwise.
+ * @return true if this bean is passivation capable
+ */
+ public boolean isPassivationCapable();
+
+ /**
+ * This determines if this bean is really a dependent bean,
+ * and as such always creats a freshl instance for each
+ * InjectionPoint. A BeanManagerBean is e.g. not a dependent bean.
+ * @return <code>true</code> if this is a dependent bean
+ */
+ public boolean isDependent();
+
+ public WebBeansContext getWebBeansContext();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldBean.java
new file mode 100644
index 0000000..f032fcd
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldBean.java
@@ -0,0 +1,101 @@
+/*
+ * 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.webbeans.component;
+
+import java.lang.reflect.Field;
+
+import javax.enterprise.context.spi.CreationalContext;
+
+import org.apache.webbeans.component.spi.ProducerFactory;
+
+/**
+ * Defines the producer field component implementation.
+ *
+ * @param <T> Type of the field decleration
+ */
+public class ProducerFieldBean<T> extends AbstractProducerBean<T>
+{
+
+ /** Producer field that defines the component */
+ private Field producerField = null;
+
+ /**
+ * Defines the new producer field component.
+ *
+ * @param returnType type of the field decleration
+ */
+ public ProducerFieldBean(InjectionTargetBean<?> ownerComponent, BeanAttributesImpl<T> beanAttributes, Class<T> returnType, ProducerFactory<T> producerFactory)
+ {
+ super(ownerComponent.getBeanClass(), ownerComponent.getWebBeansContext(), WebBeansType.PRODUCERFIELD, beanAttributes, returnType, producerFactory);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public T create(CreationalContext<T> creationalContext)
+ {
+ T instance = null;
+
+ instance = super.create(creationalContext);
+ checkNullInstance(instance, producerField.getName());
+ checkScopeType(producerField.getName());
+
+ return instance;
+
+ }
+
+ /**
+ * Gets creator field.
+ *
+ * @return creator field
+ */
+ public Field getCreatorField()
+ {
+ return producerField;
+ }
+
+ /**
+ * Set producer field.
+ *
+ * @param field producer field
+ */
+ public void setProducerField(Field field)
+ {
+ producerField = field;
+ }
+
+ @Override
+ public boolean isPassivationCapable()
+ {
+ return isPassivationCapable(producerField.getType(), producerField.getModifiers());
+ }
+
+ @Override
+ public String getId()
+ {
+ if (passivatingId == null)
+ {
+ String id = super.getId();
+
+ passivatingId = id + "#" + producerField.toGenericString();
+ }
+ return passivatingId;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerMethodBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerMethodBean.java
new file mode 100644
index 0000000..a288fbf
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerMethodBean.java
@@ -0,0 +1,131 @@
+/*
+ * 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.webbeans.component;
+
+import java.lang.reflect.Method;
+
+import javax.enterprise.context.spi.CreationalContext;
+
+import org.apache.webbeans.component.creation.MethodProducerFactory;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+
+/**
+ * Concrete implementation of the {@link AbstractOwbBean}.
+ * <p>
+ * It is defined as producer method component.
+ * </p>
+ *
+ * @version $Rev$ $Date$
+ */
+public class ProducerMethodBean<T> extends AbstractProducerBean<T>
+{
+
+ /** Creator method of the parent component */
+ protected Method creatorMethod;
+
+ /** Disposal method */
+ protected Method disposalMethod;
+
+ /**
+ * Creates a new instance.
+ *
+ * @param ownerComponent parent bean
+ * @param returnType producer method return type
+ */
+ public <P> ProducerMethodBean(InjectionTargetBean<P> ownerComponent,
+ BeanAttributesImpl<T> beanAttributes,
+ Class<T> returnType,
+ MethodProducerFactory<P> producerFactory)
+ {
+ super(ownerComponent.getBeanClass(), ownerComponent.getWebBeansContext(), WebBeansType.PRODUCERMETHOD, beanAttributes, returnType, producerFactory);
+ }
+
+ /**
+ * Gets the creator method.
+ *
+ * @return producer method
+ */
+ public Method getCreatorMethod()
+ {
+ return creatorMethod;
+ }
+
+
+ public Method getDisposalMethod()
+ {
+ return disposalMethod;
+ }
+
+ /**
+ * Sets the method.
+ *
+ * @param creatorMethod producer method
+ */
+ public void setCreatorMethod(Method creatorMethod)
+ {
+ this.creatorMethod = creatorMethod;
+ }
+
+ /**
+ * Sets the disposal method.
+ *
+ * @param disposalMethod disposal method of this producer method component
+ */
+ public void setDisposalMethod(Method disposalMethod)
+ {
+ if (this.disposalMethod != null)
+ {
+ throw new WebBeansConfigurationException("There are multiple disposal method for producer method " +
+ "component with name : " + getName() + " with implementation class " +
+ getBeanClass().getName() + " with disposal method name : " +
+ disposalMethod.getName());
+ }
+ this.disposalMethod = disposalMethod;
+ }
+
+ @Override
+ public String getId()
+ {
+ if (passivatingId == null)
+ {
+ String id = super.getId();
+
+ passivatingId = id + "#" + creatorMethod.toGenericString();
+ }
+ return passivatingId;
+ }
+
+ @Override
+ public T create(CreationalContext<T> creationalContext)
+ {
+ T instance = super.create(creationalContext);
+ // Check null instance
+ checkNullInstance(instance, creatorMethod.getName());
+
+ // Check scope type
+ checkScopeType(creatorMethod.getName());
+ return instance;
+ }
+
+ @Override
+ public boolean isPassivationCapable()
+ {
+ return isPassivationCapable(creatorMethod.getReturnType(), creatorMethod.getModifiers());
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/ResourceBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/ResourceBean.java
new file mode 100644
index 0000000..0586d04
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/ResourceBean.java
@@ -0,0 +1,72 @@
+/*
+ * 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.webbeans.component;
+
+import java.lang.annotation.Annotation;
+
+import org.apache.webbeans.portable.ProviderBasedProducerFactory;
+import org.apache.webbeans.spi.ResourceInjectionService;
+import org.apache.webbeans.spi.api.ResourceReference;
+
+import javax.enterprise.context.Dependent;
+
+public class ResourceBean<X, T extends Annotation> extends ProducerFieldBean<X>
+{
+
+ private ResourceReference<X,T> resourceReference = null;
+
+ public ResourceBean(InjectionTargetBean<?> ownerComponent,
+ ResourceReference<X, T> resourceReference,
+ BeanAttributesImpl<X> beanAttributes,
+ Class<X> beanClass)
+ {
+ super(ownerComponent,
+ beanAttributes,
+ beanClass,
+ new ProviderBasedProducerFactory<X>(!Dependent.class.equals(beanAttributes.getScope()),
+ new ResourceProvider<X>(resourceReference, ownerComponent.getWebBeansContext()),
+ beanClass,
+ ownerComponent.getWebBeansContext()));
+ this.resourceReference = resourceReference;
+ }
+
+ public ResourceReference<X, T> getReference()
+ {
+ return resourceReference;
+ }
+
+ /**
+ * Called after deserialization to get a new instance for some type of resource bean instance that are
+ * not serializable.
+ *
+ * @return a new instance of this resource bean.
+ */
+ public X getActualInstance()
+ {
+ ResourceInjectionService resourceService = getWebBeansContext().getService(ResourceInjectionService.class);
+ X instance = resourceService.getResourceReference(resourceReference);
+ return instance;
+ }
+
+ @Override
+ public boolean isPassivationCapable()
+ {
+ return true;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/ResourceProvider.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/ResourceProvider.java
new file mode 100644
index 0000000..0c4e265
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/ResourceProvider.java
@@ -0,0 +1,65 @@
+/*
+ * 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.webbeans.component;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.spi.ResourceInjectionService;
+import org.apache.webbeans.spi.api.ResourceReference;
+
+import javax.inject.Provider;
+import java.io.ObjectStreamException;
+import java.io.Serializable;
+
+public class ResourceProvider<T> implements Provider<T>, Serializable
+{
+
+ private ResourceReference<T, ?> resourceReference = null;
+ private transient WebBeansContext webBeansContext;
+
+ public ResourceProvider(ResourceReference<T, ?> resourceReference, WebBeansContext webBeansContext)
+ {
+ this.resourceReference = resourceReference;
+ this.webBeansContext = webBeansContext;
+ }
+
+ @Override
+ public T get()
+ {
+ if (webBeansContext == null)
+ {
+ webBeansContext = WebBeansContext.currentInstance();
+ }
+
+ try
+ {
+ ResourceInjectionService resourceService = webBeansContext.getService(ResourceInjectionService.class);
+ return resourceService.getResourceReference(resourceReference);
+ }
+ catch (Exception e)
+ {
+ throw new WebBeansException(e);
+ }
+ }
+
+ Object readResolve() throws ObjectStreamException
+ {
+ return get();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/SelfInterceptorBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/SelfInterceptorBean.java
new file mode 100644
index 0000000..86a38ba
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/SelfInterceptorBean.java
@@ -0,0 +1,75 @@
+/*
+ * 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.webbeans.component;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InterceptionType;
+import javax.enterprise.inject.spi.Interceptor;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.InjectionTargetFactoryImpl;
+import org.apache.webbeans.exception.WebBeansException;
+
+/**
+ * <p>Implicit self-interceptor Bean implementation.
+ * This is Interceptors which got defined by having an @AroundInvoke,
+ * @AroundTimeout, etc method inside a bean itself. In that case
+ * all business method invocations on that bean are intercepted via those methods
+ * in the bean.</p>
+ */
+public class SelfInterceptorBean<T> extends InterceptorBean<T> implements Interceptor<T>
+{
+
+ public SelfInterceptorBean(WebBeansContext webBeansContext,
+ AnnotatedType<T> annotatedType,
+ BeanAttributesImpl<T> beanAttributes,
+ Class<T> beanClass,
+ Map<InterceptionType, Method[]> interceptionMethods,
+ Method aroundConstruct)
+ {
+ super(webBeansContext, annotatedType, beanAttributes, beanClass, interceptionMethods, aroundConstruct,
+ new InjectionTargetFactoryImpl<T>(annotatedType, webBeansContext));
+ }
+
+ public boolean isAroundInvoke()
+ {
+ return aroundInvokeMethod != null;
+ }
+
+ /**
+ * @return always an empty Set as this interceptor doesn't have any InterceptorBindings
+ */
+ @Override
+ public Set<Annotation> getInterceptorBindings()
+ {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public T create(CreationalContext<T> context)
+ {
+ throw new WebBeansException("You must not create an Interceptor instance of a self-intercepted bean!");
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/SimpleProducerFactory.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/SimpleProducerFactory.java
new file mode 100644
index 0000000..7c4f74f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/SimpleProducerFactory.java
@@ -0,0 +1,44 @@
+/*
+ * 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.webbeans.component;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Producer;
+
+import org.apache.webbeans.component.spi.ProducerFactory;
+
+/**
+ * @version $Rev: 1440403 $ $Date: 2013-01-30 14:27:15 +0100 (Mi, 30 Jan 2013) $
+ */
+public class SimpleProducerFactory<P> implements ProducerFactory<P>
+{
+
+ private Producer<?> producer;
+
+ public SimpleProducerFactory(Producer<?> producer)
+ {
+ this.producer = producer;
+ }
+
+ @Override
+ public <T> Producer<T> createProducer(Bean<T> bean)
+ {
+ return (Producer<T>)producer;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/WebBeansType.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/WebBeansType.java
new file mode 100644
index 0000000..0f7b4e8
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/WebBeansType.java
@@ -0,0 +1,74 @@
+/*
+ * 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.webbeans.component;
+
+
+/**
+ * There are different <i>Web Beans Component</i> with regard to the definition.
+ * These are the;
+ * <ul>
+ * <li>Bean Implementation Class Components</li>
+ * <li>Producer Method Components</li>
+ * </ul>
+ * <p>
+ * Bean Implementation Class Components are defined with annotating the ordinary
+ * classes with {@link OwbBean} annotation. It maybe defined within the
+ * web-beans.xml file using <class> element. It is possible to mix these
+ * two definitions.
+ * </p>
+ * <p>
+ * Producer Method Components are defined within the class that is annotated
+ * with {@link OwbBean} annotation. In these classes, there are methods that
+ * are annotated with {@link javax.enterprise.inject.Produces} annotation.
+ * These methods become the producer method components of this web beans component.
+ * It maybe defined using the web-beans.xml file using the <producer> element.
+ * It is possible to mix these two definitons.
+ * </p>
+ * <p>
+ * For further details about the components, see Web Beans Specification
+ * Chapter-2.
+ * </p>
+ *
+ * @version $Rev$ $Date$
+ */
+public enum WebBeansType
+{
+ MANAGED,
+ PRODUCERMETHOD,
+ PRODUCERFIELD,
+ RESOURCEBEAN,
+ NEW,
+ ENTERPRISE,
+ JMS,
+ DEPENDENT,
+ INTERCEPTOR,
+ DECORATOR,
+ OBSERVABLE,
+ MANAGER,
+ CONVERSATION,
+ INSTANCE,
+ INJECTIONPOINT,
+ THIRDPARTY,
+ EXTENSION,
+ USERTRANSACTION,
+ PRINCIPAL,
+ VALIDATIONFACT,
+ VALIDATION,
+ METADATA
+}
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractProducerBeanBuilder.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractProducerBeanBuilder.java
new file mode 100644
index 0000000..4841f4b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractProducerBeanBuilder.java
@@ -0,0 +1,62 @@
+/*
+ * 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.webbeans.component.creation;
+
+import javax.enterprise.inject.spi.AnnotatedMember;
+import javax.enterprise.inject.spi.AnnotatedType;
+
+import org.apache.webbeans.component.AbstractProducerBean;
+import org.apache.webbeans.component.BeanAttributesImpl;
+import org.apache.webbeans.component.InjectionTargetBean;
+import org.apache.webbeans.util.Asserts;
+
+public abstract class AbstractProducerBeanBuilder<T, A extends AnnotatedMember<?>, P extends AbstractProducerBean<T>>
+{
+
+ protected final InjectionTargetBean<?> parent;
+ protected final A annotatedMember;
+ protected final BeanAttributesImpl<T> beanAttributes;
+
+ public AbstractProducerBeanBuilder(InjectionTargetBean<?> parent, A annotated, BeanAttributesImpl<T> beanAttributes)
+ {
+ Asserts.assertNotNull(parent, "webBeansContext may not be null");
+ Asserts.assertNotNull(annotated, "annotated may not be null");
+ Asserts.assertNotNull(beanAttributes, "beanAttributes may not be null");
+ this.parent = parent;
+ annotatedMember = annotated;
+ this.beanAttributes = beanAttributes;
+ }
+
+ protected AnnotatedType<?> getSuperType()
+ {
+ Class<?> superclass = annotatedMember.getDeclaringType().getJavaClass().getSuperclass();
+ if (superclass == null)
+ {
+ return null;
+ }
+ return parent.getWebBeansContext().getAnnotatedElementFactory().getAnnotatedType(superclass);
+ }
+
+ protected abstract <X> P createBean(InjectionTargetBean<X> parent, Class<T> beanClass);
+
+ protected P createBean(Class<T> beanClass)
+ {
+ return createBean(parent, beanClass);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanAttributesBuilder.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanAttributesBuilder.java
new file mode 100644
index 0000000..c145309
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanAttributesBuilder.java
@@ -0,0 +1,691 @@
+/*
+ * 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.webbeans.component.creation;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.NormalScope;
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Specializes;
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMember;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.util.Nonbinding;
+import javax.inject.Named;
+import javax.inject.Scope;
+
+import org.apache.webbeans.annotation.AnnotationManager;
+import org.apache.webbeans.annotation.AnyLiteral;
+import org.apache.webbeans.annotation.DefaultLiteral;
+import org.apache.webbeans.annotation.NamedLiteral;
+import org.apache.webbeans.component.BeanAttributesImpl;
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.ExternalScope;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.exception.inject.DefinitionException;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.Asserts;
+import org.apache.webbeans.util.ClassUtil;
+import org.apache.webbeans.util.WebBeansUtil;
+
+/**
+ * Abstract implementation.
+ *
+ * @version $Rev$ $Date$
+ *
+ * @param <T> bean class info
+ */
+public abstract class BeanAttributesBuilder<T, A extends Annotated>
+{
+ protected A annotated;
+
+ protected WebBeansContext webBeansContext;
+
+ protected Set<Type> types = new HashSet<Type>();
+
+ protected Set<Annotation> qualifiers = new HashSet<Annotation>();
+
+ protected Class<? extends Annotation> scope;
+
+ protected String name;
+
+ protected boolean nullable;
+
+ protected Set<Class<? extends Annotation>> stereotypes = new HashSet<Class<? extends Annotation>>();
+
+ protected boolean alternative;
+
+ public static BeanAttributesBuilderFactory forContext(WebBeansContext webBeansContext)
+ {
+ return new BeanAttributesBuilderFactory(webBeansContext);
+ }
+
+ /**
+ * Creates a bean instance.
+ *
+ * @param annotated
+ */
+ protected BeanAttributesBuilder(WebBeansContext webBeansContext, A annotated)
+ {
+ this.annotated = annotated;
+ this.webBeansContext = webBeansContext;
+ }
+
+ public BeanAttributesImpl<T> build()
+ {
+ defineTypes();
+ defineStereotypes();
+ defineScope();
+ defineName();
+ defineQualifiers();
+ defineNullable();
+ defineAlternative();
+ return new BeanAttributesImpl<T>(types, qualifiers, scope, name, nullable, stereotypes, alternative);
+ }
+
+ protected A getAnnotated()
+ {
+ return annotated;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void defineTypes()
+ {
+ Class<?> baseType = ClassUtil.getClass(annotated.getBaseType());
+ if (baseType.isArray())
+ {
+ // 3.3.1
+ types.add(Object.class);
+ types.add(baseType);
+ }
+ else
+ {
+ Set<Type> types = annotated.getTypeClosure();
+ this.types.addAll(types);
+ Set<String> ignored = webBeansContext.getOpenWebBeansConfiguration().getIgnoredInterfaces();
+ for (Iterator<Type> i = this.types.iterator(); i.hasNext();)
+ {
+ Type t = i.next();
+ if (t instanceof Class && ignored.contains(((Class<?>)t).getName()))
+ {
+ i.remove();
+ }
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void defineQualifiers()
+ {
+ HashSet<Class<? extends Annotation>> qualifiedTypes = new HashSet<Class<? extends Annotation>>();
+ if (annotated.isAnnotationPresent(Specializes.class))
+ {
+ defineQualifiers(getSuperAnnotated(), qualifiedTypes);
+ }
+ defineQualifiers(annotated, qualifiedTypes);
+ }
+
+ private void defineQualifiers(Annotated annotated, Set<Class<? extends Annotation>> qualifiedTypes)
+ {
+ Annotation[] annotations = AnnotationUtil.asArray(annotated.getAnnotations());
+ final AnnotationManager annotationManager = webBeansContext.getAnnotationManager();
+
+ for (Annotation annotation : annotations)
+ {
+ Class<? extends Annotation> type = annotation.annotationType();
+
+ if (annotationManager.isQualifierAnnotation(type))
+ {
+ Method[] methods = webBeansContext.getSecurityService().doPrivilegedGetDeclaredMethods(type);
+
+ for (Method method : methods)
+ {
+ Class<?> clazz = method.getReturnType();
+ if (clazz.isArray() || clazz.isAnnotation())
+ {
+ if (!AnnotationUtil.hasAnnotation(method.getDeclaredAnnotations(), Nonbinding.class))
+ {
+ throw new WebBeansConfigurationException("WebBeans definition class : " + method.getDeclaringClass().getName() + " @Qualifier : "
+ + annotation.annotationType().getName()
+ + " must have @NonBinding valued members for its array-valued and annotation valued members");
+ }
+ }
+ }
+
+ if (qualifiedTypes.contains(annotation.annotationType()))
+ {
+ continue;
+ }
+ else
+ {
+ qualifiedTypes.add(annotation.annotationType());
+ }
+ if (annotation.annotationType().equals(Named.class) && name != null)
+ {
+ qualifiers.add(new NamedLiteral(name));
+ }
+ else
+ {
+ qualifiers.add(annotation);
+ }
+ }
+ }
+
+ // No-binding annotation
+ if (qualifiers.size() == 0 )
+ {
+ qualifiers.add(DefaultLiteral.INSTANCE);
+ }
+ else if(qualifiers.size() == 1)
+ {
+ Annotation annot = qualifiers.iterator().next();
+ if(annot.annotationType().equals(Named.class))
+ {
+ qualifiers.add(DefaultLiteral.INSTANCE);
+ }
+ }
+
+ //Add @Any support
+ if(!hasAnyQualifier())
+ {
+ qualifiers.add(AnyLiteral.INSTANCE);
+ }
+
+ }
+
+ /**
+ * Returns true if any binding exist
+ *
+ * @return true if any binding exist
+ */
+ private boolean hasAnyQualifier()
+ {
+ return AnnotationUtil.getAnnotation(qualifiers, Any.class) != null;
+ }
+
+
+ protected abstract void defineScope();
+
+ protected void defineScope(String errorMessage)
+ {
+ defineScope(null, errorMessage);
+ }
+
+ protected void defineScope(Class<?> declaringClass, String errorMessage)
+ {
+ Annotation[] annotations = AnnotationUtil.asArray(annotated.getAnnotations());
+ boolean found = false;
+
+ List<ExternalScope> additionalScopes = webBeansContext.getBeanManagerImpl().getAdditionalScopes();
+
+ for (Annotation annotation : annotations)
+ {
+ if (declaringClass != null && AnnotationUtil.getDeclaringClass(annotation, declaringClass) != null && !AnnotationUtil.isDeclaringClass(declaringClass, annotation))
+ {
+ continue;
+ }
+ Class<? extends Annotation> annotationType = annotation.annotationType();
+
+ /*Normal scope*/
+ Annotation var = annotationType.getAnnotation(NormalScope.class);
+ /*Pseudo scope*/
+ Annotation pseudo = annotationType.getAnnotation(Scope.class);
+
+ if (var == null && pseudo == null)
+ {
+ // check for additional scopes registered via a CDI Extension
+ for (ExternalScope additionalScope : additionalScopes)
+ {
+ if (annotationType.equals(additionalScope.getScope()))
+ {
+ // create a proxy which implements the given annotation
+ Annotation scopeAnnotation = additionalScope.getScopeAnnotation();
+
+ if (additionalScope.isNormal())
+ {
+ var = scopeAnnotation;
+ }
+ else
+ {
+ pseudo = scopeAnnotation;
+ }
+ }
+ }
+ }
+
+ if (var != null)
+ {
+ if(pseudo != null)
+ {
+ throw new WebBeansConfigurationException("Not to define both @Scope and @NormalScope on bean : " + ClassUtil.getClass(annotated.getBaseType()).getName());
+ }
+
+ if (found)
+ {
+ throw new WebBeansConfigurationException(errorMessage);
+ }
+
+ found = true;
+ scope = annotation.annotationType();
+ }
+ else
+ {
+ if(pseudo != null)
+ {
+ if (found)
+ {
+ throw new WebBeansConfigurationException(errorMessage);
+ }
+
+ found = true;
+ scope = annotation.annotationType();
+ }
+ }
+ }
+
+ if (!found && declaringClass != null && !hasDeclaredNonInheritedScope(declaringClass))
+ {
+ defineScope(declaringClass.getSuperclass(), errorMessage);
+ }
+ else if (!found)
+ {
+ defineDefaultScope(errorMessage);
+ }
+ }
+
+ private void defineDefaultScope(String exceptionMessage)
+ {
+ if (scope == null)
+ {
+ Set<Class<? extends Annotation>> stereos = stereotypes;
+ if (stereos.size() == 0)
+ {
+ scope = Dependent.class;
+ }
+ else
+ {
+ Annotation defined = null;
+ Set<Class<? extends Annotation>> anns = stereotypes;
+ for (Class<? extends Annotation> stero : anns)
+ {
+ boolean containsNormal = AnnotationUtil.hasMetaAnnotation(stero.getDeclaredAnnotations(), NormalScope.class);
+
+ if (AnnotationUtil.hasMetaAnnotation(stero.getDeclaredAnnotations(), NormalScope.class) ||
+ AnnotationUtil.hasMetaAnnotation(stero.getDeclaredAnnotations(), Scope.class))
+ {
+ Annotation next;
+
+ if(containsNormal)
+ {
+ next = AnnotationUtil.getMetaAnnotations(stero.getDeclaredAnnotations(), NormalScope.class)[0];
+ }
+ else
+ {
+ next = AnnotationUtil.getMetaAnnotations(stero.getDeclaredAnnotations(), Scope.class)[0];
+ }
+
+ if (defined == null)
+ {
+ defined = next;
+ }
+ else
+ {
+ if (!defined.equals(next))
+ {
+ throw new WebBeansConfigurationException(exceptionMessage);
+ }
+ }
+ }
+ }
+
+ if (defined != null)
+ {
+ scope = defined.annotationType();
+ }
+ else
+ {
+ scope = Dependent.class;
+ }
+ }
+ }
+ }
+
+ private boolean hasDeclaredNonInheritedScope(Class<?> type)
+ {
+ return webBeansContext.getAnnotationManager().getDeclaredScopeAnnotation(type) != null;
+ }
+
+ protected abstract void defineName();
+
+ protected void defineName(Annotated annotated, String name)
+ {
+ Annotation[] anns = AnnotationUtil.asArray(annotated.getAnnotations());
+ Named nameAnnot = null;
+ boolean isDefault = false;
+ for (Annotation ann : anns)
+ {
+ if (ann.annotationType().equals(Named.class))
+ {
+ nameAnnot = (Named) ann;
+ break;
+ }
+ }
+
+ if (nameAnnot == null) // no @Named
+ {
+ // Check for stereottype
+ if (webBeansContext.getAnnotationManager().hasNamedOnStereoTypes(stereotypes))
+ {
+ isDefault = true;
+ }
+
+ }
+ else
+ // yes @Named
+ {
+ if (nameAnnot.value().equals(""))
+ {
+ isDefault = true;
+ }
+ else
+ {
+ this.name = nameAnnot.value();
+ }
+
+ }
+
+ if (isDefault)
+ {
+ this.name = name;
+ }
+ }
+
+ protected abstract Annotated getSuperAnnotated();
+
+ protected abstract void defineNullable();
+
+ protected void defineNullable(boolean nullable)
+ {
+ this.nullable = nullable;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void defineStereotypes()
+ {
+ Annotation[] anns = AnnotationUtil.asArray(annotated.getAnnotations());
+ final AnnotationManager annotationManager = webBeansContext.getAnnotationManager();
+ if (annotationManager.hasStereoTypeMetaAnnotation(anns))
+ {
+ Annotation[] steroAnns =
+ annotationManager.getStereotypeMetaAnnotations(anns);
+
+ for (Annotation stereo : steroAnns)
+ {
+ stereotypes.add(stereo.annotationType());
+ }
+ }
+ }
+
+ protected void defineAlternative()
+ {
+ alternative = false;
+ }
+
+ public static class BeanAttributesBuilderFactory
+ {
+ private WebBeansContext webBeansContext;
+
+ private BeanAttributesBuilderFactory(WebBeansContext webBeansContext)
+ {
+ Asserts.assertNotNull(webBeansContext, "webBeansContext may not be null");
+ this.webBeansContext = webBeansContext;
+ }
+
+ public <T> BeanAttributesBuilder<T, AnnotatedType<T>> newBeanAttibutes(AnnotatedType<T> annotatedType)
+ {
+ return new AnnotatedTypeBeanAttributesBuilder<T>(webBeansContext, annotatedType);
+ }
+
+ public <T> BeanAttributesBuilder<T, AnnotatedField<T>> newBeanAttibutes(AnnotatedField<T> annotatedField)
+ {
+ return new AnnotatedFieldBeanAttributesBuilder<T>(webBeansContext, annotatedField);
+ }
+
+ public <T> BeanAttributesBuilder<T, AnnotatedMethod<T>> newBeanAttibutes(AnnotatedMethod<T> annotatedMethod)
+ {
+ return new AnnotatedMethodBeanAttributesBuilder<T>(webBeansContext, annotatedMethod);
+ }
+ }
+
+ private static class AnnotatedTypeBeanAttributesBuilder<C> extends BeanAttributesBuilder<C, AnnotatedType<C>>
+ {
+
+ public AnnotatedTypeBeanAttributesBuilder(WebBeansContext webBeansContext, AnnotatedType<C> annotated)
+ {
+ super(webBeansContext, annotated);
+ }
+
+ @Override
+ protected void defineScope()
+ {
+ defineScope(getAnnotated().getJavaClass(), WebBeansLoggerFacade.getTokenString(OWBLogConst.TEXT_MB_IMPL) + getAnnotated().getJavaClass().getName() +
+ WebBeansLoggerFacade.getTokenString(OWBLogConst.TEXT_SAME_SCOPE));
+ }
+
+ @Override
+ protected void defineName()
+ {
+ if (getAnnotated().isAnnotationPresent(Specializes.class))
+ {
+ Class<? super C> classToSpecialize = getAnnotated().getJavaClass().getSuperclass();
+
+ while (classToSpecialize.isAnnotationPresent(Specializes.class))
+ {
+ classToSpecialize = classToSpecialize.getSuperclass();
+ }
+
+ AnnotatedType<? super C> annotatedToSpecialize = webBeansContext.getAnnotatedElementFactory().newAnnotatedType(classToSpecialize);
+ defineName(annotatedToSpecialize, WebBeansUtil.getManagedBeanDefaultName(classToSpecialize.getSimpleName()));
+ }
+ if (name == null)
+ {
+ defineName(getAnnotated(), WebBeansUtil.getManagedBeanDefaultName(getAnnotated().getJavaClass().getSimpleName()));
+ }
+ else
+ {
+ // TODO XXX We have to check stereotypes here, too
+ if (getAnnotated().getJavaClass().isAnnotationPresent(Named.class))
+ {
+ throw new DefinitionException("@Specialized Class : " + getAnnotated().getJavaClass().getName()
+ + " may not explicitly declare a bean name");
+ }
+ }
+ }
+
+ @Override
+ protected void defineNullable()
+ {
+ defineNullable(false);
+ }
+
+ @Override
+ protected AnnotatedType<? super C> getSuperAnnotated()
+ {
+ Class<? super C> superclass = getAnnotated().getJavaClass().getSuperclass();
+ if (superclass == null)
+ {
+ return null;
+ }
+ return webBeansContext.getAnnotatedElementFactory().newAnnotatedType(superclass);
+ }
+ }
+
+ private static class AnnotatedFieldBeanAttributesBuilder<M> extends AnnotatedMemberBeanAttributesBuilder<M, AnnotatedField<M>>
+ {
+
+ protected AnnotatedFieldBeanAttributesBuilder(WebBeansContext webBeansContext, AnnotatedField<M> annotated)
+ {
+ super(webBeansContext, annotated);
+ }
+
+ @Override
+ protected void defineScope()
+ {
+ defineScope("Annotated producer field: " + getAnnotated().getJavaMember() + "must declare default @Scope annotation");
+ }
+
+ @Override
+ protected void defineName()
+ {
+ defineName(getAnnotated(), WebBeansUtil.getProducerDefaultName(getAnnotated().getJavaMember().getName()));
+ }
+
+ @Override
+ protected void defineNullable()
+ {
+ defineNullable(!getAnnotated().getJavaMember().getType().isPrimitive());
+ }
+
+ @Override
+ protected AnnotatedField<? super M> getSuperAnnotated()
+ {
+ AnnotatedField<M> thisField = getAnnotated();
+ for (AnnotatedField<? super M> superField: getSuperType().getFields())
+ {
+ if (thisField.getJavaMember().getName().equals(superField.getJavaMember().getName())
+ && thisField.getBaseType().equals(superField.getBaseType()))
+ {
+ return superField;
+ }
+ }
+ return null;
+ }
+ }
+
+ private static class AnnotatedMethodBeanAttributesBuilder<M> extends AnnotatedMemberBeanAttributesBuilder<M, AnnotatedMethod<M>>
+ {
+
+ protected AnnotatedMethodBeanAttributesBuilder(WebBeansContext webBeansContext, AnnotatedMethod<M> annotated)
+ {
+ super(webBeansContext, annotated);
+ }
+
+ @Override
+ protected void defineScope()
+ {
+ defineScope("Annotated producer method : " + getAnnotated().getJavaMember() + "must declare default @Scope annotation");
+ }
+
+ @Override
+ protected void defineName()
+ {
+ if (getAnnotated().isAnnotationPresent(Specializes.class))
+ {
+ AnnotatedMethod<? super M> superAnnotated = getSuperAnnotated();
+ defineName(superAnnotated, WebBeansUtil.getProducerDefaultName(superAnnotated.getJavaMember().getName()));
+ }
+ if (name == null)
+ {
+ defineName(getAnnotated(), WebBeansUtil.getProducerDefaultName(getAnnotated().getJavaMember().getName()));
+ }
+ else
+ {
+ // TODO XXX We have to check stereotypes here, too
+ if (getAnnotated().isAnnotationPresent(Named.class))
+ {
+ throw new DefinitionException("@Specialized Producer method : " + getAnnotated().getJavaMember().getName()
+ + " may not explicitly declare a bean name");
+ }
+ }
+ }
+
+ @Override
+ protected void defineNullable()
+ {
+ defineNullable(!getAnnotated().getJavaMember().getReturnType().isPrimitive());
+ }
+
+ @Override
+ protected AnnotatedMethod<? super M> getSuperAnnotated()
+ {
+ AnnotatedMethod<M> thisMethod = getAnnotated();
+ for (AnnotatedMethod<? super M> superMethod: getSuperType().getMethods())
+ {
+ List<AnnotatedParameter<M>> thisParameters = thisMethod.getParameters();
+ if (thisMethod.getJavaMember().getName().equals(superMethod.getJavaMember().getName())
+ && thisMethod.getBaseType().equals(superMethod.getBaseType())
+ && thisParameters.size() == superMethod.getParameters().size())
+ {
+ List<AnnotatedParameter<?>> superParameters = (List<AnnotatedParameter<?>>)(List<?>)superMethod.getParameters();
+ boolean match = true;
+ for (int i = 0; i < thisParameters.size(); i++)
+ {
+ if (!thisParameters.get(i).getBaseType().equals(superParameters.get(i).getBaseType()))
+ {
+ match = false;
+ break;
+ }
+ }
+ if (match)
+ {
+ return superMethod;
+ }
+ }
+ }
+ return null;
+ }
+ }
+
+ private abstract static class AnnotatedMemberBeanAttributesBuilder<M, A extends AnnotatedMember<M>> extends BeanAttributesBuilder<M, A>
+ {
+
+ protected AnnotatedMemberBeanAttributesBuilder(WebBeansContext webBeansContext, A annotated)
+ {
+ super(webBeansContext, annotated);
+ }
+
+ protected AnnotatedType<? super M> getSuperType()
+ {
+ Class<? super M> superclass = getAnnotated().getDeclaringType().getJavaClass().getSuperclass();
+ if (superclass == null)
+ {
+ return null;
+ }
+ return webBeansContext.getAnnotatedElementFactory().getAnnotatedType(superclass);
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/CdiInterceptorBeanBuilder.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/CdiInterceptorBeanBuilder.java
new file mode 100644
index 0000000..4868746
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/CdiInterceptorBeanBuilder.java
@@ -0,0 +1,79 @@
+/*
+ * 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.webbeans.component.creation;
+
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InterceptionType;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.webbeans.component.BeanAttributesImpl;
+import org.apache.webbeans.component.CdiInterceptorBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.util.ArrayUtil;
+
+/**
+ * Bean builder for {@link org.apache.webbeans.component.InterceptorBean}s.
+ */
+public class CdiInterceptorBeanBuilder<T> extends InterceptorBeanBuilder<T, CdiInterceptorBean<T>>
+{
+
+ private Set<Annotation> interceptorBindings;
+
+ public CdiInterceptorBeanBuilder(WebBeansContext webBeansContext, AnnotatedType<T> annotatedType, BeanAttributesImpl<T> beanAttributes)
+ {
+ super(webBeansContext, annotatedType, beanAttributes);
+ }
+
+ public void defineCdiInterceptorRules()
+ {
+ checkInterceptorConditions();
+ defineInterceptorMethods();
+ defineInterceptorBindings();
+ }
+
+ @Override
+ public boolean isInterceptorEnabled()
+ {
+ return webBeansContext.getInterceptorsManager().isInterceptorClassEnabled(annotatedType.getJavaClass());
+ }
+
+ protected void defineInterceptorBindings()
+ {
+ Annotation[] bindings = webBeansContext.getAnnotationManager().getInterceptorBindingMetaAnnotations(annotatedType.getAnnotations());
+ if (bindings == null || bindings.length == 0)
+ {
+ throw new WebBeansConfigurationException("WebBeans Interceptor class : " + annotatedType.getJavaClass()
+ + " must have at least one @InterceptorBinding annotation");
+ }
+
+ interceptorBindings = ArrayUtil.asSet(bindings);
+ }
+
+ @Override
+ protected CdiInterceptorBean<T> createBean(Class<T> beanClass, boolean enabled, Map<InterceptionType, Method[]> interceptionMethods, Method aroundConstruct)
+ {
+ return new CdiInterceptorBean<T>(webBeansContext, annotatedType, beanAttributes, beanClass, interceptorBindings, enabled, interceptionMethods, aroundConstruct);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/DecoratorBeanBuilder.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/DecoratorBeanBuilder.java
new file mode 100644
index 0000000..ac1bf01
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/DecoratorBeanBuilder.java
@@ -0,0 +1,303 @@
+/*
+ * 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.webbeans.component.creation;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.decorator.Delegate;
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Inject;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.webbeans.component.BeanAttributesImpl;
+import org.apache.webbeans.component.DecoratorBean;
+import org.apache.webbeans.component.WebBeansType;
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.util.Asserts;
+import org.apache.webbeans.util.ClassUtil;
+import org.apache.webbeans.util.GenericsUtil;
+
+/**
+ * Bean builder for {@link org.apache.webbeans.component.InterceptorBean}s.
+ */
+public class DecoratorBeanBuilder<T>
+{
+ private static Logger logger = WebBeansLoggerFacade.getLogger(DecoratorBeanBuilder.class);
+
+ protected final WebBeansContext webBeansContext;
+ protected final AnnotatedType<T> annotatedType;
+ protected final BeanAttributesImpl<T> beanAttributes;
+
+ /**
+ * The Types the decorator itself implements
+ */
+ private Set<Type> decoratedTypes;
+
+ /**
+ * The Type of the @Delegate injection point.
+ */
+ private Type delegateType;
+
+ /**
+ * The Qualifiers of the @Delegate injection point.
+ */
+ private Set<Annotation> delegateQualifiers;
+
+ private final Set<String> ignoredDecoratorInterfaces;
+
+ public DecoratorBeanBuilder(WebBeansContext webBeansContext, AnnotatedType<T> annotatedType, BeanAttributesImpl<T> beanAttributes)
+ {
+ Asserts.assertNotNull(webBeansContext, "webBeansContext may not be null");
+ Asserts.assertNotNull(annotatedType, "annotated type may not be null");
+ Asserts.assertNotNull(beanAttributes, "beanAttributes may not be null");
+ this.webBeansContext = webBeansContext;
+ this.annotatedType = annotatedType;
+ this.beanAttributes = beanAttributes;
+ decoratedTypes = new HashSet<Type>(beanAttributes.getTypes());
+ ignoredDecoratorInterfaces = getIgnoredDecoratorInterfaces();
+ }
+
+ private Set<String> getIgnoredDecoratorInterfaces()
+ {
+ return webBeansContext.getOpenWebBeansConfiguration().getIgnoredInterfaces();
+ }
+
+ /**
+ * If this method returns <code>false</code> the {@link #getBean()} method must not get called.
+ *
+ * @return <code>true</code> if the Decorator is enabled and a Bean should get created
+ */
+ public boolean isDecoratorEnabled()
+ {
+ return webBeansContext.getDecoratorsManager().isDecoratorEnabled(annotatedType.getJavaClass());
+ }
+
+ protected void checkDecoratorConditions()
+ {
+ if (beanAttributes.getScope() != Dependent.class)
+ {
+ if(logger.isLoggable(Level.WARNING))
+ {
+ logger.log(Level.WARNING, OWBLogConst.WARN_0005_1, annotatedType.getJavaClass().getName());
+ }
+ }
+
+ if (beanAttributes.getName() != null)
+ {
+ if(logger.isLoggable(Level.WARNING))
+ {
+ logger.log(Level.WARNING, OWBLogConst.WARN_0005_2, annotatedType.getJavaClass().getName());
+ }
+ }
+
+ if (annotatedType.isAnnotationPresent(Alternative.class))
+ {
+ if(logger.isLoggable(Level.WARNING))
+ {
+ logger.log(Level.WARNING, OWBLogConst.WARN_0005_3, annotatedType.getJavaClass().getName());
+ }
+ }
+
+
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.log(Level.FINE, "Configuring decorator class : [{0}]", annotatedType.getJavaClass());
+ }
+
+ Set<AnnotatedMethod<? super T>> methods = annotatedType.getMethods();
+ for(AnnotatedMethod<?> method : methods)
+ {
+ for (AnnotatedParameter<?> parameter : method.getParameters())
+ {
+ if (parameter.isAnnotationPresent(Produces.class))
+ {
+ throw new WebBeansConfigurationException("Interceptor class : " + annotatedType.getJavaClass()
+ + " can not have producer methods but it has one with name : "
+ + method.getJavaMember().getName());
+ }
+ }
+ }
+ }
+
+ public void defineDecoratorRules()
+ {
+ checkDecoratorConditions();
+
+ defineDecoratedTypes();
+ }
+
+ private void defineDecoratedTypes()
+ {
+ decoratedTypes.remove(Serializable.class); /* 8.1 */
+ for (Iterator<Type> i = decoratedTypes.iterator(); i.hasNext(); )
+ {
+ Type t = i.next();
+ if (!ClassUtil.getClass(t).isInterface() || (t instanceof Class<?> && ignoredDecoratorInterfaces.contains(((Class) t).getName())))
+ {
+ i.remove();
+ }
+ }
+ }
+
+ private void defineDelegate(Set<InjectionPoint> injectionPoints)
+ {
+ boolean found = false;
+ InjectionPoint ipFound = null;
+ for(InjectionPoint ip : injectionPoints)
+ {
+ if(ip.getAnnotated().isAnnotationPresent(Delegate.class))
+ {
+ if(!found)
+ {
+ found = true;
+ ipFound = ip;
+ }
+ else
+ {
+ throw new WebBeansConfigurationException("Decorators must have a one @Delegate injection point. " +
+ "But the decorator bean : " + toString() + " has more than one");
+ }
+ }
+ }
+
+
+ if(ipFound == null)
+ {
+ throw new WebBeansConfigurationException("Decorators must have a one @Delegate injection point." +
+ "But the decorator bean : " + toString() + " has none");
+ }
+
+ if(!(ipFound.getMember() instanceof Constructor))
+ {
+ AnnotatedElement element = (AnnotatedElement)ipFound.getMember();
+ if(!element.isAnnotationPresent(Inject.class))
+ {
+ String message = "Error in decorator : "+ toString() + ". The delegate injection point must be an injected field, " +
+ "initializer method parameter or bean constructor method parameter.";
+
+ throw new WebBeansConfigurationException(message);
+ }
+ }
+
+ delegateType = GenericsUtil.resolveType(ipFound.getType(), annotatedType.getJavaClass(), ipFound.getMember());
+ delegateQualifiers = ipFound.getQualifiers();
+
+ for (Type decType : decoratedTypes)
+ {
+ if (!(ClassUtil.getClass(decType)).isAssignableFrom(ClassUtil.getClass(delegateType)))
+ {
+ throw new WebBeansConfigurationException("Decorator : " + toString() + " delegate attribute must implement all of the decorator decorated types" +
+ ", but decorator type " + decType + " is not assignable from delegate type of " + delegateType);
+ }
+ else
+ {
+ if(ClassUtil.isParametrizedType(decType) && ClassUtil.isParametrizedType(delegateType))
+ {
+ if(!delegateType.equals(decType))
+ {
+ throw new WebBeansConfigurationException("Decorator : " + toString() + " generic delegate attribute must be same with decorated type : " + decType);
+ }
+ }
+ }
+ }
+ }
+
+ public DecoratorBean<T> getBean()
+ {
+ DecoratorBean<T> decorator = new DecoratorBean<T>(webBeansContext, WebBeansType.MANAGED, annotatedType, beanAttributes, annotatedType.getJavaClass());
+ decorator.setEnabled(webBeansContext.getDecoratorsManager().isDecoratorEnabled(annotatedType.getJavaClass()));
+
+ // we can only do this after the bean injection points got scanned
+ defineDelegate(decorator.getInjectionPoints());
+ decorator.setDecoratorInfo(decoratedTypes, delegateType, delegateQualifiers);
+
+ return decorator;
+ }
+
+ protected List<AnnotatedMethod<?>> getPostConstructMethods()
+ {
+ List<AnnotatedMethod<?>> postConstructMethods = new ArrayList<AnnotatedMethod<?>>();
+ collectPostConstructMethods(annotatedType.getJavaClass(), postConstructMethods);
+ return postConstructMethods;
+ }
+
+ private void collectPostConstructMethods(Class<?> type, List<AnnotatedMethod<?>> postConstructMethods)
+ {
+ if (type == null)
+ {
+ return;
+ }
+ collectPostConstructMethods(type.getSuperclass(), postConstructMethods);
+ for (AnnotatedMethod<?> annotatedMethod: annotatedType.getMethods())
+ {
+ if (annotatedMethod.getJavaMember().getDeclaringClass() == type
+ && annotatedMethod.isAnnotationPresent(PostConstruct.class)
+ && annotatedMethod.getParameters().isEmpty())
+ {
+ postConstructMethods.add(annotatedMethod);
+ }
+ }
+ }
+
+ protected List<AnnotatedMethod<?>> getPreDestroyMethods()
+ {
+ List<AnnotatedMethod<?>> preDestroyMethods = new ArrayList<AnnotatedMethod<?>>();
+ collectPreDestroyMethods(annotatedType.getJavaClass(), preDestroyMethods);
+ return preDestroyMethods;
+ }
+
+ private void collectPreDestroyMethods(Class<?> type, List<AnnotatedMethod<?>> preDestroyMethods)
+ {
+ if (type == null)
+ {
+ return;
+ }
+ collectPreDestroyMethods(type.getSuperclass(), preDestroyMethods);
+ for (AnnotatedMethod<?> annotatedMethod: annotatedType.getMethods())
+ {
+ if (annotatedMethod.getJavaMember().getDeclaringClass() == type
+ && annotatedMethod.isAnnotationPresent(PreDestroy.class)
+ && annotatedMethod.getParameters().isEmpty())
+ {
+ preDestroyMethods.add(annotatedMethod);
+ }
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/EjbInterceptorBeanBuilder.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/EjbInterceptorBeanBuilder.java
new file mode 100644
index 0000000..ea62bcf
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/EjbInterceptorBeanBuilder.java
@@ -0,0 +1,75 @@
+/*
+ * 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.webbeans.component.creation;
+
+
+import java.lang.reflect.Method;
+import java.util.Map;
+
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InterceptionType;
+
+import org.apache.webbeans.component.BeanAttributesImpl;
+import org.apache.webbeans.component.EjbInterceptorBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+
+/**
+ * Bean builder for {@link org.apache.webbeans.component.InterceptorBean}s.
+ */
+public class EjbInterceptorBeanBuilder<T> extends InterceptorBeanBuilder<T, EjbInterceptorBean<T>>
+{
+
+ public EjbInterceptorBeanBuilder(WebBeansContext webBeansContext, AnnotatedType<T> annotatedType, BeanAttributesImpl<T> beanAttributes)
+ {
+ super(webBeansContext, annotatedType, beanAttributes);
+ }
+
+ public void defineEjbInterceptorRules()
+ {
+ checkDefaultConstructor();
+ checkInterceptorConditions();
+ defineInterceptorMethods();
+ }
+
+ @Override
+ public boolean isInterceptorEnabled()
+ {
+ return true;
+ }
+
+ public void checkDefaultConstructor()
+ {
+ for (AnnotatedConstructor<T> constructor: annotatedType.getConstructors())
+ {
+ if (constructor.getParameters().isEmpty())
+ {
+ return;
+ }
+ }
+ throw new WebBeansConfigurationException("@Interceptors interceptor must have no-arg constructor, but " + annotatedType.getJavaClass() + " has not");
+ }
+
+ @Override
+ protected EjbInterceptorBean<T> createBean(Class<T> beanClass, boolean enabled, Map<InterceptionType, Method[]> interceptionMethods, Method aroundConstruct)
+ {
+ return new EjbInterceptorBean<T>(webBeansContext, annotatedType, beanAttributes, beanClass, interceptionMethods, aroundConstruct);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ExtensionBeanBuilder.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ExtensionBeanBuilder.java
new file mode 100644
index 0000000..7146a06
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ExtensionBeanBuilder.java
@@ -0,0 +1,49 @@
+/*
+ * 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.webbeans.component.creation;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+
+import org.apache.webbeans.component.ExtensionBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.util.Asserts;
+
+public class ExtensionBeanBuilder<T>
+{
+ protected final WebBeansContext webBeansContext;
+ protected final AnnotatedType<T> annotatedType;
+
+ public ExtensionBeanBuilder(WebBeansContext webBeansContext, Class<T> type)
+ {
+ Asserts.assertNotNull(webBeansContext, "webBeansContext may not be null");
+ Asserts.assertNotNull(type, "type may not be null");
+ this.webBeansContext = webBeansContext;
+ annotatedType = webBeansContext.getAnnotatedElementFactory().newAnnotatedType(type);
+ }
+
+ public AnnotatedType<T> getAnnotatedType()
+ {
+ return annotatedType;
+ }
+
+ public ExtensionBean<T> getBean()
+ {
+ return new ExtensionBean<T>(webBeansContext, annotatedType.getJavaClass());
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/FieldProducerFactory.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/FieldProducerFactory.java
new file mode 100644
index 0000000..c93e06f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/FieldProducerFactory.java
@@ -0,0 +1,52 @@
+/*
+ * 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.webbeans.component.creation;
+
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Producer;
+
+import org.apache.webbeans.component.spi.ProducerFactory;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.portable.ProducerFieldProducer;
+import org.apache.webbeans.util.Asserts;
+
+public class FieldProducerFactory<P> implements ProducerFactory<P>
+{
+
+ private AnnotatedField<? super P> producerField;
+ private Bean<P> parent;
+ private WebBeansContext webBeansContext;
+
+ public FieldProducerFactory(AnnotatedField<? super P> producerField, Bean<P> parent, WebBeansContext webBeansContext)
+ {
+ Asserts.assertNotNull(producerField, "producer method may not be null");
+ Asserts.assertNotNull(webBeansContext, "WebBeansContext may not be null");
+ this.producerField = producerField;
+ this.parent = parent;
+ this.webBeansContext = webBeansContext;
+ }
+
+ @Override
+ public <T> Producer<T> createProducer(Bean<T> bean)
+ {
+ Producer<T> producer = new ProducerFieldProducer<T, P>(parent, producerField, webBeansContext);
+ return webBeansContext.getWebBeansUtil().fireProcessProducerEvent(producer, producerField);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/InterceptorBeanBuilder.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/InterceptorBeanBuilder.java
new file mode 100644
index 0000000..2d39fcb
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/InterceptorBeanBuilder.java
@@ -0,0 +1,351 @@
+/*
+ * 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.webbeans.component.creation;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InterceptionType;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.AroundTimeout;
+import javax.interceptor.InvocationContext;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.webbeans.component.BeanAttributesImpl;
+import org.apache.webbeans.component.InterceptorBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.intercept.annotation.AroundConstruct;
+import org.apache.webbeans.plugins.OpenWebBeansEjbLCAPlugin;
+import org.apache.webbeans.util.Asserts;
+import org.apache.webbeans.util.ClassUtil;
+
+
+/**
+ * Bean builder for {@link org.apache.webbeans.component.InterceptorBean}s.
+ */
+public abstract class InterceptorBeanBuilder<T, B extends InterceptorBean<T>>
+{
+ protected final WebBeansContext webBeansContext;
+ protected final AnnotatedType<T> annotatedType;
+ protected final BeanAttributesImpl<T> beanAttributes;
+
+ private final OpenWebBeansEjbLCAPlugin ejbPlugin;
+ private final Class<? extends Annotation> prePassivateClass;
+ private final Class<? extends Annotation> postActivateClass;
+
+ private Map<InterceptionType, Method[]> interceptionMethods;
+ private Method interceptionConstructor = null;
+
+ protected InterceptorBeanBuilder(WebBeansContext webBeansContext, AnnotatedType<T> annotatedType, BeanAttributesImpl<T> beanAttributes)
+ {
+ Asserts.assertNotNull(webBeansContext, "webBeansContext may not be null");
+ Asserts.assertNotNull(annotatedType, "annotated type may not be null");
+ Asserts.assertNotNull(beanAttributes, "beanAttributes may not be null");
+ this.webBeansContext = webBeansContext;
+ this.annotatedType = annotatedType;
+ this.beanAttributes = beanAttributes;
+ ejbPlugin = webBeansContext.getPluginLoader().getEjbLCAPlugin();
+ if (ejbPlugin != null)
+ {
+ prePassivateClass = ejbPlugin.getPrePassivateClass();
+ postActivateClass = ejbPlugin.getPostActivateClass();
+ }
+ else
+ {
+ prePassivateClass = null;
+ postActivateClass = null;
+ }
+ }
+
+ /**
+ * If this method returns <code>false</code> the {@link #getBean()} method must not get called.
+ *
+ * @return <code>true</code> if the Interceptor is enabled and a Bean should get created
+ */
+ public abstract boolean isInterceptorEnabled();
+
+ protected void checkInterceptorConditions()
+ {
+ Set<AnnotatedMethod<? super T>> methods = annotatedType.getMethods();
+ for(AnnotatedMethod<?> method : methods)
+ {
+ for (AnnotatedParameter<?> parameter : method.getParameters())
+ {
+ if (parameter.isAnnotationPresent(Produces.class))
+ {
+ throw new WebBeansConfigurationException("Interceptor class : " + annotatedType.getJavaClass()
+ + " can not have producer methods but it has one with name : "
+ + method.getJavaMember().getName());
+ }
+ }
+ }
+ }
+
+ /**
+ * <p>Grab all methods which act as interceptors for the various
+ * {@link javax.enterprise.inject.spi.InterceptionType}s.</p>
+ *
+ * <p>This method will also check some rules, e.g. that there must not be
+ * more than a single {@link javax.interceptor.AroundInvoke} method
+ * on a class.</p>
+ *
+ * <p>For the interceptors where multiple are allowed, the following rules apply:
+ * <ul>
+ * <li>Superclass methods first</li>
+ * <li>Non-private methods override and derogates their superclass counterparts.</li>
+ * <li>Private methods with the same signature stack (superclass first).</li>
+ * <li>There must only be a single method for each InterceptorType in the same class.</li>
+ * </ul>
+ * </p>
+ * @return <code>true</code> if we found some interceptor methods
+ */
+ public boolean defineInterceptorMethods()
+ {
+ List<Class> classHierarchy = webBeansContext.getInterceptorUtil().getReverseClassHierarchy(annotatedType.getJavaClass());
+
+ Collection<Method> aroundInvokeMethod = null;
+ List<AnnotatedMethod> postConstructMethods = new ArrayList<AnnotatedMethod>();
+ List<AnnotatedMethod> preDestroyMethods = new ArrayList<AnnotatedMethod>();
+ List<AnnotatedMethod> aroundTimeoutMethods = new ArrayList<AnnotatedMethod>();
+
+ // EJB related interceptors
+ List<AnnotatedMethod> prePassivateMethods = new ArrayList<AnnotatedMethod>();
+ List<AnnotatedMethod> postActivateMethods = new ArrayList<AnnotatedMethod>();
+
+ boolean interceptorFound = false;
+
+ Set<AnnotatedMethod<? super T>> methods = annotatedType.getMethods();
+
+ for (Class clazz : classHierarchy)
+ {
+
+ for (AnnotatedMethod m : methods)
+ {
+ if (clazz == m.getJavaMember().getDeclaringClass())
+ {
+ if (m.getAnnotation(AroundConstruct.class) != null)
+ {
+ if (interceptionConstructor != null)
+ {
+ throw new WebBeansConfigurationException("only one AroundConstruct allowed per Interceptor");
+ }
+ interceptionConstructor = m.getJavaMember();
+ }
+
+ // we only take methods from this very class and not sub- or superclasses
+ if (m.getAnnotation(AroundInvoke.class) != null)
+ {
+ if (aroundInvokeMethod != null)
+ {
+ for (final Method ai : aroundInvokeMethod)
+ {
+ if (ai.getDeclaringClass() == m.getJavaMember().getDeclaringClass())
+ {
+ throw new WebBeansConfigurationException("only one AroundInvoke allowed per Interceptor");
+ }
+ }
+ }
+ checkAroundInvokeConditions(m);
+ if (aroundInvokeMethod == null)
+ {
+ aroundInvokeMethod = new ArrayList<Method>();
+ }
+ aroundInvokeMethod.add(m.getJavaMember());
+ }
+
+ // PostConstruct
+ if (m.getAnnotation(PostConstruct.class) != null)
+ {
+ checkSameClassInterceptors(postConstructMethods, m);
+ postConstructMethods.add(m); // add at last position
+ }
+
+ // PreDestroy
+ if (m.getAnnotation(PreDestroy.class) != null)
+ {
+ checkSameClassInterceptors(preDestroyMethods, m);
+ preDestroyMethods.add(m); // add at last position
+ }
+
+ // AroundTimeout
+ if (m.getAnnotation(AroundTimeout.class) != null)
+ {
+ checkSameClassInterceptors(aroundTimeoutMethods, m);
+ aroundTimeoutMethods.add(m); // add at last position
+ }
+
+ // and now the EJB related interceptors
+ if (ejbPlugin != null)
+ {
+ if (m.getAnnotation(prePassivateClass) != null)
+ {
+ checkSameClassInterceptors(prePassivateMethods, m);
+ prePassivateMethods.add(m); // add at last position
+ }
+
+ // AroundTimeout
+ if (m.getAnnotation(AroundTimeout.class) != null)
+ {
+ checkSameClassInterceptors(aroundTimeoutMethods, m);
+ postActivateMethods.add(m); // add at last position
+ }
+
+ // AroundTimeout
+ if (m.getAnnotation(postActivateClass) != null)
+ {
+ checkSameClassInterceptors(postActivateMethods, m);
+ postActivateMethods.add(m); // add at last position
+ }
+ }
+ }
+ }
+ }
+
+ // and now for setting the bean info
+
+ interceptionMethods = new HashMap<InterceptionType, Method[]>();
+
+ if (aroundInvokeMethod != null)
+ {
+ interceptorFound = true;
+ interceptionMethods.put(InterceptionType.AROUND_INVOKE, aroundInvokeMethod.toArray(new Method[aroundInvokeMethod.size()]));
+ }
+
+ if (postConstructMethods.size() > 0)
+ {
+ interceptorFound = true;
+ interceptionMethods.put(InterceptionType.POST_CONSTRUCT, getMethodArray(postConstructMethods));
+ }
+ if (preDestroyMethods.size() > 0)
+ {
+ interceptorFound = true;
+ interceptionMethods.put(InterceptionType.PRE_DESTROY, getMethodArray(preDestroyMethods));
+ }
+ if (aroundTimeoutMethods.size() > 0)
+ {
+ interceptorFound = true;
+ interceptionMethods.put(InterceptionType.AROUND_TIMEOUT, getMethodArray(aroundTimeoutMethods));
+ }
+
+ if (prePassivateMethods.size() > 0)
+ {
+ interceptorFound = true;
+ interceptionMethods.put(InterceptionType.PRE_PASSIVATE, getMethodArray(prePassivateMethods));
+ }
+ if (postActivateMethods.size() > 0)
+ {
+ interceptorFound = true;
+ interceptionMethods.put(InterceptionType.POST_ACTIVATE, getMethodArray(postActivateMethods));
+ }
+
+ return interceptorFound;
+ }
+
+ private void checkAroundInvokeConditions(AnnotatedMethod method)
+ {
+ List<AnnotatedParameter<T>> parameters = method.getParameters();
+ List<Class<?>> clazzParameters = new ArrayList<Class<?>>();
+ for(AnnotatedParameter<T> parameter : parameters)
+ {
+ clazzParameters.add(ClassUtil.getClazz(parameter.getBaseType()));
+ }
+
+ Class<?>[] params = clazzParameters.toArray(new Class<?>[clazzParameters.size()]);
+
+ if (params.length != 1 || !params[0].equals(InvocationContext.class))
+ {
+ throw new WebBeansConfigurationException("@AroundInvoke annotated method : "
+ + method.getJavaMember().getName() + " in class : " + annotatedType.getJavaClass().getName()
+ + " can not take any formal arguments other than InvocationContext");
+ }
+
+ if (!method.getJavaMember().getReturnType().equals(Object.class))
+ {
+ throw new WebBeansConfigurationException("@AroundInvoke annotated method : "
+ + method.getJavaMember().getName()+ " in class : " + annotatedType.getJavaClass().getName()
+ + " must return Object type");
+ }
+
+ if (Modifier.isStatic(method.getJavaMember().getModifiers()) ||
+ Modifier.isFinal(method.getJavaMember().getModifiers()))
+ {
+ throw new WebBeansConfigurationException("@AroundInvoke annotated method : "
+ + method.getJavaMember().getName( )+ " in class : " + annotatedType.getJavaClass().getName()
+ + " can not be static or final");
+ }
+ }
+
+ /**
+ * @return the a Method array with the native members of the AnnotatedMethod list
+ */
+ private Method[] getMethodArray(List<AnnotatedMethod> methodList)
+ {
+ Method[] methods = new Method[methodList.size()];
+ int i=0;
+ for (AnnotatedMethod am : methodList)
+ {
+ methods[i++] = am.getJavaMember();
+ }
+ return methods;
+ }
+
+ private void checkSameClassInterceptors(List<AnnotatedMethod> alreadyDefinedMethods, AnnotatedMethod annotatedMethod)
+ {
+ Class clazz = null;
+ for (AnnotatedMethod alreadyDefined : alreadyDefinedMethods)
+ {
+ if (clazz == null)
+ {
+ clazz = annotatedMethod.getJavaMember().getDeclaringClass();
+ }
+
+ // check for same class -> Exception
+ if (alreadyDefined.getJavaMember().getDeclaringClass() == clazz)
+ {
+ throw new WebBeansConfigurationException("Only one Interceptor of a certain type is allowed per class, but multiple found in class "
+ + annotatedMethod.getJavaMember().getDeclaringClass().getName()
+ + " methods: " + annotatedMethod.getJavaMember().toString()
+ + " and " + alreadyDefined.getJavaMember().toString());
+ }
+ }
+ }
+
+ protected abstract B createBean(Class<T> beanClass,
+ boolean enabled,
+ Map<InterceptionType, Method[]> interceptionMethods,
+ Method aroundConstruct);
+
+ public B getBean()
+ {
+ return createBean(annotatedType.getJavaClass(), isInterceptorEnabled(), interceptionMethods, interceptionConstructor);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanBuilder.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanBuilder.java
new file mode 100644
index 0000000..0394b04
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanBuilder.java
@@ -0,0 +1,69 @@
+/*
+ * 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.webbeans.component.creation;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+
+import org.apache.webbeans.component.BeanAttributesImpl;
+import org.apache.webbeans.component.ManagedBean;
+import org.apache.webbeans.component.WebBeansType;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.util.Asserts;
+import org.apache.webbeans.util.WebBeansUtil;
+
+/**
+ * Bean builder for <i>Managed Beans</i>. A <i>ManagedBean</i> is a class
+ * which gets scanned and picked up as {@link javax.enterprise.inject.spi.Bean}.
+ *
+ * @version $Rev$ $Date$
+ *
+ * @param <T> bean type info
+ */
+public class ManagedBeanBuilder<T, M extends ManagedBean<T>>
+{
+ protected final WebBeansContext webBeansContext;
+ protected final AnnotatedType<T> annotatedType;
+ protected final BeanAttributesImpl<T> beanAttributes;
+
+ /**
+ * Creates a new creator.
+ */
+ public ManagedBeanBuilder(WebBeansContext webBeansContext, AnnotatedType<T> annotatedType, BeanAttributesImpl<T> beanAttributes)
+ {
+ Asserts.assertNotNull(webBeansContext, "webBeansContext may not be null");
+ Asserts.assertNotNull(annotatedType, "annotated type may not be null");
+ Asserts.assertNotNull(beanAttributes, "beanAttributes may not be null");
+ this.webBeansContext = webBeansContext;
+ this.annotatedType = annotatedType;
+ this.beanAttributes = beanAttributes;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public M getBean()
+ {
+ M bean = (M)new ManagedBean<T>(webBeansContext, WebBeansType.MANAGED, annotatedType, beanAttributes, annotatedType.getJavaClass());
+ bean.setEnabled(webBeansContext.getWebBeansUtil().isBeanEnabled(annotatedType, bean.getStereotypes()));
+ webBeansContext.getWebBeansUtil().checkManagedBeanCondition(annotatedType);
+ WebBeansUtil.checkGenericType(annotatedType.getJavaClass(), beanAttributes.getScope());
+ webBeansContext.getDeploymentValidationService().validateProxyable(bean);
+ return bean;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/MethodProducerFactory.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/MethodProducerFactory.java
new file mode 100644
index 0000000..5ee6938
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/MethodProducerFactory.java
@@ -0,0 +1,192 @@
+/*
+ * 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.webbeans.component.creation;
+
+import java.lang.annotation.Annotation;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.Producer;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.webbeans.component.spi.ProducerFactory;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.portable.ProducerMethodProducer;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.Asserts;
+import org.apache.webbeans.util.GenericsUtil;
+
+public class MethodProducerFactory<P> implements ProducerFactory<P>
+{
+
+ private AnnotatedMethod<? super P> producerMethod;
+ private AnnotatedMethod<? super P> disposalMethod;
+ private Bean<P> parent;
+ private WebBeansContext webBeansContext;
+
+ public MethodProducerFactory(AnnotatedMethod<? super P> producerMethod, Bean<P> parent, WebBeansContext webBeansContext)
+ {
+ Asserts.assertNotNull(producerMethod, "producer method may not be null");
+ Asserts.assertNotNull(webBeansContext, "WebBeansContext may not be null");
+ this.producerMethod = producerMethod;
+ this.parent = parent;
+ this.webBeansContext = webBeansContext;
+ defineDisposalMethod();
+ }
+
+ @Override
+ public <T> Producer<T> createProducer(Bean<T> bean)
+ {
+ Set<InjectionPoint> disposalIPs = null;
+ if (disposalMethod != null)
+ {
+ disposalIPs = new HashSet<InjectionPoint>(webBeansContext.getInjectionPointFactory().buildInjectionPoints(bean, disposalMethod));
+ }
+
+ Producer<T> producer = new ProducerMethodProducer<T, P>(parent, producerMethod, disposalMethod, createInjectionPoints(bean), disposalIPs, webBeansContext);
+ return webBeansContext.getWebBeansUtil().fireProcessProducerEvent(producer, producerMethod);
+ }
+
+ private void defineDisposalMethod()
+ {
+ Set<Annotation> producerQualifiers = webBeansContext.getAnnotationManager().getQualifierAnnotations(producerMethod.getAnnotations());
+ if (producerQualifiers.size() == 1 && producerQualifiers.iterator().next().annotationType().equals(Default.class))
+ {
+ producerQualifiers = Collections.emptySet();
+ }
+ Set<Annotation> producerQualifiersWithoutNamed = new HashSet<Annotation>();
+ for (Annotation qualifier: producerQualifiers)
+ {
+ if (!qualifier.annotationType().equals(Named.class))
+ {
+ producerQualifiersWithoutNamed.add(qualifier);
+ }
+ }
+ Set<AnnotatedMethod<? super P>> annotatedMethods = (Set<AnnotatedMethod<? super P>>)(Set<?>)producerMethod.getDeclaringType().getMethods();
+ for (AnnotatedMethod<? super P> annotatedMethod : annotatedMethods)
+ {
+ if (annotatedMethod.getDeclaringType().equals(producerMethod.getDeclaringType()))
+ {
+ for (AnnotatedParameter<? super P> annotatedParameter : annotatedMethod.getParameters())
+ {
+ if (annotatedParameter.isAnnotationPresent(Disposes.class))
+ {
+ if (!GenericsUtil.satisfiesDependency(false, producerMethod.getBaseType(), annotatedParameter.getBaseType()))
+ {
+ continue;
+ }
+
+ Set<Annotation> producerQualifiersToCompare = producerQualifiers;
+ Set<Annotation> disposalQualifiers = webBeansContext.getAnnotationManager().getQualifierAnnotations(annotatedParameter.getAnnotations());
+ if (disposalQualifiers.size() == 1 && disposalQualifiers.iterator().next().annotationType().equals(Default.class))
+ {
+ disposalQualifiers = Collections.emptySet();
+ }
+ if (disposalQualifiers.size() == producerQualifiersToCompare.size() - 1)
+ {
+ // when @Named is present at the producer it may be ignored at the disposal
+ producerQualifiersToCompare = producerQualifiersWithoutNamed;
+ }
+ if (disposalQualifiers.size() != producerQualifiersToCompare.size())
+ {
+ continue;
+ }
+ boolean same = true;
+ for (Annotation disposalQualifier: disposalQualifiers)
+ {
+ boolean found = false;
+ for (Annotation producerQualifier: producerQualifiers)
+ {
+ if (AnnotationUtil.isCdiAnnotationEqual(producerQualifier, disposalQualifier))
+ {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ same = false;
+ break;
+ }
+ }
+ if (!same)
+ {
+ continue;
+ }
+ if (disposalMethod != null)
+ {
+ throw new WebBeansConfigurationException("There are multiple disposal method for the producer method : "
+ + disposalMethod.getJavaMember().getName() + " in class : "
+ + annotatedMethod.getDeclaringType().getJavaClass());
+ }
+ if (!annotatedMethod.getDeclaringType().equals(producerMethod.getDeclaringType()))
+ {
+ throw new WebBeansConfigurationException("Producer method component of the disposal method : "
+ + annotatedMethod.getJavaMember().getName() + " in class : "
+ + annotatedMethod.getDeclaringType().getJavaClass() + " must be in the same class!");
+ }
+ checkDisposalMethod(annotatedMethod);
+ disposalMethod = (AnnotatedMethod<P>)annotatedMethod;
+ }
+ }
+ }
+ }
+ }
+
+ private void checkDisposalMethod(AnnotatedMethod<? super P> annotatedMethod)
+ {
+ boolean found = false;
+ for (AnnotatedParameter<?> parameter : annotatedMethod.getParameters())
+ {
+ if(parameter.isAnnotationPresent(Disposes.class))
+ {
+ if(found)
+ {
+ throw new WebBeansConfigurationException("Error in definining disposal method of annotated method : " + annotatedMethod
+ + ". Multiple disposes annotation.");
+ }
+ found = true;
+ }
+ }
+
+ if(annotatedMethod.isAnnotationPresent(Inject.class)
+ || AnnotationUtil.hasAnnotatedMethodParameterAnnotation(annotatedMethod, Observes.class)
+ || annotatedMethod.isAnnotationPresent(Produces.class))
+ {
+ throw new WebBeansConfigurationException("Error in definining disposal method of annotated method : " + annotatedMethod
+ + ". Disposal methods can not be annotated with" + " @Initializer/@Destructor/@Produces annotation or has a parameter annotated with @Observes.");
+ }
+ }
+
+ protected Set<InjectionPoint> createInjectionPoints(Bean<?> bean)
+ {
+ return new HashSet<InjectionPoint>(webBeansContext.getInjectionPointFactory().buildInjectionPoints(bean, producerMethod));
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ObserverMethodsBuilder.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ObserverMethodsBuilder.java
new file mode 100644
index 0000000..3bd461e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ObserverMethodsBuilder.java
@@ -0,0 +1,145 @@
+/*
+ * 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.webbeans.component.creation;
+
+import java.lang.reflect.Method;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.event.Observes;
+import javax.enterprise.event.Reception;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.ObserverMethod;
+import javax.inject.Inject;
+
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.component.InjectionTargetBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.Asserts;
+
+/**
+ * Abstract implementation of {@link AbstractBeanBuilder}.
+ *
+ * @version $Rev$ $Date$
+ *
+ * @param <T> bean class type
+ */
+public class ObserverMethodsBuilder<T, I extends InjectionTargetBean<T>>
+{
+
+ protected final WebBeansContext webBeansContext;
+ protected final AnnotatedType<T> annotatedType;
+
+ /**
+ * Creates a new instance.
+ *
+ */
+ public ObserverMethodsBuilder(WebBeansContext webBeansContext, AnnotatedType<T> annotatedType)
+ {
+ Asserts.assertNotNull(webBeansContext, "webBeansContext may not be null");
+ Asserts.assertNotNull(annotatedType, "annotated type may not be null");
+ this.webBeansContext = webBeansContext;
+ this.annotatedType = annotatedType;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Set<ObserverMethod<?>> defineObserverMethods(AbstractOwbBean<T> bean)
+ {
+ Set<ObserverMethod<?>> definedObservers = new HashSet<ObserverMethod<?>>();
+ Set<AnnotatedMethod<? super T>> annotatedMethods = annotatedType.getMethods();
+ for (AnnotatedMethod<? super T> annotatedMethod : annotatedMethods)
+ {
+ AnnotatedMethod<T> annt = (AnnotatedMethod<T>)annotatedMethod;
+ List<AnnotatedParameter<T>> parameters = annt.getParameters();
+ boolean found = false;
+ for(AnnotatedParameter<T> parameter : parameters)
+ {
+ if(parameter.isAnnotationPresent(Observes.class))
+ {
+ found = true;
+ break;
+ }
+ }
+
+ if(found)
+ {
+ checkObserverMethodConditions((AnnotatedMethod<T>) annotatedMethod, annotatedMethod.getDeclaringType().getJavaClass());
+ if (bean.getScope().equals(Dependent.class))
+ {
+ //Check Reception
+ AnnotationUtil.getAnnotatedMethodFirstParameterWithAnnotation(annotatedMethod, Observes.class);
+
+ Observes observes = AnnotationUtil.getAnnotatedMethodFirstParameterAnnotation(annotatedMethod, Observes.class);
+ Reception reception = observes.notifyObserver();
+ if(reception.equals(Reception.IF_EXISTS))
+ {
+ throw new WebBeansConfigurationException("Dependent Bean : " + annotatedType.getJavaClass() + " can not define observer method with @Receiver = IF_EXIST");
+ }
+ }
+
+ //Looking for ObserverMethod
+ ObserverMethod<?> definedObserver = webBeansContext.getBeanManagerImpl().getNotificationManager().getObservableMethodForAnnotatedMethod(annotatedMethod, bean);
+ if(definedObserver != null)
+ {
+ definedObservers.add(definedObserver);
+ }
+ }
+ }
+
+ return definedObservers;
+ }
+
+ private void checkObserverMethodConditions(AnnotatedMethod<T> annotatedMethod, Class<?> clazz)
+ {
+ Asserts.assertNotNull(annotatedMethod, "annotatedMethod parameter can not be null");
+ Asserts.nullCheckForClass(clazz);
+
+ Method candidateObserverMethod = annotatedMethod.getJavaMember();
+
+ if (AnnotationUtil.hasAnnotatedMethodMultipleParameterAnnotation(annotatedMethod, Observes.class))
+ {
+ throw new WebBeansConfigurationException("Observer method : " + candidateObserverMethod.getName() + " in class : " + clazz.getName()
+ + " can not define two parameters with annotated @Observes");
+ }
+
+ if (annotatedMethod.isAnnotationPresent(Produces.class)
+ || annotatedMethod.isAnnotationPresent(Inject.class))
+ {
+ throw new WebBeansConfigurationException("Observer method : " + candidateObserverMethod.getName() + " in class : " + clazz.getName()
+ + " can not annotated with annotation in the list {@Produces, @Initializer, @Destructor}");
+
+ }
+
+ if (AnnotationUtil.hasAnnotatedMethodParameterAnnotation(annotatedMethod, Disposes.class))
+ {
+ throw new WebBeansConfigurationException("Observer method : " + candidateObserverMethod.getName() + " in class : "
+ + clazz.getName() + " can not annotated with annotation @Disposes");
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerFieldBeanBuilder.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerFieldBeanBuilder.java
new file mode 100644
index 0000000..33c6bd1
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerFieldBeanBuilder.java
@@ -0,0 +1,59 @@
+/*
+ * 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.webbeans.component.creation;
+
+import javax.enterprise.inject.spi.AnnotatedField;
+
+import org.apache.webbeans.component.BeanAttributesImpl;
+import org.apache.webbeans.component.InjectionTargetBean;
+import org.apache.webbeans.component.ProducerFieldBean;
+
+public class ProducerFieldBeanBuilder<T, P extends ProducerFieldBean<T>> extends AbstractProducerBeanBuilder<T, AnnotatedField<?>, P>
+{
+
+ public ProducerFieldBeanBuilder(InjectionTargetBean<?> owner, AnnotatedField<?> annotated, BeanAttributesImpl<T> beanAttributes)
+ {
+ super(owner, annotated, beanAttributes);
+ }
+
+ protected AnnotatedField<?> getSuperAnnotated()
+ {
+ AnnotatedField<?> thisField = annotatedMember;
+ for (AnnotatedField<?> superField: getSuperType().getFields())
+ {
+ if (thisField.getJavaMember().getName().equals(superField.getJavaMember().getName())
+ && thisField.getBaseType().equals(superField.getBaseType()))
+ {
+ return superField;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ protected <X> P createBean(InjectionTargetBean<X> owner, Class<T> beanClass)
+ {
+ return (P) new ProducerFieldBean<T>(owner, beanAttributes, beanClass, new FieldProducerFactory(annotatedMember, owner, owner.getWebBeansContext()));
+ }
+
+ public P getBean()
+ {
+ return createBean((Class<T>) annotatedMember.getJavaMember().getType());
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerFieldBeansBuilder.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerFieldBeansBuilder.java
new file mode 100644
index 0000000..8594170
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerFieldBeansBuilder.java
@@ -0,0 +1,144 @@
+/*
+ * 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.webbeans.component.creation;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.inject.Named;
+
+import org.apache.webbeans.component.BeanAttributesImpl;
+import org.apache.webbeans.component.InjectionTargetBean;
+import org.apache.webbeans.component.ProducerFieldBean;
+import org.apache.webbeans.component.ResourceBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.spi.api.ResourceReference;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.Asserts;
+import org.apache.webbeans.util.ClassUtil;
+import org.apache.webbeans.util.WebBeansUtil;
+
+/**
+ * Abstract implementation of {@link AbstractBeanBuilder}.
+ *
+ * @version $Rev$ $Date$
+ *
+ * @param <T> bean class type
+ */
+public class ProducerFieldBeansBuilder<T, I extends InjectionTargetBean<T>>
+{
+
+ protected final WebBeansContext webBeansContext;
+ protected final AnnotatedType<T> annotatedType;
+
+ /**
+ * Creates a new instance.
+ *
+ */
+ public ProducerFieldBeansBuilder(WebBeansContext webBeansContext, AnnotatedType<T> annotatedType)
+ {
+ Asserts.assertNotNull(webBeansContext, "webBeansContext may not be null");
+ Asserts.assertNotNull(annotatedType, "annotated type may not be null");
+ this.webBeansContext = webBeansContext;
+ this.annotatedType = annotatedType;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Set<ProducerFieldBean<?>> defineProducerFields(InjectionTargetBean<T> bean)
+ {
+ Set<ProducerFieldBean<?>> producerBeans = new HashSet<ProducerFieldBean<?>>();
+ Set<AnnotatedField<? super T>> annotatedFields = annotatedType.getFields();
+ for(AnnotatedField<? super T> annotatedField: annotatedFields)
+ {
+ if(annotatedField.isAnnotationPresent(Produces.class) && annotatedField.getJavaMember().getDeclaringClass().equals(annotatedType.getJavaClass()))
+ {
+ Type genericType = annotatedField.getBaseType();
+
+ if(ClassUtil.isTypeVariable(genericType))
+ {
+ throw new WebBeansConfigurationException("Producer annotated field : " + annotatedField + " can not be Wildcard type or Type variable");
+ }
+ if(ClassUtil.isParametrizedType(genericType))
+ {
+ if(!ClassUtil.checkParametrizedType((ParameterizedType)genericType))
+ {
+ throw new WebBeansConfigurationException("Producer annotated field : " + annotatedField + " can not be Wildcard type or Type variable");
+ }
+ }
+
+ Annotation[] anns = AnnotationUtil.asArray(annotatedField.getAnnotations());
+ Field field = annotatedField.getJavaMember();
+
+ //Producer field for resource
+ Annotation resourceAnnotation = AnnotationUtil.hasOwbInjectableResource(anns);
+ //Producer field for resource
+ if(resourceAnnotation != null)
+ {
+ //Check for valid resource annotation
+ //WebBeansUtil.checkForValidResources(annotatedField.getDeclaringType().getJavaClass(), field.getType(), field.getName(), anns);
+ if(!Modifier.isStatic(field.getModifiers()))
+ {
+ ResourceReference<T, Annotation> resourceRef = new ResourceReference<T, Annotation>(annotatedType.getJavaClass(), field.getName(),
+ (Class<T>)field.getType(), resourceAnnotation);
+
+ //Can not define EL name
+ if(annotatedField.isAnnotationPresent(Named.class))
+ {
+ throw new WebBeansConfigurationException("Resource producer annotated field : " + annotatedField + " can not define EL name");
+ }
+
+ BeanAttributesImpl<T> beanAttributes = BeanAttributesBuilder.forContext(webBeansContext).newBeanAttibutes((AnnotatedField<T>)annotatedField).build();
+ ResourceBeanBuilder<T, Annotation> resourceBeanCreator
+ = new ResourceBeanBuilder<T, Annotation>(bean, resourceRef, annotatedField, beanAttributes);
+ ResourceBean<T, Annotation> resourceBean = resourceBeanCreator.getBean();
+ resourceBean.setProducerField(field);
+ producerBeans.add(resourceBean);
+ }
+ }
+ else
+ {
+ BeanAttributesImpl<T> beanAttributes = BeanAttributesBuilder.forContext(webBeansContext).newBeanAttibutes((AnnotatedField<T>)annotatedField).build();
+ ProducerFieldBeanBuilder<T, ProducerFieldBean<T>> producerFieldBeanCreator
+ = new ProducerFieldBeanBuilder<T, ProducerFieldBean<T>>(bean, annotatedField, beanAttributes);
+ ProducerFieldBean<T> producerFieldBean = producerFieldBeanCreator.getBean();
+ webBeansContext.getDeploymentValidationService().validateProxyable(producerFieldBean);
+ producerFieldBean.setProducerField(field);
+
+ webBeansContext.getWebBeansUtil().setBeanEnableFlagForProducerBean(bean, producerFieldBean, anns);
+ WebBeansUtil.checkProducerGenericType(producerFieldBean, annotatedField.getJavaMember());
+
+ producerBeans.add(producerFieldBean);
+ }
+ }
+ }
+
+ return producerBeans;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeanBuilder.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeanBuilder.java
new file mode 100644
index 0000000..e86c9c2
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeanBuilder.java
@@ -0,0 +1,120 @@
+/*
+ * 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.webbeans.component.creation;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+
+import org.apache.webbeans.component.BeanAttributesImpl;
+import org.apache.webbeans.component.InjectionTargetBean;
+import org.apache.webbeans.component.ProducerMethodBean;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.ClassUtil;
+
+public class ProducerMethodBeanBuilder<T> extends AbstractProducerBeanBuilder<T, AnnotatedMethod<?>, ProducerMethodBean<T>>
+{
+
+ //X TODO arne: this should get evaluated or deleted if not needed anymore
+ private boolean specialized;
+
+ public ProducerMethodBeanBuilder(InjectionTargetBean<T> parent, AnnotatedMethod<?> annotatedMethod, BeanAttributesImpl<T> beanAttributes)
+ {
+ super(parent, annotatedMethod, beanAttributes);
+ }
+
+ public void configureProducerSpecialization(ProducerMethodBean<T> bean, AnnotatedMethod<T> annotatedMethod)
+ {
+ List<AnnotatedParameter<T>> annotatedParameters = annotatedMethod.getParameters();
+ List<Class<?>> parameters = new ArrayList<Class<?>>();
+ for(AnnotatedParameter<T> annotatedParam : annotatedParameters)
+ {
+ parameters.add(ClassUtil.getClass(annotatedParam.getBaseType()));
+ }
+
+ Method superMethod = bean.getWebBeansContext().getSecurityService().doPrivilegedGetDeclaredMethod(annotatedMethod.getDeclaringType().getJavaClass().getSuperclass(),
+ annotatedMethod.getJavaMember().getName(), parameters.toArray(new Class[parameters.size()]));
+
+ if (superMethod == null)
+ {
+ throw new WebBeansConfigurationException("Anontated producer method specialization is failed : " + annotatedMethod.getJavaMember().getName()
+ + " not found in super class : " + annotatedMethod.getDeclaringType().getJavaClass().getSuperclass().getName()
+ + " for annotated method : " + annotatedMethod);
+ }
+
+ if (!AnnotationUtil.hasAnnotation(superMethod.getAnnotations(), Produces.class))
+ {
+ throw new WebBeansConfigurationException("Anontated producer method specialization is failed : " + annotatedMethod.getJavaMember().getName()
+ + " found in super class : " + annotatedMethod.getDeclaringType().getJavaClass().getSuperclass().getName()
+ + " is not annotated with @Produces" + " for annotated method : " + annotatedMethod);
+ }
+
+ bean.setSpecializedBean(true);
+ }
+
+ //X TODO arne: this should get implemented or removed if not needed anymore
+ protected AnnotatedMethod<?> getSuperAnnotated()
+ {
+ AnnotatedMethod<?> thisMethod = annotatedMember;
+ for (AnnotatedMethod<?> superMethod: getSuperType().getMethods())
+ {
+ List<AnnotatedParameter<?>> thisParameters = (List<AnnotatedParameter<?>>)(List<?>)thisMethod.getParameters();
+ if (thisMethod.getJavaMember().getName().equals(superMethod.getJavaMember().getName())
+ && thisMethod.getBaseType().equals(superMethod.getBaseType())
+ && thisParameters.size() == superMethod.getParameters().size())
+ {
+ List<AnnotatedParameter<?>> superParameters = (List<AnnotatedParameter<?>>)(List<?>)superMethod.getParameters();
+ boolean match = true;
+ for (int i = 0; i < thisParameters.size(); i++)
+ {
+ if (!thisParameters.get(i).getBaseType().equals(superParameters.get(i).getBaseType()))
+ {
+ match = false;
+ break;
+ }
+ }
+ if (match)
+ {
+ return superMethod;
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ protected <P> ProducerMethodBean<T> createBean(InjectionTargetBean<P> parent, Class<T> beanClass)
+ {
+ AnnotatedMethod<P> annotatedMethod = (AnnotatedMethod<P>) annotatedMember;
+ ProducerMethodBean<T> producerMethodBean
+ = new ProducerMethodBean<T>(parent, beanAttributes, beanClass, new MethodProducerFactory<P>(annotatedMethod, parent, parent.getWebBeansContext()));
+ producerMethodBean.setSpecializedBean(specialized);
+ return producerMethodBean;
+ }
+
+ public ProducerMethodBean<T> getBean()
+ {
+ return createBean((Class<T>) annotatedMember.getJavaMember().getReturnType());
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeansBuilder.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeansBuilder.java
new file mode 100644
index 0000000..ba0dc26
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerMethodBeansBuilder.java
@@ -0,0 +1,161 @@
+/*
+ * 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.webbeans.component.creation;
+
+import org.apache.webbeans.component.BeanAttributesImpl;
+import org.apache.webbeans.component.InjectionTargetBean;
+import org.apache.webbeans.component.ProducerMethodBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.Asserts;
+import org.apache.webbeans.util.GenericsUtil;
+import org.apache.webbeans.util.WebBeansUtil;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.Specializes;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.inject.Inject;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Abstract implementation of {@link AbstractBeanBuilder}.
+ *
+ * @version $Rev$ $Date$
+ *
+ * @param <T> bean class type
+ */
+public class ProducerMethodBeansBuilder<T, I extends InjectionTargetBean<T>>
+{
+
+ protected final WebBeansContext webBeansContext;
+ protected final AnnotatedType<T> annotatedType;
+
+ /**
+ * Creates a new instance.
+ *
+ */
+ public ProducerMethodBeansBuilder(WebBeansContext webBeansContext, AnnotatedType<T> annotatedType)
+ {
+ Asserts.assertNotNull(webBeansContext, "webBeansContext may not be null");
+ Asserts.assertNotNull(annotatedType, "annotated type may not be null");
+ this.webBeansContext = webBeansContext;
+ this.annotatedType = annotatedType;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Set<ProducerMethodBean<?>> defineProducerMethods(InjectionTargetBean<T> bean)
+ {
+ Set<ProducerMethodBean<?>> producerBeans = new HashSet<ProducerMethodBean<?>>();
+ Set<AnnotatedMethod<? super T>> annotatedMethods = annotatedType.getMethods();
+
+ for(AnnotatedMethod<? super T> annotatedMethod: annotatedMethods)
+ {
+ if(annotatedMethod.isAnnotationPresent(Produces.class) &&
+ annotatedMethod.getJavaMember().getDeclaringClass().equals(annotatedType.getJavaClass()))
+ {
+ checkProducerMethodForDeployment(annotatedMethod);
+ boolean specialize = false;
+ if(annotatedMethod.isAnnotationPresent(Specializes.class))
+ {
+ if (annotatedMethod.isStatic())
+ {
+ throw new WebBeansConfigurationException("Specializing annotated producer method : " + annotatedMethod + " can not be static");
+ }
+
+ specialize = true;
+ }
+
+ BeanAttributesImpl<T> beanAttributes = BeanAttributesBuilder.forContext(webBeansContext).newBeanAttibutes((AnnotatedMethod<T>)annotatedMethod).build();
+ ProducerMethodBeanBuilder<T> producerMethodBeanCreator = new ProducerMethodBeanBuilder<T>(bean, annotatedMethod, beanAttributes);
+
+ ProducerMethodBean<T> producerMethodBean = producerMethodBeanCreator.getBean();
+
+ webBeansContext.getDeploymentValidationService().validateProxyable(producerMethodBean);
+
+ if(specialize)
+ {
+ producerMethodBeanCreator.configureProducerSpecialization(producerMethodBean, (AnnotatedMethod<T>) annotatedMethod);
+ }
+ MethodProducerFactory<?> producerFactory = new MethodProducerFactory(annotatedMethod, bean, webBeansContext);
+ producerMethodBean.setCreatorMethod(annotatedMethod.getJavaMember());
+
+ webBeansContext.getWebBeansUtil().setBeanEnableFlagForProducerBean(bean,
+ producerMethodBean,
+ AnnotationUtil.asArray(annotatedMethod.getAnnotations()));
+ WebBeansUtil.checkProducerGenericType(producerMethodBean, annotatedMethod.getJavaMember());
+ producerBeans.add(producerMethodBean);
+
+ }
+
+ }
+
+ // valid all @Disposes have a @Produces
+ for (final AnnotatedMethod<? super T> annotatedMethod : annotatedMethods)
+ {
+ for (final AnnotatedParameter<?> param : annotatedMethod.getParameters())
+ {
+ if (param.isAnnotationPresent(Disposes.class))
+ {
+ boolean found = false;
+ for (final ProducerMethodBean<?> producer : producerBeans)
+ {
+ if (GenericsUtil.satisfiesDependency(false, producer.getCreatorMethod().getGenericReturnType(), param.getBaseType()))
+ {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ throw new WebBeansConfigurationException("@Disposes without @Produces " + annotatedMethod.getJavaMember());
+ }
+ break;
+ }
+ }
+ }
+
+ return producerBeans;
+ }
+
+ /**
+ * Check producer method is ok for deployment.
+ *
+ * @param annotatedMethod producer method
+ */
+ private void checkProducerMethodForDeployment(AnnotatedMethod<? super T> annotatedMethod)
+ {
+ Asserts.assertNotNull(annotatedMethod, "annotatedMethod argument can not be null");
+
+ if (annotatedMethod.isAnnotationPresent(Inject.class) ||
+ annotatedMethod.isAnnotationPresent(Disposes.class) ||
+ annotatedMethod.isAnnotationPresent(Observes.class))
+ {
+ throw new WebBeansConfigurationException("Producer annotated method : " + annotatedMethod + " can not be annotated with"
+ + " @Initializer/@Destructor annotation or has a parameter annotated with @Disposes/@Observes");
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ResourceBeanBuilder.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ResourceBeanBuilder.java
new file mode 100644
index 0000000..56be7e4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ResourceBeanBuilder.java
@@ -0,0 +1,46 @@
+/*
+ * 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.webbeans.component.creation;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.inject.spi.AnnotatedField;
+
+import org.apache.webbeans.component.BeanAttributesImpl;
+import org.apache.webbeans.component.InjectionTargetBean;
+import org.apache.webbeans.component.ResourceBean;
+import org.apache.webbeans.spi.api.ResourceReference;
+
+public class ResourceBeanBuilder<T, R extends Annotation> extends ProducerFieldBeanBuilder<T, ResourceBean<T, R>>
+{
+
+ private ResourceReference<T, R> resourceRef;
+
+ public ResourceBeanBuilder(InjectionTargetBean<?> parent, ResourceReference<T, R> resourceRef, AnnotatedField<?> annotatedField, BeanAttributesImpl<T> beanAttributes)
+ {
+ super(parent, annotatedField, beanAttributes);
+ this.resourceRef = resourceRef;
+ }
+
+ @Override
+ protected <X> ResourceBean<T, R> createBean(InjectionTargetBean<X> owner, Class<T> beanClass)
+ {
+ return new ResourceBean<T, R>(owner, resourceRef, beanAttributes, beanClass);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/SelfInterceptorBeanBuilder.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/SelfInterceptorBeanBuilder.java
new file mode 100644
index 0000000..67e4d30
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/SelfInterceptorBeanBuilder.java
@@ -0,0 +1,66 @@
+/*
+ * 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.webbeans.component.creation;
+
+
+import java.lang.reflect.Method;
+import java.util.Map;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InterceptionType;
+
+import org.apache.webbeans.component.BeanAttributesImpl;
+import org.apache.webbeans.component.SelfInterceptorBean;
+import org.apache.webbeans.config.WebBeansContext;
+
+/**
+ * Bean builder for {@link org.apache.webbeans.component.InterceptorBean}s.
+ */
+public class SelfInterceptorBeanBuilder<T> extends InterceptorBeanBuilder<T, SelfInterceptorBean<T>>
+{
+ private boolean enabled = false;
+
+ public SelfInterceptorBeanBuilder(WebBeansContext webBeansContext, AnnotatedType<T> annotatedType, BeanAttributesImpl<T> beanAttributes)
+ {
+ super(webBeansContext, annotatedType, beanAttributes);
+ }
+
+ public void defineSelfInterceptorRules()
+ {
+
+ // we do NOT invoke checkInterceptorConditions();
+ // self-interceptors have different rules!
+
+ // we do NOT invoke defineInterceptorRules() !
+
+ enabled = defineInterceptorMethods();
+ }
+
+ @Override
+ public boolean isInterceptorEnabled()
+ {
+ return enabled;
+ }
+
+ @Override
+ protected SelfInterceptorBean<T> createBean(Class<T> beanClass, boolean enabled, Map<InterceptionType, Method[]> interceptionMethods, Method aroundConstruct)
+ {
+ return new SelfInterceptorBean<T>(webBeansContext, annotatedType, beanAttributes, beanClass, interceptionMethods, aroundConstruct);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/spi/BeanAttributes.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/spi/BeanAttributes.java
new file mode 100644
index 0000000..07ff00f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/spi/BeanAttributes.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.component.spi;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+/**
+ * This is a preview to CDI 1.1
+ * when we implement CDI 1.1 this interface can be removed
+ */
+public interface BeanAttributes<T>
+{
+ Set<Type> getTypes();
+ Set<Annotation> getQualifiers();
+ Class<? extends Annotation> getScope();
+ String getName();
+ Set<Class<? extends Annotation>> getStereotypes();
+ boolean isAlternative();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/spi/InjectionTargetFactory.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/spi/InjectionTargetFactory.java
new file mode 100644
index 0000000..c53aa9e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/spi/InjectionTargetFactory.java
@@ -0,0 +1,31 @@
+/*
+ * 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.webbeans.component.spi;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionTarget;
+
+/**
+ * This is a preview to CDI 1.1
+ * when we implement CDI 1.1 this interface can be removed
+ */
+public interface InjectionTargetFactory<T>
+{
+ public InjectionTarget<T> createInjectionTarget(Bean<T> bean);
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/spi/ProducerFactory.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/spi/ProducerFactory.java
new file mode 100644
index 0000000..8fbced0
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/spi/ProducerFactory.java
@@ -0,0 +1,31 @@
+/*
+ * 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.webbeans.component.spi;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Producer;
+
+/**
+ * This is a preview to CDI 1.1
+ * when we implement CDI 1.1 this interface can be removed
+ */
+public interface ProducerFactory<X>
+{
+ public <T> Producer<T> createProducer(Bean<T> bean);
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/third/PassivationCapableThirdpartyBeanImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/third/PassivationCapableThirdpartyBeanImpl.java
new file mode 100644
index 0000000..0f765d9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/third/PassivationCapableThirdpartyBeanImpl.java
@@ -0,0 +1,47 @@
+/*
+ * 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.webbeans.component.third;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.PassivationCapable;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+public class PassivationCapableThirdpartyBeanImpl<T> extends ThirdpartyBeanImpl<T> implements PassivationCapable
+{
+ private final String id;
+
+ public PassivationCapableThirdpartyBeanImpl(WebBeansContext webBeansContext, Bean<T> bean)
+ {
+ super(webBeansContext, bean);
+ id = PassivationCapable.class.cast(bean).getId();
+ }
+
+ @Override
+ public String getId()
+ {
+ return id;
+ }
+
+ @Override
+ public boolean isPassivationCapable()
+ {
+ return true;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java
new file mode 100644
index 0000000..6141c13
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java
@@ -0,0 +1,168 @@
+/*
+ * 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.webbeans.component.third;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.Producer;
+
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.component.BeanAttributesImpl;
+import org.apache.webbeans.component.WebBeansType;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.inject.AlternativesManager;
+
+public class ThirdpartyBeanImpl<T> extends AbstractOwbBean<T> implements Bean<T>
+{
+ private Bean<T> bean = null;
+
+ public ThirdpartyBeanImpl(WebBeansContext webBeansContext, Bean<T> bean)
+ {
+ super(webBeansContext,
+ WebBeansType.THIRDPARTY,
+ new BeanAttributesImpl<T>(bean),
+ bean.getBeanClass(),
+ bean.isNullable());
+
+ this.bean = bean;
+
+ }
+
+ @Override
+ public Producer<T> getProducer()
+ {
+ return new Producer<T>()
+ {
+ @Override
+ public T produce(CreationalContext<T> creationalContext)
+ {
+ return bean.create(creationalContext);
+ }
+
+ @Override
+ public void dispose(T instance)
+ {
+ bean.destroy(instance, null);
+ }
+
+ @Override
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ return bean.getInjectionPoints();
+ }
+ };
+ }
+
+ @Override
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ return bean.getInjectionPoints();
+ }
+
+ @Override
+ public T create(CreationalContext<T> context)
+ {
+
+ return bean.create(context);
+ }
+
+ @Override
+ public void destroy(T instance, CreationalContext<T> context)
+ {
+ bean.destroy(instance,context);
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.webbeans.component.AbstractBean#getId()
+ */
+ @Override
+ public String getId()
+ {
+ return null;
+ }
+
+ @Override
+ public boolean isPassivationCapable()
+ {
+ return false;
+ }
+
+ @Override
+ public Class<?> getBeanClass()
+ {
+ return bean.getBeanClass();
+ }
+
+ @Override
+ public boolean isAlternative()
+ {
+ boolean alternative = super.isAlternative();
+ if(alternative)
+ {
+ AlternativesManager manager = getWebBeansContext().getAlternativesManager();
+ //Class alternative
+ if(manager.isClassAlternative(getBeanClass()))
+ {
+ return true;
+ }
+
+ Set<Class<? extends Annotation>> stereoTypes = bean.getStereotypes();
+ if(stereoTypes != null)
+ {
+ for(Class<? extends Annotation> stereo : stereoTypes)
+ {
+ if(manager.isStereoAlternative(stereo))
+ {
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * We need to override the hash code from the AbstractOwbBean
+ * and delegate to the shaded instance.
+ *
+ * @return the hash mixed with the shadowed bean.
+ */
+ @Override
+ public int hashCode()
+ {
+ return 29 * bean.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object other)
+ {
+ if (other instanceof ThirdpartyBeanImpl)
+ {
+ return ((ThirdpartyBeanImpl) other).bean.equals(bean);
+ }
+
+ return bean.equals(other);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
new file mode 100644
index 0000000..0c5abf6
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
@@ -0,0 +1,1092 @@
+/*
+ * 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.webbeans.config;
+
+import org.apache.webbeans.annotation.AnnotationManager;
+import org.apache.webbeans.component.AbstractProducerBean;
+import org.apache.webbeans.component.BeanAttributesImpl;
+import org.apache.webbeans.component.CdiInterceptorBean;
+import org.apache.webbeans.component.DecoratorBean;
+import org.apache.webbeans.component.EnterpriseBeanMarker;
+import org.apache.webbeans.component.InjectionTargetBean;
+import org.apache.webbeans.component.ManagedBean;
+import org.apache.webbeans.component.OwbBean;
+import org.apache.webbeans.component.ProducerFieldBean;
+import org.apache.webbeans.component.ProducerMethodBean;
+import org.apache.webbeans.component.creation.BeanAttributesBuilder;
+import org.apache.webbeans.component.creation.CdiInterceptorBeanBuilder;
+import org.apache.webbeans.component.creation.DecoratorBeanBuilder;
+import org.apache.webbeans.component.creation.ManagedBeanBuilder;
+import org.apache.webbeans.component.creation.ObserverMethodsBuilder;
+import org.apache.webbeans.component.creation.ProducerFieldBeansBuilder;
+import org.apache.webbeans.component.creation.ProducerMethodBeansBuilder;
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.container.InjectableBeanManager;
+import org.apache.webbeans.container.InjectionResolver;
+import org.apache.webbeans.corespi.se.DefaultJndiService;
+import org.apache.webbeans.deployment.StereoTypeModel;
+import org.apache.webbeans.event.ObserverMethodImpl;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.exception.WebBeansDeploymentException;
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.exception.inject.DefinitionException;
+import org.apache.webbeans.exception.inject.DeploymentException;
+import org.apache.webbeans.exception.inject.InconsistentSpecializationException;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.portable.AbstractProducer;
+import org.apache.webbeans.portable.AnnotatedElementFactory;
+import org.apache.webbeans.portable.events.ProcessAnnotatedTypeImpl;
+import org.apache.webbeans.portable.events.ProcessBeanImpl;
+import org.apache.webbeans.portable.events.ProcessInjectionTargetImpl;
+import org.apache.webbeans.portable.events.discovery.AfterBeanDiscoveryImpl;
+import org.apache.webbeans.portable.events.discovery.AfterDeploymentValidationImpl;
+import org.apache.webbeans.portable.events.discovery.BeforeBeanDiscoveryImpl;
+import org.apache.webbeans.portable.events.generics.GProcessManagedBean;
+import org.apache.webbeans.spi.JNDIService;
+import org.apache.webbeans.spi.ScannerService;
+import org.apache.webbeans.spi.plugins.OpenWebBeansJavaEEPlugin;
+import org.apache.webbeans.spi.plugins.OpenWebBeansWebPlugin;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.ClassUtil;
+import org.apache.webbeans.util.ExceptionUtil;
+import org.apache.webbeans.util.InjectionExceptionUtil;
+import org.apache.webbeans.util.WebBeansConstants;
+import org.apache.webbeans.util.WebBeansUtil;
+import org.apache.webbeans.xml.WebBeansXMLConfigurator;
+
+import javax.enterprise.context.NormalScope;
+import javax.enterprise.inject.AmbiguousResolutionException;
+import javax.enterprise.inject.Model;
+import javax.enterprise.inject.Specializes;
+import javax.enterprise.inject.UnproxyableResolutionException;
+import javax.enterprise.inject.UnsatisfiedResolutionException;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Decorator;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.Interceptor;
+import javax.enterprise.inject.spi.ObserverMethod;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.net.URL;
+import java.security.PrivilegedActionException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Stack;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Deploys the all beans that are defined in the {@link org.apache.webbeans.spi.ScannerService} at
+ * the scanner phase.
+ */
+@SuppressWarnings("unchecked")
+//This class written as single threaded.
+public class BeansDeployer
+{
+ //Logger instance
+ private static final Logger logger = WebBeansLoggerFacade.getLogger(BeansDeployer.class);
+ public static final String JAVAX_ENTERPRISE_PACKAGE = "javax.enterprise.";
+
+ /**Deployment is started or not*/
+ protected boolean deployed = false;
+
+ /**XML Configurator*/
+ protected WebBeansXMLConfigurator xmlConfigurator = null;
+
+ /**Discover ejb or not*/
+ protected boolean discoverEjb = false;
+ private final WebBeansContext webBeansContext;
+
+ /**
+ * Creates a new deployer with given xml configurator.
+ *
+ * @param xmlConfigurator xml configurator
+ * @param webBeansContext
+ */
+ public BeansDeployer(WebBeansXMLConfigurator xmlConfigurator, WebBeansContext webBeansContext)
+ {
+ this.xmlConfigurator = xmlConfigurator;
+ this.webBeansContext = webBeansContext;
+ String usage = this.webBeansContext.getOpenWebBeansConfiguration().getProperty(OpenWebBeansConfiguration.USE_EJB_DISCOVERY);
+ discoverEjb = Boolean.parseBoolean(usage);
+ }
+
+ /**
+ * Deploys all the defined web beans components in the container startup.
+ * <p>
+ * It deploys from the web-beans.xml files and from the class files. It uses
+ * the {@link org.apache.webbeans.spi.ScannerService} to get classes.
+ * </p>
+ *
+ * @throws WebBeansDeploymentException if any deployment exception occurs
+ */
+ public synchronized void deploy(ScannerService scanner)
+ {
+ try
+ {
+ if (!deployed)
+ {
+ //Load Extensions
+ webBeansContext.getExtensionLoader().loadExtensionServices();
+
+ // Bind manager
+ JNDIService service = webBeansContext.getService(JNDIService.class);
+
+ //Default jndi is just a map
+ if(service instanceof DefaultJndiService)
+ {
+ service.bind(WebBeansConstants.WEB_BEANS_MANAGER_JNDI_NAME, new InjectableBeanManager(webBeansContext.getBeanManagerImpl()));
+ }
+ //Assume, actual JNDI implementation
+ else
+ {
+ service.bind(WebBeansConstants.WEB_BEANS_MANAGER_JNDI_NAME, webBeansContext.getBeanManagerImpl().getReference());
+ }
+
+ // Register Manager built-in component
+ webBeansContext.getBeanManagerImpl().addInternalBean(webBeansContext.getWebBeansUtil().getManagerBean());
+
+ //Fire Event
+ fireBeforeBeanDiscoveryEvent();
+
+ //Deploy bean from XML. Also configures deployments, interceptors, decorators.
+ deployFromXML(scanner);
+
+ //Checking stereotype conditions
+ checkStereoTypes(scanner);
+
+ //Configure Default Beans
+ configureDefaultBeans();
+
+ //Discover classpath classes
+ deployFromClassPath(scanner);
+
+ //Deploy additional Annotated Types
+ deployAdditionalAnnotatedTypes();
+
+ //Check Specialization
+ processSpecializations(scanner);
+
+ //Fire Event
+ fireAfterBeanDiscoveryEvent();
+
+ //Validate injection Points
+ validateInjectionPoints();
+
+ //Fire Event
+ fireAfterDeploymentValidationEvent();
+
+
+ // do some cleanup after the deployment
+ scanner.release();
+ webBeansContext.getAnnotatedElementFactory().clear();
+ }
+ }
+ catch (UnsatisfiedResolutionException e)
+ {
+ throw new DeploymentException(e);
+ }
+ catch (AmbiguousResolutionException e)
+ {
+ throw new DeploymentException(e);
+ }
+ catch (UnproxyableResolutionException e)
+ {
+ // the tck expects a DeploymentException, but it really should be a DefinitionException, see i.e. https://issues.jboss.org/browse/CDITCK-346
+ throw new DeploymentException(e);
+ }
+ catch (WebBeansConfigurationException e)
+ {
+ throw new DeploymentException(e);
+ }
+ catch (Exception e)
+ {
+ throw ExceptionUtil.throwAsRuntimeException(e);
+ }
+ finally
+ {
+ //if bootstrapping failed, it doesn't make sense to do it again
+ //esp. because #addInternalBean might have been called already and would cause an exception in the next run
+ deployed = true;
+ }
+ }
+
+ /**
+ * Configure Default Beans.
+ */
+ private void configureDefaultBeans()
+ {
+ BeanManagerImpl beanManager = webBeansContext.getBeanManagerImpl();
+ WebBeansUtil webBeansUtil = webBeansContext.getWebBeansUtil();
+
+ // Register Conversation built-in component
+ beanManager.addInternalBean(webBeansUtil.getConversationBean());
+
+ // Register InjectionPoint bean
+ beanManager.addInternalBean(webBeansUtil.getInjectionPointBean());
+
+ //Register Instance Bean
+ beanManager.addInternalBean(webBeansUtil.getInstanceBean());
+
+ //Register Event Bean
+ beanManager.addInternalBean(webBeansUtil.getEventBean());
+
+ //Register Metadata Beans
+ beanManager.addInternalBean(webBeansUtil.getBeanMetadataBean());
+ beanManager.addInternalBean(webBeansUtil.getInterceptorMetadataBean());
+ beanManager.addInternalBean(webBeansUtil.getDecoratorMetadataBean());
+ beanManager.addInternalBean(webBeansUtil.getInterceptedOrDecoratedBeanMetadataBean());
+
+ //REgister Provider Beans
+ OpenWebBeansJavaEEPlugin beanEeProvider = webBeansContext.getPluginLoader().getJavaEEPlugin();
+ OpenWebBeansWebPlugin beanWebProvider = webBeansContext.getPluginLoader().getWebPlugin();
+
+ if(beanEeProvider != null)
+ {
+ addDefaultBean(webBeansContext, "org.apache.webbeans.ee.common.beans.PrincipalBean");
+ addDefaultBean(webBeansContext, "org.apache.webbeans.ee.beans.ValidatorBean");
+ addDefaultBean(webBeansContext, "org.apache.webbeans.ee.beans.ValidatorFactoryBean");
+ addDefaultBean(webBeansContext, "org.apache.webbeans.ee.beans.UserTransactionBean");
+ }
+ else if(beanWebProvider != null)
+ {
+ addDefaultBean(webBeansContext, "org.apache.webbeans.ee.common.beans.PrincipalBean");
+ }
+
+ }
+
+ private void addDefaultBean(WebBeansContext ctx,String className)
+ {
+ Bean<?> bean = null;
+
+ Class<?> beanClass = ClassUtil.getClassFromName(className);
+ if(beanClass != null)
+ {
+ bean = (Bean)newInstance(ctx, beanClass);
+ }
+
+ if(bean != null)
+ {
+ ctx.getBeanManagerImpl().addInternalBean(bean);
+ }
+ }
+
+ /**
+ * create a new instance of the class
+ */
+ private Object newInstance(WebBeansContext wbc, Class<?> clazz)
+ {
+ try
+ {
+ if(System.getSecurityManager() != null)
+ {
+ final Constructor<?> c = webBeansContext.getSecurityService().doPrivilegedGetConstructor(clazz, WebBeansContext.class);
+ if (c == null)
+ {
+ return webBeansContext.getSecurityService().doPrivilegedObjectCreate(clazz);
+ }
+ return c.newInstance(wbc);
+ }
+
+ if (clazz.getConstructors().length > 0)
+ {
+ try
+ {
+ return clazz.getConstructor(new Class<?>[] { WebBeansContext.class }).newInstance(wbc);
+ }
+ catch (final Exception e)
+ {
+ return clazz.newInstance();
+ }
+ }
+ return clazz.newInstance();
+
+ }
+ catch(Exception e)
+ {
+ Throwable cause = e;
+ if(e instanceof PrivilegedActionException)
+ {
+ cause = e.getCause();
+ }
+
+ String error = "Error occurred while creating an instance of class : " + clazz.getName();
+ logger.log(Level.SEVERE, error, cause);
+ throw new WebBeansException(error,cause);
+ }
+ }
+
+ /**
+ * Fires event before bean discovery.
+ */
+ private void fireBeforeBeanDiscoveryEvent()
+ {
+ BeanManagerImpl manager = webBeansContext.getBeanManagerImpl();
+ manager.fireLifecycleEvent(new BeforeBeanDiscoveryImpl(webBeansContext));
+ }
+
+ /**
+ * Fires event after bean discovery.
+ */
+ private void fireAfterBeanDiscoveryEvent()
+ {
+ BeanManagerImpl manager = webBeansContext.getBeanManagerImpl();
+ manager.fireLifecycleEvent(new AfterBeanDiscoveryImpl(webBeansContext));
+
+ webBeansContext.getWebBeansUtil().inspectErrorStack(
+ "There are errors that are added by AfterBeanDiscovery event observers. Look at logs for further details");
+ }
+
+ /**
+ * Fires event after deployment valdiation.
+ */
+ private void fireAfterDeploymentValidationEvent()
+ {
+ BeanManagerImpl manager = webBeansContext.getBeanManagerImpl();
+ manager.fireLifecycleEvent(new AfterDeploymentValidationImpl(manager));
+
+ webBeansContext.getWebBeansUtil().inspectErrorStack(
+ "There are errors that are added by AfterDeploymentValidation event observers. Look at logs for further details");
+ }
+
+ /**
+ * Validate all injection points.
+ */
+ private void validateInjectionPoints()
+ {
+ logger.fine("Validation of injection points has started.");
+
+ webBeansContext.getDecoratorsManager().validateDecoratorClasses();
+ webBeansContext.getInterceptorsManager().validateInterceptorClasses();
+
+ Set<Bean<?>> beans = new HashSet<Bean<?>>();
+
+ //Adding decorators to validate
+ Set<Decorator<?>> decorators = webBeansContext.getDecoratorsManager().getDecorators();
+
+ beans.addAll(decorators);
+
+
+ logger.fine("Validation of the decorator's injection points has started.");
+
+ //Validate Decorators
+ validate(beans);
+
+ beans.clear();
+
+ //Adding interceptors to validate
+ List<javax.enterprise.inject.spi.Interceptor<?>> interceptors = webBeansContext.getInterceptorsManager().getCdiInterceptors();
+ for(javax.enterprise.inject.spi.Interceptor interceptor : interceptors)
+ {
+ beans.add(interceptor);
+ }
+
+ logger.fine("Validation of the interceptor's injection points has started.");
+
+ //Validate Interceptors
+ validate(beans);
+
+ beans.clear();
+
+ beans = webBeansContext.getBeanManagerImpl().getBeans();
+
+ //Validate Others
+ validate(beans);
+
+ logger.info(OWBLogConst.INFO_0003);
+ }
+
+ /**
+ * Validates beans.
+ *
+ * @param beans deployed beans
+ */
+ private <T> void validate(Set<Bean<?>> beans)
+ {
+ BeanManagerImpl manager = webBeansContext.getBeanManagerImpl();
+
+ if (beans != null && beans.size() > 0)
+ {
+ Stack<String> beanNames = new Stack<String>();
+ for (Bean<?> bean : beans)
+ {
+ if (bean instanceof OwbBean && !((OwbBean)bean).isEnabled())
+ {
+ // we skip disabled beans
+ continue;
+ }
+
+ //don't validate the cdi-api
+ if (bean.getBeanClass().getName().startsWith(JAVAX_ENTERPRISE_PACKAGE))
+ {
+ continue;
+ }
+
+ String beanName = bean.getName();
+ if(beanName != null)
+ {
+ beanNames.push(beanName);
+ }
+
+ if (bean instanceof OwbBean && !(bean instanceof Interceptor) && !(bean instanceof Decorator))
+ {
+ OwbBean<T> owbBean = (OwbBean<T>)bean;
+ if (owbBean.getProducer() instanceof AbstractProducer)
+ {
+ AbstractProducer<T> producer = (AbstractProducer<T>)owbBean.getProducer();
+ AnnotatedType<T> annotatedType;
+ if (owbBean instanceof InjectionTargetBean)
+ {
+ annotatedType = ((InjectionTargetBean<T>)owbBean).getAnnotatedType();
+ }
+ else
+ {
+ annotatedType = webBeansContext.getAnnotatedElementFactory().newAnnotatedType(owbBean.getReturnType());
+ }
+ producer.defineInterceptorStack(owbBean, annotatedType, webBeansContext);
+ }
+ }
+
+ //Check passivation scope
+ checkPassivationScope(bean);
+
+ //Bean injection points
+ Set<InjectionPoint> injectionPoints = bean.getInjectionPoints();
+
+ //Check injection points
+ if(injectionPoints != null)
+ {
+ for (InjectionPoint injectionPoint : injectionPoints)
+ {
+ if(!injectionPoint.isDelegate())
+ {
+ manager.validate(injectionPoint);
+ }
+ else
+ {
+ if(!bean.getBeanClass().isAnnotationPresent(javax.decorator.Decorator.class)
+ && !webBeansContext.getDecoratorsManager().containsCustomDecoratorClass(bean.getBeanClass()))
+ {
+ throw new WebBeansConfigurationException(
+ "Delegate injection points can not defined by beans that are not decorator. Injection point : "
+ + injectionPoint);
+ }
+ }
+ }
+ }
+ }
+
+ //Validate Bean names
+ validateBeanNames(beanNames);
+
+ //Clear Names
+ beanNames.clear();
+ }
+
+ }
+
+ private void validateBeanNames(Stack<String> beanNames)
+ {
+ if(beanNames.size() > 0)
+ {
+ for(String beanName : beanNames)
+ {
+ for(String other : beanNames)
+ {
+ String part = null;
+ int i = beanName.lastIndexOf('.');
+ if(i != -1)
+ {
+ part = beanName.substring(0,i);
+ }
+
+ if(beanName.equals(other))
+ {
+ InjectionResolver resolver = webBeansContext.getBeanManagerImpl().getInjectionResolver();
+ Set<Bean<?>> beans = resolver.implResolveByName(beanName);
+ if(beans.size() > 1)
+ {
+ beans = resolver.findByAlternatives(beans);
+ if(beans.size() > 1)
+ {
+ InjectionExceptionUtil.throwAmbiguousResolutionExceptionForBeanName(beans, beanName);
+ }
+ }
+ }
+ else
+ {
+ if(part != null)
+ {
+ if(part.equals(other))
+ {
+ throw new WebBeansConfigurationException("EL name of one bean is of the form x.y, where y is a valid bean EL name, and " +
+ "x is the EL name of the other bean for the bean name : " + beanName);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+
+ /**
+ * Discovers and deploys classes from class path.
+ *
+ * @param scanner discovery scanner
+ * @throws ClassNotFoundException if class not found
+ */
+ protected void deployFromClassPath(ScannerService scanner) throws ClassNotFoundException
+ {
+ logger.fine("Deploying configurations from class files has started.");
+
+ // Start from the class
+ Set<Class<?>> classIndex = scanner.getBeanClasses();
+
+ //Iterating over each class
+ if (classIndex != null)
+ {
+ AnnotatedElementFactory annotatedElementFactory = webBeansContext.getAnnotatedElementFactory();
+
+ for(Class<?> implClass : classIndex)
+ {
+ //Define annotation type
+ AnnotatedType<?> annotatedType = annotatedElementFactory.newAnnotatedType(implClass);
+
+ if (null != annotatedType)
+ {
+ deploySingleAnnotatedType(implClass, annotatedType);
+
+ // if the implClass already gets processed as part of the
+ // standard BDA scanning, then we don't need to 'additionally'
+ // deploy it anymore.
+ webBeansContext.getBeanManagerImpl().removeAdditionalAnnotatedType(annotatedType);
+ }
+ else
+ {
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.fine("Error creating managed bean " + implClass);
+ }
+
+ }
+
+ }
+ }
+
+ logger.fine("Deploying configurations from class files has ended.");
+
+ }
+
+ /**
+ * Deploys any AnnotatedTypes added to the BeanManager during beforeBeanDiscovery.
+ */
+ private void deployAdditionalAnnotatedTypes()
+ {
+ BeanManagerImpl beanManager = webBeansContext.getBeanManagerImpl();
+
+ Collection<AnnotatedType<?>> annotatedTypes = beanManager.getAdditionalAnnotatedTypes();
+
+ for(AnnotatedType<?> type : annotatedTypes)
+ {
+ Class implClass = type.getJavaClass();
+
+ deploySingleAnnotatedType(implClass, type);
+ }
+ }
+
+ /**
+ * Common helper method used to deploy annotated types discovered through
+ * scanning or during beforeBeanDiscovery.
+ *
+ * @param implClass the class of the bean to be deployed
+ * @param annotatedType the AnnotatedType representing the bean to be deployed
+ */
+ private void deploySingleAnnotatedType(Class implClass, AnnotatedType annotatedType)
+ {
+ // Fires ProcessAnnotatedType
+ ProcessAnnotatedTypeImpl<?> processAnnotatedEvent =
+ webBeansContext.getWebBeansUtil().fireProcessAnnotatedTypeEvent(annotatedType);
+
+ // if veto() is called
+ if (processAnnotatedEvent.isVeto())
+ {
+ return;
+ }
+
+ Class beanClass = processAnnotatedEvent.getAnnotatedType().getJavaClass();
+
+ // EJBs can be defined so test them really before going for a ManagedBean
+ if (discoverEjb && EJBWebBeansConfigurator.isSessionBean(implClass, webBeansContext))
+ {
+ logger.log(Level.FINE, "Found Enterprise Bean with class name : [{0}]", implClass.getName());
+ defineEnterpriseWebBean((Class<Object>) implClass, (ProcessAnnotatedTypeImpl<Object>) processAnnotatedEvent);
+ }
+ else
+ {
+ try
+ {
+ if((ClassUtil.isConcrete(beanClass) || WebBeansUtil.isDecorator(processAnnotatedEvent.getAnnotatedType()))
+ && isValidManagedBean(processAnnotatedEvent.getAnnotatedType()))
+ {
+ defineManagedBean(processAnnotatedEvent);
+ }
+ }
+ catch (NoClassDefFoundError ncdfe)
+ {
+ logger.info("Skipping deployment of Class " + implClass + "due to a NoClassDefFoundError: " + ncdfe.getMessage());
+ }
+ }
+ }
+
+ private boolean isValidManagedBean(final AnnotatedType<?> type)
+ {
+ final Class<?> beanClass = type.getJavaClass();
+ final WebBeansUtil webBeansUtil = webBeansContext.getWebBeansUtil();
+
+ // done separately to be able to swallow the logging when not relevant and avoid to pollute logs
+ if (!webBeansUtil.isConstructorOk(beanClass))
+ {
+ if (isNormalScoped(type))
+ {
+ logger.info("Bean implementation class : " + beanClass.getName() + " must define at least one Constructor");
+ } // else not an issue
+ return false;
+ }
+
+ try
+ {
+ webBeansUtil.checkManagedBean(beanClass);
+ }
+ catch (final DefinitionException e)
+ {
+ logger.log(Level.FINE, "skipped deployment of: " + beanClass.getName() + " reason: " + e.getMessage());
+ logger.log(Level.FINER, "skipped deployment of: " + beanClass.getName() + " details: ", e);
+ return false;
+ }
+ //we are not allowed to catch possible exceptions thrown by the following method
+ webBeansUtil.checkManagedBeanCondition(beanClass);
+ return true;
+ }
+
+ private static boolean isNormalScoped(final AnnotatedType<?> type)
+ {
+ final Set<Annotation> annotations = type.getAnnotations();
+ if (annotations != null)
+ {
+ for (final Annotation a : annotations)
+ {
+ if (AnnotationUtil.hasMetaAnnotation(a.annotationType().getAnnotations(), NormalScope.class)
+ || AnnotationUtil.hasAnnotation(a.annotationType().getAnnotations(), NormalScope.class))
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Discovers and deploys alternatives, interceptors and decorators from XML.
+ *
+ * @param scanner discovery scanner
+ *
+ * @throws WebBeansDeploymentException if a problem occurs
+ */
+ protected void deployFromXML(ScannerService scanner) throws WebBeansDeploymentException
+ {
+ logger.fine("Deploying configurations from XML files has started.");
+
+ Set<URL> xmlLocations = scanner.getBeanXmls();
+ Iterator<URL> it = xmlLocations.iterator();
+
+ while (it.hasNext())
+ {
+ URL url = it.next();
+
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.fine("OpenWebBeans BeansDeployer configuring: " + url.toExternalForm());
+ }
+
+ InputStream fis = null;
+ try
+ {
+ fis = url.openStream();
+
+ xmlConfigurator.configure(fis, url.toExternalForm(), scanner);
+ }
+ catch (IOException e)
+ {
+ throw new WebBeansDeploymentException("Error configuring: filename: " + url.toExternalForm() , e);
+ }
+ finally
+ {
+ if (fis != null)
+ {
+ try
+ {
+ fis.close();
+ }
+ catch (IOException e)
+ {
+ // all ok, ignore this!
+ }
+ }
+ }
+ }
+
+ if(logger.isLoggable(Level.FINE))
+ {
+ logger.fine("Deploying configurations from XML has ended successfully.");
+ }
+ }
+
+ /**
+ * Checks specialization.
+ * @param scanner scanner instance
+ */
+ protected void processSpecializations(ScannerService scanner)
+ {
+ logger.fine("Checking Specialization constraints has started.");
+
+ try
+ {
+ Set<Class<?>> beanClasses = scanner.getBeanClasses();
+ if (beanClasses != null && beanClasses.size() > 0)
+ {
+ //superClassList is used to handle the case: Car, CarToyota, Bus, SchoolBus, CarFord
+ //for which case, the owb should throw exception that both CarToyota and CarFord are
+ //specialize Car.
+ Class<?> superClass;
+ ArrayList<Class<?>> superClassList = new ArrayList<Class<?>>();
+ ArrayList<Class<?>> specialClassList = new ArrayList<Class<?>>();
+ for(Class<?> specialClass : beanClasses)
+ {
+ if(AnnotationUtil.hasClassAnnotation(specialClass, Specializes.class))
+ {
+ superClass = specialClass.getSuperclass();
+ if(superClass.equals(Object.class))
+ {
+ throw new WebBeansConfigurationException(WebBeansLoggerFacade.getTokenString(OWBLogConst.EXCEPT_0003) + specialClass.getName()
+ + WebBeansLoggerFacade.getTokenString(OWBLogConst.EXCEPT_0004));
+ }
+ if (superClassList.contains(superClass))
+ {
+ // since CDI 1.1 we have to wrap this in a DeploymentException
+ InconsistentSpecializationException exception
+ = new InconsistentSpecializationException(WebBeansLoggerFacade.getTokenString(OWBLogConst.EXCEPT_0005) + superClass.getName());
+ throw new WebBeansDeploymentException(exception);
+ }
+ superClassList.add(superClass);
+ specialClassList.add(specialClass);
+ }
+ }
+ webBeansContext.getWebBeansUtil().configureSpecializations(specialClassList);
+ }
+
+
+ //configure specialized producer beans.
+ webBeansContext.getWebBeansUtil().configureProducerMethodSpecializations();
+ }
+ catch (DefinitionException e)
+ {
+ throw e;
+ }
+ catch (DeploymentException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new WebBeansDeploymentException(e);
+ }
+
+
+ logger.fine("Checking Specialization constraints has ended.");
+ }
+
+
+ /**
+ * Check passivations.
+ */
+ protected void checkPassivationScope(Bean<?> beanObj)
+ {
+ boolean validate = false;
+
+ if(beanObj instanceof EnterpriseBeanMarker)
+ {
+ EnterpriseBeanMarker marker = (EnterpriseBeanMarker)beanObj;
+ if(marker.isPassivationCapable())
+ {
+ validate = true;
+ }
+ }
+ else if(webBeansContext.getBeanManagerImpl().isPassivatingScope(beanObj.getScope()))
+ {
+ if(WebBeansUtil.getPassivationId(beanObj) == null)
+ {
+ if(!(beanObj instanceof AbstractProducerBean))
+ {
+ throw new WebBeansConfigurationException("Passivation scoped defined bean must be passivation capable, " +
+ "but bean : " + beanObj.toString() + " is not passivation capable");
+ }
+ }
+
+ validate = true;
+ }
+
+ if(validate)
+ {
+ webBeansContext.getDeploymentValidationService().validatePassivationCapable((OwbBean<?>)beanObj);
+ }
+ }
+
+ /**
+ * Check steretypes.
+ * @param scanner scanner instance
+ */
+ protected void checkStereoTypes(ScannerService scanner)
+ {
+ logger.fine("Checking StereoType constraints has started.");
+
+ addDefaultStereoTypes();
+
+ final AnnotationManager annotationManager = webBeansContext.getAnnotationManager();
+
+ Set<Class<?>> beanClasses = scanner.getBeanClasses();
+ if (beanClasses != null && beanClasses.size() > 0)
+ {
+ for(Class<?> beanClass : beanClasses)
+ {
+ if(beanClass.isAnnotation())
+ {
+ Class<? extends Annotation> stereoClass = (Class<? extends Annotation>) beanClass;
+ if (annotationManager.isStereoTypeAnnotation(stereoClass))
+ {
+ webBeansContext.getAnnotationManager().checkStereoTypeClass(stereoClass, stereoClass.getDeclaredAnnotations());
+ StereoTypeModel model = new StereoTypeModel(webBeansContext, stereoClass);
+ webBeansContext.getStereoTypeManager().addStereoTypeModel(model);
+ }
+ }
+ }
+ }
+
+ logger.fine("Checking StereoType constraints has ended.");
+ }
+
+ /**
+ * Adds default stereotypes.
+ */
+ protected void addDefaultStereoTypes()
+ {
+ StereoTypeModel model = new StereoTypeModel(webBeansContext, Model.class);
+ webBeansContext.getStereoTypeManager().addStereoTypeModel(model);
+ }
+
+ /**
+ * Defines and configures managed bean.
+ * @param <T> type info
+ */
+ protected <T> void defineManagedBean(ProcessAnnotatedTypeImpl<T> processAnnotatedEvent)
+ {
+ //Bean manager
+ BeanManagerImpl manager = webBeansContext.getBeanManagerImpl();
+
+ //Create an annotated type
+ AnnotatedType<T> annotatedType = processAnnotatedEvent.getAnnotatedType();
+
+ //Fires ProcessInjectionTarget event for Java EE components instances
+ //That supports injections but not managed beans
+ ProcessInjectionTargetImpl<T> processInjectionTargetEvent;
+ Class beanClass = processAnnotatedEvent.getAnnotatedType().getJavaClass();
+ if(webBeansContext.getWebBeansUtil().supportsJavaEeComponentInjections(beanClass))
+ {
+ //Fires ProcessInjectionTarget
+ processInjectionTargetEvent =
+ webBeansContext.getWebBeansUtil().fireProcessInjectionTargetEventForJavaEeComponents(beanClass);
+ webBeansContext.getWebBeansUtil().inspectErrorStack(
+ "There are errors that are added by ProcessInjectionTarget event observers. Look at logs for further details");
+
+ //Checks that not contains @Inject InjectionPoint
+ webBeansContext.getAnnotationManager().checkInjectionPointForInjectInjectionPoint(beanClass);
+ }
+
+ {
+ BeanAttributesImpl<T> beanAttributes = BeanAttributesBuilder.forContext(webBeansContext).newBeanAttibutes(annotatedType).build();
+
+ ManagedBeanBuilder<T, ManagedBean<T>> managedBeanCreator = new ManagedBeanBuilder<T, ManagedBean<T>>(webBeansContext, annotatedType, beanAttributes);
+
+ if(WebBeansUtil.isDecorator(annotatedType))
+ {
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.log(Level.FINE, "Found Managed Bean Decorator with class name : [{0}]", annotatedType.getJavaClass().getName());
+ }
+ DecoratorBeanBuilder<T> dbb = new DecoratorBeanBuilder<T>(webBeansContext, annotatedType, beanAttributes);
+ if (dbb.isDecoratorEnabled())
+ {
+ dbb.defineDecoratorRules();
+ DecoratorBean<T> decorator = dbb.getBean();
+ webBeansContext.getDecoratorsManager().addDecorator(decorator);
+ }
+ }
+ else if(WebBeansUtil.isCdiInterceptor(annotatedType))
+ {
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.log(Level.FINE, "Found Managed Bean Interceptor with class name : [{0}]", annotatedType.getJavaClass().getName());
+ }
+
+ CdiInterceptorBeanBuilder<T> ibb = new CdiInterceptorBeanBuilder<T>(webBeansContext, annotatedType, beanAttributes);
+ if (ibb.isInterceptorEnabled())
+ {
+ ibb.defineCdiInterceptorRules();
+ CdiInterceptorBean<T> interceptor = ibb.getBean();
+ webBeansContext.getInterceptorsManager().addCdiInterceptor(interceptor);
+ }
+ }
+ else
+ {
+ InjectionTargetBean<T> bean = managedBeanCreator.getBean();
+
+ if (webBeansContext.getDecoratorsManager().containsCustomDecoratorClass(annotatedType.getJavaClass()) ||
+ webBeansContext.getInterceptorsManager().containsCustomInterceptorClass(annotatedType.getJavaClass()))
+ {
+ return; //TODO discuss this case (it was ignored before)
+ }
+
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.log(Level.FINE, "Found Managed Bean with class name : [{0}]", annotatedType.getJavaClass().getName());
+ }
+
+ Set<ObserverMethod<?>> observerMethods = new HashSet<ObserverMethod<?>>();
+ if(bean.isEnabled())
+ {
+ observerMethods = new ObserverMethodsBuilder<T, InjectionTargetBean<T>>(webBeansContext, bean.getAnnotatedType()).defineObserverMethods(bean);
+ }
+ Set<ProducerMethodBean<?>> producerMethods = new ProducerMethodBeansBuilder(bean.getWebBeansContext(), bean.getAnnotatedType()).defineProducerMethods(bean);
+ Set<ProducerFieldBean<?>> producerFields = new ProducerFieldBeansBuilder(bean.getWebBeansContext(), bean.getAnnotatedType()).defineProducerFields(bean);
+
+ ManagedBean<T> managedBean = (ManagedBean<T>)bean;
+ Map<ProducerMethodBean<?>,AnnotatedMethod<?>> annotatedMethods =
+ new HashMap<ProducerMethodBean<?>, AnnotatedMethod<?>>();
+
+ for(ProducerMethodBean<?> producerMethod : producerMethods)
+ {
+ AnnotatedMethod<?> method = webBeansContext.getAnnotatedElementFactory().newAnnotatedMethod(producerMethod.getCreatorMethod(), annotatedType);
+ webBeansContext.getWebBeansUtil().inspectErrorStack("There are errors that are added by ProcessProducer event observers for "
+ + "ProducerMethods. Look at logs for further details");
+
+ annotatedMethods.put(producerMethod, method);
+ }
+
+ Map<ProducerFieldBean<?>,AnnotatedField<?>> annotatedFields =
+ new HashMap<ProducerFieldBean<?>, AnnotatedField<?>>();
+
+ for(ProducerFieldBean<?> producerField : producerFields)
+ {
+ webBeansContext.getWebBeansUtil().inspectErrorStack("There are errors that are added by ProcessProducer event observers for"
+ + " ProducerFields. Look at logs for further details");
+
+ annotatedFields.put(producerField,
+ webBeansContext.getAnnotatedElementFactory().newAnnotatedField(
+ producerField.getCreatorField(),
+ webBeansContext.getAnnotatedElementFactory().newAnnotatedType(producerField.getBeanClass())));
+ }
+
+ Map<ObserverMethod<?>,AnnotatedMethod<?>> observerMethodsMap =
+ new HashMap<ObserverMethod<?>, AnnotatedMethod<?>>();
+
+ for(ObserverMethod<?> observerMethod : observerMethods)
+ {
+ ObserverMethodImpl<?> impl = (ObserverMethodImpl<?>)observerMethod;
+ AnnotatedMethod<?> method = impl.getObserverMethod();
+
+ observerMethodsMap.put(observerMethod, method);
+ }
+
+ BeanManagerImpl beanManager = webBeansContext.getBeanManagerImpl();
+
+ //Fires ProcessManagedBean
+ ProcessBeanImpl<T> processBeanEvent = new GProcessManagedBean(managedBean, annotatedType);
+ beanManager.fireEvent(processBeanEvent);
+ webBeansContext.getWebBeansUtil().inspectErrorStack("There are errors that are added by ProcessManagedBean event observers for " +
+ "managed beans. Look at logs for further details");
+
+ //Fires ProcessProducerMethod
+ webBeansContext.getWebBeansUtil().fireProcessProducerMethodBeanEvent(annotatedMethods, annotatedType);
+ webBeansContext.getWebBeansUtil().inspectErrorStack("There are errors that are added by ProcessProducerMethod event observers for " +
+ "producer method beans. Look at logs for further details");
+
+ //Fires ProcessProducerField
+ webBeansContext.getWebBeansUtil().fireProcessProducerFieldBeanEvent(annotatedFields);
+ webBeansContext.getWebBeansUtil().inspectErrorStack("There are errors that are added by ProcessProducerField event observers for " +
+ "producer field beans. Look at logs for further details");
+
+ //Fire ObservableMethods
+ webBeansContext.getWebBeansUtil().fireProcessObservableMethodBeanEvent(observerMethodsMap);
+ webBeansContext.getWebBeansUtil().inspectErrorStack("There are errors that are added by ProcessObserverMethod event observers for " +
+ "observer methods. Look at logs for further details");
+
+ if(!webBeansContext.getWebBeansUtil().isAnnotatedTypeDecoratorOrInterceptor(annotatedType))
+ {
+ beanManager.addBean(bean);
+ for (ProducerMethodBean<?> producerMethod : producerMethods)
+ {
+ // add them one after the other to enable serialization handling et al
+ beanManager.addBean(producerMethod);
+ }
+ for (ProducerFieldBean<?> producerField : producerFields)
+ {
+ // add them one after the other to enable serialization handling et al
+ beanManager.addBean(producerField);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Defines enterprise bean via plugin.
+ * @param <T> bean class type
+ * @param clazz bean class
+ */
+ protected <T> void defineEnterpriseWebBean(Class<T> clazz, ProcessAnnotatedType<T> processAnnotatedTypeEvent)
+ {
+ InjectionTargetBean<T> bean = (InjectionTargetBean<T>) EJBWebBeansConfigurator.defineEjbBean(clazz, processAnnotatedTypeEvent,
+ webBeansContext);
+ webBeansContext.getWebBeansUtil().setInjectionTargetBeanEnableFlag(bean);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/DefaultAnnotation.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/DefaultAnnotation.java
new file mode 100644
index 0000000..ae007a8
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/DefaultAnnotation.java
@@ -0,0 +1,121 @@
+/*
+ * 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.webbeans.config;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+/**
+ * A small helper class to create a Annotation instance of the given annotation class
+ * via {@link java.lang.reflect.Proxy}.
+ * The annotation literal gets filled with the default values.
+ * TODO implement class caching!
+ */
+public class DefaultAnnotation implements InvocationHandler, Annotation
+{
+
+ private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
+
+ public static Annotation of(Class<? extends Annotation> annotation)
+ {
+ return (Annotation) Proxy.newProxyInstance(annotation.getClassLoader(),
+ new Class[] {annotation}, new DefaultAnnotation(annotation));
+ }
+
+ private final Class<? extends Annotation> annotationClass;
+
+ private DefaultAnnotation(Class<? extends Annotation> annotationClass)
+ {
+ this.annotationClass = annotationClass;
+ }
+
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+ {
+ if ("hashCode".equals(method.getName()))
+ {
+ return hashCode();
+ }
+ else if ("equals".equals(method.getName()))
+ {
+ return equals(args[0]);
+ }
+ else if ("annotationType".equals(method.getName()))
+ {
+ return annotationType();
+ }
+ else if ("toString".equals(method.getName()))
+ {
+ return toString();
+ }
+
+ return method.getDefaultValue();
+ }
+
+ @Override
+ public Class<? extends Annotation> annotationType()
+ {
+ return annotationClass;
+ }
+
+ /**
+ * Copied from javax.enterprise.util.AnnotationLiteral#toString()
+ * with minor changes.
+ *
+ * @return
+ */
+ @Override
+ public String toString()
+ {
+ Method[] methods = annotationClass.getDeclaredMethods();
+
+ StringBuilder sb = new StringBuilder("@" + annotationType().getName() + "(");
+ int lenght = methods.length;
+
+ for (int i = 0; i < lenght; i++)
+ {
+ // Member name
+ sb.append(methods[i].getName()).append("=");
+
+ // Member value
+ Object memberValue;
+ try
+ {
+ memberValue = invoke(this, methods[i], EMPTY_OBJECT_ARRAY);
+ }
+ catch (Throwable throwable)
+ {
+ memberValue = "";
+ }
+ sb.append(memberValue);
+
+ if (i < lenght - 1)
+ {
+ sb.append(",");
+ }
+ }
+
+ sb.append(")");
+
+ return sb.toString();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/DeploymentValidationService.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/DeploymentValidationService.java
new file mode 100644
index 0000000..6f0dc58
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/DeploymentValidationService.java
@@ -0,0 +1,217 @@
+/*
+ * 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.webbeans.config;
+
+import static org.apache.webbeans.util.InjectionExceptionUtil.throwUnproxyableResolutionException;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Set;
+
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Decorator;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.Interceptor;
+import javax.enterprise.inject.spi.PassivationCapable;
+
+import org.apache.webbeans.component.OwbBean;
+import org.apache.webbeans.component.ProducerMethodBean;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.exception.helper.ViolationMessageBuilder;
+import org.apache.webbeans.intercept.InterceptorResolutionService.BeanInterceptorInfo;
+import org.apache.webbeans.portable.InjectionTargetImpl;
+import org.apache.webbeans.util.SecurityUtil;
+
+public class DeploymentValidationService
+{
+
+ private WebBeansContext webBeansContext;
+
+ public DeploymentValidationService(WebBeansContext webBeansContext)
+ {
+ this.webBeansContext = webBeansContext;
+ }
+
+ /**
+ * Checks the unproxyable condition.
+ * @throws org.apache.webbeans.exception.WebBeansConfigurationException if bean is not proxied by the container
+ */
+ public void validateProxyable(OwbBean<?> bean)
+ {
+ // Unproxyable test for NormalScoped beans
+ if (webBeansContext.getBeanManagerImpl().isNormalScope(bean.getScope()))
+ {
+ ViolationMessageBuilder violationMessage = ViolationMessageBuilder.newViolation();
+
+ Class<?> beanClass = bean.getReturnType();
+
+ if(!beanClass.isInterface() && beanClass != Object.class)
+ {
+ if(beanClass.isPrimitive())
+ {
+ violationMessage.addLine("It isn't possible to proxy a primitive type (" + beanClass.getName(), ")");
+ }
+
+ if(beanClass.isArray())
+ {
+ violationMessage.addLine("It isn't possible to proxy an array type (", beanClass.getName(), ")");
+ }
+
+ if(!violationMessage.containsViolation())
+ {
+ if (Modifier.isFinal(beanClass.getModifiers()))
+ {
+ violationMessage.addLine(beanClass.getName(), " is a final class! CDI doesn't allow to proxy that.");
+ }
+
+ String finalMethodName = hasNonPrivateFinalMethod(beanClass);
+ if (finalMethodName != null)
+ {
+ violationMessage.addLine(beanClass.getName(), " has final method "+ finalMethodName + " CDI doesn't allow to proxy that.");
+ }
+
+
+ Constructor<?> cons = webBeansContext.getWebBeansUtil().getNoArgConstructor(beanClass);
+ if (cons == null)
+ {
+ violationMessage.addLine(beanClass.getName(), " has no explicit no-arg constructor!",
+ "A public or protected constructor without args is required!");
+ }
+ else if (Modifier.isPrivate(cons.getModifiers()))
+ {
+ violationMessage.addLine(beanClass.getName(), " has a >private< no-arg constructor! CDI doesn't allow to proxy that.");
+ }
+ }
+
+ //Throw Exception
+ if(violationMessage.containsViolation())
+ {
+ throwUnproxyableResolutionException(violationMessage);
+ }
+ }
+ }
+ }
+
+ /**
+ * check if the given class has any non-private, non-static final method
+ * @return the method name or <code>null</code> if there is no such method.
+ */
+ private String hasNonPrivateFinalMethod(Class<?> beanClass)
+ {
+ if (beanClass == Object.class)
+ {
+ return null;
+ }
+
+ // we also need to check the methods of the parent classes
+ String finalMethodName = hasNonPrivateFinalMethod(beanClass.getSuperclass());
+ if (finalMethodName != null)
+ {
+ return finalMethodName;
+ }
+
+ Method[] methods = SecurityUtil.doPrivilegedGetDeclaredMethods(beanClass);
+ for (Method m : methods)
+ {
+ int modifiers = m.getModifiers();
+ if (Modifier.isFinal(modifiers) && !Modifier.isPrivate(modifiers) && !Modifier.isStatic(modifiers) &&
+ !m.isSynthetic() && !m.isBridge())
+ {
+ return m.getName();
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * If bean is passivation capable, it validate all of its dependencies.
+ * @throws org.apache.webbeans.exception.WebBeansConfigurationException if not satisfy passivation dependencies
+ */
+ public <T> void validatePassivationCapable(OwbBean<T> bean)
+ {
+ if (isPassivationCapable(bean))
+ {
+ if (!(bean instanceof ProducerMethodBean))
+ {
+ validatePassivationCapableDependencies(bean, bean.getInjectionPoints());
+ }
+ if (bean.getProducer() instanceof InjectionTargetImpl)
+ {
+ InjectionTargetImpl<T> injectionTarget = (InjectionTargetImpl<T>)bean.getProducer();
+ BeanInterceptorInfo interceptorInfo = injectionTarget.getInterceptorInfo();
+ if (interceptorInfo != null)
+ {
+ for (Interceptor<?> ejbInterceptor: interceptorInfo.getEjbInterceptors())
+ {
+ validatePassivationCapableDependency(bean, ejbInterceptor);
+ }
+ for (Interceptor<?> cdiInterceptor: interceptorInfo.getCdiInterceptors())
+ {
+ validatePassivationCapableDependency(bean, cdiInterceptor);
+ }
+ for (Decorator<?> decorators: interceptorInfo.getDecorators())
+ {
+ validatePassivationCapableDependency(bean, decorators);
+ }
+ }
+ }
+ }
+ }
+
+ private <T> void validatePassivationCapableDependency(Bean<T> bean, Bean<?> dependentBean)
+ {
+ if (!isPassivationCapable(dependentBean))
+ {
+ String type = dependentBean instanceof Interceptor? "Interceptor ": "Decorator ";
+ throw new WebBeansConfigurationException(
+ "Passivation capable beans must satisfy passivation capable dependencies. " +
+ "Bean : " + bean.toString() + " does not satisfy. " + type + dependentBean.toString() + " is not passivation capable");
+ }
+ validatePassivationCapableDependencies(bean, dependentBean.getInjectionPoints());
+ }
+
+ private <T> void validatePassivationCapableDependencies(Bean<T> bean, Set<InjectionPoint> injectionPoints)
+ {
+ for (InjectionPoint injectionPoint: injectionPoints)
+ {
+ if(!injectionPoint.isTransient())
+ {
+ if(!webBeansContext.getWebBeansUtil().isPassivationCapableDependency(injectionPoint))
+ {
+ if(injectionPoint.getAnnotated().isAnnotationPresent(Disposes.class))
+ {
+ continue;
+ }
+ throw new WebBeansConfigurationException(
+ "Passivation capable beans must satisfy passivation capable dependencies. " +
+ "Bean : " + bean.toString() + " does not satisfy. Details about the Injection-point: " +
+ injectionPoint.toString());
+ }
+ }
+ }
+ }
+
+ private boolean isPassivationCapable(Bean<?> bean)
+ {
+ return bean instanceof OwbBean? ((OwbBean<?>)bean).isPassivationCapable(): bean instanceof PassivationCapable;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/EJBWebBeansConfigurator.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/EJBWebBeansConfigurator.java
new file mode 100644
index 0000000..ad1af21
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/EJBWebBeansConfigurator.java
@@ -0,0 +1,77 @@
+/*
+ * 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.webbeans.config;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.plugins.PluginLoader;
+import org.apache.webbeans.spi.plugins.OpenWebBeansEjbPlugin;
+
+public final class EJBWebBeansConfigurator
+{
+ private EJBWebBeansConfigurator()
+ {
+
+ }
+
+ /**
+ * Returns true if given class is an deployed ejb bean class, false otherwise.
+ * @param clazz bean class
+ * @param webBeansContext
+ * @return true if given class is an deployed ejb bean class
+ * @throws WebBeansConfigurationException if any exception occurs
+ */
+ public static boolean isSessionBean(Class<?> clazz, WebBeansContext webBeansContext) throws WebBeansConfigurationException
+ {
+ PluginLoader loader = webBeansContext.getPluginLoader();
+ OpenWebBeansEjbPlugin ejbPlugin = loader.getEjbPlugin();
+
+ //There is no ejb container
+ if(ejbPlugin == null)
+ {
+ return false;
+ }
+
+ return ejbPlugin.isSessionBean(clazz);
+ }
+
+ /**
+ * Returns ejb bean.
+ * @param webBeansContext
+ * @param <T> bean class info
+ * @param clazz bean class
+ * @return ejb bean
+ */
+ public static <T> Bean<T> defineEjbBean(Class<T> clazz, ProcessAnnotatedType<T> processAnnotatedTypeEvent,
+ WebBeansContext webBeansContext)
+ {
+ PluginLoader loader = webBeansContext.getPluginLoader();
+ OpenWebBeansEjbPlugin ejbPlugin = loader.getEjbPlugin();
+
+ if(ejbPlugin == null)
+ {
+ throw new IllegalStateException("There is no provided EJB plugin. Unable to define session bean for class : " + clazz.getName());
+ }
+
+ return ejbPlugin.defineSessionBean(clazz, processAnnotatedTypeEvent);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/OWBLogConst.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/OWBLogConst.java
new file mode 100644
index 0000000..7f0f1c7
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/OWBLogConst.java
@@ -0,0 +1,125 @@
+/*
+ * 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.webbeans.config;
+
+/* Requires the following import where referenced:
+ * import org.apache.webbeans.config.OWBLogConst;
+ */
+
+public class OWBLogConst
+{
+ private OWBLogConst()
+ {
+ // utility class doesn't have a public ct
+ }
+
+ public static final String TEXT_MB_IMPL = "TEXT_MB_IMPL"; // Managed Bean implementation class :
+ public static final String TEXT_SAME_SCOPE = "TEXT_SAME_SCOPE"; // stereotypes must declare the same @Scope annotations.
+
+ public static final String INFO_0001 = "INFO_0001"; // OpenWebBeans Container has started, it took {0} ms.
+ public static final String INFO_0002 = "INFO_0002"; // OpenWebBeans Container has stopped for context path,
+ public static final String INFO_0003 = "INFO_0003"; // All injection points are validated successfully.
+ public static final String INFO_0004 = "INFO_0004"; // Adding OpenWebBeansPlugin \:
+ public static final String INFO_0005 = "INFO_0005"; // OpenWebBeans Container is starting...
+ public static final String INFO_0006 = "INFO_0006"; // Initializing OpenWebBeans Container.
+ public static final String INFO_0008 = "INFO_0008"; // Stopping OpenWebBeans Container...
+ public static final String INFO_0009 = "INFO_0009"; // OpenWebBeans Container has stopped.
+ public static final String INFO_0010 = "INFO_0010"; // Cannot send event to bean in non-active context \: [{0}]
+ public static final String INFO_0011 = "INFO_0011"; // Conversation with id {0} has been destroyed because of inactive time period.
+
+
+ public static final String WARN_0001 = "WARN_0001"; // No plugins to shutDown.
+ public static final String WARN_0002 = "WARN_0002"; // Alternative XML content is wrong. Child of <alternatives> must be <class>,<stereotype> but found :
+ public static final String WARN_0003 = "WARN_0003"; // Conversation already started with cid : [{0}]
+ public static final String WARN_0004 = "WARN_0004"; // Conversation already ended with cid \: [{0}]
+
+ // [{0}] has not DependentScope. If an interceptor or decorator has any scope other than @Dependent, non-portable behaviour results.
+ public static final String WARN_0005_1 = "WARN_0005_1";
+
+ public static final String WARN_0005_2 = "WARN_0005_2"; // [{0}] has a name. If an interceptor or decorator has name, non-portable behaviour results.
+ public static final String WARN_0005_3 = "WARN_0005_3"; // [{0}] is Alternative. If an interceptor or decorator is @Alternative, non-portable behaviour results.
+ public static final String WARN_0006 = "WARN_0006"; // Unable to close entity manager factory with name \: [{0}]
+ public static final String WARN_0007 = "WARN_0007"; // Exception in ejbContext.proceed().
+ public static final String WARN_0008 = "WARN_0008"; // Unable to find EJB bean with class \: [{0}] \: [{1}]
+ public static final String WARN_0009 = "WARN_0009"; // Unable to find service with class name \: [{0}]
+ public static final String WARN_0010 = "WARN_0010"; // Trying to serialize non-passivation capable bean proxy \: [{0}]
+ public static final String WARN_0011 = "WARN_0011"; // Trying to de-serialize non-passivation capable bean proxy \: [{0}]
+ public static final String WARN_0012 = "WARN_0012"; // No suitable constructor found for injection target class \: [{0}]. produce() method does not work!
+ public static final String WARN_0013 = "WARN_0013"; // Unable to clear ResourceFactory.
+ public static final String WARN_0014 = "WARN_0014"; // Could not find {0} with name [{1}].
+ public static final String WARN_0015 = "WARN_0015"; // Trying to serialize non-passivation capable bean proxy \: [{0}]
+ public static final String WARN_0016 = "WARN_0016"; // Stereotypes can not annotated with @Typed but stereotype \: [{0}] has annotated, non-portable behaviour results.
+
+ // Stereotypes can not define qualifier other than @Named but stereotype \: [{0}] has defined [{1}] , non-portable behaviour results.
+ public static final String WARN_0017 = "WARN_0017";
+ public static final String WARN_0018 = "WARN_0018";
+
+
+ public static final String ERROR_0001 = "ERROR_0001"; // Unable to inject resource for : [{0}]
+ public static final String ERROR_0002 = "ERROR_0002"; // Initialization of the WebBeans container has failed.
+ public static final String ERROR_0003 = "ERROR_0003"; // An exception occurred in the transactional observer.
+ public static final String ERROR_0004 = "ERROR_0004"; // Unable to initialize InitialContext object.
+ public static final String ERROR_0005 = "ERROR_0005"; // Unable to bind object with name : [{0}]
+ public static final String ERROR_0006 = "ERROR_0006"; // Security exception. Cannot access decorator class: [{0}] method : [{1}]
+ public static final String ERROR_0007 = "ERROR_0007"; // Delegate field is not found on the given decorator class : [{0}]
+ public static final String ERROR_0008 = "ERROR_0008"; // An error occurred while executing {0}
+ public static final String ERROR_0009 = "ERROR_0009"; // An error occurred while shutting down the plugin : [{0}]
+ public static final String ERROR_0010 = "ERROR_0010"; // An error occurred while closing the JMS instance.
+ public static final String ERROR_0011 = "ERROR_0011"; // Method security access violation for method : [{0}] in decorator class : [{1}]
+ public static final String ERROR_0012 = "ERROR_0012"; // Exception in calling method : [{0}] in decorator class : [{1}]. Look in the log for target checked exception.
+ public static final String ERROR_0013 = "ERROR_0013"; // An Exception occurred while starting a fresh session!
+ public static final String ERROR_0014 = "ERROR_0014"; // Method illegal access for method : [{0}] in decorator class : [{1}]
+ public static final String ERROR_0015 = "ERROR_0015"; // Illegal access exception for field : [{0}] in decorator class : [{1}]
+ public static final String ERROR_0016 = "ERROR_0016"; // IllegalArgumentException has occurred while calling the field: [{0}] on the class: [{1}]
+ public static final String ERROR_0017 = "ERROR_0017"; // IllegalAccessException has occurred while calling the field: [{0}] on the class: [{1}]
+ public static final String ERROR_0018 = "ERROR_0018"; // An error occured while starting application context path \: [{0}]
+ public static final String ERROR_0019 = "ERROR_0019"; // An error occured while starting request \: [{0}]
+ public static final String ERROR_0020 = "ERROR_0020"; // An error occured while starting session \: [{0}]
+ public static final String ERROR_0021 = "ERROR_0021"; // An error occured while stopping the container.
+ public static final String ERROR_0022 = "ERROR_0022"; // Unable to inject dependencies of EJB interceptor instance with class \: [{0}]
+ public static final String ERROR_0023 = "ERROR_0023"; // An error occured while injecting Java EE Resources for the bean instance \: [{0}]
+ public static final String ERROR_0024 = "ERROR_0024"; // Unable to get resource with class \: [{0}] in \: [{1}] with name \: [{2}].
+ public static final String ERROR_0025 = "ERROR_0025"; // Unable to inject field \: [{0}]
+ public static final String ERROR_0026 = "ERROR_0026"; // An error occured while injecting dependencies of bean \: [{0}]
+ public static final String ERROR_0027 = "ERROR_0027"; // Unable to create AnnotatedType for class \: [{0}]. Exception cause \: [{1}].
+ public static final String ERROR_0028 = "ERROR_0028"; // Can't use logger factory class [{0}]. Exception cause \: [{1}].
+
+
+ public static final String FATAL_0001 = "FATAL_0001"; // Exception thrown while destroying bean instance : {0}
+ public static final String FATAL_0002 = "FATAL_0002"; // Unable to read root element of the given input stream.
+
+ public static final String EDCONF_FAIL = "CRITICAL_DEFAULT_CONFIG_FAILURE"; // Problem while loading OpenWebBeans default configuration.
+ public static final String EXCEPT_0002 = "EXCEPT_0002"; // Wrong ended object.
+ public static final String EXCEPT_0003 = "EXCEPT_0003"; // Specialized class [
+ public static final String EXCEPT_0004 = "EXCEPT_0004"; // ] must extend another class.
+ public static final String EXCEPT_XML = "EXCEPT_XML"; // XML Specialization Error :
+ public static final String EXCEPT_0005 = "EXCEPT_0005"; // More than one class specialized the same super class :
+ public static final String EXCEPT_0006 = "EXCEPT_0006"; // Got Exceptions while sending shutdown to the following plugins : {0}
+ public static final String EXCEPT_0007 = "EXCEPT_0007"; // TransactionPhase not supported:
+ public static final String EXCEPT_0008 = "EXCEPT_0008"; // Exception is thrown while handling event object with type :
+ public static final String EXCEPT_0009 = "EXCEPT_0009"; // Unable to unbind object with name :
+ public static final String EXCEPT_0010 = "EXCEPT_0010"; // Unable to lookup object with name :
+ public static final String EXCEPT_0012 = "EXCEPT_0012"; // All elements in the beans.xml file have to declare name space.
+ public static final String EXCEPT_0013 = "EXCEPT_0013"; // Unable to read root element of the given input stream.
+ public static final String EXCEPT_0014 = "EXCEPT_0014"; // Multiple class with name :
+ public static final String EXCEPT_0015 = "EXCEPT_0015"; // Passivation bean \: [{0}] decorators must be passivating capable.
+ public static final String EXCEPT_0016 = "EXCEPT_0016"; // Passivation bean \: [{0}] interceptors must be passivating capable.
+ public static final String EXCEPT_0017 = "EXCEPT_0017"; // Passivation bean \: [{0}] interceptor \: [{1}] must have serializable injection points.
+ public static final String EXCEPT_0018 = "EXCEPT_0018"; // Wrong start object.
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java
new file mode 100644
index 0000000..c338261
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java
@@ -0,0 +1,324 @@
+/*
+ * 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.webbeans.config;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.Set;
+import java.util.logging.Logger;
+
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+
+/**
+ * Defines configuration for OpenWebBeans.
+ *
+ * The algorithm is easy:
+ * <ul>
+ * <li>Load all properties you can find with the name (META-INF/openwebbeans/openwebbeans.properties),
+ * <li>Sort them via configuration.ordinal in ascending order,
+ * <li>Overload them as we do already,
+ * <li>Use the sorted list of properties.
+ * </ul>
+ */
+public class OpenWebBeansConfiguration
+{
+ /**Logger instance*/
+ private final static Logger logger = WebBeansLoggerFacade.getLogger(OpenWebBeansConfiguration.class);
+
+ /**Default configuration files*/
+ private final static String DEFAULT_CONFIG_PROPERTIES_NAME = "META-INF/openwebbeans/openwebbeans.properties";
+
+ /**Property of application*/
+ private final Properties configProperties = new Properties();
+
+ /**Conversation periodic delay in ms.*/
+ public static final String CONVERSATION_PERIODIC_DELAY = "org.apache.webbeans.conversation.Conversation.periodicDelay";
+
+ /**Timeout interval in ms*/
+ public static final String CONVERSATION_TIMEOUT_INTERVAL = "org.apache.webbeans.conversation.Conversation.timeoutInterval";
+
+ /**
+ * Lifycycle methods like {@link javax.annotation.PostConstruct} and
+ * {@link javax.annotation.PreDestroy} must not define a checked Exception
+ * regarding to the spec. But this is often unnecessary restrictive so we
+ * allow to disable this check application wide.
+ */
+ public static final String INTERCEPTOR_FORCE_NO_CHECKED_EXCEPTIONS = "org.apache.webbeans.forceNoCheckedExceptions";
+
+ /**Use EJB Discovery or not*/
+ public static final String USE_EJB_DISCOVERY = "org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService";
+
+ /**Container lifecycle*/
+ public static final String CONTAINER_LIFECYCLE = "org.apache.webbeans.spi.ContainerLifecycle";
+
+ /**JNDI Service SPI*/
+ public static final String JNDI_SERVICE = "org.apache.webbeans.spi.JNDIService";
+
+ /**Scanner Service*/
+ public static final String SCANNER_SERVICE = "org.apache.webbeans.spi.ScannerService";
+
+ /**Contexts Service*/
+ public static final String CONTEXTS_SERVICE = "org.apache.webbeans.spi.ContextsService";
+
+ /**Conversation Service*/
+ public static final String CONVERSATION_SERVICE = "org.apache.webbeans.spi.ConversationService";
+
+ /**Resource Injection Service*/
+ public static final String RESOURCE_INJECTION_SERVICE = "org.apache.webbeans.spi.ResourceInjectionService";
+
+ /**Security Service*/
+ public static final String SECURITY_SERVICE = "org.apache.webbeans.spi.SecurityService";
+
+ /**Validator Service*/
+ public static final String VALIDATOR_SERVICE = "org.apache.webbeans.spi.ValidatorService";
+
+ /**Transaction Service*/
+ public static final String TRANSACTION_SERVICE = "org.apache.webbeans.spi.TransactionService";
+
+ /**Application is core JSP*/
+ public static final String APPLICATION_IS_JSP = "org.apache.webbeans.application.jsp";
+
+ /**Supports conversations*/
+ public static final String APPLICATION_SUPPORTS_CONVERSATION = "org.apache.webbeans.application.supportsConversation";
+
+ /**EL Adaptor*/
+ public static final String EL_ADAPTOR_CLASS = "org.apache.webbeans.spi.adaptor.ELAdaptor";
+
+ /** prefix followed by the fully qualified scope name, for configuring InterceptorHandlers for our proxies.*/
+ public static final String PROXY_MAPPING_PREFIX = "org.apache.webbeans.proxy.mapping.";
+
+ /**
+ * Use BDABeansXmlScanner to determine if interceptors, decorators, and
+ * alternatives are enabled in the beans.xml of a given BDA. For an
+ * application containing jar1 and jar2, this implies that an interceptor
+ * enabled in the beans.xml of jar1 is not automatically enabled in jar2
+ **/
+ public static final String USE_BDA_BEANSXML_SCANNER = "org.apache.webbeans.useBDABeansXMLScanner";
+
+ /**
+ * a comma-separated list of fully qualified class names that should be ignored
+ * when determining if a decorator matches its delegate. These are typically added by
+ * weaving or bytecode modification.
+ */
+ public static final String IGNORED_INTERFACES = "org.apache.webbeans.ignoredDecoratorInterfaces";
+
+ private Set<String> ignoredInterfaces;
+
+ /**
+ * you can configure this externally as well.
+ *
+ * @param properties
+ */
+ public OpenWebBeansConfiguration(Properties properties)
+ {
+ configProperties.putAll(properties);
+ }
+
+ /**
+ * Parse configuration.
+ */
+ public OpenWebBeansConfiguration()
+ {
+ parseConfiguration();
+
+ logger.fine("Overriding properties from System properties");
+
+ //Look for System properties
+ loadFromSystemProperties();
+ }
+
+ /**
+ * Load from system properties
+ */
+ private void loadFromSystemProperties()
+ {
+ Properties properties;
+ if(System.getSecurityManager() != null)
+ {
+ properties = doPrivilegedGetSystemProperties();
+ }
+ else
+ {
+ properties = System.getProperties();
+ }
+
+ String value = properties.getProperty(CONVERSATION_PERIODIC_DELAY);
+ setPropertyFromSystemProperty(CONVERSATION_PERIODIC_DELAY, value);
+
+ value = properties.getProperty(USE_EJB_DISCOVERY);
+ setPropertyFromSystemProperty(USE_EJB_DISCOVERY, value);
+
+ value = properties.getProperty(CONTAINER_LIFECYCLE);
+ setPropertyFromSystemProperty(CONTAINER_LIFECYCLE, value);
+
+ value = properties.getProperty(APPLICATION_IS_JSP);
+ setPropertyFromSystemProperty(APPLICATION_IS_JSP, value);
+
+ value = properties.getProperty(TRANSACTION_SERVICE);
+ setPropertyFromSystemProperty(TRANSACTION_SERVICE, value);
+
+ value = properties.getProperty(VALIDATOR_SERVICE);
+ setPropertyFromSystemProperty(VALIDATOR_SERVICE, value);
+
+ value = properties.getProperty(SECURITY_SERVICE);
+ setPropertyFromSystemProperty(SECURITY_SERVICE, value);
+
+ value = properties.getProperty(RESOURCE_INJECTION_SERVICE);
+ setPropertyFromSystemProperty(RESOURCE_INJECTION_SERVICE, value);
+
+ value = properties.getProperty(CONVERSATION_SERVICE);
+ setPropertyFromSystemProperty(CONVERSATION_SERVICE, value);
+
+ value = properties.getProperty(CONTEXTS_SERVICE);
+ setPropertyFromSystemProperty(CONTEXTS_SERVICE, value);
+
+ value = properties.getProperty(SCANNER_SERVICE);
+ setPropertyFromSystemProperty(SCANNER_SERVICE, value);
+
+ value = properties.getProperty(JNDI_SERVICE);
+ setPropertyFromSystemProperty(JNDI_SERVICE, value);
+
+ value = properties.getProperty(EL_ADAPTOR_CLASS);
+ setPropertyFromSystemProperty(EL_ADAPTOR_CLASS, value);
+
+ value = properties.getProperty(USE_BDA_BEANSXML_SCANNER);
+ setPropertyFromSystemProperty(USE_BDA_BEANSXML_SCANNER, value);
+
+ }
+
+ private Properties doPrivilegedGetSystemProperties()
+ {
+ return AccessController.doPrivileged(
+ new PrivilegedAction<Properties>()
+ {
+ @Override
+ public Properties run()
+ {
+ return System.getProperties();
+ }
+
+ }
+ );
+ }
+
+
+ private void setPropertyFromSystemProperty(String key, String value)
+ {
+ if(value != null)
+ {
+ setProperty(key, value);
+ }
+ }
+
+ /**
+ * (re)read the configuration from the resources in the classpath.
+ * @see #DEFAULT_CONFIG_PROPERTIES_NAME
+ * @see #DEFAULT_CONFIG_PROPERTIES_NAME
+ */
+ public synchronized void parseConfiguration() throws WebBeansConfigurationException
+ {
+ Properties newConfigProperties = PropertyLoader.getProperties(DEFAULT_CONFIG_PROPERTIES_NAME);
+ configProperties.clear();
+
+ // set the new one as perfect fit.
+ if(newConfigProperties != null)
+ {
+ configProperties.putAll(newConfigProperties);
+ }
+ }
+
+
+ /**
+ * Gets property.
+ * @param key
+ * @return String with the property value or <code>null</code>
+ */
+ public String getProperty(String key)
+ {
+ return configProperties.getProperty(key);
+ }
+
+ /**
+ * Gets property value.
+ * @param key
+ * @param defaultValue
+ * @return String with the property value or <code>null</code>
+ */
+ public String getProperty(String key,String defaultValue)
+ {
+ return configProperties.getProperty(key, defaultValue);
+ }
+
+
+ /**
+ * Sets given property.
+ * @param key property name
+ * @param value property value
+ */
+ public synchronized void setProperty(String key, Object value)
+ {
+ configProperties.put(key, value);
+ }
+
+
+ /**
+ * Gets jsp property.
+ * @return true if jsp
+ */
+ public boolean isJspApplication()
+ {
+ String value = getProperty(APPLICATION_IS_JSP);
+
+ return Boolean.valueOf(value);
+ }
+
+ /**
+ * Gets conversation supports property.
+ * @return true if supports
+ */
+ public boolean supportsConversation()
+ {
+ String value = getProperty(APPLICATION_SUPPORTS_CONVERSATION);
+
+ return Boolean.valueOf(value);
+ }
+
+ public synchronized Set<String> getIgnoredInterfaces()
+ {
+ if (ignoredInterfaces == null)
+ {
+ String ignoredInterfacesString = getProperty(IGNORED_INTERFACES);
+ if (ignoredInterfacesString != null)
+ {
+ ignoredInterfaces = new HashSet<String>(Arrays.asList(ignoredInterfacesString.split("[,\\p{javaWhitespace}]")));
+ }
+ else
+ {
+ ignoredInterfaces = Collections.emptySet();
+ }
+ }
+ return ignoredInterfaces;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/OwbParametrizedTypeImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/OwbParametrizedTypeImpl.java
new file mode 100644
index 0000000..449e3f8
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/OwbParametrizedTypeImpl.java
@@ -0,0 +1,131 @@
+/*
+ * 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.webbeans.config;
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+
+/**
+ * Custom parametrized type implementation.
+ * @version $Rev$ $Date$
+ *
+ */
+public class OwbParametrizedTypeImpl implements ParameterizedType
+{
+ /**Owner type*/
+ private final Type owner;
+
+ /**Raw type*/
+ private final Type rawType;
+
+ /**Actual type arguments*/
+ private final Type[] types;
+
+ /**
+ * New instance.
+ * @param owner owner
+ * @param raw raw
+ */
+ public OwbParametrizedTypeImpl(Type owner, Type raw, Type... types)
+ {
+ this.owner = owner;
+ rawType = raw;
+ this.types = types;
+ }
+
+ @Override
+ public Type[] getActualTypeArguments()
+ {
+ return types.clone();
+ }
+
+ @Override
+ public Type getOwnerType()
+ {
+ return owner;
+ }
+
+ @Override
+ public Type getRawType()
+ {
+ return rawType;
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode()
+ {
+ return Arrays.hashCode(types) ^ (owner == null ? 0 : owner.hashCode()) ^ (rawType == null ? 0 : rawType.hashCode());
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ else if (obj instanceof ParameterizedType)
+ {
+ ParameterizedType that = (ParameterizedType) obj;
+ Type thatOwnerType = that.getOwnerType();
+ Type thatRawType = that.getRawType();
+ return (owner == null ? thatOwnerType == null : owner.equals(thatOwnerType))
+ && (rawType == null ? thatRawType == null : rawType.equals(thatRawType))
+ && Arrays.equals(types, that.getActualTypeArguments());
+ }
+ else
+ {
+ return false;
+ }
+
+ }
+
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append(((Class<?>) rawType).getSimpleName());
+ Type[] actualTypes = getActualTypeArguments();
+ if(actualTypes.length > 0)
+ {
+ buffer.append("<");
+ int length = actualTypes.length;
+ for(int i=0;i<length;i++)
+ {
+ buffer.append(actualTypes[i].toString());
+ if(i != actualTypes.length-1)
+ {
+ buffer.append(",");
+ }
+ }
+
+ buffer.append(">");
+ }
+
+ return buffer.toString();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/PropertyLoader.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/PropertyLoader.java
new file mode 100644
index 0000000..86655cf
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/PropertyLoader.java
@@ -0,0 +1,226 @@
+/*
+ * 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.webbeans.config;
+
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.util.WebBeansUtil;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * <p>Utility class to load configuration properties via a list of
+ * artibrary property files by a well defined order.</p>
+ * <p>User configurations should start with 'configuration.ordinal'
+ * greather than 100.</p>
+ *
+ */
+public class PropertyLoader
+{
+ public final static int CONFIGURATION_ORDINAL_DEFAULT_VALUE = 100;
+
+ public final static String CONFIGURATION_ORDINAL_PROPERTY_NAME = "configuration.ordinal";
+
+
+ private static final Logger logger = WebBeansLoggerFacade.getLogger(PropertyLoader.class);
+
+
+ private PropertyLoader()
+ {
+ // utility class doesn't have a public ct
+ }
+
+ /**
+ * <p>Look for all property files with the given name (e.g. 'myconfig.properties') in
+ * the classpath. Then load all properties files and sort them by their ascending
+ * configuration order and apply them in this order.</p>
+ *
+ * <p>The idea is to be able to 'override' properties by just providing
+ * a new properties file with the same name but a higher 'configuration.ordinal'
+ * than the old one.</p>
+ *
+ * <p>If a property file defines no 'configuration.ordinal' property than a default
+ * value of {@link #CONFIGURATION_ORDINAL_DEFAULT_VALUE} is assumed. Any sensitive
+ * default which is provided by the system parsing for the configuration should
+ * have a 'configuration.ordinal' value lower than 10. In most cases a value of 1</p>
+ *
+ * <p>If 2 property files have the same ordinal 'configuraiton.order' the outcome
+ * is not really defined. The Properties file which got found first will be
+ * processed first and thus get overwritten by the one found later.</p>
+ *
+ * @param propertyFileName the name of the properties file
+ * @return the final property values
+ */
+ public static synchronized Properties getProperties(String propertyFileName)
+ {
+ try
+ {
+ List<Properties> allProperties = loadAllProperties(propertyFileName);
+ if (allProperties == null)
+ {
+ return null;
+ }
+
+ List<Properties> sortedProperties = sortProperties(allProperties);
+ Properties properties = mergeProperties(sortedProperties);
+ return properties;
+ }
+ catch (IOException e)
+ {
+ logger.log(Level.SEVERE, "Error while loading the propertyFile " + propertyFileName, e);
+ return null;
+ }
+ }
+
+ private static List<Properties> loadAllProperties(String propertyFileName)
+ throws IOException
+ {
+ ClassLoader cl = WebBeansUtil.getCurrentClassLoader();
+ Enumeration<URL> propertyUrls = cl.getResources(propertyFileName);
+ if (propertyUrls == null || !propertyUrls.hasMoreElements())
+ {
+ if(logger.isLoggable(Level.INFO))
+ {
+ logger.info("could not find any property files with name " + propertyFileName);
+ }
+
+ return null;
+ }
+
+ List<Properties> properties = new ArrayList<Properties>();
+
+ while (propertyUrls.hasMoreElements())
+ {
+ URL propertyUrl = propertyUrls.nextElement();
+ InputStream is = null;
+ try
+ {
+ is = propertyUrl.openStream();
+ Properties prop = new Properties();
+ prop.load(is);
+ properties.add(prop);
+
+ // a bit debugging output
+ int ordinal = getConfigurationOrdinal(prop);
+ if(logger.isLoggable(Level.FINE))
+ {
+ logger.fine("loading properties with ordinal " + ordinal + " from file " + propertyUrl.getFile());
+ }
+ }
+ finally
+ {
+ if (is != null)
+ {
+ is.close();
+ }
+ }
+ }
+
+ return properties;
+ }
+
+ /**
+ * Implement a quick and dirty sorting mechanism for the given Properties.
+ * @param allProperties
+ * @return the Properties list sorted by it's 'configuration.ordinal' in ascending order.
+ */
+ private static List<Properties> sortProperties(List<Properties> allProperties)
+ {
+ List<Properties> sortedProperties = new ArrayList<Properties>();
+ for (Properties p : allProperties)
+ {
+ int configOrder = getConfigurationOrdinal(p);
+
+ int i;
+ for (i = 0; i < sortedProperties.size(); i++)
+ {
+ int listConfigOrder = getConfigurationOrdinal(sortedProperties.get(i));
+ if (listConfigOrder > configOrder)
+ {
+ // only go as far as we found a higher priority Properties file
+ break;
+ }
+ }
+ sortedProperties.add(i, p);
+ }
+ return sortedProperties;
+ }
+
+ /**
+ * Determine the 'configuration.ordinal' of the given properties.
+ * {@link #CONFIGURATION_ORDINAL_DEFAULT_VALUE} if
+ * {@link #CONFIGURATION_ORDINAL_PROPERTY_NAME} is not set in the
+ * Properties file.
+ *
+ * @param p the Properties from the file.
+ * @return the ordinal number of the given Properties file.
+ */
+ private static int getConfigurationOrdinal(Properties p)
+ {
+ int configOrder = CONFIGURATION_ORDINAL_DEFAULT_VALUE;
+
+ String configOrderString = p.getProperty(CONFIGURATION_ORDINAL_PROPERTY_NAME);
+ if (configOrderString != null && configOrderString.length() > 0)
+ {
+ try
+ {
+ configOrder = Integer.parseInt(configOrderString);
+ }
+ catch(NumberFormatException nfe)
+ {
+ logger.severe(CONFIGURATION_ORDINAL_PROPERTY_NAME + " must be an integer value!");
+ throw nfe;
+ }
+ }
+
+ return configOrder;
+ }
+
+ /**
+ * Merge the given Properties in order of appearance.
+ * @param sortedProperties
+ * @return the merged Properties
+ */
+ private static Properties mergeProperties(List<Properties> sortedProperties)
+ {
+ Properties mergedProperties = new Properties();
+ for (Properties p : sortedProperties)
+ {
+ for (Map.Entry<?,?> entry : p.entrySet())
+ {
+ String key = (String) entry.getKey();
+ String value = (String) entry.getValue();
+
+ // simply overwrite the old properties with the new ones.
+ mergedProperties.setProperty(key, value);
+ }
+ }
+
+ return mergedProperties;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java
new file mode 100644
index 0000000..1a5a827
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java
@@ -0,0 +1,440 @@
+/*
+ * 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.webbeans.config;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.webbeans.annotation.AnnotationManager;
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.container.SerializableBeanVault;
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.context.creational.CreationalContextFactory;
+import org.apache.webbeans.conversation.ConversationManager;
+import org.apache.webbeans.decorator.DecoratorsManager;
+import org.apache.webbeans.deployment.StereoTypeManager;
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.inject.AlternativesManager;
+import org.apache.webbeans.inject.impl.InjectionPointFactory;
+import org.apache.webbeans.intercept.InterceptorResolutionService;
+import org.apache.webbeans.intercept.InterceptorUtil;
+import org.apache.webbeans.intercept.InterceptorsManager;
+import org.apache.webbeans.plugins.PluginLoader;
+import org.apache.webbeans.portable.AnnotatedElementFactory;
+import org.apache.webbeans.portable.events.ExtensionLoader;
+import org.apache.webbeans.proxy.SubclassProxyFactory;
+import org.apache.webbeans.proxy.InterceptorDecoratorProxyFactory;
+import org.apache.webbeans.proxy.NormalScopeProxyFactory;
+import org.apache.webbeans.service.DefaultLoaderService;
+import org.apache.webbeans.spi.ContextsService;
+import org.apache.webbeans.spi.LoaderService;
+import org.apache.webbeans.spi.ScannerService;
+import org.apache.webbeans.spi.SecurityService;
+import org.apache.webbeans.spi.plugins.OpenWebBeansPlugin;
+import org.apache.webbeans.util.ClassUtil;
+import org.apache.webbeans.util.WebBeansUtil;
+
+/**
+ * This is the central point to manage the whole CDI container
+ * for a single application There is one WebBeansContext per BeanManagerImpl.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WebBeansContext
+{
+ private final Map<Class<?>, Object> managerMap = new HashMap<Class<?>, Object>();
+
+ private final Map<Class<?>, Object> serviceMap = new HashMap<Class<?>, Object>();
+
+ private final WebBeansUtil webBeansUtil = new WebBeansUtil(this);
+ private final ContextFactory contextFactory = new ContextFactory(this);
+ private final AlternativesManager alternativesManager = new AlternativesManager(this);
+ private final AnnotatedElementFactory annotatedElementFactory = new AnnotatedElementFactory(this);
+ private final BeanManagerImpl beanManagerImpl = new BeanManagerImpl(this);
+ private final ConversationManager conversationManager = new ConversationManager(this);
+ private final CreationalContextFactory creationalContextFactory = new CreationalContextFactory(this);
+ private final DecoratorsManager decoratorsManager = new DecoratorsManager(this);
+ private final ExtensionLoader extensionLoader = new ExtensionLoader(this);
+ private final InterceptorsManager interceptorsManager = new InterceptorsManager(this);
+ private final InterceptorDecoratorProxyFactory interceptorDecoratorProxyFactory = new InterceptorDecoratorProxyFactory(this);
+ private final NormalScopeProxyFactory normalScopeProxyFactory = new NormalScopeProxyFactory(this);
+ private final SubclassProxyFactory subclassProxyFactory = new SubclassProxyFactory(this);
+ private final OpenWebBeansConfiguration openWebBeansConfiguration;
+ private final PluginLoader pluginLoader = new PluginLoader();
+ private final SerializableBeanVault serializableBeanVault = new SerializableBeanVault();
+ private final StereoTypeManager stereoTypeManager = new StereoTypeManager();
+ private final AnnotationManager annotationManager = new AnnotationManager(this);
+ private final InjectionPointFactory injectionPointFactory = new InjectionPointFactory(this);
+ private final InterceptorUtil interceptorUtil = new InterceptorUtil(this);
+ private final SecurityService securityService;
+ private final LoaderService loaderService;
+ private final InterceptorResolutionService interceptorResolutionService = new InterceptorResolutionService(this);
+ private final DeploymentValidationService deploymentValidationService = new DeploymentValidationService(this);
+ private ScannerService scannerService;
+ private ContextsService contextsService;
+
+ public WebBeansContext()
+ {
+ this(null, new OpenWebBeansConfiguration());
+ }
+
+ public WebBeansContext(Map<Class<?>, Object> initialServices, Properties properties)
+ {
+ this(initialServices, new OpenWebBeansConfiguration(properties));
+ }
+
+ private WebBeansContext(Map<Class<?>, Object> initialServices, OpenWebBeansConfiguration openWebBeansConfiguration)
+ {
+ this.openWebBeansConfiguration = openWebBeansConfiguration;
+
+ //pluggable service-loader
+ if (initialServices == null || !initialServices.containsKey(LoaderService.class))
+ {
+ String implementationLoaderServiceName =
+ openWebBeansConfiguration.getProperty(LoaderService.class.getName());
+ if (implementationLoaderServiceName == null)
+ {
+ serviceMap.put(LoaderService.class, new DefaultLoaderService());
+ }
+ else
+ {
+ serviceMap.put(LoaderService.class, LoaderService.class.cast(get(implementationLoaderServiceName)));
+ }
+ }
+
+ if (initialServices != null)
+ {
+ for (Map.Entry<Class<?>, Object> entry: initialServices.entrySet())
+ {
+ if (!entry.getKey().isAssignableFrom(entry.getValue().getClass()))
+ {
+ throw new IllegalArgumentException("Initial service claiming to be of type " + entry.getKey() + " is a " + entry.getValue().getClass());
+ }
+ serviceMap.put(entry.getKey(), entry.getValue());
+ }
+ }
+ loaderService = getService(LoaderService.class);
+ securityService = getService(SecurityService.class);
+
+
+ // Allow the WebBeansContext itself to be looked up
+ managerMap.put(getClass(), this);
+
+ // Add them all into the map for backwards compatibility
+ managerMap.put(AlternativesManager.class, alternativesManager);
+ managerMap.put(AnnotatedElementFactory.class, annotatedElementFactory);
+ managerMap.put(BeanManagerImpl.class, beanManagerImpl);
+ managerMap.put(ConversationManager.class, conversationManager);
+ managerMap.put(CreationalContextFactory.class, creationalContextFactory);
+ managerMap.put(DecoratorsManager.class, decoratorsManager);
+ managerMap.put(ExtensionLoader.class, extensionLoader);
+ managerMap.put(InterceptorsManager.class, interceptorsManager);
+ managerMap.put(InterceptorDecoratorProxyFactory.class, interceptorDecoratorProxyFactory);
+ managerMap.put(NormalScopeProxyFactory.class, normalScopeProxyFactory);
+ managerMap.put(SubclassProxyFactory.class, subclassProxyFactory);
+ managerMap.put(OpenWebBeansConfiguration.class, openWebBeansConfiguration);
+ managerMap.put(PluginLoader.class, pluginLoader);
+ managerMap.put(SerializableBeanVault.class, serializableBeanVault);
+ managerMap.put(StereoTypeManager.class, stereoTypeManager);
+ managerMap.put(InterceptorResolutionService.class, interceptorResolutionService);
+ }
+
+ public static WebBeansContext getInstance()
+ {
+ WebBeansContext webBeansContext = WebBeansFinder.getSingletonInstance();
+
+ return webBeansContext;
+ }
+
+ /**
+ * Method to be used when static use is truely unavoidable, such as serialization
+ *
+ * Ideally this method would never lazily create a WebBeansContext and as we don't
+ * want to do any deployment of new apps during deserialization, we want to rehydrate
+ * objects from an existing WebBeansContext which should be the active context.
+ *
+ * This method could throw a runtime exception if no instance currently exists.
+ *
+ * @return
+ */
+ public static WebBeansContext currentInstance()
+ {
+ return getInstance();
+ }
+
+ public <T> T getService(Class<T> clazz)
+ {
+ T t = clazz.cast(serviceMap.get(clazz));
+ if (t == null)
+ {
+ t = doServiceLoader(clazz);
+ registerService(clazz, t);
+ }
+ return t;
+ }
+
+ public <T> void registerService(Class<T> clazz, T t)
+ {
+ serviceMap.put(clazz, t);
+ }
+
+ private <T> T doServiceLoader(Class<T> serviceInterface)
+ {
+ String implName = getOpenWebBeansConfiguration().getProperty(serviceInterface.getName());
+
+ if (implName == null)
+ {
+ //Look for plugins
+ List<OpenWebBeansPlugin> plugins = getPluginLoader().getPlugins();
+ if(plugins != null && plugins.size() > 0)
+ {
+ for(OpenWebBeansPlugin plugin : plugins)
+ {
+ if(plugin.supportService(serviceInterface))
+ {
+ return plugin.getSupportedService(serviceInterface);
+ }
+ }
+ }
+
+ return null;
+ }
+ return serviceInterface.cast(get(implName));
+ }
+
+ public InterceptorUtil getInterceptorUtil()
+ {
+ return interceptorUtil;
+ }
+
+ public InjectionPointFactory getInjectionPointFactory()
+ {
+ return injectionPointFactory;
+ }
+
+ public WebBeansUtil getWebBeansUtil()
+ {
+ return webBeansUtil;
+ }
+
+ @Deprecated
+ public ContextFactory getContextFactory()
+ {
+ return contextFactory;
+ }
+
+ public AnnotationManager getAnnotationManager()
+ {
+ return annotationManager;
+ }
+
+ public ConversationManager getConversationManager()
+ {
+ return conversationManager;
+ }
+
+ public OpenWebBeansConfiguration getOpenWebBeansConfiguration()
+ {
+ return openWebBeansConfiguration;
+ }
+
+ public AnnotatedElementFactory getAnnotatedElementFactory()
+ {
+ return annotatedElementFactory;
+ }
+
+ public BeanManagerImpl getBeanManagerImpl()
+ {
+ return beanManagerImpl;
+ }
+
+ public SerializableBeanVault getSerializableBeanVault()
+ {
+ return serializableBeanVault;
+ }
+
+ public CreationalContextFactory getCreationalContextFactory()
+ {
+ return creationalContextFactory;
+ }
+
+ public DecoratorsManager getDecoratorsManager()
+ {
+ return decoratorsManager;
+ }
+
+ public StereoTypeManager getStereoTypeManager()
+ {
+ return stereoTypeManager;
+ }
+
+ public AlternativesManager getAlternativesManager()
+ {
+ return alternativesManager;
+ }
+
+ public InterceptorsManager getInterceptorsManager()
+ {
+ return interceptorsManager;
+ }
+
+ public InterceptorResolutionService getInterceptorResolutionService()
+ {
+ return interceptorResolutionService;
+ }
+
+ public PluginLoader getPluginLoader()
+ {
+ return pluginLoader;
+ }
+
+ public ExtensionLoader getExtensionLoader()
+ {
+ return extensionLoader;
+ }
+
+
+ public InterceptorDecoratorProxyFactory getInterceptorDecoratorProxyFactory()
+ {
+ return interceptorDecoratorProxyFactory;
+ }
+
+ public NormalScopeProxyFactory getNormalScopeProxyFactory()
+ {
+ return normalScopeProxyFactory;
+ }
+
+ public SubclassProxyFactory getSubclassProxyFactory()
+ {
+ return subclassProxyFactory;
+ }
+
+ public ScannerService getScannerService()
+ {
+ if (scannerService == null)
+ {
+ // lazy init
+ scannerService = getService(ScannerService.class);
+ }
+ return scannerService;
+ }
+
+ public ContextsService getContextsService()
+ {
+ if (contextsService == null)
+ {
+ contextsService = getService(ContextsService.class);
+ }
+ return contextsService;
+ }
+
+ public SecurityService getSecurityService()
+ {
+ return securityService;
+ }
+
+ private Object get(String singletonName)
+ {
+ //Load class
+ Class<?> clazz = ClassUtil.getClassFromName(singletonName);
+ if (clazz == null)
+ {
+ throw new WebBeansException("Class not found exception in creating instance with class : " + singletonName,
+ new ClassNotFoundException("Class with name: " + singletonName + " is not found in the system"));
+ }
+ return get(clazz);
+
+ }
+
+ public <T> T get(Class<T> clazz)
+ {
+ //util.Track.get(clazz);
+ T object = clazz.cast(managerMap.get(clazz));
+
+ /* No singleton for this application, create one */
+ if (object == null)
+ {
+ object = createInstance(clazz);
+
+ //Save it
+ managerMap.put(clazz, object);
+ }
+
+ return object;
+ }
+
+ private <T> T createInstance(Class<T> clazz)
+ {
+ try
+ {
+
+ // first try constructor that takes this object as an argument
+ try
+ {
+ Constructor<T> constructor = clazz.getConstructor(WebBeansContext.class);
+ return constructor.newInstance(this);
+ }
+ catch (NoSuchMethodException e)
+ {
+ }
+
+ // then try a no-arg constructor
+ try
+ {
+ Constructor<T> constructor = clazz.getConstructor();
+ return constructor.newInstance();
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new WebBeansException("No suitable constructor : " + clazz.getName(), e.getCause());
+ }
+ }
+ catch (InstantiationException e)
+ {
+ throw new WebBeansException("Unable to instantiate class : " + clazz.getName(), e.getCause());
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new WebBeansException("Unable to instantiate class : " + clazz.getName(), e.getCause());
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new WebBeansException("Illegal access exception in creating instance with class : " + clazz.getName(), e);
+ }
+ }
+
+ public void clear()
+ {
+ managerMap.clear();
+ }
+
+ public LoaderService getLoaderService()
+ {
+ return loaderService;
+ }
+
+ public DeploymentValidationService getDeploymentValidationService()
+ {
+ return deploymentValidationService;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansFinder.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansFinder.java
new file mode 100644
index 0000000..d586fc7
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansFinder.java
@@ -0,0 +1,73 @@
+/*
+ * 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.webbeans.config;
+
+import org.apache.webbeans.corespi.DefaultSingletonService;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.spi.SingletonService;
+import org.apache.webbeans.util.WebBeansUtil;
+
+/**
+ * Holds the SingletonService that tracks WebBeansContext instances
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public final class WebBeansFinder
+{
+ //How you use singleton provider ,
+ //As a default we use ClassLoader --> Object
+ private static SingletonService<WebBeansContext> singletonService = new DefaultSingletonService();
+
+ /** safety mechanism to allow setting a special SingletonService only once */
+ private static boolean customSingletonServiceUsed = false;
+
+ /**
+ * No instantiate.
+ */
+ private WebBeansFinder()
+ {
+ //No action
+ }
+
+ public static WebBeansContext getSingletonInstance()
+ {
+ return singletonService.get(WebBeansUtil.getCurrentClassLoader());
+ }
+
+ public static void clearInstances(Object key)
+ {
+ singletonService.clear(key);
+ }
+
+ // Third pary frameworks can set singleton instance
+ // For example, OpenEJB could provide its own provider
+ // This can be called at most once.
+ public static void setSingletonService(SingletonService<WebBeansContext> singletonSvc)
+ {
+ if (customSingletonServiceUsed && !singletonService.equals(singletonSvc))
+ {
+ throw new WebBeansConfigurationException("Already using another custom SingletonService!");
+ }
+
+ singletonService = singletonSvc;
+ customSingletonServiceUsed = true;
+ }
+
+}
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/AbstractBeanManager.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/AbstractBeanManager.java
new file mode 100644
index 0000000..062c6d9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/AbstractBeanManager.java
@@ -0,0 +1,142 @@
+/*
+ * 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.webbeans.container;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMember;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.apache.webbeans.component.InjectionTargetBean;
+import org.apache.webbeans.component.WebBeansType;
+import org.apache.webbeans.component.creation.BeanAttributesBuilder;
+import org.apache.webbeans.component.creation.FieldProducerFactory;
+import org.apache.webbeans.component.creation.MethodProducerFactory;
+import org.apache.webbeans.component.spi.BeanAttributes;
+import org.apache.webbeans.component.spi.InjectionTargetFactory;
+import org.apache.webbeans.component.spi.ProducerFactory;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.util.AnnotationUtil;
+
+public abstract class AbstractBeanManager implements BeanManager
+{
+
+ protected abstract WebBeansContext getWebBeansContext();
+
+ public boolean areInterceptorBindingsEquivalent(Annotation annotation1, Annotation annotation2)
+ {
+ return AnnotationUtil.isCdiAnnotationEqual(annotation1, annotation2);
+ }
+
+ public boolean areQualifiersEquivalent(Annotation annotation1, Annotation annotation2)
+ {
+ return AnnotationUtil.isCdiAnnotationEqual(annotation1, annotation2);
+ }
+
+ public int getInterceptorBindingHashCode(Annotation annotation)
+ {
+ return AnnotationUtil.getCdiAnnotationHashCode(annotation);
+ }
+
+ public int getQualifierHashCode(Annotation annotation)
+ {
+ return AnnotationUtil.getCdiAnnotationHashCode(annotation);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public <T> BeanAttributes<T> createBeanAttributes(AnnotatedType<T> type)
+ {
+ return BeanAttributesBuilder.forContext(getWebBeansContext()).newBeanAttibutes(type).build();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public BeanAttributes<?> createBeanAttributes(AnnotatedMember<?> member)
+ {
+ if (member instanceof AnnotatedField)
+ {
+ return BeanAttributesBuilder.forContext(getWebBeansContext()).newBeanAttibutes((AnnotatedField<?>)member).build();
+ }
+ else if (member instanceof AnnotatedMethod)
+ {
+ return BeanAttributesBuilder.forContext(getWebBeansContext()).newBeanAttibutes((AnnotatedMethod<?>)member).build();
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unsupported member type " + member.getClass().getName());
+ }
+ }
+
+ public InjectionPoint createInjectionPoint(AnnotatedField<?> field)
+ {
+ return getWebBeansContext().getInjectionPointFactory().buildInjectionPoint(null, field);
+ }
+
+ public InjectionPoint createInjectionPoint(AnnotatedParameter<?> parameter)
+ {
+ return getWebBeansContext().getInjectionPointFactory().buildInjectionPoint(null, parameter);
+ }
+
+ public <X> ProducerFactory<X> getProducerFactory(AnnotatedField<? super X> field, Bean<X> bean)
+ {
+ return new FieldProducerFactory<X>(field, bean, getWebBeansContext());
+ }
+
+ public <X> ProducerFactory<X> getProducerFactory(AnnotatedMethod<? super X> method, Bean<X> bean)
+ {
+ return new MethodProducerFactory<X>(method, bean, getWebBeansContext());
+ }
+
+ public <X> InjectionTargetFactory<X> getInjectionTargetFactory(AnnotatedType<X> type)
+ {
+ return new InjectionTargetFactoryImpl<X>(type, getWebBeansContext());
+ }
+
+ public <T> Bean<T> createBean(BeanAttributes<T> attributes, Class<T> type, InjectionTargetFactory<T> factory)
+ {
+ return new InjectionTargetBean<T>(
+ getWebBeansContext(),
+ WebBeansType.THIRDPARTY,
+ getWebBeansContext().getAnnotatedElementFactory().newAnnotatedType(type),
+ attributes,
+ type,
+ factory);
+ }
+
+ public <T, X> Bean<T> createBean(BeanAttributes<T> attributes, Class<X> type, ProducerFactory<X> factory)
+ {
+ return null;
+ //return new AbstractProducerBean<T>(type, getWebBeansContext(), WebBeansType.THIRDPARTY, attributes, returnType, factory);
+ }
+
+ public <T extends Extension> T getExtension(Class<T> type)
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanCacheKey.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanCacheKey.java
new file mode 100644
index 0000000..70f5ad8
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanCacheKey.java
@@ -0,0 +1,436 @@
+/*
+ * 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.webbeans.container;
+
+import org.apache.webbeans.util.AnnotationUtil;
+
+import javax.enterprise.util.Nonbinding;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Array;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.Comparator;
+
+public final class BeanCacheKey
+{
+ private final boolean isDelegate;
+ private final Type type;
+ private final String path;
+ private final Annotation qualifier;
+ private final Annotation qualifiers[];
+ private final int hashCode;
+ private static final Comparator<Annotation> ANNOTATION_COMPARATOR = new AnnotationComparator();
+
+ public BeanCacheKey(boolean isDelegate, Type type, String path, Annotation... qualifiers)
+ {
+ this.isDelegate = isDelegate;
+ this.type = type;
+ this.path = path;
+ final int length = qualifiers != null ? qualifiers.length : 0;
+ if (length == 0)
+ {
+ qualifier = null;
+ this.qualifiers = null;
+ }
+ else if (length == 1)
+ {
+ qualifier = qualifiers[0];
+ this.qualifiers = null;
+ }
+ else
+ {
+ qualifier = null;
+ // to save array creations, we only create an array, if we have more than one annotation
+ this.qualifiers = new Annotation[length];
+ System.arraycopy(qualifiers, 0, this.qualifiers, 0, length);
+ Arrays.sort(this.qualifiers, ANNOTATION_COMPARATOR);
+ }
+
+ // this class is directly used in ConcurrentHashMap.get() so simply init the hasCode here
+ hashCode = computeHashCode();
+ }
+
+ @Override
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ BeanCacheKey cacheKey = (BeanCacheKey) o;
+
+ if (!isDelegate == cacheKey.isDelegate)
+ {
+ return false;
+ }
+ if (!type.equals(cacheKey.type))
+ {
+ return false;
+ }
+ if (qualifier != null ? !qualifierEquals(qualifier, cacheKey.qualifier) : cacheKey.qualifier != null)
+ {
+ return false;
+ }
+ if (!qualifierArrayEquals(qualifiers, cacheKey.qualifiers))
+ {
+ return false;
+ }
+ if (path != null ? !path.equals(cacheKey.path) : cacheKey.path != null)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ private boolean qualifierArrayEquals(Annotation[] qualifiers1, Annotation[] qualifiers2)
+ {
+ if (qualifiers1 == qualifiers2)
+ {
+ return true;
+ }
+ else if (qualifiers1 == null || qualifiers2 == null)
+ {
+ return false;
+ }
+ if (qualifiers1.length != qualifiers2.length)
+ {
+ return false;
+ }
+ for (int i = 0; i < qualifiers1.length; i++)
+ {
+ Annotation a1 = qualifiers1[i];
+ Annotation a2 = qualifiers2[i];
+ if (a1 == null ? a2 != null : !qualifierEquals(a1, a2))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return hashCode;
+ }
+
+ /**
+ * We need this method as some weird JVMs return 0 as hashCode for classes.
+ * In that case we return the hashCode of the String.
+ */
+ private int getTypeHashCode(Type type)
+ {
+ int typeHash = type.hashCode();
+ if (typeHash == 0 && type instanceof Class)
+ {
+ return ((Class)type).getName().hashCode();
+ // the type.toString() is always the same: "java.lang.Class@<hexid>"
+ // was: return type.toString().hashCode();
+ }
+
+ return typeHash;
+ }
+
+ /**
+ * Compute the HashCode. This should be called only in the constructor.
+ */
+ private int computeHashCode()
+ {
+ int computedHashCode = 31 * getTypeHashCode(type) + (path != null ? path.hashCode() : 0)
+ + (isDelegate ? 29 : 0);
+ if (qualifier != null)
+ {
+ computedHashCode = 31 * computedHashCode + getQualifierHashCode(qualifier);
+ }
+ if (qualifiers != null)
+ {
+ for (int i = 0; i < qualifiers.length; i++)
+ {
+ computedHashCode = 31 * computedHashCode + getQualifierHashCode(qualifiers[i]);
+ }
+ }
+ return computedHashCode;
+ }
+
+ /**
+ * Calculate the hashCode() of a qualifier, which ignores {@link Nonbinding} members.
+ */
+ private int getQualifierHashCode(Annotation a)
+ {
+ Class annotationClass = getAnnotationClass(a.getClass());
+
+ if (annotationClass == null)
+ {
+ return getTypeHashCode(a.getClass());
+ }
+
+ // the hashCode of an Annotation is calculated solely via the hashCodes
+ // of it's members. If there are no members, it is 0.
+ // thus we first need to get the annotation-class hashCode
+ int hashCode = getTypeHashCode(annotationClass);
+
+ // and now add the hashCode of all it's Nonbinding members
+ // the following algorithm is defined by the Annotation class definition
+ // see the JavaDoc for Annotation!
+ // we only change it so far that we skip evaluating @Nonbinding members
+ final Method[] members = annotationClass.getDeclaredMethods();
+
+ for (Method member : members)
+ {
+ if (member.isAnnotationPresent(Nonbinding.class))
+ {
+ // ignore the non binding
+ continue;
+ }
+
+ // Member value
+ final Object object = callMethod(a, member);
+ final int value;
+ if(object.getClass().isArray())
+ {
+ Class<?> type = object.getClass().getComponentType();
+ if(type.isPrimitive())
+ {
+ if(Long.TYPE == type)
+ {
+ value = Arrays.hashCode((long[]) object);
+ }
+ else if(Integer.TYPE == type)
+ {
+ value = Arrays.hashCode((int[])object);
+ }
+ else if(Short.TYPE == type)
+ {
+ value = Arrays.hashCode((short[])object);
+ }
+ else if(Double.TYPE == type)
+ {
+ value = Arrays.hashCode((double[])object);
+ }
+ else if(Float.TYPE == type)
+ {
+ value = Arrays.hashCode((float[])object);
+ }
+ else if(Boolean.TYPE == type)
+ {
+ value = Arrays.hashCode((boolean[])object);
+ }
+ else if(Byte.TYPE == type)
+ {
+ value = Arrays.hashCode((byte[])object);
+ }
+ else if(Character.TYPE == type)
+ {
+ value = Arrays.hashCode((char[])object);
+ }
+ else
+ {
+ value = 0;
+ }
+ }
+ else
+ {
+ value = Arrays.hashCode((Object[])object);
+ }
+ }
+ else
+ {
+ value = object.hashCode();
+ }
+
+ hashCode = 29 * hashCode + value;
+ hashCode = 29 * hashCode + member.getName().hashCode();
+ }
+
+ return hashCode;
+ }
+
+ /**
+ * Implements the equals() method for qualifiers, which ignores {@link Nonbinding} members.
+ */
+ private boolean qualifierEquals(Annotation qualifier1, Annotation qualifier2)
+ {
+ return ANNOTATION_COMPARATOR.compare(qualifier1, qualifier2) == 0;
+ }
+
+ private static Class getAnnotationClass(Class a)
+ {
+ for (Class i : a.getInterfaces())
+ {
+ if (i.isAnnotation())
+ {
+ return i;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Helper method for calculating the hashCode of an annotation.
+ */
+ private static Object callMethod(Object instance, Method method)
+ {
+ try
+ {
+ if (!method.isAccessible())
+ {
+ method.setAccessible(true);
+ }
+
+ return method.invoke(instance, AnnotationUtil.EMPTY_OBJECT_ARRAY);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Exception in method call : " + method.getName(), e);
+ }
+
+ }
+
+ /**
+ * for debugging ...
+ */
+ @Override
+ public String toString()
+ {
+ return "BeanCacheKey{" + "type=" + type + ", path='" + path + '\''
+ + ", delegate=" + isDelegate + ", qualifiers="
+ + (qualifiers == null ? qualifier : Arrays.asList(qualifiers)) + ", hashCode=" + hashCode + '}';
+ }
+
+ /**
+ * to keep the annotations ordered.
+ */
+ private static class AnnotationComparator implements Comparator<Annotation>
+ {
+
+ // Notice: Sorting is a bit costly, but the use of this code is very rar.
+ @Override
+ public int compare(Annotation annotation1, Annotation annotation2)
+ {
+ final Class<? extends Annotation> type1 = annotation1.annotationType();
+ final Class<? extends Annotation> type2 = annotation2.annotationType();
+ final int temp = type1.getName().compareTo(type2.getName());
+ if (temp != 0)
+ {
+ return temp;
+ }
+ final Method[] member1 = type1.getDeclaredMethods();
+ final Method[] member2 = type2.getDeclaredMethods();
+
+ // TBD: the order of the list of members seems to be deterministic
+
+ int i = 0;
+ int j = 0;
+ final int length1 = member1.length;
+ final int length2 = member2.length;
+
+ // find next nonbinding
+ for (;; i++, j++)
+ {
+ while (i < length1 && member1[i].isAnnotationPresent(Nonbinding.class))
+ {
+ i++;
+ }
+ while (j < length2 && member2[j].isAnnotationPresent(Nonbinding.class))
+ {
+ j++;
+ }
+ if (i >= length1 && j >= length2)
+ { // both ended
+ return 0;
+ }
+ else if (i >= length1)
+ { // #1 ended
+ return 1;
+ }
+ else if (j >= length2)
+ { // #2 ended
+ return -1;
+ }
+ else
+ { // not ended
+ int c = member1[i].getName().compareTo(member2[j].getName());
+ if (c != 0)
+ {
+ return c;
+ }
+ final Object value1 = callMethod(annotation1, member1[i]);
+ final Object value2 = callMethod(annotation2, member2[j]);
+ assert value1.getClass().equals(value2.getClass());
+
+ if (value1 instanceof Comparable)
+ {
+ c = ((Comparable)value1).compareTo(value2);
+ if (c != 0)
+ {
+ return c;
+ }
+ }
+ else if (value1.getClass().isArray())
+ {
+ c = value1.getClass().getComponentType().getName()
+ .compareTo(value2.getClass().getComponentType().getName());
+ if (c != 0)
+ {
+ return c;
+ }
+
+ final int length = Array.getLength(value1);
+ c = length - Array.getLength(value2);
+ if (c != 0)
+ {
+ return c;
+ }
+ for (int k = 0; k < length; k++)
+ {
+ c = ((Comparable)Array.get(value1, k)).compareTo(Array.get(value2, k));
+ if (c != 0)
+ {
+ return c;
+ }
+ }
+
+ }
+ else if (value1 instanceof Class)
+ {
+
+ c = ((Class)value1).getName().compareTo(((Class) value2).getName());
+ if (c != 0)
+ {
+ return c;
+ }
+ }
+ else
+ {
+ // valid types for members are only Comparable, Arrays, or Class
+ assert false;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
new file mode 100644
index 0000000..7900f0d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
@@ -0,0 +1,1111 @@
+/*
+ * 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.webbeans.container;
+
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.CopyOnWriteArraySet;
+
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+import javax.enterprise.context.ContextNotActiveException;
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.NormalScope;
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.Stereotype;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.Decorator;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.enterprise.inject.spi.InterceptionType;
+import javax.enterprise.inject.spi.Interceptor;
+import javax.enterprise.inject.spi.ObserverMethod;
+import javax.enterprise.inject.spi.PassivationCapable;
+import javax.enterprise.inject.spi.Producer;
+import javax.inject.Scope;
+import javax.interceptor.InterceptorBinding;
+import javax.naming.NamingException;
+import javax.naming.Reference;
+import javax.naming.Referenceable;
+import javax.naming.StringRefAddr;
+
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.component.EnterpriseBeanMarker;
+import org.apache.webbeans.component.JmsBeanMarker;
+import org.apache.webbeans.component.NewBean;
+import org.apache.webbeans.component.OwbBean;
+import org.apache.webbeans.component.third.PassivationCapableThirdpartyBeanImpl;
+import org.apache.webbeans.component.third.ThirdpartyBeanImpl;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.creational.CreationalContextImpl;
+import org.apache.webbeans.decorator.DecoratorComparator;
+import org.apache.webbeans.event.EventMetadata;
+import org.apache.webbeans.event.EventMetadataImpl;
+import org.apache.webbeans.event.NotificationManager;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.exception.definition.DuplicateDefinitionException;
+import org.apache.webbeans.exception.inject.DefinitionException;
+import org.apache.webbeans.plugins.OpenWebBeansJmsPlugin;
+import org.apache.webbeans.portable.AnnotatedElementFactory;
+import org.apache.webbeans.portable.events.discovery.ErrorStack;
+import org.apache.webbeans.spi.adaptor.ELAdaptor;
+import org.apache.webbeans.spi.plugins.OpenWebBeansEjbPlugin;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.Asserts;
+import org.apache.webbeans.util.ClassUtil;
+import org.apache.webbeans.util.GenericsUtil;
+import org.apache.webbeans.util.WebBeansUtil;
+import org.apache.webbeans.xml.WebBeansXMLConfigurator;
+
+/**
+ * Implementation of the {@link BeanManager} contract of the web beans
+ * container.
+ *
+ * <p>
+ * It is written as thread-safe.
+ * </p>
+ *
+ * @version $Rev$ $Date$
+ * @see BeanManager
+ */
+@SuppressWarnings("unchecked")
+public class BeanManagerImpl extends AbstractBeanManager implements BeanManager, Referenceable
+{
+ private static final long serialVersionUID = 2L;
+
+ /**
+ * Holds the non-standard contexts with key = scope type
+ * This will get used if more than 1 scope exists.
+ * Since the contexts will only get added through the
+ * {@link org.apache.webbeans.portable.events.discovery.AfterBeanDiscoveryImpl}
+ * we don't even need a ConcurrentHashMap.
+ * @see #singleContextMap
+ */
+ private Map<Class<? extends Annotation>, List<Context>> contextMap = new HashMap<Class<? extends Annotation>, List<Context>>();
+
+ /**
+ * This will hold non-standard contexts where only one Context implementation got registered
+ * for the given key = scope type
+ * Since the contexts will only get added through the
+ * {@link org.apache.webbeans.portable.events.discovery.AfterBeanDiscoveryImpl}
+ * we don't even need a ConcurrentHashMap.
+ * @see #contextMap
+ */
+ private Map<Class<? extends Annotation>, Context> singleContextMap = new HashMap<Class<? extends Annotation>, Context>();
+
+ /**Deployment archive beans*/
+ private Set<Bean<?>> deploymentBeans = new CopyOnWriteArraySet<Bean<?>>();
+
+ /**Normal scoped cache proxies*/
+ private Map<Contextual<?>, Object> cacheProxies = new ConcurrentHashMap<Contextual<?>, Object>();
+
+ /**Event notification manager instance*/
+ private NotificationManager notificationManager = null;
+
+ /**Injection resolver instance*/
+ private InjectionResolver injectionResolver = null;
+
+ /**XML configurator instance*/
+ private WebBeansXMLConfigurator xmlConfigurator = null;
+
+ /**
+ * This list contains additional qualifiers which got set via the
+ * {@link javax.enterprise.inject.spi.BeforeBeanDiscovery#addQualifier(Class)}
+ * event function.
+ */
+ private List<Class<? extends Annotation>> additionalQualifiers = new ArrayList<Class<? extends Annotation>>();
+
+ /**
+ * This list contains additional interceptor bindings which got set via the
+ * {@link javax.enterprise.inject.spi.BeforeBeanDiscovery#addInterceptorBinding(Class, java.lang.annotation.Annotation...)}
+ * event function.
+ */
+ private List<Class<? extends Annotation>> additionalInterceptorBindings = new ArrayList<Class<? extends Annotation>>();
+
+ /**
+ * This list contains additional scopes which got set via the
+ * {@link javax.enterprise.inject.spi.BeforeBeanDiscovery#addScope(Class, boolean, boolean)} event function.
+ */
+ private List<ExternalScope> additionalScopes = new ArrayList<ExternalScope>();
+
+ private ConcurrentMap<Class<?>, ConcurrentMap<String, AnnotatedType<?>>> additionalAnnotatedTypes = new ConcurrentHashMap<Class<?>, ConcurrentMap<String, AnnotatedType<?>>>();
+
+ private ErrorStack errorStack = new ErrorStack();
+
+ /**
+ * This map stores all beans along with their unique {@link javax.enterprise.inject.spi.PassivationCapable} id.
+ * This is used as a reference for serialization.
+ */
+ private ConcurrentMap<String, Bean<?>> passivationBeans = new ConcurrentHashMap<String, Bean<?>>();
+
+ /**InjectionTargets for Java EE component instances that supports injections*/
+ private Map<Class<?>, Producer<?>> producersForJavaEeComponents =
+ new ConcurrentHashMap<Class<?>, Producer<?>>();
+
+ private AnnotatedElementFactory annotatedElementFactory;
+
+ private final WebBeansContext webBeansContext;
+
+ /**
+ * This flag will get set to <code>true</code> if a custom bean
+ * (all non-internal beans like {@link org.apache.webbeans.component.BeanManagerBean;} etc)
+ * gets set.
+ */
+ private boolean inUse = false;
+
+
+ /**
+ * we cache results of calls to {@link #isNormalScope(Class)} because
+ * this doesn't change at runtime.
+ * We don't need to take special care about classloader
+ * hierarchies, because each cl has other classes.
+ */
+ private static Map<Class<? extends Annotation>, Boolean> isScopeTypeNormalCache =
+ new ConcurrentHashMap<Class<? extends Annotation>, Boolean>();
+
+
+ /**
+ * Creates a new {@link BeanManager} instance.
+ * Called by the system. Do not use outside of the
+ * system.
+ */
+ public BeanManagerImpl(WebBeansContext webBeansContext)
+ {
+ this.webBeansContext = webBeansContext;
+ injectionResolver = new InjectionResolver(webBeansContext);
+ notificationManager = new NotificationManager(webBeansContext);
+ annotatedElementFactory = webBeansContext.getAnnotatedElementFactory();
+ }
+
+ @Override
+ public WebBeansContext getWebBeansContext()
+ {
+ return webBeansContext;
+ }
+
+ public <T> void putProducerForJavaEeComponent(Class<T> javaEeComponentClass, Producer<T> wrapper)
+ {
+ Asserts.assertNotNull(javaEeComponentClass);
+ Asserts.assertNotNull(wrapper);
+
+ producersForJavaEeComponents.put(javaEeComponentClass, wrapper);
+ }
+
+ public <T> Producer<T> getProducerForJavaEeComponent(Class<T> javaEeComponentClass)
+ {
+ Asserts.assertNotNull(javaEeComponentClass);
+ return (Producer<T>) producersForJavaEeComponents.get(javaEeComponentClass);
+ }
+
+ public ErrorStack getErrorStack()
+ {
+ return errorStack;
+ }
+
+ /**
+ * Return manager notification manager.
+ *
+ * @return notification manager
+ */
+ public NotificationManager getNotificationManager()
+ {
+ return notificationManager;
+ }
+
+ /**
+ * Gets injection resolver.
+ *
+ * @return injection resolver
+ */
+ public InjectionResolver getInjectionResolver()
+ {
+ return injectionResolver;
+ }
+
+ /**
+ * Sets the xml configurator instance.
+ *
+ * @param xmlConfigurator set xml configurator instance.
+ * @see WebBeansXMLConfigurator
+ */
+ public synchronized void setXMLConfigurator(WebBeansXMLConfigurator xmlConfigurator)
+ {
+ if(this.xmlConfigurator != null)
+ {
+ throw new IllegalStateException("WebBeansXMLConfigurator is already defined!");
+ }
+
+ this.xmlConfigurator = xmlConfigurator;
+ }
+
+ /**
+ * Gets the active context for the given scope type.
+ *
+ * @param scopeType scope type of the context
+ * @throws ContextNotActiveException if no active context
+ * @throws IllegalStateException if more than one active context
+ */
+ @Override
+ public Context getContext(Class<? extends Annotation> scopeType)
+ {
+ Asserts.assertNotNull(scopeType, "scopeType parameter can not be null");
+
+ Context standardContext = webBeansContext.getContextsService().getCurrentContext(scopeType);
+
+ if(standardContext != null && standardContext.isActive())
+ {
+ return standardContext;
+ }
+
+ // this is by far the most case
+ Context singleContext = singleContextMap.get(scopeType);
+ if (singleContext != null)
+ {
+ if (!singleContext.isActive())
+ {
+ throw new ContextNotActiveException("WebBeans context with scope type annotation @"
+ + scopeType.getSimpleName()
+ + " does not exist within current thread");
+ }
+ return singleContext;
+ }
+
+ // the spec also allows for multiple contexts existing for the same scope type
+ // but in this case only one must be active at a time (for the current thread)
+ List<Context> others = contextMap.get(scopeType);
+ Context found = null;
+
+ if(others != null)
+ {
+ for(Context otherContext : others)
+ {
+ if(otherContext.isActive())
+ {
+ if (found != null)
+ {
+ throw new IllegalStateException("More than one active context exists with scope type annotation @"
+ + scopeType.getSimpleName());
+ }
+
+ found = otherContext;
+ }
+ }
+ }
+
+ if (found == null)
+ {
+ throw new ContextNotActiveException("WebBeans context with scope type annotation @"
+ + scopeType.getSimpleName() + " does not exist within current thread");
+ }
+
+ return found;
+ }
+
+ /**
+ * Add new bean to the BeanManager.
+ * This will also set OWBs {@link #inUse} status.
+ *
+ * @param newBean new bean instance
+ * @return the this manager
+ */
+ public BeanManager addBean(Bean<?> newBean)
+ {
+ inUse = true;
+ return addInternalBean(newBean);
+ }
+
+ /**
+ * This method is reserved for adding 'internal beans'
+ * like e.g. a BeanManagerBean,
+ * @param newBean
+ * @return
+ */
+ public <T> BeanManager addInternalBean(Bean<T> newBean)
+ {
+ if(newBean instanceof AbstractOwbBean)
+ {
+ addPassivationInfo((OwbBean<T>)newBean);
+ deploymentBeans.add(newBean);
+ }
+ else
+ {
+ ThirdpartyBeanImpl<?> bean;
+ if (!PassivationCapable.class.isInstance(newBean))
+ {
+ bean = new ThirdpartyBeanImpl<T>(webBeansContext, newBean);
+ }
+ else
+ {
+ bean = new PassivationCapableThirdpartyBeanImpl<T>(webBeansContext, newBean);
+ }
+ addPassivationInfo(bean);
+ deploymentBeans.add(bean);
+ }
+
+ return this;
+ }
+
+
+ /**
+ * Check if the bean is has a passivation id and add it to the id store.
+ *
+ * @param bean
+ * @throws DefinitionException if the id is not unique.
+ */
+ public void addPassivationInfo(Bean<?> bean) throws DefinitionException
+ {
+ String id = null;
+ if (bean instanceof OwbBean<?>)
+ {
+ id = ((OwbBean) bean).getId();
+ }
+ if (id == null && bean instanceof PassivationCapable)
+ {
+ id = ((PassivationCapable) bean).getId();
+ }
+
+ if(id != null)
+ {
+ Bean<?> oldBean = passivationBeans.putIfAbsent(id, bean);
+ if (oldBean != null)
+ {
+ throw new DuplicateDefinitionException("PassivationCapable bean id is not unique: " + id + " bean:" + bean);
+ }
+
+ }
+ }
+
+
+ public BeanManager addContext(Context context)
+ {
+ addContext(context.getScope(), webBeansContext.getContextFactory().getCustomContext(context));
+
+ return this;
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void fireEvent(Object event, Annotation... bindings)
+ {
+ fireEvent(event, new EventMetadataImpl(event.getClass(), null, bindings), false);
+ }
+
+ /**
+ * Like {@link #fireEvent(Object, java.lang.annotation.Annotation...)} but intended for
+ * internal CDI Container lifecycle events. The difference is that those
+ * events must only be delivered to CDI Extensions and not to normal beans.
+ */
+ public void fireLifecycleEvent(Object event, Annotation... bindings)
+ {
+ fireEvent(event, new EventMetadataImpl(event.getClass(), null, bindings), true);
+ }
+
+ public void fireEvent(Object event, EventMetadata metadata, boolean isLifecycleEvent)
+ {
+ if (ClassUtil.isDefinitionContainsTypeVariables(event.getClass()))
+ {
+ throw new IllegalArgumentException("Event class : " + event.getClass().getName() + " can not be defined as generic type");
+ }
+
+ notificationManager.fireEvent(event, metadata, isLifecycleEvent);
+ }
+
+ public Set<Bean<?>> getComponents()
+ {
+ return deploymentBeans;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<Decorator<?>> resolveDecorators(Set<Type> types, Annotation... bindingTypes)
+ {
+ webBeansContext.getAnnotationManager().checkDecoratorResolverParams(types, bindingTypes);
+ Set<Decorator<?>> intsSet = webBeansContext.getDecoratorsManager().findDeployedWebBeansDecorator(types, bindingTypes);
+
+ List<Decorator<?>> decoratorList = new ArrayList<Decorator<?>>(intsSet);
+ Collections.sort(decoratorList, new DecoratorComparator(webBeansContext));
+
+ return decoratorList;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<Interceptor<?>> resolveInterceptors(InterceptionType type, Annotation... interceptorBindings)
+ {
+ webBeansContext.getAnnotationManager().checkInterceptorResolverParams(interceptorBindings);
+
+ return webBeansContext.getInterceptorsManager().resolveInterceptors(type, interceptorBindings);
+ }
+
+
+ public Set<Bean<?>> getBeans()
+ {
+ return deploymentBeans;
+ }
+
+ private void addContext(Class<? extends Annotation> scopeType, javax.enterprise.context.spi.Context context)
+ {
+ Asserts.assertNotNull(scopeType, "scopeType parameter can not be null");
+ Asserts.assertNotNull(context, "context parameter can not be null");
+
+ List<Context> contextList = contextMap.get(scopeType);
+
+ if(contextList == null)
+ {
+ Context singleContext = singleContextMap.get(scopeType);
+ if (singleContext == null)
+ {
+ // first put them into the singleContextMap
+ singleContextMap.put(scopeType, context);
+ }
+ else
+ {
+ // from the 2nd Context for this scopetype on, we need to maintain a List for them
+ contextList = new ArrayList<Context>();
+ contextList.add(singleContext);
+ contextList.add(context);
+
+ contextMap.put(scopeType, contextList);
+ singleContextMap.remove(scopeType);
+ }
+ }
+ else
+ {
+ contextList.add(context);
+ }
+
+ }
+
+ @Override
+ public Reference getReference() throws NamingException
+ {
+ return new Reference(BeanManagerImpl.class.getName(), new StringRefAddr("ManagerImpl", "ManagerImpl"), ManagerObjectFactory.class.getName(), null);
+ }
+
+ /**
+ * Parse the given XML input stream for adding XML defined artifacts.
+ *
+ * @param xmlStream beans xml definitions
+ * @return {@link BeanManager} instance
+ */
+
+ public BeanManager parse(InputStream xmlStream)
+ {
+ xmlConfigurator.configure(xmlStream);
+
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public <T> AnnotatedType<T> createAnnotatedType(Class<T> type)
+ {
+ AnnotatedType<T> annotatedType = annotatedElementFactory.newAnnotatedType(type);
+
+ return annotatedType;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public <T> CreationalContextImpl<T> createCreationalContext(Contextual<T> contextual)
+ {
+ if (contextual instanceof SerializableBean)
+ {
+ contextual = ((SerializableBean)contextual).getBean();
+ }
+
+ return webBeansContext.getCreationalContextFactory().getCreationalContext(contextual);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<Bean<?>> getBeans(Type beanType, Annotation... bindings)
+ {
+ if(ClassUtil.isTypeVariable(beanType))
+ {
+ throw new IllegalArgumentException("Exception in getBeans method. Bean type can not be TypeVariable for bean type : " + beanType);
+ }
+
+ webBeansContext.getAnnotationManager().checkQualifierConditions(bindings);
+
+ return injectionResolver.implResolveByType(false, beanType, bindings);
+
+ }
+
+ @Override
+ public Set<Bean<?>> getBeans(String name)
+ {
+ Asserts.assertNotNull(name, "name parameter can not be null");
+
+ return injectionResolver.implResolveByName(name);
+ }
+
+ @Override
+ public ELResolver getELResolver()
+ {
+ ELAdaptor elAdaptor = webBeansContext.getService(ELAdaptor.class);
+ return elAdaptor.getOwbELResolver();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object getInjectableReference(InjectionPoint injectionPoint, CreationalContext<?> ownerCreationalContext)
+ {
+ Asserts.assertNotNull(injectionPoint, "injectionPoint parameter can not be null");
+
+ //Injected instance
+ Object instance = null;
+
+ //Injection point is null
+ if(injectionPoint == null)
+ {
+ return null;
+ }
+
+ //Find the injection point Bean
+ Bean<Object> injectedBean = (Bean<Object>)injectionResolver.getInjectionPointBean(injectionPoint);
+
+ if(WebBeansUtil.isDependent(injectedBean))
+ {
+ if (!(ownerCreationalContext instanceof CreationalContextImpl))
+ {
+ ownerCreationalContext = webBeansContext.getCreationalContextFactory().wrappedCreationalContext(ownerCreationalContext, injectionPoint.getBean());
+ }
+ ((CreationalContextImpl<?>)ownerCreationalContext).putInjectionPoint(injectionPoint);
+ //Using owner creational context
+ //Dependents use parent creational context
+ try
+ {
+ instance = getReference(injectedBean, injectionPoint.getType(), ownerCreationalContext);
+ }
+ finally
+ {
+ ((CreationalContextImpl<?>)ownerCreationalContext).removeInjectionPoint();
+ }
+ }
+ else
+ {
+ //New creational context for normal scoped beans
+ CreationalContextImpl<Object> injectedCreational = (CreationalContextImpl<Object>)createCreationalContext(injectedBean);
+ injectedCreational.putInjectionPoint(injectionPoint);
+ try
+ {
+ instance = getReference(injectedBean, injectionPoint.getType(), injectedCreational);
+ }
+ finally
+ {
+ injectedCreational.removeInjectionPoint();
+ }
+ }
+
+ return instance;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<Annotation> getInterceptorBindingDefinition(Class<? extends Annotation> binding)
+ {
+ Annotation[] annotations = binding.getDeclaredAnnotations();
+ Set<Annotation> set = new HashSet<Annotation>();
+
+ if(binding.isAnnotationPresent(InterceptorBinding.class))
+ {
+ Collections.addAll(set, annotations);
+ }
+
+ return set;
+ }
+
+ @Override
+ public Bean<?> getPassivationCapableBean(String id)
+ {
+ return passivationBeans.get(id);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object getReference(Bean<?> bean, Type beanType, CreationalContext<?> creationalContext)
+ {
+ Asserts.assertNotNull(bean, "bean parameter can not be null");
+
+ Context context = null;
+ Object instance = null;
+
+ if (bean instanceof SerializableBean)
+ {
+ bean = ((SerializableBean)bean).getBean();
+ }
+
+ if(!(creationalContext instanceof CreationalContextImpl))
+ {
+ creationalContext = webBeansContext.getCreationalContextFactory().wrappedCreationalContext(creationalContext, bean);
+ }
+
+ //Check type if bean type is given
+ if(beanType != null)
+ {
+ if(!isBeanTypeAssignableToGivenType(bean.getTypes(), beanType, bean instanceof NewBean) &&
+ !GenericsUtil.satisfiesDependency(false, beanType, bean.getBeanClass()))
+ {
+ throw new IllegalArgumentException("Given bean type : " + beanType + " is not applicable for the bean instance : " + bean);
+ }
+ }
+ else
+ {
+ beanType = bean.getBeanClass();
+ }
+
+ //Scope is normal
+ if (isNormalScope(bean.getScope()))
+ {
+ instance = getEjbOrJmsProxyReference(bean, beanType,creationalContext);
+
+ if(instance != null)
+ {
+ return instance;
+ }
+
+ instance = cacheProxies.get(bean);
+
+ if (instance == null)
+ {
+ //Create Managed Bean Proxy
+ //X old approach: instance = webBeansContext.getProxyFactoryRemove().createNormalScopedBeanProxyRemove((AbstractOwbBean<?>) bean, creationalContext);
+ instance = webBeansContext.getNormalScopeProxyFactory().createNormalScopeProxy(bean);
+
+ //Cached instance
+ cacheProxies.put(bean, instance);
+ }
+
+ }
+ //Create Pseudo-Scope Bean Instance
+ else
+ {
+ //Get bean context
+ context = getContext(bean.getScope());
+
+ //Get instance for ejb or jms
+ instance = getEjbOrJmsProxyReference(bean, beanType, creationalContext);
+
+ if(instance != null)
+ {
+ return instance;
+ }
+
+ //Get dependent from DependentContex that create contextual instance
+ instance = context.get((Bean<Object>)bean, (CreationalContext<Object>)creationalContext);
+ }
+
+ return instance;
+ }
+
+
+ private boolean isBeanTypeAssignableToGivenType(Set<Type> beanTypes, Type givenType, boolean newBean)
+ {
+ Iterator<Type> itBeanApiTypes = beanTypes.iterator();
+ while (itBeanApiTypes.hasNext())
+ {
+ Type beanApiType = itBeanApiTypes.next();
+
+ if(GenericsUtil.satisfiesDependency(false, givenType, beanApiType))
+ {
+ return true;
+ }
+ else
+ {
+ //Check for @New
+ if(newBean && ClassUtil.isParametrizedType(givenType))
+ {
+ Class<?> requiredType = ClassUtil.getClass(givenType);
+ if(ClassUtil.isClassAssignable(requiredType, ClassUtil.getClass(beanApiType)))
+ {
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
+
+ private Object getEjbOrJmsProxyReference(Bean<?> bean,Type beanType, CreationalContext<?> creationalContext)
+ {
+ //Create session bean proxy
+ if(bean instanceof EnterpriseBeanMarker)
+ {
+ if(isNormalScope(bean.getScope()))
+ {
+ //Maybe it is cached
+ if(cacheProxies.containsKey(bean))
+ {
+ return cacheProxies.get(bean);
+ }
+ }
+
+ OpenWebBeansEjbPlugin ejbPlugin = webBeansContext.getPluginLoader().getEjbPlugin();
+ if(ejbPlugin == null)
+ {
+ throw new IllegalStateException("There is no EJB plugin provider. Injection is failed for bean : " + bean);
+ }
+
+ return ejbPlugin.getSessionBeanProxy(bean,ClassUtil.getClazz(beanType), creationalContext);
+ }
+
+ //Create JMS Proxy
+ else if(bean instanceof JmsBeanMarker)
+ {
+ OpenWebBeansJmsPlugin jmsPlugin = webBeansContext.getPluginLoader().getJmsPlugin();
+ if(jmsPlugin == null)
+ {
+ throw new IllegalStateException("There is no JMS plugin provider. Injection is failed for bean : " + bean);
+ }
+
+ return jmsPlugin.getJmsBeanProxy(bean, ClassUtil.getClass(beanType));
+ }
+
+ return null;
+ }
+
+
+ @Override
+ public Set<Annotation> getStereotypeDefinition(Class<? extends Annotation> stereotype)
+ {
+ Annotation[] annotations = stereotype.getDeclaredAnnotations();
+ Set<Annotation> set = new HashSet<Annotation>();
+
+ if(stereotype.isAnnotationPresent(Stereotype.class))
+ {
+ Collections.addAll(set, annotations);
+ }
+
+ return set;
+ }
+
+ @Override
+ public boolean isQualifier(Class<? extends Annotation> annotationType)
+ {
+ return webBeansContext.getAnnotationManager().isQualifierAnnotation(annotationType);
+ }
+
+ @Override
+ public boolean isInterceptorBinding(Class<? extends Annotation> annotationType)
+ {
+ return webBeansContext.getAnnotationManager().isInterceptorBindingAnnotation(annotationType);
+ }
+
+ @Override
+ public boolean isScope(Class<? extends Annotation> annotationType)
+ {
+ if(AnnotationUtil.hasAnnotation(annotationType.getDeclaredAnnotations(), Scope.class) ||
+ AnnotationUtil.hasAnnotation(annotationType.getDeclaredAnnotations(), NormalScope.class))
+ {
+ return true;
+ }
+
+ for(ExternalScope ext : additionalScopes)
+ {
+ if(ext.getScope().equals(annotationType))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean isNormalScope(Class<? extends Annotation> scopeType)
+ {
+ Boolean isNormal = isScopeTypeNormalCache.get(scopeType);
+
+ if (isNormal != null)
+ {
+ return isNormal;
+ }
+
+ for(ExternalScope extScope : additionalScopes)
+ {
+ if (extScope.getScope().equals(scopeType))
+ {
+ isScopeTypeNormalCache.put(scopeType, extScope.isNormal());
+ return extScope.isNormal();
+ }
+ }
+
+ isNormal = scopeType.getAnnotation(NormalScope.class) != null;
+ isScopeTypeNormalCache.put(scopeType, isNormal);
+
+ return isNormal;
+ }
+
+ @Override
+ public boolean isPassivatingScope(Class<? extends Annotation> annotationType)
+ {
+ for(ExternalScope extScope : additionalScopes)
+ {
+ if (extScope.getScope().equals(annotationType))
+ {
+ return extScope.isPassivating();
+ }
+ }
+
+ NormalScope scope = annotationType.getAnnotation(NormalScope.class);
+
+ if(scope != null)
+ {
+ return scope.passivating();
+ }
+
+ return false;
+ }
+
+
+ @Override
+ public boolean isStereotype(Class<? extends Annotation> annotationType)
+ {
+ return AnnotationUtil.hasAnnotation(annotationType.getDeclaredAnnotations(), Stereotype.class);
+ }
+
+ @Override
+ public <X> Bean<? extends X> resolve(Set<Bean<? extends X>> beans)
+ {
+ return injectionResolver.resolve(beans);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void validate(InjectionPoint injectionPoint)
+ {
+ Bean<?> bean = injectionPoint.getBean();
+
+ //Check for correct injection type
+ injectionResolver.checkInjectionPointType(injectionPoint);
+
+ Class<?> rawType = ClassUtil.getRawTypeForInjectionPoint(injectionPoint);
+
+ // check for InjectionPoint injection
+ if (rawType.equals(InjectionPoint.class))
+ {
+ if (AnnotationUtil.hasAnnotation(AnnotationUtil.asArray(injectionPoint.getQualifiers()), Default.class))
+ {
+ if (!bean.getScope().equals(Dependent.class))
+ {
+ throw new WebBeansConfigurationException("Bean " + bean.getBeanClass() + " scope can not define other scope except @Dependent to inject InjectionPoint");
+ }
+ }
+ }
+ else
+ {
+ injectionResolver.checkInjectionPoint(injectionPoint);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public <T> InjectionTarget<T> createInjectionTarget(AnnotatedType<T> type)
+ {
+ InjectionTargetFactoryImpl<T> factory = new InjectionTargetFactoryImpl<T>(type, webBeansContext);
+ return factory.createInjectionTarget();
+ }
+
+ @Override
+ public <T> Set<ObserverMethod<? super T>> resolveObserverMethods(T event, Annotation... qualifiers)
+ {
+ return resolveObserverMethods(event, new EventMetadataImpl(event.getClass(), null, qualifiers));
+ }
+
+ public <T> Set<ObserverMethod<? super T>> resolveObserverMethods(T event, EventMetadata metadata)
+ {
+ if(ClassUtil.isDefinitionContainsTypeVariables(ClassUtil.getClass(metadata.getType())))
+ {
+ throw new IllegalArgumentException("Event type can not contain type variables. Event class is : " + event.getClass());
+ }
+
+ return notificationManager.resolveObservers(event, metadata);
+ }
+
+ @Override
+ public ExpressionFactory wrapExpressionFactory(ExpressionFactory expressionFactory)
+ {
+ ELAdaptor elAdaptor = webBeansContext.getService(ELAdaptor.class);
+ return elAdaptor.getOwbWrappedExpressionFactory(expressionFactory);
+ }
+
+ public void addAdditionalQualifier(Class<? extends Annotation> qualifier)
+ {
+ if (!additionalQualifiers.contains(qualifier))
+ {
+ additionalQualifiers.add(qualifier);
+ }
+ }
+
+ public void addAdditionalInterceptorBindings(Class<? extends Annotation> interceptorBinding)
+ {
+ if (!additionalInterceptorBindings.contains(interceptorBinding))
+ {
+ additionalInterceptorBindings.add(interceptorBinding);
+ }
+ }
+
+ public void addAdditionalAnnotatedType(AnnotatedType<?> annotatedType)
+ {
+ addAdditionalAnnotatedType(annotatedType, AnnotatedElementFactory.OWB_DEFAULT_KEY);
+ }
+
+ public void addAdditionalAnnotatedType(AnnotatedType<?> annotatedType, String id)
+ {
+ webBeansContext.getAnnotatedElementFactory().setAnnotatedType(annotatedType, id);
+ ConcurrentMap<String, AnnotatedType<?>> annotatedTypes = additionalAnnotatedTypes.get(annotatedType.getJavaClass());
+ if (annotatedTypes == null)
+ {
+ annotatedTypes = new ConcurrentHashMap<String, AnnotatedType<?>>();
+ ConcurrentMap<String, AnnotatedType<?>> oldAnnotatedTypes = additionalAnnotatedTypes.putIfAbsent(annotatedType.getJavaClass(), annotatedTypes);
+ if (oldAnnotatedTypes != null)
+ {
+ annotatedTypes = oldAnnotatedTypes;
+ }
+ }
+ annotatedTypes.put(id, annotatedType);
+ }
+
+ public void removeAdditionalAnnotatedType(AnnotatedType<?> annotatedType)
+ {
+ removeAdditionalAnnotatedType(annotatedType, AnnotatedElementFactory.OWB_DEFAULT_KEY);
+ }
+
+ public void removeAdditionalAnnotatedType(AnnotatedType<?> annotatedType, String id)
+ {
+ ConcurrentMap<String, AnnotatedType<?>> annotatedTypes = additionalAnnotatedTypes.get(annotatedType.getJavaClass());
+ if (annotatedTypes == null)
+ {
+ return;
+ }
+ if (annotatedType.equals(annotatedTypes.get(id)))
+ {
+ annotatedTypes.remove(id);
+ }
+ }
+
+ public List<Class<? extends Annotation>> getAdditionalQualifiers()
+ {
+ return additionalQualifiers;
+ }
+
+ public void addAdditionalScope(ExternalScope additionalScope)
+ {
+ if (!additionalScopes.contains(additionalScope))
+ {
+ additionalScopes.add(additionalScope);
+ }
+ }
+
+
+ public List<ExternalScope> getAdditionalScopes()
+ {
+ return additionalScopes;
+ }
+
+ public Collection<AnnotatedType<?>> getAdditionalAnnotatedTypes()
+ {
+ Collection<AnnotatedType<?>> annotatedTypes = new ArrayList<AnnotatedType<?>>();
+ for (ConcurrentMap<String,AnnotatedType<?>> types: additionalAnnotatedTypes.values())
+ {
+ annotatedTypes.addAll(types.values());
+ }
+ return annotatedTypes;
+ }
+
+ public <T> AnnotatedType<T> getAdditionalAnnotatedType(Class<T> type, String id)
+ {
+ ConcurrentMap<String, AnnotatedType<?>> annotatedTypes = additionalAnnotatedTypes.get(type);
+ if (annotatedTypes == null)
+ {
+ return null;
+ }
+ return (AnnotatedType<T>)annotatedTypes.get(id);
+ }
+
+ public void clear()
+ {
+ additionalAnnotatedTypes.clear();
+ additionalQualifiers.clear();
+ additionalScopes.clear();
+ clearCacheProxies();
+ singleContextMap.clear();
+ contextMap.clear();
+ deploymentBeans.clear();
+ errorStack.clear();
+ producersForJavaEeComponents.clear();
+ passivationBeans.clear();
+ webBeansContext.getInterceptorsManager().clear();
+ webBeansContext.getDecoratorsManager().clear();
+ }
+
+ public void clearCacheProxies()
+ {
+ cacheProxies.clear();
+ }
+
+ public boolean isInUse()
+ {
+ return inUse;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/DecoratorInjectionTargetFactory.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/DecoratorInjectionTargetFactory.java
new file mode 100644
index 0000000..532db41
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/DecoratorInjectionTargetFactory.java
@@ -0,0 +1,55 @@
+/*
+ * 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.webbeans.container;
+
+import java.lang.reflect.Modifier;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionTarget;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.portable.AbstractDecoratorInjectionTarget;
+
+public class DecoratorInjectionTargetFactory<T> extends InjectionTargetFactoryImpl<T>
+{
+
+ public DecoratorInjectionTargetFactory(AnnotatedType<T> annotatedType, WebBeansContext webBeansContext)
+ {
+ super(annotatedType, webBeansContext);
+ }
+
+ @Override
+ public InjectionTarget<T> createInjectionTarget(Bean<T> bean)
+ {
+ if (Modifier.isAbstract(getAnnotatedType().getJavaClass().getModifiers()))
+ {
+ return new AbstractDecoratorInjectionTarget<T>(
+ getAnnotatedType(),
+ createInjectionPoints(bean),
+ getWebBeansContext(),
+ getPostConstructMethods(),
+ getPreDestroyMethods());
+ }
+ else
+ {
+ return super.createInjectionTarget(bean);
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/ExternalScope.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/ExternalScope.java
new file mode 100644
index 0000000..e57fae6
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/ExternalScope.java
@@ -0,0 +1,70 @@
+/*
+ * 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.webbeans.container;
+
+
+import java.lang.annotation.Annotation;
+
+import org.apache.webbeans.config.DefaultAnnotation;
+
+
+/**
+ * A wrapper for an external scope which can be added by
+ * {@link javax.enterprise.inject.spi.BeforeBeanDiscovery#addScope(Class, boolean, boolean)}.
+ */
+public class ExternalScope
+{
+
+ private Class<? extends Annotation> scope;
+ private boolean normal;
+ private boolean passivating;
+ private Annotation scopeAnnotation;
+
+ public ExternalScope(Class<? extends Annotation> scope, boolean normal, boolean passivating)
+ {
+ this.scope = scope;
+ this.normal = normal;
+ this.passivating = passivating;
+ scopeAnnotation = DefaultAnnotation.of(scope);
+ }
+
+ public Class<? extends Annotation> getScope()
+ {
+ return scope;
+ }
+
+ public boolean isNormal()
+ {
+ return normal;
+ }
+
+ public boolean isPassivating()
+ {
+ return passivating;
+ }
+
+ /**
+ * @return an instance of the annotation class we got set
+ * in {@link javax.enterprise.inject.spi.BeforeBeanDiscovery#addScope(Class, boolean, boolean)}
+ */
+ public Annotation getScopeAnnotation()
+ {
+ return scopeAnnotation;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectableBeanManager.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectableBeanManager.java
new file mode 100644
index 0000000..9da43ae
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectableBeanManager.java
@@ -0,0 +1,290 @@
+/*
+ * 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.webbeans.container;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.List;
+import java.util.Set;
+
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.Decorator;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.enterprise.inject.spi.InterceptionType;
+import javax.enterprise.inject.spi.Interceptor;
+import javax.enterprise.inject.spi.ObserverMethod;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+/**
+ * <p>This implementation of the {@link BeanManager} will get used
+ * for whenever a BeanManager gets injected into a bean:
+ * <pre>
+ * private @Inject BeanManager beanManager;
+ * </pre>
+ * </p>
+ * This class is Serializable and always resolves the current
+ * instance of the central BeanManager automatically.
+ */
+public class InjectableBeanManager extends AbstractBeanManager implements BeanManager, Serializable, Externalizable
+{
+
+ private static final long serialVersionUID = 1L;
+
+ private transient BeanManagerImpl bm;
+
+ /**
+ * Used by serialization.
+ */
+ public InjectableBeanManager()
+ {
+ this(WebBeansContext.getInstance().getBeanManagerImpl());
+ }
+
+ public InjectableBeanManager(BeanManagerImpl beanManager)
+ {
+ bm = beanManager;
+ }
+
+ @Override
+ public WebBeansContext getWebBeansContext()
+ {
+ return bm.getWebBeansContext();
+ }
+
+ @Override
+ public <T> AnnotatedType<T> createAnnotatedType(Class<T> type)
+ {
+ return bm.createAnnotatedType(type);
+ }
+
+ @Override
+ public <T> CreationalContext<T> createCreationalContext(Contextual<T> contextual)
+ {
+ return bm.createCreationalContext(contextual);
+ }
+
+ @Override
+ public <T> InjectionTarget<T> createInjectionTarget(AnnotatedType<T> type)
+ {
+ return bm.createInjectionTarget(type);
+ }
+
+ @Override
+ public void fireEvent(Object event, Annotation... qualifiers)
+ {
+ bm.fireEvent(event, qualifiers);
+ }
+
+ @Override
+ public Set<Bean<?>> getBeans(String name)
+ {
+ return bm.getBeans(name);
+ }
+
+ @Override
+ public Set<Bean<?>> getBeans(Type beanType, Annotation... qualifiers)
+ {
+ return bm.getBeans(beanType, qualifiers);
+ }
+
+ @Override
+ public Context getContext(Class<? extends Annotation> scope)
+ {
+ return bm.getContext(scope);
+ }
+
+ @Override
+ public ELResolver getELResolver()
+ {
+ return bm.getELResolver();
+ }
+
+ @Override
+ public Object getInjectableReference(InjectionPoint injectionPoint, CreationalContext<?> ctx)
+ {
+ return bm.getInjectableReference(injectionPoint, ctx);
+ }
+
+ @Override
+ public Set<Annotation> getInterceptorBindingDefinition(Class<? extends Annotation> qualifier)
+ {
+ return bm.getInterceptorBindingDefinition(qualifier);
+ }
+
+ @Override
+ public Bean<?> getPassivationCapableBean(String id)
+ {
+ return bm.getPassivationCapableBean(id);
+ }
+
+ @Override
+ public Object getReference(Bean<?> bean, Type beanType, CreationalContext<?> ctx)
+ {
+ return bm.getReference(bean, beanType, ctx);
+ }
+
+ @Override
+ public Set<Annotation> getStereotypeDefinition(Class<? extends Annotation> stereotype)
+ {
+ return bm.getStereotypeDefinition(stereotype);
+ }
+
+ @Override
+ public boolean isInterceptorBinding(Class<? extends Annotation> annotationType)
+ {
+ return bm.isInterceptorBinding(annotationType);
+ }
+
+ @Override
+ public boolean isNormalScope(Class<? extends Annotation> annotationType)
+ {
+ return bm.isNormalScope(annotationType);
+ }
+
+ @Override
+ public boolean isPassivatingScope(Class<? extends Annotation> annotationType)
+ {
+ return bm.isPassivatingScope(annotationType);
+ }
+
+ @Override
+ public boolean isQualifier(Class<? extends Annotation> annotationType)
+ {
+ return bm.isQualifier(annotationType);
+ }
+
+ @Override
+ public boolean isScope(Class<? extends Annotation> annotationType)
+ {
+ return bm.isScope(annotationType);
+ }
+
+ @Override
+ public boolean isStereotype(Class<? extends Annotation> annotationType)
+ {
+ return bm.isStereotype(annotationType);
+ }
+
+ @Override
+ public <X> Bean<? extends X> resolve(Set<Bean<? extends X>> beans)
+ {
+ return bm.resolve(beans);
+ }
+
+ @Override
+ public List<Decorator<?>> resolveDecorators(Set<Type> types, Annotation... qualifiers)
+ {
+ return bm.resolveDecorators(types, qualifiers);
+ }
+
+ @Override
+ public List<Interceptor<?>> resolveInterceptors(InterceptionType type, Annotation... interceptorBindings)
+ {
+ return bm.resolveInterceptors(type, interceptorBindings);
+ }
+
+ @Override
+ public <T> Set<ObserverMethod<? super T>> resolveObserverMethods(T event, Annotation... qualifiers)
+ {
+ return bm.resolveObserverMethods(event, qualifiers);
+ }
+
+ @Override
+ public void validate(InjectionPoint injectionPoint)
+ {
+ bm.validate(injectionPoint);
+ }
+
+ @Override
+ public ExpressionFactory wrapExpressionFactory(ExpressionFactory expressionFactory)
+ {
+ return bm.wrapExpressionFactory(expressionFactory);
+ }
+
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ }
+
+ @Override
+ public void readExternal(ObjectInput in) throws IOException,
+ ClassNotFoundException
+ {
+ //static lookup required for bean manager
+ bm = WebBeansContext.currentInstance().getBeanManagerImpl();
+ }
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((bm == null) ? 0 : System.identityHashCode(bm));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (obj == null)
+ {
+ return false;
+ }
+ if (getClass() != obj.getClass())
+ {
+ return false;
+ }
+
+ InjectableBeanManager other = (InjectableBeanManager) obj;
+ if (bm == null)
+ {
+ if (other.bm != null)
+ {
+ return false;
+ }
+ }
+ else if (System.identityHashCode(bm) != (System.identityHashCode(other.bm)))
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
new file mode 100644
index 0000000..13111fb
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
@@ -0,0 +1,812 @@
+/*
+ * 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.webbeans.container;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.GenericArrayType;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.lang.reflect.WildcardType;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.New;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.apache.webbeans.annotation.AnyLiteral;
+import org.apache.webbeans.annotation.DefaultLiteral;
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.component.InjectionTargetBean;
+import org.apache.webbeans.component.OwbBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.exception.inject.DefinitionException;
+import org.apache.webbeans.exception.inject.NullableDependencyException;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.spi.BDABeansXmlScanner;
+import org.apache.webbeans.spi.ScannerService;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.Asserts;
+import org.apache.webbeans.util.ClassUtil;
+import org.apache.webbeans.util.GenericsUtil;
+import org.apache.webbeans.util.InjectionExceptionUtil;
+import org.apache.webbeans.util.WebBeansUtil;
+import static org.apache.webbeans.util.InjectionExceptionUtil.throwAmbiguousResolutionException;
+
+/**
+ * Injection point resolver class.
+ * <p/>
+ * <p>
+ * It is a singleton class per BeanManager. It is
+ * responsible for resolving the bean instances at the injection points for
+ * its bean manager.
+ * </p>
+ *
+ * @version $Rev$ $Date$
+ * @see org.apache.webbeans.config.WebBeansFinder
+ */
+public class InjectionResolver
+{
+ private final static Logger logger = WebBeansLoggerFacade.getLogger(InjectionResolver.class);
+
+ /**
+ * Bean Manager
+ */
+ private WebBeansContext webBeansContext;
+
+ /**
+ * This Map contains all resolved beans via it's type and qualifiers.
+ * If a bean have resolved as not existing, the entry will contain <code>null</code> as value.
+ * The Long key is a hashCode, see {@link BeanCacheKey#BeanCacheKey(boolean, Type, String, Annotation...)}
+ */
+ private Map<BeanCacheKey, Set<Bean<?>>> resolvedBeansByType = new ConcurrentHashMap<BeanCacheKey, Set<Bean<?>>>();
+
+ /**
+ * This Map contains all resolved beans via it's ExpressionLanguage name.
+ */
+ private Map<String, Set<Bean<?>>> resolvedBeansByName = new ConcurrentHashMap<String, Set<Bean<?>>>();
+
+ /**
+ * Creates a new injection resolve for given bean manager.
+ *
+ * @param webBeansContext WebBeansContext
+ */
+ public InjectionResolver(WebBeansContext webBeansContext)
+ {
+ this.webBeansContext = webBeansContext;
+
+ }
+
+ /**
+ * Clear caches.
+ */
+ public void clearCaches()
+ {
+ resolvedBeansByName.clear();
+ resolvedBeansByType.clear();
+ }
+
+ /**
+ * Check the type of the injection point.
+ * <p>
+ * Injection point type can not be {@link java.lang.reflect.TypeVariable}.
+ * </p>
+ *
+ * @param injectionPoint injection point
+ * @throws WebBeansConfigurationException if not obey the rule
+ */
+ public void checkInjectionPointType(InjectionPoint injectionPoint)
+ {
+ Type type = injectionPoint.getType();
+
+ //Check for injection point type variable
+ if (ClassUtil.isTypeVariable(type))
+ {
+ throw new WebBeansConfigurationException("Injection point type : " + injectionPoint + " can not define Type Variable generic type");
+ }
+
+ }
+
+ /**
+ * Check that a valid enabled bean exists in the deployment for the given
+ * injection point definition.
+ *
+ * @param injectionPoint injection point
+ * @throws WebBeansConfigurationException If bean is not available in the current deployment for given injection
+ */
+ public void checkInjectionPoint(InjectionPoint injectionPoint)
+ {
+ WebBeansUtil.checkInjectionPointNamedQualifier(injectionPoint);
+
+ Type type = injectionPoint.getType();
+ Class<?> clazz;
+
+ if (ClassUtil.isTypeVariable(type))
+ {
+ throw new WebBeansConfigurationException("Injection point type : " + injectionPoint + " type can not be defined as Typevariable or Wildcard type!");
+ }
+
+ if (type instanceof ParameterizedType)
+ {
+ ParameterizedType pt = (ParameterizedType) type;
+
+ clazz = (Class<?>) pt.getRawType();
+ }
+ else
+ {
+ clazz = (Class<?>) type;
+ }
+
+ Annotation[] qualifiers = new Annotation[injectionPoint.getQualifiers().size()];
+ qualifiers = injectionPoint.getQualifiers().toArray(qualifiers);
+
+ // OWB-890 some 3rd party InjectionPoints return null in getBean();
+ Class<?> injectionPointClass = Object.class; // the fallback
+ Bean injectionPointBean = injectionPoint.getBean();
+ if (injectionPointBean != null)
+ {
+ injectionPointClass = injectionPointBean.getBeanClass();
+ }
+ if (injectionPointClass == null && type instanceof Class)
+ {
+ injectionPointClass = (Class) type;
+ }
+
+ Set<Bean<?>> beanSet = implResolveByType(injectionPoint.isDelegate(), type, injectionPointClass, qualifiers);
+
+ if (beanSet.isEmpty())
+ {
+ if (qualifiers.length == 1 && qualifiers[0].annotationType().equals(New.class))
+ {
+ createNewBean(injectionPoint, type, qualifiers, beanSet);
+ }
+ }
+
+ Bean<?> bean = resolve(beanSet);
+
+ if (bean == null)
+ {
+ InjectionExceptionUtil.throwUnsatisfiedResolutionException(clazz, injectionPoint, qualifiers);
+ }
+
+
+ if (clazz.isPrimitive())
+ {
+ if (bean.isNullable())
+ {
+ throw new NullableDependencyException("Injection point type : " + injectionPoint +
+ " type is primitive but resolved bean can have nullable objects!");
+ }
+ }
+
+ }
+
+
+ /**
+ * Returns bean for injection point.
+ *
+ * @param injectionPoint injection point declaration
+ * @return bean for injection point
+ */
+ public Bean<?> getInjectionPointBean(InjectionPoint injectionPoint)
+ {
+
+ Type type = injectionPoint.getType();
+ Class<?> clazz;
+
+ if (type instanceof ParameterizedType)
+ {
+ ParameterizedType pt = (ParameterizedType) type;
+ clazz = (Class<?>) pt.getRawType();
+ }
+ else
+ {
+ clazz = (Class<?>) type;
+ }
+
+ Set<Annotation> qualSet = injectionPoint.getQualifiers();
+ Annotation[] qualifiers = qualSet.toArray(new Annotation[qualSet.size()]);
+ if (isInstanceOrEventInjection(type))
+ {
+ qualifiers = AnyLiteral.ARRAY;
+ }
+
+ Set<Bean<?>> beanSet = implResolveByType(injectionPoint.isDelegate(), type, clazz, qualifiers);
+
+ if (beanSet.isEmpty())
+ {
+ if (qualifiers.length == 1 && qualifiers[0].annotationType().equals(New.class))
+ {
+ createNewBean(injectionPoint, type, qualifiers, beanSet);
+ }
+ else
+ {
+ InjectionExceptionUtil.throwUnsatisfiedResolutionException(clazz, injectionPoint, qualifiers);
+ }
+ }
+
+ return resolve(beanSet);
+ }
+
+ private void createNewBean(InjectionPoint injectionPoint, Type type, Annotation[] qualifiers, Set<Bean<?>> beanSet)
+ {
+ New newQualifier = (New) qualifiers[0];
+ Class<?> newType;
+ if (newQualifier.value() == New.class)
+ {
+ newType = ClassUtil.getClass(type);
+ }
+ else
+ {
+ newType = newQualifier.value();
+ }
+ Set<Bean<?>> beans = implResolveByType(injectionPoint.isDelegate(), newType, injectionPoint.getBean().getBeanClass(), AnyLiteral.INSTANCE);
+ if (beans.isEmpty())
+ {
+ beanSet.add(webBeansContext.getWebBeansUtil().createNewComponent(newType));
+ }
+ else
+ {
+ // we just need the bean for the injection points. So when we find an InjectionTargetBean, we can just take it.
+ for (Bean<?> bean: beans)
+ {
+ if (bean instanceof InjectionTargetBean)
+ {
+ beanSet.add(webBeansContext.getWebBeansUtil().createNewComponent((OwbBean)bean, (Class)newType));
+ break;
+ }
+ }
+ if (beanSet.isEmpty())
+ {
+ //Hmm, no InjectionTargetBean available, then we have to create the injection points on our own
+ beanSet.add(webBeansContext.getWebBeansUtil().createNewComponent((Class)newType));
+ }
+ }
+ }
+
+
+ private boolean isInstanceOrEventInjection(Type type)
+ {
+ Class<?> clazz;
+ boolean injectInstanceOrEventProvider = false;
+ if (type instanceof ParameterizedType)
+ {
+ ParameterizedType pt = (ParameterizedType) type;
+ clazz = (Class<?>) pt.getRawType();
+
+ if (clazz.isAssignableFrom(Instance.class) || clazz.isAssignableFrom(Event.class))
+ {
+ injectInstanceOrEventProvider = true;
+ }
+ }
+
+ return injectInstanceOrEventProvider;
+ }
+
+
+ /**
+ * Returns set of beans for given bean name.
+ *
+ * @param name bean name
+ * @return set of beans for given bean name
+ */
+ @SuppressWarnings("unchecked")
+ public Set<Bean<?>> implResolveByName(String name)
+ {
+ Asserts.assertNotNull(name, "name parameter can not be null");
+
+ String cacheKey = name;
+ Set<Bean<?>> resolvedComponents = resolvedBeansByName.get(cacheKey);
+ if (resolvedComponents != null)
+ {
+ return resolvedComponents;
+ }
+
+ resolvedComponents = new HashSet<Bean<?>>();
+ Set<Bean<?>> deployedComponents = webBeansContext.getBeanManagerImpl().getBeans();
+
+ Iterator<Bean<?>> it = deployedComponents.iterator();
+ //Finding all beans with given name
+ while (it.hasNext())
+ {
+ Bean<?> component = it.next();
+ if (component.getName() != null)
+ {
+ if (component.getName().equals(name))
+ {
+ resolvedComponents.add(component);
+ }
+ }
+ }
+
+ //Look for enable/disable
+ resolvedComponents = findByEnabled(resolvedComponents);
+
+ //Still Ambigious, check for specialization
+ if (resolvedComponents.size() > 1)
+ {
+ //Check for specialization
+ Set<Bean<?>> specializedComponents = findSpecializedForNameResolution(resolvedComponents);
+ if (specializedComponents.size() > 0)
+ {
+ resolvedComponents = specializedComponents;
+ }
+ }
+
+ if (resolvedComponents.isEmpty())
+ {
+ // maintain negative cache but use standard empty set so we can garbage collect
+ resolvedBeansByName.put(cacheKey, Collections.EMPTY_SET);
+ }
+ else
+ {
+ resolvedBeansByName.put(cacheKey, resolvedComponents);
+ }
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.log(Level.FINE, "DEBUG_ADD_BYNAME_CACHE_BEANS", cacheKey);
+ }
+
+ return resolvedComponents;
+ }
+
+ private Set<Bean<?>> findByEnabled(Set<Bean<?>> resolvedComponents)
+ {
+ Set<Bean<?>> specializedComponents = new HashSet<Bean<?>>();
+ if (resolvedComponents.size() > 0)
+ {
+ for (Bean<?> bean : resolvedComponents)
+ {
+ AbstractOwbBean<?> component = (AbstractOwbBean<?>) bean;
+
+ if (component.isEnabled())
+ {
+ specializedComponents.add(component);
+ }
+ }
+ }
+
+ return specializedComponents;
+
+ }
+
+
+ /**
+ * Returns filtered set by specialization.
+ *
+ * @param resolvedComponents result beans
+ * @return filtered set by specialization
+ */
+ private Set<Bean<?>> findSpecializedForNameResolution(Set<Bean<?>> resolvedComponents)
+ {
+ Set<Bean<?>> specializedComponents = new HashSet<Bean<?>>();
+ if (resolvedComponents.size() > 0)
+ {
+ for (Bean<?> bean : resolvedComponents)
+ {
+ AbstractOwbBean<?> component = (AbstractOwbBean<?>) bean;
+
+ if (component.isSpecializedBean())
+ {
+ specializedComponents.add(component);
+ }
+ }
+ }
+
+ return specializedComponents;
+ }
+
+ /**
+ * Resolution by type.
+ *
+ * @param isDelegate whether the InjectionPoint is for a {@link javax.decorator.Delegate}
+ * @param injectionPointType injection point api type
+ * @param qualifiers qualifiers of the injection point
+ * @return set of resolved beans
+ */
+ public Set<Bean<?>> implResolveByType(boolean isDelegate, Type injectionPointType, Annotation... qualifiers)
+ {
+ return implResolveByType(isDelegate, injectionPointType, null, qualifiers);
+ }
+
+ private String getBDABeansXMLPath(Class<?> injectionPointBeanClass)
+ {
+ if (injectionPointBeanClass == null)
+ {
+ return null;
+ }
+
+ ScannerService scannerService = webBeansContext.getScannerService();
+ BDABeansXmlScanner beansXMLScanner = scannerService.getBDABeansXmlScanner();
+ return beansXMLScanner.getBeansXml(injectionPointBeanClass);
+ }
+
+ /**
+ * Resolution by type.
+ *
+ * @param isDelegate whether the InjectionPoint is for a {@link javax.decorator.Delegate}
+ * @param injectionPointType injection point api type
+ * @param qualifiers qualifiers of the injection point
+ * @return set of resolved beans
+ */
+ public Set<Bean<?>> implResolveByType(boolean isDelegate, Type injectionPointType,
+ Class<?> injectionPointClass, Annotation... qualifiers)
+ {
+ ScannerService scannerService = webBeansContext.getScannerService();
+ String bdaBeansXMLFilePath = null;
+ if (scannerService.isBDABeansXmlScanningEnabled())
+ {
+ bdaBeansXMLFilePath = getBDABeansXMLPath(injectionPointClass);
+ }
+
+ boolean currentQualifier = false;
+
+ if (isInstanceOrEventInjection(injectionPointType))
+ {
+ qualifiers = AnyLiteral.ARRAY;
+ }
+ else
+ {
+ if (qualifiers.length == 0)
+ {
+ qualifiers = DefaultLiteral.ARRAY;
+ currentQualifier = true;
+ }
+ }
+
+ validateInjectionPointType(injectionPointType);
+
+ BeanCacheKey cacheKey = new BeanCacheKey(isDelegate, injectionPointType, bdaBeansXMLFilePath, qualifiers);
+
+ Set<Bean<?>> resolvedComponents = resolvedBeansByType.get(cacheKey);
+ if (resolvedComponents != null)
+ {
+ return resolvedComponents;
+ }
+
+ resolvedComponents = new HashSet<Bean<?>>();
+
+ boolean returnAll = false;
+
+ if (injectionPointType.equals(Object.class) && currentQualifier)
+ {
+ returnAll = true;
+ }
+
+ for (Bean<?> component : webBeansContext.getBeanManagerImpl().getBeans())
+ {
+ // no need to check instanceof OwbBean as we always wrap in a
+ // ThirdpartyBeanImpl at least
+ if (!((OwbBean) component).isEnabled())
+ {
+ continue;
+ }
+
+ if (returnAll)
+ {
+ resolvedComponents.add(component);
+ }
+ else
+ {
+ for (Type componentApiType : component.getTypes())
+ {
+
+ if (GenericsUtil.satisfiesDependency(isDelegate, injectionPointType, componentApiType))
+ {
+ resolvedComponents.add(component);
+ break;
+ }
+ }
+ }
+ }
+
+ // Look for qualifiers
+ resolvedComponents = findByQualifier(resolvedComponents, injectionPointType, qualifiers);
+
+ // Ambigious resolution, check for specialization
+ /*
+ // super beans are deactivated so it is useless
+ if (resolvedComponents.size() > 1)
+ {
+ //Look for specialization
+ resolvedComponents = findBySpecialization(resolvedComponents);
+ }
+ */
+
+ resolvedBeansByType.put(cacheKey, resolvedComponents);
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.log(Level.FINE, "DEBUG_ADD_BYTYPE_CACHE_BEANS", cacheKey);
+ }
+
+ return resolvedComponents;
+ }
+
+
+ /**
+ * Verify that we have a legal Type at the injection point.
+ * CDI can basically only handle Class and ParameterizedType injection points atm.
+ * @throws DefinitionException on TypeVariable, WildcardType and GenericArrayType
+ * @throws IllegalArgumentException if the type is not yet supported by the spec.
+ */
+ private void validateInjectionPointType(Type injectionPointType)
+ {
+ if (injectionPointType instanceof TypeVariable || injectionPointType instanceof WildcardType || injectionPointType instanceof GenericArrayType)
+ {
+ throw new DefinitionException("Injection point cannot define Type Variable " + injectionPointType);
+ }
+
+ if (!(injectionPointType instanceof Class) &&
+ !(injectionPointType instanceof ParameterizedType))
+ {
+ throw new IllegalArgumentException("Unsupported type " + injectionPointType.getClass());
+ }
+ }
+
+ /**
+ * Returns specialized beans if exists, otherwise return input result
+ *
+ * @param result result beans
+ * @return specialized beans if exists, otherwise return input result
+ */
+ public Set<Bean<?>> findBySpecialization(Set<Bean<?>> result)
+ {
+ Iterator<Bean<?>> it = result.iterator();
+ Set<Bean<?>> res = new HashSet<Bean<?>>();
+
+ while (it.hasNext())
+ {
+ AbstractOwbBean<?> component = (AbstractOwbBean<?>) it.next();
+ if (component.isSpecializedBean() && component.isEnabled())
+ {
+ res.add(component);
+ }
+ }
+
+ if (res.size() > 0)
+ {
+ return res;
+ }
+
+ return result;
+ }
+
+ /**
+ * Gets alternatives from set.
+ *
+ * @param result resolved set
+ * @return containes alternatives
+ */
+ public Set<Bean<?>> findByAlternatives(Set<Bean<?>> result)
+ {
+ return findByAlternatives(result, null);
+ }
+
+ /**
+ * Gets alternatives from set.
+ *
+ * @param result resolved set
+ * @return containes alternatives
+ */
+ public Set<Bean<?>> findByAlternatives(Set<Bean<?>> result, String bdaBeansXMLFilePath)
+ {
+ Set<Bean<?>> alternativeSet = new HashSet<Bean<?>>();
+ Set<Bean<?>> enableSet = new HashSet<Bean<?>>();
+ boolean containsAlternative = false;
+
+ if (bdaBeansXMLFilePath != null)
+ {
+ // per BDA beans.xml
+ for (Bean<?> bean : result)
+ {
+ if (bean.isAlternative())
+ {
+ if (isAltBeanInInjectionPointBDA(bdaBeansXMLFilePath, bean))
+ {
+ if (!containsAlternative)
+ {
+ containsAlternative = true;
+ }
+ alternativeSet.add(bean);
+ }
+ }
+ else
+ {
+ if (!containsAlternative)
+ {
+ // Do not check isEnabled flag to allow beans to be
+ // added on a per BDA basis when a bean is disabled due
+ // to specialize alternative defined in a different BDA
+ enableSet.add(bean);
+ }
+ }
+ }
+ }
+ else
+ {
+ for (Bean<?> bean : result)
+ {
+ if (bean.isAlternative())
+ {
+ if (!containsAlternative)
+ {
+ containsAlternative = true;
+ }
+ alternativeSet.add(bean);
+ }
+ else
+ {
+ if (!containsAlternative)
+ {
+ AbstractOwbBean<?> temp = (AbstractOwbBean<?>) bean;
+ if (temp.isEnabled())
+ {
+ enableSet.add(bean);
+ }
+ }
+ }
+ }
+ }
+
+ if (containsAlternative)
+ {
+ return alternativeSet;
+ }
+
+ return enableSet;
+ }
+
+ public <X> Bean<? extends X> resolve(Set<Bean<? extends X>> beans)
+ {
+ Set set = resolveAll(beans);
+
+ if (set.isEmpty())
+ {
+ return null;
+ }
+
+ if(set.size() > 1)
+ {
+ set = findBySpecialization(set);
+ if(set.size() > 1)
+ {
+ throwAmbiguousResolutionException(set);
+ }
+ }
+
+ return (Bean<? extends X>)set.iterator().next();
+ }
+
+ public <X> Set<Bean<? extends X>> resolveAll(Set<Bean<? extends X>> beans)
+ {
+ if (beans == null || beans.isEmpty())
+ {
+ return Collections.emptySet();
+ }
+
+ Set set = new HashSet<Bean<Object>>();
+ for(Bean<? extends X> obj : beans)
+ {
+ set.add(obj);
+ }
+
+ set = findByAlternatives(set);
+
+ if (set == null || set.isEmpty())
+ {
+ return Collections.emptySet();
+ }
+
+ /*
+ // specialized bean are disabled so no need to refilter
+ if(set.size() > 1)
+ {
+ set = findBySpecialization(set);
+ }
+ */
+
+ return set;
+ }
+
+ private boolean isAltBeanInInjectionPointBDA(String bdaBeansXMLFilePath, Bean<?> altBean)
+ {
+
+ ScannerService scannerService = webBeansContext.getScannerService();
+ BDABeansXmlScanner beansXMLScanner = scannerService.getBDABeansXmlScanner();
+
+ Set<Class<?>> definedAlternatives = beansXMLScanner.getAlternatives(bdaBeansXMLFilePath);
+
+ if (definedAlternatives.contains(altBean.getBeanClass()))
+ {
+ return true;
+ }
+
+ Set<Class<? extends Annotation>> definedStereotypes = beansXMLScanner.getStereotypes(bdaBeansXMLFilePath);
+
+ for (Class<? extends Annotation> stereoAnnotations : definedStereotypes)
+ {
+ if (AnnotationUtil.hasClassAnnotation(altBean.getBeanClass(), stereoAnnotations))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+
+ /**
+ * Returns filtered bean set according to the qualifiers.
+ *
+ * @param remainingSet bean set for filtering by qualifier
+ * @param annotations qualifiers on injection point
+ * @return filtered bean set according to the qualifiers
+ */
+ private Set<Bean<?>> findByQualifier(Set<Bean<?>> remainingSet, Type type, Annotation... annotations)
+ {
+ Iterator<Bean<?>> it = remainingSet.iterator();
+ Set<Bean<?>> result = new HashSet<Bean<?>>();
+
+ while (it.hasNext())
+ {
+ Bean<?> component = it.next();
+ Set<Annotation> qTypes = component.getQualifiers();
+
+ int i = 0;
+ for (Annotation annot : annotations)
+ {
+ Iterator<Annotation> itQualifiers = qTypes.iterator();
+ while (itQualifiers.hasNext())
+ {
+ Annotation qualifier = itQualifiers.next();
+ if (annot.annotationType().equals(qualifier.annotationType()))
+ {
+ if (AnnotationUtil.isCdiAnnotationEqual(qualifier, annot))
+ {
+ i++;
+ }
+ }
+
+ }
+ }
+
+ if (i == annotations.length)
+ {
+ result.add(component);
+ }
+ }
+
+ if (result.isEmpty() && annotations.length == 1 && New.class.equals(annotations[0].annotationType()) && Class.class.isInstance(type))
+ { // happen in TCKs, shouldn't be the case in real apps
+ result.add(webBeansContext.getWebBeansUtil().createNewComponent(Class.class.cast(type)));
+ }
+
+ return result;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionTargetFactoryImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionTargetFactoryImpl.java
new file mode 100644
index 0000000..90b18ac
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionTargetFactoryImpl.java
@@ -0,0 +1,93 @@
+/*
+ * 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.webbeans.container;
+
+import org.apache.webbeans.component.spi.InjectionTargetFactory;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.portable.InjectionTargetImpl;
+import org.apache.webbeans.util.Asserts;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.InjectionTarget;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public class InjectionTargetFactoryImpl<T> implements InjectionTargetFactory<T>
+{
+
+ private AnnotatedType<T> annotatedType;
+ private WebBeansContext webBeansContext;
+
+ public InjectionTargetFactoryImpl(AnnotatedType<T> annotatedType, WebBeansContext webBeansContext)
+ {
+ Asserts.assertNotNull(annotatedType, "AnnotatedType may not be null");
+ Asserts.assertNotNull(webBeansContext, "WebBeansContext may not be null");
+ this.annotatedType = annotatedType;
+ this.webBeansContext = webBeansContext;
+ }
+
+ public InjectionTarget<T> createInjectionTarget()
+ {
+ return createInjectionTarget(null);
+ }
+
+ @Override
+ public InjectionTarget<T> createInjectionTarget(Bean<T> bean)
+ {
+ final InjectionTargetImpl<T> injectionTarget
+ = new InjectionTargetImpl<T>(annotatedType, createInjectionPoints(bean), webBeansContext, getPostConstructMethods(), getPreDestroyMethods());
+ return webBeansContext.getWebBeansUtil().fireProcessInjectionTargetEvent(injectionTarget, annotatedType).getInjectionTarget();
+ }
+
+ protected Set<InjectionPoint> createInjectionPoints(Bean<T> bean)
+ {
+ Set<InjectionPoint> injectionPoints = new HashSet<InjectionPoint>();
+ for (InjectionPoint injectionPoint: webBeansContext.getInjectionPointFactory().buildInjectionPoints(bean, annotatedType))
+ {
+ injectionPoints.add(injectionPoint);
+ }
+ return injectionPoints;
+ }
+
+ protected AnnotatedType<T> getAnnotatedType()
+ {
+ return annotatedType;
+ }
+
+ protected WebBeansContext getWebBeansContext()
+ {
+ return webBeansContext;
+ }
+
+ protected List<AnnotatedMethod<?>> getPostConstructMethods()
+ {
+ return webBeansContext.getInterceptorUtil().getLifecycleMethods(annotatedType, PostConstruct.class, true);
+ }
+
+ protected List<AnnotatedMethod<?>> getPreDestroyMethods()
+ {
+ return webBeansContext.getInterceptorUtil().getLifecycleMethods(annotatedType, PreDestroy.class, false);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/InterceptorInjectionTargetFactory.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/InterceptorInjectionTargetFactory.java
new file mode 100644
index 0000000..a63ed4a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/InterceptorInjectionTargetFactory.java
@@ -0,0 +1,48 @@
+/*
+ * 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.webbeans.container;
+
+import java.util.Collections;
+import java.util.List;
+
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedType;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+public class InterceptorInjectionTargetFactory<T> extends InjectionTargetFactoryImpl<T>
+{
+
+ public InterceptorInjectionTargetFactory(AnnotatedType<T> annotatedType, WebBeansContext webBeansContext)
+ {
+ super(annotatedType, webBeansContext);
+ }
+
+ @Override
+ protected List<AnnotatedMethod<?>> getPostConstructMethods()
+ {
+ return Collections.<AnnotatedMethod<?>>emptyList();
+ }
+
+ @Override
+ protected List<AnnotatedMethod<?>> getPreDestroyMethods()
+ {
+ return Collections.<AnnotatedMethod<?>>emptyList();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerObjectFactory.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerObjectFactory.java
new file mode 100644
index 0000000..4a563dd
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerObjectFactory.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.container;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.spi.ObjectFactory;
+import org.apache.webbeans.config.WebBeansContext;
+
+public class ManagerObjectFactory implements ObjectFactory
+{
+
+ @Override
+ public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment)
+ {
+ return new InjectableBeanManager(WebBeansContext.getInstance().getBeanManagerImpl());
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/SerializableBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/SerializableBean.java
new file mode 100644
index 0000000..ee2d308
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/SerializableBean.java
@@ -0,0 +1,202 @@
+/*
+ * 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.webbeans.container;
+
+import org.apache.webbeans.component.OwbBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.inject.DeploymentException;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.PassivationCapable;
+import java.io.*;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+
+/**
+ * Wrapper to make all our Beans serializable.
+ * This is basically a delegate to an underlying Bean<T>.
+ *
+ * We use the {@link PassivationCapable#getId()} and
+ * {@link javax.enterprise.inject.spi.BeanManager#getPassivationCapableBean(String)}
+ * for serialisation and deserialisation.
+ *
+ * @version $Rev$ $Date$
+ */
+public final class SerializableBean<T> implements Bean<T>, PassivationCapable, Serializable
+{
+
+ private static final long serialVersionUID = -8141263188006177021L;
+
+ /** the delegated bean */
+ private Bean<T> bean;
+
+
+ /**
+ * @return the delegated internal Bean.
+ */
+ public Bean<T> getBean()
+ {
+ return bean;
+ }
+
+ /**
+ * This constructor shall not be invoked directly, but only get called
+ * from {@link org.apache.webbeans.container.SerializableBeanVault}
+ * @param bean the PassivationCapable bean which should be made Serializable
+ */
+ SerializableBean(Bean<T> bean)
+ {
+ this.bean = bean;
+ }
+
+ @Override
+ public Set<Type> getTypes()
+ {
+ return bean.getTypes();
+ }
+
+ @Override
+ public Set<Annotation> getQualifiers()
+ {
+ return bean.getQualifiers();
+ }
+
+ @Override
+ public Class<? extends Annotation> getScope()
+ {
+ return bean.getScope();
+ }
+
+ @Override
+ public String getName()
+ {
+ return bean.getName();
+ }
+
+ @Override
+ public boolean isNullable()
+ {
+ return bean.isNullable();
+ }
+
+ @Override
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ return bean.getInjectionPoints();
+ }
+
+ @Override
+ public Class<?> getBeanClass()
+ {
+ return bean.getBeanClass();
+ }
+
+ @Override
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return bean.getStereotypes();
+ }
+
+ @Override
+ public boolean isAlternative()
+ {
+ return bean.isAlternative();
+ }
+
+ @Override
+ public T create(CreationalContext<T> tCreationalContext)
+ {
+ return bean.create(tCreationalContext);
+ }
+
+ @Override
+ public void destroy(T instance, CreationalContext<T> tCreationalContext)
+ {
+ bean.destroy(instance, tCreationalContext);
+ }
+
+ @Override
+ public String getId()
+ {
+ return ((OwbBean<?>) bean).getId();
+ }
+
+ private void writeObject(ObjectOutputStream s)
+ throws IOException
+ {
+ String id = getId();
+ if (id == null)
+ {
+ throw new NotSerializableException();
+ }
+
+ s.writeObject(id);
+ }
+
+
+ @SuppressWarnings("unchecked")
+ private void readObject(ObjectInputStream s)
+ throws IOException, ClassNotFoundException
+ {
+ String id = (String) s.readObject();
+ Bean<T> b = (Bean<T>) WebBeansContext.currentInstance().getBeanManagerImpl().getPassivationCapableBean(id);
+ if (b == null)
+ {
+ throw new DeploymentException("cannot deserialize Bean with PassivationCapable id=" + id);
+ }
+ if (b instanceof SerializableBean)
+ {
+ b = ((SerializableBean<T>)b).getBean();
+ }
+
+ bean = b;
+ }
+
+ /**
+ * If the other object is a SerializableBean too, we compare the 2 underlying wrapped beans.
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean equals(Object other)
+ {
+ if (other instanceof SerializableBean<?>)
+ {
+ return bean.equals(((SerializableBean<?>)other).getBean());
+ }
+
+ return super.equals(other);
+ }
+
+ /**
+ * We need to return the hashCode of the wrapped underlying bean, otherwise the context
+ * won't work.
+ * @return hashCode of the underlying bean instance.
+ */
+ @Override
+ public int hashCode()
+ {
+ return bean.hashCode();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/SerializableBeanVault.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/SerializableBeanVault.java
new file mode 100644
index 0000000..f89b7eb
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/SerializableBeanVault.java
@@ -0,0 +1,74 @@
+/*
+ * 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.webbeans.container;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.inject.spi.Bean;
+
+import org.apache.webbeans.util.WebBeansUtil;
+
+/**
+ * <p>This class acts as a storage for {@link SerializableBean}s.</p>
+ *
+ * <h3>The Background:</h3>
+ * <p>Any Contextual<T> which holds it's information on a storage which may get serialized,
+ * like e.g. the SessionContext, the ConversationContext or any 3-rd party Context
+ * for a NormalScoped(passivating=true) and therefore PassivationCapable Scope needs to be Serializable.</p>
+ * <p>Normal {@link Bean}s are not serializable because they contain non transportable information. But each
+ * {@link javax.enterprise.inject.spi.PassivationCapable} {@link Bean} is uniquely
+ * identifyable via it's id and can be restored by
+ * {@link javax.enterprise.inject.spi.BeanManager#getPassivationCapableBean(String)}.</p>
+ * <p>Since a custom Context implementation doesn't know when it gets passivated (for a Http Session
+ * this is pretty seldom), the Contextual<T> handed over to the Context implementation must be
+ * Serializable.</p>
+ */
+public class SerializableBeanVault
+{
+
+ private Map<String, SerializableBean<?>> serializableBeans = new ConcurrentHashMap<String, SerializableBean<?>>();
+
+ @SuppressWarnings("unchecked")
+ public <T> Contextual<T> getSerializableBean(Contextual<T> bean)
+ {
+ if (bean instanceof SerializableBean)
+ {
+ // we don't like to wrap SerializedBeans in itself!
+ return bean;
+ }
+
+ String id = WebBeansUtil.getPassivationId(bean);
+
+ if(id != null)
+ {
+ SerializableBean<T> sb = (SerializableBean<T>) serializableBeans.get(id);
+ if (sb == null)
+ {
+ sb = new SerializableBean<T>((Bean<T>) bean);
+ serializableBeans.put(id, sb);
+ }
+
+ return sb;
+ }
+
+ return null;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/AbstractContext.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/AbstractContext.java
new file mode 100644
index 0000000..e3c0aeb
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/AbstractContext.java
@@ -0,0 +1,322 @@
+/*
+ * 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.webbeans.context;
+
+import java.io.*;
+import java.lang.annotation.Annotation;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+import java.util.concurrent.ConcurrentMap;
+
+import javax.enterprise.context.ContextNotActiveException;
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+
+import org.apache.webbeans.container.SerializableBean;
+import org.apache.webbeans.container.SerializableBeanVault;
+import org.apache.webbeans.context.creational.BeanInstanceBag;
+
+/**
+ * Abstract implementation of the {@link Context} interfaces.
+ *
+ * @see javax.enterprise.context.spi.Context
+ * @see RequestContext
+ * @see DependentContext
+ * @see SessionContext
+ * @see ApplicationContext
+ * @see ConversationContext
+ */
+public abstract class AbstractContext implements Context, Serializable
+{
+ private static final long serialVersionUID = 2357678967444477818L;
+ /**Context status, active or not*/
+ protected volatile boolean active;
+
+
+ /**Context contextual instances*/
+ protected Map<Contextual<?>, BeanInstanceBag<?>> componentInstanceMap = null;
+
+ /**Contextual Scope Type*/
+ protected Class<? extends Annotation> scopeType;
+
+
+
+
+
+ @SuppressWarnings("unchecked")
+ private <T> void createContextualBag(Contextual<T> contextual, CreationalContext<T> creationalContext)
+ {
+ BeanInstanceBag<T> bag = new BeanInstanceBag<T>(creationalContext);
+
+ if(componentInstanceMap instanceof ConcurrentMap)
+ {
+ T exist = (T) ((ConcurrentMap) componentInstanceMap).putIfAbsent(contextual, bag);
+ //no instance
+ if(exist == null)
+ {
+ componentInstanceMap.put(contextual, bag);
+ }
+ }
+ else
+ {
+ componentInstanceMap.put(contextual, bag);
+ }
+ }
+
+ /**
+ * Creates a new context with given scope type.
+ *
+ * @param scopeType context scope type
+ */
+ protected AbstractContext(Class<? extends Annotation> scopeType)
+ {
+ this.scopeType = scopeType;
+ setComponentInstanceMap();
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T> T get(Contextual<T> component)
+ {
+ checkActive();
+
+ BeanInstanceBag bag = componentInstanceMap.get(component);
+
+ if(bag != null)
+ {
+ return (T) bag.getBeanInstance();
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext)
+ {
+ checkActive();
+
+ return getInstance(contextual, creationalContext);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ protected <T> T getInstance(Contextual<T> contextual, CreationalContext<T> creationalContext)
+ {
+ T instance;
+
+ //Look for bag
+ BeanInstanceBag<T> bag = (BeanInstanceBag<T>)componentInstanceMap.get(contextual);
+ if(bag == null)
+ {
+ createContextualBag(contextual, creationalContext);
+ bag = (BeanInstanceBag<T>)componentInstanceMap.get(contextual);
+ }
+
+ //Look for instance
+ instance = bag.getBeanInstance();
+ if (instance != null)
+ {
+ return instance;
+ }
+
+ else
+ {
+ if(creationalContext == null)
+ {
+ return null;
+ }
+
+ else
+ {
+ instance = bag.create(contextual);
+ }
+ }
+
+ return instance;
+ }
+
+ /**
+ * Destroy the given web beans component instance.
+ *
+ * @param <T>
+ * @param component web beans component
+ * @param instance component instance
+ */
+ private <T> void destroyInstance(Contextual<T> component, T instance,CreationalContext<T> creationalContext)
+ {
+ //Destroy component
+ component.destroy(instance,creationalContext);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ public void destroy()
+ {
+ Set<Entry<Contextual<?>, BeanInstanceBag<?>>> entrySet = componentInstanceMap.entrySet();
+ Iterator<Entry<Contextual<?>, BeanInstanceBag<?>>> it = entrySet.iterator();
+
+ Contextual<?> contextual;
+ while (it.hasNext())
+ {
+ contextual = it.next().getKey();
+
+ BeanInstanceBag<?> instance = componentInstanceMap.get(contextual);
+ //Get creational context
+ CreationalContext<Object> cc = (CreationalContext<Object>)instance.getBeanCreationalContext();
+
+ //Destroy instance
+ final Object beanInstance = instance.getBeanInstance();
+ if (beanInstance != null)
+ {
+ destroyInstance((Contextual<Object>) contextual, beanInstance, cc);
+ }
+ }
+
+ //Clear context map
+ componentInstanceMap.clear();
+ setActive(false);
+ }
+
+ /**
+ * Gets context active flag.
+ *
+ * @return active flag
+ */
+ @Override
+ public boolean isActive()
+ {
+ return active;
+ }
+
+ /**
+ * Set component active flag.
+ *
+ * @param active active flag
+ */
+ public void setActive(boolean active)
+ {
+ this.active = active;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Class<? extends Annotation> getScope()
+ {
+
+ return scopeType;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected abstract void setComponentInstanceMap();
+
+ /**
+ * Check that context is active or throws exception.
+ */
+ protected void checkActive()
+ {
+ if (!active)
+ {
+ throw new ContextNotActiveException("WebBeans context with scope annotation @" + getScope().getName() + " is not active with respect to the current thread");
+ }
+ }
+
+ /**
+ * Write Object.
+ */
+ private void writeObject(ObjectOutputStream s)
+ throws IOException
+ {
+ s.writeObject(scopeType);
+
+ // we need to repack the Contextual<T> from the componentInstanceMap into Serializable ones
+ if (componentInstanceMap != null)
+ {
+ SerializableBeanVault sbv = org.apache.webbeans.config.WebBeansContext.getInstance().getSerializableBeanVault();
+
+ Map<Contextual<?>, BeanInstanceBag<?>> serializableInstanceMap =
+ new HashMap<Contextual<?>, BeanInstanceBag<?>>();
+
+ for (Map.Entry<Contextual<?>, BeanInstanceBag<?>> componentInstanceMapEntry : componentInstanceMap.entrySet())
+ {
+ serializableInstanceMap.put(sbv.getSerializableBean(componentInstanceMapEntry.getKey()),
+ componentInstanceMapEntry.getValue());
+ }
+
+ s.writeObject(serializableInstanceMap);
+ }
+ else
+ {
+ s.writeObject(null);
+ }
+
+ }
+
+ /**
+ * Read object.
+ */
+ private void readObject(ObjectInputStream s)
+ throws IOException, ClassNotFoundException
+ {
+ scopeType = (Class<? extends Annotation>) s.readObject();
+
+ HashMap<Contextual<?>, BeanInstanceBag<?>> serializableInstanceMap =
+ (HashMap<Contextual<?>, BeanInstanceBag<?>>) s.readObject();
+
+ if (serializableInstanceMap != null)
+ {
+ setComponentInstanceMap();
+ if (componentInstanceMap == null)
+ {
+ throw new NotSerializableException("componentInstanceMap not initialized!");
+ }
+
+ for (Map.Entry<Contextual<?>, BeanInstanceBag<?>> serializableInstanceMapEntry : serializableInstanceMap.entrySet())
+ {
+ Contextual<?> bean = serializableInstanceMapEntry.getKey();
+ if (bean instanceof SerializableBean)
+ {
+ componentInstanceMap.put(((SerializableBean<?>)bean).getBean(), serializableInstanceMapEntry.getValue());
+ }
+ else
+ {
+ componentInstanceMap.put(bean, serializableInstanceMapEntry.getValue());
+ }
+ }
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/AbstractContextsService.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/AbstractContextsService.java
new file mode 100644
index 0000000..85c35ce
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/AbstractContextsService.java
@@ -0,0 +1,94 @@
+/*
+ * 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.webbeans.context;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.context.ContextException;
+import javax.enterprise.context.spi.Context;
+
+import org.apache.webbeans.spi.ContextsService;
+
+public abstract class AbstractContextsService implements ContextsService
+{
+
+ @Override
+ public void destroy(Object destroyObject)
+ {
+ //Default no-op
+ }
+
+ @Override
+ public void endContext(Class<? extends Annotation> scopeType, Object endParameters)
+ {
+ //Default no-op
+ }
+
+ @Override
+ public Context getCurrentContext(Class<? extends Annotation> scopeType)
+ {
+
+ return null;
+ }
+
+ @Override
+ public void init(Object initializeObject)
+ {
+ //Default no-op
+ }
+
+ @Override
+ public void startContext(Class<? extends Annotation> scopeType, Object startParameter) throws ContextException
+ {
+ //Default no-op
+ }
+
+ @Override
+ public boolean supportsContext(Class<? extends Annotation> scopeType)
+ {
+ return false;
+ }
+
+ @Override
+ public void activateContext(Class<? extends Annotation> scopeType)
+ {
+ if(supportsContext(scopeType))
+ {
+ Context context = getCurrentContext(scopeType);
+ if(context instanceof AbstractContext)
+ {
+ ((AbstractContext)context).setActive(true);
+ }
+ }
+ }
+
+ @Override
+ public void deActivateContext(Class<? extends Annotation> scopeType)
+ {
+ if(supportsContext(scopeType))
+ {
+ Context context = getCurrentContext(scopeType);
+ if(context instanceof AbstractContext)
+ {
+ ((AbstractContext)context).setActive(false);
+ }
+ }
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/ApplicationContext.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/ApplicationContext.java
new file mode 100644
index 0000000..ab7caff
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/ApplicationContext.java
@@ -0,0 +1,48 @@
+/*
+ * 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.webbeans.context;
+
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.spi.Contextual;
+
+import org.apache.webbeans.context.creational.BeanInstanceBag;
+
+/**
+ * Application context implementation.
+ *
+ */
+public class ApplicationContext extends AbstractContext
+{
+ private static final long serialVersionUID = -8254441824647652312L;
+
+ public ApplicationContext()
+ {
+ super(ApplicationScoped.class);
+ }
+
+ @Override
+ public void setComponentInstanceMap()
+ {
+ componentInstanceMap = new ConcurrentHashMap<Contextual<?>, BeanInstanceBag<?>>();
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java
new file mode 100644
index 0000000..8a5df84
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java
@@ -0,0 +1,189 @@
+/*
+ * 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.webbeans.context;
+
+import java.lang.annotation.Annotation;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.context.spi.Context;
+import javax.inject.Singleton;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.spi.ContextsService;
+import org.apache.webbeans.config.WebBeansContext;
+
+/**
+ * JSR-299 based standard context
+ * related operations.
+ * @deprecated user should use the ContextsService directly.
+ */
+public final class ContextFactory
+{
+ /**Logger instance*/
+ private static final Logger logger = WebBeansLoggerFacade.getLogger(ContextFactory.class);
+ private final WebBeansContext webBeansContext;
+
+ private ContextsService contextsService = null;
+
+ public ContextFactory(WebBeansContext webBeansContext)
+ {
+ this.webBeansContext = webBeansContext;
+ }
+
+ /**
+ * @return the ContextService for the current ClassLoader
+ */
+ private ContextsService getContextsService()
+ {
+ if (contextsService == null)
+ {
+ contextsService = webBeansContext.getService(ContextsService.class);
+ }
+ return contextsService;
+ }
+
+ public void initRequestContext(Object request)
+ {
+ try
+ {
+ ContextsService contextService = getContextsService();
+ contextService.startContext(RequestScoped.class, request);
+ }
+ catch (Exception e)
+ {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
+ }
+
+ public Context getCustomContext(Context context)
+ {
+ if (webBeansContext.getBeanManagerImpl().isPassivatingScope(context.getScope()))
+ {
+ return new CustomPassivatingContextImpl(webBeansContext.getSerializableBeanVault(), context);
+ }
+
+ return context;
+ }
+
+ public void destroyRequestContext(Object request)
+ {
+ ContextsService contextService = getContextsService();
+ contextService.endContext(RequestScoped.class, request);
+ }
+
+ public void initSessionContext(Object session)
+ {
+ try
+ {
+ ContextsService contextService = getContextsService();
+ contextService.startContext(SessionScoped.class, session);
+ }
+ catch (Exception e)
+ {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
+ }
+
+ public void destroySessionContext(Object session)
+ {
+ ContextsService contextService = getContextsService();
+ contextService.endContext(SessionScoped.class, session);
+ }
+
+ public void initApplicationContext(Object parameter)
+ {
+ try
+ {
+ ContextsService contextService = getContextsService();
+ contextService.startContext(ApplicationScoped.class, parameter);
+ }
+ catch (Exception e)
+ {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Destroys the application context and all of its components at the end of
+ * the application.
+ *
+ * @param parameter parameter object
+ */
+ public void destroyApplicationContext(Object parameter)
+ {
+ ContextsService contextService = getContextsService();
+ contextService.endContext(ApplicationScoped.class, parameter);
+ }
+
+ public void initSingletonContext(Object parameter)
+ {
+ try
+ {
+ ContextsService contextService = getContextsService();
+ contextService.startContext(Singleton.class, parameter);
+ }
+ catch (Exception e)
+ {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
+ }
+
+ public void destroySingletonContext(Object parameter)
+ {
+ ContextsService contextService = getContextsService();
+ contextService.endContext(Singleton.class, parameter);
+ }
+
+ public void initConversationContext(Object context)
+ {
+ try
+ {
+ ContextsService contextService = getContextsService();
+ contextService.startContext(ConversationScoped.class, context);
+ }
+ catch (Exception e)
+ {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
+ }
+
+ public void destroyConversationContext()
+ {
+ ContextsService contextService = getContextsService();
+ contextService.endContext(ConversationScoped.class, null);
+ }
+
+ /**
+ * Gets the standard context with given scope type.
+ *
+ * @return the current context, or <code>null</code> if no standard context exists for the given scopeType
+ */
+ public Context getStandardContext(Class<? extends Annotation> scopeType)
+ {
+ ContextsService contextService = getContextsService();
+
+ return contextService.getCurrentContext(scopeType);
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/ConversationContext.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/ConversationContext.java
new file mode 100644
index 0000000..831e538
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/ConversationContext.java
@@ -0,0 +1,101 @@
+/*
+ * 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.webbeans.context;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.NotSerializableException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.lang.annotation.Annotation;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.context.spi.Contextual;
+
+import org.apache.webbeans.context.creational.BeanInstanceBag;
+import org.apache.webbeans.util.WebBeansUtil;
+
+/**
+ * Conversation context implementation.
+ */
+public class ConversationContext extends AbstractContext implements Externalizable
+{
+ private static final long serialVersionUID = -576054696008715282L;
+
+ /*
+ * Constructor
+ */
+ public ConversationContext()
+ {
+ super(ConversationScoped.class);
+ }
+
+ @Override
+ public void setComponentInstanceMap()
+ {
+ componentInstanceMap = new ConcurrentHashMap<Contextual<?>, BeanInstanceBag<?>>();
+ }
+
+ @Override
+ public void readExternal(ObjectInput in) throws IOException,
+ ClassNotFoundException
+ {
+ scopeType = (Class<? extends Annotation>) in.readObject();
+ Map<String, BeanInstanceBag<?>> map = (Map<String, BeanInstanceBag<?>>)in.readObject();
+ setComponentInstanceMap();
+ Iterator<String> it = map.keySet().iterator();
+ Contextual<?> contextual = null;
+ while(it.hasNext())
+ {
+ String id = it.next();
+ if (id != null)
+ {
+ contextual = org.apache.webbeans.config.WebBeansContext.currentInstance().getBeanManagerImpl().getPassivationCapableBean(id);
+ }
+ if (contextual != null)
+ {
+ componentInstanceMap.put(contextual, map.get(id));
+ }
+ }
+ }
+
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ out.writeObject(scopeType);
+ Iterator<Contextual<?>> it = componentInstanceMap.keySet().iterator();
+ Map<String, BeanInstanceBag<?>> map = new HashMap<String, BeanInstanceBag<?>>();
+ while(it.hasNext())
+ {
+ Contextual<?>contextual = it.next();
+ String id = WebBeansUtil.getPassivationId(contextual);
+ if (id == null)
+ {
+ throw new NotSerializableException("cannot serialize " + contextual.toString());
+ }
+ map.put(id, componentInstanceMap.get(contextual));
+ }
+ out.writeObject(map);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/CustomPassivatingContextImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/CustomPassivatingContextImpl.java
new file mode 100644
index 0000000..b850539
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/CustomPassivatingContextImpl.java
@@ -0,0 +1,66 @@
+/*
+ * 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.webbeans.context;
+
+import org.apache.webbeans.container.SerializableBeanVault;
+
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+import java.lang.annotation.Annotation;
+
+/**
+ *
+ */
+public class CustomPassivatingContextImpl implements Context
+{
+ private final SerializableBeanVault sbv;
+ private final Context context;
+
+
+ CustomPassivatingContextImpl(SerializableBeanVault sbv, Context context)
+ {
+ this.sbv = sbv;
+ this.context = context;
+ }
+
+ @Override
+ public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext)
+ {
+ return context.get(sbv.getSerializableBean(contextual), creationalContext);
+ }
+
+ @Override
+ public <T> T get(Contextual<T> contextual)
+ {
+ return context.get(sbv.getSerializableBean(contextual));
+ }
+
+ @Override
+ public Class<? extends Annotation> getScope()
+ {
+ return context.getScope();
+ }
+
+ @Override
+ public boolean isActive()
+ {
+ return context.isActive();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/DependentContext.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/DependentContext.java
new file mode 100644
index 0000000..4536ddd
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/DependentContext.java
@@ -0,0 +1,92 @@
+/*
+ * 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.webbeans.context;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+
+/**
+ * Defines the component {@link javax.enterprise.context.Dependent} context.
+ * <p>
+ * Each web beans component has a dependent context, that saves its dependent
+ * objects. Dependent context is destroyed at the end of the component
+ * destruction or its dependent objects are destroyed by the container at any
+ * time that the dependent object is no longer alive.
+ * </p>
+ *
+ * <p>
+ * Dependent context is always active.
+ * </p>
+ *
+ * @version $Rev$ $Date$
+ */
+public class DependentContext extends AbstractContext
+{
+ private static final long serialVersionUID = 8225241216057316441L;
+
+ /**
+ * Creats a new instance of dependent context.
+ */
+ public DependentContext()
+ {
+ super(Dependent.class);
+ active = true;
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ *
+ */
+ @Override
+ protected <T> T getInstance(Contextual<T> component,CreationalContext<T> creationalContext)
+ {
+ if(creationalContext == null)
+ {
+ return null;
+ }
+ else
+ {
+ return component.create(creationalContext);
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setComponentInstanceMap()
+ {
+
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public <T> T get(Contextual<T> component)
+ {
+ return null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/RequestContext.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/RequestContext.java
new file mode 100644
index 0000000..82bca89
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/RequestContext.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.context;
+
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.spi.Contextual;
+
+import org.apache.webbeans.context.creational.BeanInstanceBag;
+
+/**
+ * Request context implementation.
+ *
+ * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
+ * @since 1.0
+ */
+public class RequestContext extends AbstractContext
+{
+ private static final long serialVersionUID = -1030240915163272268L;
+
+ /*
+ * Constructor
+ */
+ public RequestContext()
+ {
+ super(RequestScoped.class);
+ }
+
+ @Override
+ public void setComponentInstanceMap()
+ {
+ componentInstanceMap = new ConcurrentHashMap<Contextual<?>, BeanInstanceBag<?>>();
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/SessionContext.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/SessionContext.java
new file mode 100644
index 0000000..cc1bd52
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/SessionContext.java
@@ -0,0 +1,102 @@
+/*
+ * 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.webbeans.context;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.NotSerializableException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.context.spi.Contextual;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.creational.BeanInstanceBag;
+import org.apache.webbeans.util.WebBeansUtil;
+
+/**
+ * Session context implementation.
+ */
+public class SessionContext extends AbstractContext implements Serializable, Externalizable
+{
+ private static final long serialVersionUID = 1L;
+
+ public SessionContext()
+ {
+ super(SessionScoped.class);
+ }
+
+ @Override
+ public void setComponentInstanceMap()
+ {
+ componentInstanceMap = new ConcurrentHashMap<Contextual<?>, BeanInstanceBag<?>>();
+ }
+
+ @Override
+ public void readExternal(ObjectInput in) throws IOException,
+ ClassNotFoundException
+ {
+ WebBeansContext webBeansContext = WebBeansContext.currentInstance();
+
+ scopeType = (Class<? extends Annotation>) in.readObject();
+ Map<String, BeanInstanceBag<?>> map = (Map<String, BeanInstanceBag<?>>)in.readObject();
+ setComponentInstanceMap();
+ Iterator<String> it = map.keySet().iterator();
+ Contextual<?> contextual = null;
+ while(it.hasNext())
+ {
+ String id = it.next();
+ if (id != null)
+ {
+ contextual = webBeansContext.getBeanManagerImpl().getPassivationCapableBean(id);
+ }
+ if (contextual != null)
+ {
+ componentInstanceMap.put(contextual, map.get(id));
+ }
+ }
+ }
+
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ out.writeObject(scopeType);
+ Iterator<Contextual<?>> it = componentInstanceMap.keySet().iterator();
+ Map<String, BeanInstanceBag<?>> map = new HashMap<String, BeanInstanceBag<?>>();
+ while(it.hasNext())
+ {
+ Contextual<?>contextual = it.next();
+ String id = WebBeansUtil.getPassivationId(contextual);
+ if (id == null)
+ {
+ throw new NotSerializableException("cannot serialize " + contextual.toString());
+ }
+ map.put(id, componentInstanceMap.get(contextual));
+ }
+ out.writeObject(map);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/SingletonContext.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/SingletonContext.java
new file mode 100644
index 0000000..cf83525
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/SingletonContext.java
@@ -0,0 +1,46 @@
+/*
+ * 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.webbeans.context;
+
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.enterprise.context.spi.Contextual;
+import javax.inject.Singleton;
+
+import org.apache.webbeans.context.creational.BeanInstanceBag;
+
+/**
+ * Application context implementation.
+ *
+ */
+public class SingletonContext extends AbstractContext
+{
+ private static final long serialVersionUID = -7600942820719243149L;
+
+ public SingletonContext()
+ {
+ super(Singleton.class);
+ }
+
+ @Override
+ public void setComponentInstanceMap()
+ {
+ componentInstanceMap = new ConcurrentHashMap<Contextual<?>, BeanInstanceBag<?>>();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/BeanInstanceBag.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/BeanInstanceBag.java
new file mode 100644
index 0000000..d85615f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/BeanInstanceBag.java
@@ -0,0 +1,93 @@
+/*
+ * 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.webbeans.context.creational;
+
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+import java.io.Serializable;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * Stores the CreationalContext and the Contextual Instance.
+ * This also makes sure that we don't create the same bean
+ * twice.
+ */
+public class BeanInstanceBag<T> implements Serializable
+{
+ private static final long serialVersionUID = 1656996021599122499L;
+ private final CreationalContext<T> beanCreationalContext;
+
+ private T beanInstance;
+
+ private final Lock lock = new ReentrantLock();
+
+ public BeanInstanceBag(CreationalContext<T> beanCreationalContext)
+ {
+ this.beanCreationalContext = beanCreationalContext;
+ }
+
+ /**
+ * @return the beanCreationalContext
+ */
+ public CreationalContext<T> getBeanCreationalContext()
+ {
+ return beanCreationalContext;
+ }
+
+ /**
+ * @return the beanInstance
+ */
+ public T getBeanInstance()
+ {
+ return beanInstance;
+ }
+
+ /**
+ * Create the contextual instance in a thread safe fashion
+ * @param contextual
+ * @return the single contextual instance for the context
+ */
+ public T create(Contextual<T> contextual)
+ {
+ try
+ {
+ lock.lock();
+
+ // we need to check again, maybe we got blocked by a previous invocation
+ if (beanInstance == null)
+ {
+ beanInstance = contextual.create(beanCreationalContext);
+ }
+
+ }
+ finally
+ {
+ lock.unlock();
+ }
+
+ return beanInstance;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Bag:" + beanCreationalContext + ", Instance: " + beanInstance;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextFactory.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextFactory.java
new file mode 100644
index 0000000..e0895ce
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextFactory.java
@@ -0,0 +1,62 @@
+/*
+ * 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.webbeans.context.creational;
+
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+/**
+ * Factory for {@link CreationalContext} instances.
+ *
+ * @version $Rev$ $Date$
+ *
+ * @param <T> contextual type info
+ */
+public final class CreationalContextFactory<T>
+{
+ private WebBeansContext webBeansContext;
+
+ /**
+ * Creates a new <code>CreationalContextFactory</code> instance.
+ * @param webBeansContext
+ */
+ public CreationalContextFactory(WebBeansContext webBeansContext)
+ {
+ this.webBeansContext = webBeansContext;
+ }
+
+ /**
+ * Returns a new creational context for given contextual.
+ *
+ * @param contextual contextual instance
+ * @return new creational context for given contextual
+ */
+ public CreationalContextImpl<T> getCreationalContext(Contextual<T> contextual)
+ {
+ return new CreationalContextImpl<T>(contextual, webBeansContext);
+ }
+
+ public CreationalContextImpl<T> wrappedCreationalContext(CreationalContext<T> creationalContext, Contextual<T> contextual)
+ {
+ return new WrappedCreationalContext<T>(contextual, creationalContext, webBeansContext);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextImpl.java
new file mode 100644
index 0000000..befa41c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextImpl.java
@@ -0,0 +1,345 @@
+/*
+ * 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.webbeans.context.creational;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Stack;
+
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.util.Asserts;
+import org.apache.webbeans.util.WebBeansUtil;
+
+/** {@inheritDoc} */
+public class CreationalContextImpl<T> implements CreationalContext<T>, Serializable
+{
+ //Default serial id
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * The delegate object to be injected into delegate injection points
+ */
+ private transient T delegate;
+
+ /**
+ * The injection point object to be injected into injection points of type InjectionPoint
+ */
+ private transient Stack<InjectionPoint> injectionPoints = null;
+
+ /**
+ * Contextual bean dependent instances
+ *
+ * <p><b>ATTENTION</b> This variable gets initiated lazily!</p>
+ */
+ private List<DependentCreationalContext<?>> dependentObjects = null;
+
+ /**
+ * Contains the currently created bean
+ */
+ private Bean<T> bean = null;
+
+ /**
+ * Contains the currently created contextual, may be a bean, interceptor or decorator
+ */
+ private Contextual<T> contextual = null;
+
+ private WebBeansContext webBeansContext;
+
+ /**
+ * This flag will get set to <code>true</code> to prevent recursive loops while destroying
+ * the CreationContext.
+ */
+ private boolean destroying = false;
+
+ /**
+ * Package private
+ */
+ CreationalContextImpl(Contextual<T> contextual, WebBeansContext webBeansContext)
+ {
+ if (contextual instanceof Bean)
+ {
+ bean = (Bean<T>)contextual;
+ }
+ this.contextual = contextual;
+ this.webBeansContext = webBeansContext;
+ }
+
+ public WebBeansContext getWebBeansContext()
+ {
+ return webBeansContext;
+ }
+
+ public T getDelegate()
+ {
+ return delegate;
+ }
+
+ /**
+ * @return the previously set delegate instance
+ */
+ public T putDelegate(T delegate)
+ {
+ T oldValue = this.delegate;
+ this.delegate = delegate;
+ return oldValue;
+ }
+
+ public InjectionPoint getInjectionPoint()
+ {
+ if (injectionPoints == null || injectionPoints.isEmpty())
+ {
+ return null;
+ }
+ return injectionPoints.peek();
+ }
+
+ public void putInjectionPoint(InjectionPoint injectionPoint)
+ {
+ if (injectionPoints == null)
+ {
+ injectionPoints = new Stack<InjectionPoint>();
+ }
+ injectionPoints.push(injectionPoint);
+ }
+
+ public InjectionPoint removeInjectionPoint()
+ {
+ if (injectionPoints == null || injectionPoints.isEmpty())
+ {
+ return null;
+ }
+ return injectionPoints.pop();
+ }
+
+ /**
+ * Save this incomplete instance.
+ *
+ * @param incompleteInstance incomplete bean instance
+ */
+ @Override
+ public void push(T incompleteInstance)
+ {
+ //No-action
+ }
+
+ /**
+ * Adds given dependent instance to the map.
+ *
+ * @param dependent dependent contextual
+ * @param instance dependent instance
+ */
+ public <K> void addDependent(Contextual<K> dependent, Object instance)
+ {
+ Asserts.assertNotNull(dependent,"dependent parameter cannot be null");
+
+ if(instance != null)
+ {
+ DependentCreationalContext<K> dependentCreational = new DependentCreationalContext<K>(dependent);
+ dependentCreational.setInstance(instance);
+
+ synchronized(this)
+ {
+ if (dependentObjects == null)
+ {
+ dependentObjects = new ArrayList<DependentCreationalContext<?>>();
+ }
+
+ if (dependent == bean)
+ {
+ dependentObjects.add(0, dependentCreational);
+ }
+ else
+ {
+ dependentObjects.add(dependentCreational);
+ }
+ }
+ }
+ }
+
+ public boolean containsDependent(Contextual<?> contextual, Object instance)
+ {
+ if (dependentObjects == null)
+ {
+ return false;
+ }
+ synchronized (this)
+ {
+ for (DependentCreationalContext<?> dependentCreationalContext: dependentObjects)
+ {
+ if (dependentCreationalContext.getContextual().equals(contextual) && dependentCreationalContext.getInstance() == instance)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
+ public <X> void destroyDependent(X instance)
+ {
+ if (dependentObjects == null)
+ {
+ return;
+ }
+ synchronized (this)
+ {
+ for (Iterator<DependentCreationalContext<?>> i = dependentObjects.iterator(); i.hasNext();)
+ {
+ DependentCreationalContext<?> dependentContext = i.next();
+ if (dependentContext.getInstance() == instance)
+ {
+ Contextual<X> dependentContextual = (Contextual<X>)dependentContext.getContextual();
+ CreationalContext<X> creationalContext = (CreationalContext<X>)this;
+ dependentContextual.destroy(instance, creationalContext);
+ i.remove();
+ break;
+ }
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public void removeAllDependents()
+ {
+ if (dependentObjects == null || destroying)
+ {
+ return;
+ }
+
+ destroying = true;
+
+ synchronized(this)
+ {
+ if (dependentObjects != null)
+ {
+ // this is kind of an emergency valve...
+ int maxRemoval = dependentObjects.size() * 3;
+ while (!dependentObjects.isEmpty() && maxRemoval > 0)
+ {
+ // we don't use an iterator because the destroyal might register a
+ // fresh PreDestroy interceptor as dependent object...
+ DependentCreationalContext<T> dependent = (DependentCreationalContext<T>) dependentObjects.get(0);
+ dependentObjects.remove(0);
+ dependent.getContextual().destroy((T) dependent.getInstance(), this);
+ maxRemoval--;
+ }
+
+ if (maxRemoval == 0)
+ {
+ throw new WebBeansException("infinite loop detected while destroying bean " + bean);
+ }
+ }
+ }
+
+ dependentObjects = null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void release()
+ {
+ removeAllDependents();
+ }
+
+ public Bean<T> getBean()
+ {
+ return bean;
+ }
+
+ public Bean<T> putBean(Bean<T> newBean)
+ {
+ Bean<T> oldBean = bean;
+ bean = newBean;
+ return oldBean;
+ }
+
+ public Contextual<T> getContextual()
+ {
+ return contextual;
+ }
+
+ public Contextual<T> putContextual(Contextual<T> newContextual)
+ {
+ Contextual<T> oldContextual = contextual;
+ contextual = newContextual;
+ return oldContextual;
+ }
+
+ /**
+ * Write Object.
+ */
+ private void writeObject(ObjectOutputStream s)
+ throws IOException
+ {
+ s.writeObject(dependentObjects);
+
+ String id = WebBeansUtil.getPassivationId(bean);
+ if (bean != null && id != null)
+ {
+ s.writeObject(id);
+ }
+ else
+ {
+ s.writeObject(null);
+ }
+ }
+
+
+ /**
+ * Read object.
+ */
+ @SuppressWarnings("unchecked")
+ private void readObject(ObjectInputStream s)
+ throws IOException, ClassNotFoundException
+ {
+ webBeansContext = WebBeansContext.currentInstance();
+ dependentObjects = (List<DependentCreationalContext<?>>)s.readObject();
+
+ String id = (String) s.readObject();
+ if (id != null)
+ {
+ bean = (Bean<T>) webBeansContext.getBeanManagerImpl().getPassivationCapableBean(id);
+ }
+
+ }
+
+ @Override
+ public String toString()
+ {
+
+ final StringBuilder sb = new StringBuilder("CreationalContext{name=");
+
+ sb.append(bean.getBeanClass().getSimpleName());
+
+ return sb.append("}").toString();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/DependentCreationalContext.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/DependentCreationalContext.java
new file mode 100644
index 0000000..1c8f12b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/DependentCreationalContext.java
@@ -0,0 +1,117 @@
+/*
+ * 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.webbeans.context.creational;
+
+import java.io.IOException;
+import java.io.NotSerializableException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+
+import javax.enterprise.context.spi.Contextual;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.util.WebBeansUtil;
+
+/**
+ * This class contains creation information about @Dependent scoped
+ * contextual instances.
+ */
+public class DependentCreationalContext<S> implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private Contextual<S> contextual;
+
+ private Object instance;
+
+ /**
+ * @return the instance
+ */
+ public Object getInstance()
+ {
+ return instance;
+ }
+
+
+ /**
+ * @param instance the instance to set
+ */
+ public void setInstance(Object instance)
+ {
+ this.instance = instance;
+ }
+
+
+ public DependentCreationalContext(Contextual<S> contextual)
+ {
+ this.contextual = contextual;
+ }
+
+
+ /**
+ * @return the contextual
+ */
+ public Contextual<S> getContextual()
+ {
+ return contextual;
+ }
+
+ private void writeObject(ObjectOutputStream s)
+ throws IOException
+ {
+ s.writeObject(instance);
+
+ //Write for contextual
+ if (contextual != null)
+ {
+ String id = WebBeansUtil.getPassivationId(contextual);
+ if (id != null)
+ {
+ s.writeObject(id);
+ }
+ else
+ {
+ throw new NotSerializableException("cannot serialize " + contextual.toString());
+ }
+
+ }
+ else
+ {
+ s.writeObject(null);
+ }
+ }
+
+
+ @SuppressWarnings("unchecked")
+ private void readObject(ObjectInputStream s)
+ throws IOException, ClassNotFoundException
+ {
+ instance = s.readObject();
+
+ //Read for contextual
+ String id = (String) s.readObject();
+ if (id != null)
+ {
+ WebBeansContext webBeansContext = WebBeansContext.currentInstance();
+ contextual = (Contextual<S>) webBeansContext.getBeanManagerImpl().getPassivationCapableBean(id);
+ }
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/WrappedCreationalContext.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/WrappedCreationalContext.java
new file mode 100644
index 0000000..19dc4b6
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/WrappedCreationalContext.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.context.creational;
+
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+class WrappedCreationalContext<T> extends CreationalContextImpl<T> implements CreationalContext<T>
+{
+ private static final long serialVersionUID = 3580925478881669439L;
+
+ private CreationalContext<T> wrapped = null;
+
+ WrappedCreationalContext(Contextual<T> contextual, CreationalContext<T> creationalContext,
+ WebBeansContext webBeansContext)
+ {
+ super(contextual, webBeansContext);
+ wrapped = creationalContext;
+ }
+
+ @Override
+ public void push(T instance)
+ {
+ super.push(instance);
+ wrapped.push(instance);
+ }
+
+ @Override
+ public void release()
+ {
+ super.release();
+ wrapped.release();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationImpl.java
new file mode 100644
index 0000000..602b42e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationImpl.java
@@ -0,0 +1,365 @@
+/*
+ * 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.webbeans.conversation;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.enterprise.context.Conversation;
+import javax.enterprise.context.ConversationScoped;
+
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.OpenWebBeansConfiguration;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.ConversationContext;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.util.Asserts;
+
+/**
+ * Implementation of the {@link Conversation} interface.
+ * @version $Rev$ $Date$
+ *
+ */
+public class ConversationImpl implements Conversation, Serializable
+{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 8511063860333431722L;
+
+ /**Logger instance*/
+ private final static Logger logger = WebBeansLoggerFacade.getLogger(ConversationImpl.class);
+
+ /**Conversation id*/
+ private String id;
+
+ /**Transient or not. Transient conversations are destroyed at the end of JSF request*/
+ private boolean isTransient = true;
+
+ /**Default timeout is 30mins*/
+ private long timeout;
+
+ /**Id of the session that this conversation is created*/
+ private String sessionId;
+
+ /**Active duration of the conversation*/
+ private long activeTime = 0L;
+
+ /**Generating ids*/
+ private static AtomicInteger conversationIdGenerator = new AtomicInteger(0);
+
+ /**This instance is under used*/
+ private AtomicBoolean inUsed = new AtomicBoolean(false);
+
+ private transient WebBeansContext webBeansContext;
+
+ /**
+ * Default constructor. Used for proxies.
+ */
+ public ConversationImpl()
+ {
+ super();
+ }
+
+ public ConversationImpl(WebBeansContext webBeansContext)
+ {
+ this.webBeansContext = webBeansContext;
+ try
+ {
+ timeout = Long.parseLong(this.webBeansContext.getOpenWebBeansConfiguration().
+ getProperty(OpenWebBeansConfiguration.CONVERSATION_TIMEOUT_INTERVAL, "1800000"));
+ }
+ catch(NumberFormatException e)
+ {
+ timeout = 30 * 60 * 1000;
+ }
+ }
+
+ /**
+ * Creates a new conversation instance. Id is not
+ * set until conversation is begin.
+ * @param sessionId
+ * @param webBeansContext
+ */
+ public ConversationImpl(String sessionId, WebBeansContext webBeansContext)
+ {
+ Asserts.assertNotNull(sessionId);
+
+ this.webBeansContext = webBeansContext;
+
+ try
+ {
+ timeout = Long.parseLong(this.webBeansContext.getOpenWebBeansConfiguration().
+ getProperty(OpenWebBeansConfiguration.CONVERSATION_TIMEOUT_INTERVAL, "1800000"));
+ }
+ catch(NumberFormatException e)
+ {
+ timeout = 30 * 60 * 1000;
+ }
+
+ this.sessionId = sessionId;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void begin()
+ {
+ //Transient state
+ if(isTransient)
+ {
+ isTransient = false;
+ id = Integer.toString(conversationIdGenerator.incrementAndGet());
+ updateTimeOut();
+
+ //Conversation manager
+ ConversationManager manager = webBeansContext.getConversationManager();
+ try
+ {
+ //Gets current conversation context instance.
+ //Each conversation has its own conversation context instance.
+ //Sets at the beginning of each JSF request.
+ manager.addConversationContext(this, (ConversationContext) webBeansContext.getBeanManagerImpl().getContext(ConversationScoped.class));
+
+ }
+ catch(Exception e)
+ {
+ //TCK tests
+ manager.addConversationContext(this, new ConversationContext());
+ }
+ }
+ //Already started conversation.
+ else
+ {
+ logger.log(Level.WARNING, OWBLogConst.WARN_0003, id);
+ throw new IllegalStateException();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void begin(String id)
+ {
+ //Look at other conversation, that may collate with this is
+ final ConversationManager conversationManager = webBeansContext.getConversationManager();
+ if(conversationManager.isConversationExistWithGivenId(id))
+ {
+ throw new IllegalArgumentException("Conversation with id=" + id + " is already exist!");
+ }
+
+ //Transient state
+ if(isTransient)
+ {
+ isTransient = false;
+ this.id = id;
+ updateTimeOut();
+ conversationManager.addConversationContext(this, (ConversationContext) webBeansContext.getBeanManagerImpl().getContext(ConversationScoped.class));
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void end()
+ {
+ if(!isTransient)
+ {
+ isTransient = true;
+
+ webBeansContext.getConversationManager().removeConversation(this);
+ }
+ else
+ {
+ logger.log(Level.WARNING, OWBLogConst.WARN_0004, id);
+ throw new IllegalStateException(toString() + " has already ended");
+ }
+ }
+
+
+ /**
+ * @return the inUsed
+ */
+ public AtomicBoolean getInUsed()
+ {
+ return inUsed;
+ }
+
+ /**
+ * @param inUsed the inUsed to set
+ */
+ public void setInUsed(boolean inUsed)
+ {
+ this.inUsed.set(inUsed);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getId()
+ {
+ return id;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public long getTimeout()
+ {
+ return timeout;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isTransient()
+ {
+ return isTransient;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setTimeout(long milliseconds)
+ {
+ timeout = milliseconds;
+ }
+
+ /**
+ * Gets session id.
+ * @return conversation session id
+ */
+ public String getSessionId()
+ {
+ return sessionId;
+ }
+
+ /**
+ * @return the creationTime
+ */
+ public long getActiveTime()
+ {
+ return activeTime;
+ }
+
+
+ /**
+ * Update conversation timeout value.
+ */
+ public void updateTimeOut()
+ {
+ activeTime = System.currentTimeMillis();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ result = prime * result + ((sessionId == null) ? 0 : sessionId.hashCode());
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+
+ if (obj == null)
+ {
+ return false;
+ }
+
+ if (getClass() != obj.getClass())
+ {
+ return false;
+ }
+
+ final ConversationImpl other = (ConversationImpl) obj;
+ if (id == null)
+ {
+ if (other.id != null)
+ {
+ return false;
+ }
+ }
+ else if (!id.equals(other.id))
+ {
+ return false;
+ }
+ if (sessionId == null)
+ {
+ if (other.sessionId != null)
+ {
+ return false;
+ }
+ }
+ else if (!sessionId.equals(other.sessionId))
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append("Conversation with id [ ");
+ builder.append(id);
+ builder.append(" ]");
+
+ return builder.toString();
+ }
+
+ /**
+ * We need this for restoring our WebBeansContext on de-serialisation
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
+ {
+ webBeansContext = WebBeansContext.currentInstance();
+ in.defaultReadObject();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationManager.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationManager.java
new file mode 100644
index 0000000..23cca69
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationManager.java
@@ -0,0 +1,275 @@
+/*
+ * 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.webbeans.conversation;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.enterprise.context.Conversation;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.apache.webbeans.annotation.DefaultLiteral;
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.ConversationContext;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.util.Asserts;
+
+/**
+ * Manager for the conversations.
+ * Each conversation is related with conversation id and session id.
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public class ConversationManager
+{
+ /**Current conversations*/
+ private final ConcurrentMap<Conversation, ConversationContext> conversations = new ConcurrentHashMap<Conversation, ConversationContext>();
+ private final WebBeansContext webBeansContext;
+ private final static Logger logger = WebBeansLoggerFacade.getLogger(ConversationManager.class);
+
+ /**
+ * Creates new conversation manager
+ */
+ public ConversationManager(WebBeansContext webBeansContext)
+ {
+ this.webBeansContext = webBeansContext;
+ }
+
+ /**
+ * Adds new conversation context.
+ * @param conversation new conversation
+ * @param context new context
+ */
+ public void addConversationContext(Conversation conversation, ConversationContext context)
+ {
+ conversations.put(conversation, context);
+ }
+
+ /**
+ * Check conversation id exists.
+ * @param conversationId conversation id
+ * @return true if this conversation exist
+ */
+ public boolean isConversationExistWithGivenId(String conversationId)
+ {
+ ConversationImpl conv = null;
+ Set<Conversation> set = conversations.keySet();
+ Iterator<Conversation> it = set.iterator();
+
+ while (it.hasNext())
+ {
+ conv = (ConversationImpl) it.next();
+ if (conv.getId().equals(conversationId))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Return all conversation/context associated with sessionid.
+ *
+ * @param sessionId
+ * @return
+ */
+ public Map<Conversation, ConversationContext> getConversationMapWithSessionId(String sessionId)
+ {
+ Asserts.assertNotNull(sessionId,"sessionId parameter can not be null");
+ Set<Conversation> set = conversations.keySet();
+ Iterator<Conversation> it = set.iterator();
+ ConversationImpl conv = null;
+ Map<Conversation, ConversationContext> map = new HashMap<Conversation, ConversationContext>();
+ while (it.hasNext())
+ {
+ conv = (ConversationImpl) it.next();
+ if (conv.getSessionId().equals(sessionId))
+ {
+ map.put(conv, conversations.get(conv));
+ }
+ }
+ return map;
+ }
+
+ /**
+ * Return all conversation/context associated with sessionid.
+ *
+ * @param sessionId
+ * @return
+ */
+ public Map<Conversation, ConversationContext> getAndRemoveConversationMapWithSessionId(String sessionId)
+ {
+ Asserts.assertNotNull(sessionId,"sessionId parameter can not be null");
+ Set<Conversation> set = conversations.keySet();
+ Iterator<Conversation> it = set.iterator();
+ ConversationImpl conv = null;
+ Map<Conversation, ConversationContext> map = new HashMap<Conversation, ConversationContext>();
+ while (it.hasNext())
+ {
+ conv = (ConversationImpl) it.next();
+ if (conv.getSessionId().equals(sessionId))
+ {
+ map.put(conv, conversations.remove(conv));
+ }
+ }
+ return map;
+ }
+
+ /**
+ * Remove given conversation.
+ * @param conversation conversation instance
+ * @return context
+ */
+ public ConversationContext removeConversation(Conversation conversation)
+ {
+ Asserts.assertNotNull(conversation, "conversation can not be null");
+
+ return conversations.remove(conversation);
+ }
+
+ /**
+ * Gets conversation's context instance.
+ * @param conversation conversation instance
+ * @return conversation related context
+ */
+ public ConversationContext getConversationContext(Conversation conversation)
+ {
+ Asserts.assertNotNull(conversation, "conversation can not be null");
+
+ return conversations.get(conversation);
+ }
+
+ /**
+ * Gets conversation with id and session id.
+ * @param conversationId conversation id
+ * @param sessionId session id
+ * @return conversation
+ */
+ public ConversationImpl getPropogatedConversation(String conversationId, String sessionId)
+ {
+ Asserts.assertNotNull(conversationId, "conversationId parameter can not be null");
+ Asserts.assertNotNull(sessionId,"sessionId parameter can not be null");
+
+ ConversationImpl conv;
+ Set<Conversation> set = conversations.keySet();
+ Iterator<Conversation> it = set.iterator();
+
+ while (it.hasNext())
+ {
+ conv = (ConversationImpl) it.next();
+ if (conv.getId().equals(conversationId) && conv.getSessionId().equals(sessionId))
+ {
+ return conv;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Destroy conversations with given session id.
+ * @param sessionId session id
+ */
+ @Deprecated
+ public void destroyConversationContextWithSessionId(String sessionId)
+ {
+ Asserts.assertNotNull(sessionId, "sessionId parameter can not be null");
+
+ ConversationImpl conv;
+ Set<Conversation> set = conversations.keySet();
+ Iterator<Conversation> it = set.iterator();
+
+ while (it.hasNext())
+ {
+ conv = (ConversationImpl) it.next();
+ if (conv.getSessionId().equals(sessionId))
+ {
+ ConversationContext ctx = getConversationContext(conv);
+ if (ctx != null)
+ {
+ ctx.destroy();
+ }
+ it.remove();
+ }
+ }
+ }
+
+ /**
+ * Gets conversation instance from conversation bean.
+ * @return conversation instance
+ */
+ @SuppressWarnings("unchecked")
+ public Conversation getConversationBeanReference()
+ {
+ BeanManager beanManager = webBeansContext.getBeanManagerImpl();
+ Bean<Conversation> bean = (Bean<Conversation>)beanManager.getBeans(Conversation.class, DefaultLiteral.INSTANCE).iterator().next();
+ Conversation conversation =(Conversation) beanManager.getReference(bean, Conversation.class, beanManager.createCreationalContext(bean));
+
+ return conversation;
+ }
+
+ /**
+ * Destroy unactive conversations.
+ */
+ public void destroyWithRespectToTimout()
+ {
+ ConversationImpl conv = null;
+ Set<Conversation> set = conversations.keySet();
+ Iterator<Conversation> it = set.iterator();
+
+ while (it.hasNext())
+ {
+ conv = (ConversationImpl) it.next();
+ long timeout = conv.getTimeout();
+
+ if (timeout != 0L)
+ {
+ if ((System.currentTimeMillis() - conv.getActiveTime()) > timeout)
+ {
+ ConversationContext ctx = getConversationContext(conv);
+ if (ctx != null)
+ {
+ if(logger.isLoggable(Level.INFO))
+ {
+ logger.log(Level.INFO, OWBLogConst.INFO_0011, conv.getId());
+ }
+ ctx.destroy();
+ }
+
+ it.remove();
+ }
+ }
+ }
+ }
+
+ public Map<Conversation, ConversationContext> getAllConversationContexts()
+ {
+ return conversations;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/corespi/DefaultSingletonService.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/corespi/DefaultSingletonService.java
new file mode 100644
index 0000000..153945e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/corespi/DefaultSingletonService.java
@@ -0,0 +1,98 @@
+/*
+ * 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.webbeans.corespi;
+
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.spi.SingletonService;
+import org.apache.webbeans.util.Asserts;
+
+public class DefaultSingletonService implements SingletonService<WebBeansContext>
+{
+ /**
+ * Keys --> ClassLoaders
+ * Values --> WebBeansContext
+ */
+ private final Map<ClassLoader, WebBeansContext> singletonMap = new WeakHashMap<ClassLoader, WebBeansContext>();
+
+ /**
+ * Gets singleton instance for deployment.
+ * @return signelton instance for this deployment
+ */
+ @Override
+ public WebBeansContext get(Object key)
+ {
+ assertClassLoaderKey(key);
+ ClassLoader classLoader = (ClassLoader) key;
+ synchronized (singletonMap)
+ {
+ //util.Track.sync(key);
+
+ WebBeansContext webBeansContext = singletonMap.get(classLoader);
+ //util.Track.get(key);
+
+ if (webBeansContext == null)
+ {
+ webBeansContext = new WebBeansContext();
+ singletonMap.put(classLoader, webBeansContext);
+ }
+
+ return webBeansContext;
+
+ }
+ }
+
+ /**
+ * Clear all deployment instances when the application is undeployed.
+ * @param classLoader of the deployment
+ */
+ public void clearInstances(ClassLoader classLoader)
+ {
+ Asserts.assertNotNull(classLoader, "classloader is null");
+ synchronized (singletonMap)
+ {
+ singletonMap.remove(classLoader);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void clear(Object classLoader)
+ {
+ assertClassLoaderKey(classLoader);
+ clearInstances((ClassLoader)classLoader);
+ }
+
+ /**
+ * Assert that key is classloader instance.
+ * @param key key
+ */
+ private void assertClassLoaderKey(Object key)
+ {
+ if(!(key instanceof ClassLoader))
+ {
+ throw new IllegalArgumentException("Key instance must be ClassLoader for using DefaultSingletonService");
+ }
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java
new file mode 100644
index 0000000..a4542ec
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java
@@ -0,0 +1,264 @@
+/*
+ * 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.webbeans.corespi.scanner;
+
+
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.OpenWebBeansConfiguration;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.corespi.scanner.xbean.CdiArchive;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.exception.WebBeansDeploymentException;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.spi.BDABeansXmlScanner;
+import org.apache.webbeans.spi.ScannerService;
+import org.apache.webbeans.util.ClassUtil;
+import org.apache.webbeans.util.UrlSet;
+import org.apache.webbeans.util.WebBeansUtil;
+import org.apache.xbean.finder.AnnotationFinder;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public abstract class AbstractMetaDataDiscovery implements ScannerService
+{
+ protected static final Logger logger = WebBeansLoggerFacade.getLogger(AbstractMetaDataDiscovery.class);
+
+ public static final String META_INF_BEANS_XML = "META-INF/beans.xml";
+
+ /** Location of the beans.xml files. */
+ private final UrlSet webBeansXmlLocations = new UrlSet();
+
+ //private Map<String, InputStream> EJB_XML_LOCATIONS = new HashMap<String, InputStream>();
+
+ protected ClassLoader loader;
+ protected CdiArchive archive;
+ protected AnnotationFinder finder;
+ protected boolean isBDAScannerEnabled = false;
+ protected BDABeansXmlScanner bdaBeansXmlScanner;
+
+ protected AnnotationFinder initFinder()
+ {
+ if (finder != null)
+ {
+ return finder;
+ }
+
+ final Collection<URL> trimmedUrls = new ArrayList<URL>();
+ for (final URL url : getUrls())
+ {
+ try
+ {
+ String file = url.getFile();
+ if (file.endsWith(META_INF_BEANS_XML))
+ {
+ file = file.substring(0, file.length() - META_INF_BEANS_XML.length());
+ }
+ else if (file.endsWith("WEB-INF/beans.xml"))
+ {
+ file = file.substring(0, file.length() - "WEB-INF/beans.xml".length());
+ }
+ trimmedUrls.add(new URL(url.getProtocol(), url.getHost(), url.getPort(), file));
+ }
+ catch (MalformedURLException e)
+ {
+ throw new WebBeansConfigurationException("Can't trim url " + url.toExternalForm());
+ }
+ }
+
+ archive = new CdiArchive(WebBeansUtil.getCurrentClassLoader(), trimmedUrls);
+ finder = new AnnotationFinder(archive);
+
+ return finder;
+ }
+
+ protected Iterable<URL> getUrls()
+ {
+ return webBeansXmlLocations;
+ }
+
+ /**
+ * Configure the Web Beans Container with deployment information and fills
+ * annotation database and beans.xml stream database.
+ *
+ * @throws org.apache.webbeans.exception.WebBeansConfigurationException if any run time exception occurs
+ */
+ @Override
+ public void scan() throws WebBeansDeploymentException
+ {
+ try
+ {
+ configure();
+ initFinder();
+ }
+ catch (Exception e)
+ {
+ throw new WebBeansDeploymentException(e);
+ }
+ }
+
+ @Override
+ public void release()
+ {
+ finder = null;
+ archive = null;
+ loader = null;
+ }
+
+ abstract protected void configure();
+
+ /**
+ * Find the base paths of all available resources with the given
+ * resourceName in the classpath.
+ * The returned Strings will <i>NOT</i> contain the resourceName itself!
+ *
+ * @param resourceName the name of the resource, e.g. 'META-INF/beans.xml'
+ * @param loader the ClassLoader which should be used
+ * @return array of Strings with the URL path to the resources.
+ */
+ protected String[] findBeansXmlBases(String resourceName, ClassLoader loader)
+ {
+ this.loader = loader;
+
+ ArrayList<String> list = new ArrayList<String>();
+ try
+ {
+ Enumeration<URL> urls = loader.getResources(resourceName);
+
+ while (urls.hasMoreElements())
+ {
+ URL url = urls.nextElement();
+
+ addWebBeansXmlLocation(url);
+
+ String urlString = url.toString();
+ int idx = urlString.lastIndexOf(resourceName);
+ urlString = urlString.substring(0, idx);
+
+ list.add(urlString);
+ }
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+
+ return list.toArray(new String[list.size()]);
+
+ }
+
+
+
+ @Override
+ public void init(Object object)
+ {
+ // set per BDA beans.xml flag here because setting it in constructor
+ // occurs before
+ // properties are loaded.
+ String usage = WebBeansContext.currentInstance().getOpenWebBeansConfiguration().getProperty(OpenWebBeansConfiguration.USE_BDA_BEANSXML_SCANNER);
+ isBDAScannerEnabled = Boolean.parseBoolean(usage);
+ }
+
+ public Set<String> getAllAnnotations(String className)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+
+ /**
+ * add the given beans.xml path to the locations list
+ * @param beansXmlUrl location path
+ */
+ protected void addWebBeansXmlLocation(URL beansXmlUrl)
+ {
+ if(logger.isLoggable(Level.INFO))
+ {
+ logger.info("added beans.xml marker: " + beansXmlUrl.toExternalForm());
+ }
+ webBeansXmlLocations.add(beansXmlUrl);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.webbeans.corespi.ScannerService#getBeanClasses()
+ */
+ @Override
+ public Set<Class<?>> getBeanClasses()
+ {
+ final Set<Class<?>> classSet = new HashSet<Class<?>>();
+ for(String str : archive.getClasses())
+ {
+ try
+ {
+ Class<?> clazz = ClassUtil.getClassFromName(str);
+ if (clazz != null)
+ {
+
+ // try to provoke a NoClassDefFoundError exception which is thrown
+ // if some dependencies of the class are missing
+ clazz.getDeclaredFields();
+ clazz.getDeclaredMethods();
+
+ // we can add this class cause it has been loaded completely
+ classSet.add(clazz);
+
+ }
+ }
+ catch (NoClassDefFoundError e)
+ {
+ if (logger.isLoggable(Level.WARNING))
+ {
+ logger.log(Level.WARNING, OWBLogConst.WARN_0018, new Object[] { str, e.toString() });
+ }
+ }
+ }
+
+ return classSet;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.webbeans.corespi.ScannerService#getBeanXmls()
+ */
+ @Override
+ public Set<URL> getBeanXmls()
+ {
+ return Collections.unmodifiableSet(webBeansXmlLocations);
+ }
+
+ @Override
+ public BDABeansXmlScanner getBDABeansXmlScanner()
+ {
+ return bdaBeansXmlScanner;
+ }
+
+ @Override
+ public boolean isBDABeansXmlScanningEnabled()
+ {
+ return isBDAScannerEnabled;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/xbean/CdiArchive.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/xbean/CdiArchive.java
new file mode 100644
index 0000000..94fe657
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/xbean/CdiArchive.java
@@ -0,0 +1,142 @@
+/*
+ * 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.webbeans.corespi.scanner.xbean;
+
+import org.apache.xbean.finder.archive.Archive;
+import org.apache.xbean.finder.archive.ClassesArchive;
+import org.apache.xbean.finder.archive.ClasspathArchive;
+import org.apache.xbean.finder.archive.CompositeArchive;
+import org.apache.xbean.finder.archive.FilteredArchive;
+import org.apache.xbean.finder.filter.Filter;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * this delegate pattern is interesting
+ * because we will be able to add
+ * some exclusion config through it
+ * using Filter + FilterArchive
+ */
+public class CdiArchive implements Archive
+{
+ /**
+ * key: URL#toExternalForm of the scanned classpath entry
+ * value: small data container with URL and class names
+ */
+ private final Map<String, FoundClasses> classesByUrl = new HashMap<String, FoundClasses>();
+
+ private final Set<String> classes = new HashSet<String>();
+ private final Archive delegate;
+
+ public CdiArchive(final ClassLoader loader, final Iterable<URL> urls)
+ {
+ final Collection<Archive> archives = new ArrayList<Archive>();
+ for (final URL url : urls)
+ {
+ final List<String> classes = new ArrayList<String>();
+ final Archive archive = new FilteredArchive(ClasspathArchive.archive(loader, url), new Filter()
+ {
+ @Override
+ public boolean accept(final String name)
+ {
+ classes.add(name);
+ CdiArchive.this.classes.add(name);
+ return true;
+ }
+ });
+ classesByUrl.put(url.toExternalForm(), new FoundClasses(url, classes));
+ archives.add(archive);
+ }
+
+ delegate = new CompositeArchive(archives);
+ }
+
+ public CdiArchive(final Collection<Class<?>> classList)
+ {
+ delegate = new FilteredArchive(new ClassesArchive(classList), new Filter()
+ {
+ @Override
+ public boolean accept(final String name)
+ {
+ classes.add(name);
+ return true;
+ }
+ });
+ }
+
+ public Set<String> getClasses()
+ {
+ return classes;
+ }
+
+ public Map<String, FoundClasses> classesByUrl()
+ {
+ return classesByUrl;
+ }
+
+ @Override
+ public InputStream getBytecode(final String className) throws IOException, ClassNotFoundException
+ {
+ return delegate.getBytecode(className);
+ }
+
+ @Override
+ public Class<?> loadClass(final String className) throws ClassNotFoundException
+ {
+ return delegate.loadClass(className);
+ }
+
+ @Override
+ public Iterator<Entry> iterator()
+ {
+ return delegate.iterator();
+ }
+
+ public final class FoundClasses
+ {
+ private URL url;
+ private Collection<String> classNames;
+
+ public FoundClasses(URL url, Collection<String> classNames)
+ {
+ this.url = url;
+ this.classNames = classNames;
+ }
+
+ public URL getUrl()
+ {
+ return url;
+ }
+
+ public Collection<String> getClassNames()
+ {
+ return classNames;
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultBDABeansXmlScanner.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultBDABeansXmlScanner.java
new file mode 100644
index 0000000..01d0196
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultBDABeansXmlScanner.java
@@ -0,0 +1,289 @@
+/*
+ * 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.webbeans.corespi.se;
+
+import java.lang.annotation.Annotation;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.webbeans.spi.BDABeansXmlScanner;
+
+/**
+ *
+ * Tracks contents of each BDA's beans.xml to determine
+ * the interceptor, alternative, decorator, or etc that
+ * is applicable for a given BDA.
+ *
+ */
+public class DefaultBDABeansXmlScanner implements BDABeansXmlScanner
+{
+
+ /**
+ * Map containing bean classes with reference to beans.xml of containing JAR
+ */
+ private Map<Class<?>, String> jarBeanClasses;
+
+ /**
+ * Maps BDA beans.xml file to the set of interceptors defined in the
+ * beans.xml
+ */
+ private final Map<String, Set<Class<?>>> interceptorsPerBDA;
+
+ /**
+ * Maps BDA beans.xml file to the set of decorators defined in the beans.xml
+ */
+ private final Map<String, Set<Class<?>>> decoratorsPerBDA;
+
+ /**
+ * Maps BDA beans.xml file to the set of alternatives defined in the
+ * beans.xml
+ */
+ private final Map<String, Set<Class<?>>> alternativesPerBDA;
+
+ /**
+ * Maps BDA beans.xml file to the set of stereotypes defined in the
+ * beans.xml
+ */
+ private final Map<String, Set<Class<? extends Annotation>>> stereotypesPerBDA;
+
+ public DefaultBDABeansXmlScanner()
+ {
+ interceptorsPerBDA = new HashMap<String, Set<Class<?>>>();
+ decoratorsPerBDA = new HashMap<String, Set<Class<?>>>();
+ stereotypesPerBDA = new HashMap<String, Set<Class<? extends Annotation>>>();
+ alternativesPerBDA = new HashMap<String, Set<Class<?>>>();
+ jarBeanClasses = new HashMap<Class<?>, String>();
+ }
+
+ /**
+ * Stores the beans.xml an Interceptor class is defined in
+ *
+ * @return T - Interceptor class successfully stored; F - Interceptor class
+ * already exists and was not stored.
+ */
+ @Override
+ public boolean addInterceptor(Class<?> interceptorClass, String beansXMLFilePath)
+ {
+
+ if (interceptorClass == null || beansXMLFilePath == null)
+ {
+ return false;
+ }
+ synchronized (interceptorsPerBDA)
+ {
+ Set<Class<?>> interceptorClasses = interceptorsPerBDA.get(beansXMLFilePath);
+ if (interceptorClasses == null)
+ {
+ interceptorClasses = new HashSet<Class<?>>();
+ interceptorsPerBDA.put(beansXMLFilePath, interceptorClasses);
+ }
+ return interceptorClasses.add(interceptorClass);
+ }
+ }
+
+ /**
+ * @param beansXMLFilePath
+ * @return a non-null set of Interceptors defined by the specified
+ * beansXMLFilePath
+ */
+ @Override
+ public Set<Class<?>> getInterceptors(String beansXMLFilePath)
+ {
+ Set<Class<?>> set;
+ synchronized (interceptorsPerBDA)
+ {
+ set = interceptorsPerBDA.get(beansXMLFilePath);
+ if (set != null)
+ {
+ return new HashSet<Class<?>>(set);
+ }
+ else
+ {
+ return new HashSet<Class<?>>();
+ }
+ }
+ }
+
+ /**
+ * @param beansXMLFilePath
+ * @return a non-null set of Decorators defined by the specified
+ * beansXMLFilePath
+ */
+ @Override
+ public Set<Class<?>> getDecorators(String beansXMLFilePath)
+ {
+ Set<Class<?>> set;
+ synchronized (decoratorsPerBDA)
+ {
+ set = decoratorsPerBDA.get(beansXMLFilePath);
+ if (set != null)
+ {
+ return new HashSet<Class<?>>(set);
+ }
+ else
+ {
+ return new HashSet<Class<?>>();
+ }
+ }
+ }
+
+ /**
+ * Stores the beans.xml a Decorator class is defined in
+ *
+ * @return T - Decorator class successfully stored; F - Decorator class
+ * already exists and was not stored.
+ */
+ @Override
+ public boolean addDecorator(Class<?> decoratorClass, String beansXMLFilePath)
+ {
+
+ if (decoratorClass == null || beansXMLFilePath == null)
+ {
+ return false;
+ }
+ synchronized (decoratorsPerBDA)
+ {
+ Set<Class<?>> decoratorClasses = decoratorsPerBDA.get(beansXMLFilePath);
+ if (decoratorClasses == null)
+ {
+ decoratorClasses = new HashSet<Class<?>>();
+ decoratorsPerBDA.put(beansXMLFilePath, decoratorClasses);
+ }
+ return decoratorClasses.add(decoratorClass);
+ }
+
+ }
+
+ /**
+ * Stores the beans.xml an Alternative class is defined in
+ *
+ * @return T - Alternative class successfully stored; F - Alternative class
+ * already exists and was not stored.
+ */
+ @Override
+ public boolean addAlternative(Class<?> alternativeClass, String beansXMLFilePath)
+ {
+
+ if (alternativeClass == null || beansXMLFilePath == null)
+ {
+ return false;
+ }
+ synchronized (alternativesPerBDA)
+ {
+ Set<Class<?>> alternativeClasses = alternativesPerBDA.get(beansXMLFilePath);
+ if (alternativeClasses == null)
+ {
+ alternativeClasses = new HashSet<Class<?>>();
+ alternativesPerBDA.put(beansXMLFilePath, alternativeClasses);
+ }
+ return alternativeClasses.add(alternativeClass);
+ }
+ }
+
+ /**
+ * Stores the beans.xml a Stereotype class is defined in
+ *
+ * @return T - Stereotype class successfully stored; F - Stereotype class
+ * already exists and was not stored.
+ */
+ @Override
+ public boolean addStereoType(Class<? extends Annotation> stereoTypeClass, String beansXMLFilePath)
+ {
+
+ if (stereoTypeClass == null || beansXMLFilePath == null)
+ {
+ return false;
+ }
+ synchronized (stereotypesPerBDA)
+ {
+ Set<Class<? extends Annotation>> stereoTypeClasses = stereotypesPerBDA.get(beansXMLFilePath);
+ if (stereoTypeClasses == null)
+ {
+ stereoTypeClasses = new HashSet<Class<? extends Annotation>>();
+ stereotypesPerBDA.put(beansXMLFilePath, stereoTypeClasses);
+ }
+ return stereoTypeClasses.add(stereoTypeClass);
+ }
+ }
+
+ /**
+ * @param beansXMLFilePath
+ * @return a non-null set of Alternatives defined by the specified
+ * beansXMLFilePath
+ */
+ @Override
+ public Set<Class<?>> getAlternatives(String beansXMLFilePath)
+ {
+ Set<Class<?>> set;
+ synchronized (alternativesPerBDA)
+ {
+ set = alternativesPerBDA.get(beansXMLFilePath);
+ if (set != null)
+ {
+ return new HashSet<Class<?>>(set);
+ }
+ else
+ {
+ return new HashSet<Class<?>>();
+ }
+ }
+ }
+
+ /**
+ * @param beansXMLFilePath
+ * @return a non-null set of Stereotypes defined by the specified
+ * beansXMLFilePath
+ */
+ @Override
+ public Set<Class<? extends Annotation>> getStereotypes(String beansXMLFilePath)
+ {
+ Set<Class<? extends Annotation>> set;
+ synchronized (stereotypesPerBDA)
+ {
+ set = stereotypesPerBDA.get(beansXMLFilePath);
+ if (set != null)
+ {
+ return new HashSet<Class<? extends Annotation>>(set);
+ }
+ else
+ {
+ return new HashSet<Class<? extends Annotation>>();
+ }
+ }
+ }
+
+ /**
+ * @param class1 deployed class
+ * @return A String representing the file path to the beans.xml of the
+ * specified class's BDA
+ */
+ @Override
+ public String getBeansXml(Class<?> class1)
+ {
+ return jarBeanClasses.get(class1);
+ }
+
+ @Override
+ public void setBeansXml(Class<?> class1, String beansXmlFilePath)
+ {
+ jarBeanClasses.put(class1, beansXmlFilePath);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultContextsService.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultContextsService.java
new file mode 100644
index 0000000..a2769f0
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultContextsService.java
@@ -0,0 +1,367 @@
+/*
+ * 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.webbeans.corespi.se;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.ContextException;
+import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.context.spi.Context;
+import javax.inject.Singleton;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.AbstractContextsService;
+import org.apache.webbeans.context.ApplicationContext;
+import org.apache.webbeans.context.ConversationContext;
+import org.apache.webbeans.context.DependentContext;
+import org.apache.webbeans.context.RequestContext;
+import org.apache.webbeans.context.SessionContext;
+import org.apache.webbeans.context.SingletonContext;
+
+public class DefaultContextsService extends AbstractContextsService
+{
+ private static ThreadLocal<RequestContext> requestContext = null;
+
+ private static ThreadLocal<SessionContext> sessionContext = null;
+
+ private ApplicationContext applicationContext = null;
+
+ private static ThreadLocal<ConversationContext> conversationContext = null;
+
+ private static ThreadLocal<SingletonContext> singletonContext = null;
+
+ private static ThreadLocal<DependentContext> dependentContext = null;
+
+
+ static
+ {
+ requestContext = new ThreadLocal<RequestContext>();
+ sessionContext = new ThreadLocal<SessionContext>();
+ conversationContext = new ThreadLocal<ConversationContext>();
+ dependentContext = new ThreadLocal<DependentContext>();
+ singletonContext = new ThreadLocal<SingletonContext>();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void endContext(Class<? extends Annotation> scopeType, Object endParameters)
+ {
+
+ if(supportsContext(scopeType))
+ {
+ if(scopeType.equals(RequestScoped.class))
+ {
+ stopRequestContext(endParameters);
+ }
+ else if(scopeType.equals(SessionScoped.class))
+ {
+ stopSessionContext(endParameters);
+ }
+ else if(scopeType.equals(ApplicationScoped.class))
+ {
+ stopApplicationContext(endParameters);
+ }
+ else if(scopeType.equals(ConversationScoped.class))
+ {
+ stopConversationContext(endParameters);
+ }
+ else if(scopeType.equals(Dependent.class))
+ {
+ //Do nothing
+ }
+ else
+ {
+ stopSingletonContext(endParameters);
+ }
+ }
+
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Context getCurrentContext(Class<? extends Annotation> scopeType)
+ {
+ if(scopeType.equals(RequestScoped.class))
+ {
+ return getCurrentRequestContext();
+ }
+ else if(scopeType.equals(SessionScoped.class))
+ {
+ return getCurrentSessionContext();
+ }
+ else if(scopeType.equals(ApplicationScoped.class))
+ {
+ return getCurrentApplicationContext();
+ }
+ else if(scopeType.equals(ConversationScoped.class))
+ {
+ return getCurrentConversationContext();
+ }
+ else if(scopeType.equals(Dependent.class))
+ {
+ return getCurrentDependentContext();
+ }
+ else if(scopeType.equals(Singleton.class))
+ {
+ return getCurrentSingletonContext();
+ }
+
+ return null;
+
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void startContext(Class<? extends Annotation> scopeType, Object startParameter) throws ContextException
+ {
+ try
+ {
+ if(scopeType.equals(RequestScoped.class))
+ {
+ startRequestContext(startParameter);
+ }
+ else if(scopeType.equals(SessionScoped.class))
+ {
+ startSessionContext(startParameter);
+ }
+ else if(scopeType.equals(ApplicationScoped.class))
+ {
+ startApplicationContext(startParameter);
+ }
+ else if(scopeType.equals(ConversationScoped.class))
+ {
+ startConversationContext(startParameter);
+ }
+ else if(scopeType.equals(Dependent.class))
+ {
+ //Do nothing
+ }
+ else if(scopeType.equals(Singleton.class))
+ {
+ startSingletonContext(startParameter);
+ }
+ }
+ catch(Exception e)
+ {
+ if(e instanceof ContextException)
+ {
+ throw (ContextException)e;
+ }
+
+ throw new ContextException(e);
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean supportsContext(Class<? extends Annotation> scopeType)
+ {
+
+ return scopeType.equals(RequestScoped.class) ||
+ scopeType.equals(SessionScoped.class) ||
+ scopeType.equals(ApplicationScoped.class) ||
+ scopeType.equals(ConversationScoped.class) ||
+ scopeType.equals(Dependent.class) ||
+ scopeType.equals(Singleton.class);
+ }
+
+
+ @Override
+ public void destroy(Object destroyObject)
+ {
+ requestContext.set(null);
+ sessionContext.set(null);
+ conversationContext.set(null);
+ dependentContext.set(null);
+ singletonContext.set(null);
+
+ requestContext.remove();
+ sessionContext.remove();
+ conversationContext.remove();
+ dependentContext.remove();
+ singletonContext.remove();
+ }
+
+
+ private Context getCurrentApplicationContext()
+ {
+ return applicationContext;
+ }
+
+
+ private Context getCurrentConversationContext()
+ {
+ return conversationContext.get();
+ }
+
+
+ private Context getCurrentDependentContext()
+ {
+ if(dependentContext.get() == null)
+ {
+ dependentContext.set(new DependentContext());
+ }
+
+ return dependentContext.get();
+ }
+
+
+ private Context getCurrentRequestContext()
+ {
+ return requestContext.get();
+ }
+
+
+ private Context getCurrentSessionContext()
+ {
+ return sessionContext.get();
+ }
+
+
+ private Context getCurrentSingletonContext()
+ {
+ return singletonContext.get();
+ }
+
+
+ private void startApplicationContext(Object instance)
+ {
+ ApplicationContext ctx = new ApplicationContext();
+ ctx.setActive(true);
+
+ applicationContext = ctx;
+ }
+
+
+ private void startConversationContext(Object object)
+ {
+ ConversationContext ctx = new ConversationContext();
+ ctx.setActive(true);
+
+ conversationContext.set(ctx);
+
+ }
+
+
+ private void startRequestContext(Object instance)
+ {
+
+ RequestContext ctx = new RequestContext();
+ ctx.setActive(true);
+
+ requestContext.set(ctx);
+ }
+
+
+ private void startSessionContext(Object instance)
+ {
+ SessionContext ctx = new SessionContext();
+ ctx.setActive(true);
+
+ sessionContext.set(ctx);
+ }
+
+
+ private void startSingletonContext(Object object)
+ {
+
+ SingletonContext ctx = new SingletonContext();
+ ctx.setActive(true);
+
+ singletonContext.set(ctx);
+ }
+
+
+ private void stopApplicationContext(Object object)
+ {
+ if(applicationContext != null)
+ {
+ applicationContext.destroy();
+ applicationContext = null;
+
+ // this is needed to get rid of ApplicationScoped beans which are cached inside the proxies...
+ WebBeansContext.currentInstance().getBeanManagerImpl().clearCacheProxies();
+ }
+ }
+
+
+ private void stopConversationContext(Object object)
+ {
+ if(conversationContext.get() != null)
+ {
+ conversationContext.get().destroy();
+ }
+
+ conversationContext.set(null);
+ conversationContext.remove();
+ }
+
+
+ private void stopRequestContext(Object instance)
+ {
+ if(requestContext.get() != null)
+ {
+ requestContext.get().destroy();
+ }
+
+ requestContext.set(null);
+ requestContext.remove();
+ }
+
+
+ private void stopSessionContext(Object instance)
+ {
+ if(sessionContext.get() != null)
+ {
+ sessionContext.get().destroy();
+ }
+
+ sessionContext.set(null);
+ sessionContext.remove();
+ }
+
+
+ private void stopSingletonContext(Object object)
+ {
+ if(singletonContext.get() != null)
+ {
+ singletonContext.get().destroy();
+ }
+
+ singletonContext.set(null);
+ singletonContext.remove();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultJndiService.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultJndiService.java
new file mode 100644
index 0000000..ff316fc
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultJndiService.java
@@ -0,0 +1,74 @@
+/*
+ * 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.webbeans.corespi.se;
+
+import java.util.HashMap;
+
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.spi.JNDIService;
+
+/**
+ * SPI Implementation of the JNDIService.
+ * This version doesn't operate on a real JNDI context!
+ * Instead it will store the values to bind in a singleton Map.
+ * This is intended for all environments where
+ * the java:comp and java:app context canot be written to, e.g.
+ * because they are only readonly (tomcat, resin, jetty, ...) or
+ * don't exist at all (JDK standalone applications)
+ *
+ */
+public class DefaultJndiService implements JNDIService
+{
+
+ private HashMap<String, Object> jndiContent = new HashMap<String, Object>();
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void bind(String name, Object object) throws WebBeansException
+ {
+ jndiContent.put(name, object);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ public <T> T getObject(String name, Class<? extends T> expectedClass) throws WebBeansException
+ {
+ return (T) jndiContent.get(name);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void unbind(String name) throws WebBeansException
+ {
+ jndiContent.remove(name);
+ }
+
+ @Override
+ public <T> T lookup(String name, Class<? extends T> expectedClass)
+ {
+ return getObject(name, expectedClass);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultScannerService.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultScannerService.java
new file mode 100644
index 0000000..96aaa78
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultScannerService.java
@@ -0,0 +1,47 @@
+/*
+ * 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.webbeans.corespi.se;
+
+import org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery;
+import org.apache.webbeans.util.WebBeansUtil;
+
+public class DefaultScannerService extends AbstractMetaDataDiscovery
+{
+
+ public DefaultScannerService()
+ {
+ super();
+ }
+
+ @Override
+ protected void configure()
+ {
+ configureAnnotationDB();
+ }
+
+
+ private void configureAnnotationDB()
+ {
+ ClassLoader loader = WebBeansUtil.getCurrentClassLoader();
+ //Store collection of beans.xml's before scanning archives
+
+ findBeansXmlBases(META_INF_BEANS_XML, loader);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/corespi/security/ManagedSecurityService.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/corespi/security/ManagedSecurityService.java
new file mode 100644
index 0000000..2c0abce
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/corespi/security/ManagedSecurityService.java
@@ -0,0 +1,383 @@
+/*
+ * 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.webbeans.corespi.security;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.spi.SecurityService;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.Principal;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.Properties;
+
+/**
+ * This version of the {@link SecurityService} uses the java.lang.SecurityManager
+ * to check low level access to the underlying functions via doPriviliged blocks.
+ *
+ * The most secure way is to just copy the source over to your own class and configure
+ * it in openwebbeans.properties. This way you can add whatever security features
+ * you like to use.
+ */
+public class ManagedSecurityService implements SecurityService
+{
+ private static final int METHOD_CLASS_GETDECLAREDCONSTRUCTOR = 0x01;
+
+ private static final int METHOD_CLASS_GETDECLAREDCONSTRUCTORS = 0x02;
+
+ private static final int METHOD_CLASS_GETDECLAREDMETHOD = 0x03;
+
+ private static final int METHOD_CLASS_GETDECLAREDMETHODS = 0x04;
+
+ private static final int METHOD_CLASS_GETDECLAREDFIELD = 0x05;
+
+ private static final int METHOD_CLASS_GETDECLAREDFIELDS = 0x06;
+
+ private static final int METHOD_CLASS_GETCONSTRUCTOR = 0x07;
+
+ private static final PrivilegedActionGetSystemProperties SYSTEM_PROPERTY_ACTION = new PrivilegedActionGetSystemProperties();
+
+
+ public ManagedSecurityService()
+ {
+ // we need to make sure that only WebBeansContext gets used to create us!
+ StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
+
+ // in the Sun Java VM-1.6 the parent ct is alwasys entry [6]
+ // but we cannot rely on that because it might differ for
+ // other VMs.
+ boolean isCalledFromWebBeansContext = false;
+ for (int i = 3; i < 20; i++)
+ {
+ String declaringClass = stackTrace[i].getClassName();
+ String methodName = stackTrace[i].getMethodName();
+ if (declaringClass.equals(WebBeansContext.class.getName()) &&
+ methodName.equals("<init>"))
+ {
+ isCalledFromWebBeansContext = true;
+ break;
+ }
+ }
+ if (!isCalledFromWebBeansContext)
+ {
+ throw new SecurityException("ManagedSecurityService must directly get created by WebBeansContext!");
+ }
+
+ // we also need to make sure that this very class didn't get subclassed
+ // to prevent man in the middle attacks
+ if (getClass() != ManagedSecurityService.class)
+ {
+ throw new SecurityException("ManagedSecurityService must not get subclassed!");
+ }
+ }
+
+ @Override
+ public Principal getCurrentPrincipal()
+ {
+ // no pricipal by default
+ return null;
+ }
+
+ @Override
+ public <T> Constructor<T> doPrivilegedGetDeclaredConstructor(Class<T> clazz, Class<?>... parameterTypes)
+ {
+ Object obj = AccessController.doPrivileged(
+ new PrivilegedActionForClass(clazz, parameterTypes, METHOD_CLASS_GETDECLAREDCONSTRUCTOR));
+ if (obj instanceof NoSuchMethodException)
+ {
+ return null;
+ }
+ return (Constructor<T>)obj;
+ }
+
+ @Override
+ public <T> Constructor<T> doPrivilegedGetConstructor(Class<T> clazz, Class<?>... parameterTypes)
+ {
+ Object obj = AccessController.doPrivileged(
+ new PrivilegedActionForClass(clazz, parameterTypes, METHOD_CLASS_GETCONSTRUCTOR));
+ if (obj instanceof NoSuchMethodException)
+ {
+ return null;
+ }
+ return (Constructor<T>)obj;
+ }
+
+ @Override
+ public <T> Constructor<?>[] doPrivilegedGetDeclaredConstructors(Class<T> clazz)
+ {
+ Object obj = AccessController.doPrivileged(
+ new PrivilegedActionForClass(clazz, null, METHOD_CLASS_GETDECLAREDCONSTRUCTORS));
+ return (Constructor<T>[])obj;
+ }
+
+ @Override
+ public <T> Method doPrivilegedGetDeclaredMethod(Class<T> clazz, String name, Class<?>... parameterTypes)
+ {
+ Object obj = AccessController.doPrivileged(
+ new PrivilegedActionForClass(clazz, new Object[] {name, parameterTypes}, METHOD_CLASS_GETDECLAREDMETHOD));
+ if (obj instanceof NoSuchMethodException)
+ {
+ return null;
+ }
+ return (Method)obj;
+ }
+
+ @Override
+ public <T> Method[] doPrivilegedGetDeclaredMethods(Class<T> clazz)
+ {
+ Object obj = AccessController.doPrivileged(
+ new PrivilegedActionForClass(clazz, null, METHOD_CLASS_GETDECLAREDMETHODS));
+ return (Method[])obj;
+ }
+
+ @Override
+ public <T> Field doPrivilegedGetDeclaredField(Class<T> clazz, String name)
+ {
+ Object obj = AccessController.doPrivileged(
+ new PrivilegedActionForClass(clazz, name, METHOD_CLASS_GETDECLAREDFIELD));
+ if (obj instanceof NoSuchFieldException)
+ {
+ return null;
+ }
+ return (Field)obj;
+ }
+
+ @Override
+ public <T> Field[] doPrivilegedGetDeclaredFields(Class<T> clazz)
+ {
+ Object obj = AccessController.doPrivileged(
+ new PrivilegedActionForClass(clazz, null, METHOD_CLASS_GETDECLAREDFIELDS));
+ return (Field[])obj;
+ }
+
+ @Override
+ public void doPrivilegedSetAccessible(AccessibleObject obj, boolean flag)
+ {
+ AccessController.doPrivileged(new PrivilegedActionForSetAccessible(obj, flag));
+ }
+
+ @Override
+ public boolean doPrivilegedIsAccessible(AccessibleObject obj)
+ {
+ return (Boolean) AccessController.doPrivileged(new PrivilegedActionForIsAccessible(obj));
+ }
+
+ @Override
+ public <T> T doPrivilegedObjectCreate(Class<T> clazz) throws PrivilegedActionException, IllegalAccessException, InstantiationException
+ {
+ return (T) AccessController.doPrivileged(new PrivilegedActionForObjectCreation(clazz));
+ }
+
+ @Override
+ public void doPrivilegedSetSystemProperty(String propertyName, String value)
+ {
+ AccessController.doPrivileged(new PrivilegedActionForSetProperty(propertyName, value));
+ }
+
+ @Override
+ public String doPrivilegedGetSystemProperty(String propertyName, String defaultValue)
+ {
+ return AccessController.doPrivileged(new PrivilegedActionForProperty(propertyName, defaultValue));
+ }
+
+ @Override
+ public Properties doPrivilegedGetSystemProperties()
+ {
+ return AccessController.doPrivileged(SYSTEM_PROPERTY_ACTION);
+ }
+
+
+ // the following block contains internal wrapper classes for doPrivileged actions
+
+ protected static class PrivilegedActionForClass implements PrivilegedAction<Object>
+ {
+ private Class<?> clazz;
+
+ private Object parameters;
+
+ private int method;
+
+ protected PrivilegedActionForClass(Class<?> clazz, Object parameters, int method)
+ {
+ this.clazz = clazz;
+ this.parameters = parameters;
+ this.method = method;
+ }
+
+ @Override
+ public Object run()
+ {
+ try
+ {
+ switch (method)
+ {
+ case METHOD_CLASS_GETDECLAREDCONSTRUCTOR:
+ return clazz.getDeclaredConstructor((Class<?>[])parameters);
+ case METHOD_CLASS_GETDECLAREDCONSTRUCTORS:
+ return clazz.getDeclaredConstructors();
+ case METHOD_CLASS_GETDECLAREDMETHOD:
+ String name = (String)((Object[])parameters)[0];
+ Class<?>[] realParameters = (Class<?>[])((Object[])parameters)[1];
+ return clazz.getDeclaredMethod(name, realParameters);
+ case METHOD_CLASS_GETDECLAREDMETHODS:
+ return clazz.getDeclaredMethods();
+ case METHOD_CLASS_GETDECLAREDFIELD:
+ return clazz.getDeclaredField((String)parameters);
+ case METHOD_CLASS_GETDECLAREDFIELDS:
+ return clazz.getDeclaredFields();
+ case METHOD_CLASS_GETCONSTRUCTOR:
+ return clazz.getConstructor((Class<?>[])parameters);
+ default:
+ return new WebBeansException("unknown security method: " + method);
+ }
+ }
+ catch (Exception exception)
+ {
+ return exception;
+ }
+ }
+
+ }
+
+ protected static class PrivilegedActionForSetAccessible implements PrivilegedAction<Object>
+ {
+
+ private AccessibleObject object;
+
+ private boolean flag;
+
+ protected PrivilegedActionForSetAccessible(AccessibleObject object, boolean flag)
+ {
+ this.object = object;
+ this.flag = flag;
+ }
+
+ @Override
+ public Object run()
+ {
+ object.setAccessible(flag);
+ return null;
+ }
+ }
+
+ protected static class PrivilegedActionForIsAccessible implements PrivilegedAction<Object>
+ {
+
+ private AccessibleObject object;
+
+ protected PrivilegedActionForIsAccessible(AccessibleObject object)
+ {
+ this.object = object;
+ }
+
+ @Override
+ public Object run()
+ {
+ return object.isAccessible();
+ }
+ }
+
+ protected static class PrivilegedActionForProperty implements PrivilegedAction<String>
+ {
+ private final String propertyName;
+
+ private final String defaultValue;
+
+ protected PrivilegedActionForProperty(String propertyName, String defaultValue)
+ {
+ this.propertyName = propertyName;
+ this.defaultValue = defaultValue;
+ }
+
+ @Override
+ public String run()
+ {
+ return System.getProperty(propertyName, defaultValue);
+ }
+
+ }
+
+ protected static class PrivilegedActionForSetProperty implements PrivilegedAction<Object>
+ {
+ private final String propertyName;
+
+ private final String value;
+
+ protected PrivilegedActionForSetProperty(String propertyName, String value)
+ {
+ this.propertyName = propertyName;
+ this.value = value;
+ }
+
+ @Override
+ public String run()
+ {
+ System.setProperty(propertyName, value);
+ return null;
+ }
+
+ }
+
+ protected static class PrivilegedActionGetSystemProperties implements PrivilegedAction<Properties>
+ {
+
+ @Override
+ public Properties run()
+ {
+ return System.getProperties();
+ }
+
+ }
+
+ protected static class PrivilegedActionForObjectCreation implements PrivilegedExceptionAction<Object>
+ {
+ private Class<?> clazz;
+
+ protected PrivilegedActionForObjectCreation(Class<?> clazz)
+ {
+ this.clazz = clazz;
+ }
+
+ @Override
+ public Object run() throws Exception
+ {
+ try
+ {
+ return clazz.newInstance();
+ }
+ catch (InstantiationException e)
+ {
+ throw e;
+ }
+ catch (IllegalAccessException e)
+ {
+ throw e;
+ }
+ }
+
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/corespi/security/SimpleSecurityService.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/corespi/security/SimpleSecurityService.java
new file mode 100644
index 0000000..991e540
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/corespi/security/SimpleSecurityService.java
@@ -0,0 +1,154 @@
+/*
+ * 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.webbeans.corespi.security;
+
+import org.apache.webbeans.spi.SecurityService;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.security.Principal;
+import java.security.PrivilegedActionException;
+import java.util.Properties;
+
+/**
+ * A version of the {@link SecurityService} which directly invokes
+ * the underlying Class methods instead of using a SecurityManager.
+ * This version is activated by default and intended for JavaSE and
+ * non EE-Server use.
+ */
+public class SimpleSecurityService implements SecurityService
+{
+ /**
+ * @return always <code>null</code> in the default implementation
+ */
+ @Override
+ public Principal getCurrentPrincipal()
+ {
+ return null;
+ }
+
+ @Override
+ public <T> Constructor<T> doPrivilegedGetDeclaredConstructor(Class<T> clazz, Class<?>... parameterTypes)
+ {
+ try
+ {
+ return clazz.getDeclaredConstructor(parameterTypes);
+ }
+ catch (NoSuchMethodException e)
+ {
+ return null;
+ }
+ }
+
+ @Override
+ public <T> Constructor<T> doPrivilegedGetConstructor(Class<T> clazz, Class<?>... parameterTypes)
+ {
+ try
+ {
+ return clazz.getConstructor(parameterTypes);
+ }
+ catch (NoSuchMethodException e)
+ {
+ return null;
+ }
+ }
+
+ @Override
+ public <T> Constructor<?>[] doPrivilegedGetDeclaredConstructors(Class<T> clazz)
+ {
+ return clazz.getDeclaredConstructors();
+ }
+
+ @Override
+ public <T> Method doPrivilegedGetDeclaredMethod(Class<T> clazz, String name, Class<?>... parameterTypes)
+ {
+ try
+ {
+ return clazz.getDeclaredMethod(name, parameterTypes);
+ }
+ catch (NoSuchMethodException e)
+ {
+ return null;
+ }
+ }
+
+ @Override
+ public <T> Method[] doPrivilegedGetDeclaredMethods(Class<T> clazz)
+ {
+ return clazz.getDeclaredMethods();
+ }
+
+ @Override
+ public <T> Field doPrivilegedGetDeclaredField(Class<T> clazz, String name)
+ {
+ try
+ {
+ return clazz.getDeclaredField(name);
+ }
+ catch (NoSuchFieldException e)
+ {
+ return null;
+ }
+ }
+
+ @Override
+ public <T> Field[] doPrivilegedGetDeclaredFields(Class<T> clazz)
+ {
+ return clazz.getDeclaredFields();
+ }
+
+ @Override
+ public void doPrivilegedSetAccessible(AccessibleObject obj, boolean flag)
+ {
+ obj.setAccessible(flag);
+ }
+
+ @Override
+ public boolean doPrivilegedIsAccessible(AccessibleObject obj)
+ {
+ return obj.isAccessible();
+ }
+
+ @Override
+ public <T> T doPrivilegedObjectCreate(Class<T> clazz)
+ throws PrivilegedActionException, IllegalAccessException, InstantiationException
+ {
+ return clazz.newInstance();
+ }
+
+ @Override
+ public void doPrivilegedSetSystemProperty(String propertyName, String value)
+ {
+ System.setProperty(propertyName, value);
+ }
+
+ @Override
+ public String doPrivilegedGetSystemProperty(String propertyName, String defaultValue)
+ {
+ return System.getProperty(propertyName, defaultValue);
+ }
+
+ @Override
+ public Properties doPrivilegedGetSystemProperties()
+ {
+ return System.getProperties();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorComparator.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorComparator.java
new file mode 100644
index 0000000..2fd519b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorComparator.java
@@ -0,0 +1,56 @@
+/*
+ * 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.webbeans.decorator;
+
+import java.util.Comparator;
+
+import javax.enterprise.inject.spi.Decorator;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+public class DecoratorComparator<T> implements Comparator<Decorator<T>>
+{
+
+ /** default serial version UID */
+ private static final long serialVersionUID = 1L;
+
+ private final WebBeansContext webBeansContext;
+
+ public DecoratorComparator(WebBeansContext webBeansContext)
+ {
+ this.webBeansContext = webBeansContext;
+ }
+
+ @Override
+ public int compare(Decorator<T> o1, Decorator<T> o2)
+ {
+ if (o1.equals(o2))
+ {
+ return 0;
+ }
+ else
+ {
+ Class<?> o1Clazz = o1.getBeanClass();
+ Class<?> o2Clazz = o2.getBeanClass();
+
+ return webBeansContext.getDecoratorsManager().compare(o1Clazz, o2Clazz);
+ }
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java
new file mode 100644
index 0000000..bb9e427
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java
@@ -0,0 +1,241 @@
+/*
+ * 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.webbeans.decorator;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.CopyOnWriteArraySet;
+
+import javax.enterprise.inject.spi.Decorator;
+
+import org.apache.webbeans.annotation.DefaultLiteral;
+import org.apache.webbeans.component.OwbBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.Asserts;
+import org.apache.webbeans.util.GenericsUtil;
+
+public class DecoratorsManager
+{
+ private List<Class<?>> enabledDecorators = new CopyOnWriteArrayList<Class<?>>();
+ private final WebBeansContext webBeansContext;
+
+ /**
+ * Additional decorator classes added by Extensions
+ */
+ private List<Class<?>> additionalDecoratorClasses = new ArrayList<Class<?>>();
+
+ /**
+ * Active and enabled decorators
+ */
+ private Set<Decorator<?>> webBeansDecorators = new CopyOnWriteArraySet<Decorator<?>>();
+
+
+
+ public DecoratorsManager(WebBeansContext webBeansContext)
+ {
+ this.webBeansContext = webBeansContext;
+ }
+
+ public void addEnabledDecorator(Class<?> decoratorClazz)
+ {
+ Asserts.assertNotNull(decoratorClazz, "decoratorClazz parameter can not be emtpy");
+ if (!enabledDecorators.contains(decoratorClazz))
+ {
+ enabledDecorators.add(decoratorClazz);
+ }
+ }
+
+ public int compare(Class<?> src, Class<?> target)
+ {
+ Asserts.assertNotNull(src, "src parameter can not be null");
+ Asserts.assertNotNull(target, "target parameter can not be null");
+
+ int srcIndex = enabledDecorators.indexOf(src);
+ int targetIndex = enabledDecorators.indexOf(target);
+
+ if (srcIndex == -1 || targetIndex == -1)
+ {
+ throw new IllegalArgumentException("One of the compare class of the list : [" + src.getName() + "," + target.getName() + "]"
+ + " is not contained in the enabled decorators list!");
+ }
+
+ if (srcIndex == targetIndex)
+ {
+ return 0;
+ }
+ else if (srcIndex < targetIndex)
+ {
+ return -1;
+ }
+ else
+ {
+ return 1;
+ }
+ }
+
+ public boolean isDecoratorEnabled(Class<?> decoratorClazz)
+ {
+ Asserts.nullCheckForClass(decoratorClazz, "decoratorClazz can not be null");
+
+ return enabledDecorators.contains(decoratorClazz);
+ }
+
+ public void validateDecoratorClasses()
+ {
+ for(Class<?> decoratorClazz : enabledDecorators)
+ {
+ //Validate decorator classes
+ if(!decoratorClazz.isAnnotationPresent(javax.decorator.Decorator.class) && !containsCustomDecoratorClass(decoratorClazz))
+ {
+ throw new WebBeansConfigurationException("Given class : " + decoratorClazz + " is not a decorator class");
+ }
+ }
+ }
+
+ public void addCustomDecoratorClass(Class<?> clazz)
+ {
+ Asserts.nullCheckForClass(clazz);
+ additionalDecoratorClasses.add(clazz);
+ }
+
+ public boolean containsCustomDecoratorClass(Class<?> clazz)
+ {
+ Asserts.nullCheckForClass(clazz);
+ return additionalDecoratorClasses.contains(clazz);
+ }
+
+ public Set<Decorator<?>> getDecorators()
+ {
+ return webBeansDecorators;
+ }
+
+ public void addDecorator(Decorator decorator)
+ {
+ webBeansDecorators.add(decorator);
+ if (decorator instanceof OwbBean)
+ {
+ OwbBean<?> owbBean = (OwbBean<?>)decorator;
+
+ if(owbBean.isPassivationCapable())
+ {
+ webBeansContext.getBeanManagerImpl().addPassivationInfo(decorator);
+ }
+ }
+ }
+
+ public Set<Decorator<?>> findDeployedWebBeansDecorator(Set<Type> apiTypes, Annotation... anns)
+ {
+ Set<Decorator<?>> set = new HashSet<Decorator<?>>();
+
+ List<Class<? extends Annotation>> bindingTypes = new ArrayList<Class<? extends Annotation>>();
+ Set<Annotation> listAnnot = new HashSet<Annotation>();
+ for (Annotation ann : anns)
+ {
+ bindingTypes.add(ann.annotationType());
+ listAnnot.add(ann);
+ }
+
+ if (listAnnot.isEmpty())
+ {
+ listAnnot.add(DefaultLiteral.INSTANCE);
+ }
+
+ for (Decorator<?> decorator : getDecorators())
+ {
+ if (isDecoratorMatch(decorator, apiTypes, listAnnot))
+ {
+ set.add(decorator);
+ }
+ }
+
+ return set;
+
+ }
+
+ private boolean isDecoratorMatch(Decorator<?> decorator, Set<Type> apiTypes, Set<Annotation> annotations)
+ {
+ // 8.3.1
+ if (!apiTypesMatchDelegateType(decorator, apiTypes))
+ {
+ return false;
+ }
+
+ for (Annotation bindingType : decorator.getDelegateQualifiers())
+ {
+ if (!bindingMatchesAnnotations(bindingType, annotations))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private boolean bindingMatchesAnnotations(Annotation bindingType, Set<Annotation> annotations)
+ {
+
+ for (Annotation annot : annotations)
+ {
+ if (AnnotationUtil.isCdiAnnotationEqual(annot, bindingType))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Helper method to check if any of a list of Types are assignable to the
+ * delegate type.
+ *
+ * @param apiTypes Set of apiTypes to check against the delegate type
+ * @return true if one of the types is assignable to the delegate type
+ */
+ private boolean apiTypesMatchDelegateType(Decorator<?> decorator, Set<Type> apiTypes)
+ {
+ boolean ok = false;
+ for (Type apiType : apiTypes)
+ {
+ if (GenericsUtil.satisfiesDependency(true, decorator.getDelegateType(), apiType))
+ {
+ ok = true;
+ break;
+ }
+ }
+
+ return ok;
+ }
+
+
+
+
+ public void clear()
+ {
+ additionalDecoratorClasses.clear();
+ webBeansDecorators.clear();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeManager.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeManager.java
new file mode 100644
index 0000000..d5d9705
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeManager.java
@@ -0,0 +1,76 @@
+/*
+ * 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.webbeans.deployment;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.webbeans.deployment.stereotype.IStereoTypeModel;
+import org.apache.webbeans.util.Asserts;
+
+/**
+ * Manager for the {@link StereoTypeModel} instances.
+ * <p>
+ * It keeps map with name to model.
+ * </p>
+ * @version $Rev$ $Date$
+ *
+ */
+public class StereoTypeManager
+{
+ /**Stereotype model instances, stereotype mode name to model instance*/
+ private Map<String, IStereoTypeModel> stereoTypeMap = new ConcurrentHashMap<String, IStereoTypeModel>();
+
+ /**
+ * Default constructor
+ */
+ public StereoTypeManager()
+ {
+
+ }
+
+ /**
+ * Adds new steretype model instance.
+ * @param model new model
+ */
+ public void addStereoTypeModel(IStereoTypeModel model)
+ {
+ Asserts.assertNotNull(model, "model parameter can not be null");
+
+ stereoTypeMap.put(model.getName(), model);
+ }
+
+ /**
+ * Returns model with given name.
+ * @param modelName stereotype model name
+ * @return model with given name
+ */
+ public IStereoTypeModel getStereoTypeModel(String modelName)
+ {
+ Asserts.assertNotNull(modelName, "modelName parameter can not be null");
+
+ if (stereoTypeMap.containsKey(modelName))
+ {
+ return stereoTypeMap.get(modelName);
+ }
+
+ return null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeModel.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeModel.java
new file mode 100644
index 0000000..6f087cf
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeModel.java
@@ -0,0 +1,271 @@
+/*
+ * 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.webbeans.deployment;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.enterprise.context.NormalScope;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.Typed;
+import javax.inject.Named;
+import javax.inject.Scope;
+
+import org.apache.webbeans.annotation.AnnotationManager;
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.deployment.stereotype.IStereoTypeModel;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.util.AnnotationUtil;
+
+/**
+ * Default implementation of the {@link IStereoTypeModel} contract.
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public class StereoTypeModel implements IStereoTypeModel
+{
+ /** Name of the stereotype model. It is usd for registering model with StereoTypeManager */
+ private String name;
+
+ /** Default deployment type */
+ private Annotation defaultDeploymentType;
+
+ /** Default scope type */
+ private Annotation defaultScopeType;
+
+ /** Interceptor Bindings */
+ private Set<Annotation> interceptorBindingTypes = new HashSet<Annotation>();
+
+ /** Inherit StereoType annotations */
+ private Set<Annotation> inherits = new HashSet<Annotation>();
+
+ private static final Logger logger = WebBeansLoggerFacade.getLogger(StereoTypeModel.class);
+
+ /**
+ * Creates a new instance of the stereotype model for
+ * given class.
+ * @param webBeansContext
+ * @param clazz stereotype type
+ */
+ public StereoTypeModel(WebBeansContext webBeansContext, Class<? extends Annotation> clazz)
+ {
+ this(webBeansContext, clazz, clazz.getDeclaredAnnotations());
+ }
+
+ public StereoTypeModel(WebBeansContext webBeansContext, Class<? extends Annotation> clazz, Annotation[] annotationDefs)
+ {
+ name = clazz.getName();
+
+ configAnnotations(clazz, webBeansContext, annotationDefs);
+
+ }
+
+ private void configAnnotations(Class<? extends Annotation> clazz, WebBeansContext webBeansContext, Annotation... annotations)
+ {
+ if(clazz.getAnnotation(Typed.class) != null)
+ {
+ if(logger.isLoggable(Level.WARNING))
+ {
+ logger.log(Level.WARNING, OWBLogConst.WARN_0016, clazz.getName());
+ }
+ }
+
+ final AnnotationManager annotationManager = webBeansContext.getAnnotationManager();
+ Annotation[] qualifiers = annotationManager.getQualifierAnnotations(annotations);
+
+ if(qualifiers != null)
+ {
+ for(Annotation qualifier : qualifiers)
+ {
+ if(qualifier.annotationType() == Default.class)
+ {
+ return;
+ }
+
+ if(qualifier.annotationType() != Named.class)
+ {
+ if(logger.isLoggable(Level.WARNING))
+ {
+ logger.log(Level.WARNING, OWBLogConst.WARN_0017, WebBeansLoggerFacade.args(clazz.getName(),qualifier.annotationType().getName()));
+ }
+ }
+ }
+ }
+
+ if (AnnotationUtil.hasMetaAnnotation(annotations, NormalScope.class))
+ {
+ defaultScopeType = AnnotationUtil.getMetaAnnotations(annotations, NormalScope.class)[0];
+ }
+
+ if (AnnotationUtil.hasMetaAnnotation(annotations, Scope.class))
+ {
+ defaultScopeType = AnnotationUtil.getMetaAnnotations(annotations, Scope.class)[0];
+ }
+
+ if (annotationManager.hasInterceptorBindingMetaAnnotation(annotations))
+ {
+ Annotation[] ibs =
+ annotationManager.getInterceptorBindingMetaAnnotations(annotations);
+ for (Annotation ann : ibs)
+ {
+ interceptorBindingTypes.add(ann);
+ }
+ }
+
+ if (annotationManager.hasStereoTypeMetaAnnotation(annotations))
+ {
+ Annotation[] isy =
+ annotationManager.getStereotypeMetaAnnotations(annotations);
+
+ Target outerStereo = clazz.getAnnotation(Target.class);
+ for (Annotation is : isy)
+ {
+ Target innerStereo = is.annotationType().getAnnotation(Target.class);
+
+ ElementType[] innerValues = innerStereo.value();
+ ElementType[] outerValues = outerStereo.value();
+
+ for (ElementType innerValue : innerValues)
+ {
+ if (innerValue.equals(ElementType.METHOD) || innerValue.equals(ElementType.FIELD))
+ {
+ for (ElementType outerValue : outerValues)
+ {
+ if (outerValue.equals(ElementType.TYPE) && outerValues.length == 1)
+ {
+ throw new WebBeansConfigurationException("Inherited StereoType with class name : " + clazz.getName()
+ + " must have compatible @Target annotation with Stereotype class name : " + clazz.getName());
+ }
+ }
+ }
+ else if (innerValue.equals(ElementType.TYPE) && innerValues.length == 1)
+ {
+ for (ElementType outerValue : outerValues)
+ {
+ if (outerValue.equals(ElementType.METHOD) || outerValue.equals(ElementType.FIELD))
+ {
+ throw new WebBeansConfigurationException("Inherited StereoType with class name : " + clazz.getName()
+ + " must have compatible @Target annotation with Stereotype class name : " + clazz.getName());
+ }
+ }
+ }
+ }
+
+ inherits.add(is);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Annotation getDefaultDeploymentType()
+ {
+ return defaultDeploymentType;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Annotation getDefaultScopeType()
+ {
+ return defaultScopeType;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<Annotation> getInterceptorBindingTypes()
+ {
+ return interceptorBindingTypes;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<Annotation> getInheritedStereoTypes()
+ {
+ return inherits;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ if (!(obj instanceof StereoTypeModel))
+ {
+ return false;
+ }
+
+ if(obj == null)
+ {
+ return false;
+ }
+
+ StereoTypeModel model = (StereoTypeModel) obj;
+
+ return model.name.equals(name);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int hashCode()
+ {
+ return name.hashCode();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/deployment/stereotype/IStereoTypeModel.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/deployment/stereotype/IStereoTypeModel.java
new file mode 100644
index 0000000..3874754
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/deployment/stereotype/IStereoTypeModel.java
@@ -0,0 +1,70 @@
+/*
+ * 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.webbeans.deployment.stereotype;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+/**
+ * Stereotype model contract.
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public interface IStereoTypeModel
+{
+ /**
+ * Returns name of the stereotype. As default,
+ * its class name.
+ * @return the name
+ */
+ public String getName();
+
+ /**
+ * Sets name.
+ * @param name the name to set
+ */
+ public void setName(String name);
+
+ /**
+ * Gets default deployment type.
+ * @return the defaultDeploymentType
+ */
+ public Annotation getDefaultDeploymentType();
+
+ /**
+ * Sets default deployment type.
+ * @return the defaultScopeType
+ */
+ public Annotation getDefaultScopeType();
+
+ /**
+ * Returns set of interceptor binding that are
+ * definen by the stereotype.
+ * @return set of interceptor bindings.
+ */
+ public Set<Annotation> getInterceptorBindingTypes();
+
+ /**
+ * Returns a set of inherited stereotypes.
+ * @return set of inherited stereotypes.
+ */
+ public Set<Annotation> getInheritedStereoTypes();
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/el/ELContextStore.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/el/ELContextStore.java
new file mode 100644
index 0000000..c3835a6
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/el/ELContextStore.java
@@ -0,0 +1,209 @@
+/*
+ * 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.webbeans.el;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+/**
+ * The ELContextStore serves two different purposes
+ *
+ * <ol>
+ * <li>
+ * Store {@link javax.enterprise.context.Dependent} objects of the same
+ * invocation. See spec section 6.4.3. <i>Dependent pseudo-scope and Unified EL</i>.
+ * This gets cleaned up with {@link #destroyDependents()} after the whole Expression
+ * got scanned.
+ * </li>
+ * <li>
+ * Store the Contextual Reference for each name per request thread. This is a performance
+ * tuning strategy, because creating a {@link org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler}
+ * for each and every EL call is very expensive. This needs to be cleaned up with
+ * {@link #destroyELContextStore()} at the end of each request.
+ * </li>
+ * </ol>
+ */
+public class ELContextStore
+{
+ private static ThreadLocal<ELContextStore> contextStores = new ThreadLocal<ELContextStore>();
+
+ /**
+ * @param createIfNotExist if <code>false</code> doesn't create a new ELContextStore if none exists
+ * @return
+ */
+ public static ELContextStore getInstance(boolean createIfNotExist)
+ {
+ ELContextStore store = contextStores.get();
+
+ if (store == null && createIfNotExist)
+ {
+ store = new ELContextStore();
+ contextStores.set(store);
+ }
+
+ return store;
+ }
+
+ /**
+ * The same Expression must get same instances of @Dependent beans
+ */
+ private Map<Bean<?>, CreationalStore> dependentObjects = new HashMap<Bean<?>, CreationalStore>();
+ private Map<String, Bean<?>> beanNameToDependentBeanMapping = new HashMap<String, Bean<?>>();
+
+ /**
+ * Cache for resolved proxies of @NormalScoped beans. This heavily speeds up pages with
+ * multiple ELs for the same bean. A typical bean invoke through an EL only accesses 1
+ * property. If we wouldn't cache this, every EL call would create a new proxy and
+ * drops it after the EL.
+ */
+ private Map<String, Object> normalScopedObjects = new HashMap<String, Object>();
+
+ public Object findBeanByName(String name)
+ {
+ Object cachedBean = normalScopedObjects.get(name);
+
+ if(cachedBean != null)
+ {
+ return cachedBean;
+ }
+
+ Bean<?> dependentBean = beanNameToDependentBeanMapping.get(name);
+
+ if(dependentBean == null)
+ {
+ return null;
+ }
+ CreationalStore cs = dependentObjects.get(dependentBean);
+ if (cs != null)
+ {
+ return cs.getObject();
+ }
+
+ return null;
+ }
+
+ private static class CreationalStore
+ {
+ private Object object;
+
+ private CreationalContext<?> creational;
+
+ public CreationalStore(Object object, CreationalContext<?> creational)
+ {
+ this.object = object;
+ this.creational = creational;
+ }
+
+ /**
+ * @return the object
+ */
+ public Object getObject()
+ {
+ return object;
+ }
+
+ /**
+ * @return the creational
+ */
+ public CreationalContext<?> getCreational()
+ {
+ return creational;
+ }
+
+
+ }
+
+ /**
+ * This class can only get constructed via {@link #getInstance(boolean)}
+ */
+ private ELContextStore()
+ {
+ }
+
+ /**
+ * Add a @Dependent scoped bean for later use in the <b>same</b> EL.
+ * See spec section 6.4.3. <i>Dependent pseudo-scope and Unified EL</i>.
+ * @param bean
+ * @param dependent
+ * @param creationalContext
+ */
+ public void addDependent(Bean<?> bean, Object dependent, CreationalContext<?> creationalContext)
+ {
+ dependentObjects.put(bean, new CreationalStore(dependent, creationalContext));
+ beanNameToDependentBeanMapping.put(bean.getName(), bean);
+ }
+
+ /**
+ * @see #addDependent(Bean, Object, CreationalContext)
+ * @param bean
+ * @return the previously used dependent bean or <code>null</code>
+ */
+ public Object getDependent(Bean<?> bean)
+ {
+ CreationalStore sc = dependentObjects.get(bean);
+
+ return sc != null ? sc.getObject() : null;
+ }
+
+ /**
+ * We cache resolved @NormalScoped bean proxies on the same for speeding up EL.
+ * @param beanName
+ */
+ public void addNormalScoped(String beanName, Object contextualInstance)
+ {
+ normalScopedObjects.put(beanName, contextualInstance);
+ }
+
+ /**
+ * This method have to be called after the EL parsing to cleanup the cache
+ * for @Dependent scoped beans.
+ */
+ public void destroyDependents()
+ {
+ if (dependentObjects.size() > 0)
+ {
+ Set<Bean<?>> beans = dependentObjects.keySet();
+ for(Bean<?> bean : beans)
+ {
+ Bean<Object> o = (Bean<Object>)bean;
+ CreationalStore store = dependentObjects.get(bean);
+ o.destroy(store.getObject(), (CreationalContext<Object>)store.getCreational());
+ }
+
+ dependentObjects.clear();
+ }
+ beanNameToDependentBeanMapping.clear();
+ }
+
+ /**
+ * This needs to be called at the end of each request.
+ * Because after the request ends, a server might reuse
+ * the Thread to serve other requests (from other WebApps)
+ */
+ public void destroyELContextStore()
+ {
+ normalScopedObjects.clear();
+ contextStores.set(null);
+ contextStores.remove();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/event/EventImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/event/EventImpl.java
new file mode 100644
index 0000000..9043556
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/event/EventImpl.java
@@ -0,0 +1,162 @@
+/*
+ * 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.webbeans.event;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.util.TypeLiteral;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.util.ClassUtil;
+import org.apache.webbeans.util.OwbCustomObjectInputStream;
+import org.apache.webbeans.util.WebBeansUtil;
+
+/**
+ * Event implementation.
+ *
+ * @param <T> event type
+ * @see Event
+ */
+public class EventImpl<T> implements Event<T>, Serializable
+{
+ private static final long serialVersionUID = -9035218380365451350L;
+
+ /**Event binding types*/
+ private Annotation[] injectedBindings;
+
+ /**Event types*/
+ private Type eventType;
+
+ /**injection point of the event*/
+ private InjectionPoint injectionPoint;
+
+ private transient WebBeansContext webBeansContext;
+
+ /**
+ * Creates a new event.
+ *
+ * @param injectedBindings event bindings
+ * @param eventType event type
+ * @param webBeansContext
+ */
+ public EventImpl(Annotation[] injectedBindings, Type eventType, InjectionPoint injectionPoint, WebBeansContext webBeansContext)
+ {
+ this.webBeansContext = webBeansContext;
+ this.injectedBindings = injectedBindings;
+ this.eventType = eventType;
+ this.injectionPoint = injectionPoint;
+ }
+
+ /**
+ * Fires event with given event object.
+ */
+ @Override
+ public void fire(T event)
+ {
+ webBeansContext.getBeanManagerImpl().fireEvent(event, new EventMetadataImpl(eventType, injectionPoint, injectedBindings), false);
+ }
+
+ /**
+ * Returns total binding annotations.
+ *
+ * @param annotations new annotations
+ * @return total binding annotations
+ */
+ private Annotation[] getEventBindings(Annotation... annotations)
+ {
+ webBeansContext.getAnnotationManager().checkQualifierConditions(annotations);
+
+ Set<Annotation> eventBindings = new HashSet<Annotation>();
+ Collections.addAll(eventBindings, injectedBindings);
+ Collections.addAll(eventBindings, annotations);
+
+ return eventBindings.toArray(new Annotation[eventBindings.size()]);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Event<T> select(Annotation... bindings)
+ {
+ Event<T> sub = new EventImpl<T>(getEventBindings(bindings), eventType, injectionPoint, webBeansContext);
+
+ return sub;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public <U extends T> Event<U> select(Class<U> subtype, Annotation... bindings)
+ {
+ if(ClassUtil.isDefinitionContainsTypeVariables(subtype))
+ {
+ throw new IllegalArgumentException("Class : " + subtype + " cannot contain type variable");
+ }
+
+ Type sub = subtype;
+
+ if(sub == null)
+ {
+ sub = eventType;
+ }
+
+ Event<U> subEvent = new EventImpl<U>(getEventBindings(bindings),sub, injectionPoint, webBeansContext);
+
+ return subEvent;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public <U extends T> Event<U> select(TypeLiteral<U> subtype, Annotation... bindings)
+ {
+ return select(subtype.getRawType(), bindings);
+ }
+
+ private void writeObject(java.io.ObjectOutputStream op) throws IOException
+ {
+ ObjectOutputStream oos = new ObjectOutputStream(op);
+ oos.writeObject(eventType);
+ oos.writeObject(injectedBindings);
+
+ oos.flush();
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException
+ {
+ final ObjectInputStream inputStream = new OwbCustomObjectInputStream(in, WebBeansUtil.getCurrentClassLoader());
+ eventType = (Type)inputStream.readObject();
+ injectedBindings = (Annotation[])inputStream.readObject();
+
+ webBeansContext = WebBeansContext.currentInstance();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/event/EventMetadata.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/event/EventMetadata.java
new file mode 100644
index 0000000..76565e0
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/event/EventMetadata.java
@@ -0,0 +1,50 @@
+/*
+ * 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.webbeans.event;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+
+/**
+ * This is a preview to CDI 1.1
+ * when we implement CDI 1.1 this interface can be removed
+ */
+public interface EventMetadata
+{
+
+ /**
+ * Get the qualifiers for which event payload was fired.
+ */
+ public Set<Annotation> getQualifiers();
+
+ /**
+ * Get the {@link InjectionPoint} from which the event fired, or
+ * <code>null</code> if it was fired from
+ * {@link javax.enterprise.inject.spi.BeanManager#fireEvent(Object, Annotation...)};
+ */
+ public InjectionPoint getInjectionPoint();
+
+ /**
+ * Returns the resolved event {@link Type}.
+ */
+ public Type getType();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/event/EventMetadataImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/event/EventMetadataImpl.java
new file mode 100644
index 0000000..f95c98e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/event/EventMetadataImpl.java
@@ -0,0 +1,81 @@
+/*
+ * 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.webbeans.event;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.apache.webbeans.annotation.AnyLiteral;
+import org.apache.webbeans.util.AnnotationUtil;
+
+public class EventMetadataImpl implements EventMetadata
+{
+
+ private final Type type;
+ private final InjectionPoint injectionPoint;
+ private final Set<Annotation> qualifiers;
+
+ public EventMetadataImpl(Type type, InjectionPoint injectionPoint, Annotation... qualifiers)
+ {
+ this.type = type;
+ this.injectionPoint = injectionPoint;
+ Set<Annotation> completeQualifiers;
+ if (qualifiers.length == 0)
+ {
+ completeQualifiers = AnnotationUtil.DEFAULT_AND_ANY_ANNOTATION;
+ }
+ else
+ {
+ completeQualifiers = new HashSet<Annotation>(Arrays.asList(qualifiers));
+ if (completeQualifiers.size() != qualifiers.length)
+ {
+ throw new IllegalArgumentException("duplicate qualifier");
+ }
+ if (!completeQualifiers.contains(AnyLiteral.INSTANCE))
+ {
+ completeQualifiers.add(AnyLiteral.INSTANCE);
+ }
+ }
+ this.qualifiers = Collections.unmodifiableSet(completeQualifiers);
+ }
+
+ @Override
+ public Type getType()
+ {
+ return type;
+ }
+
+ @Override
+ public InjectionPoint getInjectionPoint()
+ {
+ return injectionPoint;
+ }
+
+ @Override
+ public Set<Annotation> getQualifiers()
+ {
+ return qualifiers;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java
new file mode 100644
index 0000000..00ab570
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java
@@ -0,0 +1,147 @@
+/*
+ * 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.webbeans.event;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.event.Event;
+import javax.enterprise.event.Observes;
+import javax.enterprise.event.TransactionPhase;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.Asserts;
+import org.apache.webbeans.util.ClassUtil;
+
+public final class EventUtil
+{
+ private EventUtil()
+ {
+
+ }
+
+ public static void checkEventType(Class<?> eventType)
+ {
+ Asserts.assertNotNull(eventType, "eventType parameter can not be null");
+
+ if (ClassUtil.isDefinitionContainsTypeVariables(eventType))
+ {
+ throw new IllegalArgumentException("Event type : " + eventType.getName() + " can not be generic");
+ }
+ }
+
+ //expensive check needed by the TCK (EventBindingTypesTest#testFireEventWithNonRuntimeBindingTypeFails) - see OWB-798
+ public static void checkQualifierImplementations(Set<Annotation> qualifiers)
+ {
+ for (Annotation qualifier : qualifiers)
+ {
+ //This is added, because TCK Event tests for this.
+ Retention retention = qualifier.annotationType().getAnnotation(Retention.class);
+ RetentionPolicy policy = retention.value();
+ if(!policy.equals(RetentionPolicy.RUNTIME))
+ {
+ throw new IllegalArgumentException("Event qualifier RetentionPolicy must be RUNTIME for qualifier : " + qualifier.annotationType().getName());
+ }
+ }
+ }
+
+ public static void checkEventBindings(WebBeansContext webBeansContext, Set<Annotation> annotations)
+ {
+ webBeansContext.getAnnotationManager().checkQualifierConditions(annotations);
+ }
+
+ public static TransactionPhase getObserverMethodTransactionType(AnnotatedMethod<?> observerMethod)
+ {
+ Observes observes = AnnotationUtil.getAnnotatedMethodFirstParameterAnnotation(observerMethod, Observes.class);
+ if (observes != null)
+ {
+ return observes.during();
+ }
+
+ return null;
+ }
+
+ public static boolean checkObservableInjectionPointConditions(InjectionPoint injectionPoint)
+ {
+ Type type = injectionPoint.getType();
+
+ Class<?> candidateClazz = null;
+ if(type instanceof Class)
+ {
+ candidateClazz = (Class<?>)type;
+ }
+ else if(type instanceof ParameterizedType)
+ {
+ ParameterizedType pt = (ParameterizedType)type;
+ candidateClazz = (Class<?>)pt.getRawType();
+ }
+
+ if(!candidateClazz.equals(Event.class))
+ {
+ return false;
+ }
+
+ if (!ClassUtil.isParametrizedType(injectionPoint.getType()))
+ {
+ throw new WebBeansConfigurationException("@Observable field injection " + injectionPoint
+ + " must be ParametrizedType with actual type argument");
+ }
+ else
+ {
+ if(ClassUtil.isParametrizedType(injectionPoint.getType()))
+ {
+ ParameterizedType pt = (ParameterizedType)injectionPoint.getType();
+
+ Class<?> rawType = (Class<?>) pt.getRawType();
+
+ Type[] typeArgs = pt.getActualTypeArguments();
+
+ if(!(rawType.equals(Event.class)))
+ {
+ return false;
+ }
+ else
+ {
+ if(typeArgs.length != 1)
+ {
+ throw new IllegalArgumentException("@Observable field injection " + injectionPoint.toString()
+ + " must not have more than one actual type argument");
+ }
+ }
+ }
+ else
+ {
+ throw new IllegalArgumentException("@Observable field injection " + injectionPoint.toString()
+ + " must be defined as ParameterizedType with one actual type argument");
+ }
+ }
+
+ return true;
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
new file mode 100644
index 0000000..52fec92
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
@@ -0,0 +1,560 @@
+/*
+ * 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.webbeans.event;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.enterprise.event.ObserverException;
+import javax.enterprise.event.Observes;
+import javax.enterprise.event.Reception;
+import javax.enterprise.event.TransactionPhase;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ObserverMethod;
+import javax.enterprise.inject.spi.ProcessProducer;
+import javax.enterprise.util.TypeLiteral;
+
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.portable.events.generics.GenericBeanEvent;
+import org.apache.webbeans.portable.events.generics.GenericProducerObserverEvent;
+import org.apache.webbeans.spi.TransactionService;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.Asserts;
+import org.apache.webbeans.util.ClassUtil;
+import org.apache.webbeans.util.WebBeansUtil;
+
+@SuppressWarnings("unchecked")
+public final class NotificationManager
+{
+ private final Map<Type, Set<ObserverMethod<?>>> observers = new ConcurrentHashMap<Type, Set<ObserverMethod<?>>>();
+ private final WebBeansContext webBeansContext;
+
+ public NotificationManager(WebBeansContext webBeansContext)
+ {
+ this.webBeansContext = webBeansContext;
+ }
+
+ public <T> void addObserver(ObserverMethod<T> observer, Type eventType)
+ {
+ webBeansContext.getAnnotationManager().checkQualifierConditions(observer.getObservedQualifiers());
+
+ Set<ObserverMethod<?>> set = observers.get(eventType);
+ if (set == null)
+ {
+ set = new HashSet<ObserverMethod<?>>();
+ observers.put(eventType, set);
+ }
+
+ set.add(observer);
+ }
+
+ public <T> void addObserver(ObserverMethod<T> observer, TypeLiteral<T> typeLiteral)
+ {
+ EventUtil.checkEventType(typeLiteral.getRawType());
+
+ addObserver(observer, typeLiteral.getType());
+ }
+
+ /**
+ * <p>This method shall only be called for subclasses.
+ * It will disable all observer methods which are overridden
+ * in the given subclass.</p>
+ */
+ public void disableOverriddenObservers(Class<?> subClass)
+ {
+ for (Set<ObserverMethod<?>> observerMethods: observers.values())
+ {
+ for (Iterator<ObserverMethod<?>> i = observerMethods.iterator(); i.hasNext();)
+ {
+ ObserverMethod<?> observer = i.next();
+ if (observer instanceof ObserverMethodImpl)
+ {
+ AnnotatedMethod<?> observerMethod = ((ObserverMethodImpl<?>)observer).getObserverMethod();
+
+ //needs to be a subtype and not the class itself (otherwise all observer-methods get removed)
+ if (subClass.isAssignableFrom(observerMethod.getJavaMember().getDeclaringClass()) &&
+ !subClass.equals(observerMethod.getJavaMember().getDeclaringClass()))
+ {
+ try
+ {
+ subClass.getMethod(observerMethod.getJavaMember().getName(), observerMethod.getJavaMember().getParameterTypes());
+ i.remove();
+ }
+ catch(NoSuchMethodException nsme)
+ {
+ // that's perfectly fine.
+ // it means that we don't need to remove anything because the
+ // observer method didn't get overridden.
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public <T> Set<ObserverMethod<? super T>> resolveObservers(T event, EventMetadata metadata)
+ {
+ EventUtil.checkEventBindings(webBeansContext, metadata.getQualifiers());
+
+ Type eventType = metadata.getType();
+ Set<ObserverMethod<? super T>> observersMethods = filterByType(event, eventType);
+
+ observersMethods = filterByQualifiers(observersMethods, metadata.getQualifiers());
+
+ //this check for the TCK is only needed if no observer was found
+ if (observersMethods.isEmpty())
+ {
+ EventUtil.checkQualifierImplementations(metadata.getQualifiers());
+ }
+
+ return observersMethods;
+ }
+
+ private <T> Set<ObserverMethod<? super T>> filterByType(T event, Type eventType)
+ {
+ if(WebBeansUtil.isExtensionEventType(eventType))
+ {
+ return filterByExtensionEventType(event, eventType);
+ }
+ Class<?> eventClass = ClassUtil.getClass(eventType);
+
+ Set<ObserverMethod<? super T>> matching = new HashSet<ObserverMethod<? super T>>();
+
+ Set<Type> types = new HashSet<Type>();
+ types.add(eventType);
+
+ Type superClazz = eventClass.getGenericSuperclass();
+ if(superClazz != null)
+ {
+ types.add(superClazz);
+ }
+
+ Type[] genericInts = eventClass.getGenericInterfaces();
+
+ if(genericInts != null && genericInts.length > 0)
+ {
+ for(Type genericInt : genericInts)
+ {
+ types.add(genericInt);
+ }
+ }
+
+ Set<Type> keySet = observers.keySet();
+
+ for (Type type : keySet)
+ {
+ for (Type check : types)
+ {
+ if (ClassUtil.checkEventTypeAssignability(check, type))
+ {
+ Set<ObserverMethod<?>> wrappers = observers.get(type);
+
+ for (ObserverMethod<?> wrapper : wrappers)
+ {
+ matching.add((ObserverMethod<T>) wrapper);
+ }
+ break;
+ }
+ }
+ }
+ return matching;
+ }
+
+ private <T> Set<ObserverMethod<? super T>> filterByExtensionEventType(T event, Type eventType)
+ {
+ Class<?> eventClass = ClassUtil.getClazz(eventType);
+ Set<ObserverMethod<? super T>> matching = new HashSet<ObserverMethod<? super T>>();
+ Set<Type> keySet = observers.keySet();
+ for (Type type : keySet)
+ {
+ Class<?> beanClass = null;
+ Class<?> observerClass = ClassUtil.getClazz(type);
+
+ if(observerClass != null)
+ {
+ if(observerClass.isAssignableFrom(eventClass))
+ {
+ //ProcessBean,ProcessAnnotateType, ProcessInjectionTarget
+ if(WebBeansUtil.isExtensionBeanEventType(eventType))
+ {
+ if(WebBeansUtil.isDefaultExtensionBeanEventType(observerClass))
+ {
+ GenericBeanEvent genericBeanEvent = (GenericBeanEvent)event;
+ beanClass = genericBeanEvent.getBeanClassFor(observerClass);
+
+ if(ClassUtil.isParametrizedType(type))
+ {
+ addToMathingWithParametrizedForBeans(type,beanClass,matching);
+ }
+ else
+ {
+ addToMatching(type, matching);
+ }
+ }
+ }
+ //ProcessProducer, ProcessProducerMethod, ProcessProducerField,ProcessObserverMEthod
+ else if(WebBeansUtil.isExtensionProducerOrObserverEventType(eventType))
+ {
+ GenericProducerObserverEvent genericBeanEvent = (GenericProducerObserverEvent)event;
+ beanClass = genericBeanEvent.getBeanClass();
+ Class<?> producerOrObserverReturnClass = genericBeanEvent.getProducerOrObserverType();
+
+ if(WebBeansUtil.isDefaultExtensionProducerOrObserverEventType(observerClass))
+ {
+ boolean processProducerEvent = false;
+ if(observerClass.equals(ProcessProducer.class))
+ {
+ processProducerEvent = true;
+ }
+
+ if(ClassUtil.isParametrizedType(type))
+ {
+ addToMatchingWithParametrizedForProducers(processProducerEvent,type, beanClass, producerOrObserverReturnClass, matching);
+ }
+ else
+ {
+ addToMatching(type, matching);
+ }
+ }
+ else if(observerClass.isAssignableFrom(eventClass))
+ {
+ if(ClassUtil.isParametrizedType(type))
+ {
+ addToMathingWithParametrizedForBeans(type,beanClass,matching);
+ }
+ else
+ {
+ addToMatching(type, matching);
+ }
+ }
+ }
+ //BeforeBeanDiscovery,AfterBeanDiscovery,AfterDeploymentValidation
+ //BeforeShutDown Events
+ else
+ {
+ if(observerClass.isAssignableFrom(eventClass))
+ {
+ addToMatching(type, matching);
+ }
+ }
+ }
+ }
+ }
+
+ return matching;
+ }
+
+ /**
+ * Returns true if fired event class is assignable with
+ * given observer type argument.
+ * @param beanClass fired event class.
+ * @param observerTypeActualArg actual type argument,
+ * such as in case ProcessProducerField<Book> is Book.class
+ * @return true if fired event class is assignable with
+ * given observer type argument.
+ */
+ private boolean checkEventTypeParameterForExtensions(Class<?> beanClass, Type observerTypeActualArg)
+ {
+ if(ClassUtil.isTypeVariable(observerTypeActualArg))
+ {
+ TypeVariable<?> tv = (TypeVariable<?>)observerTypeActualArg;
+ Type tvBound = tv.getBounds()[0];
+
+ if(tvBound instanceof Class)
+ {
+ Class<?> clazzTvBound = (Class<?>)tvBound;
+
+ if(clazzTvBound.isAssignableFrom(beanClass))
+ {
+ return true;
+ }
+ }
+
+ }
+ else if(ClassUtil.isWildCardType(observerTypeActualArg))
+ {
+ return ClassUtil.checkRequiredTypeIsWildCard(beanClass, observerTypeActualArg);
+ }
+ else if(observerTypeActualArg instanceof Class)
+ {
+ Class<?> observerClass = (Class<?>)observerTypeActualArg;
+ if(observerClass.isAssignableFrom(beanClass))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private <T> void addToMatching(Type type, Set<ObserverMethod<? super T>> matching)
+ {
+ Set<ObserverMethod<?>> wrappers = observers.get(type);
+
+ for (ObserverMethod<?> wrapper : wrappers)
+ {
+ matching.add((ObserverMethod<T>) wrapper);
+ }
+ }
+
+ private <T> void addToMathingWithParametrizedForBeans(Type type, Class<?> beanClass, Set<ObserverMethod<? super T>> matching )
+ {
+ ParameterizedType pt = (ParameterizedType)type;
+ Type[] actualArgs = pt.getActualTypeArguments();
+
+ if(actualArgs.length == 0)
+ {
+ Class<?> rawType = (Class<?>)pt.getRawType();
+ if(rawType.isAssignableFrom(beanClass))
+ {
+ addToMatching(type, matching);
+ }
+ }
+ else
+ {
+ if(checkEventTypeParameterForExtensions(beanClass, actualArgs[0]))
+ {
+ addToMatching(type, matching);
+ }
+ }
+
+ }
+
+ /**
+ * Add to matching.
+ * @param <T> generic observer method parameter type
+ * fired event because of observer method or not
+ * @param type one of observer method parameter base type
+ * @param beanClass observer method owner bean class
+ * @param producerOrObserverReturnClass observer even normal class
+ * @param matching set of observer method that match the given type
+ */
+ private <T> void addToMatchingWithParametrizedForProducers(boolean processProducer, Type type, Class<?> beanClass,
+ Class<?> producerOrObserverReturnClass, Set<ObserverMethod<? super T>> matching )
+ {
+ ParameterizedType pt = (ParameterizedType)type;
+ Type[] actualArgs = pt.getActualTypeArguments();
+
+ if(actualArgs.length == 0)
+ {
+ Class<?> rawType = (Class<?>)pt.getRawType();
+ if(rawType.isAssignableFrom(beanClass))
+ {
+ addToMatching(type, matching);
+ }
+ }
+ else
+ {
+ //Bean class argument
+ //For observer related event, observer owner bean class.
+ Type beanClassArg = actualArgs[1];
+
+ //Event payload
+ Type returnClassArg = actualArgs[0];
+
+ //For ProcessProducer<BeanClass, Event Class>
+ if(processProducer)
+ {
+ beanClassArg = actualArgs[0];
+ returnClassArg = actualArgs[1];
+ }
+
+ if(checkEventTypeParameterForExtensions(beanClass, beanClassArg) &&
+ checkEventTypeParameterForExtensions(producerOrObserverReturnClass, returnClassArg))
+ {
+ addToMatching(type, matching);
+ }
+ }
+
+ }
+
+ /**
+ * filter out all {@code ObserverMethod}s which do not fit the given
+ * qualifiers.
+ */
+ private <T> Set<ObserverMethod<? super T>> filterByQualifiers(Set<ObserverMethod<? super T>> observers, Set<Annotation> eventQualifiers)
+ {
+ Set<ObserverMethod<? super T>> matching = new HashSet<ObserverMethod<? super T>>();
+
+ search: for (ObserverMethod<? super T> ob : observers)
+ {
+ Set<Annotation> qualifiers = ob.getObservedQualifiers();
+
+ if (qualifiers.size() > eventQualifiers.size())
+ {
+ continue;
+ }
+
+
+ for (Annotation qualifier : qualifiers)
+ {
+ boolean found = false;
+ for(Annotation inList : eventQualifiers)
+ {
+ if(AnnotationUtil.isCdiAnnotationEqual(inList, qualifier))
+ {
+ found = true;
+ break;
+ }
+ }
+
+ if(!found)
+ {
+ continue search;
+ }
+ }
+
+ matching.add(ob);
+ }
+
+ return matching;
+ }
+
+ public void fireEvent(Object event, EventMetadata metadata, boolean isLifecycleEvent)
+ {
+ Set<ObserverMethod<? super Object>> observerMethods = resolveObservers(event, metadata);
+
+ for (ObserverMethod<? super Object> observer : observerMethods)
+ {
+ try
+ {
+ if (isLifecycleEvent && !Extension.class.isAssignableFrom(observer.getBeanClass()))
+ {
+ // we must not fire Extension Lifecycle events to beans which are no Extensions
+ continue;
+ }
+
+ TransactionPhase phase = observer.getTransactionPhase();
+
+ if(phase != null && !phase.equals(TransactionPhase.IN_PROGRESS))
+ {
+ TransactionService transactionService = webBeansContext.getService(TransactionService.class);
+ if(transactionService != null)
+ {
+ transactionService.registerTransactionSynchronization(phase, observer, event);
+ }
+ else
+ {
+ if (observer instanceof OwbObserverMethod)
+ {
+ ((OwbObserverMethod<? super Object>)observer).notify(event, metadata);
+ }
+ else
+ {
+ observer.notify(event);
+ }
+ }
+ }
+ else
+ {
+ if (observer instanceof OwbObserverMethod)
+ {
+ ((OwbObserverMethod<? super Object>)observer).notify(event, metadata);
+ }
+ else
+ {
+ observer.notify(event);
+ }
+ }
+ }
+ catch (WebBeansException e)
+ {
+ Throwable exc = e.getCause();
+ if(exc instanceof InvocationTargetException)
+ {
+ InvocationTargetException invt = (InvocationTargetException)exc;
+ exc = invt.getCause();
+ }
+
+ if (!RuntimeException.class.isAssignableFrom(exc.getClass()))
+ {
+ throw new ObserverException(WebBeansLoggerFacade.getTokenString(OWBLogConst.EXCEPT_0008) + event.getClass().getName(), e);
+ }
+ else
+ {
+ RuntimeException rte = (RuntimeException) exc;
+ throw rte;
+ }
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+
+ catch (Exception e)
+ {
+ throw new WebBeansException(e);
+ }
+ }
+ }
+
+ /**
+ * Gets observer method from given annotated method.
+ * @param <T> bean type info
+ * @param annotatedMethod annotated method for observer
+ * @param bean bean instance
+ * @return ObserverMethod
+ */
+ public <T> ObserverMethod<?> getObservableMethodForAnnotatedMethod(AnnotatedMethod<?> annotatedMethod, AbstractOwbBean<T> bean)
+ {
+ Asserts.assertNotNull(annotatedMethod, "annotatedMethod parameter can not be null");
+
+ Observes observes = AnnotationUtil.getAnnotatedMethodFirstParameterAnnotation(annotatedMethod, Observes.class);
+ boolean ifExist = false;
+ if(observes != null)
+ {
+ if (observes.notifyObserver().equals(Reception.IF_EXISTS))
+ {
+ ifExist = true;
+ }
+ }
+
+ //Looking for qualifiers
+ Annotation[] observerQualifiers =
+ bean.getWebBeansContext().getAnnotationManager().getAnnotatedMethodFirstParameterQualifierWithGivenAnnotation(
+ annotatedMethod, Observes.class);
+
+ //Getting observer event type
+ Type type = AnnotationUtil.getAnnotatedMethodFirstParameterWithAnnotation(annotatedMethod, Observes.class);
+
+ //Observer creation from annotated method
+ ObserverMethodImpl<T> observer = new ObserverMethodImpl(bean, annotatedMethod, ifExist, observerQualifiers, type);
+
+ //Adds this observer
+ addObserver(observer, type);
+
+
+ return observer;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverMethodImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverMethodImpl.java
new file mode 100644
index 0000000..a01ff63
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverMethodImpl.java
@@ -0,0 +1,442 @@
+/*
+ * 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.webbeans.event;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.enterprise.context.ContextNotActiveException;
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.event.Event;
+import javax.enterprise.event.Observes;
+import javax.enterprise.event.Reception;
+import javax.enterprise.event.TransactionPhase;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.apache.webbeans.annotation.AnnotationManager;
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.component.WebBeansType;
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.context.creational.CreationalContextImpl;
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.inject.impl.InjectionPointFactory;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.proxy.OwbNormalScopeProxy;
+import org.apache.webbeans.spi.plugins.OpenWebBeansEjbPlugin;
+import org.apache.webbeans.util.AnnotationUtil;
+
+/**
+ * Defines observers that are declared in observer methods.
+ * <p>
+ * Example:
+ * <pre>
+ * public class X {
+ *
+ * public void afterLoggedIn(@Observes @Current LoggedInEvent event)
+ * {
+ * .....
+ * }
+ * }
+ * </pre>
+ * Above class X instance observes for the event with type <code>LoggedInEvent</code>
+ * and event qualifier is <code>Current</code>. Whenever event is fired, its {@link javax.enterprise.inject.spi.ObserverMethod#notify()}
+ * method is called.
+ * </p>
+ *
+ * @version $Rev$ $Date$
+ *
+ * @param <T> event type
+ */
+public class ObserverMethodImpl<T> implements OwbObserverMethod<T>
+{
+ /**Logger instance*/
+ private final static Logger logger = WebBeansLoggerFacade.getLogger(ObserverMethodImpl.class);
+
+ /**Observer owner bean that defines observer method*/
+ private final AbstractOwbBean<?> bean;
+
+ /**Using existing bean instance or not*/
+ private final boolean ifExist;
+
+ /** the observed qualifiers */
+ private final Set<Annotation> observedQualifiers;
+
+ /** the type of the observed event */
+ private final Type observedEventType;
+
+ /** the transaction phase */
+ private final TransactionPhase phase;
+
+ private final Method view;
+
+ /**Annotated method*/
+ private AnnotatedMethod<T> annotatedObserverMethod;
+
+ private static class ObserverParams
+ {
+ private Bean<Object> bean;
+
+ private Object instance;
+
+ private CreationalContext<Object> creational;
+
+ private boolean isBean = false;
+ }
+
+ /**
+ * used if the qualifiers and event type are already known, e.g. from the XML.
+ * @param bean
+ * @param annotatedObserverMethod
+ * @param ifExist
+ * @param qualifiers
+ * @param observedEventType
+ */
+ public ObserverMethodImpl(AbstractOwbBean<?> bean, AnnotatedMethod<T> annotatedObserverMethod, boolean ifExist,
+ Annotation[] qualifiers, Type observedEventType)
+ {
+ this.bean = bean;
+ this.annotatedObserverMethod = annotatedObserverMethod;
+ this.ifExist = ifExist;
+ observedQualifiers = new HashSet<Annotation>(qualifiers.length);
+ Collections.addAll(observedQualifiers, qualifiers);
+ this.observedEventType = observedEventType;
+ phase = EventUtil.getObserverMethodTransactionType(annotatedObserverMethod);
+
+ final OpenWebBeansEjbPlugin ejbPlugin = getWebBeansContext().getPluginLoader().getEjbPlugin();
+ if (ejbPlugin != null && ejbPlugin.isNewSessionBean(bean.getBeanClass()))
+ {
+ view = ejbPlugin.resolveViewMethod(bean , annotatedObserverMethod.getJavaMember());
+ }
+ else
+ {
+ view = annotatedObserverMethod.getJavaMember();
+ }
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void notify(T event)
+ {
+ notify(event, null);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public void notify(T event, EventMetadata metadata)
+ {
+ AbstractOwbBean<Object> component = (AbstractOwbBean<Object>) bean;
+ if (!bean.isEnabled())
+ {
+ return;
+ }
+
+ Object object = null;
+
+ List<ObserverParams> methodArgsMap = getMethodArguments(event, metadata);
+
+ BeanManagerImpl manager = bean.getWebBeansContext().getBeanManagerImpl();
+ CreationalContextImpl<Object> creationalContext = manager.createCreationalContext(component);
+ if (metadata != null)
+ {
+ creationalContext.putInjectionPoint(metadata.getInjectionPoint());
+ }
+
+ ObserverParams[] obargs = null;
+ try
+ {
+ obargs = new ObserverParams[methodArgsMap.size()];
+ obargs = methodArgsMap.toArray(obargs);
+ Object[] args = new Object[obargs.length];
+ int i = 0;
+ for(ObserverParams param : obargs)
+ {
+ args[i++] = param.instance;
+ }
+
+ //Static or not
+ if (Modifier.isStatic(view.getModifiers()))
+ {
+ if (!view.isAccessible())
+ {
+ view.setAccessible(true);
+ }
+ //Invoke Method
+ view.invoke(null, args);
+ }
+ else
+ {
+ Context context;
+ try
+ {
+ context = manager.getContext(component.getScope());
+ }
+ catch (ContextNotActiveException cnae)
+ {
+ // this may happen if we try to e.g. send an event to a @ConversationScoped bean from a ServletListener
+ logger.log(Level.INFO, OWBLogConst.INFO_0010, bean);
+ return;
+ }
+
+
+ // on Reception.IF_EXISTS: ignore this bean if a the contextual instance doesn't already exist
+ object = context.get(component);
+
+ if (ifExist && object == null)
+ {
+ return;
+ }
+
+ if (object == null)
+ {
+ object = context.get(component, creationalContext);
+ }
+
+ if (object == null)
+ {
+ // this might happen for EJB components.
+ Type t = component.getBeanClass();
+
+ // If the bean is an EJB, its beanClass may not be one of
+ // its types. Instead pick a local interface
+ if (component.getWebBeansType() == WebBeansType.ENTERPRISE)
+ {
+ t = (Type) component.getTypes().toArray()[0];
+ }
+
+ object = manager.getReference(component, t, creationalContext);
+
+ }
+
+ if (object != null)
+ {
+ if (!view.isAccessible())
+ {
+ bean.getWebBeansContext().getSecurityService().doPrivilegedSetAccessible(view, true);
+ }
+
+ if (Modifier.isPrivate(view.getModifiers()))
+ {
+ // since private methods cannot be intercepted, we have to unwrap anny possible proxy
+ if (object instanceof OwbNormalScopeProxy)
+ {
+ object = getWebBeansContext().getInterceptorDecoratorProxyFactory().unwrapInstance(object);
+ }
+ }
+
+ //Invoke Method
+ view.invoke(object, args);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ throw new WebBeansException(e);
+ }
+ finally
+ {
+ creationalContext.removeInjectionPoint();
+ //Destory bean instance
+ if (component.getScope().equals(Dependent.class) && object != null)
+ {
+ component.destroy(object, creationalContext);
+ }
+
+ //Destroy observer method dependent instances
+ if(methodArgsMap != null)
+ {
+ for(ObserverParams param : obargs)
+ {
+ if(param.isBean && param.bean.getScope().equals(Dependent.class))
+ {
+ param.bean.destroy(param.instance, param.creational);
+ }
+ }
+ }
+ }
+
+ }
+
+ /**
+ * Gets observer method parameters.
+ * @param event event payload
+ * @return observer method parameters
+ */
+ protected List<ObserverParams> getMethodArguments(Object event, EventMetadata metadata)
+ {
+ final WebBeansContext webBeansContext = bean.getWebBeansContext();
+ final AnnotationManager annotationManager = webBeansContext.getAnnotationManager();
+ final BeanManagerImpl manager = webBeansContext.getBeanManagerImpl();
+ List<ObserverParams> list = new ArrayList<ObserverParams>();
+ List<AnnotatedParameter<T>> parameters = annotatedObserverMethod.getParameters();
+ ObserverParams param = null;
+ for(AnnotatedParameter<T> parameter : parameters)
+ {
+ if(parameter.isAnnotationPresent(Observes.class))
+ {
+ param = new ObserverParams();
+ param.instance = event;
+ list.add(param);
+ }
+ else
+ {
+ //Get parameter annotations
+ Annotation[] bindingTypes =
+ annotationManager.getQualifierAnnotations(AnnotationUtil.
+ asArray(parameter.getAnnotations()));
+
+ InjectionPoint point = InjectionPointFactory.getPartialInjectionPoint(bean, parameter, bindingTypes);
+
+ //Get observer parameter instance
+ @SuppressWarnings("unchecked")
+ Bean<Object> injectedBean = (Bean<Object>)getWebBeansContext().getBeanManagerImpl().getInjectionResolver().getInjectionPointBean(point);
+
+ CreationalContextImpl<Object> creational = manager.createCreationalContext(injectedBean);
+ creational.putInjectionPoint(metadata.getInjectionPoint());
+ creational.putInjectionPoint(point);
+ Object instance;
+ try
+ {
+ instance = manager.getReference(injectedBean, null, creational);
+ }
+ finally
+ {
+ creational.removeInjectionPoint();
+ creational.removeInjectionPoint();
+ }
+
+ param = new ObserverParams();
+ param.isBean = true;
+ param.creational = creational;
+ param.instance = instance;
+ param.bean = injectedBean;
+ list.add(param);
+ }
+ }
+
+ return list;
+ }
+
+ private boolean isEventProviderInjection(InjectionPoint injectionPoint)
+ {
+ Type type = injectionPoint.getType();
+
+ if (type instanceof ParameterizedType)
+ {
+ ParameterizedType pt = (ParameterizedType) type;
+ Class<?> clazz = (Class<?>) pt.getRawType();
+
+ if (clazz.isAssignableFrom(Event.class))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Returns observer owner bean.
+ *
+ * @return the bean
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public Class<?> getBeanClass()
+ {
+ return bean.getBeanClass();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<Annotation> getObservedQualifiers()
+ {
+ return observedQualifiers;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Type getObservedType()
+ {
+ return observedEventType;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Reception getReception()
+ {
+ return ifExist ? Reception.IF_EXISTS : Reception.ALWAYS;
+ }
+
+ @Override
+ public TransactionPhase getTransactionPhase()
+ {
+ return phase;
+ }
+
+ public AnnotatedMethod<T> getObserverMethod()
+ {
+ return annotatedObserverMethod;
+ }
+
+ protected WebBeansContext getWebBeansContext()
+ {
+ return bean.getWebBeansContext();
+ }
+
+ /**
+ * Provides a way to set the observer method. This may need to be done for
+ * EJBs so that the method used will be from an interface and not the
+ * EJB class that likely can not be invoked on the EJB proxy
+ *
+ * @param m method to be invoked as the observer
+ */
+ public void setObserverMethod(AnnotatedMethod<T> m)
+ {
+ annotatedObserverMethod = m;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/event/OwbObserverMethod.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/event/OwbObserverMethod.java
new file mode 100644
index 0000000..178872a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/event/OwbObserverMethod.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.event;
+
+import javax.enterprise.inject.spi.ObserverMethod;
+
+/**
+ * This interface fixes an issue of the CDI API. See https://issues.jboss.org/browse/CDI-36
+ */
+public interface OwbObserverMethod<T> extends ObserverMethod<T>
+{
+
+ /**
+ * will actually call the underlying observer method with the specified event metadata
+ */
+ public void notify(T event, EventMetadata metadata);
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansConfigurationException.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansConfigurationException.java
new file mode 100644
index 0000000..94fd76e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansConfigurationException.java
@@ -0,0 +1,50 @@
+/*
+ * 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.webbeans.exception;
+
+import org.apache.webbeans.exception.inject.DefinitionException;
+
+/**
+ * Exception that is thrown by the web beans container at the intialization
+ * time.
+ *
+ * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
+ * @since 1.0
+ */
+public class WebBeansConfigurationException extends DefinitionException
+{
+
+ private static final long serialVersionUID = 1863095663133791175L;
+
+ public WebBeansConfigurationException(String message)
+ {
+ super(message);
+ }
+
+ public WebBeansConfigurationException(Throwable e)
+ {
+ super(e);
+ }
+
+ public WebBeansConfigurationException(String message, Throwable e)
+ {
+ super(message, e);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansCreationException.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansCreationException.java
new file mode 100644
index 0000000..f2e0c0c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansCreationException.java
@@ -0,0 +1,41 @@
+/*
+ * 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.webbeans.exception;
+
+/**
+ * Exception that is thrown by the web beans container at the deployment time.
+ *
+ * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
+ * @since 1.0
+ */
+public class WebBeansCreationException extends WebBeansException
+{
+
+ private static final long serialVersionUID = 1863095663133791175L;
+
+ public WebBeansCreationException(Throwable e)
+ {
+ super(e);
+ }
+
+ public WebBeansCreationException(String message)
+ {
+ super(message);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansDeploymentException.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansDeploymentException.java
new file mode 100644
index 0000000..99b35e0
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansDeploymentException.java
@@ -0,0 +1,48 @@
+/*
+ * 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.webbeans.exception;
+
+import org.apache.webbeans.exception.inject.DeploymentException;
+
+/**
+ * Exception that is thrown by the web beans container at the deployment time.
+ *
+ * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
+ * @since 1.0
+ */
+public class WebBeansDeploymentException extends DeploymentException
+{
+
+ private static final long serialVersionUID = 1863095663133791175L;
+
+ public WebBeansDeploymentException(Throwable e)
+ {
+ super(e);
+ }
+
+ public WebBeansDeploymentException(String message)
+ {
+ super(message);
+ }
+
+ public WebBeansDeploymentException(String message, Throwable e)
+ {
+ super(message, e);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansException.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansException.java
new file mode 100644
index 0000000..3790f3e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansException.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.exception;
+
+/**
+ * @author Administrator
+ */
+public class WebBeansException extends RuntimeException
+{
+
+ private static final long serialVersionUID = -3721839220664165557L;
+ private Throwable cause;
+
+ public WebBeansException(String message)
+ {
+ super(message);
+ }
+
+ public WebBeansException(Throwable e)
+ {
+ super(e);
+ cause = e;
+ }
+
+ public WebBeansException(String message, Throwable e)
+ {
+ super(message, e);
+ cause = e;
+ }
+
+ @Override
+ public Throwable getCause()
+ {
+ return cause;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/DuplicateDefinitionException.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/DuplicateDefinitionException.java
new file mode 100644
index 0000000..94e7a17
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/definition/DuplicateDefinitionException.java
@@ -0,0 +1,42 @@
+/*
+ * 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.webbeans.exception.definition;
+
+import org.apache.webbeans.exception.inject.DefinitionException;
+
+public class DuplicateDefinitionException extends DefinitionException
+{
+ private static final long serialVersionUID = 2312285271502063304L;
+
+ public DuplicateDefinitionException(String message)
+ {
+ super(message);
+ }
+
+ public DuplicateDefinitionException(Throwable e)
+ {
+ super(e);
+ }
+
+ public DuplicateDefinitionException(String message, Throwable e)
+ {
+ super(message, e);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/helper/ViolationMessageBuilder.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/helper/ViolationMessageBuilder.java
new file mode 100644
index 0000000..5230c85
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/helper/ViolationMessageBuilder.java
@@ -0,0 +1,81 @@
+/*
+ * 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.webbeans.exception.helper;
+
+public class ViolationMessageBuilder
+{
+ private StringBuilder violationMessage;
+
+ private final String lineSeparator = System.getProperty("line.separator");
+
+ public static ViolationMessageBuilder newViolation()
+ {
+ return new ViolationMessageBuilder();
+ }
+
+ public static ViolationMessageBuilder newViolation(String... text)
+ {
+ return new ViolationMessageBuilder().append(text);
+ }
+
+ public ViolationMessageBuilder append(String... text)
+ {
+ appendText(text, false);
+ return this;
+ }
+
+ public ViolationMessageBuilder addLine(String... text)
+ {
+ if(text == null)
+ {
+ return this;
+ }
+
+ appendText(text, true);
+ return this;
+ }
+
+ private void appendText(String[] text, boolean appendLineSeparator)
+ {
+ if(violationMessage == null)
+ {
+ violationMessage = new StringBuilder();
+ }
+ else if(appendLineSeparator)
+ {
+ violationMessage.append(lineSeparator);
+ }
+
+ for(String t : text)
+ {
+ violationMessage.append(t);
+ }
+ }
+
+ public boolean containsViolation()
+ {
+ return violationMessage != null;
+ }
+
+ @Override
+ public String toString()
+ {
+ return containsViolation() ? violationMessage.toString() : "no violation recorded";
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/DefinitionException.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/DefinitionException.java
new file mode 100644
index 0000000..9606474
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/DefinitionException.java
@@ -0,0 +1,45 @@
+/*
+ * 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.webbeans.exception.inject;
+
+public class DefinitionException extends RuntimeException
+{
+ private static final long serialVersionUID = -6261526411795328050L;
+
+ public DefinitionException()
+ {
+ super();
+ }
+
+ public DefinitionException(String message)
+ {
+ super(message);
+ }
+
+ public DefinitionException(Throwable e)
+ {
+ super(e);
+ }
+
+ public DefinitionException(String message, Throwable e)
+ {
+ super(message, e);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/DeploymentException.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/DeploymentException.java
new file mode 100644
index 0000000..bc310c2
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/DeploymentException.java
@@ -0,0 +1,45 @@
+/*
+ * 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.webbeans.exception.inject;
+
+public class DeploymentException extends RuntimeException
+{
+ private static final long serialVersionUID = -6635290650256485602L;
+
+ public DeploymentException()
+ {
+ super();
+ }
+
+ public DeploymentException(String message)
+ {
+ super(message);
+ }
+
+ public DeploymentException(Throwable e)
+ {
+ super(e);
+ }
+
+ public DeploymentException(String message, Throwable e)
+ {
+ super(message, e);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/InconsistentSpecializationException.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/InconsistentSpecializationException.java
new file mode 100644
index 0000000..2bece88
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/InconsistentSpecializationException.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.exception.inject;
+
+public class InconsistentSpecializationException extends DefinitionException
+{
+ private static final long serialVersionUID = 5398575103682514128L;
+
+ public InconsistentSpecializationException(String message)
+ {
+ super(message);
+ }
+
+ public InconsistentSpecializationException(Throwable e)
+ {
+ super(e);
+ }
+
+ public InconsistentSpecializationException(String message, Throwable e)
+ {
+ super(message, e);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/NullableDependencyException.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/NullableDependencyException.java
new file mode 100644
index 0000000..8493da9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/exception/inject/NullableDependencyException.java
@@ -0,0 +1,45 @@
+/*
+ * 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.webbeans.exception.inject;
+
+public class NullableDependencyException extends DeploymentException
+{
+ private static final long serialVersionUID = -2226577224929251465L;
+
+ public NullableDependencyException()
+ {
+ super();
+ }
+
+ public NullableDependencyException(String message)
+ {
+ super(message);
+ }
+
+ public NullableDependencyException(Throwable e)
+ {
+ super(e);
+ }
+
+ public NullableDependencyException(String message, Throwable e)
+ {
+ super(message, e);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
new file mode 100644
index 0000000..72e64b4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
@@ -0,0 +1,147 @@
+/*
+ * 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.webbeans.inject;
+
+import java.io.Serializable;
+import java.lang.reflect.Member;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.inject.IllegalProductException;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.Producer;
+
+import org.apache.webbeans.component.AbstractProducerBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.container.InjectionResolver;
+import org.apache.webbeans.context.creational.CreationalContextImpl;
+import org.apache.webbeans.util.WebBeansUtil;
+
+/**
+ * Abstract implementation of all components which are injectable.
+ *
+ * <p>
+ * Do actual injection via {@link AbstractInjectable#inject(InjectionPoint)}
+ * </p>
+ *
+ * @see InjectableField
+ * @see InjectableConstructor
+ * @see InjectableMethod
+ */
+public abstract class AbstractInjectable<T>
+{
+
+ private Producer<?> owner;
+
+ protected final CreationalContextImpl<?> creationalContext;
+
+ protected AbstractInjectable(Producer<?> owner, CreationalContextImpl<?> creationalContext)
+ {
+ this.owner = owner;
+ this.creationalContext = creationalContext;
+ }
+
+ /**
+ * Gets the injected bean instance in its scoped context.
+ * @param injectionPoint injection point definition
+ * @return current bean instance in the resolved bean scope
+ */
+ public T inject(InjectionPoint injectionPoint)
+ {
+ T injected;
+ BeanManagerImpl beanManager = creationalContext.getWebBeansContext().getBeanManagerImpl();
+
+ //Injected contextual beam
+ InjectionResolver instance = beanManager.getInjectionResolver();
+
+ Bean<?> injectedBean = instance.getInjectionPointBean(injectionPoint);
+
+ //Injection for dependent instance InjectionPoint fields
+ boolean dependentProducer = false;
+ if(WebBeansUtil.isDependent(injectedBean))
+ {
+ if(!injectionPoint.isTransient())
+ {
+ if(injectedBean instanceof AbstractProducerBean)
+ {
+ if((creationalContext.getBean() instanceof Bean) && beanManager.isPassivatingScope(((Bean<?>) creationalContext.getBean()).getScope()))
+ {
+ dependentProducer = true;
+ }
+ }
+ }
+ }
+
+ //Gets injectable reference for injected bean
+ injected = (T) beanManager.getInjectableReference(injectionPoint, creationalContext);
+
+ if (injected == null && beanManager.isNormalScope(injectedBean.getScope()))
+ {
+ throw new IllegalStateException("InjectableReference is 'null' for " + injectionPoint.toString());
+ }
+
+ /*X TODO see spec issue CDI-140 */
+ if(dependentProducer)
+ {
+ if(injected != null && !Serializable.class.isAssignableFrom(injected.getClass()))
+ {
+ throw new IllegalProductException("A producer method or field of scope @Dependent returns an unserializable object for injection " +
+ "into an injection point "+ injectionPoint +" that requires a passivation capable dependency");
+ }
+ }
+
+ return injected;
+ }
+
+ protected Contextual<?> getBean()
+ {
+ return creationalContext.getBean();
+ }
+
+ protected WebBeansContext getWebBeansContext()
+ {
+ return creationalContext.getWebBeansContext();
+ }
+
+ /**
+ * Returns injection points related with given member type of the bean.
+ * @param member java member
+ * @return injection points related with given member type
+ */
+ protected List<InjectionPoint> getInjectionPoints(Member member)
+ {
+ return createInjectionPoints(owner, member);
+ }
+
+ protected static List<InjectionPoint> createInjectionPoints(Producer<?> owner, Member member)
+ {
+ List<InjectionPoint> injectionPoints = new ArrayList<InjectionPoint>();
+ for (InjectionPoint injectionPoint : owner.getInjectionPoints())
+ {
+ if (injectionPoint.getMember().equals(member))
+ {
+ injectionPoints.add(injectionPoint);
+ }
+ }
+ return injectionPoints;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/inject/AlternativesManager.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/inject/AlternativesManager.java
new file mode 100644
index 0000000..179af95
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/inject/AlternativesManager.java
@@ -0,0 +1,137 @@
+/*
+ * 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.webbeans.inject;
+
+import java.lang.annotation.Annotation;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.spi.Bean;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.spi.ScannerService;
+import org.apache.webbeans.util.AnnotationUtil;
+
+public class AlternativesManager
+{
+ private final Set<Class<?>> alternatives = new HashSet<Class<?>>();
+
+ private final Set<Class<? extends Annotation>> stereoAlternatives = new HashSet<Class<? extends Annotation>>();
+
+ private final WebBeansContext webBeansContext;
+
+ public AlternativesManager(WebBeansContext webBeansContext)
+ {
+
+ this.webBeansContext = webBeansContext;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void addStereoTypeAlternative(Class<?> alternative, String fileName, ScannerService scanner)
+ {
+ if(Annotation.class.isAssignableFrom(alternative))
+ {
+ Class<? extends Annotation> stereo = (Class<? extends Annotation>)alternative;
+ boolean ok = false;
+ if(webBeansContext.getAnnotationManager().isStereoTypeAnnotation(stereo))
+ {
+ if(AnnotationUtil.hasClassAnnotation(stereo, Alternative.class))
+ {
+ boolean isBDAScanningEnabled=(scanner!=null && scanner.isBDABeansXmlScanningEnabled());
+ if(isBDAScanningEnabled && !scanner.getBDABeansXmlScanner().addStereoType(stereo, fileName))
+ {
+ throw new WebBeansConfigurationException("Given alternative class : " + alternative.getName() + " is already added as @Alternative" );
+ }
+
+ ok = true;
+
+ stereoAlternatives.add(stereo);
+ }
+ }
+
+ if(!ok)
+ {
+ throw new WebBeansConfigurationException("Given stereotype class : " + alternative.getName() + " is not annotated with @Alternative" );
+ }
+ }
+ else
+ {
+ throw new WebBeansConfigurationException("Given stereotype class : " + alternative.getName() + " is not an annotation" );
+ }
+ }
+
+ public void addClazzAlternative(Class<?> alternative, String fileName, ScannerService scanner)
+ {
+ if(AnnotationUtil.hasClassAnnotation(alternative, Alternative.class))
+ {
+ boolean isBDAScanningEnabled=(scanner!=null && scanner.isBDABeansXmlScanningEnabled());
+ if((isBDAScanningEnabled && !scanner.getBDABeansXmlScanner().addAlternative(alternative, fileName)))
+ {
+ throw new WebBeansConfigurationException("Given class : " + alternative.getName() + " is already added as @Alternative" );
+ }
+
+ alternatives.add(alternative);
+ }
+ else
+ {
+ throw new WebBeansConfigurationException("Given class : " + alternative.getName() + " is not annotated with @Alternative" );
+ }
+ }
+
+ public boolean isClassAlternative(Class<?> clazz)
+ {
+ return alternatives.contains(clazz);
+ }
+
+ public boolean isStereoAlternative(Class<? extends Annotation> stereo)
+ {
+ return stereoAlternatives.contains(stereo);
+ }
+
+ public boolean isBeanHasAlternative(Bean<?> bean)
+ {
+ return isAlternative(bean.getBeanClass(), bean.getStereotypes());
+ }
+
+ public boolean isAlternative(Class<?> beanType, Set<Class<? extends Annotation>> stereotypes)
+ {
+ if(alternatives.contains(beanType))
+ {
+ return true;
+ }
+
+ for(Class<? extends Annotation> ann : stereotypes)
+ {
+ if(stereoAlternatives.contains(ann))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public void clear()
+ {
+ alternatives.clear();
+ stereoAlternatives.clear();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableConstructor.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableConstructor.java
new file mode 100644
index 0000000..c63f3d8
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableConstructor.java
@@ -0,0 +1,116 @@
+/*
+ * 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.webbeans.inject;
+
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.InjectionTarget;
+
+import org.apache.webbeans.context.creational.CreationalContextImpl;
+import org.apache.webbeans.exception.WebBeansException;
+
+/**
+ * Injects the parameters of the {@link org.apache.webbeans.component.ManagedBean} constructor and returns
+ * the created instance.
+ *
+ * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
+ * @since 1.0
+ * @see AbstractInjectable
+ */
+public class InjectableConstructor<T> extends AbstractInjectable<T>
+{
+ /** Injectable constructor instance */
+ protected Constructor<T> con;
+
+ private Object[] params = null;
+ private T instance;
+
+ /**
+ * Sets the constructor.
+ *
+ * @param cons injectable constructor
+ */
+ public InjectableConstructor(Constructor<T> cons, InjectionTarget<T> owner, CreationalContextImpl<T> creationalContext)
+ {
+ super(owner,creationalContext);
+ con = cons;
+ }
+
+ /**
+ * Creates the instance from the constructor. Each constructor parameter
+ * instance is resolved using the resolution algorithm.
+ */
+ public T doInjection()
+ {
+ try
+ {
+ if(!con.isAccessible())
+ {
+ getWebBeansContext().getSecurityService().doPrivilegedSetAccessible(con, true);
+ }
+
+ instance = con.newInstance(createParameters());
+ return instance;
+ }
+ catch (Exception e)
+ {
+ throw new WebBeansException(e);
+ }
+ }
+
+ public T getInstance()
+ {
+ return instance;
+ }
+
+ public Object[] createParameters()
+ {
+ if (params != null)
+ {
+ return params;
+ }
+
+ final List<Object> list = new ArrayList<Object>();
+ final List<InjectionPoint> injectedPoints = getInjectionPoints(con);
+
+ for(int i=0;i<injectedPoints.size();i++)
+ {
+ for(InjectionPoint point : injectedPoints)
+ {
+ AnnotatedParameter<?> parameter = (AnnotatedParameter<?>)point.getAnnotated();
+ if(parameter.getPosition() == i)
+ {
+ if (point.isDelegate())
+ {
+ list.add(creationalContext.getDelegate());
+ break;
+ }
+ list.add(inject(point));
+ break;
+ }
+ }
+ }
+ params = list.toArray(new Object[list.size()]);
+ return params;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableField.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableField.java
new file mode 100644
index 0000000..f0a56d9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableField.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.inject;
+
+import java.lang.reflect.Field;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.InjectionTarget;
+
+import org.apache.webbeans.context.creational.CreationalContextImpl;
+import org.apache.webbeans.exception.WebBeansException;
+
+/**
+ * Field type injection.
+ *
+ * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
+ * @since 1.0
+ */
+public class InjectableField<T> extends AbstractInjectable<T>
+{
+ protected Field field;
+ protected Object instance;
+
+ public InjectableField(Field field, Object instance, InjectionTarget<T> owner, CreationalContextImpl<T> creationalContext)
+ {
+ super(owner,creationalContext);
+ this.field = field;
+ this.instance = instance;
+ }
+
+ public T doInjection()
+ {
+ try
+ {
+ InjectionPoint injectedField = getInjectionPoints(field).get(0);
+
+ if (!field.isAccessible())
+ {
+ getWebBeansContext().getSecurityService().doPrivilegedSetAccessible(field, true);
+ }
+
+ Object object;
+ if (injectedField.isDelegate())
+ {
+ object = creationalContext.getDelegate();
+ }
+ else
+ {
+ object = inject(injectedField);
+ }
+
+ field.set(instance, object);
+
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new WebBeansException(e);
+ }
+
+ return null;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableMethod.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableMethod.java
new file mode 100644
index 0000000..6ac1e9b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableMethod.java
@@ -0,0 +1,190 @@
+/*
+ * 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.webbeans.inject;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.Producer;
+
+import org.apache.webbeans.component.ProducerMethodBean;
+import org.apache.webbeans.container.InjectionResolver;
+import org.apache.webbeans.context.creational.CreationalContextImpl;
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.proxy.NormalScopeProxyFactory;
+import org.apache.webbeans.proxy.OwbNormalScopeProxy;
+
+@SuppressWarnings("unchecked")
+public class InjectableMethod<T> extends AbstractInjectable<T>
+{
+ /** Injectable method */
+ protected Method method;
+
+ /** Bean parent instance that owns the method */
+ protected Object ownerInstance;
+
+ /**If this method is dispose method*/
+ private boolean disposable;
+
+ /**Used in dispose method, represents produces method parameter instance*/
+ private Object producerMethodInstance = null;
+
+ private Map<Bean<?>, Object> dependentParameters = new HashMap<Bean<?>, Object>();
+
+ private Set<InjectionPoint> injectionPoints;
+
+ public InjectableMethod(Method m, Object instance, Producer<T> owner, CreationalContextImpl<T> creationalContext)
+ {
+ this(m, instance, owner, creationalContext, new HashSet<InjectionPoint>(createInjectionPoints(owner, m)));
+ }
+
+ /**
+ * Constructs new instance.
+ *
+ * @param m injectable method
+ * @param instance component instance
+ */
+ public InjectableMethod(Method m, Object instance, Producer<T> owner, CreationalContextImpl<T> creationalContext, Set<InjectionPoint> ips)
+ {
+ super(owner,creationalContext);
+ method = m;
+ ownerInstance = instance;
+ injectionPoints = ips;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.apache.webbeans.inject.Injectable#doInjection()
+ */
+ public T doInjection()
+ {
+ Object owner = ownerInstance;
+ if (owner instanceof OwbNormalScopeProxy)
+ {
+ owner = NormalScopeProxyFactory.unwrapInstance(owner);
+ }
+
+ List<Object> list = new ArrayList<Object>();
+
+
+ for(int i=0;i<injectionPoints.size();i++)
+ {
+ for(InjectionPoint point : injectionPoints)
+ {
+ AnnotatedParameter<?> parameter = (AnnotatedParameter<?>)point.getAnnotated();
+ if (parameter.getPosition() == i)
+ {
+ if (point.isDelegate())
+ {
+ list.add(creationalContext.getDelegate());
+ break;
+ }
+
+ boolean injectionPoint = false;
+ if(getBean() instanceof ProducerMethodBean)
+ {
+ if(parameter.getBaseType().equals(InjectionPoint.class))
+ {
+ BeanManager manager = getWebBeansContext().getBeanManagerImpl();
+ Object reference = manager.getInjectableReference(point, creationalContext);
+ list.add(reference);
+ injectionPoint = true;
+ }
+ }
+
+ if(!injectionPoint)
+ {
+ if(isDisposable() && parameter.getAnnotation(Disposes.class) != null)
+ {
+ list.add(producerMethodInstance);
+ }
+ else
+ {
+ Object instance = inject(point);
+ InjectionResolver injectionResolver = getWebBeansContext().getBeanManagerImpl().getInjectionResolver();
+
+ Bean<?> injectedBean = injectionResolver.getInjectionPointBean(point);
+ if(injectedBean.getScope() == Dependent.class)
+ {
+ dependentParameters.put(injectedBean, instance);
+ }
+
+ list.add(instance);
+ }
+ }
+
+ break;
+ }
+ }
+ }
+
+ try
+ {
+ if (!method.isAccessible())
+ {
+ getWebBeansContext().getSecurityService().doPrivilegedSetAccessible(method, true);
+ }
+
+ return (T) method.invoke(owner, list.toArray(new Object[list.size()]));
+
+ }
+ catch (Exception e)
+ {
+ throw new WebBeansException(e);
+ }
+ }
+
+ //X TODO is this still needed? If not we can also drop the whole dependentParameters...
+ public Map<Bean<?>,Object> getDependentBeanParameters()
+ {
+ return dependentParameters;
+ }
+
+ /**
+ * @return the disposable
+ */
+ private boolean isDisposable()
+ {
+ return disposable;
+ }
+
+ /**
+ * @param disposable the disposable to set
+ */
+ public void setDisposable(boolean disposable)
+ {
+ this.disposable = disposable;
+ }
+
+ public void setProducerMethodInstance(Object instance)
+ {
+ producerMethodInstance = instance;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/inject/OWBInjector.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/inject/OWBInjector.java
new file mode 100644
index 0000000..06cd00c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/inject/OWBInjector.java
@@ -0,0 +1,61 @@
+/*
+ * 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.webbeans.inject;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.BeanManager;
+
+/**
+ * Injects dependencies of the given Java EE component
+ * instance.
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public final class OWBInjector
+{
+ private OWBInjector()
+ {
+ //No operation
+ }
+
+ /**
+ * Inject dependencies of given instance.
+ * @param beanManager the BeanManager to use
+ * @param instanceUnderInjection instance
+ * @param ownerCreationalContext CreationalContext of the owner
+ * @throws Exception if exception occurs
+ */
+ @SuppressWarnings("unchecked")
+ public static void inject(BeanManager beanManager, Object instanceUnderInjection, CreationalContext<?> ownerCreationalContext)
+ throws Exception
+ {
+ CreationalContext<?> creationalContext = ownerCreationalContext;
+ if(creationalContext == null)
+ {
+ creationalContext = beanManager.createCreationalContext(null);
+ }
+
+ AnnotatedType annotatedType = beanManager.createAnnotatedType(instanceUnderInjection.getClass());
+ beanManager.createInjectionTarget(annotatedType).inject(instanceUnderInjection, creationalContext);
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java
new file mode 100644
index 0000000..b1b6565
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java
@@ -0,0 +1,233 @@
+/*
+ * 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.webbeans.inject.impl;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.TypeVariable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.AnnotatedCallable;
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.webbeans.annotation.AnnotationManager;
+import org.apache.webbeans.annotation.NamedLiteral;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.Asserts;
+
+public class InjectionPointFactory
+{
+ private final WebBeansContext webBeansContext;
+
+ public InjectionPointFactory(WebBeansContext webBeansContext)
+ {
+ this.webBeansContext = webBeansContext;
+ }
+
+ public <X> Set<InjectionPoint> buildInjectionPoints(Bean<X> owner, AnnotatedType<X> annotatedType)
+ {
+ Set<InjectionPoint> injectionPoints = new HashSet<InjectionPoint>();
+ boolean constructorFound = false;
+ for (AnnotatedConstructor<X> constructor: annotatedType.getConstructors())
+ {
+ if (constructor.isAnnotationPresent(Inject.class))
+ {
+ if (constructorFound)
+ {
+ throw new WebBeansConfigurationException("There are more than one constructor with @Inject annotation in annotation type : "
+ + annotatedType);
+ }
+ constructorFound = true;
+ validateInitializerConstructor(constructor);
+ buildInjectionPoints(owner, constructor, injectionPoints);
+ }
+ }
+ for (AnnotatedField<? super X> field: annotatedType.getFields())
+ {
+ if (owner != null && Modifier.isPublic(field.getJavaMember().getModifiers()) && !field.isStatic())
+ {
+ if (webBeansContext.getBeanManagerImpl().isNormalScope(owner.getScope()))
+ {
+ throw new WebBeansConfigurationException("If bean has a public field, bean scope must be defined as @Scope. Bean is : "
+ + owner.getBeanClass().getName());
+ }
+ }
+ if (field.isAnnotationPresent(Inject.class))
+ {
+ injectionPoints.add(buildInjectionPoint(owner, field));
+ }
+ }
+ for (AnnotatedMethod<? super X> method: annotatedType.getMethods())
+ {
+ if (method.isAnnotationPresent(Inject.class) && !Modifier.isStatic(method.getJavaMember().getModifiers()))
+ {
+ validateInitializerMethod(method);
+ buildInjectionPoints(owner, method, injectionPoints);
+ }
+ }
+ return injectionPoints;
+ }
+
+ public <X> InjectionPoint buildInjectionPoint(Bean<?> owner, AnnotatedField<X> annotField)
+ {
+ Asserts.assertNotNull(annotField, "annotField parameter can not be null");
+
+ Annotation[] annots = AnnotationUtil.asArray(annotField.getAnnotations());
+ Annotation[] qualifierAnnots = webBeansContext.getAnnotationManager().getQualifierAnnotations(annots);
+
+ //@Named update for injection fields!
+ for (int i=0; i < qualifierAnnots.length; i++)
+ {
+ Annotation qualifier = qualifierAnnots[i];
+ if (qualifier.annotationType().equals(Named.class))
+ {
+ Named named = (Named)qualifier;
+ String value = named.value();
+
+ if (value == null || value.equals(""))
+ {
+ NamedLiteral namedLiteral = new NamedLiteral();
+ namedLiteral.setValue(annotField.getJavaMember().getName());
+ qualifierAnnots[i] = namedLiteral;
+ }
+
+ break;
+ }
+ }
+
+ return new InjectionPointImpl(owner, Arrays.asList(qualifierAnnots), annotField);
+ }
+
+ public <X> InjectionPoint buildInjectionPoint(Bean<?> owner, AnnotatedParameter<X> parameter)
+ {
+ Asserts.assertNotNull(parameter, "parameter parameter can not be null");
+ Set<Annotation> anns = parameter.getAnnotations();
+ Annotation[] qualifierAnnots = webBeansContext.getAnnotationManager().getQualifierAnnotations(anns.toArray(new Annotation[anns.size()]));
+ return new InjectionPointImpl(owner, Arrays.asList(qualifierAnnots), parameter);
+ }
+
+ public <X> List<InjectionPoint> buildInjectionPoints(Bean<?> owner, AnnotatedCallable<X> callable)
+ {
+ List<InjectionPoint> lists = new ArrayList<InjectionPoint>();
+ buildInjectionPoints(owner, callable, lists);
+ return lists;
+ }
+
+ private <X> void buildInjectionPoints(Bean<?> owner, AnnotatedCallable<X> callable, Collection<InjectionPoint> lists)
+ {
+ Asserts.assertNotNull(callable, "callable parameter can not be null");
+
+ List<AnnotatedParameter<X>> parameters = callable.getParameters();
+
+ for (AnnotatedParameter<?> parameter : parameters)
+ {
+ //@Observes is not injection point type for method parameters
+ if (parameter.getAnnotation(Observes.class) == null)
+ {
+ lists.add(buildInjectionPoint(owner, parameter));
+ }
+ }
+ }
+
+ public static InjectionPoint getPartialInjectionPoint(Bean<?> owner, AnnotatedParameter<?> parameter, Annotation...bindings)
+ {
+ return new InjectionPointImpl(owner, Arrays.asList(bindings), parameter);
+ }
+
+ /**
+ * This method gets used for InjectionPoints needed during programmatic lookup.
+ */
+ public static InjectionPoint getVirtualInjectionPoint(Bean<?> bean)
+ {
+ return new InjectionPointImpl(bean.getBeanClass(), bean.getQualifiers());
+ }
+
+ private void validateInitializerConstructor(AnnotatedConstructor<?> constructor)
+ {
+ for (AnnotatedParameter<?> parameter: constructor.getParameters())
+ {
+ if (parameter.isAnnotationPresent(Disposes.class))
+ {
+ throw new WebBeansConfigurationException("Constructor parameter annotations can not contain @Disposes annotation in annotated constructor : " + constructor);
+ }
+
+ if(parameter.isAnnotationPresent(Observes.class))
+ {
+ throw new WebBeansConfigurationException("Constructor parameter annotations can not contain @Observes annotation in annotated constructor : " + constructor);
+ }
+ }
+ }
+
+ /**
+ * add the definitions for a @Initializer method.
+ */
+ private void validateInitializerMethod(AnnotatedMethod<?> annotatedMethod)
+ {
+ Method method = annotatedMethod.getJavaMember();
+
+ TypeVariable<?>[] args = method.getTypeParameters();
+ if(args.length > 0)
+ {
+ throw new WebBeansConfigurationException("Error in defining injected methods in annotated method : " + annotatedMethod+
+ ". Reason : Initializer methods must not be generic.");
+ }
+
+ if (annotatedMethod.isAnnotationPresent(Produces.class))
+ {
+ throw new WebBeansConfigurationException("Error in defining injected methods in annotated method : " + annotatedMethod+
+ ". Reason : Initializer method can not be annotated with @Produces.");
+
+ }
+
+ AnnotationManager annotationManager = webBeansContext.getAnnotationManager();
+
+ for (AnnotatedParameter<?> annotatedParameter : annotatedMethod.getParameters())
+ {
+ annotationManager.checkForNewQualifierForDeployment(annotatedParameter.getBaseType(), annotatedMethod.getDeclaringType().getJavaClass(),
+ method.getName(), AnnotationUtil.asArray(annotatedParameter.getAnnotations()));
+
+ if(annotatedParameter.isAnnotationPresent(Disposes.class) ||
+ annotatedParameter.isAnnotationPresent(Observes.class))
+ {
+ throw new WebBeansConfigurationException("Error in defining injected methods in annotated method : " + annotatedMethod+
+ ". Reason : Initializer method parameters does not contain @Observes or @Dispose annotations.");
+
+ }
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java
new file mode 100644
index 0000000..6932172
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java
@@ -0,0 +1,329 @@
+/*
+ * 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.webbeans.inject.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamClass;
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Type;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.decorator.Delegate;
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.event.EventUtil;
+import org.apache.webbeans.portable.AnnotatedElementFactory;
+import org.apache.webbeans.util.Asserts;
+import org.apache.webbeans.util.WebBeansUtil;
+
+class InjectionPointImpl implements InjectionPoint, Serializable
+{
+ private static final long serialVersionUID = 1047233127758068484L;
+
+ private Set<Annotation> qualifierAnnotations = new HashSet<Annotation>();
+
+ private Bean<?> ownerBean;
+
+ private Member injectionMember;
+
+ private Type injectionType;
+
+ private Annotated annotated;
+
+ private boolean transientt;
+
+ private boolean delegate;
+
+ InjectionPointImpl(Bean<?> ownerBean, Collection<Annotation> qualifiers, AnnotatedField<?> annotatedField)
+ {
+ this(ownerBean, annotatedField.getBaseType(), qualifiers, annotatedField,
+ annotatedField.getJavaMember(), annotatedField.isAnnotationPresent(Delegate.class), Modifier.isTransient(annotatedField.getJavaMember().getModifiers()));
+ }
+
+ InjectionPointImpl(Bean<?> ownerBean, Collection<Annotation> qualifiers, AnnotatedParameter<?> parameter)
+ {
+ this(ownerBean, parameter.getBaseType(), qualifiers, parameter, parameter.getDeclaringCallable().getJavaMember(), parameter.isAnnotationPresent(Delegate.class), false);
+ }
+
+ /**
+ * This constructor is used to create a 'virtual' InjectionPoint.
+ * This is needed if an InjectionPoint was needed during a programmatic lookup.
+ */
+ InjectionPointImpl(Type type, Collection<Annotation> qualifiers)
+ {
+ this(null, type, qualifiers, null, null, false, false);
+ }
+
+ private InjectionPointImpl(Bean<?> ownerBean, Type type, Collection<Annotation> qualifiers, Annotated annotated, Member member, boolean delegate, boolean isTransient)
+ {
+ Asserts.assertNotNull(type, "required type may not be null");
+ Asserts.assertNotNull(qualifiers, "qualifiers may not be null");
+ this.ownerBean = ownerBean;
+ injectionType = type;
+ qualifierAnnotations = Collections.unmodifiableSet(new HashSet<Annotation>(qualifiers));
+ this.annotated = annotated;
+ injectionMember = member;
+ this.delegate = delegate;
+ transientt = isTransient;
+ if(!WebBeansUtil.checkObtainsInjectionPointConditions(this))
+ {
+ EventUtil.checkObservableInjectionPointConditions(this);
+ }
+ }
+
+ @Override
+ public Bean<?> getBean()
+ {
+ return ownerBean;
+ }
+
+ @Override
+ public Set<Annotation> getQualifiers()
+ {
+
+ return qualifierAnnotations;
+ }
+
+ @Override
+ public Member getMember()
+ {
+ return injectionMember;
+ }
+
+ @Override
+ public Type getType()
+ {
+
+ return injectionType;
+ }
+
+
+ @Override
+ public Annotated getAnnotated()
+ {
+ return annotated;
+ }
+
+ @Override
+ public boolean isDelegate()
+ {
+ return delegate;
+ }
+
+ @Override
+ public boolean isTransient()
+ {
+ return transientt;
+ }
+
+ private void writeObject(java.io.ObjectOutputStream op) throws IOException
+ {
+ ObjectOutputStream out = new ObjectOutputStream(op);
+
+ //Write the owning bean class
+ out.writeObject(ownerBean.getBeanClass());
+
+ Set<Annotation> qualifiers = ownerBean.getQualifiers();
+ for(Annotation qualifier : qualifiers)
+ {
+ out.writeObject(Character.valueOf('-')); // throw-away delimiter so alternating annotations don't get swallowed in the read.
+ out.writeObject(qualifier);
+
+ }
+
+ out.writeObject(Character.valueOf('~'));
+
+ if(injectionMember instanceof Field)
+ {
+ out.writeByte(0);
+ out.writeUTF(injectionMember.getName());
+ }
+
+ if(injectionMember instanceof Method)
+ {
+ out.writeByte(1);
+ out.writeUTF(injectionMember.getName());
+ Method method = (Method) injectionMember;
+ Class<?>[] parameters = method.getParameterTypes();
+ out.writeObject(parameters);
+
+ AnnotatedParameter<?> ap = (AnnotatedParameter<?>) annotated;
+ out.writeByte(ap.getPosition());
+
+ }
+
+ if(injectionMember instanceof Constructor)
+ {
+ out.writeByte(2);
+ Constructor<?> constr = (Constructor<?>) injectionMember;
+ Class<?>[] parameters = constr.getParameterTypes();
+ out.writeObject(parameters);
+
+ AnnotatedParameter<?> ap = (AnnotatedParameter<?>) annotated;
+ out.writeByte(ap.getPosition());
+
+ }
+
+ out.writeBoolean(delegate);
+ out.writeBoolean(transientt);
+ out.flush();
+
+ }
+
+ public class CustomObjectInputStream extends ObjectInputStream
+ {
+ private ClassLoader classLoader;
+
+ public CustomObjectInputStream(InputStream in, ClassLoader classLoader) throws IOException
+ {
+ super(in);
+ this.classLoader = classLoader;
+ }
+
+ @Override
+ protected Class<?> resolveClass(ObjectStreamClass desc) throws ClassNotFoundException
+ {
+ return Class.forName(desc.getName(), false, classLoader);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void readObject(java.io.ObjectInputStream inp) throws IOException, ClassNotFoundException
+ {
+
+ ObjectInputStream in = new CustomObjectInputStream(inp, WebBeansUtil.getCurrentClassLoader());
+
+ Class<?> beanClass = (Class<?>)in.readObject();
+ Set<Annotation> anns = new HashSet<Annotation>();
+ WebBeansContext webBeansContext = WebBeansContext.currentInstance();
+ AnnotatedElementFactory annotatedElementFactory = webBeansContext.getAnnotatedElementFactory();
+
+ while(!in.readObject().equals('~')) // read throw-away '-' or '~' terminal delimiter.
+ {
+ Annotation ann = (Annotation) in.readObject(); // now read the annotation.
+ anns.add(ann);
+ }
+
+ //process annotations
+ ownerBean = webBeansContext.getBeanManagerImpl().getBeans(beanClass, anns.toArray(new Annotation[anns.size()])).iterator().next();
+ qualifierAnnotations = anns;
+
+ // determine type of injection point member (0=field, 1=method, 2=constructor) and read...
+ int c = in.readByte();
+ if(c == 0)
+ {
+ String fieldName = in.readUTF();
+ Field field = webBeansContext.getSecurityService().doPrivilegedGetDeclaredField(beanClass, fieldName);
+
+ injectionMember = field;
+
+ AnnotatedType<?> annotatedType = annotatedElementFactory.newAnnotatedType(beanClass);
+ annotated = annotatedElementFactory.newAnnotatedField(field, annotatedType);
+ injectionType = field.getGenericType();
+
+ }
+ else if(c == 1)
+ {
+ String methodName = in.readUTF();
+ Class<?>[] parameters = (Class<?>[])in.readObject();
+
+ Method method = webBeansContext.getSecurityService().doPrivilegedGetDeclaredMethod(beanClass, methodName, parameters);
+ injectionMember = method;
+
+ AnnotatedType<?> annotatedType = annotatedElementFactory.newAnnotatedType(beanClass);
+ AnnotatedMethod<Object> am = (AnnotatedMethod<Object>)annotatedElementFactory.
+ newAnnotatedMethod((Method) injectionMember,annotatedType);
+ List<AnnotatedParameter<Object>> annParameters = am.getParameters();
+
+ annotated = annParameters.get(in.readByte());
+ injectionType = annotated.getBaseType();
+
+ }
+ else if(c == 2)
+ {
+ Class<?>[] parameters = (Class<?>[])in.readObject();
+ try
+ {
+ injectionMember = beanClass.getConstructor(parameters);
+
+ }
+ catch(NoSuchMethodException e)
+ {
+ injectionMember = null;
+ }
+
+ AnnotatedType<Object> annotatedType = (AnnotatedType<Object>)annotatedElementFactory.newAnnotatedType(beanClass);
+ AnnotatedConstructor<Object> am = annotatedElementFactory
+ .newAnnotatedConstructor((Constructor<Object>) injectionMember,annotatedType);
+ List<AnnotatedParameter<Object>> annParameters = am.getParameters();
+
+ annotated = annParameters.get(in.readByte());
+ injectionType = annotated.getBaseType();
+ }
+
+ delegate = in.readBoolean();
+ transientt = in.readBoolean();
+
+ }
+
+
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder();
+ if(injectionMember instanceof Constructor)
+ {
+ Constructor<?> constructor = (Constructor<?>) injectionMember;
+ buffer.append("Constructor Injection Point, constructor name : ").append(constructor.getName()).append(", Bean Owner : [").append(ownerBean).append("]");
+ }
+ else if(injectionMember instanceof Method)
+ {
+ Method method = (Method) injectionMember;
+ buffer.append("Method Injection Point, method name : ").append(method.getName()).append(", Bean Owner : [").append(ownerBean).append("]");
+
+ }
+ else if(injectionMember instanceof Field)
+ {
+ Field field = (Field) injectionMember;
+ buffer.append("Field Injection Point, field name : ").append(field.getName()).append(", Bean Owner : [").append(ownerBean).append("]");
+ }
+
+ return buffer.toString();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
new file mode 100644
index 0000000..6355727
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
@@ -0,0 +1,341 @@
+/*
+ * 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.webbeans.inject.instance;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.util.TypeLiteral;
+import javax.inject.Provider;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.container.InjectionResolver;
+import org.apache.webbeans.context.creational.CreationalContextImpl;
+import org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler;
+import org.apache.webbeans.proxy.OwbNormalScopeProxy;
+import org.apache.webbeans.util.ClassUtil;
+import org.apache.webbeans.util.InjectionExceptionUtil;
+import org.apache.webbeans.util.OwbCustomObjectInputStream;
+import org.apache.webbeans.util.WebBeansUtil;
+
+/**
+ * Implements the {@link Instance} interface.
+ *
+ * @param <T> specific instance type
+ */
+public class InstanceImpl<T> implements Instance<T>, Serializable
+{
+ private static final long serialVersionUID = -8401944412490389024L;
+
+ /** Injected class type */
+ private Type injectionClazz;
+
+ /**
+ * injection point, needed for injection into producer method and used to determine the BDA it was loaded from or null.
+ */
+ private InjectionPoint injectionPoint;
+
+ /** Qualifier annotations appeared on the injection point */
+ private Set<Annotation> qualifierAnnotations = new HashSet<Annotation>();
+
+ private WebBeansContext webBeansContext;
+
+ private CreationalContextImpl<?> parentCreationalContext;
+
+ /**
+ * Creates new instance.
+ *
+ * @param injectionClazz injection class type
+ * @param injectionPoint null or injection point
+ * @param webBeansContext
+ * @param creationalContext will get used for creating @Dependent beans
+ * @param annotations qualifier annotations
+ */
+ public InstanceImpl(Type injectionClazz, InjectionPoint injectionPoint, WebBeansContext webBeansContext,
+ CreationalContextImpl<?> creationalContext, Annotation... annotations)
+ {
+ this.injectionClazz = injectionClazz;
+ this.injectionPoint = injectionPoint;
+ parentCreationalContext = creationalContext;
+
+ for (Annotation ann : annotations)
+ {
+ qualifierAnnotations.add(ann);
+ }
+ this.webBeansContext = webBeansContext;
+ }
+
+ /**
+ * Returns the bean instance with given qualifier annotations.
+ *
+ * @return bean instance
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public T get()
+ {
+ Annotation[] anns = new Annotation[qualifierAnnotations.size()];
+ anns = qualifierAnnotations.toArray(anns);
+
+ Set<Bean<?>> beans = resolveBeans();
+
+ BeanManagerImpl beanManager = webBeansContext.getBeanManagerImpl();
+
+ Bean<?> bean = beanManager.resolve(beans);
+
+ if (bean == null)
+ {
+ InjectionExceptionUtil.throwUnsatisfiedResolutionException(ClassUtil.getClazz(injectionClazz), injectionPoint, anns);
+ }
+
+ // since Instance<T> is Dependent, we we gonna use the parent CreationalContext by default
+ CreationalContext<?> creationalContext = parentCreationalContext;
+
+ boolean isDependentBean = WebBeansUtil.isDependent(bean);
+
+ if (!isDependentBean)
+ {
+ // but for all NormalScoped beans we will need to create a fresh CreationalContext
+ creationalContext = beanManager.createCreationalContext(bean);
+ }
+ if (!(creationalContext instanceof CreationalContextImpl))
+ {
+ creationalContext = webBeansContext.getCreationalContextFactory().wrappedCreationalContext(creationalContext, bean);
+ }
+
+ ((CreationalContextImpl<?>)creationalContext).putInjectionPoint(injectionPoint);
+ try
+ {
+ return (T) beanManager.getReference(bean, injectionClazz, creationalContext);
+ }
+ finally
+ {
+ ((CreationalContextImpl<?>)creationalContext).removeInjectionPoint();
+ }
+ }
+
+ /**
+ * Returns set of resolved beans.
+ *
+ * @return set of resolved beans
+ */
+ private Set<Bean<?>> resolveBeans()
+ {
+ Annotation[] anns = new Annotation[qualifierAnnotations.size()];
+ anns = qualifierAnnotations.toArray(anns);
+
+ InjectionResolver injectionResolver = webBeansContext.getBeanManagerImpl().getInjectionResolver();
+
+ Bean<?> injectionPointBean = injectionPoint.getBean();
+ Class<?> injectionPointClass = null;
+ if (injectionPointBean != null)
+ {
+ injectionPointClass = injectionPointBean.getBeanClass();
+ }
+ Set<Bean<?>> beans = injectionResolver.implResolveByType(false, injectionClazz, injectionPointClass, anns);
+ return injectionResolver.resolveAll(beans);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isAmbiguous()
+ {
+ Set<Bean<?>> beans = resolveBeans();
+
+ return beans.size() > 1;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isUnsatisfied()
+ {
+ Set<Bean<?>> beans = resolveBeans();
+
+ return beans.size() == 0;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Instance<T> select(Annotation... qualifiers)
+ {
+ Annotation[] newQualifiersArray = getAdditionalQualifiers(qualifiers);
+ return new InstanceImpl<T>(injectionClazz, injectionPoint, webBeansContext, parentCreationalContext, newQualifiersArray);
+ }
+
+ /**
+ * Returns total qualifiers array
+ *
+ * @param qualifiers additional qualifiers
+ * @return total qualifiers array
+ */
+ private Annotation[] getAdditionalQualifiers(Annotation[] qualifiers)
+ {
+ webBeansContext.getAnnotationManager().checkQualifierConditions(qualifiers);
+
+ Set<Annotation> newQualifiers = new HashSet<Annotation>(qualifierAnnotations);
+
+ if (qualifiers != null && qualifiers.length > 0)
+ {
+ for (int i = 0; i < qualifiers.length; i++)
+ {
+ newQualifiers.add(qualifiers[i]);
+ }
+ }
+
+ Annotation[] newQualifiersArray = new Annotation[newQualifiers.size()];
+ newQualifiersArray = newQualifiers.toArray(newQualifiersArray);
+
+ return newQualifiersArray;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public <U extends T> Instance<U> select(Class<U> subtype, Annotation... qualifiers)
+ {
+ webBeansContext.getAnnotationManager().checkQualifierConditions(qualifiers);
+
+ Type sub = subtype;
+
+ if(sub == null)
+ {
+ sub = injectionClazz;
+ }
+
+ Annotation[] newQualifiers = getAdditionalQualifiers(qualifiers);
+
+ return new InstanceImpl<U>(sub, injectionPoint, webBeansContext, parentCreationalContext, newQualifiers);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public <U extends T> Instance<U> select(TypeLiteral<U> subtype, Annotation... qualifiers)
+ {
+ return select(subtype.getRawType(), qualifiers);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public Iterator<T> iterator()
+ {
+ Set<Bean<?>> beans = resolveBeans();
+ List<T> instances = new ArrayList<T>();
+ parentCreationalContext.putInjectionPoint(injectionPoint);
+ try
+ {
+ for(Bean<?> bean : beans)
+ {
+ T instance = (T) webBeansContext.getBeanManagerImpl().getReference(bean,null, parentCreationalContext);
+ instances.add(instance);
+ }
+ }
+ finally
+ {
+ parentCreationalContext.removeInjectionPoint();
+ }
+
+ return instances.iterator();
+ }
+
+ public void destroy(T instance)
+ {
+ if (instance instanceof OwbNormalScopeProxy)
+ {
+ OwbNormalScopeProxy proxy = (OwbNormalScopeProxy) instance;
+ Provider<T> provider = webBeansContext.getNormalScopeProxyFactory().getInstanceProvider(proxy);
+ NormalScopedBeanInterceptorHandler handler = (NormalScopedBeanInterceptorHandler)provider;
+ Bean<T> bean = (Bean<T>)handler.getBean();
+ CreationalContext<T> creationalContext = (CreationalContext<T>)parentCreationalContext;
+ bean.destroy(instance, creationalContext);
+ }
+ else
+ {
+ parentCreationalContext.destroyDependent(instance);
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream op) throws IOException
+ {
+ ObjectOutputStream oos = new ObjectOutputStream(op);
+ oos.writeObject(injectionClazz);
+ oos.writeObject(qualifierAnnotations);
+ oos.writeObject(injectionPoint);
+
+ oos.flush();
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException
+ {
+ webBeansContext = WebBeansContext.currentInstance();
+ final ObjectInputStream inputStream = new OwbCustomObjectInputStream(in, WebBeansUtil.getCurrentClassLoader());
+ injectionClazz = (Type)inputStream.readObject();
+ qualifierAnnotations = (Set<Annotation>)inputStream.readObject();
+ injectionPoint = (InjectionPoint) inputStream.readObject();
+ }
+
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append("Instance<");
+ builder.append(ClassUtil.getClazz(injectionClazz).getName());
+ builder.append("> injectionPointClazz=").append(injectionPoint);
+
+ builder.append(",with qualifier annotations {");
+ int i = 0;
+ for (Annotation qualifier : qualifierAnnotations)
+ {
+ if (i != 0)
+ {
+ builder.append(",");
+ }
+
+ builder.append(qualifier.toString());
+ }
+
+ builder.append("}");
+
+ return builder.toString();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/AbstractInvocationContext.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/AbstractInvocationContext.java
new file mode 100644
index 0000000..1a1350c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/AbstractInvocationContext.java
@@ -0,0 +1,130 @@
+/*
+ * 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.webbeans.intercept;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.interceptor.InvocationContext;
+
+import org.apache.webbeans.util.ExceptionUtil;
+
+public abstract class AbstractInvocationContext<T> implements InvocationContext
+{
+
+ private T target;
+ private AccessibleObject member;
+ private Object[] parameters;
+ private Map<String, Object> contextData;
+ private Object timer;
+
+ public AbstractInvocationContext(T target, AccessibleObject member, Object[] parameters)
+ {
+ this.target = target;
+ this.member = member;
+ this.parameters = parameters;
+ if (!member.isAccessible())
+ {
+ member.setAccessible(true);
+ }
+ }
+
+ public AbstractInvocationContext(T target, Method method, Object[] parameters, Object timer)
+ {
+ this(target, method, parameters);
+ this.timer = timer;
+ }
+
+ @Override
+ public T getTarget()
+ {
+ return target;
+ }
+
+ @Override
+ public Method getMethod()
+ {
+ if (Method.class.isInstance(member))
+ {
+ return Method.class.cast(member);
+ }
+ return null;
+ }
+
+ @Override
+ public Object[] getParameters()
+ {
+ return parameters;
+ }
+
+ @Override
+ public void setParameters(Object[] parameters)
+ {
+ this.parameters = parameters;
+ }
+
+ @Override
+ public Map<String, Object> getContextData()
+ {
+ if (contextData == null)
+ {
+ contextData = new HashMap<String, Object>();
+ }
+ return contextData;
+ }
+
+ @Override
+ public Object getTimer()
+ {
+ return timer;
+ }
+
+ @Override
+ public Object proceed() throws Exception
+ {
+ try
+ {
+ final Method m = getMethod();
+ if (m != null)
+ {
+ return m.invoke(target, parameters);
+ }
+ return getConstructor().newInstance(parameters);
+ }
+ catch (final InvocationTargetException ite)
+ {
+ // unpack the reflection Exception
+ throw ExceptionUtil.throwAsRuntimeException(ite.getCause());
+ }
+ }
+
+ // @Override
+ public Constructor getConstructor()
+ {
+ if (Constructor.class.isInstance(member))
+ {
+ return Constructor.class.cast(member);
+ }
+ return null;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ApplicationScopedBeanInterceptorHandler.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ApplicationScopedBeanInterceptorHandler.java
new file mode 100644
index 0000000..a589bee
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ApplicationScopedBeanInterceptorHandler.java
@@ -0,0 +1,67 @@
+/*
+ * 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.webbeans.intercept;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
+
+/**
+ * <p>This is a {@link javax.inject.Provider} especially
+ * made for @ApplicationScoped beans.</p>
+ *
+ * <p>Since there is only one single contextual instance of an @ApplicationScoped bean,
+ * we can simply cache this instance inside our bean. We only need to reload this instance
+ * if it is null. This happens at the first usage and after the MethodHandler got deserialized</p>
+ */
+public class ApplicationScopedBeanInterceptorHandler extends NormalScopedBeanInterceptorHandler
+{
+ /**default serial id*/
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Cached bean instance. Please note that it is only allowed to
+ * use this special proxy if you don't use OpenWebBeans in an EAR
+ * scenario. In this case we must not cache @ApplicationScoped
+ * contextual instances because they could be injected into EJBs or other
+ * shared instances which span over multiple web-apps.
+ */
+ private transient Object cachedInstance = null;
+
+
+ public ApplicationScopedBeanInterceptorHandler(BeanManager beanManager, Bean<?> bean)
+ {
+ super(beanManager, bean);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Object getContextualInstance()
+ {
+ if (cachedInstance == null)
+ {
+ cachedInstance = super.getContextualInstance();
+ }
+
+ return cachedInstance;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/DecoratorHandler.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/DecoratorHandler.java
new file mode 100644
index 0000000..b6ab33a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/DecoratorHandler.java
@@ -0,0 +1,218 @@
+/*
+ * 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.webbeans.intercept;
+
+import org.apache.webbeans.component.OwbBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.intercept.InterceptorResolutionService.BeanInterceptorInfo;
+import org.apache.webbeans.intercept.InterceptorResolutionService.BusinessMethodInterceptorInfo;
+import org.apache.webbeans.portable.AbstractProducer;
+import org.apache.webbeans.proxy.InterceptorHandler;
+import org.apache.webbeans.util.ExceptionUtil;
+import org.apache.webbeans.util.WebBeansUtil;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.Decorator;
+import javax.enterprise.inject.spi.Producer;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.NotSerializableException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.io.ObjectStreamException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+/**
+ * InterceptorHandler which handles all the Decorators on the InjectionTarget.
+ * This one always gets added at the last position in the interceptor chain.
+ */
+public class DecoratorHandler implements InterceptorHandler, Externalizable
+{
+
+ private BeanInterceptorInfo interceptorInfo;
+ private List<Decorator<?>> decorators;
+ private Map<Decorator<?>, ?> instances;
+ private int index;
+ private Object target;
+ private String passivationId;
+
+ public DecoratorHandler(BeanInterceptorInfo interceptorInfo, Map<Decorator<?>, ?> instances, int index, Object target, String passivationId)
+ {
+ this.interceptorInfo = interceptorInfo;
+ decorators = interceptorInfo.getDecorators();
+ this.instances = instances;
+ this.index = index;
+ this.target = target;
+ this.passivationId = passivationId;
+ }
+
+ public DecoratorHandler()
+ {
+ // no-op: for serialization
+ }
+
+ @Override
+ public Object invoke(Method method, Object[] args)
+ {
+ BusinessMethodInterceptorInfo methodInterceptorInfo = interceptorInfo.getBusinessMethodsInfo().get(method);
+ LinkedHashMap<Decorator<?>, Method> methodDecorators = methodInterceptorInfo.getMethodDecorators();
+ if (methodDecorators != null)
+ {
+ for (int i = index; i < decorators.size(); i++)
+ {
+ Decorator<?> decorator = decorators.get(i);
+ Method decoratingMethod = methodDecorators.get(decorator);
+ if (decoratingMethod != null)
+ {
+ try
+ {
+ if (!decoratingMethod.isAccessible())
+ {
+ decoratingMethod.setAccessible(true);
+ }
+ return decoratingMethod.invoke(instances.get(decorator), args);
+ }
+ catch (InvocationTargetException e)
+ {
+ return ExceptionUtil.throwAsRuntimeException(e.getTargetException());
+ }
+ catch (Exception e)
+ {
+ return ExceptionUtil.throwAsRuntimeException(e);
+ }
+ }
+ }
+ }
+ try
+ {
+ if (!method.isAccessible())
+ {
+ method.setAccessible(true);
+ }
+ return method.invoke(target, args);
+ }
+ catch (InvocationTargetException e)
+ {
+ return ExceptionUtil.throwAsRuntimeException(e.getTargetException());
+ }
+ catch (Exception e)
+ {
+ return ExceptionUtil.throwAsRuntimeException(e);
+ }
+ }
+
+ @Override
+ public void writeExternal(final ObjectOutput out) throws IOException
+ {
+ out.writeInt(index);
+ out.writeObject(target);
+
+ out.writeInt(instances.size());
+ for (final Map.Entry<Decorator<?>, ?> entry : instances.entrySet())
+ {
+ final Decorator<?> key = entry.getKey();
+ serializeDecorator(out, key);
+ out.writeObject(entry.getValue());
+ }
+
+ out.writeInt(decorators.size());
+ for (final Decorator<?> decorator : decorators)
+ {
+ serializeDecorator(out, decorator);
+ }
+
+ out.writeUTF(passivationId);
+ }
+
+ Object readResolve() throws ObjectStreamException
+ {
+ final WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ final BeanManager beanManager = webBeansContext.getBeanManagerImpl();
+ final Bean<?> bean = beanManager.getPassivationCapableBean(passivationId);
+
+ return webBeansContext.getInterceptorDecoratorProxyFactory().createProxyInstance(
+ webBeansContext.getInterceptorDecoratorProxyFactory().getCachedProxyClass(bean),
+ target,
+ this
+ );
+ }
+
+ @Override
+ public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ index = in.readInt();
+ target = in.readObject();
+
+ final int instancesSize = in.readInt();
+ final WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ final BeanManager beanManager = webBeansContext.getBeanManagerImpl();
+
+ final Map<Decorator<?>, Object> tmpInstances = new HashMap<Decorator<?>, Object>();
+ for (int i = 0; i < instancesSize; i++)
+ {
+ final Decorator<?> bean = (Decorator<?>) beanManager.getPassivationCapableBean(in.readUTF());
+ final Object value = in.readObject();
+ tmpInstances.put(bean, value);
+ }
+ instances = tmpInstances;
+
+ final int decoratorsSize = in.readInt();
+ decorators = new CopyOnWriteArrayList<Decorator<?>>();
+ for (int i = 0; i < decoratorsSize; i++)
+ {
+ decorators.add((Decorator<?>) beanManager.getPassivationCapableBean(in.readUTF()));
+ }
+
+ passivationId = in.readUTF();
+ final Bean<?> bean = beanManager.getPassivationCapableBean(passivationId);
+ if (bean instanceof OwbBean)
+ {
+ final Producer<?> producer = ((OwbBean<?>)bean).getProducer();
+ if (producer instanceof AbstractProducer)
+ {
+ interceptorInfo = ((AbstractProducer<?>)producer).getInterceptorInfo();
+ }
+ else
+ {
+ // TODO
+ }
+ }
+ else
+ {
+ // TODO
+ }
+ }
+
+ private static void serializeDecorator(final ObjectOutput out, final Decorator<?> key) throws IOException
+ {
+ final String id = WebBeansUtil.getPassivationId(key);
+ if (id == null)
+ {
+ throw new NotSerializableException(key + " is not serializable");
+ }
+ out.writeUTF(id);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/DefaultInterceptorHandler.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/DefaultInterceptorHandler.java
new file mode 100644
index 0000000..a8889e6
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/DefaultInterceptorHandler.java
@@ -0,0 +1,325 @@
+/*
+ * 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.webbeans.intercept;
+
+import org.apache.webbeans.component.InjectionTargetBean;
+import org.apache.webbeans.component.SelfInterceptorBean;
+import org.apache.webbeans.component.WebBeansType;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.portable.InjectionTargetImpl;
+import org.apache.webbeans.proxy.InterceptorHandler;
+import org.apache.webbeans.util.ExceptionUtil;
+import org.apache.webbeans.util.WebBeansUtil;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.enterprise.inject.spi.InterceptionType;
+import javax.enterprise.inject.spi.Interceptor;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.NotSerializableException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.io.ObjectStreamException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class DefaultInterceptorHandler<T> implements InterceptorHandler, Externalizable
+{
+ private static final String SELF_KEY = "SELF_INTERCEPTOR";
+
+ /**
+ * The native contextual instance target instance.
+ * This is the unproxies and undecorated instance.
+ * It e.g. get's used for direct event delivery to private Observer methods.
+ */
+ private T target;
+
+ /**
+ * The instance the Interceptors get applied on.
+ * If there is no Decorator involved, then this is the same like {@link #target}.
+ * For decorated beans this will point to the outermost Decorator instance.
+ */
+ private T delegate;
+
+ /**
+ * The passivation if in case this is a
+ * {@link javax.enterprise.inject.spi.PassivationCapable} bean.
+ * we just keep this field for serializing it away
+ */
+ private String beanPassivationId;
+
+
+ private Map<Method, List<Interceptor<?>>> interceptors;
+ private Map<Interceptor<?>, ?> instances;
+
+ /**
+ * InterceptorHandler wich gets used in our InjectionTargets which
+ * support interceptors and decorators
+ * @param target the decorated and intercepted instance. Needed for delivering Events to private methods, etc.
+ * @param delegate the outermost Decorator or the intercepted instance
+ * @param interceptors Map with all active interceptors for each method.
+ * @param instances the Interceptor instances
+ * @param beanPassivationId passivationId if a Bean is {@link javax.enterprise.inject.spi.PassivationCapable}
+ */
+ public DefaultInterceptorHandler(T target,
+ T delegate,
+ Map<Method, List<Interceptor<?>>> interceptors,
+ Map<Interceptor<?>, ?> instances,
+ String beanPassivationId)
+ {
+ this.target = target;
+ this.delegate = delegate;
+ this.instances = instances;
+ this.interceptors = interceptors;
+ this.beanPassivationId = beanPassivationId;
+ }
+
+ public DefaultInterceptorHandler()
+ {
+ // no-op: for serialization
+ }
+
+ public T getTarget()
+ {
+ return target;
+ }
+
+ public T getDelegate()
+ {
+ return delegate;
+ }
+
+ public Map<Interceptor<?>, ?> getInstances()
+ {
+ return instances;
+ }
+
+ public Map<Method, List<Interceptor<?>>> getInterceptors()
+ {
+ return interceptors;
+ }
+
+ @Override
+ public Object invoke(Method method, Object[] parameters)
+ {
+ try
+ {
+ List<Interceptor<?>> methodInterceptors = interceptors.get(method);
+ if (methodInterceptors == null)
+ {
+ methodInterceptors = Collections.emptyList();
+ }
+
+ InterceptorInvocationContext<T> ctx
+ = new InterceptorInvocationContext<T>(delegate, InterceptionType.AROUND_INVOKE, methodInterceptors, instances, method, parameters);
+
+ return ctx.proceed();
+ }
+ catch (Exception e)
+ {
+ return ExceptionUtil.throwAsRuntimeException(e);
+ }
+ }
+
+ /**
+ * The following code gets generated into the proxy:
+ *
+ * <pre>
+ * Object writeReplace() throws ObjectStreamException
+ * {
+ * return provider;
+ * }
+ * </pre>
+ *
+ * The trick is to replace the generated proxy class with this handler
+ * and on deserialisation we use readResolve to create/resolve
+ * the proxy class again.
+ */
+ @SuppressWarnings("unused")
+ Object readResolve() throws ObjectStreamException
+ {
+ final WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ final BeanManager beanManager = webBeansContext.getBeanManagerImpl();
+ final Bean<T> bean = (Bean<T>) beanManager.getPassivationCapableBean(beanPassivationId);
+
+ return webBeansContext.getInterceptorDecoratorProxyFactory().createProxyInstance(
+ webBeansContext.getInterceptorDecoratorProxyFactory().getCachedProxyClass(bean),
+ target,
+ this
+ );
+ }
+
+ @Override
+ public void writeExternal(final ObjectOutput out) throws IOException
+ {
+ out.writeObject(target);
+
+ final boolean noDecorator = target == delegate;
+ out.writeBoolean(noDecorator);
+ if (!noDecorator)
+ {
+ out.writeObject(delegate);
+ }
+
+ out.writeInt(instances.size());
+ for (final Map.Entry<Interceptor<?>, ?> entry : instances.entrySet())
+ {
+ final Interceptor<?> key = entry.getKey();
+ if (serializeInterceptor(out, key))
+ {
+ out.writeObject(entry.getValue());
+ }
+ }
+
+ out.writeInt(interceptors.size());
+ for (final Map.Entry<Method, List<Interceptor<?>>> entry : interceptors.entrySet())
+ {
+ final Method key = entry.getKey();
+ out.writeObject(key.getDeclaringClass());
+ out.writeUTF(key.getName());
+ out.writeObject(key.getParameterTypes());
+
+ final List<Interceptor<?>> value = entry.getValue();
+ out.writeInt(value.size());
+ for (final Interceptor<?> i : value)
+ {
+ serializeInterceptor(out, i);
+ }
+ }
+
+ out.writeUTF(beanPassivationId);
+ }
+
+ @Override
+ public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ target = (T) in.readObject();
+ if (in.readBoolean())
+ {
+ delegate = target;
+ }
+ else
+ {
+ delegate = (T) in.readObject();
+ }
+
+ final int instancesSize = in.readInt();
+ final WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ final BeanManager beanManager = webBeansContext.getBeanManagerImpl();
+
+ final Map<Interceptor<?>, Object> tmpInstances = new HashMap<Interceptor<?>, Object>();
+ for (int i = 0; i < instancesSize; i++)
+ {
+ final Interceptor<?> interceptor = readInterceptor(in.readUTF(), beanManager);
+ if (!SelfInterceptorBean.class.isInstance(interceptor))
+ {
+ final Object value = in.readObject();
+ tmpInstances.put(interceptor, value);
+ }
+ else
+ {
+ tmpInstances.put(interceptor, target);
+ }
+ }
+ instances = tmpInstances;
+
+ final int interceptorsSize = in.readInt();
+ interceptors = new HashMap<Method, List<Interceptor<?>>>(interceptorsSize);
+ for (int i = 0; i < interceptorsSize; i++)
+ {
+ final Class<?> declaringClass = (Class<?>) in.readObject();
+ final String name = in.readUTF();
+ final Class<?>[] parameters = (Class<?>[]) in.readObject();
+ final Method method;
+ try
+ {
+ method = declaringClass.getDeclaredMethod(name, parameters);
+ }
+ catch (final NoSuchMethodException e)
+ {
+ throw new NotSerializableException(target.getClass().getName());
+ }
+
+ final int interceptorListSize = in.readInt();
+ final List<Interceptor<?>> interceptorList = new ArrayList<Interceptor<?>>(interceptorListSize);
+ for (int j = 0; j < interceptorListSize; j++)
+ {
+ interceptorList.add(readInterceptor(in.readUTF(), beanManager));
+ }
+ interceptors.put(method, interceptorList);
+ }
+
+ beanPassivationId = in.readUTF();
+ }
+
+ /**
+ * @return false if the interceptor value can be ignored
+ */
+ private static boolean serializeInterceptor(final ObjectOutput out, final Interceptor<?> key) throws IOException
+ {
+ if (SelfInterceptorBean.class.isInstance(key))
+ {
+ final String beanName = WebBeansUtil.getPassivationId(key)
+ .replace(WebBeansType.INTERCEPTOR.name(), WebBeansType.MANAGED.name());
+ out.writeUTF(SELF_KEY + beanName);
+ return false;
+ }
+
+ final String id = WebBeansUtil.getPassivationId(key);
+ if (id == null)
+ {
+ throw new NotSerializableException(key + " is not serializable");
+ }
+ out.writeUTF(id);
+ return true;
+ }
+
+ private static Interceptor<?> readInterceptor(final String id, final BeanManager beanManager) throws IOException
+ {
+ if (id.startsWith(SELF_KEY))
+ {
+ final Bean<?> bean = beanManager.getPassivationCapableBean(id.substring(SELF_KEY.length()));
+ if (InjectionTargetBean.class.isInstance(bean))
+ {
+ final InjectionTarget<?> it = InjectionTargetBean.class.cast(bean).getInjectionTarget();
+ if (InjectionTargetImpl.class.isInstance(it))
+ {
+ final InterceptorResolutionService.BeanInterceptorInfo info = InjectionTargetImpl.class.cast(it)
+ .getInterceptorInfo();
+ return info.getSelfInterceptorBean();
+ }
+ else
+ {
+ throw new NotSerializableException("Can't find self interceptor");
+ }
+ }
+ else
+ {
+ throw new NotSerializableException("Can't find self interceptor");
+ }
+ }
+ return (Interceptor<?>) beanManager.getPassivationCapableBean(id);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorComparator.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorComparator.java
new file mode 100644
index 0000000..1625301
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorComparator.java
@@ -0,0 +1,55 @@
+/*
+ * 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.webbeans.intercept;
+
+import java.util.Comparator;
+
+import javax.enterprise.inject.spi.Interceptor;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+public class InterceptorComparator<T> implements Comparator<Interceptor<T>>
+{
+
+ private final InterceptorsManager interceptorsManager;
+
+ public InterceptorComparator(WebBeansContext webBeansContext)
+ {
+ interceptorsManager = webBeansContext.getInterceptorsManager();
+ }
+
+ @Override
+ public int compare(Interceptor<T> o1, Interceptor<T> o2)
+ {
+
+ if (o1.equals(o2))
+ {
+ return 0;
+ }
+ else
+ {
+ final Class<?> o1Clazz = o1.getBeanClass();
+ final Class<?> o2Clazz = o2.getBeanClass();
+
+ return interceptorsManager.compareCdiInterceptors(o1Clazz, o2Clazz);
+
+ }
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorInvocationContext.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorInvocationContext.java
new file mode 100644
index 0000000..0a33c31
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorInvocationContext.java
@@ -0,0 +1,69 @@
+/*
+ * 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.webbeans.intercept;
+
+import java.lang.reflect.AccessibleObject;
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.inject.spi.InterceptionType;
+import javax.enterprise.inject.spi.Interceptor;
+
+/**
+ * InvocationContext for business method interceptors
+ */
+public class InterceptorInvocationContext<T> extends AbstractInvocationContext<T>
+{
+
+ protected InterceptionType type;
+ protected List<Interceptor<?>> interceptors;
+ protected Map<Interceptor<?>, ?> instances;
+ protected int index = 0;
+
+ public InterceptorInvocationContext(T target, InterceptionType type,
+ List<Interceptor<?>> interceptors, Map<Interceptor<?>, ?> instances,
+ AccessibleObject method, Object[] parameters)
+ {
+ super(target, method, parameters);
+ this.type = type;
+ this.interceptors = interceptors;
+ this.instances = instances;
+ }
+
+ @Override
+ public Object proceed() throws Exception
+ {
+ if (index < interceptors.size())
+ {
+ Interceptor interceptor = interceptors.get(index++);
+ if (!interceptor.intercepts(type))
+ {
+ // continue with next interceptor
+ // this e.g. happens for lifecycle interceptors
+ return proceed();
+ }
+
+ return interceptor.intercept(type, instances.get(interceptor), this);
+ }
+ else
+ {
+ return super.proceed();
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
new file mode 100644
index 0000000..45cb7de
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
@@ -0,0 +1,802 @@
+/*
+ * 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.webbeans.intercept;
+
+import org.apache.webbeans.annotation.AnnotationManager;
+import org.apache.webbeans.component.BeanAttributesImpl;
+import org.apache.webbeans.component.SelfInterceptorBean;
+import org.apache.webbeans.component.creation.BeanAttributesBuilder;
+import org.apache.webbeans.component.creation.SelfInterceptorBeanBuilder;
+import org.apache.webbeans.config.OpenWebBeansConfiguration;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.Asserts;
+import org.apache.webbeans.util.CDI11s;
+import org.apache.webbeans.util.ClassUtil;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.Decorator;
+import javax.enterprise.inject.spi.InterceptionType;
+import javax.enterprise.inject.spi.Interceptor;
+import javax.interceptor.ExcludeClassInterceptors;
+import javax.interceptor.Interceptors;
+import javax.interceptor.InvocationContext;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Class to calculate interceptor resolution information.
+ * It also handles the proxy caching and applying.
+ */
+public class InterceptorResolutionService
+{
+ private final WebBeansContext webBeansContext;
+
+ /**
+ * Enforcing that interceptor callbacks should not be
+ * able to throw checked exceptions is configurable
+ */
+ private static volatile Boolean enforceCheckedException;
+
+
+ public InterceptorResolutionService(WebBeansContext webBeansContext)
+ {
+ this.webBeansContext = webBeansContext;
+ }
+
+
+ public <T> BeanInterceptorInfo calculateInterceptorInfo(Set<Type> beanTypes, Set<Annotation> qualifiers, AnnotatedType<T> annotatedType)
+ {
+ Asserts.assertNotNull(beanTypes, "beanTypes must not be null!");
+ Asserts.assertNotNull(qualifiers, "qualifiers must not be null!");
+ Asserts.assertNotNull(annotatedType, "AnnotatedType must not be null!");
+
+ List<AnnotatedMethod> interceptableAnnotatedMethods = getInterceptableBusinessMethods(annotatedType);
+
+ AnnotationManager annotationManager = webBeansContext.getAnnotationManager();
+ BeanManager beanManager = webBeansContext.getBeanManagerImpl();
+
+
+ // pick up EJB-style interceptors from a class level
+ List<Interceptor<?>> classLevelEjbInterceptors = new ArrayList<Interceptor<?>>();
+
+ collectEjbInterceptors(classLevelEjbInterceptors, annotatedType, false, beanTypes);
+
+ // pick up the decorators
+ List<Decorator<?>> decorators = beanManager.resolveDecorators(beanTypes, AnnotationUtil.asArray(qualifiers));
+ if (decorators.size() == 0)
+ {
+ decorators = Collections.emptyList(); // less to store
+ }
+
+ // pick up CDI interceptors from a class level
+ Set<Annotation> classInterceptorBindings = annotationManager.getInterceptorAnnotations(annotatedType.getAnnotations());
+ Set<Interceptor<?>> allUsedCdiInterceptors = new HashSet<Interceptor<?>>();
+ addCdiClassLifecycleInterceptors(classInterceptorBindings, allUsedCdiInterceptors);
+
+ LinkedHashSet<Interceptor<?>> allUsedEjbInterceptors = new LinkedHashSet<Interceptor<?>>(); // we need to preserve the order!
+ allUsedEjbInterceptors.addAll(classLevelEjbInterceptors);
+
+ Map<Method, BusinessMethodInterceptorInfo> businessMethodInterceptorInfos = new HashMap<Method, BusinessMethodInterceptorInfo>();
+
+ List<Method> nonInterceptedMethods = new ArrayList<Method>();
+
+ SelfInterceptorBean<T> selfInterceptorBean = resolveSelfInterceptorBean(annotatedType);
+
+ // iterate over all methods and build up the interceptor/decorator stack
+ for (AnnotatedMethod annotatedMethod : interceptableAnnotatedMethods)
+ {
+ BusinessMethodInterceptorInfo methodInterceptorInfo = new BusinessMethodInterceptorInfo();
+
+ calculateEjbMethodInterceptors(methodInterceptorInfo, allUsedEjbInterceptors, classLevelEjbInterceptors, annotatedMethod);
+
+ calculateCdiMethodInterceptors(methodInterceptorInfo, InterceptionType.AROUND_INVOKE, allUsedCdiInterceptors, annotatedMethod, classInterceptorBindings);
+
+ calculateCdiMethodDecorators(methodInterceptorInfo, decorators, annotatedMethod);
+
+ if (methodInterceptorInfo.isEmpty() && (selfInterceptorBean == null || !selfInterceptorBean.isAroundInvoke()))
+ {
+ nonInterceptedMethods.add(annotatedMethod.getJavaMember());
+ continue;
+ }
+
+ businessMethodInterceptorInfos.put(annotatedMethod.getJavaMember(), methodInterceptorInfo);
+ }
+
+ Map<InterceptionType, LifecycleMethodInfo> lifecycleMethodInterceptorInfos
+ = new HashMap<InterceptionType, LifecycleMethodInfo>();
+
+ addLifecycleMethods(
+ lifecycleMethodInterceptorInfos,
+ annotatedType,
+ InterceptionType.POST_CONSTRUCT,
+ PostConstruct.class,
+ allUsedCdiInterceptors,
+ allUsedEjbInterceptors,
+ classLevelEjbInterceptors,
+ classInterceptorBindings,
+ true);
+
+ addLifecycleMethods(
+ lifecycleMethodInterceptorInfos,
+ annotatedType,
+ InterceptionType.PRE_DESTROY,
+ PreDestroy.class,
+ allUsedCdiInterceptors,
+ allUsedEjbInterceptors,
+ classLevelEjbInterceptors,
+ classInterceptorBindings,
+ true);
+
+ List<Interceptor<?>> cdiInterceptors = new ArrayList<Interceptor<?>>(allUsedCdiInterceptors);
+ Collections.sort(cdiInterceptors, new InterceptorComparator(webBeansContext));
+
+ if (Modifier.isFinal(annotatedType.getJavaClass().getModifiers()) &&
+ (allUsedEjbInterceptors.size() > 0 ||
+ allUsedCdiInterceptors.size() > 0 ||
+ lifecycleMethodInterceptorInfos.size() > 0 ||
+ (decorators != null && decorators.size() > 0)))
+ {
+ throw new WebBeansConfigurationException("Cannot apply Decorators or Interceptors on a final class: "
+ + annotatedType.getJavaClass().getName());
+ }
+
+ return new BeanInterceptorInfo(decorators, allUsedEjbInterceptors, cdiInterceptors, selfInterceptorBean,
+ businessMethodInterceptorInfos,
+ nonInterceptedMethods, lifecycleMethodInterceptorInfos);
+ }
+
+ /**
+ * Lifycycle methods like {@link javax.annotation.PostConstruct} and
+ * {@link javax.annotation.PreDestroy} must not define a checked Exception
+ * regarding to the spec. But this is often unnecessary restrictive so we
+ * allow to disable this check application wide.
+ *
+ * @return <code>true</code> if the spec rule of having no checked exception should be enforced
+ */
+ private boolean isNoCheckedExceptionEnforced()
+ {
+ if (enforceCheckedException == null)
+ {
+ enforceCheckedException = Boolean.parseBoolean(webBeansContext.getOpenWebBeansConfiguration().
+ getProperty(OpenWebBeansConfiguration.INTERCEPTOR_FORCE_NO_CHECKED_EXCEPTIONS, "true"));
+ }
+
+ return enforceCheckedException;
+ }
+
+
+ private void addCdiClassLifecycleInterceptors(Set<Annotation> classInterceptorBindings, Set<Interceptor<?>> allUsedCdiInterceptors)
+ {
+ if (classInterceptorBindings.size() > 0)
+ {
+ final Annotation[] interceptorBindings = AnnotationUtil.asArray(classInterceptorBindings);
+ final BeanManagerImpl beanManagerImpl = webBeansContext.getBeanManagerImpl();
+
+ allUsedCdiInterceptors.addAll(beanManagerImpl.resolveInterceptors(InterceptionType.POST_CONSTRUCT, interceptorBindings));
+ allUsedCdiInterceptors.addAll(beanManagerImpl.resolveInterceptors(InterceptionType.PRE_DESTROY, interceptorBindings));
+ if (CDI11s.AROUND_CONSTRUCT != null)
+ {
+ allUsedCdiInterceptors.addAll(beanManagerImpl.resolveInterceptors(CDI11s.AROUND_CONSTRUCT, interceptorBindings));
+ }
+ }
+ }
+
+ /**
+ * Check whether this class has any method which intercepts the whole bean itself.
+ * @return SelfInterceptorBean or <code>null</code> if this bean doesn't intercept itself
+ */
+ private <T> SelfInterceptorBean<T> resolveSelfInterceptorBean(AnnotatedType<T> annotatedType)
+ {
+ BeanAttributesImpl<T> beanAttributes = BeanAttributesBuilder.forContext(webBeansContext).newBeanAttibutes(annotatedType).build();
+ SelfInterceptorBeanBuilder<T>sibb = new SelfInterceptorBeanBuilder<T>(webBeansContext, annotatedType, beanAttributes);
+ sibb.defineSelfInterceptorRules();
+ if (!sibb.isInterceptorEnabled())
+ {
+ return null;
+ }
+
+ return sibb.getBean();
+ }
+
+ private void addLifecycleMethods(Map<InterceptionType, LifecycleMethodInfo> lifecycleMethodInterceptorInfos,
+ AnnotatedType<?> annotatedType,
+ InterceptionType interceptionType,
+ Class<? extends Annotation> lifeycleAnnotation,
+ Set<Interceptor<?>> allUsedCdiInterceptors,
+ Set<Interceptor<?>> allUsedEjbInterceptors,
+ List<Interceptor<?>> classLevelEjbInterceptors,
+ Set<Annotation> classInterceptorBindings,
+ boolean parentFirst)
+ {
+ List<AnnotatedMethod<?>> foundMethods = new ArrayList<AnnotatedMethod<?>>();
+ BusinessMethodInterceptorInfo methodInterceptorInfo = new BusinessMethodInterceptorInfo();
+
+ List<AnnotatedMethod<?>> lifecycleMethodCandidates = webBeansContext.getInterceptorUtil().getLifecycleMethods(annotatedType, lifeycleAnnotation, parentFirst);
+
+ for (AnnotatedMethod<?> lifecycleMethod : lifecycleMethodCandidates)
+ {
+ verifyLifecycleMethod(lifeycleAnnotation, lifecycleMethod);
+
+ if (lifecycleMethod.getParameters().size() == 0)
+ {
+ foundMethods.add(lifecycleMethod);
+ calculateEjbMethodInterceptors(methodInterceptorInfo, allUsedEjbInterceptors, classLevelEjbInterceptors, lifecycleMethod);
+
+ calculateCdiMethodInterceptors(methodInterceptorInfo, interceptionType, allUsedCdiInterceptors, lifecycleMethod, classInterceptorBindings);
+ }
+ }
+
+ if (foundMethods.size() > 0 )
+ {
+ lifecycleMethodInterceptorInfos.put(interceptionType, new LifecycleMethodInfo(foundMethods, methodInterceptorInfo));
+ }
+ }
+
+ private <T> void collectEjbInterceptors(List<Interceptor<?>> ejbInterceptors, Annotated annotated, boolean unproxyable, Set<Type> types)
+ {
+ Interceptors interceptorsAnnot = annotated.getAnnotation(Interceptors.class);
+ if (interceptorsAnnot != null)
+ {
+ if (unproxyable)
+ {
+ throw new WebBeansConfigurationException(annotated + " is not proxyable, but an Interceptor got defined on it!");
+ }
+
+ if (types == null)
+ {
+ types = Collections.emptySet();
+ }
+
+ for (Class interceptorClass : interceptorsAnnot.value())
+ {
+ if (types.contains(interceptorClass)) // don't create another bean for it
+ {
+ continue;
+ }
+
+ Interceptor ejbInterceptor = webBeansContext.getInterceptorsManager().getEjbInterceptorForClass(interceptorClass);
+ ejbInterceptors.add(ejbInterceptor);
+ }
+ }
+ }
+
+ private void calculateEjbMethodInterceptors(BusinessMethodInterceptorInfo methodInterceptorInfo, Set<Interceptor<?>> allUsedEjbInterceptors,
+ List<Interceptor<?>> classLevelEjbInterceptors, AnnotatedMethod annotatedMethod)
+ {
+ boolean unproxyable = isUnproxyable(annotatedMethod);
+
+ List<Interceptor<?>> methodInterceptors = new ArrayList<Interceptor<?>>();
+
+ if (classLevelEjbInterceptors != null && classLevelEjbInterceptors.size() > 0 && !unproxyable)
+ {
+ // add the class level defined Interceptors first
+
+ ExcludeClassInterceptors excludeClassInterceptors = annotatedMethod.getAnnotation(ExcludeClassInterceptors.class);
+ if (excludeClassInterceptors == null)
+ {
+ // but only if there is no exclusion of all class-level interceptors
+ methodInterceptors.addAll(classLevelEjbInterceptors);
+ }
+ }
+
+ collectEjbInterceptors(methodInterceptors, annotatedMethod, unproxyable, Collections.<Type>singleton(annotatedMethod.getJavaMember().getDeclaringClass()));
+ allUsedEjbInterceptors.addAll(methodInterceptors);
+
+ if (methodInterceptors.size() > 0)
+ {
+ methodInterceptorInfo.setEjbInterceptors(methodInterceptors);
+ }
+ }
+
+ private boolean isUnproxyable(AnnotatedMethod annotatedMethod)
+ {
+ int modifiers = annotatedMethod.getJavaMember().getModifiers();
+ return Modifier.isFinal(modifiers) || Modifier.isPrivate(modifiers);
+ }
+
+
+ private void calculateCdiMethodDecorators(BusinessMethodInterceptorInfo methodInterceptorInfo, List<Decorator<?>> decorators, AnnotatedMethod annotatedMethod)
+ {
+ if (decorators == null || decorators.isEmpty())
+ {
+ return;
+ }
+
+ LinkedHashMap<Decorator<?>, Method> appliedDecorators = new LinkedHashMap<Decorator<?>, Method>();
+
+ for (Decorator decorator : decorators)
+ {
+ Method decoratingMethod = getDecoratingMethod(decorator, annotatedMethod);
+ if (decoratingMethod != null)
+ {
+ if (isUnproxyable(annotatedMethod))
+ {
+ throw new WebBeansConfigurationException(annotatedMethod + " is not proxyable, but an Decorator got defined on it!");
+ }
+
+ appliedDecorators.put(decorator, decoratingMethod);
+ }
+ }
+
+ if (appliedDecorators.size() > 0)
+ {
+ methodInterceptorInfo.setMethodDecorators(appliedDecorators);
+ }
+ }
+
+ /**
+ * @return the Method from the decorator which decorates the annotatedMethod, <code>null</code>
+ * if the given Decorator does <i>not</i> decorate the annotatedMethod
+ */
+ private Method getDecoratingMethod(Decorator decorator, AnnotatedMethod annotatedMethod)
+ {
+ Set<Type> decoratedTypes = decorator.getDecoratedTypes();
+ for (Type decoratedType : decoratedTypes)
+ {
+ if (decoratedType instanceof ParameterizedType)
+ {
+ // TODO handle the case that method parameter types are TypeVariables
+ ParameterizedType parameterizedType = (ParameterizedType)decoratedType;
+ decoratedType = parameterizedType.getRawType();
+ }
+
+ if (decoratedType instanceof Class)
+ {
+ Class decoratedClass = (Class) decoratedType;
+ Method[] decoratorMethods = decoratedClass.getDeclaredMethods();
+ for (Method decoratorMethod : decoratorMethods)
+ {
+ int modifiers = decoratorMethod.getModifiers();
+ if (Modifier.isFinal(modifiers) ||
+ Modifier.isPrivate(modifiers) ||
+ Modifier.isStatic(modifiers))
+ {
+ continue;
+ }
+
+ if (methodEquals(decoratorMethod, annotatedMethod.getJavaMember()))
+ {
+ // yikes our method is decorated by this very decorator type.
+
+ if (Modifier.isAbstract((decorator.getBeanClass().getModifiers())))
+ {
+ // For abstract classes we will only decorate this method if it's really implemented on the decorator itself
+ Class decoratorClass = decorator.getBeanClass();
+ while (decoratorClass != Object.class)
+ {
+ try
+ {
+ Method m = decoratorClass.getDeclaredMethod(decoratorMethod.getName(), decoratorMethod.getParameterTypes());
+ if (Modifier.isAbstract(m.getModifiers()))
+ {
+ return null;
+ }
+ else
+ {
+ return decoratorMethod;
+ }
+ }
+ catch (NoSuchMethodException e)
+ {
+ // all ok, just continue
+ }
+
+ decoratorClass = decoratorClass.getSuperclass();
+ }
+
+ return null;
+ }
+ {
+ return decoratorMethod;
+ }
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ private boolean methodEquals(Method method1, Method method2)
+ {
+ if (method1.getName().equals(method2.getName()))
+ {
+ Class<?>[] method1Params = method1.getParameterTypes();
+ Class<?>[] method2Params = method2.getParameterTypes();
+ if (method1Params.length == method2Params.length)
+ {
+ boolean paramsMatch = true;
+ for (int i = 0; i < method1Params.length; i++)
+ {
+ if (!method1Params[i].equals(method2Params[i]))
+ {
+ paramsMatch = false;
+ break;
+ }
+ }
+
+ if (paramsMatch)
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ private void calculateCdiMethodInterceptors(BusinessMethodInterceptorInfo methodInterceptorInfo,
+ InterceptionType interceptionType,
+ Set<Interceptor<?>> allUsedCdiInterceptors,
+ AnnotatedMethod annotatedMethod,
+ Set<Annotation> classInterceptorBindings)
+ {
+ AnnotationManager annotationManager = webBeansContext.getAnnotationManager();
+
+ boolean unproxyable = isUnproxyable(annotatedMethod);
+
+ Set<Annotation> cummulatedInterceptorBindings = new HashSet<Annotation>();
+ cummulatedInterceptorBindings.addAll(
+ annotationManager.getInterceptorAnnotations(annotatedMethod.getAnnotations()));
+
+ if (unproxyable && cummulatedInterceptorBindings.size() > 0)
+ {
+ if (unproxyable)
+ {
+ throw new WebBeansConfigurationException(annotatedMethod + " is not proxyable, but an Interceptor got defined on it!");
+ }
+ }
+
+ if (unproxyable)
+ {
+ // don't apply class level interceptors - instead just return
+ return;
+ }
+
+ cummulatedInterceptorBindings.addAll(classInterceptorBindings);
+
+ if (cummulatedInterceptorBindings.size() == 0)
+ {
+ return;
+ }
+
+ List<Interceptor<?>> methodInterceptors
+ = webBeansContext.getBeanManagerImpl().resolveInterceptors(interceptionType, AnnotationUtil.asArray(cummulatedInterceptorBindings));
+
+ methodInterceptorInfo.setCdiInterceptors(methodInterceptors);
+
+ allUsedCdiInterceptors.addAll(methodInterceptors);
+ }
+
+ /**
+ * Check that the given lifecycle method has:
+ * <ul>
+ * <li>either has no parameter at all (standard case), or</li>
+ * <li>has exactly one InvocationContext parameter (self-interception)</li>
+ * <li>has no return value</li>
+ * </ul>
+ *
+ * @param annotatedMethod
+ */
+ private <T> void verifyLifecycleMethod(Class<? extends Annotation> lifecycleAnnotation, AnnotatedMethod<T> annotatedMethod)
+ {
+ List<AnnotatedParameter<T>> params = annotatedMethod.getParameters();
+ if (params.size() > 0 && (params.size() > 1 || !params.get(0).getBaseType().equals(InvocationContext.class)))
+ {
+ throw new WebBeansConfigurationException(lifecycleAnnotation.getName() + " LifecycleMethod "
+ + annotatedMethod.getJavaMember()
+ + " must either have no parameter or InvocationContext but has:"
+ + Arrays.toString(annotatedMethod.getJavaMember().getParameterTypes()));
+ }
+
+ if (!annotatedMethod.getJavaMember().getReturnType().equals(Void.TYPE))
+ {
+ throw new WebBeansConfigurationException("@" + lifecycleAnnotation.getName()
+ + " annotated method : " + annotatedMethod.getJavaMember().getName()
+ + " in class : " + annotatedMethod.getDeclaringType().getJavaClass().getName()
+ + " must return void type");
+ }
+
+ if (isNoCheckedExceptionEnforced() && ClassUtil.isMethodHasCheckedException(annotatedMethod.getJavaMember()))
+ {
+ throw new WebBeansConfigurationException("@" + lifecycleAnnotation.getName()
+ + " annotated method : " + annotatedMethod.getJavaMember().getName()
+ + " in class : " + annotatedMethod.getDeclaringType().getJavaClass().getName()
+ + " can not throw any checked exception");
+ }
+
+ if (Modifier.isStatic(annotatedMethod.getJavaMember().getModifiers()))
+ {
+ throw new WebBeansConfigurationException("@" + lifecycleAnnotation.getName()
+ + " annotated method : " + annotatedMethod.getJavaMember().getName()
+ + " in class : " + annotatedMethod.getDeclaringType().getJavaClass().getName()
+ + " can not be static");
+ }
+ }
+
+ /**
+ * @return the list of all non-overloaded non-private and non-static methods
+ */
+ private List<AnnotatedMethod> getInterceptableBusinessMethods(AnnotatedType annotatedType)
+ {
+ List<Method> interceptableMethods = ClassUtil.getNonPrivateMethods(annotatedType.getJavaClass(), false);
+
+ List<AnnotatedMethod> interceptableAnnotatedMethods = new ArrayList<AnnotatedMethod>();
+
+ Set<AnnotatedMethod> annotatedMethods = annotatedType.getMethods();
+ for (Method interceptableMethod : interceptableMethods)
+ {
+ for (AnnotatedMethod<?> annotatedMethod : annotatedMethods)
+ {
+ if (annotatedMethod.getJavaMember().equals(interceptableMethod))
+ {
+ int modifiers = annotatedMethod.getJavaMember().getModifiers();
+ if (Modifier.isPrivate(modifiers) || Modifier.isStatic(modifiers))
+ {
+ // we must only intercept business methods
+ continue;
+ }
+
+ interceptableAnnotatedMethods.add(annotatedMethod);
+ }
+ }
+ }
+
+ return interceptableAnnotatedMethods;
+ }
+
+
+ /**
+ * static information about interceptors and decorators for a
+ * single bean.
+ */
+ public static class BeanInterceptorInfo
+ {
+ public BeanInterceptorInfo(List<Decorator<?>> decorators,
+ LinkedHashSet<Interceptor<?>> ejbInterceptors,
+ List<Interceptor<?>> cdiInterceptors,
+ SelfInterceptorBean<?> selfInterceptorBean,
+ Map<Method, BusinessMethodInterceptorInfo> businessMethodsInfo,
+ List<Method> nonInterceptedMethods,
+ Map<InterceptionType, LifecycleMethodInfo> lifecycleMethodInterceptorInfos)
+ {
+ this.decorators = decorators;
+ this.ejbInterceptors = ejbInterceptors;
+ this.cdiInterceptors = cdiInterceptors;
+ this.selfInterceptorBean = selfInterceptorBean;
+ this.businessMethodsInfo = businessMethodsInfo;
+ this.nonInterceptedMethods = nonInterceptedMethods;
+ this.lifecycleMethodInterceptorInfos = lifecycleMethodInterceptorInfos;
+ }
+
+ /**
+ * All the EJB-style Interceptor Beans which are active on this class somewhere.
+ * The Interceptors are sorted according to their definition.
+ */
+ private LinkedHashSet<Interceptor<?>> ejbInterceptors;
+
+ /**
+ * All the CDI-style Interceptor Beans which are active on this class somewhere.
+ * This is only used to create the Interceptor instances.
+ * The Interceptors are not sorted according to beans.xml .
+ */
+ private List<Interceptor<?>> cdiInterceptors;
+
+ /**
+ * Set if this class intercepts itself.
+ */
+ private SelfInterceptorBean<?> selfInterceptorBean;
+
+ /**
+ * All the Decorator Beans active on this class.
+ */
+ private List<Decorator<?>> decorators = null;
+
+ /**
+ * For each business method which is either decorated or intercepted we keep an entry.
+ * If there is no entry then the method has neither a decorator nor an interceptor.
+ */
+ private Map<Method, BusinessMethodInterceptorInfo> businessMethodsInfo = new HashMap<Method, BusinessMethodInterceptorInfo>();
+
+ /**
+ * all non-intercepted methods
+ */
+ private List<Method> nonInterceptedMethods = Collections.EMPTY_LIST;
+
+ /**
+ * Contains info about lifecycle methods.
+ * A method can be a 'business method' when invoked via the user but a
+ * 'lifecycle method' while invoked by the container!
+ */
+ private Map<InterceptionType, LifecycleMethodInfo> lifecycleMethodInterceptorInfos = Collections.EMPTY_MAP;
+
+
+ public List<Decorator<?>> getDecorators()
+ {
+ return decorators;
+ }
+
+ public LinkedHashSet<Interceptor<?>> getEjbInterceptors()
+ {
+ return ejbInterceptors;
+ }
+
+ public List<Interceptor<?>> getCdiInterceptors()
+ {
+ return cdiInterceptors;
+ }
+
+ public SelfInterceptorBean<?> getSelfInterceptorBean()
+ {
+ return selfInterceptorBean;
+ }
+
+ public Map<Method, BusinessMethodInterceptorInfo> getBusinessMethodsInfo()
+ {
+ return businessMethodsInfo;
+ }
+
+ public List<Method> getNonInterceptedMethods()
+ {
+ return nonInterceptedMethods;
+ }
+
+ public Map<InterceptionType, LifecycleMethodInfo> getLifecycleMethodInterceptorInfos()
+ {
+ return lifecycleMethodInterceptorInfos;
+ }
+ }
+
+ /**
+ * We track per method which Interceptors to invoke
+ */
+ public static class BusinessMethodInterceptorInfo
+ {
+ private Interceptor<?>[] ejbInterceptors = null;
+ private Interceptor<?>[] cdiInterceptors = null;
+ private LinkedHashMap<Decorator<?>, Method> methodDecorators = null;
+
+ public BusinessMethodInterceptorInfo()
+ {
+ }
+
+ /**
+ * The (sorted) EJB-style ({@link javax.interceptor.Interceptors})
+ * Interceptor Beans for a specific method or <code>null</code>
+ * if no Interceptor exists for this method.
+ * They must be called <i>before</i> the {@link #cdiInterceptors}!
+ */
+ public Interceptor<?>[] getEjbInterceptors()
+ {
+ return ejbInterceptors;
+ }
+
+ /**
+ * The (sorted) CDI Interceptor Beans for a specific method or <code>null</code>
+ * if no Interceptor exists for this method.
+ */
+ public Interceptor<?>[] getCdiInterceptors()
+ {
+ return cdiInterceptors;
+ }
+
+ /**
+ * The (sorted) Decorator Beans for a specific method or <code>null</code>
+ * if no Decorator exists for this method.
+ * This Map is sorted!
+ * Key: the Decorator Bean
+ * Value: the decorating method from the decorator instance
+ */
+ public LinkedHashMap<Decorator<?>, Method> getMethodDecorators()
+ {
+ return methodDecorators;
+ }
+
+ public void setCdiInterceptors(List<Interceptor<?>> cdiInterceptors)
+ {
+ if (cdiInterceptors == null || cdiInterceptors.isEmpty())
+ {
+ this.cdiInterceptors = null;
+ }
+ else
+ {
+ this.cdiInterceptors = cdiInterceptors.toArray(new Interceptor[cdiInterceptors.size()]);
+ }
+ }
+
+ public void setMethodDecorators(LinkedHashMap<Decorator<?>, Method> methodDecorators)
+ {
+ if (methodDecorators == null || methodDecorators.isEmpty())
+ {
+ this.methodDecorators = null;
+ }
+ else
+ {
+ this.methodDecorators = methodDecorators;
+ }
+ }
+
+ public void setEjbInterceptors(List<Interceptor<?>> ejbInterceptors)
+ {
+ if (ejbInterceptors == null || ejbInterceptors.isEmpty())
+ {
+ this.ejbInterceptors = null;
+ }
+ else
+ {
+ this.ejbInterceptors = ejbInterceptors.toArray(new Interceptor[ejbInterceptors.size()]);
+ }
+
+ }
+
+ /**
+ * Determine if any interceptor information has been set at all.
+ */
+ public boolean isEmpty()
+ {
+ return cdiInterceptors == null && ejbInterceptors == null && methodDecorators == null;
+ }
+ }
+
+
+ public static class LifecycleMethodInfo
+ {
+ private List<AnnotatedMethod<?>> methods = new ArrayList<AnnotatedMethod<?>>();
+ private BusinessMethodInterceptorInfo methodInterceptorInfo;
+
+ public LifecycleMethodInfo(List<AnnotatedMethod<?>> methods, BusinessMethodInterceptorInfo methodInterceptorInfo)
+ {
+ this.methods = methods;
+ this.methodInterceptorInfo = methodInterceptorInfo;
+ }
+
+ public List<AnnotatedMethod<?>> getMethods()
+ {
+ return methods;
+ }
+
+ public BusinessMethodInterceptorInfo getMethodInterceptorInfo()
+ {
+ return methodInterceptorInfo;
+ }
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
new file mode 100644
index 0000000..364d734
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
@@ -0,0 +1,155 @@
+/*
+ * 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.webbeans.intercept;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedType;
+
+import org.apache.webbeans.annotation.AnnotationManager;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.util.Asserts;
+
+
+public final class InterceptorUtil
+{
+
+ private final WebBeansContext webBeansContext;
+
+ public InterceptorUtil(WebBeansContext webBeansContext)
+ {
+ this.webBeansContext = webBeansContext;
+
+ }
+
+ /**
+ * @return the Type hierarchy in the order superclass first. Object.class is <b>not</b> included!
+ */
+ public List<Class> getReverseClassHierarchy(Class clazz)
+ {
+ List<Class> hierarchy = new ArrayList<Class>();
+ while (clazz != null && clazz != Object.class)
+ {
+ hierarchy.add(0, clazz);
+ clazz = clazz.getSuperclass();
+ }
+
+ return hierarchy;
+ }
+
+
+ public List<AnnotatedMethod<?>> getLifecycleMethods(AnnotatedType<?> annotatedType, Class<? extends Annotation> annotation, boolean parentFirst)
+ {
+ List<AnnotatedMethod<?>> lifecycleMethods = new ArrayList<AnnotatedMethod<?>>();
+
+ List<Class> classes = getReverseClassHierarchy(annotatedType.getJavaClass());
+ for (Class clazz : classes)
+ {
+ for (AnnotatedMethod<?> annotatedMethod : annotatedType.getMethods())
+ {
+ if (annotatedMethod.getJavaMember().getDeclaringClass() != clazz)
+ {
+ continue;
+ }
+
+ if (annotatedMethod.isAnnotationPresent(annotation))
+ {
+ if (parentFirst)
+ {
+ lifecycleMethods.add(annotatedMethod);
+ }
+ else
+ {
+ lifecycleMethods.add(0, annotatedMethod);
+ }
+ }
+ }
+ }
+
+ return lifecycleMethods;
+ }
+
+ public void checkSimpleWebBeansInterceptorConditions(Class<?> clazz)
+ {
+ Asserts.nullCheckForClass(clazz);
+ Annotation[] anns = clazz.getDeclaredAnnotations();
+
+ boolean hasClassInterceptors = false;
+ AnnotationManager annotationManager = webBeansContext.getAnnotationManager();
+ if (annotationManager.getInterceptorBindingMetaAnnotations(anns).length > 0)
+ {
+ hasClassInterceptors = true;
+ }
+ else
+ {
+ Annotation[] stereoTypes = annotationManager.getStereotypeMetaAnnotations(clazz.getDeclaredAnnotations());
+ for (Annotation stero : stereoTypes)
+ {
+ if (annotationManager.hasInterceptorBindingMetaAnnotation(stero.annotationType().getDeclaredAnnotations()))
+ {
+ hasClassInterceptors = true;
+ break;
+ }
+ }
+ }
+
+ //Simple webbeans
+ if(Modifier.isFinal(clazz.getModifiers()) && hasClassInterceptors)
+ {
+ throw new WebBeansConfigurationException("Final Simple class with name : " + clazz.getName() + " can not define any InterceptorBindings");
+ }
+
+ Method[] methods = webBeansContext.getSecurityService().doPrivilegedGetDeclaredMethods(clazz);
+
+ for (Method method : methods)
+ {
+ int modifiers = method.getModifiers();
+ if (!method.isSynthetic() && !method.isBridge() && !Modifier.isStatic(modifiers) && !Modifier.isPrivate(modifiers) && Modifier.isFinal(modifiers))
+ {
+ if (hasClassInterceptors)
+ {
+ throw new WebBeansConfigurationException("Simple web bean class : " + clazz.getName()
+ + " can not define non-static, non-private final methods. "
+ + "Because it is annotated with at least one @InterceptorBinding");
+ }
+ else
+ {
+ if (annotationManager.hasInterceptorBindingMetaAnnotation(
+ method.getDeclaredAnnotations()))
+ {
+ throw new WebBeansConfigurationException("Method : " + method.getName() + "in simple web bean class : "
+ + clazz.getName()
+ + " can not be defined as non-static, non-private and final. "
+ + "Because it is annotated with at least one @InterceptorBinding");
+ }
+ }
+ }
+ }
+
+ }
+
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java
new file mode 100644
index 0000000..7f5b754
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java
@@ -0,0 +1,317 @@
+/*
+ * 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.webbeans.intercept;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InterceptionType;
+import javax.enterprise.inject.spi.Interceptor;
+import javax.enterprise.inject.spi.PassivationCapable;
+
+import org.apache.webbeans.component.BeanAttributesImpl;
+import org.apache.webbeans.component.OwbBean;
+import org.apache.webbeans.component.creation.BeanAttributesBuilder;
+import org.apache.webbeans.component.creation.EjbInterceptorBeanBuilder;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.intercept.annotation.Priority;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.Asserts;
+
+/**
+ * This class keeps all the enabled interceptor classes information of a certain BeanManager.
+ */
+public class InterceptorsManager
+{
+ private final WebBeansContext webBeansContext;
+ private final BeanManagerImpl beanManager;
+
+ /**
+ * Interceptor classes which got added via beans.xml
+ */
+ private List<Class<?>> configuredInterceptorClasses = new CopyOnWriteArrayList<Class<?>>();
+
+ /**
+ * Active CDI-style interceptors.
+ */
+ private List<Interceptor<?>> cdiInterceptors = new ArrayList<Interceptor<?>>();
+
+ /**
+ * EJB-style Interceptor beans.
+ */
+ private ConcurrentMap<Class<?>, Interceptor<?>> ejbInterceptors = new ConcurrentHashMap<Class<?>, Interceptor<?>>();
+
+ /**Additional interceptor class*/
+ private List<Class<?>> additionalInterceptorClasses = new ArrayList<Class<?>>();
+
+ /**
+ * Additional interceptor binding types we got via Extensions
+ */
+ private Map<Class<? extends Annotation>, Set<Annotation>> additionalInterceptorBindingTypes
+ = new HashMap<Class<? extends Annotation>, Set<Annotation>>();
+
+
+ public InterceptorsManager(WebBeansContext webBeansContext)
+ {
+ this.webBeansContext = webBeansContext;
+ beanManager = webBeansContext.getBeanManagerImpl();
+ }
+
+ /**
+ * Clears all info.
+ * This must only be called by the BeanManager.
+ */
+ public void clear()
+ {
+ additionalInterceptorBindingTypes.clear();
+ additionalInterceptorClasses.clear();
+ configuredInterceptorClasses.clear();
+ cdiInterceptors.clear();
+ ejbInterceptors.clear();
+ }
+
+
+ /**
+ * Add a certain class to the enabled interceptors list.
+ */
+ public void addEnabledInterceptorClass(Class<?> interceptorClazz)
+ {
+ Asserts.nullCheckForClass(interceptorClazz, "interceptorClazz can not be null");
+
+ if (!configuredInterceptorClasses.contains(interceptorClazz))
+ {
+ configuredInterceptorClasses.add(interceptorClazz);
+ }
+ }
+
+ /**
+ * get the EJB-style Interceptor
+ * @param interceptorClass
+ * @param <T>
+ * @return
+ */
+ public <T> Interceptor<T> getEjbInterceptorForClass(Class<T> interceptorClass)
+ {
+ Interceptor<T> interceptor = (Interceptor<T>) ejbInterceptors.get(interceptorClass);
+ if (interceptor == null)
+ {
+ AnnotatedType<T> annotatedType = webBeansContext.getBeanManagerImpl().createAnnotatedType(interceptorClass);
+ BeanAttributesImpl<T> beanAttributes = BeanAttributesBuilder.forContext(webBeansContext).newBeanAttibutes(annotatedType).build();
+ EjbInterceptorBeanBuilder<T> buildr = new EjbInterceptorBeanBuilder<T>(webBeansContext, annotatedType, beanAttributes);
+ buildr.defineEjbInterceptorRules();
+ Interceptor<T> i = buildr.getBean();
+ interceptor = (Interceptor<T>) ejbInterceptors.putIfAbsent(interceptorClass, i);
+ if (interceptor == null)
+ {
+ interceptor = i;
+ }
+ }
+
+ return interceptor;
+ }
+
+ /**
+ * Helper to compare the order of different interceptor classes
+ */
+ public int compareCdiInterceptors(Class<?> src, Class<?> target)
+ {
+ Asserts.assertNotNull(src, "src parameter can not be null");
+ Asserts.assertNotNull(target, "target parameter can not be null");
+
+ int srcIndex = configuredInterceptorClasses.indexOf(src);
+ if (srcIndex == -1)
+ {
+ throw new IllegalArgumentException(src.getName() + " is not an enabled interceptor!");
+ }
+
+ int targetIndex = configuredInterceptorClasses.indexOf(target);
+ if (targetIndex == -1)
+ {
+ throw new IllegalArgumentException(target.getName() + " is not an enabled interceptor!");
+ }
+
+ final Priority p1 = src.getAnnotation(Priority.class);
+ final Priority p2 = target.getAnnotation(Priority.class);
+ if (p1 != null && p2 != null)
+ {
+ return p1.value() - p2.value();
+ }
+ if (p1 == null && p2 != null)
+ {
+ return -1;
+ }
+ if (p1 != null)
+ {
+ return 1;
+ }
+
+ if (srcIndex == targetIndex)
+ {
+ return 0;
+ }
+ else if (srcIndex < targetIndex)
+ {
+ return -1;
+ }
+ else
+ {
+ return 1;
+ }
+ }
+
+ /**
+ * Check if the given interceptor class is in the list of enabled interceptors.
+ */
+ public boolean isInterceptorClassEnabled(Class<?> interceptorClazz)
+ {
+ Asserts.nullCheckForClass(interceptorClazz, "interceptorClazz can not be null");
+
+ return configuredInterceptorClasses.contains(interceptorClazz);
+ }
+
+ public List<Interceptor<?>> resolveInterceptors(InterceptionType type, Annotation... interceptorBindings)
+ {
+ List<Interceptor<?>> interceptorList = new ArrayList<Interceptor<?>>();
+ for (Interceptor<?> interceptor : cdiInterceptors)
+ {
+ if (interceptor.intercepts(type) && intercepts(interceptor, interceptorBindings))
+ {
+ interceptorList.add(interceptor);
+ }
+ }
+
+ Collections.sort(interceptorList, new InterceptorComparator(webBeansContext));
+
+ return interceptorList;
+ }
+
+ private boolean intercepts(Interceptor<?> interceptor, Annotation[] requestedInterceptorBindings)
+ {
+ for (Annotation interceptorBinding : interceptor.getInterceptorBindings())
+ {
+ // if an interceptor has multiple bindings then all of them must be in the
+ // requestedInterceptorBindings for a positive match
+
+ if (!inBindingArray(interceptorBinding, requestedInterceptorBindings))
+ {
+ return false;
+ }
+
+ }
+
+ return true;
+ }
+
+ private boolean inBindingArray(Annotation interceptorBinding, Annotation[] requestedInterceptorBindings)
+ {
+ for (Annotation requestedBinding : requestedInterceptorBindings)
+ {
+ if (AnnotationUtil.isCdiAnnotationEqual(requestedBinding, interceptorBinding))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Add a CDI-style interceptor.
+ * These are interceptors declared using an {@link javax.interceptor.InterceptorBinding}.
+ * @param interceptor
+ */
+ public void addCdiInterceptor(Interceptor interceptor)
+ {
+ cdiInterceptors.add(interceptor);
+ if (interceptor instanceof PassivationCapable)
+ {
+ OwbBean<?> owbBean = (OwbBean<?>)interceptor;
+ if(owbBean.isPassivationCapable())
+ {
+ beanManager.addPassivationInfo(interceptor);
+ }
+
+ }
+ }
+
+
+ public List<Interceptor<?>> getCdiInterceptors()
+ {
+ return cdiInterceptors;
+ }
+
+ public void addCustomInterceptorClass(Class<?> clazz)
+ {
+ Asserts.nullCheckForClass(clazz);
+ additionalInterceptorClasses.add(clazz);
+ }
+
+ public boolean containsCustomInterceptorClass(Class<?> clazz)
+ {
+ Asserts.nullCheckForClass(clazz);
+ return additionalInterceptorClasses.contains(clazz);
+ }
+
+ public void addInterceptorBindingType(Class<? extends Annotation> bindingType, Annotation... inheritsArray)
+ {
+ Set<Annotation> inherits = additionalInterceptorBindingTypes.get(bindingType);
+ if (inherits == null)
+ {
+ inherits = new HashSet<Annotation>();
+ additionalInterceptorBindingTypes.put(bindingType, inherits);
+ }
+ for(Annotation ann : inheritsArray)
+ {
+ inherits.add(ann);
+ }
+
+ }
+
+ public boolean hasInterceptorBindingType(Class<? extends Annotation> bindingType)
+ {
+ return additionalInterceptorBindingTypes.keySet().contains(bindingType);
+ }
+
+
+ public void validateInterceptorClasses()
+ {
+ for(Class<?> interceptorClass : configuredInterceptorClasses)
+ {
+ AnnotatedType<?> annotatedType = webBeansContext.getAnnotatedElementFactory().newAnnotatedType(interceptorClass);
+
+ // Validate decorator classes
+ if(!annotatedType.isAnnotationPresent(javax.interceptor.Interceptor.class) &&
+ !containsCustomInterceptorClass(interceptorClass))
+ {
+ throw new WebBeansConfigurationException("Given class : " + interceptorClass + " is not a interceptor class");
+ }
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/LifecycleInterceptorInvocationContext.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/LifecycleInterceptorInvocationContext.java
new file mode 100644
index 0000000..b4daab6
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/LifecycleInterceptorInvocationContext.java
@@ -0,0 +1,149 @@
+/*
+ * 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.webbeans.intercept;
+
+import org.apache.webbeans.util.ExceptionUtil;
+
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.InterceptionType;
+import javax.enterprise.inject.spi.Interceptor;
+import javax.interceptor.InvocationContext;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * InvocationContext for lifecycle methods like @PostConstruct, etc.
+ */
+public class LifecycleInterceptorInvocationContext<T> implements InvocationContext
+{
+ private T target;
+ private InterceptionType type;
+ private List<Interceptor<?>> interceptors;
+ private Map<Interceptor<?>, ?> instances;
+ private Map<String, Object> contextData = new HashMap<String, Object>();
+ private int interceptorIndex = 0;
+ private List<AnnotatedMethod<?>> lifecycleMethods;
+
+ public LifecycleInterceptorInvocationContext(T target, InterceptionType type, List<Interceptor<?>> interceptors, Map<Interceptor<?>, ?> instances,
+ List<AnnotatedMethod<?>> lifecycleMethods)
+ {
+ this.target = target;
+ this.type = type;
+ this.interceptors = interceptors;
+ this.instances = instances;
+ this.lifecycleMethods = lifecycleMethods;
+ }
+
+ @Override
+ public T getTarget()
+ {
+ return target;
+ }
+
+ @Override
+ public Map<String, Object> getContextData()
+ {
+ return contextData;
+ }
+
+ public void setContextData(Map<String, Object> contextData)
+ {
+ this.contextData = contextData;
+ }
+
+ @Override
+ public Object proceed() throws Exception
+ {
+ if (interceptors != null && interceptorIndex < interceptors.size())
+ {
+ Interceptor interceptor = interceptors.get(interceptorIndex++);
+
+ if (interceptor.intercepts(type))
+ {
+ return interceptor.intercept(type, instances.get(interceptor), this);
+ }
+ else
+ {
+ return proceed();
+ }
+ }
+ else
+ {
+ if (lifecycleMethods != null)
+ {
+ // only if there is a lifecycle method, otherwise re immediately return
+ for (AnnotatedMethod<?> lifecycleMethod : lifecycleMethods)
+ { Method m = lifecycleMethod.getJavaMember();
+ if (!m.isAccessible())
+ {
+ m.setAccessible(true);
+ }
+ try
+ {
+ m.invoke(getTarget());
+ }
+ catch (final InvocationTargetException ite)
+ {
+ throw ExceptionUtil.throwAsRuntimeException(ite.getCause());
+ }
+ }
+ }
+ // else, see interceptors spec
+ // "For lifecycle callback interceptor methods, if there is no callback method
+ // defined on the target class, the invocation of proceed in the last
+ // interceptor method in the chain is a no-op, and null is returned."
+
+ return null;
+ }
+ }
+
+
+ @Override
+ public Method getMethod()
+ {
+ return null;
+ }
+
+ @Override
+ public Object[] getParameters()
+ {
+ return new Object[0];
+ }
+
+ @Override
+ public void setParameters(Object[] parameters)
+ {
+ }
+
+ @Override
+ public Object getTimer()
+ {
+ return null;
+ }
+
+ // @Override
+ public Constructor getConstructor()
+ {
+ return null;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/NormalScopedBeanInterceptorHandler.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/NormalScopedBeanInterceptorHandler.java
new file mode 100644
index 0000000..d945b52
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/NormalScopedBeanInterceptorHandler.java
@@ -0,0 +1,127 @@
+/*
+ * 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.webbeans.intercept;
+
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.UnproxyableResolutionException;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.PassivationCapable;
+import javax.inject.Provider;
+import java.io.ObjectStreamException;
+import java.io.Serializable;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+/**
+ * <p>A Provider which handles all NormalScoped proxying.
+ * It's two main responsibilities are to provide the one active
+ * Contextual Instance, the second is to provide serialisation.</p>
+ *
+ * <p>The generated proxy will writeReplace() with this class and any
+ * NormalScopedBean provider must readResolve() and regenerate the
+ * proxy class from the {@link org.apache.webbeans.proxy.NormalScopeProxyFactory}
+ * again.
+ * </p>
+ * <p>Any subclass should either declare all their fields <code>transient</code>
+ * or handle the serialisation properly!</p>
+ */
+public class NormalScopedBeanInterceptorHandler implements Provider, Serializable
+{
+ private transient BeanManager beanManager;
+ protected transient Bean<?> bean;
+
+ /**
+ * The passivation if in case this is a {@link PassivationCapable} bean.
+ * we just keep this field for serializing it away
+ */
+ private String beanPassivationId;
+
+ public NormalScopedBeanInterceptorHandler(BeanManager beanManager, Bean<?> bean)
+ {
+ this.beanManager = beanManager;
+ this.bean = bean;
+ if (bean instanceof PassivationCapable)
+ {
+ beanPassivationId = ((PassivationCapable) bean).getId();
+ }
+ }
+
+ @Override
+ public Object get()
+ {
+ return getContextualInstance();
+ }
+
+ public Bean<?> getBean()
+ {
+ return bean;
+ }
+
+ protected BeanManager getBeanManager()
+ {
+ return beanManager;
+ }
+
+ protected Object getContextualInstance()
+ {
+ Object webbeansInstance;
+
+ //Context of the bean
+ Context webbeansContext = beanManager.getContext(bean.getScope());
+
+ //Already saved in context?
+ webbeansInstance = webbeansContext.get(bean);
+ if (webbeansInstance != null)
+ {
+ // voila, we are finished if we found an existing contextual instance
+ return webbeansInstance;
+ }
+
+ // finally, we create a new contextual instance
+ CreationalContext cc = beanManager.createCreationalContext(bean);
+ webbeansInstance = webbeansContext.get(bean, cc);
+
+ if (webbeansInstance == null)
+ {
+ throw new UnproxyableResolutionException("Cannot find a contextual instance of bean " + bean.toString());
+ }
+ return webbeansInstance;
+ }
+
+ /**
+ * The following code gets generated into the proxy:
+ *
+ * <pre>
+ * Object writeReplace() throws ObjectStreamException
+ * {
+ * return provider;
+ * }
+ * </pre>
+ */
+ protected Object readResolve() throws ObjectStreamException
+ {
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ beanManager = webBeansContext.getBeanManagerImpl();
+ bean = beanManager.getPassivationCapableBean(beanPassivationId);
+
+ return webBeansContext.getNormalScopeProxyFactory().createNormalScopeProxy(bean);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/annotation/AroundConstruct.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/annotation/AroundConstruct.java
new file mode 100644
index 0000000..83fcd3e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/annotation/AroundConstruct.java
@@ -0,0 +1,30 @@
+/*
+ * 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.webbeans.intercept.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface AroundConstruct
+{
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/annotation/Priority.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/annotation/Priority.java
new file mode 100644
index 0000000..5b098d8
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/annotation/Priority.java
@@ -0,0 +1,31 @@
+/*
+ * 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.webbeans.intercept.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Priority
+{
+ int value();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/jms/JMSModel.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/jms/JMSModel.java
new file mode 100644
index 0000000..7981ba7
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/jms/JMSModel.java
@@ -0,0 +1,155 @@
+/*
+ * 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.webbeans.jms;
+
+import java.lang.annotation.Annotation;
+import java.util.HashSet;
+import java.util.Set;
+
+public class JMSModel
+{
+ public enum JMSType
+ {
+ QUEUE,
+ TOPIC
+ }
+
+ private final JMSType jmsType;
+ private String jndiName;
+ private final String mappedName;
+ private boolean isJndiNameDefined;
+ private final Set<Annotation> bindings = new HashSet<Annotation>();
+
+
+ public JMSModel(JMSType jmsType, String jndiName, String mappedName)
+ {
+ this.jmsType = jmsType;
+
+ if(jndiName != null)
+ {
+ this.jndiName = jndiName;
+ isJndiNameDefined = true;
+ }
+
+ this.mappedName = mappedName;
+ }
+
+ public void addBinding(Annotation annotation)
+ {
+ bindings.add(annotation);
+ }
+
+ public Annotation[] getBindings()
+ {
+ return bindings.toArray(new Annotation[bindings.size()]);
+ }
+
+ /**
+ * @return the jmsType
+ */
+ public JMSType getJmsType()
+ {
+ return jmsType;
+ }
+
+
+ /**
+ * @return the jndiName
+ */
+ public String getJndiName()
+ {
+ return jndiName;
+ }
+
+
+ /**
+ * @return the mappedName
+ */
+ public String getMappedName()
+ {
+ return mappedName;
+ }
+
+
+ /**
+ * @return the isJndiNameDefined
+ */
+ public boolean isJndiNameDefined()
+ {
+ return isJndiNameDefined;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((bindings == null) ? 0 : bindings.hashCode());
+ result = prime * result + ((jmsType == null) ? 0 : jmsType.hashCode());
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (obj == null)
+ {
+ return false;
+ }
+ if (getClass() != obj.getClass())
+ {
+ return false;
+ }
+ JMSModel other = (JMSModel) obj;
+ if (bindings == null)
+ {
+ if (other.bindings != null)
+ {
+ return false;
+ }
+ }
+ else if (!bindings.equals(other.bindings))
+ {
+ return false;
+ }
+ if (jmsType == null)
+ {
+ if (other.jmsType != null)
+ {
+ return false;
+ }
+ }
+ else if (!jmsType.equals(other.jmsType))
+ {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/AbstractLifeCycle.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/AbstractLifeCycle.java
new file mode 100644
index 0000000..1a83dfc
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/AbstractLifeCycle.java
@@ -0,0 +1,255 @@
+/*
+ * 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.webbeans.lifecycle;
+
+import java.util.Properties;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.apache.webbeans.config.BeansDeployer;
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.config.WebBeansFinder;
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.container.InjectionResolver;
+import org.apache.webbeans.portable.events.discovery.BeforeShutdownImpl;
+import org.apache.webbeans.spi.ContainerLifecycle;
+import org.apache.webbeans.spi.ContextsService;
+import org.apache.webbeans.spi.JNDIService;
+import org.apache.webbeans.spi.ScannerService;
+import org.apache.webbeans.util.WebBeansConstants;
+import org.apache.webbeans.util.WebBeansUtil;
+import org.apache.webbeans.xml.WebBeansXMLConfigurator;
+
+public abstract class AbstractLifeCycle implements ContainerLifecycle
+{
+ protected AtomicBoolean started = new AtomicBoolean(false);
+
+ //Logger instance
+ protected Logger logger;
+
+ /**Discover bean classes*/
+ protected ScannerService scannerService;
+
+ protected final ContextsService contextsService;
+
+ /**Deploy discovered beans*/
+ private final BeansDeployer deployer;
+
+ /**Using for lookup operations*/
+ private final JNDIService jndiService;
+
+ /**Root container.*/
+ private final BeanManagerImpl beanManager;
+ protected final WebBeansContext webBeansContext;
+
+ protected AbstractLifeCycle()
+ {
+ this(null);
+ }
+
+ protected AbstractLifeCycle(Properties properties)
+ {
+ this(properties, WebBeansContext.getInstance());
+ }
+
+ protected AbstractLifeCycle(Properties properties, WebBeansContext webBeansContext)
+ {
+ beforeInitApplication(properties);
+
+ this.webBeansContext = webBeansContext;
+ beanManager = this.webBeansContext.getBeanManagerImpl();
+
+ WebBeansXMLConfigurator xmlDeployer = new WebBeansXMLConfigurator();
+ deployer = new BeansDeployer(xmlDeployer, this.webBeansContext);
+
+ jndiService = this.webBeansContext.getService(JNDIService.class);
+ beanManager.setXMLConfigurator(xmlDeployer);
+ scannerService = this.webBeansContext.getScannerService();
+ contextsService = this.webBeansContext.getService(ContextsService.class);
+ initApplication(properties);
+ }
+
+ public WebBeansContext getWebBeansContext()
+ {
+ return webBeansContext;
+ }
+
+ @Override
+ public BeanManager getBeanManager()
+ {
+ return beanManager;
+ }
+
+ @Override
+ public void startApplication(Object startupObject)
+ {
+ bootstrapApplication(startupObject);
+ }
+
+ protected synchronized void bootstrapApplication(Object startupObject)
+ {
+ if (started.get())
+ {
+ return;
+ }
+
+ // Initalize Application Context
+ logger.info(OWBLogConst.INFO_0005);
+
+ long begin = System.currentTimeMillis();
+
+ //Before Start
+ beforeStartApplication(startupObject);
+
+ //Load all plugins
+ webBeansContext.getPluginLoader().startUp();
+
+ //Initialize contexts
+ contextsService.init(startupObject);
+
+ //Scanning process
+ logger.fine("Scanning classpaths for beans artifacts.");
+
+ //Scan
+ scannerService.scan();
+
+ //Deploy beans
+ logger.fine("Deploying scanned beans.");
+
+ //Deploy
+ deployer.deploy(scannerService);
+
+ //Start actual starting on sub-classes
+ afterStartApplication(startupObject);
+
+ if (logger.isLoggable(Level.INFO))
+ {
+ logger.log(Level.INFO, OWBLogConst.INFO_0001, Long.toString(System.currentTimeMillis() - begin));
+ }
+
+ started.set(true);
+ }
+
+ @Override
+ public void stopApplication(Object endObject)
+ {
+ logger.fine("OpenWebBeans Container is stopping.");
+
+ try
+ {
+ //Sub-classes operations
+ beforeStopApplication(endObject);
+
+ //Set up the thread local for Application scoped as listeners will be App scoped.
+ contextsService.startContext(ApplicationScoped.class, endObject);
+
+ //Fire shut down
+ beanManager.fireLifecycleEvent(new BeforeShutdownImpl());
+
+ //Destroys context
+ contextsService.destroy(endObject);
+
+ //Unbind BeanManager
+ jndiService.unbind(WebBeansConstants.WEB_BEANS_MANAGER_JNDI_NAME);
+
+ //Free all plugin resources
+ webBeansContext.getPluginLoader().shutDown();
+
+ //Clear extensions
+ webBeansContext.getExtensionLoader().clear();
+
+ //Delete Resolutions Cache
+ InjectionResolver injectionResolver = webBeansContext.getBeanManagerImpl().getInjectionResolver();
+
+ injectionResolver.clearCaches();
+
+ //Delete AnnotateTypeCache
+ webBeansContext.getAnnotatedElementFactory().clear();
+
+ //After Stop
+ afterStopApplication(endObject);
+
+ // Clear BeanManager
+ beanManager.clear();
+ }
+ catch (Exception e)
+ {
+ if (logger.isLoggable(Level.SEVERE))
+ {
+ logger.log(Level.SEVERE, OWBLogConst.ERROR_0021, e);
+ }
+ }
+ finally
+ {
+ started.set(false);
+ // Clear singleton list
+ WebBeansFinder.clearInstances(WebBeansUtil.getCurrentClassLoader());
+ }
+ }
+
+ /**
+ * @return the contextsService
+ */
+ @Override
+ public ContextsService getContextService()
+ {
+ return contextsService;
+ }
+
+ @Override
+ public void initApplication(Properties properties)
+ {
+ afterInitApplication(properties);
+ }
+
+ protected void beforeInitApplication(Properties properties)
+ {
+ //Do nothing as default
+ }
+
+ protected void afterInitApplication(Properties properties)
+ {
+ //Do nothing as default
+ }
+
+ protected void afterStartApplication(Object startupObject)
+ {
+ //Do nothing as default
+ }
+
+ protected void afterStopApplication(Object stopObject)
+ {
+ //Do nothing as default
+ }
+
+ protected void beforeStartApplication(Object startupObject)
+ {
+ //Do nothing as default
+ }
+
+ protected void beforeStopApplication(Object stopObject)
+ {
+ //Do nothing as default
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/StandaloneLifeCycle.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/StandaloneLifeCycle.java
new file mode 100644
index 0000000..459b021
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/StandaloneLifeCycle.java
@@ -0,0 +1,82 @@
+/*
+ * 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.webbeans.lifecycle;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Singleton;
+import java.util.Properties;
+import java.util.logging.Logger;
+
+import org.apache.webbeans.config.WebBeansFinder;
+import org.apache.webbeans.el.ELContextStore;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.util.WebBeansUtil;
+
+/**
+ * Default LifeCycle for a standalone application without a ServletContainer.
+ */
+public class StandaloneLifeCycle extends AbstractLifeCycle
+{
+ public StandaloneLifeCycle(Properties properties, Logger logger)
+ {
+ super(properties);
+ this.logger = logger;
+ }
+
+ public StandaloneLifeCycle()
+ {
+ this(null, WebBeansLoggerFacade.getLogger(StandaloneLifeCycle.class));
+ }
+
+ @Override
+ public void beforeStartApplication(Object object)
+ {
+ webBeansContext.getContextsService().startContext(RequestScoped.class, null);
+ webBeansContext.getContextsService().startContext(SessionScoped.class, null);
+ webBeansContext.getContextsService().startContext(ConversationScoped.class, null);
+ webBeansContext.getContextsService().startContext(ApplicationScoped.class, null);
+ webBeansContext.getContextsService().startContext(Singleton.class, null);
+ }
+
+ @Override
+ public void beforeStopApplication(Object endObject)
+ {
+ webBeansContext.getContextsService().endContext(RequestScoped.class, null);
+ webBeansContext.getContextsService().endContext(SessionScoped.class, null);
+ webBeansContext.getContextsService().endContext(ConversationScoped.class, null);
+ webBeansContext.getContextsService().endContext(ApplicationScoped.class, null);
+ webBeansContext.getContextsService().endContext(Singleton.class, null);
+
+ // clean up the EL caches after each request
+ ELContextStore elStore = ELContextStore.getInstance(false);
+ if (elStore != null)
+ {
+ elStore.destroyELContextStore();
+ }
+ }
+
+ @Override
+ protected void afterStopApplication(Object stopObject)
+ {
+ WebBeansFinder.clearInstances(WebBeansUtil.getCurrentClassLoader());
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/test/OpenWebBeansTestLifeCycle.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/test/OpenWebBeansTestLifeCycle.java
new file mode 100644
index 0000000..88a941f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/test/OpenWebBeansTestLifeCycle.java
@@ -0,0 +1,48 @@
+/*
+ * 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.webbeans.lifecycle.test;
+
+import java.util.Properties;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.lifecycle.StandaloneLifeCycle;
+import org.apache.webbeans.spi.ScannerService;
+
+/**
+ * Ease the writing of the tests. Simulates container
+ * startup and stop functionality and allow injection of
+ * classes which should be scanned by using the
+ * {@link OpenWebBeansTestMetaDataDiscoveryService}.
+ * @version $Rev$ $Date$
+ *
+ */
+public class OpenWebBeansTestLifeCycle extends StandaloneLifeCycle
+{
+ public OpenWebBeansTestLifeCycle()
+ {
+ super();
+ }
+
+ @Override
+ public void beforeInitApplication(Properties properties)
+ {
+ WebBeansContext.getInstance().registerService(ScannerService.class, new OpenWebBeansTestMetaDataDiscoveryService());
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/test/OpenWebBeansTestMetaDataDiscoveryService.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/test/OpenWebBeansTestMetaDataDiscoveryService.java
new file mode 100644
index 0000000..19726e1
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/test/OpenWebBeansTestMetaDataDiscoveryService.java
@@ -0,0 +1,96 @@
+/*
+ * 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.webbeans.lifecycle.test;
+
+import org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery;
+import org.apache.webbeans.corespi.scanner.xbean.CdiArchive;
+import org.apache.webbeans.exception.WebBeansDeploymentException;
+import org.apache.webbeans.util.Asserts;
+import org.apache.xbean.finder.AnnotationFinder;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Collection;
+
+/**
+ * Used by each test.
+ * @version $Rev$ $Date$
+ *
+ */
+public class OpenWebBeansTestMetaDataDiscoveryService extends AbstractMetaDataDiscovery
+{
+ public OpenWebBeansTestMetaDataDiscoveryService()
+ {
+
+ }
+
+ @Override
+ protected void configure()
+ {
+ //Nothing we scan
+ }
+
+ /**
+ * Those classes will be scanned by container.
+ * @param classes deployed classes
+ */
+ public void deployClasses(Collection<Class<?>> classes)
+ {
+ if(classes != null)
+ {
+ archive = new CdiArchive(classes);
+ finder = new AnnotationFinder(archive);
+ }
+ }
+
+ /**
+ * Those xmls will be scanned by container.
+ * @param xmls beans xmls
+ */
+ public void deployXMLs(Collection<String> xmls)
+ {
+ if(xmls != null)
+ {
+ for(String url : xmls)
+ {
+ try
+ {
+ addBeanXml(new URL(url));
+ }
+ catch (MalformedURLException e)
+ {
+ throw new WebBeansDeploymentException("could not convert to URL: " + url, e);
+ }
+ }
+ }
+ }
+
+ /**
+ * Adds new beans.xml url for scanning.
+ * @param url new xml url
+ */
+ private void addBeanXml(URL url)
+ {
+ Asserts.assertNotNull(url);
+
+ addWebBeansXmlLocation(url);
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/logger/JULLoggerFactory.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/logger/JULLoggerFactory.java
new file mode 100644
index 0000000..fc3ab66
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/logger/JULLoggerFactory.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.logger;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.logging.Logger;
+
+public class JULLoggerFactory implements WebBeansLoggerFactory
+{
+ @Override
+ public Logger getLogger(Class<?> clazz, Locale desiredLocale)
+ {
+ return Logger.getLogger(clazz.getName(), ResourceBundle.getBundle("openwebbeans/Messages", desiredLocale).toString());
+ }
+
+ @Override
+ public Logger getLogger(Class<?> clazz)
+ {
+ return Logger.getLogger(clazz.getName(),"openwebbeans/Messages");
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/logger/WebBeansLoggerFacade.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/logger/WebBeansLoggerFacade.java
new file mode 100644
index 0000000..8d770cc
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/logger/WebBeansLoggerFacade.java
@@ -0,0 +1,153 @@
+/*
+ * 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.webbeans.logger;
+
+/*
+ * These are for use of JDK util logging.
+ */
+
+import org.apache.webbeans.config.OWBLogConst;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Wrapper class around the JUL logger class to include some checks before the
+ * logs are actually written.
+ * <p>
+ * Actually, it is a thin layer on the JUL {@link Logger} implementation.
+ * </p>
+ *
+ * @version $Rev$ $Date$
+ */
+public final class WebBeansLoggerFacade
+{
+ public static final String OPENWEBBEANS_LOGGING_FACTORY_PROP = "openwebbeans.logging.factory";
+
+ private static final WebBeansLoggerFactory FACTORY;
+
+ static final ResourceBundle WB_BUNDLE = ResourceBundle.getBundle("openwebbeans/Messages");
+
+ static {
+ final String factoryClassname = System.getProperty(OPENWEBBEANS_LOGGING_FACTORY_PROP);
+ WebBeansLoggerFactory factory = null;
+ Exception error = null;
+ if (factoryClassname != null)
+ {
+ try
+ {
+ // don't use the org.apache.webbeans.util.WebBeansUtil.getCurrentClassLoader()
+ // to avoid weird dependency and potential failing
+ ClassLoader classloader = Thread.currentThread().getContextClassLoader();
+ if(classloader == null)
+ {
+ classloader = WebBeansLoggerFacade.class.getClassLoader();
+ }
+ Class<?> factoryClazz = classloader.loadClass(factoryClassname);
+ factory = (WebBeansLoggerFactory) factoryClazz.newInstance();
+ }
+ catch (Exception e)
+ {
+ error = e;
+ }
+ }
+ if (factory != null)
+ {
+ FACTORY = factory;
+ }
+ else
+ {
+ FACTORY = new JULLoggerFactory();
+ }
+
+ final Logger logger = FACTORY.getLogger(WebBeansLoggerFacade.class);
+ if (error != null && logger.isLoggable(Level.SEVERE))
+ {
+ logger.log(Level.SEVERE, OWBLogConst.ERROR_0028, error);
+ }
+ }
+
+ /**
+ * Gets the new web beans logger instance.
+ *
+ * @param clazz own the return logger
+ * @return new logger
+ */
+ public static Logger getLogger(Class<?> clazz)
+ {
+ return FACTORY.getLogger(clazz);
+ }
+
+ /**
+ * Gets the new web beans logger instance.
+ *
+ * @param clazz own the return logger
+ * @param desiredLocale Locale used to select the Message resource bundle.
+ * @return new logger
+ */
+ public static Logger getLogger(Class<?> clazz, Locale desiredLocale)
+ {
+ return FACTORY.getLogger(clazz, desiredLocale);
+ }
+
+ public static String constructMessage(String messageKey, Object... args)
+ {
+ MessageFormat msgFrmt;
+ String formattedString;
+
+ msgFrmt = new MessageFormat(getTokenString(messageKey), Locale.getDefault());
+ formattedString = msgFrmt.format(args);
+
+ return formattedString;
+ }
+
+ public static String getTokenString(String messageKey)
+ {
+ String strVal;
+
+ if (WB_BUNDLE == null)
+ {
+ throw new NullPointerException("ResourceBundle can not be null");
+ }
+ try
+ {
+ strVal = WB_BUNDLE.getString(messageKey);
+ }
+ catch (MissingResourceException mre)
+ {
+ strVal = null;
+ }
+ if (strVal == null)
+ {
+ return messageKey;
+ }
+
+ return strVal;
+ }
+
+ // helper method
+ public static Object[] args(final Object... values)
+ {
+ return values;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/logger/WebBeansLoggerFactory.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/logger/WebBeansLoggerFactory.java
new file mode 100644
index 0000000..ecf5b66
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/logger/WebBeansLoggerFactory.java
@@ -0,0 +1,28 @@
+/*
+ * 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.webbeans.logger;
+
+import java.util.Locale;
+import java.util.logging.Logger;
+
+public interface WebBeansLoggerFactory
+{
+ Logger getLogger(Class<?> clazz, Locale desiredLocale);
+ Logger getLogger(Class<?> clazz);
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/plugins/OpenWebBeansEjbLCAPlugin.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/plugins/OpenWebBeansEjbLCAPlugin.java
new file mode 100644
index 0000000..b582c7e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/plugins/OpenWebBeansEjbLCAPlugin.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.plugins;
+
+import java.lang.annotation.Annotation;
+
+import org.apache.webbeans.spi.plugins.OpenWebBeansPlugin;
+/**
+ * @version $Rev$ $Date$
+ */
+public interface OpenWebBeansEjbLCAPlugin extends OpenWebBeansPlugin
+{
+ public Class<? extends Annotation> getPrePassivateClass();
+
+ public Class<? extends Annotation> getPostActivateClass();
+
+ public Class<? extends Annotation> getAroundTimeoutClass();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/plugins/OpenWebBeansJmsPlugin.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/plugins/OpenWebBeansJmsPlugin.java
new file mode 100644
index 0000000..fb74aff
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/plugins/OpenWebBeansJmsPlugin.java
@@ -0,0 +1,31 @@
+/*
+ * 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.webbeans.plugins;
+
+import javax.enterprise.inject.spi.Bean;
+
+import org.apache.webbeans.jms.JMSModel;
+import org.apache.webbeans.spi.plugins.OpenWebBeansPlugin;
+
+public interface OpenWebBeansJmsPlugin extends OpenWebBeansPlugin
+{
+ public Bean<?> getJmsBean(JMSModel jmsModel);
+
+ public Object getJmsBeanProxy(Bean<?> bean, Class<?> iface);
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/plugins/PluginLoader.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/plugins/PluginLoader.java
new file mode 100644
index 0000000..a1e6b92
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/plugins/PluginLoader.java
@@ -0,0 +1,285 @@
+/*
+ * 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.webbeans.plugins;
+
+import java.lang.reflect.Proxy;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.exception.inject.DefinitionException;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.spi.plugins.OpenWebBeansEjbPlugin;
+import org.apache.webbeans.spi.plugins.OpenWebBeansJavaEEPlugin;
+import org.apache.webbeans.spi.plugins.OpenWebBeansPlugin;
+import org.apache.webbeans.spi.plugins.OpenWebBeansWebPlugin;
+
+/**
+ * <p>OpenWebBeans plugins are used to extend 'core' functionality of the injection
+ * mechanism with functionality of other frameworks.</p>
+ *
+ * <p>Core functionality are all parts which are available in a standard
+ * JDK-1.5 SE runtime. Extended functionality are things like JPA, JSF, EJB etc.</p>
+ *
+ * <p>The plugin mechanism is based on the ServiceProvider functionality.
+ * A jar containing an OWB plugin has to expose itself in the file
+ * <code>META-INF/services/org.apache.webbeans.plugins.OpenWebBeansPlugin</code></p>
+ */
+public class PluginLoader
+{
+ /**Logger instance*/
+ private static final Logger logger = WebBeansLoggerFacade.getLogger(PluginLoader.class);
+
+ /** unmodifiable list with all found OWB plugins */
+ private List<OpenWebBeansPlugin> plugins = null;
+
+ private AtomicBoolean started = new AtomicBoolean(false);
+
+ public PluginLoader()
+ {
+ }
+
+ /**
+ * load and startup all registered plugins.
+ * This must be called once the WebApplication is started.
+ * @throws WebBeansConfigurationException
+ */
+ public void startUp() throws WebBeansConfigurationException
+ {
+ if(started.compareAndSet(false, true))
+ {
+ logger.fine("PluginLoader startUp called.");
+ ArrayList<OpenWebBeansPlugin> ps = new ArrayList<OpenWebBeansPlugin>();
+
+ List<OpenWebBeansPlugin> pluginList = WebBeansContext.getInstance().getLoaderService().load(OpenWebBeansPlugin.class);
+ for (OpenWebBeansPlugin plugin : pluginList)
+ {
+ if (logger.isLoggable(Level.INFO))
+ {
+ final Class<? extends OpenWebBeansPlugin> pluginClass = plugin.getClass();
+ if (!Proxy.isProxyClass(pluginClass))
+ {
+ logger.log(Level.INFO, OWBLogConst.INFO_0004, pluginClass.getSimpleName());
+ }
+ else
+ {
+ logger.log(Level.INFO, OWBLogConst.INFO_0004, plugin.toString());
+ }
+ }
+ try
+ {
+ plugin.startUp();
+ }
+ catch (Exception e)
+ {
+ throwsException(e);
+ }
+ ps.add(plugin);
+ }
+
+ // just to make sure the plugins aren't modified afterwards
+ plugins = Collections.unmodifiableList(ps);
+ }
+ else
+ {
+ logger.fine("PluginLoader is already started.");
+ }
+ }
+
+ public static void throwsException(Exception e) throws WebBeansConfigurationException
+ {
+ if(e instanceof DefinitionException)
+ {
+ throw (DefinitionException)e;
+ }
+ else
+ {
+ throw new WebBeansConfigurationException(e);
+ }
+ }
+
+ /**
+ * Tell all the plugins to free up all locked resources.
+ * This must be called before the WebApplication gets undeployed or stopped.
+ * @throws WebBeansConfigurationException
+ */
+ public void shutDown() throws WebBeansConfigurationException
+ {
+ if(started.compareAndSet(true, false))
+ {
+ logger.fine("PluginLoader shutDown called.");
+
+ if (plugins == null)
+ {
+ logger.warning(OWBLogConst.WARN_0001);
+ return;
+ }
+
+ ArrayList<String> failedShutdown = new ArrayList<String>();
+
+ for (OpenWebBeansPlugin plugin : plugins)
+ {
+ try
+ {
+ plugin.shutDown();
+ }
+ catch (Exception e)
+ {
+ // we catch ALL exceptions, since we like to continue shutting down all other plugins!
+ String pluginName = plugin.getClass().getSimpleName();
+ logger.log(Level.SEVERE, WebBeansLoggerFacade.constructMessage(OWBLogConst.ERROR_0009, pluginName), e);
+ failedShutdown.add(pluginName);
+ }
+ }
+
+ if (!failedShutdown.isEmpty())
+ {
+ throw new WebBeansConfigurationException(WebBeansLoggerFacade.getTokenString(OWBLogConst.EXCEPT_0006) + failedShutdown.toString());
+ }
+ }
+ else
+ {
+ logger.fine("PluginLoader is already shut down.");
+ }
+ }
+
+ /**
+ * @return an unmodifiable list of all registered {code OpenWebBeansPlugin}s
+ */
+ public List<OpenWebBeansPlugin> getPlugins()
+ {
+ return plugins;
+ }
+
+ /**
+ * Gets ejb plugin
+ *
+ * @return ejb plugin
+ */
+ public OpenWebBeansEjbPlugin getEjbPlugin()
+ {
+ if(!pluginsExist())
+ {
+ return null;
+ }
+
+ for(OpenWebBeansPlugin plugin : plugins)
+ {
+ if(plugin instanceof OpenWebBeansEjbPlugin)
+ {
+ return (OpenWebBeansEjbPlugin)plugin;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Gets ejb lifecycle annotations plugin
+ *
+ * @return ejb LCA plugin
+ */
+ public OpenWebBeansEjbLCAPlugin getEjbLCAPlugin()
+ {
+ if(!pluginsExist())
+ {
+ return null;
+ }
+
+ for(OpenWebBeansPlugin plugin : plugins)
+ {
+ if(plugin instanceof OpenWebBeansEjbLCAPlugin)
+ {
+ return (OpenWebBeansEjbLCAPlugin)plugin;
+ }
+ }
+
+ return null;
+ }
+ /**
+ * Gets the JMS plugin
+ *
+ * @return jms plugin
+ */
+ public OpenWebBeansJmsPlugin getJmsPlugin()
+ {
+ if(!pluginsExist())
+ {
+ return null;
+ }
+
+ for(OpenWebBeansPlugin plugin : plugins)
+ {
+ if(plugin instanceof OpenWebBeansJmsPlugin)
+ {
+ return (OpenWebBeansJmsPlugin)plugin;
+ }
+ }
+
+ return null;
+ }
+
+
+ public OpenWebBeansJavaEEPlugin getJavaEEPlugin()
+ {
+ if(!pluginsExist())
+ {
+ return null;
+ }
+
+ for(OpenWebBeansPlugin plugin : plugins)
+ {
+ if(plugin instanceof OpenWebBeansJavaEEPlugin)
+ {
+ return (OpenWebBeansJavaEEPlugin)plugin;
+ }
+ }
+
+ return null;
+ }
+
+ public OpenWebBeansWebPlugin getWebPlugin()
+ {
+ if(!pluginsExist())
+ {
+ return null;
+ }
+
+ for(OpenWebBeansPlugin plugin : plugins)
+ {
+ if(plugin instanceof OpenWebBeansWebPlugin)
+ {
+ return (OpenWebBeansWebPlugin)plugin;
+ }
+ }
+
+ return null;
+ }
+
+ private boolean pluginsExist()
+ {
+ return plugins != null && plugins.size() > 0;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractAnnotated.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractAnnotated.java
new file mode 100644
index 0000000..6cec05b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractAnnotated.java
@@ -0,0 +1,235 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.enterprise.inject.Typed;
+import javax.enterprise.inject.spi.Annotated;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.ClassUtil;
+import org.apache.webbeans.util.GenericsUtil;
+
+/**
+ * Abstract implementation of the {@link Annotated} contract.
+ *
+ * @version $Rev$ $Date$
+ */
+abstract class AbstractAnnotated implements Annotated
+{
+ /**Base type of an annotated element*/
+ private final Type baseType;
+
+ /**Type closures*/
+ private Set<Type> typeClosures = null;
+
+ /**Set of annotations*/
+ private Set<Annotation> annotations = new HashSet<Annotation>();
+
+ private final WebBeansContext webBeansContext;
+
+ /**
+ * Creates a new annotated element.
+ *
+ * @param webBeansContext our WebBeansContext
+ * @param baseType annotated element type
+ */
+ protected AbstractAnnotated(WebBeansContext webBeansContext, Type baseType)
+ {
+ if (webBeansContext == null)
+ {
+ throw new NullPointerException("no WebBeansContext");
+ }
+ if (baseType == null)
+ {
+ throw new NullPointerException("no base type");
+ }
+ this.baseType = baseType;
+ this.webBeansContext = webBeansContext;
+ }
+
+ /**
+ * Adds new annotation to set.
+ *
+ * @param annotation new annotation
+ */
+ protected void addAnnotation(Annotation annotation)
+ {
+ annotations.add(annotation);
+ }
+
+ protected WebBeansContext getWebBeansContext()
+ {
+ return webBeansContext;
+ }
+
+ /**
+ * Adds new annotation to set.
+ *
+ * @param annotations new annotations
+ */
+ protected void setAnnotations(Annotation[] annotations)
+ {
+ this.annotations.clear();
+ Collections.addAll(this.annotations, annotations);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+ {
+ for(Annotation ann : annotations)
+ {
+ if(ann.annotationType().equals(annotationType))
+ {
+ return (T)ann;
+ }
+ }
+
+ return null;
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<Annotation> getAnnotations()
+ {
+ return annotations;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Type getBaseType()
+ {
+ return baseType;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<Type> getTypeClosure()
+ {
+ if (typeClosures == null)
+ {
+ initTypeClosure();
+ }
+ return typeClosures;
+ }
+
+ protected abstract Class<?> getOwningClass();
+ protected abstract Class<?> getDeclaringClass();
+
+ private synchronized void initTypeClosure()
+ {
+ if (typeClosures == null)
+ {
+ typeClosures = GenericsUtil.getTypeClosure(baseType, getOwningClass(), getDeclaringClass());
+ Set<String> ignoredInterfaces = webBeansContext.getOpenWebBeansConfiguration().getIgnoredInterfaces();
+ for (Iterator<Type> i = typeClosures.iterator(); i.hasNext(); )
+ {
+ Type t = i.next();
+ if (t instanceof Class && ignoredInterfaces.contains(((Class<?>)t).getName()))
+ {
+ i.remove();
+ }
+ }
+
+ Annotation[] anns = annotations.toArray(new Annotation[annotations.size()]);
+ if(AnnotationUtil.hasAnnotation(anns, Typed.class))
+ {
+ Typed beanTypes = AnnotationUtil.getAnnotation(anns, Typed.class);
+ Class<?>[] types = beanTypes.value();
+
+ //New api types
+ Set<Type> newTypes = new HashSet<Type>();
+ for(Class<?> type : types)
+ {
+ Type foundType = null;
+
+ for(Type apiType : typeClosures)
+ {
+ if(ClassUtil.getClazz(apiType) == type)
+ {
+ foundType = apiType;
+ break;
+ }
+ }
+
+ if(foundType == null)
+ {
+ throw new WebBeansConfigurationException("@Type values must be in bean api types of class: " + baseType);
+ }
+
+ newTypes.add(foundType);
+ }
+
+ typeClosures.clear();
+ typeClosures.addAll(newTypes);
+
+ typeClosures.add(Object.class);
+ }
+
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+ {
+ for(Annotation ann : annotations)
+ {
+ if(ann.annotationType().equals(annotationType))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder();
+
+ builder.append("Base Type : " + baseType.toString() + ",");
+ builder.append("Type Closures : " + typeClosures + ",");
+ builder.append("Annotations : " + annotations.toString());
+
+ return builder.toString();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractAnnotatedCallable.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractAnnotatedCallable.java
new file mode 100644
index 0000000..38453c8
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractAnnotatedCallable.java
@@ -0,0 +1,97 @@
+/*
+ * 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.webbeans.portable;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Member;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.inject.spi.AnnotatedCallable;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.AnnotatedType;
+
+/**
+ * Implementation of {@link AnnotatedCallable} interface.
+ *
+ * @version $Rev$ $Date$
+ *
+ * @param <X> declaring class
+ */
+abstract class AbstractAnnotatedCallable<X> extends AbstractAnnotatedMember<X> implements AnnotatedCallable<X>
+{
+ /**Annotated parameters*/
+ private List<AnnotatedParameter<X>> annotatedParameters = new ArrayList<AnnotatedParameter<X>>();
+
+ AbstractAnnotatedCallable(WebBeansContext webBeansContext, Type baseType, Member javaMember, AnnotatedType<X> declaringType)
+ {
+ super(webBeansContext, baseType,javaMember,declaringType);
+ }
+
+ protected void setAnnotatedParameters(Type[] genericParameterTypes,Annotation[][] parameterAnnotations)
+ {
+ int i = 0;
+
+ for(Type genericParameter : genericParameterTypes)
+ {
+ AnnotatedParameterImpl<X> parameterImpl = new AnnotatedParameterImpl<X>(getWebBeansContext(), genericParameter,this,i);
+ parameterImpl.setAnnotations(parameterAnnotations[i]);
+
+ addAnnotatedParameter(parameterImpl);
+
+ i++;
+ }
+ }
+
+ /**
+ * Adds new annotated parameter.
+ *
+ * @param parameter new annotated parameter
+ */
+ void addAnnotatedParameter(AnnotatedParameter<X> parameter)
+ {
+ annotatedParameters.add(parameter);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<AnnotatedParameter<X>> getParameters()
+ {
+ return annotatedParameters;
+ }
+
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder(super.toString());
+ builder.append(",");
+ builder.append("Annotated Parameters : [");
+ for(AnnotatedParameter<X> parameter : annotatedParameters)
+ {
+ builder.append(parameter.toString());
+ }
+ builder.append("]");
+
+ return builder.toString();
+ }
+ }
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractAnnotatedMember.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractAnnotatedMember.java
new file mode 100644
index 0000000..bf7888d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractAnnotatedMember.java
@@ -0,0 +1,105 @@
+/*
+ * 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.webbeans.portable;
+
+import java.lang.reflect.Member;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Type;
+
+import javax.enterprise.inject.spi.AnnotatedMember;
+import javax.enterprise.inject.spi.AnnotatedType;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+/**
+ * Implementation of {@link AnnotatedMember} interface.
+ *
+ * @version $Rev$ $Date$
+ *
+ * @param <X> declaring class
+ */
+abstract class AbstractAnnotatedMember<X> extends AbstractAnnotated implements AnnotatedMember<X>
+{
+ /**Annotated type that owns this member*/
+ private final AnnotatedType<X> declaringType;
+
+ /**Member type*/
+ protected final Member javaMember;
+
+ AbstractAnnotatedMember(WebBeansContext webBeansContext, Type baseType, Member javaMember, AnnotatedType<X> declaringType)
+ {
+ super(webBeansContext, baseType);
+
+ if (declaringType == null)
+ {
+ throw new IllegalArgumentException("declaringType cannot be null");
+ }
+
+ this.javaMember = javaMember;
+ this.declaringType = declaringType;
+
+ }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public AnnotatedType<X> getDeclaringType()
+ {
+ return declaringType;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Member getJavaMember()
+ {
+ return javaMember;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isStatic()
+ {
+ return Modifier.isStatic(javaMember.getModifiers());
+ }
+
+ @Override
+ protected Class<?> getOwningClass()
+ {
+ return declaringType.getJavaClass();
+ }
+
+ @Override
+ protected Class<?> getDeclaringClass()
+ {
+ return javaMember.getDeclaringClass();
+ }
+
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder(super.toString());
+ builder.append(",");
+ builder.append("Java Member Name : " + javaMember.getName());
+
+ return builder.toString();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractDecoratorInjectionTarget.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractDecoratorInjectionTarget.java
new file mode 100644
index 0000000..1e64662
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractDecoratorInjectionTarget.java
@@ -0,0 +1,56 @@
+/*
+ * 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.webbeans.portable;
+
+import java.lang.reflect.Constructor;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+public class AbstractDecoratorInjectionTarget<T> extends InjectionTargetImpl<T>
+{
+ private Class<T> proxySubClass = null;
+
+ public AbstractDecoratorInjectionTarget(AnnotatedType<T> annotatedType, Set<InjectionPoint> points, WebBeansContext webBeansContext,
+ List<AnnotatedMethod<?>> postConstructMethods, List<AnnotatedMethod<?>> preDestroyMethods)
+ {
+ super(annotatedType, points, webBeansContext, postConstructMethods, preDestroyMethods);
+ }
+
+ @Override
+ protected AnnotatedConstructor<T> createConstructor()
+ {
+ // create proxy subclass
+ ClassLoader classLoader = getClass().getClassLoader();
+ Class<T> classToProxy = annotatedType.getJavaClass();
+
+ proxySubClass = webBeansContext.getSubclassProxyFactory().createImplementedSubclass(classLoader, classToProxy);
+
+ //X TODO what about @Inject constructors?
+ Constructor<T> ct = webBeansContext.getWebBeansUtil().getNoArgConstructor(proxySubClass);
+ return new AnnotatedConstructorImpl<T>(webBeansContext, ct, annotatedType);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractEjbInjectionTarget.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractEjbInjectionTarget.java
new file mode 100644
index 0000000..1d70355
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractEjbInjectionTarget.java
@@ -0,0 +1,41 @@
+/*
+ * 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.webbeans.portable;
+
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+public abstract class AbstractEjbInjectionTarget<T> extends InjectionTargetImpl<T>
+{
+
+ public AbstractEjbInjectionTarget(AnnotatedType<T> annotatedType,
+ Set<InjectionPoint> points,
+ WebBeansContext webBeansContext)
+ {
+ super(annotatedType, points, webBeansContext, null, null);
+ }
+
+ @Override
+ public abstract T produce(CreationalContext<T> creationalContext);
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractProducer.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractProducer.java
new file mode 100644
index 0000000..8249876
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractProducer.java
@@ -0,0 +1,272 @@
+/*
+ * 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.webbeans.portable;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.decorator.Delegate;
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Decorator;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.Interceptor;
+import javax.enterprise.inject.spi.PassivationCapable;
+import javax.enterprise.inject.spi.Producer;
+import javax.interceptor.AroundInvoke;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.creational.CreationalContextImpl;
+import org.apache.webbeans.intercept.DecoratorHandler;
+import org.apache.webbeans.intercept.DefaultInterceptorHandler;
+import org.apache.webbeans.intercept.InterceptorResolutionService.BeanInterceptorInfo;
+import org.apache.webbeans.intercept.InterceptorResolutionService.BusinessMethodInterceptorInfo;
+import org.apache.webbeans.proxy.InterceptorDecoratorProxyFactory;
+import org.apache.webbeans.proxy.InterceptorHandler;
+import org.apache.webbeans.proxy.OwbInterceptorProxy;
+
+public abstract class AbstractProducer<T> implements Producer<T>
+{
+
+ private Set<InjectionPoint> injectionPoints;
+ private Class<? extends T> proxyClass;
+ private String passivationId;
+ private BeanInterceptorInfo interceptorInfo;
+ private InterceptorDecoratorProxyFactory proxyFactory;
+ private Map<Method, List<Interceptor<?>>> methodInterceptors;
+
+ public AbstractProducer()
+ {
+ this(Collections.<InjectionPoint>emptySet());
+ }
+
+ public AbstractProducer(Set<InjectionPoint> points)
+ {
+ // this shares the InjectionPoints with the owning component for now
+ injectionPoints = points;
+ }
+
+ /**
+ *
+ * Configure bean instance interceptor stack.
+ *
+ * This method gets invoked in the ValidateBean phase and will fill all the
+ * interceptor information into the given InjectionTargetBean
+ *
+ */
+ public void defineInterceptorStack(Bean<T> bean, AnnotatedType<T> annotatedType, WebBeansContext webBeansContext)
+ {
+ interceptorInfo = webBeansContext.getInterceptorResolutionService().
+ calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(), annotatedType);
+ proxyFactory = webBeansContext.getInterceptorDecoratorProxyFactory();
+ if (bean instanceof PassivationCapable)
+ {
+ PassivationCapable passivationCapable = (PassivationCapable)bean;
+ passivationId = passivationCapable.getId();
+ }
+
+ methodInterceptors = new HashMap<Method, List<Interceptor<?>>>();
+ for (Map.Entry<Method, BusinessMethodInterceptorInfo> miEntry : interceptorInfo.getBusinessMethodsInfo().entrySet())
+ {
+ Method interceptedMethod = miEntry.getKey();
+ BusinessMethodInterceptorInfo mii = miEntry.getValue();
+ List<Interceptor<?>> activeInterceptors = new ArrayList<Interceptor<?>>();
+
+ if (mii.getEjbInterceptors() != null)
+ {
+ Collections.addAll(activeInterceptors, mii.getEjbInterceptors());
+ }
+ if (mii.getCdiInterceptors() != null)
+ {
+ Collections.addAll(activeInterceptors, mii.getCdiInterceptors());
+ }
+ if (interceptorInfo.getSelfInterceptorBean() != null)
+ {
+ if (interceptedMethod.getAnnotation(AroundInvoke.class) == null) // this check is a dirty hack for now to prevent infinite loops
+ {
+ // add self-interception as last interceptor in the chain.
+ activeInterceptors.add(interceptorInfo.getSelfInterceptorBean());
+ }
+ }
+
+ if (activeInterceptors.size() > 0)
+ {
+ methodInterceptors.put(interceptedMethod, activeInterceptors);
+ }
+ else if (mii.getMethodDecorators() != null)
+ {
+ methodInterceptors.put(interceptedMethod, Collections.EMPTY_LIST);
+ }
+ }
+
+ defineLifecycleInterceptors(bean, annotatedType, webBeansContext);
+
+ if (needsProxy())
+ {
+ // we only need to create a proxy class for intercepted or decorated Beans
+ InterceptorDecoratorProxyFactory pf = webBeansContext.getInterceptorDecoratorProxyFactory();
+
+ ClassLoader classLoader = annotatedType.getJavaClass().getClassLoader();
+
+ Method[] businessMethods = methodInterceptors.keySet().toArray(new Method[methodInterceptors.size()]);
+ Method[] nonInterceptedMethods = interceptorInfo.getNonInterceptedMethods().toArray(new Method[interceptorInfo.getNonInterceptedMethods().size()]);
+
+ proxyClass = (Class<? extends T>) pf.createProxyClass(bean, classLoader, annotatedType.getJavaClass(), businessMethods, nonInterceptedMethods);
+
+ // now we collect the post-construct and pre-destroy interceptors
+
+ }
+ }
+
+ @Override
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ return injectionPoints;
+ }
+
+ public BeanInterceptorInfo getInterceptorInfo()
+ {
+ return interceptorInfo;
+ }
+
+ @Override
+ public T produce(CreationalContext<T> creationalContext)
+ {
+ final CreationalContextImpl<T> creationalContextImpl = (CreationalContextImpl<T>) creationalContext;
+
+ final Map<Interceptor<?>,Object> interceptorInstances = new HashMap<Interceptor<?>, Object>();
+ final Contextual<T> oldContextual = creationalContextImpl.getContextual();
+
+ if (interceptorInfo != null)
+ {
+ // apply interceptorInfo
+
+ // create EJB-style interceptors
+ for (final Interceptor interceptorBean : interceptorInfo.getEjbInterceptors())
+ {
+ creationalContextImpl.putContextual(interceptorBean);
+ interceptorInstances.put(interceptorBean, interceptorBean.create(creationalContext));
+ }
+
+ // create CDI-style interceptors
+ for (final Interceptor interceptorBean : interceptorInfo.getCdiInterceptors())
+ {
+ creationalContextImpl.putContextual(interceptorBean);
+ interceptorInstances.put(interceptorBean, interceptorBean.create(creationalContext));
+ }
+ }
+
+ T instance = produce(interceptorInstances, creationalContextImpl);
+
+ if (hasInterceptorInfo())
+ {
+ // register the bean itself for self-interception
+ if (interceptorInfo.getSelfInterceptorBean() != null)
+ {
+ interceptorInstances.put(interceptorInfo.getSelfInterceptorBean(), instance);
+ }
+
+ T delegate = instance;
+ if (interceptorInfo.getDecorators() != null && !isDelegateInjection(creationalContextImpl))
+ {
+ List<Decorator<?>> decorators = interceptorInfo.getDecorators();
+ Map<Decorator<?>, Object> instances = new HashMap<Decorator<?>, Object>();
+ for (int i = decorators.size(); i > 0; i--)
+ {
+ Decorator decorator = decorators.get(i - 1);
+ creationalContextImpl.putContextual(decorator);
+ creationalContextImpl.putDelegate(delegate);
+ Object decoratorInstance = decorator.create((CreationalContext) creationalContext);
+ instances.put(decorator, decoratorInstance);
+ delegate = proxyFactory.createProxyInstance(proxyClass, instance, new DecoratorHandler(interceptorInfo, instances, i - 1, instance, passivationId));
+ }
+ }
+ InterceptorHandler interceptorHandler = new DefaultInterceptorHandler<T>(instance, delegate, methodInterceptors, interceptorInstances, passivationId);
+
+ T proxyInstance = proxyFactory.createProxyInstance(proxyClass, instance, interceptorHandler);
+ instance = proxyInstance;
+ creationalContextImpl.putContextual(oldContextual);
+ }
+
+ return instance;
+ }
+
+ @Override
+ public void dispose(T instance)
+ {
+ }
+
+ protected abstract T produce(Map<Interceptor<?>, ?> interceptorInstances, CreationalContextImpl<T> creationalContext);
+
+ protected InterceptorDecoratorProxyFactory getProxyFactory()
+ {
+ return proxyFactory;
+ }
+
+ protected Map<Method, List<Interceptor<?>>> getMethodInterceptors()
+ {
+ return methodInterceptors;
+ }
+
+ protected boolean needsProxy()
+ {
+ return methodInterceptors.size() != 0;
+ }
+
+ protected boolean hasInterceptorInfo()
+ {
+ return interceptorInfo != null && proxyClass != null;
+ }
+
+ protected boolean isDelegateInjection(final CreationalContextImpl<?> cc)
+ {
+ final InjectionPoint ip = cc.getInjectionPoint();
+ if (ip == null)
+ {
+ return false;
+ }
+ return ip.getAnnotated().isAnnotationPresent(Delegate.class);
+ }
+
+ /**
+ * Helper method to unwrap the internal proxy instance.
+ * Returns the instance directly if this is not a proxied instance.
+ */
+ protected T unwrapProxyInstance(T probableProxyInstance)
+ {
+ if (proxyFactory != null && probableProxyInstance instanceof OwbInterceptorProxy)
+ {
+ return proxyFactory.unwrapInstance(probableProxyInstance);
+ }
+
+ return probableProxyInstance;
+ }
+
+ protected void defineLifecycleInterceptors(Bean<T> bean, AnnotatedType<T> annotatedType, WebBeansContext webBeansContext)
+ {
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedConstructorImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedConstructorImpl.java
new file mode 100644
index 0000000..7c6d6fa
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedConstructorImpl.java
@@ -0,0 +1,70 @@
+/*
+ * 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.webbeans.portable;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.util.GenericsUtil;
+
+import java.lang.reflect.Constructor;
+
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+import javax.enterprise.inject.spi.AnnotatedType;
+
+/**
+ * Implementation of {@link AnnotatedConstructor} interface.
+ *
+ * @version $Rev$ $Date$
+ *
+ * @param <X> class info
+ */
+public class AnnotatedConstructorImpl<X> extends AbstractAnnotatedCallable<X> implements AnnotatedConstructor<X>
+{
+ /**
+ * Create a ew instance.
+ *
+ * @param javaMember constructor
+ */
+ public AnnotatedConstructorImpl(WebBeansContext webBeansContext, Constructor<X> javaMember, AnnotatedType<X> declaringType)
+ {
+ super(webBeansContext, javaMember.getDeclaringClass(), javaMember, declaringType);
+ setAnnotations(javaMember.getDeclaredAnnotations());
+ setAnnotatedParameters(GenericsUtil.resolveParameterTypes(declaringType.getJavaClass(), javaMember), javaMember.getParameterAnnotations());
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public Constructor<X> getJavaMember()
+ {
+ return Constructor.class.cast(javaMember);
+ }
+
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append("Annotated Constructor,");
+ builder.append(super.toString());
+
+ return builder.toString();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedElementFactory.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedElementFactory.java
new file mode 100644
index 0000000..2a0eca1
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedElementFactory.java
@@ -0,0 +1,300 @@
+/*
+ * 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.webbeans.portable;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedType;
+
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.util.Asserts;
+
+/**
+ * Factory for {@link javax.enterprise.inject.spi.Annotated} elements.
+ *
+ * @version $Rev$ $Date$
+ */
+public final class AnnotatedElementFactory
+{
+
+ public static final String OWB_DEFAULT_KEY = "OWB_DEFAULT_KEY";
+
+ // Logger instance
+ private final static Logger logger = WebBeansLoggerFacade.getLogger(AnnotatedElementFactory.class);
+
+ //Cache of the AnnotatedType
+ private ConcurrentMap<Class<?>, ConcurrentMap<String, AnnotatedType<?>>> annotatedTypeCache =
+ new ConcurrentHashMap<Class<?>, ConcurrentMap<String, AnnotatedType<?>>>();
+
+ //Cache of AnnotatedConstructor
+ private ConcurrentMap<Constructor<?>, AnnotatedConstructor<?>> annotatedConstructorCache =
+ new ConcurrentHashMap<Constructor<?>, AnnotatedConstructor<?>>();
+
+ //Cache of AnnotatedMethod
+ private ConcurrentMap<Method, AnnotatedMethod<?>> annotatedMethodCache =
+ new ConcurrentHashMap<Method, AnnotatedMethod<?>>();
+
+ //Cache of AnnotatedField
+ private ConcurrentMap<Field, AnnotatedField<?>> annotatedFieldCache =
+ new ConcurrentHashMap<Field, AnnotatedField<?>>();
+
+ private WebBeansContext webBeansContext;
+
+ /**
+ * No instantiate.
+ */
+ public AnnotatedElementFactory(WebBeansContext webBeansContext)
+ {
+ this.webBeansContext = webBeansContext;
+ }
+
+ /**
+ * Get an already registered AnnotatedType. This will NOT create a new one!
+ * @param annotatedClass
+ * @param <X>
+ * @return AnnotatedType
+ */
+ public <X> AnnotatedType<X> getAnnotatedType(Class<X> annotatedClass)
+ {
+ return getAnnotatedTypeCache(annotatedClass).get(OWB_DEFAULT_KEY);
+ }
+
+ /**
+ * Get all already registered AnnotatedTypes of the specified type. This will NOT create a new one!
+ * @param annotatedClass
+ * @param <X>
+ * @return AnnotatedType
+ */
+ public <X> Iterable<AnnotatedType<X>> getAnnotatedTypes(Class<X> annotatedClass)
+ {
+ return getAnnotatedTypeCache(annotatedClass).values();
+ }
+
+ /**
+ * This method will get used to manually add AnnoatedTypes to our storage.
+ * Those AnnotatedTypes are coming from Extensions and get registered e.g. via
+ * {@link javax.enterprise.inject.spi.BeforeBeanDiscovery#addAnnotatedType(AnnotatedType)}
+ *
+ * Sets the annotatedType and replace the given one.
+ * @param annotatedType
+ * @param <X>
+ * @return the previously registered AnnotatedType or null if not previously defined.
+ */
+ public <X> AnnotatedType<X> setAnnotatedType(AnnotatedType<X> annotatedType)
+ {
+ return setAnnotatedType(annotatedType, OWB_DEFAULT_KEY);
+ }
+
+ public <X> AnnotatedType<X> setAnnotatedType(AnnotatedType<X> annotatedType, String id)
+ {
+ ConcurrentMap<String, AnnotatedType<X>> annotatedTypes = getAnnotatedTypeCache(annotatedType.getJavaClass());
+ return (AnnotatedType<X>) annotatedTypes.put(id, annotatedType);
+ }
+
+ /**
+ * Creates and configures new annotated type.
+ *
+ * @param <X> class info
+ * @param annotatedClass annotated class
+ * @return new annotated type
+ */
+ public <X> AnnotatedType<X> newAnnotatedType(Class<X> annotatedClass)
+ {
+ Asserts.assertNotNull(annotatedClass, "annotatedClass is null");
+ ConcurrentMap<String, AnnotatedType<X>> annotatedTypes = getAnnotatedTypeCache(annotatedClass);
+ AnnotatedType<X> annotatedType = annotatedTypes.get(OWB_DEFAULT_KEY);
+ if(annotatedType == null)
+ {
+ try
+ {
+ AnnotatedType<? super X> supertype = null;
+ if (annotatedClass.getSuperclass() != null && !annotatedClass.getSuperclass().equals(Object.class))
+ {
+ supertype = newAnnotatedType(annotatedClass.getSuperclass());
+ }
+ annotatedType = new AnnotatedTypeImpl<X>(webBeansContext, annotatedClass, supertype);
+
+ AnnotatedType<X> oldType = annotatedTypes.putIfAbsent(OWB_DEFAULT_KEY, annotatedType);
+ if(oldType != null)
+ {
+ annotatedType = oldType;
+ }
+ }
+ catch (Exception e)
+ {
+ if (e instanceof ClassNotFoundException || e instanceof ArrayStoreException)
+ {
+ if (logger.isLoggable(Level.SEVERE))
+ {
+ logger.log(Level.SEVERE, WebBeansLoggerFacade.constructMessage(OWBLogConst.ERROR_0027, annotatedClass.getName(), e.getCause()), e);
+ }
+
+ annotatedType = null;
+ }
+ else
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ catch (NoClassDefFoundError ncdfe)
+ {
+ if (logger.isLoggable(Level.SEVERE))
+ {
+ logger.log(Level.SEVERE, WebBeansLoggerFacade.constructMessage(OWBLogConst.ERROR_0027, annotatedClass.getName(), ncdfe.getCause()), ncdfe);
+ }
+
+ annotatedType = null;
+ }
+ }
+
+ return annotatedType;
+ }
+
+ /**
+ * Creates and configures new annotated constructor.
+ *
+ * @param <X> declaring class
+ * @param constructor constructor
+ * @return new annotated constructor
+ */
+ @SuppressWarnings("unchecked")
+ public <X> AnnotatedConstructor<X> newAnnotatedConstructor(Constructor<X> constructor, AnnotatedType<X> declaringClass)
+ {
+ Asserts.assertNotNull(constructor, "constructor is null");
+ Asserts.assertNotNull(declaringClass, "declaringClass is null");
+
+ AnnotatedConstructorImpl<X> annConstructor;
+ if(annotatedConstructorCache.containsKey(constructor))
+ {
+ annConstructor = (AnnotatedConstructorImpl<X>)annotatedConstructorCache.get(constructor);
+ }
+ else
+ {
+ annConstructor = new AnnotatedConstructorImpl<X>(webBeansContext, constructor, declaringClass);
+ AnnotatedConstructorImpl<X> old = (AnnotatedConstructorImpl<X>)annotatedConstructorCache.putIfAbsent(constructor, annConstructor);
+ if(old != null)
+ {
+ annConstructor = old;
+ }
+ }
+
+ return annConstructor;
+ }
+
+ /**
+ * Creates and configures new annotated field.
+ *
+ * @param <X> declaring class
+ * @param field field instance
+ * @param declaringClass declaring class
+ * @return new annotated field
+ */
+ @SuppressWarnings("unchecked")
+ public <X> AnnotatedField<X> newAnnotatedField(Field field, AnnotatedType<X> declaringClass)
+ {
+ Asserts.assertNotNull(field, "field is null");
+ Asserts.assertNotNull(declaringClass, "declaringClass is null");
+
+ AnnotatedFieldImpl<X> annotField;
+ if(annotatedFieldCache.containsKey(field))
+ {
+ annotField = (AnnotatedFieldImpl<X>)annotatedFieldCache.get(field);
+ }
+ else
+ {
+ annotField = new AnnotatedFieldImpl<X>(webBeansContext, field, declaringClass);
+ AnnotatedFieldImpl<X> old = (AnnotatedFieldImpl<X>) annotatedFieldCache.putIfAbsent(field, annotField);
+ if(old != null)
+ {
+ annotField = old;
+ }
+ }
+
+ return annotField;
+ }
+
+ /**
+ * Creates and configures new annotated method.
+ *
+ * @param <X> declaring class
+ * @param method annotated method
+ * @param declaringType declaring class info
+ * @return new annotated method
+ */
+ @SuppressWarnings("unchecked")
+ public <X> AnnotatedMethod<X> newAnnotatedMethod(Method method, AnnotatedType<X> declaringType)
+ {
+ Asserts.assertNotNull(method, "method is null");
+ Asserts.assertNotNull(declaringType, "declaringType is null");
+
+ AnnotatedMethodImpl<X> annotMethod;
+ if(annotatedMethodCache.containsKey(method))
+ {
+ annotMethod = (AnnotatedMethodImpl<X>)annotatedMethodCache.get(method);
+ }
+ else
+ {
+ annotMethod = new AnnotatedMethodImpl<X>(webBeansContext, method, declaringType);
+ AnnotatedMethodImpl<X> old = (AnnotatedMethodImpl<X>) annotatedMethodCache.putIfAbsent(method, annotMethod);
+ if(old != null)
+ {
+ annotMethod = old;
+ }
+ }
+
+ return annotMethod;
+ }
+
+ /**
+ * Clear caches.
+ */
+ public void clear()
+ {
+ annotatedTypeCache.clear();
+ annotatedConstructorCache.clear();
+ annotatedFieldCache.clear();
+ annotatedMethodCache.clear();
+ }
+
+ private <T> ConcurrentMap<String, AnnotatedType<T>> getAnnotatedTypeCache(Class<T> type)
+ {
+ ConcurrentMap<String, AnnotatedType<?>> annotatedTypes = annotatedTypeCache.get(type);
+ if (annotatedTypes == null)
+ {
+ annotatedTypes = new ConcurrentHashMap<String, AnnotatedType<?>>();
+ ConcurrentMap<String, AnnotatedType<?>> oldAnnotatedTypes = annotatedTypeCache.putIfAbsent(type, annotatedTypes);
+ if (oldAnnotatedTypes != null)
+ {
+ annotatedTypes = oldAnnotatedTypes;
+ }
+ }
+ return (ConcurrentMap<String, AnnotatedType<T>>)(ConcurrentMap<?, ?>)annotatedTypes;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedFieldImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedFieldImpl.java
new file mode 100644
index 0000000..715d6f9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedFieldImpl.java
@@ -0,0 +1,73 @@
+/*
+ * 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.webbeans.portable;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.util.GenericsUtil;
+
+import java.lang.reflect.Field;
+
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedType;
+
+/**
+ * Implementation of {@link AnnotatedField} interface.
+ *
+ * @version $Rev$ $Date$
+ *
+ * @param <X>
+ */
+public class AnnotatedFieldImpl<X> extends AbstractAnnotatedMember<X> implements AnnotatedField<X>
+{
+
+ /**
+ * Creates a new instance
+ *
+ * @param declaringType base type
+ * @param javaMember field
+ */
+ AnnotatedFieldImpl(WebBeansContext webBeansContext, Field javaMember, AnnotatedType<X> declaringType)
+ {
+ super(webBeansContext, GenericsUtil.resolveType(declaringType.getJavaClass(), javaMember), javaMember,declaringType);
+
+ setAnnotations(javaMember.getDeclaredAnnotations());
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Field getJavaMember()
+ {
+ return Field.class.cast(javaMember);
+ }
+
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append("Annotated Field '");
+ builder.append(javaMember.getName());
+ builder.append("', ");
+ builder.append(super.toString());
+
+ return builder.toString();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedMethodImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedMethodImpl.java
new file mode 100644
index 0000000..1108a36
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedMethodImpl.java
@@ -0,0 +1,73 @@
+/*
+ * 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.webbeans.portable;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.util.GenericsUtil;
+
+import java.lang.reflect.Method;
+
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedType;
+
+/**
+ * Implementation of {@link AnnotatedMethod} interface.
+ *
+ * @version $Rev$ $Date$
+ *
+ * @param <X> class info
+ */
+class AnnotatedMethodImpl<X> extends AbstractAnnotatedCallable<X> implements AnnotatedMethod<X>
+{
+
+ /**
+ * Create a ew instance.
+ *
+ * @param declaringType declaring type
+ * @param javaMember method
+ */
+ AnnotatedMethodImpl(WebBeansContext webBeansContext, Method javaMember, AnnotatedType<X> declaringType)
+ {
+ super(webBeansContext, GenericsUtil.resolveReturnType(declaringType.getJavaClass(), javaMember), javaMember,declaringType);
+ setAnnotations(javaMember.getDeclaredAnnotations());
+ setAnnotatedParameters(GenericsUtil.resolveParameterTypes(declaringType.getJavaClass(), javaMember), javaMember.getParameterAnnotations());
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Method getJavaMember()
+ {
+ return Method.class.cast(javaMember);
+ }
+
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append("Annotated Method '");
+ builder.append(javaMember.getName());
+ builder.append("', ");
+ builder.append(super.toString());
+
+ return builder.toString();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedParameterImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedParameterImpl.java
new file mode 100644
index 0000000..1e8055d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedParameterImpl.java
@@ -0,0 +1,90 @@
+/*
+ * 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.webbeans.portable;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+import java.lang.reflect.Type;
+
+import javax.enterprise.inject.spi.AnnotatedCallable;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+
+/**
+ * Implementation of {@link AnnotatedParameter} interface.
+ *
+ * @version $Rev$ $Date$
+ *
+ * @param <X> declaring class info
+ */
+class AnnotatedParameterImpl<X> extends AbstractAnnotated implements AnnotatedParameter<X>
+{
+ /**Declaring callable*/
+ private final AnnotatedCallable<X> declaringCallable;
+
+ /**Parameter position*/
+ private final int position;
+
+ AnnotatedParameterImpl(WebBeansContext webBeansContext, Type baseType, AnnotatedCallable<X> declaringCallable, int position)
+ {
+ super(webBeansContext, baseType);
+ this.declaringCallable = declaringCallable;
+ this.position = position;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public AnnotatedCallable<X> getDeclaringCallable()
+ {
+ return declaringCallable;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getPosition()
+ {
+ return position;
+ }
+
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append("Annotated Parameter");
+ builder.append(",");
+ builder.append(super.toString()+ ",");
+ builder.append("Position : " + position);
+
+ return builder.toString();
+ }
+
+ @Override
+ protected Class<?> getOwningClass()
+ {
+ return declaringCallable.getDeclaringType().getJavaClass();
+ }
+
+ @Override
+ protected Class<?> getDeclaringClass()
+ {
+ return declaringCallable.getJavaMember().getDeclaringClass();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedTypeImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedTypeImpl.java
new file mode 100644
index 0000000..bc324fc
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedTypeImpl.java
@@ -0,0 +1,271 @@
+/*
+ * 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.webbeans.portable;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Inherited;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedType;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.util.ClassUtil;
+
+/**
+ * Implementation of the {@link AnnotatedType} interface.
+ *
+ * @param <X> class type
+ * @version $Rev$ $Date$
+ */
+class AnnotatedTypeImpl<X>
+ extends AbstractAnnotated
+ implements AnnotatedType<X>
+{
+ /**
+ * parent class
+ */
+ private final AnnotatedType<? super X> supertype;
+
+ /**
+ * Annotated class
+ */
+ private final Class<X> annotatedClass;
+
+ private volatile State state;
+
+ /**
+ * Creates a new instance.
+ *
+ * @param annotatedClass class
+ */
+ AnnotatedTypeImpl(WebBeansContext webBeansContext, Class<X> annotatedClass, AnnotatedType<? super X> supertype)
+ {
+ super(webBeansContext, annotatedClass);
+ this.supertype = supertype;
+ this.annotatedClass = annotatedClass;
+
+ if (supertype == null)
+ {
+ setAnnotations(annotatedClass.getDeclaredAnnotations());
+ }
+ else
+ {
+ Set<Class<? extends Annotation>> annotationTypes = new HashSet<Class<? extends Annotation>>();
+ List<Annotation> annotations = new ArrayList<Annotation>();
+ for (Annotation annotation : annotatedClass.getDeclaredAnnotations())
+ {
+ annotations.add(annotation);
+ annotationTypes.add(annotation.annotationType());
+ }
+ for (Annotation annotation : supertype.getAnnotations())
+ {
+ if (annotation.annotationType().isAnnotationPresent(Inherited.class) &&
+ !annotationTypes.contains(annotation.annotationType()))
+ {
+ annotations.add(annotation);
+ annotationTypes.add(annotation.annotationType());
+ }
+ }
+ setAnnotations(annotations.toArray(new Annotation[annotations.size()]));
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Class<X> getJavaClass()
+ {
+ return annotatedClass;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<AnnotatedConstructor<X>> getConstructors()
+ {
+ return getState().constructors;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<AnnotatedField<? super X>> getFields()
+ {
+ return getState().fields;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<AnnotatedMethod<? super X>> getMethods()
+ {
+ return getState().methods;
+ }
+
+ @Override
+ protected Class<?> getOwningClass()
+ {
+ return getJavaClass();
+ }
+
+ @Override
+ protected Class<?> getDeclaringClass()
+ {
+ return getJavaClass();
+ }
+
+ private State getState()
+ {
+ State result = state;
+ // Double check locking with standard optimization to avoid
+ // extra reads on the volatile field 'state'
+ if (result == null)
+ {
+ synchronized (this)
+ {
+ result = state;
+ if (result == null)
+ {
+ result = new State();
+ state = result;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ private class State
+ {
+
+ /**
+ * Constructors
+ */
+ private final Set<AnnotatedConstructor<X>> constructors;
+
+ /**
+ * Fields
+ */
+ private final Set<AnnotatedField<? super X>> fields;
+
+ /**
+ * Methods
+ */
+ private final Set<AnnotatedMethod<? super X>> methods;
+
+ private State()
+ {
+ Constructor<?>[] decCtxs =
+ getWebBeansContext().getSecurityService().doPrivilegedGetDeclaredConstructors(annotatedClass);
+
+ final Set<AnnotatedConstructor<X>> constructors = new HashSet<AnnotatedConstructor<X>>();
+ final Set<AnnotatedField<? super X>> fields = new HashSet<AnnotatedField<? super X>>();
+ final Set<AnnotatedMethod<? super X>> methods = new HashSet<AnnotatedMethod<? super X>>();
+
+ this.constructors = Collections.unmodifiableSet(constructors);
+ this.fields = Collections.unmodifiableSet(fields);
+ this.methods = Collections.unmodifiableSet(methods);
+
+ for (Constructor<?> ct : decCtxs)
+ {
+ if (!ct.isSynthetic())
+ {
+ AnnotatedConstructor<X> ac =
+ new AnnotatedConstructorImpl<X>(getWebBeansContext(), (Constructor<X>) ct,
+ AnnotatedTypeImpl.this);
+ constructors.add(ac);
+ }
+ }
+ if (constructors.isEmpty())
+ {
+ // must be implicit default constructor
+ Constructor<X> constructor =
+ getWebBeansContext().getSecurityService().doPrivilegedGetDeclaredConstructor(annotatedClass);
+ if (constructor != null)
+ {
+ constructors.add(
+ new AnnotatedConstructorImpl<X>(getWebBeansContext(), constructor, AnnotatedTypeImpl.this));
+ }
+ }
+
+ Field[] decFields = getWebBeansContext().getSecurityService().doPrivilegedGetDeclaredFields(annotatedClass);
+ Method[] decMethods =
+ getWebBeansContext().getSecurityService().doPrivilegedGetDeclaredMethods(annotatedClass);
+ for (Field f : decFields)
+ {
+ if (!f.isSynthetic())
+ {
+ AnnotatedField<X> af = new AnnotatedFieldImpl<X>(getWebBeansContext(), f, AnnotatedTypeImpl.this);
+ fields.add(af);
+ }
+ }
+
+ for (Method m : decMethods)
+ {
+ if (!m.isSynthetic() && !m.isBridge())
+ {
+ AnnotatedMethod<X> am = new AnnotatedMethodImpl<X>(getWebBeansContext(), m, AnnotatedTypeImpl.this);
+ methods.add(am);
+ }
+ }
+
+ if (supertype != null)
+ {
+ for (AnnotatedField<? super X> field: supertype.getFields())
+ {
+ fields.add(new AnnotatedFieldImpl<X>(getWebBeansContext(), field.getJavaMember(), AnnotatedTypeImpl.this));
+ }
+ for (AnnotatedMethod<? super X> method : supertype.getMethods())
+ {
+ if (!isOverridden(method))
+ {
+ methods.add(new AnnotatedMethodImpl<X>(getWebBeansContext(), method.getJavaMember(), AnnotatedTypeImpl.this));
+ }
+ }
+ }
+
+ }
+
+ private boolean isOverridden(AnnotatedMethod<? super X> superclassMethod)
+ {
+ for (AnnotatedMethod<? super X> subclassMethod : methods)
+ {
+ if (ClassUtil.isOverridden(subclassMethod.getJavaMember(), superclassMethod.getJavaMember()))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/BeanAttributesImpl.java.cdi-1.1 b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/BeanAttributesImpl.java.cdi-1.1
new file mode 100644
index 0000000..18c280d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/BeanAttributesImpl.java.cdi-1.1
@@ -0,0 +1,96 @@
+/*
+ * 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.webbeans.portable;
+
+import javax.enterprise.inject.spi.BeanAttributes;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+/**
+ * BeanAttributes are new in CDI-1.1. They represent all
+ * attributes of a Bean which can be changed via Extensions.
+ *
+ * @since 1.2.0
+ */
+public class BeanAttributesImpl<T> implements BeanAttributes<T>
+{
+ private Set<Type> types;
+ private Set<Class<? extends Annotation>> stereotypes;
+ private String name;
+ private Set<Annotation> qualifiers;
+ private Class<Annotation> scope;
+ private boolean isAlternative;
+
+ public BeanAttributesImpl(Set<Type> types, boolean alternative, String name, Set<Annotation> qualifiers,
+ Class<Annotation> scope, Set<Class<? extends Annotation>> stereotypes)
+ {
+ this.types = types;
+ isAlternative = alternative;
+ this.name = name;
+ this.qualifiers = qualifiers;
+ this.scope = scope;
+ this.stereotypes = stereotypes;
+ }
+
+ @Override
+ public String getName()
+ {
+ return name;
+ }
+
+ @Override
+ public Set<Type> getTypes()
+ {
+ return types;
+ }
+
+ @Override
+ public Set<Annotation> getQualifiers()
+ {
+ return qualifiers;
+ }
+
+ @Override
+ public Class<? extends Annotation> getScope()
+ {
+ return scope;
+ }
+
+ /**
+ * @deprecated makes no sense in CDI-1.1
+ */
+ @Override
+ public boolean isNullable()
+ {
+ return true;
+ }
+
+ @Override
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return stereotypes;
+ }
+
+ @Override
+ public boolean isAlternative()
+ {
+ return isAlternative;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/BeanManagerProducer.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/BeanManagerProducer.java
new file mode 100644
index 0000000..7a62aa3
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/BeanManagerProducer.java
@@ -0,0 +1,57 @@
+/*
+ * 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.webbeans.portable;
+
+import java.util.Map;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.Interceptor;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.InjectableBeanManager;
+import org.apache.webbeans.context.creational.CreationalContextImpl;
+
+public class BeanManagerProducer extends AbstractProducer<BeanManager>
+{
+
+ private WebBeansContext context;
+ private BeanManager manager;
+
+ public BeanManagerProducer(WebBeansContext webBeansContext)
+ {
+ context = webBeansContext;
+ }
+
+ @Override
+ protected BeanManager produce(Map<Interceptor<?>, ?> interceptors, CreationalContextImpl<BeanManager> creationalContext)
+ {
+ if (manager == null)
+ {
+ manager = new InjectableBeanManager(context.getBeanManagerImpl());
+ }
+
+ return manager;
+ }
+
+ @Override
+ public void dispose(BeanManager instance)
+ {
+ manager = null;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/BeanMetadataProducer.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/BeanMetadataProducer.java
new file mode 100644
index 0000000..dabd08f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/BeanMetadataProducer.java
@@ -0,0 +1,42 @@
+/*
+ * 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.webbeans.portable;
+
+import java.util.Map;
+
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.inject.spi.Interceptor;
+
+import org.apache.webbeans.context.creational.CreationalContextImpl;
+
+public class BeanMetadataProducer<T> extends AbstractProducer<Contextual<T>>
+{
+
+ @Override
+ protected Contextual<T> produce(Map<Interceptor<?>, ?> interceptors, CreationalContextImpl<Contextual<T>> creationalContext)
+ {
+ if (!(creationalContext instanceof CreationalContextImpl))
+ {
+ // TODO What to do here?
+ throw new IllegalStateException("MetadataProducer does work only with CreationalContextImpl");
+ }
+ CreationalContextImpl<T> contextImpl = (CreationalContextImpl<T>)creationalContext;
+ return contextImpl.getBean();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/ConversationProducer.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/ConversationProducer.java
new file mode 100644
index 0000000..d0c182b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/ConversationProducer.java
@@ -0,0 +1,80 @@
+/*
+ * 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.webbeans.portable;
+
+import java.util.Collections;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.creational.CreationalContextImpl;
+import org.apache.webbeans.conversation.ConversationImpl;
+import org.apache.webbeans.spi.ConversationService;
+
+public class ConversationProducer extends InjectionTargetImpl<ConversationImpl>
+{
+
+ private WebBeansContext webBeansContext;
+
+ public ConversationProducer(AnnotatedType<ConversationImpl> annotatedType, WebBeansContext webBeansContext)
+ {
+ super(annotatedType, Collections.<InjectionPoint>emptySet(), webBeansContext, null, null);
+ this.webBeansContext = webBeansContext;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected ConversationImpl newInstance(CreationalContextImpl<ConversationImpl> creationalContext)
+ {
+ ConversationImpl conversation = null;
+ //Gets conversation service
+ ConversationService conversationService = webBeansContext.getService(ConversationService.class);
+ //Gets conversation id
+ String conversationId = conversationService.getConversationId();
+ //Gets session id that conversation is created
+ String sessionId = conversationService.getConversationSessionId();
+
+ //If conversation id is not null, this means that
+ //conversation is propogated
+ if (conversationId != null)
+ {
+ //Gets propogated conversation
+ conversation = webBeansContext.getConversationManager().getPropogatedConversation(conversationId, sessionId);
+ }
+
+ if (conversation == null)
+ {
+ if(sessionId != null)
+ {
+ conversation = new ConversationImpl(conversationService.getConversationSessionId(), webBeansContext);
+ }
+ else
+ {
+ //Used in Tests
+ conversation = new ConversationImpl(webBeansContext);
+ }
+
+ }
+
+ return conversation;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/EventProducer.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/EventProducer.java
new file mode 100644
index 0000000..8c14fb7
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/EventProducer.java
@@ -0,0 +1,97 @@
+/*
+ * 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.webbeans.portable;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Map;
+
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.Interceptor;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.creational.CreationalContextImpl;
+import org.apache.webbeans.event.EventImpl;
+import org.apache.webbeans.exception.WebBeansException;
+
+public class EventProducer<T> extends AbstractProducer<Event<T>>
+{
+
+ private WebBeansContext webBeansContext;
+
+ public EventProducer(WebBeansContext webBeansContext)
+ {
+ this.webBeansContext = webBeansContext;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Event<T> produce(Map<Interceptor<?>, ?> interceptors, CreationalContextImpl<Event<T>> creationalContext)
+ {
+ Event<T> instance = null;
+ InjectionPoint injectionPoint = null;
+ //TODO What should we do here if creationalContext is not instanceof CreationalContextImpl?
+ if (creationalContext instanceof CreationalContextImpl)
+ {
+ injectionPoint = ((CreationalContextImpl<Event<T>>)creationalContext).getInjectionPoint();
+ }
+
+ Type eventType;
+
+ if(injectionPoint != null)
+ {
+ Type[] eventActualTypeArgs;
+ Type type = injectionPoint.getType();
+ ParameterizedType pt = (ParameterizedType) type;
+ eventActualTypeArgs = pt.getActualTypeArguments();
+
+ //First argument and sole argument is actual Event type
+ //Example : Event<MyEvent>
+ eventType = eventActualTypeArgs[0];
+
+ //Event qualifiers
+ Annotation[] qualifiers = new Annotation[injectionPoint.getQualifiers().size()];
+ qualifiers = injectionPoint.getQualifiers().toArray(qualifiers);
+
+ try
+ {
+ instance = new EventImpl<T>(qualifiers, eventType, injectionPoint, webBeansContext);
+ }
+ catch (Exception e)
+ {
+ throw new WebBeansException("Exception in creating Event implicit component for event type : "
+ + eventType);
+ }
+ finally
+ {
+ if (creationalContext instanceof CreationalContextImpl)
+ {
+ ((CreationalContextImpl<Event<T>>)creationalContext).removeInjectionPoint();
+ }
+ }
+
+ }
+
+ return instance;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/ExtensionProducer.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/ExtensionProducer.java
new file mode 100644
index 0000000..a862dc8
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/ExtensionProducer.java
@@ -0,0 +1,50 @@
+/*
+ * 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.webbeans.portable;
+
+import java.util.Map;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Interceptor;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.creational.CreationalContextImpl;
+import org.apache.webbeans.portable.events.ExtensionLoader;
+
+public class ExtensionProducer<R> extends AbstractProducer<R>
+{
+
+ private WebBeansContext webBeansContext;
+ public <T> ExtensionProducer(AnnotatedType<T> annotatedType,
+ Bean<T> owner,
+ WebBeansContext webBeansContext)
+ {
+ super(webBeansContext.getInjectionPointFactory().buildInjectionPoints(owner, annotatedType));
+ this.webBeansContext = webBeansContext;
+ }
+
+ @Override
+ protected R produce(Map<Interceptor<?>, ?> interceptors, CreationalContextImpl<R> creationalContext)
+ {
+ ExtensionLoader loader = webBeansContext.getExtensionLoader();
+
+ return loader.getBeanInstance((Bean<R>)((CreationalContextImpl<R>) creationalContext).getBean());
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionPointProducer.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionPointProducer.java
new file mode 100644
index 0000000..7995a65
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionPointProducer.java
@@ -0,0 +1,64 @@
+/*
+ * 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.webbeans.portable;
+
+import java.util.Map;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.Interceptor;
+
+import org.apache.webbeans.context.creational.CreationalContextImpl;
+import org.apache.webbeans.util.ClassUtil;
+
+public class InjectionPointProducer extends AbstractProducer<InjectionPoint>
+{
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected InjectionPoint produce(Map<Interceptor<?>, ?> interceptors, CreationalContextImpl<InjectionPoint> creationalContext)
+ {
+ if (!(creationalContext instanceof CreationalContextImpl))
+ {
+ return null;
+ }
+ // the first injection point on the stack is of type InjectionPoint, so we need the second one
+ CreationalContextImpl<InjectionPoint> creationalContextImpl = (CreationalContextImpl<InjectionPoint>)creationalContext;
+ InjectionPoint first = creationalContextImpl.removeInjectionPoint();
+ if (!InjectionPoint.class.isAssignableFrom(ClassUtil.getClass(first.getType())))
+ {
+ throw new IllegalStateException("Inconsistent injection point stack");
+ }
+ try
+ {
+ return creationalContextImpl.getInjectionPoint();
+ }
+ finally
+ {
+ creationalContextImpl.putInjectionPoint(first);
+ }
+ }
+
+ @Override
+ public void dispose(InjectionPoint ip)
+ {
+ // nothing to do
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionTargetImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionTargetImpl.java
new file mode 100644
index 0000000..7b82689
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionTargetImpl.java
@@ -0,0 +1,446 @@
+/*
+ * 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.webbeans.portable;
+
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.creational.CreationalContextImpl;
+import org.apache.webbeans.exception.WebBeansCreationException;
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.inject.InjectableConstructor;
+import org.apache.webbeans.inject.InjectableField;
+import org.apache.webbeans.inject.InjectableMethod;
+import org.apache.webbeans.intercept.DefaultInterceptorHandler;
+import org.apache.webbeans.intercept.InterceptorInvocationContext;
+import org.apache.webbeans.intercept.InterceptorResolutionService.BeanInterceptorInfo;
+import org.apache.webbeans.intercept.LifecycleInterceptorInvocationContext;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.proxy.InterceptorDecoratorProxyFactory;
+import org.apache.webbeans.proxy.InterceptorHandler;
+import org.apache.webbeans.proxy.OwbInterceptorProxy;
+import org.apache.webbeans.spi.ResourceInjectionService;
+import org.apache.webbeans.util.Asserts;
+import org.apache.webbeans.util.CDI11s;
+import org.apache.webbeans.util.ExceptionUtil;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.enterprise.inject.spi.InterceptionType;
+import javax.enterprise.inject.spi.Interceptor;
+import javax.inject.Inject;
+import javax.interceptor.InvocationContext;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class InjectionTargetImpl<T> extends AbstractProducer<T> implements InjectionTarget<T>
+{
+
+ protected final WebBeansContext webBeansContext;
+
+ protected final AnnotatedType<T> annotatedType;
+ protected volatile AnnotatedConstructor<T> constructor;
+
+ /**
+ * If the InjectionTarget has a @PostConstruct method, <code>null</code> if not.
+ * This methods only gets used if the produced instance is not intercepted.
+ * This methods must have the signature <code>void METHOD();</code>
+ * They are ordered as <b>superclass first</b>.
+ */
+ private List<AnnotatedMethod<?>> postConstructMethods;
+
+ /**
+ * Interceptors which should get triggered for @PostConstruct.
+ * Ordered in parent-class first
+ */
+ private List<Interceptor<?>> postConstructInterceptors;
+
+ /**
+ * If the InjectionTarget has a @PreDestroy method, <code>null</code> if not.
+ * This methods only gets used if the produced instance is not intercepted.
+ * This methods must have the signature <code>void METHOD();</code>
+ * They are ordered as <b>subclass first</b>.
+ */
+ private List<AnnotatedMethod<?>> preDestroyMethods;
+
+ /**
+ * Interceptors which should get triggered for @PreDestroy.
+ * Ordered in sub-class first
+ */
+ private List<Interceptor<?>> preDestroyInterceptors;
+
+ private List<Interceptor<?>> aroundConstructInterceptors;
+
+ public InjectionTargetImpl(AnnotatedType<T> annotatedType, Set<InjectionPoint> points, WebBeansContext webBeansContext,
+ List<AnnotatedMethod<?>> postConstructMethods, List<AnnotatedMethod<?>> preDestroyMethods)
+ {
+ super(points);
+ Asserts.assertNotNull(annotatedType);
+ Asserts.assertNotNull(webBeansContext);
+ this.annotatedType = annotatedType;
+ this.webBeansContext = webBeansContext;
+ this.postConstructMethods = postConstructMethods;
+ this.preDestroyMethods = preDestroyMethods;
+ }
+
+ @Override
+ protected void defineLifecycleInterceptors(Bean<T> bean, AnnotatedType<T> annotatedType, WebBeansContext webBeansContext)
+ {
+ BeanInterceptorInfo interceptorInfo = getInterceptorInfo();
+
+ postConstructInterceptors
+ = getLifecycleInterceptors(interceptorInfo.getEjbInterceptors(), interceptorInfo.getCdiInterceptors(), InterceptionType.POST_CONSTRUCT);
+
+ preDestroyInterceptors
+ = getLifecycleInterceptors(interceptorInfo.getEjbInterceptors(), interceptorInfo.getCdiInterceptors(), InterceptionType.PRE_DESTROY);
+
+ if (CDI11s.AROUND_CONSTRUCT != null)
+ {
+ aroundConstructInterceptors = getLifecycleInterceptors(interceptorInfo.getEjbInterceptors(), interceptorInfo.getCdiInterceptors(), CDI11s.AROUND_CONSTRUCT);
+ }
+ else
+ {
+ aroundConstructInterceptors = new ArrayList<Interceptor<?>>();
+ }
+ }
+
+ @Override
+ public T produce(Map<Interceptor<?>, ?> interceptorInstances, CreationalContextImpl<T> creationalContext)
+ {
+ if (hasAroundConstruct())
+ {
+ try
+ {
+ final Constructor<T> cons = getConstructor().getJavaMember();
+ final InjectableConstructor<T> injectableConstructor = new InjectableConstructor<T>(cons, this, creationalContext);
+ return (T)new InterceptorInvocationContext<T>(null, CDI11s.AROUND_CONSTRUCT, aroundConstructInterceptors, interceptorInstances,
+ cons, injectableConstructor.createParameters()).proceed();
+ }
+ catch (final Exception e) // CDI 1.0
+ {
+ throw ExceptionUtil.throwAsRuntimeException(e);
+ }
+ }
+ else
+ {
+ return newInstance(creationalContext);
+ }
+ }
+
+ @Override
+ protected boolean needsProxy()
+ {
+ return super.needsProxy() || postConstructInterceptors.size() != 0 || preDestroyInterceptors.size() != 0;
+ }
+
+ protected boolean hasAroundConstruct()
+ {
+ return aroundConstructInterceptors != null && !aroundConstructInterceptors.isEmpty();
+ }
+
+ protected T newInstance(CreationalContextImpl<T> creationalContext)
+ {
+ return new InjectableConstructor<T>(getConstructor().getJavaMember(), this, creationalContext).doInjection();
+ }
+
+ @Override
+ public void inject(T instance, CreationalContext<T> context)
+ {
+ inject(instance.getClass(), unwrapProxyInstance(instance), (CreationalContextImpl<T>) context);
+ }
+
+ private void inject(Class<?> type, final T instance, CreationalContextImpl<T> context)
+ {
+ if (type == null || type.equals(Object.class))
+ {
+ return;
+ }
+ inject(type.getSuperclass(), instance, context);
+ injectFields(type, instance, context);
+ injectMethods(type, instance, context);
+ injectInitializerMethods(type, instance, context);
+ injectResources(instance);
+ }
+
+ private void injectFields(Class<?> type, T instance, CreationalContextImpl<T> context)
+ {
+ for (InjectionPoint injectionPoint : getInjectionPoints())
+ {
+ if (injectionPoint.getMember().getDeclaringClass().equals(type))
+ {
+ if (injectionPoint.getMember() instanceof Field)
+ {
+ new InjectableField<T>((Field) injectionPoint.getMember(), instance, this, context).doInjection();
+ }
+ }
+ }
+ }
+
+ private void injectMethods(Class<?> type, T instance, CreationalContextImpl<T> context)
+ {
+ Set<Member> injectedMethods = new HashSet<Member>();
+ for (InjectionPoint injectionPoint : getInjectionPoints())
+ {
+ if (injectionPoint.getMember().getDeclaringClass().equals(type))
+ {
+ if (injectionPoint.getMember() instanceof Method
+ && !injectedMethods.contains(injectionPoint.getMember())
+ && !isProducerMethod(injectionPoint)
+ && !isDisposalMethod(injectionPoint)
+ && !isObserverMethod(injectionPoint))
+ {
+ new InjectableMethod<T>((Method) injectionPoint.getMember(), instance, this, context).doInjection();
+ injectedMethods.add(injectionPoint.getMember());
+ }
+ }
+ }
+ }
+
+ /**
+ * Performs injection on initializer methods, which are methods that are annotated with @Inject,
+ * but have no parameter and thus no injection point.
+ */
+ private void injectInitializerMethods(Class<?> declaringType, T instance, CreationalContextImpl<T> context)
+ {
+ for (AnnotatedMethod<? super T> method : annotatedType.getMethods())
+ {
+ if (method.getDeclaringType().getJavaClass().equals(declaringType) && method.isAnnotationPresent(Inject.class) && method.getParameters().isEmpty())
+ {
+ new InjectableMethod<T>(method.getJavaMember(), instance, this, context).doInjection();
+ }
+ }
+ }
+
+ private void injectResources(T instance)
+ {
+ try
+ {
+ ResourceInjectionService service = null;
+ try
+ {
+ service = webBeansContext.getService(ResourceInjectionService.class);
+
+ }
+ catch (Exception e)
+ {
+ // When running in tests
+ }
+
+ if (service != null)
+ {
+ service.injectJavaEEResources(instance);
+ }
+ }
+ catch (Exception e)
+ {
+ throw new WebBeansException(MessageFormat.format(
+ WebBeansLoggerFacade.getTokenString(OWBLogConst.ERROR_0023), instance), e);
+ }
+ }
+
+ @Override
+ public void postConstruct(final T instance)
+ {
+ Map<Interceptor<?>, ?> interceptorInstances = null;
+ T internalInstance = instance;
+
+ if (getInterceptorInfo() != null && instance instanceof OwbInterceptorProxy)
+ {
+ InterceptorHandler ih = getProxyFactory().getInterceptorHandler((OwbInterceptorProxy) instance);
+ if (ih instanceof DefaultInterceptorHandler)
+ {
+ DefaultInterceptorHandler dih = (DefaultInterceptorHandler) ih;
+ interceptorInstances = dih.getInstances();
+ internalInstance = (T) dih.getTarget();
+ }
+ }
+ else if (postConstructMethods == null || postConstructMethods.size() == 0)
+ {
+ return;
+ }
+
+ InvocationContext ic = new LifecycleInterceptorInvocationContext<T>(internalInstance, InterceptionType.POST_CONSTRUCT, postConstructInterceptors,
+ interceptorInstances, postConstructMethods);
+ try
+ {
+ ic.proceed();
+ }
+ catch (Exception e)
+ {
+ throw ExceptionUtil.throwAsRuntimeException(e);
+ }
+ }
+
+ @Override
+ public void preDestroy(T instance)
+ {
+ Map<Interceptor<?>, ?> interceptorInstances = null;
+ T internalInstance = instance;
+
+ if (getInterceptorInfo() != null && instance instanceof OwbInterceptorProxy)
+ {
+ InterceptorDecoratorProxyFactory pf = webBeansContext.getInterceptorDecoratorProxyFactory();
+ InterceptorHandler ih = pf.getInterceptorHandler((OwbInterceptorProxy) instance);
+ if (ih instanceof DefaultInterceptorHandler)
+ {
+ DefaultInterceptorHandler dih = (DefaultInterceptorHandler) ih;
+ interceptorInstances = dih.getInstances();
+ internalInstance = (T) dih.getTarget();
+ }
+ }
+ else if (preDestroyMethods == null || preDestroyMethods.size() == 0)
+ {
+ return;
+ }
+
+ InvocationContext ic = new LifecycleInterceptorInvocationContext<T>(internalInstance, InterceptionType.PRE_DESTROY, preDestroyInterceptors,
+ interceptorInstances, preDestroyMethods);
+ try
+ {
+ ic.proceed();
+ }
+ catch (Exception e)
+ {
+ ExceptionUtil.throwAsRuntimeException(e);
+ }
+ }
+
+ protected AnnotatedConstructor<T> getConstructor()
+ {
+ if (constructor == null)
+ {
+ constructor = createConstructor();
+ }
+ return constructor;
+ }
+
+ protected AnnotatedConstructor<T> createConstructor()
+ {
+ AnnotatedConstructor<T> constructor = null;
+ for (InjectionPoint injectionPoint : getInjectionPoints())
+ {
+ if (injectionPoint.getMember() instanceof Constructor)
+ {
+ if (constructor == null)
+ {
+ constructor = (AnnotatedConstructor<T>)((AnnotatedParameter<T>)injectionPoint.getAnnotated()).getDeclaringCallable();
+ return constructor;
+ }
+ }
+ }
+
+ final Constructor<T> defaultConstructor = getDefaultConstructor();
+ if (defaultConstructor == null)
+ {
+ throw new WebBeansCreationException("No default constructor for " + annotatedType.getJavaClass().getName());
+ }
+ return new AnnotatedConstructorImpl<T>(webBeansContext, defaultConstructor, annotatedType);
+ }
+
+ private Constructor<T> getDefaultConstructor()
+ {
+ return webBeansContext.getWebBeansUtil().getNoArgConstructor(annotatedType.getJavaClass());
+ }
+
+ private boolean isProducerMethod(InjectionPoint injectionPoint)
+ {
+ return ((AnnotatedElement)injectionPoint.getMember()).isAnnotationPresent(Produces.class);
+ }
+
+ private boolean isObserverMethod(InjectionPoint injectionPoint)
+ {
+ if (!(injectionPoint.getMember() instanceof Method))
+ {
+ return false;
+ }
+ Method method = (Method) injectionPoint.getMember();
+ for (Annotation[] annotations : method.getParameterAnnotations())
+ {
+ for (Annotation annotation : annotations)
+ {
+ if (annotation.annotationType().equals(Observes.class))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean isDisposalMethod(InjectionPoint injectionPoint)
+ {
+ if (!(injectionPoint.getMember() instanceof Method))
+ {
+ return false;
+ }
+ Method method = (Method) injectionPoint.getMember();
+ for (Annotation[] annotations : method.getParameterAnnotations())
+ {
+ for (Annotation annotation : annotations)
+ {
+ if (annotation.annotationType().equals(Disposes.class))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private List<Interceptor<?>> getLifecycleInterceptors(LinkedHashSet<Interceptor<?>> ejbInterceptors, List<Interceptor<?>> cdiInterceptors, InterceptionType interceptionType)
+ {
+ List<Interceptor<?>> lifecycleInterceptors = new ArrayList<Interceptor<?>>();
+
+ for (Interceptor<?> ejbInterceptor : ejbInterceptors)
+ {
+ if (ejbInterceptor.intercepts(interceptionType))
+ {
+ lifecycleInterceptors.add(ejbInterceptor);
+ }
+ }
+ for (Interceptor<?> cdiInterceptor : cdiInterceptors)
+ {
+ if (cdiInterceptor.intercepts(interceptionType))
+ {
+ lifecycleInterceptors.add(cdiInterceptor);
+ }
+ }
+
+ return lifecycleInterceptors;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/InstanceProducer.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/InstanceProducer.java
new file mode 100644
index 0000000..b9e3c49
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/InstanceProducer.java
@@ -0,0 +1,91 @@
+/*
+ * 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.webbeans.portable;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Map;
+import java.util.Set;
+
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.Interceptor;
+
+import org.apache.webbeans.component.InstanceBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.creational.CreationalContextImpl;
+import org.apache.webbeans.inject.instance.InstanceImpl;
+
+public class InstanceProducer<T> extends AbstractProducer<Instance<T>>
+{
+ private Class<Instance<T>> returnType;
+ private Set<Annotation> qualifiers;
+ private WebBeansContext webBeansContext;
+
+ public InstanceProducer(Class<Instance<T>> returnType, Set<Annotation> qualifiers, WebBeansContext webBeansContext)
+ {
+ this.returnType = returnType;
+ this.qualifiers = qualifiers;
+ this.webBeansContext = webBeansContext;
+ }
+
+ @Override
+ protected Instance<T> produce(Map<Interceptor<?>, ?> interceptors, CreationalContextImpl<Instance<T>> creationalContext)
+ {
+ CreationalContextImpl<Instance<T>> creationalContextImpl = null;
+ try
+ {
+ InjectionPoint injectionPoint = null;
+ if (creationalContext instanceof CreationalContextImpl)
+ {
+ creationalContextImpl = (CreationalContextImpl<Instance<T>>)creationalContext;
+ }
+ else
+ {
+ InstanceBean<Object> instanceBean = webBeansContext.getWebBeansUtil().getInstanceBean();
+ creationalContextImpl = webBeansContext.getCreationalContextFactory().wrappedCreationalContext(creationalContext, instanceBean);
+ }
+ injectionPoint = creationalContextImpl.getInjectionPoint();
+ Set<Annotation> qualifiers;
+ Type type;
+
+ if (injectionPoint != null)
+ {
+ ParameterizedType injectedType = (ParameterizedType)injectionPoint.getType();
+ qualifiers = injectionPoint.getQualifiers();
+ type = injectedType.getActualTypeArguments()[0];
+ }
+ else
+ {
+ qualifiers = this.qualifiers;
+ type = returnType;
+ }
+
+ return new InstanceImpl<T>(type, injectionPoint, webBeansContext, creationalContextImpl, qualifiers.toArray(new Annotation[qualifiers.size()]));
+ }
+ finally
+ {
+ if (creationalContextImpl != null)
+ {
+ creationalContextImpl.removeInjectionPoint();
+ }
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/MetadataProducer.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/MetadataProducer.java
new file mode 100644
index 0000000..2330e79
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/MetadataProducer.java
@@ -0,0 +1,42 @@
+/*
+ * 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.webbeans.portable;
+
+import java.util.Map;
+
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.inject.spi.Interceptor;
+
+import org.apache.webbeans.context.creational.CreationalContextImpl;
+
+public class MetadataProducer<T> extends AbstractProducer<Contextual<T>>
+{
+
+ @Override
+ protected Contextual<T> produce(Map<Interceptor<?>, ?> interceptors, CreationalContextImpl<Contextual<T>> creationalContext)
+ {
+ if (!(creationalContext instanceof CreationalContextImpl))
+ {
+ // TODO What to do here?
+ throw new IllegalStateException("MetadataProducer does work only with CreationalContextImpl");
+ }
+ CreationalContextImpl<T> contextImpl = (CreationalContextImpl<T>)creationalContext;
+ return contextImpl.getContextual();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/ProducerFieldProducer.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/ProducerFieldProducer.java
new file mode 100644
index 0000000..b1dd76a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/ProducerFieldProducer.java
@@ -0,0 +1,122 @@
+/*
+ * 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.webbeans.portable;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.Collections;
+import java.util.Map;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.Interceptor;
+
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.creational.CreationalContextImpl;
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.util.Asserts;
+import org.apache.webbeans.util.WebBeansUtil;
+
+public class ProducerFieldProducer<T, P> extends AbstractProducer<T>
+{
+
+ private Bean<P> owner;
+ private WebBeansContext webBeansContext;
+ private AnnotatedField<? super P> producerField;
+
+ public ProducerFieldProducer(Bean<P> owner, AnnotatedField<? super P> producerField, WebBeansContext context)
+ {
+ super(Collections.<InjectionPoint>emptySet());
+ Asserts.assertNotNull(owner, "owner may not be null");
+ Asserts.assertNotNull(producerField, "field may not be null");
+ Asserts.assertNotNull(context, "WebBeansContext may not be null");
+ this.owner = owner;
+ webBeansContext = context;
+ this.producerField = producerField;
+ }
+
+ @Override
+ protected T produce(Map<Interceptor<?>, ?> interceptors, CreationalContextImpl<T> creationalContext)
+ {
+ T instance = null;
+ P parentInstance = null;
+ CreationalContext<P> parentCreational = null;
+ try
+ {
+ parentCreational = webBeansContext.getBeanManagerImpl().createCreationalContext(owner);
+
+ Field field = producerField.getJavaMember();
+ if (!field.isAccessible())
+ {
+ webBeansContext.getSecurityService().doPrivilegedSetAccessible(field, true);
+ }
+
+ if (Modifier.isStatic(field.getModifiers()))
+ {
+ instance = (T) field.get(null);
+ }
+ else
+ {
+ parentInstance = getParentInstanceFromContext(parentCreational);
+
+ instance = (T) field.get(parentInstance);
+ }
+ }
+ catch(Exception e)
+ {
+ throw new WebBeansException(e);
+ }
+ finally
+ {
+ if (owner.getScope().equals(Dependent.class))
+ {
+ owner.destroy(parentInstance, parentCreational);
+ }
+ }
+
+ return instance;
+
+ }
+
+ @SuppressWarnings("unchecked")
+ protected P getParentInstanceFromContext(CreationalContext<?> creationalContext)
+ {
+ P parentInstance;
+
+ Bean<?> specialize = WebBeansUtil.getMostSpecializedBean(webBeansContext.getBeanManagerImpl(), (AbstractOwbBean<T>) owner);
+
+ if (specialize != null)
+ {
+ parentInstance = (P) webBeansContext.getBeanManagerImpl().getContext(specialize.getScope()).
+ get((Bean<Object>)specialize,(CreationalContext<Object>) creationalContext);
+ }
+ else
+ {
+ parentInstance = (P) webBeansContext.getBeanManagerImpl().getContext(
+ owner.getScope()).get((Bean<Object>)owner, (CreationalContext<Object>) creationalContext);
+ }
+
+ return parentInstance;
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/ProducerMethodProducer.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/ProducerMethodProducer.java
new file mode 100644
index 0000000..fd8d5d4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/ProducerMethodProducer.java
@@ -0,0 +1,152 @@
+/*
+ * 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.webbeans.portable;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Map;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.Interceptor;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.creational.CreationalContextImpl;
+import org.apache.webbeans.inject.InjectableMethod;
+import org.apache.webbeans.spi.plugins.OpenWebBeansEjbPlugin;
+import org.apache.webbeans.util.Asserts;
+
+/**
+ * A {@link javax.enterprise.inject.spi.Producer} for producer-method beans.
+ */
+public class ProducerMethodProducer<T, P> extends AbstractProducer<T>
+{
+
+ private Bean<P> owner;
+ private WebBeansContext webBeansContext;
+ private Method producerMethod;
+ private Method disposalMethod;
+ private Set<InjectionPoint> disposalIPs;
+
+ public ProducerMethodProducer(Bean<P> owner,
+ AnnotatedMethod<? super P> producerMethod,
+ AnnotatedMethod<? super P> disposerMethod,
+ Set<InjectionPoint> points,
+ Set<InjectionPoint> disposalIPs,
+ WebBeansContext webBeansContext)
+ {
+ super(points);
+ Asserts.assertNotNull(owner, "owner may not be null");
+ Asserts.assertNotNull(producerMethod, "method may not be null");
+ Asserts.assertNotNull(webBeansContext, "WebBeansContext may not be null");
+ if (!producerMethod.isStatic())
+ {
+ Asserts.assertNotNull(owner, "owner may not be null for non-static producer method");
+ }
+ this.owner = owner;
+ this.webBeansContext = webBeansContext;
+ this.disposalIPs = disposalIPs;
+
+ final OpenWebBeansEjbPlugin ejbPlugin = webBeansContext.getPluginLoader().getEjbPlugin();
+ if (ejbPlugin != null)
+ {
+ this.producerMethod = ejbPlugin.resolveViewMethod(owner, producerMethod.getJavaMember());
+ if (disposerMethod != null)
+ {
+ disposalMethod = ejbPlugin.resolveViewMethod(owner, disposerMethod.getJavaMember());
+ }
+ }
+ else
+ {
+ this.producerMethod = producerMethod.getJavaMember();
+ if (disposerMethod != null)
+ {
+ disposalMethod = disposerMethod.getJavaMember();
+ }
+ }
+ }
+
+ public void specializeBy(Bean<P> bean)
+ {
+ owner = bean;
+ }
+
+ @Override
+ protected T produce(Map<Interceptor<?>, ?> interceptors, CreationalContextImpl<T> creationalContext)
+ {
+ P parentInstance = null;
+ CreationalContext<P> parentCreationalContext = null;
+ InjectableMethod<T> m;
+ try
+ {
+ parentCreationalContext = webBeansContext.getBeanManagerImpl().createCreationalContext(owner);
+
+ if (!Modifier.isStatic(producerMethod.getModifiers()))
+ {
+ parentInstance = (P)webBeansContext.getBeanManagerImpl().getReference(owner, owner.getBeanClass(), parentCreationalContext);
+ }
+
+ m = new InjectableMethod<T>(producerMethod, parentInstance, this, (CreationalContextImpl<T>) creationalContext);
+
+ return m.doInjection();
+
+ }
+ finally
+ {
+ if (parentCreationalContext != null)
+ {
+ parentCreationalContext.release();
+ }
+ }
+ }
+
+ @Override
+ public void dispose(T instance)
+ {
+ if (disposalMethod != null)
+ {
+ P parentInstance = null;
+ CreationalContext<P> parentCreationalContext = null;
+ InjectableMethod<T> m;
+ try
+ {
+ parentCreationalContext = webBeansContext.getBeanManagerImpl().createCreationalContext(owner);
+
+ if (!Modifier.isStatic(disposalMethod.getModifiers()))
+ {
+ parentInstance = (P)webBeansContext.getBeanManagerImpl().getReference(owner, owner.getBeanClass(), parentCreationalContext);
+ }
+
+ m = new InjectableMethod<T>(disposalMethod, parentInstance, this, (CreationalContextImpl<T>) parentCreationalContext, disposalIPs);
+ m.setDisposable(true);
+ m.setProducerMethodInstance(instance);
+
+ m.doInjection();
+
+ }
+ finally
+ {
+ parentCreationalContext.release();
+ }
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/ProviderBasedProducer.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/ProviderBasedProducer.java
new file mode 100644
index 0000000..888fed4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/ProviderBasedProducer.java
@@ -0,0 +1,71 @@
+/*
+ * 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.webbeans.portable;
+
+import java.util.Map;
+
+import javax.enterprise.inject.spi.Interceptor;
+import javax.inject.Provider;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.creational.CreationalContextImpl;
+import org.apache.webbeans.proxy.NormalScopeProxyFactory;
+import org.apache.webbeans.util.WebBeansUtil;
+
+public class ProviderBasedProducer<T> extends AbstractProducer<T>
+{
+
+ private WebBeansContext webBeansContext;
+ private Class<T> returnType;
+ private Provider<T> provider;
+ private T proxyInstance;
+ private boolean proxy;
+
+ public ProviderBasedProducer(WebBeansContext webBeansContext, Class<T> returnType, Provider<T> provider, boolean proxy)
+ {
+ this.webBeansContext = webBeansContext;
+ this.returnType = returnType;
+ this.provider = provider;
+ this.proxy = proxy;
+ }
+
+ @Override
+ protected T produce(Map<Interceptor<?>, ?> interceptors, CreationalContextImpl<T> creationalContext)
+ {
+ if (proxyInstance == null)
+ {
+ if (proxy)
+ {
+ NormalScopeProxyFactory proxyFactory = webBeansContext.getNormalScopeProxyFactory();
+ ClassLoader loader = returnType.getClassLoader();
+ if (loader == null)
+ {
+ loader = WebBeansUtil.getCurrentClassLoader();
+ }
+ Class<T> proxyClass = proxyFactory.createProxyClass(loader, returnType);
+ proxyInstance = proxyFactory.createProxyInstance(proxyClass, provider);
+ }
+ else
+ {
+ proxyInstance = provider.get();
+ }
+ }
+ return proxyInstance;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/ProviderBasedProducerFactory.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/ProviderBasedProducerFactory.java
new file mode 100644
index 0000000..b7c4c47
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/ProviderBasedProducerFactory.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Producer;
+import javax.inject.Provider;
+
+import org.apache.webbeans.component.spi.ProducerFactory;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.util.Asserts;
+
+public class ProviderBasedProducerFactory<P> implements ProducerFactory<P>
+{
+
+ private Provider<?> provider;
+ private Class<?> providerType;
+ private WebBeansContext webBeansContext;
+ private boolean proxy;
+
+ public ProviderBasedProducerFactory(boolean proxy, Provider<?> provider, Class<?> providerType, WebBeansContext context)
+ {
+ Asserts.assertNotNull(provider);
+ Asserts.assertNotNull(providerType);
+ Asserts.assertNotNull(context);
+ this.provider = provider;
+ this.providerType = providerType;
+ webBeansContext = context;
+ this.proxy = proxy;
+ }
+
+ @Override
+ public <T> Producer<T> createProducer(Bean<T> bean)
+ {
+ return new ProviderBasedProducer<T>(webBeansContext, (Class<T>)providerType, (Provider<T>)provider, proxy);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ExtensionLoader.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ExtensionLoader.java
new file mode 100644
index 0000000..da51ba8
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ExtensionLoader.java
@@ -0,0 +1,135 @@
+/*
+ * 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.webbeans.portable.events;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Extension;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.util.Asserts;
+import org.apache.webbeans.util.WebBeansUtil;
+
+/**
+ * Loads META-INF/services/javax.enterprise.inject.spi.Extension
+ * services.
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public class ExtensionLoader
+{
+ /**Map of extensions*/
+ private final Map<Bean<?>, Object> extensions = new ConcurrentHashMap<Bean<?>, Object>();
+ private final Set<Class<? extends Extension>> extensionClasses = new HashSet<Class<? extends Extension>>();
+ private final BeanManagerImpl manager;
+
+ private final WebBeansContext webBeansContext;
+
+ /**
+ * Creates a new loader instance.
+ * @param webBeansContext
+ */
+ public ExtensionLoader(WebBeansContext webBeansContext)
+ {
+
+ this.webBeansContext = webBeansContext;
+ manager = this.webBeansContext.getBeanManagerImpl();
+ }
+
+ /**
+ * Load extension services.
+ */
+ public void loadExtensionServices()
+ {
+ loadExtensionServices(WebBeansUtil.getCurrentClassLoader());
+ }
+
+ /**
+ * Load extension services.
+ * @param classLoader
+ */
+ public void loadExtensionServices(ClassLoader classLoader)
+ {
+ List<Extension> loader = webBeansContext.getLoaderService().load(Extension.class, classLoader);
+ for (Extension extension : loader)
+ {
+ if (!extensionClasses.contains(extension.getClass()))
+ {
+ extensionClasses.add(extension.getClass());
+ try
+ {
+ addExtension(extension);
+ }
+ catch (Exception e)
+ {
+ throw new WebBeansException("Error occurred while reading Extension service list", e);
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns service bean instance.
+ *
+ * @param bean service bean
+ * @return service bean instance
+ */
+ @SuppressWarnings("unchecked")
+ public <T> T getBeanInstance(Bean<T> bean)
+ {
+ Asserts.assertNotNull(bean,"bean parameter cannot be null");
+
+ if(extensions.containsKey(bean))
+ {
+ return (T) extensions.get(bean);
+ }
+
+ return null;
+ }
+
+
+ /**
+ * Add a CDI Extension to our internal list.
+ * @param ext Extension to add
+ */
+ public void addExtension(Extension ext)
+ {
+ Bean<?> bean = webBeansContext.getWebBeansUtil().createExtensionComponent(ext.getClass());
+ extensions.put(bean, ext);
+
+ manager.addBean(bean);
+ }
+
+ /**
+ * Clear service list.
+ */
+ public void clear()
+ {
+ extensions.clear();
+ extensionClasses.clear();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessAnnotatedTypeImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessAnnotatedTypeImpl.java
new file mode 100644
index 0000000..217037d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessAnnotatedTypeImpl.java
@@ -0,0 +1,104 @@
+/*
+ * 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.webbeans.portable.events;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+
+/**
+ * Default implementation of the {@link ProcessAnnotatedType}.
+ *
+ * @version $Rev$ $Date$
+ *
+ * @param <X> bean class info
+ */
+public class ProcessAnnotatedTypeImpl<X> implements ProcessAnnotatedType<X>
+{
+ /**Annotated Type*/
+ private AnnotatedType<X> annotatedType = null;
+
+ /**veto or not*/
+ private boolean veto = false;
+
+ /**
+ * This field gets set to <code>true</code> when a custom AnnotatedType
+ * got set in an Extension. In this case we must now take this modified
+ * AnnotatedType for our further processing!
+ */
+ private boolean modifiedAnnotatedType = false;
+
+ /**
+ * Creates a new instance with the given annotated type.
+ *
+ * @param annotatedType annotated type
+ */
+ public ProcessAnnotatedTypeImpl(AnnotatedType<X> annotatedType)
+ {
+ this.annotatedType = annotatedType;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public AnnotatedType<X> getAnnotatedType()
+ {
+ return annotatedType;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setAnnotatedType(AnnotatedType<X> type)
+ {
+ annotatedType = type;
+ modifiedAnnotatedType = true;
+ }
+
+ /**
+ * Returns sets or not.
+ *
+ * @return set or not
+ */
+ public boolean isModifiedAnnotatedType()
+ {
+ return modifiedAnnotatedType;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void veto()
+ {
+ veto = true;
+ }
+
+ /**
+ * Returns veto status.
+ *
+ * @return veto status
+ */
+ public boolean isVeto()
+ {
+ return veto;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessBeanImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessBeanImpl.java
new file mode 100644
index 0000000..21930b0
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessBeanImpl.java
@@ -0,0 +1,75 @@
+/*
+ * 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.webbeans.portable.events;
+
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.ProcessBean;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+/**
+ * Implementation of the {@link ProcessBean}.
+ *
+ * @version $Rev$ $Date$
+ *
+ * @param <X> bean class info
+ */
+public class ProcessBeanImpl<X> implements ProcessBean<X>
+{
+ /**Annotated instance. Can be AnnotatedType, AnnotatedMethod or AnnotatedField*/
+ private final Annotated annotated;
+
+ /**ManagedBean, SessionBean, ProducerMethodBean, ProducerFieldBean*/
+ private final Bean<X> bean;
+
+ protected ProcessBeanImpl(Bean<X> bean, Annotated annotated)
+ {
+ this.bean = bean;
+ this.annotated = annotated;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void addDefinitionError(Throwable t)
+ {
+ WebBeansContext.getInstance().getBeanManagerImpl().getErrorStack().pushError(t);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Annotated getAnnotated()
+ {
+ return annotated;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Bean<X> getBean()
+ {
+ return bean;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessInjectionTargetImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessInjectionTargetImpl.java
new file mode 100644
index 0000000..b9718bd
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessInjectionTargetImpl.java
@@ -0,0 +1,95 @@
+/*
+ * 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.webbeans.portable.events;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.enterprise.inject.spi.ProcessInjectionTarget;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+/**
+ * Implementation of the {@link ProcessInjectionTarget}.
+ *
+ * @version $Rev$ $Date$
+ *
+ * @param <X> bean class info
+ */
+public class ProcessInjectionTargetImpl<X> implements ProcessInjectionTarget<X>
+{
+ /**Annotated type instance that is used by container to read meta-data*/
+ private final AnnotatedType<X> annotatedType;
+
+ /**Injection target that is used by container to inject dependencies*/
+ private InjectionTarget<X> injectionTarget = null;
+
+ /**Injection target is set or not*/
+ private boolean set = false;
+
+ /**
+ * Creates a new instance.
+ *
+ * @param injectionTarget injection target
+ */
+ public ProcessInjectionTargetImpl(InjectionTarget<X> injectionTarget, AnnotatedType<X> annotatedType)
+ {
+ this.injectionTarget = injectionTarget;
+ this.annotatedType = annotatedType;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void addDefinitionError(Throwable t)
+ {
+ WebBeansContext.getInstance().getBeanManagerImpl().getErrorStack().pushError(t);
+ }
+
+ public AnnotatedType<X> getAnnotatedType()
+ {
+ return annotatedType;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public InjectionTarget<X> getInjectionTarget()
+ {
+ return injectionTarget;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setInjectionTarget(InjectionTarget<X> injectionTarget)
+ {
+ this.injectionTarget = injectionTarget;
+ set = true;
+ }
+
+ /**
+ * Returns whether or not injection target is set or not.
+ *
+ * @return whether or not injection target is set
+ */
+ public boolean isSet()
+ {
+ return set;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessManagedBeanImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessManagedBeanImpl.java
new file mode 100644
index 0000000..d21586b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessManagedBeanImpl.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable.events;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.ProcessManagedBean;
+
+import org.apache.webbeans.component.ManagedBean;
+
+/**
+ * Implementation of {@link ProcessManagedBean}.
+ *
+ * @version $Rev$ $Date$
+ *
+ * @param <X> bean class info
+ */
+public class ProcessManagedBeanImpl<X> extends ProcessBeanImpl<X> implements ProcessManagedBean<X>
+{
+ /**Annotated managed bean class*/
+ private final AnnotatedType<X> annotatedBeanClass;
+
+ public ProcessManagedBeanImpl(ManagedBean<X> bean, AnnotatedType<X> annotatedType)
+ {
+ super(bean, annotatedType);
+ annotatedBeanClass = annotatedType;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public AnnotatedType<X> getAnnotatedBeanClass()
+ {
+ return annotatedBeanClass;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessObserverMethodImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessObserverMethodImpl.java
new file mode 100644
index 0000000..98ef9b1
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessObserverMethodImpl.java
@@ -0,0 +1,76 @@
+/*
+ * 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.webbeans.portable.events;
+
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.ObserverMethod;
+import javax.enterprise.inject.spi.ProcessObserverMethod;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+/**
+ * Implementation of {@link ProcessObserverMethod}.
+ *
+ * @version $Rev$ $Date$
+ *
+ * @param <X> declared bean class
+ * @param <T> event type
+ */
+public class ProcessObserverMethodImpl<T,X> implements ProcessObserverMethod<T, X>
+{
+ /**Observer annotated method*/
+ private final AnnotatedMethod<X> annotatedMethod;
+
+ /**ObserverMethod instance*/
+ private final ObserverMethod<T> observerMethod;
+
+ public ProcessObserverMethodImpl(AnnotatedMethod<X> annotatedMethod,ObserverMethod<T> observerMethod)
+ {
+ this.annotatedMethod = annotatedMethod;
+ this.observerMethod = observerMethod;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void addDefinitionError(Throwable t)
+ {
+ WebBeansContext.getInstance().getBeanManagerImpl().getErrorStack().pushError(t);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public AnnotatedMethod<X> getAnnotatedMethod()
+ {
+ return annotatedMethod;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ObserverMethod<T> getObserverMethod()
+ {
+ return observerMethod;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerFieldImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerFieldImpl.java
new file mode 100644
index 0000000..a64d151
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerFieldImpl.java
@@ -0,0 +1,63 @@
+/*
+ * 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.webbeans.portable.events;
+
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.ProcessProducerField;
+
+import org.apache.webbeans.component.ProducerFieldBean;
+
+/**
+ * Implementation of the {@link ProcessProducerField}.
+ *
+ * @version $Rev$ $Date$
+ *
+ * @param <X> producer field return type
+ * @param <T> producer field bean class type
+ */
+public class ProcessProducerFieldImpl<X,T> extends ProcessBeanImpl<T> implements ProcessProducerField<X, T>
+{
+ private final AnnotatedField<X> annotatedField;
+ private final AnnotatedParameter<X> annotatedParameter;
+
+ public ProcessProducerFieldImpl(ProducerFieldBean<T> bean, AnnotatedField<X> annotatedField, AnnotatedParameter<X> annotatedParameter)
+ {
+ super(bean, annotatedField);
+ this.annotatedField = annotatedField;
+ this.annotatedParameter = annotatedParameter;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public AnnotatedField<X> getAnnotatedProducerField()
+ {
+ return annotatedField;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public AnnotatedParameter<X> getAnnotatedDisposedParameter()
+ {
+ return annotatedParameter;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerImpl.java
new file mode 100644
index 0000000..0ee89ec
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerImpl.java
@@ -0,0 +1,84 @@
+/*
+ * 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.webbeans.portable.events;
+
+import javax.enterprise.inject.spi.AnnotatedMember;
+import javax.enterprise.inject.spi.ProcessProducer;
+import javax.enterprise.inject.spi.Producer;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+/**
+ * Implementation of {@link ProcessProducer}.
+ *
+ * @version $Rev$ $Date$
+ *
+ * @param <X> bean class
+ * @param <T> producer return type class
+ */
+public class ProcessProducerImpl<X,T> implements ProcessProducer<X, T>
+{
+ /**Annotated method or annotated field according to producer method or field*/
+ private final AnnotatedMember<X> annotateMember;
+
+ /**Used by container to produce instance for producer method or field*/
+ private Producer<T> producer = null;
+
+ public ProcessProducerImpl(Producer<T> producer,AnnotatedMember<X> annotateMember)
+ {
+ this.annotateMember = annotateMember;
+ this.producer = producer;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void addDefinitionError(Throwable t)
+ {
+ WebBeansContext.getInstance().getBeanManagerImpl().getErrorStack().pushError(t);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public AnnotatedMember<X> getAnnotatedMember()
+ {
+ return annotateMember;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Producer<T> getProducer()
+ {
+ return producer;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setProducer(Producer<T> producer)
+ {
+ this.producer = producer;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerMethodImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerMethodImpl.java
new file mode 100644
index 0000000..c83a544
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerMethodImpl.java
@@ -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.webbeans.portable.events;
+
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.ProcessProducerMethod;
+
+import org.apache.webbeans.component.ProducerMethodBean;
+
+/**
+ * Implementation of {@link ProcessProducerMethod}.
+ *
+ * @version $Rev$ $Date$
+ *
+ * @param <X> producer method return type
+ * @param <T> producer method bean class
+ */
+public class ProcessProducerMethodImpl<X,T> extends ProcessBeanImpl<T> implements ProcessProducerMethod<X, T>
+{
+ /**Disposed parameter*/
+ private final AnnotatedParameter<X> annotatedDisposedParameter;
+
+ /**Producer method*/
+ private final AnnotatedMethod<X> annotatedProducerMethod;
+
+ public ProcessProducerMethodImpl(ProducerMethodBean<T> bean, AnnotatedMethod<X> method, AnnotatedParameter<X> disposeParameter)
+ {
+ super(bean, method);
+ annotatedProducerMethod = method;
+ annotatedDisposedParameter = disposeParameter;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public AnnotatedParameter<X> getAnnotatedDisposedParameter()
+ {
+ return annotatedDisposedParameter;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public AnnotatedMethod<X> getAnnotatedProducerMethod()
+ {
+ return annotatedProducerMethod;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessSessionBeanImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessSessionBeanImpl.java
new file mode 100644
index 0000000..5dc1dca
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessSessionBeanImpl.java
@@ -0,0 +1,80 @@
+/*
+ * 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.webbeans.portable.events;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.ProcessSessionBean;
+import javax.enterprise.inject.spi.SessionBeanType;
+
+/**
+ * Implementation of {@link ProcessSessionBean}.
+ *
+ * @version $Rev$ $Date$
+ *
+ * @param <X> ejb class info
+ */
+public class ProcessSessionBeanImpl<X> extends ProcessBeanImpl<Object> implements ProcessSessionBean<X>
+{
+ /**Session bean annotated type*/
+ private final AnnotatedType<Object> annotatedBeanClass;
+
+ /**Ejb name*/
+ private final String ejbName;
+
+ /**Session bean type*/
+ private final SessionBeanType type;
+
+ public ProcessSessionBeanImpl(Bean<Object> bean, AnnotatedType<Object> annotatedType, String name, SessionBeanType type)
+ {
+ super(bean, annotatedType);
+ annotatedBeanClass = annotatedType;
+ ejbName = name;
+ this.type = type;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getEjbName()
+ {
+ return ejbName;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public SessionBeanType getSessionBeanType()
+ {
+ return type;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public AnnotatedType<Object> getAnnotatedBeanClass()
+ {
+ return annotatedBeanClass;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java
new file mode 100644
index 0000000..43e0c03
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java
@@ -0,0 +1,197 @@
+/*
+ * 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.webbeans.portable.events.discovery;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Decorator;
+import javax.enterprise.inject.spi.Interceptor;
+import javax.enterprise.inject.spi.ObserverMethod;
+import javax.enterprise.inject.spi.ProcessBean;
+import javax.enterprise.inject.spi.ProcessObserverMethod;
+
+import org.apache.webbeans.component.ManagedBean;
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.intercept.InterceptorsManager;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.portable.events.generics.GProcessBean;
+import org.apache.webbeans.portable.events.generics.GProcessObservableMethod;
+import org.apache.webbeans.util.AnnotationUtil;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Event that is fired by the container after it discovers beans.
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public class AfterBeanDiscoveryImpl implements AfterBeanDiscovery
+{
+ private BeanManagerImpl beanManager = null;
+
+ private static final Logger logger = WebBeansLoggerFacade.getLogger(AfterBeanDiscoveryImpl.class);
+ private final WebBeansContext webBeansContext;
+
+ public AfterBeanDiscoveryImpl(WebBeansContext webBeansContext)
+ {
+ this.webBeansContext = webBeansContext;
+ beanManager = this.webBeansContext.getBeanManagerImpl();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void addBean(Bean<?> bean)
+ {
+ AnnotatedType<?> annotatedType = webBeansContext.getAnnotatedElementFactory().newAnnotatedType(bean.getBeanClass());
+
+ //Fire Event
+ ProcessBean<?> processBeanEvent = new GProcessBean(bean,annotatedType);
+ beanManager.fireEvent(processBeanEvent, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
+
+ if(bean instanceof Interceptor)
+ {
+ //Required for custom interceptors
+ webBeansContext.getWebBeansUtil().defineManagedBeanWithoutFireEvents((AnnotatedType<?>) annotatedType);
+
+ Interceptor<?> interceptor = (Interceptor<?>)bean;
+ if(interceptor.getScope() != Dependent.class)
+ {
+ if(logger.isLoggable(Level.WARNING))
+ {
+ logger.log(Level.WARNING, OWBLogConst.WARN_0005_1, interceptor.getBeanClass().getName());
+ }
+ }
+
+ if(interceptor.getName() != null)
+ {
+ if(logger.isLoggable(Level.WARNING))
+ {
+ logger.log(Level.WARNING, OWBLogConst.WARN_0005_2, interceptor.getBeanClass().getName());
+ }
+ }
+
+ if(interceptor.isAlternative())
+ {
+ if(logger.isLoggable(Level.WARNING))
+ {
+ logger.log(Level.WARNING, OWBLogConst.WARN_0005_3, interceptor.getBeanClass().getName());
+ }
+ }
+
+ InterceptorsManager interceptorsManager = webBeansContext.getInterceptorsManager();
+ interceptorsManager.addCdiInterceptor(interceptor);
+ interceptorsManager.addCustomInterceptorClass(bean.getBeanClass());
+ }
+
+ else if(bean instanceof Decorator)
+ {
+ //Required for custom decorators
+ ManagedBean<?> managedBean =
+ webBeansContext.getWebBeansUtil().defineManagedBeanWithoutFireEvents(
+ (AnnotatedType<?>) annotatedType);
+ if(managedBean.getScope() != Dependent.class)
+ {
+ if(logger.isLoggable(Level.WARNING))
+ {
+ logger.log(Level.WARNING, OWBLogConst.WARN_0005_1, managedBean.getBeanClass().getName());
+ }
+ }
+
+ if(managedBean.getName() != null)
+ {
+ if(logger.isLoggable(Level.WARNING))
+ {
+ logger.log(Level.WARNING, OWBLogConst.WARN_0005_2, managedBean.getBeanClass().getName());
+ }
+ }
+
+ if(managedBean.isAlternative())
+ {
+ if(logger.isLoggable(Level.WARNING))
+ {
+ logger.log(Level.WARNING, OWBLogConst.WARN_0005_3, managedBean.getBeanClass().getName());
+ }
+ }
+
+
+ webBeansContext.getDecoratorsManager().addDecorator((Decorator<?>) bean);
+ webBeansContext.getDecoratorsManager().addCustomDecoratorClass(bean.getBeanClass());
+ }
+ else
+ {
+ beanManager.addBean(bean);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void addContext(Context context)
+ {
+ beanManager.addContext(context);
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void addDefinitionError(Throwable t)
+ {
+ beanManager.getErrorStack().pushError(t);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void addObserverMethod(ObserverMethod<?> observerMethod)
+ {
+ ProcessObserverMethod<?, ?> event = new GProcessObservableMethod(null,observerMethod);
+ beanManager.fireEvent(event, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
+ beanManager.getNotificationManager().addObserver(observerMethod, observerMethod.getObservedType());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public <T> AnnotatedType<T> getAnnotatedType(Class<T> type, String id)
+ {
+ return (AnnotatedType<T>) beanManager.getAdditionalAnnotatedType(type, id);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public <T> Iterable<AnnotatedType<T>> getAnnotatedTypes(Class<T> type)
+ {
+ return beanManager.getWebBeansContext().getAnnotatedElementFactory().getAnnotatedTypes(type);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterDeploymentValidationImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterDeploymentValidationImpl.java
new file mode 100644
index 0000000..5664a68
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterDeploymentValidationImpl.java
@@ -0,0 +1,50 @@
+/*
+ * 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.webbeans.portable.events.discovery;
+
+import javax.enterprise.inject.spi.AfterDeploymentValidation;
+
+import org.apache.webbeans.container.BeanManagerImpl;
+
+/**
+ * Event that is fired by the container after it validates
+ * deployment.
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public class AfterDeploymentValidationImpl implements AfterDeploymentValidation
+{
+ private final BeanManagerImpl beanManagerImpl;
+
+ public AfterDeploymentValidationImpl(BeanManagerImpl beanManagerImpl)
+ {
+ this.beanManagerImpl = beanManagerImpl;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void addDeploymentProblem(Throwable t)
+ {
+ beanManagerImpl.getErrorStack().pushError(t);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/BeforeBeanDiscoveryImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/BeforeBeanDiscoveryImpl.java
new file mode 100644
index 0000000..f28630b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/BeforeBeanDiscoveryImpl.java
@@ -0,0 +1,122 @@
+/*
+ * 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.webbeans.portable.events.discovery;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.container.ExternalScope;
+import org.apache.webbeans.deployment.StereoTypeModel;
+
+/**
+ * Events that is fired before container starts to discover beans.
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public class BeforeBeanDiscoveryImpl implements BeforeBeanDiscovery
+{
+
+ private BeanManagerImpl beanManager = null;
+ private final WebBeansContext webBeansContext;
+
+ public BeforeBeanDiscoveryImpl(WebBeansContext webBeansContext)
+ {
+ this.webBeansContext = webBeansContext;
+ beanManager = this.webBeansContext.getBeanManagerImpl();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void addAnnotatedType(AnnotatedType<?> type)
+ {
+ beanManager.addAdditionalAnnotatedType(type);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void addQualifier(Class<? extends Annotation> qualifier)
+ {
+ beanManager.addAdditionalQualifier(qualifier);
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void addInterceptorBinding(Class<? extends Annotation> binding, Annotation... bindingDef)
+ {
+ webBeansContext.getInterceptorsManager().addInterceptorBindingType(binding, bindingDef);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void addScope(Class<? extends Annotation> scope, boolean normal, boolean passivating)
+ {
+ ExternalScope additionalScope = new ExternalScope(scope, normal, passivating);
+ beanManager.addAdditionalScope(additionalScope);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void addStereotype(Class<? extends Annotation> stereotype, Annotation... stereotypeDef)
+ {
+ webBeansContext.getAnnotationManager().checkStereoTypeClass(stereotype, stereotypeDef);
+ StereoTypeModel model = new StereoTypeModel(webBeansContext, stereotype, stereotypeDef);
+ webBeansContext.getStereoTypeManager().addStereoTypeModel(model);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void addAnnotatedType(AnnotatedType<?> annotatedType, String id)
+ {
+ beanManager.addAdditionalAnnotatedType(annotatedType, id);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void addInterceptorBinding(AnnotatedType<? extends Annotation> annotatedType)
+ {
+ // TODO extract inherited types
+ webBeansContext.getInterceptorsManager().addInterceptorBindingType(annotatedType.getJavaClass());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void addQualifier(AnnotatedType<? extends Annotation> annotatedType)
+ {
+ beanManager.addAdditionalQualifier(annotatedType.getJavaClass());
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/BeforeShutdownImpl.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/BeforeShutdownImpl.java
new file mode 100644
index 0000000..619d54a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/BeforeShutdownImpl.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.portable.events.discovery;
+
+import javax.enterprise.inject.spi.BeforeShutdown;
+
+/**
+ * Event that is fired by the container before it shuts down.
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public class BeforeShutdownImpl implements BeforeShutdown
+{
+ /**
+ * Creates a new instance.
+ */
+ public BeforeShutdownImpl()
+ {
+ super();
+ }
+}
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/ErrorStack.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/ErrorStack.java
new file mode 100644
index 0000000..a69bd50
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/ErrorStack.java
@@ -0,0 +1,71 @@
+/*
+ * 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.webbeans.portable.events.discovery;
+
+import java.util.Iterator;
+import java.util.Stack;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+
+/**
+ * Error stack.
+ * @version $Rev$ $Date$
+ *
+ */
+public class ErrorStack
+{
+ private static final Logger logger = WebBeansLoggerFacade.getLogger(ErrorStack.class);
+
+ private Stack<Throwable> errorStack = new Stack<Throwable>();
+
+ public ErrorStack()
+ {
+
+ }
+
+ public void pushError(Throwable e)
+ {
+ errorStack.addElement(e);
+ }
+
+ public void logErrors()
+ {
+ if(!errorStack.isEmpty())
+ {
+ Iterator<Throwable> it = errorStack.iterator();
+ while(it.hasNext())
+ {
+ Throwable t = it.next();
+ logger.log(Level.SEVERE, t.getMessage(), t);
+ }
+ }
+ }
+
+ public void clear()
+ {
+ errorStack.clear();
+ }
+
+ public boolean hasErrors()
+ {
+ return !errorStack.isEmpty();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessAnnotatedType.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessAnnotatedType.java
new file mode 100644
index 0000000..cab870e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessAnnotatedType.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.portable.events.generics;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+
+import org.apache.webbeans.portable.events.ProcessAnnotatedTypeImpl;
+
+@SuppressWarnings("unchecked")
+public class GProcessAnnotatedType extends ProcessAnnotatedTypeImpl implements GenericBeanEvent
+{
+ public GProcessAnnotatedType(AnnotatedType annotatedType )
+ {
+ super(annotatedType);
+ }
+
+ @Override
+ public Class<?> getBeanClassFor(Class<?> eventClass)
+ {
+ return getAnnotatedType().getJavaClass();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessBean.java
new file mode 100644
index 0000000..5aa4a15
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessBean.java
@@ -0,0 +1,39 @@
+/*
+ * 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.webbeans.portable.events.generics;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+
+import org.apache.webbeans.portable.events.ProcessBeanImpl;
+
+@SuppressWarnings("unchecked")
+public class GProcessBean extends ProcessBeanImpl implements GenericBeanEvent
+{
+ public GProcessBean(Bean<?> bean,AnnotatedType<?> annotated)
+ {
+ super(bean,annotated);
+ }
+
+ @Override
+ public Class<?> getBeanClassFor(Class<?> eventClass)
+ {
+ return getBean().getBeanClass();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessInjectionTarget.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessInjectionTarget.java
new file mode 100644
index 0000000..8b187a7
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessInjectionTarget.java
@@ -0,0 +1,39 @@
+/*
+ * 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.webbeans.portable.events.generics;
+
+import org.apache.webbeans.portable.InjectionTargetImpl;
+import org.apache.webbeans.portable.events.ProcessInjectionTargetImpl;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+
+@SuppressWarnings("unchecked")
+public class GProcessInjectionTarget extends ProcessInjectionTargetImpl implements GenericBeanEvent
+{
+ public GProcessInjectionTarget(InjectionTargetImpl<?> injectionTarget,AnnotatedType<?> annotatedType)
+ {
+ super(injectionTarget, annotatedType);
+ }
+
+ @Override
+ public Class<?> getBeanClassFor(Class<?> eventClass)
+ {
+ return getAnnotatedType().getJavaClass();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessManagedBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessManagedBean.java
new file mode 100644
index 0000000..8cd8337
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessManagedBean.java
@@ -0,0 +1,39 @@
+/*
+ * 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.webbeans.portable.events.generics;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+
+import org.apache.webbeans.component.ManagedBean;
+import org.apache.webbeans.portable.events.ProcessManagedBeanImpl;
+
+@SuppressWarnings("unchecked")
+public class GProcessManagedBean extends ProcessManagedBeanImpl implements GenericBeanEvent
+{
+ public GProcessManagedBean(ManagedBean<?> bean,AnnotatedType<?> annotated)
+ {
+ super(bean,annotated);
+ }
+
+ @Override
+ public Class<?> getBeanClassFor(Class<?> eventClass)
+ {
+ return getBean().getBeanClass();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessObservableMethod.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessObservableMethod.java
new file mode 100644
index 0000000..f7ed1fc
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessObservableMethod.java
@@ -0,0 +1,50 @@
+/*
+ * 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.webbeans.portable.events.generics;
+
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.ObserverMethod;
+
+import org.apache.webbeans.portable.events.ProcessObserverMethodImpl;
+import org.apache.webbeans.util.ClassUtil;
+
+@SuppressWarnings("unchecked")
+public class GProcessObservableMethod extends ProcessObserverMethodImpl implements GenericProducerObserverEvent
+{
+
+ public GProcessObservableMethod(AnnotatedMethod<?> annotatedMethod, ObserverMethod<?> observerMethod)
+ {
+ super(annotatedMethod, observerMethod);
+ }
+
+ @Override
+ public Class<?> getBeanClass()
+ {
+ return getObserverMethod().getBeanClass();
+ }
+
+ @Override
+ public Class<?> getProducerOrObserverType()
+ {
+ return ClassUtil.getClazz(getObserverMethod().getObservedType());
+ }
+
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducer.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducer.java
new file mode 100644
index 0000000..34fc804
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducer.java
@@ -0,0 +1,48 @@
+/*
+ * 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.webbeans.portable.events.generics;
+
+import javax.enterprise.inject.spi.AnnotatedMember;
+import javax.enterprise.inject.spi.Producer;
+
+import org.apache.webbeans.portable.events.ProcessProducerImpl;
+import org.apache.webbeans.util.ClassUtil;
+
+@SuppressWarnings("unchecked")
+public class GProcessProducer extends ProcessProducerImpl implements GenericProducerObserverEvent
+{
+ public GProcessProducer(Producer<?> producer, AnnotatedMember<?> annotateMember)
+ {
+ super(producer,annotateMember);
+ }
+
+ @Override
+ public Class<?> getBeanClass()
+ {
+ return getAnnotatedMember().getDeclaringType().getJavaClass();
+ }
+
+ @Override
+ public Class<?> getProducerOrObserverType()
+ {
+ return ClassUtil.getClazz(getAnnotatedMember().getBaseType());
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducerField.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducerField.java
new file mode 100644
index 0000000..1b05e6a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducerField.java
@@ -0,0 +1,48 @@
+/*
+ * 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.webbeans.portable.events.generics;
+
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+
+import org.apache.webbeans.component.ProducerFieldBean;
+import org.apache.webbeans.portable.events.ProcessProducerFieldImpl;
+import org.apache.webbeans.util.ClassUtil;
+
+@SuppressWarnings("unchecked")
+public class GProcessProducerField extends ProcessProducerFieldImpl implements GenericProducerObserverEvent
+{
+ public GProcessProducerField(ProducerFieldBean<?> bean, AnnotatedField<?> annotatedField, AnnotatedParameter<?> annotatedParameter)
+ {
+ super(bean, annotatedField, annotatedParameter);
+ }
+
+ @Override
+ public Class<?> getBeanClass()
+ {
+ return getBean().getBeanClass();
+ }
+
+ @Override
+ public Class<?> getProducerOrObserverType()
+ {
+ return ClassUtil.getClazz(getAnnotatedProducerField().getBaseType());
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducerMethod.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducerMethod.java
new file mode 100644
index 0000000..4d8cc2b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducerMethod.java
@@ -0,0 +1,49 @@
+/*
+ * 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.webbeans.portable.events.generics;
+
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+
+import org.apache.webbeans.component.ProducerMethodBean;
+import org.apache.webbeans.portable.events.ProcessProducerMethodImpl;
+import org.apache.webbeans.util.ClassUtil;
+
+@SuppressWarnings("unchecked")
+public class GProcessProducerMethod extends ProcessProducerMethodImpl implements GenericProducerObserverEvent
+{
+ public GProcessProducerMethod(ProducerMethodBean<?> bean,AnnotatedMethod<?> annotatedMethod, AnnotatedParameter dispose)
+ {
+ super(bean, annotatedMethod,dispose);
+ }
+
+ @Override
+ public Class<?> getBeanClass()
+ {
+ return getBean().getBeanClass();
+ }
+
+ @Override
+ public Class<?> getProducerOrObserverType()
+ {
+ return ClassUtil.getClazz(getAnnotatedProducerMethod().getBaseType());
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessSessionBean.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessSessionBean.java
new file mode 100644
index 0000000..107aba3
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessSessionBean.java
@@ -0,0 +1,59 @@
+/*
+ * 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.webbeans.portable.events.generics;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.ProcessSessionBean;
+import javax.enterprise.inject.spi.SessionBeanType;
+
+import org.apache.webbeans.portable.events.ProcessSessionBeanImpl;
+
+@SuppressWarnings("unchecked")
+public class GProcessSessionBean extends ProcessSessionBeanImpl implements GenericBeanEvent
+{
+ public GProcessSessionBean(Bean<Object> bean, AnnotatedType<?> annotatedType, String name, SessionBeanType type)
+ {
+ super(bean, annotatedType, name, type);
+ }
+
+ /**
+ * This is an exceptional case due to the definition
+ * ProcessSessionBean<X> extends ProcessManagedBean<Object>
+ *
+ * If we are thinking of this event as a ProcessSessionBean then the bean class is X
+ * but if we are thinking of it as a ProcessManagedBean or superclass then the bean class
+ * is Object. See https://issues.jboss.org/browse/CDITCK-215
+ *
+ * @param eventClass the class of event we are treating this event as
+ * @return X.class or Object.class
+ */
+ @Override
+ public Class<?> getBeanClassFor(Class<?> eventClass)
+ {
+ if (ProcessSessionBean.class.isAssignableFrom(eventClass))
+ {
+ return getBean().getBeanClass();
+ }
+ else
+ {
+ return Object.class;
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GenericBeanEvent.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GenericBeanEvent.java
new file mode 100644
index 0000000..259fe65
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GenericBeanEvent.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.portable.events.generics;
+
+public interface GenericBeanEvent
+{
+
+ /**
+ * If this is a Foo<X> event and we are considering it as a Bar<Y> event,
+ * returns the generic type of Foo as a Bar. Normally this is X, but in at least one case
+ * (ProcessSessionBean) the generic type is different.
+ * @param eventClass the class of event we are treating this event as
+ * @return the generic type parameter of this event considered as an "eventClass"
+ */
+ public Class<?> getBeanClassFor(Class<?> eventClass);
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GenericProducerObserverEvent.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GenericProducerObserverEvent.java
new file mode 100644
index 0000000..031c1ea
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GenericProducerObserverEvent.java
@@ -0,0 +1,26 @@
+/*
+ * 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.webbeans.portable.events.generics;
+
+public interface GenericProducerObserverEvent
+{
+ public Class<?> getBeanClass();
+
+ public Class<?> getProducerOrObserverType();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/AbstractProxyFactory.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/AbstractProxyFactory.java
new file mode 100644
index 0000000..485f967
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/AbstractProxyFactory.java
@@ -0,0 +1,700 @@
+/*
+ * 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.webbeans.proxy;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.xbean.asm5.ClassWriter;
+import org.apache.xbean.asm5.MethodVisitor;
+import org.apache.xbean.asm5.Opcodes;
+import org.apache.xbean.asm5.Type;
+
+/**
+ * Base class for all OWB Proxy factories
+ */
+public abstract class AbstractProxyFactory
+{
+ public final static int MAX_CLASSLOAD_TRIES = 10000;
+
+ protected WebBeansContext webBeansContext;
+
+ /**
+ * contains the instance of sun.misc.Unsafe.
+ * We use it for creating the proxy instance without fully
+ * initializing the class.
+ */
+ private Object unsafe = null;
+ private Method unsafeAllocateInstance;
+
+
+ /**
+ * The name of the field which stores the passivationID of the Bean this proxy serves.
+ * This is needed in case the proxy gets de-serialized back into a JVM
+ * which didn't have this bean loaded yet.
+ */
+ public static final String FIELD_BEAN_PASSIVATION_ID = "owbBeanPassivationId";
+
+
+ protected AbstractProxyFactory(WebBeansContext webBeansContext)
+ {
+ this.webBeansContext = webBeansContext;
+ initializeUnsafe();
+ }
+
+ /**
+ * @return the marker interface which should be used for this proxy.
+ */
+ protected abstract Class getMarkerInterface();
+
+ /**
+ * generate the bytecode for creating the instance variables of the class
+ */
+ protected abstract void createInstanceVariables(ClassWriter cw, Class<?> classToProxy, String classFileName);
+
+ /**
+ * generate the bytecode for serialization.
+ */
+ protected abstract void createSerialisation(ClassWriter cw, String proxyClassFileName, Class<?> classToProxy, String classFileName);
+
+ /**
+ * Each of our interceptor/decorator proxies has exactly 1 constructor
+ * which invokes the super ct + sets the delegation field.
+ *
+ * @param cw
+ * @param classToProxy
+ * @param classFileName
+ * @throws ProxyGenerationException
+ */
+ protected abstract void createConstructor(ClassWriter cw, String proxyClassFileName, Class<?> classToProxy, String classFileName)
+ throws ProxyGenerationException;
+
+ /**
+ * generate the bytecode for invoking all intercepted methods
+ */
+ protected abstract void delegateInterceptedMethods(ClassLoader classLoader, ClassWriter cw, String proxyClassFileName, Class<?> classToProxy, Method[] interceptedMethods)
+ throws ProxyGenerationException;
+
+ /**
+ * generate the bytecode for invoking all non-intercepted methods
+ */
+ protected abstract void delegateNonInterceptedMethods(ClassLoader classLoader, ClassWriter cw, String proxyClassFileName, Class<?> classToProxy, Method[] noninterceptedMethods)
+ throws ProxyGenerationException;
+
+ /**
+ * Detect a free classname based on the given one
+ * @param proxyClassName
+ * @return
+ */
+ protected String getUnusedProxyClassName(ClassLoader classLoader, String proxyClassName)
+ {
+ proxyClassName = fixPreservedPackages(proxyClassName);
+
+ String finalName = proxyClassName;
+
+ for (int i = 0; i < MAX_CLASSLOAD_TRIES; i++)
+ {
+ try
+ {
+ finalName = proxyClassName + i;
+ Class.forName(finalName, true, classLoader);
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ // this is exactly what we need!
+ return finalName;
+ }
+ // otherwise we continue ;)
+ }
+
+ throw new WebBeansException("Unable to detect a free proxy class name based on: " + proxyClassName);
+ }
+
+ protected String fixPreservedPackages(String proxyClassName)
+ {
+ proxyClassName = fixPreservedPackage(proxyClassName, "java.");
+ proxyClassName = fixPreservedPackage(proxyClassName, "javax.");
+ proxyClassName = fixPreservedPackage(proxyClassName, "sun.misc.");
+
+ return proxyClassName;
+ }
+ /**
+ * Detect if the provided className is in the forbidden package.
+ * If so, move it to org.apache.webbeans.custom.
+ * @param forbiddenPackagePrefix including the '.', e.g. 'javax.'
+ */
+ private String fixPreservedPackage(final String className, final String forbiddenPackagePrefix)
+ {
+ String fixedClassName = className;
+
+ if (className.startsWith(forbiddenPackagePrefix))
+ {
+ fixedClassName = "org.apache.webbeans.custom." + className.substring(forbiddenPackagePrefix.length());
+ }
+
+ return fixedClassName;
+ }
+
+
+ /**
+ * @param classLoader to use for creating the class in
+ * @param classToProxy the class for which a subclass will get generated
+ * @param interceptedMethods the list of intercepted or decorated business methods.
+ * @param nonInterceptedMethods all methods which are <b>not</b> intercepted nor decorated and shall get delegated directly
+ * @param <T>
+ * @return the proxy class
+ */
+ protected <T> Class<T> createProxyClass(ClassLoader classLoader, String proxyClassName, Class<T> classToProxy,
+ Method[] interceptedMethods, Method[] nonInterceptedMethods)
+ throws ProxyGenerationException
+ {
+ String proxyClassFileName = proxyClassName.replace('.', '/');
+
+ final byte[] proxyBytes = generateProxy(classLoader, classToProxy, proxyClassName, proxyClassFileName, interceptedMethods, nonInterceptedMethods);
+
+ Class<T> clazz = defineAndLoadClass(classLoader, proxyClassName, proxyBytes);
+
+
+ return clazz;
+ }
+
+ private byte[] generateProxy(ClassLoader classLoader, Class<?> classToProxy, String proxyClassName, String proxyClassFileName,
+ Method[] interceptedMethods, Method[] nonInterceptedMethods)
+ throws ProxyGenerationException
+ {
+ ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
+ String classFileName = classToProxy.getName().replace('.', '/');
+
+ String[] interfaceNames = new String[]{Type.getInternalName(getMarkerInterface())};
+ String superClassName = classFileName;
+
+ if (classToProxy.isInterface())
+ {
+ interfaceNames = new String[]{Type.getInternalName(classToProxy), interfaceNames[0]};
+ superClassName = Type.getInternalName(Object.class);
+ }
+
+ cw.visit(Opcodes.V1_5, Opcodes.ACC_PUBLIC + Opcodes.ACC_SUPER + Opcodes.ACC_SYNTHETIC, proxyClassFileName, null, superClassName, interfaceNames);
+ cw.visitSource(classFileName + ".java", null);
+
+ createInstanceVariables(cw, classToProxy, classFileName);
+ createSerialisation(cw, proxyClassFileName, classToProxy, classFileName);
+
+
+
+ // create a static String Field which contains the passivationId of the Bean or null if not PassivationCapable
+ cw.visitField(Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC,
+ FIELD_BEAN_PASSIVATION_ID, Type.getDescriptor(String.class), null, null).visitEnd();
+
+ createConstructor(cw, proxyClassFileName, classToProxy, classFileName);
+
+
+ if (nonInterceptedMethods != null)
+ {
+ delegateNonInterceptedMethods(classLoader, cw, proxyClassFileName, classToProxy, nonInterceptedMethods);
+ }
+
+ if (interceptedMethods != null)
+ {
+ delegateInterceptedMethods(classLoader, cw, proxyClassFileName, classToProxy, interceptedMethods);
+ }
+
+ return cw.toByteArray();
+ }
+
+
+ /**
+ * The 'defineClass' method on the ClassLoader is protected, thus we need to invoke it via reflection.
+ * @return the Class which got loaded in the classloader
+ */
+ private <T> Class<T> defineAndLoadClass(ClassLoader classLoader, String proxyName, byte[] proxyBytes)
+ throws ProxyGenerationException
+ {
+ Class<?> clazz = classLoader.getClass();
+
+ Method defineClassMethod = null;
+ do
+ {
+ try
+ {
+ defineClassMethod = clazz.getDeclaredMethod("defineClass", String.class, byte[].class, int.class, int.class);
+ }
+ catch (NoSuchMethodException e)
+ {
+ // do nothing, we need to search the superclass
+ }
+
+ clazz = clazz.getSuperclass();
+ } while (defineClassMethod == null && clazz != Object.class);
+
+ if (defineClassMethod == null)
+ {
+ throw new ProxyGenerationException("could not find 'defineClass' method in the ClassLoader!");
+ }
+
+ defineClassMethod.setAccessible(true);
+ try
+ {
+ Class<T> definedClass = (Class<T>) defineClassMethod.invoke(classLoader, proxyName, proxyBytes, 0, proxyBytes.length);
+
+ Class<T> loadedClass = (Class<T>) Class.forName(definedClass.getName(), true, classLoader);
+ return loadedClass;
+ }
+ catch (Throwable e)
+ {
+ throw new ProxyGenerationException(e);
+ }
+ }
+
+
+ protected boolean unproxyableMethod(Method delegatedMethod)
+ {
+ int modifiers = delegatedMethod.getModifiers();
+
+ return (modifiers & (Modifier.PRIVATE | Modifier.STATIC | Modifier.FINAL | Modifier.NATIVE)) > 0 ||
+ "finalize".equals(delegatedMethod.getName()) || delegatedMethod.isBridge();
+ }
+
+ /**
+ * @return the wrapper type for a primitive, e.g. java.lang.Integer for int
+ */
+ protected String getWrapperType(final Class<?> type)
+ {
+ if (Integer.TYPE.equals(type))
+ {
+ return Integer.class.getCanonicalName().replace('.', '/');
+ }
+ else if (Boolean.TYPE.equals(type))
+ {
+ return Boolean.class.getCanonicalName().replace('.', '/');
+ }
+ else if (Character.TYPE.equals(type))
+ {
+ return Character.class.getCanonicalName().replace('.', '/');
+ }
+ else if (Byte.TYPE.equals(type))
+ {
+ return Byte.class.getCanonicalName().replace('.', '/');
+ }
+ else if (Short.TYPE.equals(type))
+ {
+ return Short.class.getCanonicalName().replace('.', '/');
+ }
+ else if (Float.TYPE.equals(type))
+ {
+ return Float.class.getCanonicalName().replace('.', '/');
+ }
+ else if (Long.TYPE.equals(type))
+ {
+ return Long.class.getCanonicalName().replace('.', '/');
+ }
+ else if (Double.TYPE.equals(type))
+ {
+ return Double.class.getCanonicalName().replace('.', '/');
+ }
+ else if (Void.TYPE.equals(type))
+ {
+ return Void.class.getCanonicalName().replace('.', '/');
+ }
+
+ throw new IllegalStateException("Type: " + type.getCanonicalName() + " is not a primitive type");
+ }
+
+ /**
+ * Returns the appropriate bytecode instruction to load a value from a variable to the stack
+ *
+ * @param type Type to load
+ * @return Bytecode instruction to use
+ */
+ protected int getVarInsn(final Class<?> type)
+ {
+ if (type.isPrimitive())
+ {
+ if (Integer.TYPE.equals(type))
+ {
+ return Opcodes.ILOAD;
+ }
+ else if (Boolean.TYPE.equals(type))
+ {
+ return Opcodes.ILOAD;
+ }
+ else if (Character.TYPE.equals(type))
+ {
+ return Opcodes.ILOAD;
+ }
+ else if (Byte.TYPE.equals(type))
+ {
+ return Opcodes.ILOAD;
+ }
+ else if (Short.TYPE.equals(type))
+ {
+ return Opcodes.ILOAD;
+ }
+ else if (Float.TYPE.equals(type))
+ {
+ return Opcodes.FLOAD;
+ }
+ else if (Long.TYPE.equals(type))
+ {
+ return Opcodes.LLOAD;
+ }
+ else if (Double.TYPE.equals(type))
+ {
+ return Opcodes.DLOAD;
+ }
+ }
+
+ throw new IllegalStateException("Type: " + type.getCanonicalName() + " is not a primitive type");
+ }
+
+ /**
+ * Invokes the most appropriate bytecode instruction to put a number on the stack
+ *
+ * @param mv
+ * @param i
+ */
+ protected void pushIntOntoStack(final MethodVisitor mv, final int i)
+ {
+ if (i == 0)
+ {
+ mv.visitInsn(Opcodes.ICONST_0);
+ }
+ else if (i == 1)
+ {
+ mv.visitInsn(Opcodes.ICONST_1);
+ }
+ else if (i == 2)
+ {
+ mv.visitInsn(Opcodes.ICONST_2);
+ }
+ else if (i == 3)
+ {
+ mv.visitInsn(Opcodes.ICONST_3);
+ }
+ else if (i == 4)
+ {
+ mv.visitInsn(Opcodes.ICONST_4);
+ }
+ else if (i == 5)
+ {
+ mv.visitInsn(Opcodes.ICONST_5);
+ }
+ else if (i > 5 && i <= 255)
+ {
+ mv.visitIntInsn(Opcodes.BIPUSH, i);
+ }
+ else
+ {
+ mv.visitIntInsn(Opcodes.SIPUSH, i);
+ }
+ }
+
+ /**
+ * Gets the appropriate bytecode instruction for RETURN, according to what type we need to return
+ *
+ * @param type Type the needs to be returned
+ * @return The matching bytecode instruction
+ */
+ protected int getReturnInsn(final Class<?> type)
+ {
+ if (type.isPrimitive())
+ {
+ if (Void.TYPE.equals(type))
+ {
+ return Opcodes.RETURN;
+ }
+ if (Integer.TYPE.equals(type))
+ {
+ return Opcodes.IRETURN;
+ }
+ else if (Boolean.TYPE.equals(type))
+ {
+ return Opcodes.IRETURN;
+ }
+ else if (Character.TYPE.equals(type))
+ {
+ return Opcodes.IRETURN;
+ }
+ else if (Byte.TYPE.equals(type))
+ {
+ return Opcodes.IRETURN;
+ }
+ else if (Short.TYPE.equals(type))
+ {
+ return Opcodes.IRETURN;
+ }
+ else if (Float.TYPE.equals(type))
+ {
+ return Opcodes.FRETURN;
+ }
+ else if (Long.TYPE.equals(type))
+ {
+ return Opcodes.LRETURN;
+ }
+ else if (Double.TYPE.equals(type))
+ {
+ return Opcodes.DRETURN;
+ }
+ }
+
+ return Opcodes.ARETURN;
+ }
+
+ /**
+ * Gets the string to use for CHECKCAST instruction, returning the correct value for any type, including primitives and arrays
+ *
+ * @param returnType The type to cast to with CHECKCAST
+ * @return CHECKCAST parameter
+ */
+ protected String getCastType(final Class<?> returnType)
+ {
+ if (returnType.isPrimitive())
+ {
+ return getWrapperType(returnType);
+ }
+ else
+ {
+ return Type.getInternalName(returnType);
+ }
+ }
+
+ /**
+ * Returns the name of the Java method to call to get the primitive value from an Object - e.g. intValue for java.lang.Integer
+ *
+ * @param type Type whose primitive method we want to lookup
+ * @return The name of the method to use
+ */
+ protected String getPrimitiveMethod(final Class<?> type)
+ {
+ if (Integer.TYPE.equals(type))
+ {
+ return "intValue";
+ }
+ else if (Boolean.TYPE.equals(type))
+ {
+ return "booleanValue";
+ }
+ else if (Character.TYPE.equals(type))
+ {
+ return "charValue";
+ }
+ else if (Byte.TYPE.equals(type))
+ {
+ return "byteValue";
+ }
+ else if (Short.TYPE.equals(type))
+ {
+ return "shortValue";
+ }
+ else if (Float.TYPE.equals(type))
+ {
+ return "floatValue";
+ }
+ else if (Long.TYPE.equals(type))
+ {
+ return "longValue";
+ }
+ else if (Double.TYPE.equals(type))
+ {
+ return "doubleValue";
+ }
+
+ throw new IllegalStateException("Type: " + type.getCanonicalName() + " is not a primitive type");
+ }
+
+ protected void generateReturn(MethodVisitor mv, Method delegatedMethod)
+ {
+ final Class<?> returnType = delegatedMethod.getReturnType();
+ mv.visitInsn(getReturnInsn(returnType));
+ }
+
+ protected <T> T unsafeNewInstance(Class<T> clazz)
+ {
+ try
+ {
+ return (T) unsafeAllocateInstance.invoke(unsafe, clazz);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new IllegalStateException("Failed to allocateInstance of Proxy class " + clazz.getName(), e);
+ }
+ catch (InvocationTargetException e)
+ {
+ Throwable throwable = e.getTargetException() != null ? e.getTargetException() : e;
+ throw new IllegalStateException("Failed to allocateInstance of Proxy class " + clazz.getName(),
+ throwable);
+ }
+ }
+
+
+ private void initializeUnsafe()
+ {
+ final Class<?> unsafeClass;
+ try
+ {
+ unsafeClass = AccessController.doPrivileged(new PrivilegedAction<Class<?>>()
+ {
+ @Override
+ public Class<?> run()
+ {
+ try
+ {
+ return Thread.currentThread().getContextClassLoader().loadClass("sun.misc.Unsafe");
+ }
+ catch (Exception e)
+ {
+ try
+ {
+ return ClassLoader.getSystemClassLoader().loadClass("sun.misc.Unsafe");
+ }
+ catch (ClassNotFoundException e1)
+ {
+ throw new IllegalStateException("Cannot get sun.misc.Unsafe", e);
+ }
+ }
+ }
+ });
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException("Cannot get sun.misc.Unsafe class", e);
+ }
+
+ Object unsafe = AccessController.doPrivileged(new PrivilegedAction<Object>()
+ {
+ @Override
+ public Object run()
+ {
+ try
+ {
+ Field field = unsafeClass.getDeclaredField("theUnsafe");
+ field.setAccessible(true);
+ return field.get(null);
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException("Cannot get sun.misc.Unsafe", e);
+ }
+ }
+ });
+
+ this.unsafe = unsafe;
+
+ unsafeAllocateInstance = AccessController.doPrivileged(new PrivilegedAction<Method>()
+ {
+ @Override
+ public Method run()
+ {
+ try
+ {
+ Method mtd = unsafeClass.getDeclaredMethod("allocateInstance", Class.class);
+ mtd.setAccessible(true);
+ return mtd;
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException("Cannot get sun.misc.Unsafe.allocateInstance", e);
+ }
+ }
+ });
+ }
+
+ /**
+ * Create an Object[] parameter which contains all the parameters of the currently invoked method
+ * and store this array for use in the call stack.
+ * @param mv
+ * @param parameterTypes
+ */
+ protected void pushMethodParameterArray(MethodVisitor mv, Class<?>[] parameterTypes)
+ {
+ // need to construct the array of objects passed in
+ // create the Object[]
+ createArrayDefinition(mv, parameterTypes.length, Object.class);
+
+ int index = 1;
+ // push parameters into array
+ for (int i = 0; i < parameterTypes.length; i++)
+ {
+ // keep copy of array on stack
+ mv.visitInsn(Opcodes.DUP);
+
+ final Class<?> parameterType = parameterTypes[i];
+
+ // push number onto stack
+ pushIntOntoStack(mv, i);
+
+ if (parameterType.isPrimitive())
+ {
+ String wrapperType = getWrapperType(parameterType);
+ mv.visitVarInsn(getVarInsn(parameterType), index);
+
+ mv.visitMethodInsn(Opcodes.INVOKESTATIC, wrapperType, "valueOf",
+ "(" + Type.getDescriptor(parameterType) + ")L" + wrapperType + ";", false);
+ mv.visitInsn(Opcodes.AASTORE);
+
+ if (Long.TYPE.equals(parameterType) || Double.TYPE.equals(parameterType))
+ {
+ index += 2;
+ }
+ else
+ {
+ index++;
+ }
+ }
+ else
+ {
+ mv.visitVarInsn(Opcodes.ALOAD, index);
+ mv.visitInsn(Opcodes.AASTORE);
+ index++;
+ }
+ }
+ }
+
+ /**
+ * pushes an array of the specified size to the method visitor. The generated bytecode will leave
+ * the new array at the top of the stack.
+ *
+ * @param mv MethodVisitor to use
+ * @param size Size of the array to create
+ * @param type Type of array to create
+ * @throws ProxyGenerationException
+ */
+ protected void createArrayDefinition(final MethodVisitor mv, final int size, final Class<?> type)
+ throws ProxyGenerationException
+ {
+ // create a new array of java.lang.class (2)
+
+ if (size < 0)
+ {
+ throw new ProxyGenerationException("Array size cannot be less than zero");
+ }
+
+ pushIntOntoStack(mv, size);
+
+ mv.visitTypeInsn(Opcodes.ANEWARRAY, type.getCanonicalName().replace('.', '/'));
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java
new file mode 100644
index 0000000..f91a11e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java
@@ -0,0 +1,557 @@
+/*
+ * 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.webbeans.proxy;
+
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.util.Asserts;
+import org.apache.webbeans.util.ExceptionUtil;
+import org.apache.xbean.asm5.ClassWriter;
+import org.apache.xbean.asm5.Label;
+import org.apache.xbean.asm5.MethodVisitor;
+import org.apache.xbean.asm5.Opcodes;
+import org.apache.xbean.asm5.Type;
+
+import javax.enterprise.inject.spi.Bean;
+import java.io.ObjectStreamException;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.logging.Logger;
+
+
+/**
+ * Generate a dynamic subclass which has exactly 1 delegation point instance
+ * which get's set in the Constructor of the proxy.
+ * Any non-intercepted or decorated method will get delegated natively,
+ * All intercepted and decorated methods will get invoked via an InvocationHandler chain.
+ *
+ * This factory will create and cache the proxy classes for a given type.
+ *
+ */
+public class InterceptorDecoratorProxyFactory extends AbstractProxyFactory
+{
+ private final static Logger logger = WebBeansLoggerFacade.getLogger(InterceptorDecoratorProxyFactory.class);
+
+
+ /** the name of the field which stores the proxied instance */
+ public static final String FIELD_PROXIED_INSTANCE = "owbIntDecProxiedInstance";
+
+ /** the name of the field which stores the Interceptor + Decorator stack InterceptorHandler */
+ public static final String FIELD_INTERCEPTOR_HANDLER = "owbIntDecHandler";
+
+ /** the name of the field which stores the Method[] of all intercepted methods */
+ public static final String FIELD_INTERCEPTED_METHODS = "owbIntDecMethods";
+
+ /**
+ * Caches the proxy classes for each bean.
+ * We need this to prevent filling up the ClassLoaders by
+ */
+ private ConcurrentMap<Bean<?>, Class<?>> cachedProxyClasses = new ConcurrentHashMap<Bean<?>, Class<?>>();
+
+
+ public InterceptorDecoratorProxyFactory(WebBeansContext webBeansContext)
+ {
+ super(webBeansContext);
+ }
+
+ public <T> T createProxyInstance(Class<? extends T> proxyClass, T instance, InterceptorHandler interceptorDecoratorStack)
+ throws ProxyGenerationException
+ {
+ Asserts.assertNotNull(instance);
+
+ try
+ {
+ T proxy = unsafeNewInstance(proxyClass);
+
+ Field delegateField = proxy.getClass().getDeclaredField(FIELD_PROXIED_INSTANCE);
+ delegateField.setAccessible(true);
+ delegateField.set(proxy, instance);
+
+ Field invocationHandlerField = proxy.getClass().getDeclaredField(FIELD_INTERCEPTOR_HANDLER);
+ invocationHandlerField.setAccessible(true);
+ invocationHandlerField.set(proxy, interceptorDecoratorStack);
+
+ return proxy;
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new ProxyGenerationException(e);
+ }
+ catch (NoSuchFieldException e)
+ {
+ throw new ProxyGenerationException(e);
+ }
+ }
+
+ /**
+ * @return the internal instance which gets proxied.
+ */
+ public static <T> T unwrapInstance(T proxyInstance)
+ {
+ try
+ {
+ if (proxyInstance instanceof OwbInterceptorProxy)
+ {
+ Field internalInstanceField = proxyInstance.getClass().getDeclaredField(FIELD_PROXIED_INSTANCE);
+ internalInstanceField.setAccessible(true);
+ return (T) internalInstanceField.get(proxyInstance);
+ }
+ else
+ {
+ return proxyInstance;
+ }
+ }
+ catch (Exception e)
+ {
+ throw ExceptionUtil.throwAsRuntimeException(e);
+ }
+ }
+
+ /**
+ * @return the internal instance which gets proxied.
+ */
+ public InterceptorHandler getInterceptorHandler(OwbInterceptorProxy proxyInstance)
+ {
+ try
+ {
+ Field internalInstanceField = proxyInstance.getClass().getDeclaredField(FIELD_INTERCEPTOR_HANDLER);
+ internalInstanceField.setAccessible(true);
+ return (InterceptorHandler) internalInstanceField.get(proxyInstance);
+ }
+ catch (Exception e)
+ {
+ throw ExceptionUtil.throwAsRuntimeException(e);
+ }
+ }
+
+ /**
+ * <p>Create a decorator and interceptor proxy for the given type. A single instance
+ * of such a proxy class has exactly one single internal instance.</p>
+ *
+ * <p>There are 3 different kind of methods:
+ * <ol>
+ * <li>
+ * private methods - they do not get proxied at all! If you like to invoke a private method,
+ * then you can use {@link #unwrapInstance(Object)} and use reflection on it.
+ * </li>
+ * <li>
+ * non-proxied methods - all methods which do not have a business interceptor nor decorator
+ * will get delegated to the internal instance without invoking any InterceptorHandler nor
+ * doing reflection. Just plain java bytecode will get generated!
+ * </li>
+ * <li>
+ * proxied methods - all calls to such a proxied method will get forwarded to the
+ * InterceptorHandler which got set for this instance.
+ * </li>
+ * </ol>
+ * </p>
+ *
+ *
+ * @param bean the bean the proxy serves for. Needed for caching and serialisation.
+ * @param classLoader to use for creating the class in
+ * @param classToProxy the class for which a subclass will get generated
+ * @param interceptedMethods the list of intercepted or decorated business methods.
+ * @param nonInterceptedMethods all methods which are <b>not</b> intercepted nor decorated and shall get delegated directly
+ * @param <T>
+ * @return the proxy class
+ */
+ public synchronized <T> Class<T> createProxyClass(Bean<T> bean, ClassLoader classLoader, Class<T> classToProxy,
+ Method[] interceptedMethods, Method[] nonInterceptedMethods)
+ throws ProxyGenerationException
+ {
+ String proxyClassName = getUnusedProxyClassName(classLoader, classToProxy.getName() + "$$OwbInterceptProxy");
+
+
+ Class<T> clazz = createProxyClass(classLoader, proxyClassName, classToProxy, interceptedMethods, nonInterceptedMethods);
+
+ try
+ {
+ Field interceptedMethodsField = clazz.getDeclaredField(FIELD_INTERCEPTED_METHODS);
+ interceptedMethodsField.setAccessible(true);
+ interceptedMethodsField.set(null, interceptedMethods);
+ }
+ catch (Exception e)
+ {
+ throw new ProxyGenerationException(e);
+ }
+
+ cachedProxyClasses.put(bean, clazz);
+
+ return clazz;
+ }
+
+ public <T> Class<T> getCachedProxyClass(Bean<T> bean)
+ {
+ return (Class<T>) cachedProxyClasses.get(bean);
+ }
+
+ @Override
+ protected Class getMarkerInterface()
+ {
+ return OwbInterceptorProxy.class;
+ }
+
+ @Override
+ protected void createInstanceVariables(ClassWriter cw, Class<?> classToProxy, String classFileName)
+ {
+ // variable #1, the delegation point
+ cw.visitField(Opcodes.ACC_PRIVATE,
+ FIELD_PROXIED_INSTANCE, Type.getDescriptor(classToProxy), null, null).visitEnd();
+
+ // variable #2, the invocation handler
+ cw.visitField(Opcodes.ACC_PRIVATE,
+ FIELD_INTERCEPTOR_HANDLER, Type.getDescriptor(InterceptorHandler.class), null, null).visitEnd();
+
+ // variable #3, the Method[] of all intercepted methods.
+ cw.visitField(Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC,
+ FIELD_INTERCEPTED_METHODS, Type.getDescriptor(Method[].class), null, null).visitEnd();
+ }
+
+ @Override
+ protected void createSerialisation(ClassWriter cw, String proxyClassFileName, Class<?> classToProxy, String classFileName)
+ {
+ String[] exceptionTypeNames = {Type.getType(ObjectStreamException.class).getInternalName()};
+ MethodVisitor mv = cw.visitMethod(Modifier.PUBLIC, "writeReplace", "()Ljava/lang/Object;", null, exceptionTypeNames);
+
+ // fill method body
+ mv.visitCode();
+
+ // load the contextual instance Provider
+ mv.visitVarInsn(Opcodes.ALOAD, 0);
+ mv.visitFieldInsn(Opcodes.GETFIELD, proxyClassFileName, FIELD_INTERCEPTOR_HANDLER, Type.getDescriptor(InterceptorHandler.class));
+
+ mv.visitInsn(Opcodes.ARETURN);
+
+ mv.visitMaxs(-1, -1);
+ mv.visitEnd();
+ }
+
+
+ /**
+ * Each of our interceptor/decorator proxies has exactly 1 constructor
+ * which invokes the super ct + sets the delegation field.
+ *
+ * @param cw
+ * @param classToProxy
+ * @param classFileName
+ * @throws ProxyGenerationException
+ */
+ @Override
+ protected void createConstructor(ClassWriter cw, String proxyClassFileName, Class<?> classToProxy, String classFileName)
+ throws ProxyGenerationException
+ {
+ // was: final String descriptor = Type.getConstructorDescriptor(classToProxy.getDeclaredConstructor());
+ // but we need to get a default constructor even if the bean uses constructor injection
+ final MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "<init>", "()V", null, null);
+ mv.visitCode();
+ mv.visitVarInsn(Opcodes.ALOAD, 0);
+ mv.visitMethodInsn(Opcodes.INVOKESPECIAL, classFileName, "<init>", "()V", false);
+
+ mv.visitVarInsn(Opcodes.ALOAD, 0);
+ mv.visitInsn(Opcodes.ACONST_NULL);
+ mv.visitFieldInsn(Opcodes.PUTFIELD, proxyClassFileName, FIELD_PROXIED_INSTANCE, Type.getDescriptor(classToProxy));
+
+ mv.visitVarInsn(Opcodes.ALOAD, 0);
+ mv.visitInsn(Opcodes.ACONST_NULL);
+ mv.visitFieldInsn(Opcodes.PUTFIELD, proxyClassFileName, FIELD_INTERCEPTOR_HANDLER, Type.getDescriptor(InterceptorHandler.class));
+
+ mv.visitInsn(Opcodes.RETURN);
+ mv.visitMaxs(-1, -1);
+ mv.visitEnd();
+
+ }
+
+ /**
+ * Directly delegate all non intercepted nor decorated methods to the internal instance.
+ *
+ * @param noninterceptedMethods all methods which are neither intercepted nor decorated
+ */
+ @Override
+ protected void delegateNonInterceptedMethods(ClassLoader classLoader, ClassWriter cw, String proxyClassFileName, Class<?> classToProxy, Method[] noninterceptedMethods)
+ {
+ for (Method delegatedMethod : noninterceptedMethods)
+ {
+ if (unproxyableMethod(delegatedMethod))
+ {
+ continue;
+ }
+
+ final int modifiers = delegatedMethod.getModifiers();
+ if (Modifier.isProtected(modifiers)
+ && !delegatedMethod.getDeclaringClass().getPackage().getName()
+ .equals(classToProxy.getPackage().getName()))
+ {
+ continue;
+ }
+
+ String methodDescriptor = Type.getMethodDescriptor(delegatedMethod);
+
+ //X TODO handle generic exception types?
+ Class[] exceptionTypes = delegatedMethod.getExceptionTypes();
+ String[] exceptionTypeNames = new String[exceptionTypes.length];
+ for (int i = 0; i < exceptionTypes.length; i++)
+ {
+ exceptionTypeNames[i] = Type.getType(exceptionTypes[i]).getInternalName();
+ }
+
+ int targetModifiers = modifiers & (Modifier.PROTECTED | Modifier.PUBLIC);
+
+ MethodVisitor mv = cw.visitMethod(targetModifiers, delegatedMethod.getName(), methodDescriptor, null, exceptionTypeNames);
+
+ // fill method body
+ mv.visitCode();
+
+ // load the delegate variable
+ mv.visitVarInsn(Opcodes.ALOAD, 0);
+ mv.visitFieldInsn(Opcodes.GETFIELD, proxyClassFileName, FIELD_PROXIED_INSTANCE, Type.getDescriptor(classToProxy));
+
+ int offset = 1;
+ for (Class<?> aClass : delegatedMethod.getParameterTypes())
+ {
+ final Type type = Type.getType(aClass);
+ mv.visitVarInsn(type.getOpcode(Opcodes.ILOAD), offset);
+ offset += type.getSize();
+ }
+
+ final Type declaringClass = Type.getType(delegatedMethod.getDeclaringClass());
+ mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, declaringClass.getInternalName(), delegatedMethod.getName(), methodDescriptor, false);
+
+ generateReturn(mv, delegatedMethod);
+
+ mv.visitMaxs(-1, -1);
+
+ mv.visitEnd();
+ }
+ }
+
+ @Override
+ protected void delegateInterceptedMethods(ClassLoader classLoader, ClassWriter cw, String proxyClassFileName, Class<?> classToProxy, Method[] interceptedMethods)
+ throws ProxyGenerationException
+ {
+ for (int i = 0; i < interceptedMethods.length; i++)
+ {
+ Method proxiedMethod = interceptedMethods[i];
+ generateInterceptorHandledMethod(cw, proxiedMethod, i, classToProxy, proxyClassFileName);
+ }
+ }
+
+ private void generateInterceptorHandledMethod(ClassWriter cw, Method method, int methodIndex, Class<?> classToProxy, String proxyClassFileName)
+ throws ProxyGenerationException
+ {
+ if ("<init>".equals(method.getName()))
+ {
+ return;
+ }
+
+ final Class<?> returnType = method.getReturnType();
+ final Class<?>[] parameterTypes = method.getParameterTypes();
+ final Class<?>[] exceptionTypes = method.getExceptionTypes();
+ final int modifiers = method.getModifiers();
+
+ if (Modifier.isFinal(modifiers) || Modifier.isStatic(modifiers))
+ {
+ throw new WebBeansConfigurationException("It's not possible to proxy a final or static method: " + classToProxy.getName() +
+ " " + method.getName());
+ }
+
+ // push the method definition
+ int modifier = modifiers & (Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED);
+
+ MethodVisitor mv = cw.visitMethod(modifier, method.getName(), Type.getMethodDescriptor(method), null, null);
+ mv.visitCode();
+
+ // push try/catch block, to catch declared exceptions, and to catch java.lang.Throwable
+ final Label l0 = new Label();
+ final Label l1 = new Label();
+ final Label l2 = new Label();
+
+ if (exceptionTypes.length > 0)
+ {
+ mv.visitTryCatchBlock(l0, l1, l2, "java/lang/reflect/InvocationTargetException");
+ }
+
+ // push try code
+ mv.visitLabel(l0);
+ final String classNameToOverride = method.getDeclaringClass().getName().replace('.', '/');
+ mv.visitLdcInsn(Type.getType("L" + classNameToOverride + ";"));
+
+ // the following code generates the bytecode for this line of Java:
+ // Method method = <proxy>.class.getMethod("add", new Class[] { <array of function argument classes> });
+
+ // get the method name to invoke, and push to stack
+ mv.visitLdcInsn(method.getName());
+
+ // create the Class[]
+ createArrayDefinition(mv, parameterTypes.length, Class.class);
+
+ int length = 1;
+
+ // push parameters into array
+ for (int i = 0; i < parameterTypes.length; i++)
+ {
+ // keep copy of array on stack
+ mv.visitInsn(Opcodes.DUP);
+
+ final Class<?> parameterType = parameterTypes[i];
+
+ // push number onto stack
+ pushIntOntoStack(mv, i);
+
+ if (parameterType.isPrimitive())
+ {
+ String wrapperType = getWrapperType(parameterType);
+ mv.visitFieldInsn(Opcodes.GETSTATIC, wrapperType, "TYPE", "Ljava/lang/Class;");
+ }
+ else
+ {
+ mv.visitLdcInsn(Type.getType(parameterType));
+ }
+
+ mv.visitInsn(Opcodes.AASTORE);
+
+ if (Long.TYPE.equals(parameterType) || Double.TYPE.equals(parameterType))
+ {
+ length += 2;
+ }
+ else
+ {
+ length++;
+ }
+ }
+
+ // the following code generates bytecode equivalent to:
+ // return ((<returntype>) invocationHandler.invoke(this, {methodIndex}, new Object[] { <function arguments }))[.<primitive>Value()];
+
+ final Label l4 = new Label();
+ mv.visitLabel(l4);
+
+ mv.visitVarInsn(Opcodes.ALOAD, 0);
+
+ // get the invocationHandler field from this class
+ mv.visitFieldInsn(Opcodes.GETFIELD, proxyClassFileName, FIELD_INTERCEPTOR_HANDLER, Type.getDescriptor(InterceptorHandler.class));
+
+ // add the Method from the static array as first parameter
+ mv.visitFieldInsn(Opcodes.GETSTATIC, proxyClassFileName, FIELD_INTERCEPTED_METHODS, Type.getDescriptor(Method[].class));
+
+ // push the methodIndex of the current method
+ if (methodIndex <128)
+ {
+ mv.visitIntInsn(Opcodes.BIPUSH, methodIndex);
+ }
+ else if (methodIndex < 32267)
+ {
+ // for methods > 127 we need to push a short number as index
+ mv.visitIntInsn(Opcodes.SIPUSH, methodIndex);
+ }
+ else
+ {
+ throw new ProxyGenerationException("Sorry, we only support Classes with 2^15 methods...");
+ }
+
+ // and now load the Method from the array
+ mv.visitInsn(Opcodes.AALOAD);
+
+
+ // prepare the parameter array as Object[] and store it on the stack
+ pushMethodParameterArray(mv, parameterTypes);
+
+
+ // invoke the invocationHandler
+ mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(InterceptorHandler.class), "invoke",
+ "(Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;", true);
+
+ // cast the result
+ mv.visitTypeInsn(Opcodes.CHECKCAST, getCastType(returnType));
+
+ if (returnType.isPrimitive() && (!Void.TYPE.equals(returnType)))
+ {
+ // get the primitive value
+ mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, getWrapperType(returnType), getPrimitiveMethod(returnType),
+ "()" + Type.getDescriptor(returnType), false);
+ }
+
+ // push return
+ mv.visitLabel(l1);
+ if (!Void.TYPE.equals(returnType))
+ {
+ mv.visitInsn(getReturnInsn(returnType));
+ }
+ else
+ {
+ mv.visitInsn(Opcodes.POP);
+ mv.visitInsn(Opcodes.RETURN);
+ }
+
+ // catch InvocationTargetException
+ if (exceptionTypes.length > 0)
+ {
+ mv.visitLabel(l2);
+ mv.visitVarInsn(Opcodes.ASTORE, length);
+
+ final Label l5 = new Label();
+ mv.visitLabel(l5);
+
+ for (int i = 0; i < exceptionTypes.length; i++)
+ {
+ final Class<?> exceptionType = exceptionTypes[i];
+
+ mv.visitLdcInsn(Type.getType("L" + exceptionType.getCanonicalName().replace('.', '/') + ";"));
+ mv.visitVarInsn(Opcodes.ALOAD, length);
+ mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/reflect/InvocationTargetException", "getCause",
+ "()Ljava/lang/Throwable;", false);
+ mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/Object", "getClass", "()Ljava/lang/Class;", false);
+ mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/Object", "equals", "(Ljava/lang/Object;)Z", false);
+
+ final Label l6 = new Label();
+ mv.visitJumpInsn(Opcodes.IFEQ, l6);
+
+ final Label l7 = new Label();
+ mv.visitLabel(l7);
+
+ mv.visitVarInsn(Opcodes.ALOAD, length);
+ mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/reflect/InvocationTargetException", "getCause",
+ "()Ljava/lang/Throwable;", false);
+ mv.visitTypeInsn(Opcodes.CHECKCAST, getCastType(exceptionType));
+ mv.visitInsn(Opcodes.ATHROW);
+ mv.visitLabel(l6);
+
+ if (i == (exceptionTypes.length - 1))
+ {
+ mv.visitTypeInsn(Opcodes.NEW, "java/lang/reflect/UndeclaredThrowableException");
+ mv.visitInsn(Opcodes.DUP);
+ mv.visitVarInsn(Opcodes.ALOAD, length);
+ mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/reflect/UndeclaredThrowableException", "<init>",
+ "(Ljava/lang/Throwable;)V", false);
+ mv.visitInsn(Opcodes.ATHROW);
+ }
+ }
+ }
+
+ // finish this method
+ mv.visitMaxs(0, 0);
+ mv.visitEnd();
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorHandler.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorHandler.java
new file mode 100644
index 0000000..2ea0078
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorHandler.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.proxy;
+
+import java.lang.reflect.Method;
+
+/**
+ * An InterceptorHandler can be used to dynamically invoke methods on
+ * an internally stored target instance.
+ */
+public interface InterceptorHandler
+{
+
+ /**
+ * This method will get called whenever the proxy
+ * of the intercepted instance will get invoked.
+ * @param method Method which should get invoked
+ * @param args original invocation parameters
+ * @return the return value of the intercepted methos
+ */
+ public Object invoke(Method method, Object[] args);
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/NormalScopeProxyFactory.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/NormalScopeProxyFactory.java
new file mode 100644
index 0000000..e7f9ac7
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/NormalScopeProxyFactory.java
@@ -0,0 +1,530 @@
+/*
+ * 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.webbeans.proxy;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Provider;
+import java.io.ObjectStreamException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import org.apache.webbeans.component.OwbBean;
+import org.apache.webbeans.config.OpenWebBeansConfiguration;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler;
+import org.apache.webbeans.util.ClassUtil;
+import org.apache.webbeans.util.ExceptionUtil;
+import org.apache.webbeans.util.WebBeansUtil;
+import org.apache.xbean.asm5.ClassWriter;
+import org.apache.xbean.asm5.MethodVisitor;
+import org.apache.xbean.asm5.Opcodes;
+import org.apache.xbean.asm5.Type;
+
+/**
+ * This factory creates proxies which delegate the
+ * method invocations 1:1 to an instance which gets
+ * resolved via a {@link javax.inject.Provider}.
+ */
+public class NormalScopeProxyFactory extends AbstractProxyFactory
+{
+ /** the name of the field which stores the {@link Provider} for the Contextual Instance */
+ public static final String FIELD_INSTANCE_PROVIDER = "owbContextualInstanceProvider";
+
+ /** the Method[] for all protected methods. We need to invoke them via reflection. */
+ public static final String FIELD_PROTECTED_METHODS = "owbProtectedMethods";
+
+ /**
+ * Caches the proxy classes for each bean.
+ * We need this to prevent filling up the ClassLoaders by
+ */
+ private ConcurrentMap<Bean<?>, Class<?>> cachedProxyClasses = new ConcurrentHashMap<Bean<?>, Class<?>>();
+
+
+ public NormalScopeProxyFactory(WebBeansContext webBeansContext)
+ {
+ super(webBeansContext);
+ }
+
+ @Override
+ protected Class getMarkerInterface()
+ {
+ return OwbNormalScopeProxy.class;
+ }
+
+
+ public static <T> T unwrapInstance(T proxyInstance)
+ {
+ if (proxyInstance instanceof OwbNormalScopeProxy)
+ {
+ try
+ {
+ Field internalInstanceField = proxyInstance.getClass().getDeclaredField(FIELD_INSTANCE_PROVIDER);
+ internalInstanceField.setAccessible(true);
+ Provider<T> provider = (Provider<T>) internalInstanceField.get(proxyInstance);
+ return provider.get();
+ }
+ catch (Exception e)
+ {
+ throw ExceptionUtil.throwAsRuntimeException(e);
+ }
+ }
+
+ return proxyInstance;
+ }
+
+ /**
+ * @return the internal instance which gets proxied.
+ */
+ public Provider getInstanceProvider(OwbNormalScopeProxy proxyInstance)
+ {
+ try
+ {
+ Field internalInstanceField = proxyInstance.getClass().getDeclaredField(FIELD_INSTANCE_PROVIDER);
+ internalInstanceField.setAccessible(true);
+ return (Provider) internalInstanceField.get(proxyInstance);
+ }
+ catch (Exception e)
+ {
+ throw ExceptionUtil.throwAsRuntimeException(e);
+ }
+ }
+
+ public <T> T createNormalScopeProxy(Bean<T> bean)
+ {
+ final ClassLoader classLoader;
+ if (bean.getBeanClass() != null)
+ {
+ classLoader = bean.getBeanClass().getClassLoader();
+ }
+ else if (OwbBean.class.isInstance(bean) && OwbBean.class.cast(bean).getReturnType() != null)
+ {
+ classLoader = OwbBean.class.cast(bean).getReturnType().getClassLoader();
+ }
+ else
+ {
+ classLoader = WebBeansUtil.getCurrentClassLoader();
+ }
+
+ Class<T> classToProxy;
+ if (bean instanceof OwbBean)
+ {
+ classToProxy = ((OwbBean<T>) bean).getReturnType();
+ }
+ else
+ {
+ // TODO: that might be wrong sometimes
+ classToProxy = (Class<T>) bean.getBeanClass();
+ }
+
+ Class<? extends T> proxyClass = (Class<? extends T>) cachedProxyClasses.get(bean);
+
+ if (proxyClass == null)
+ {
+ proxyClass = createProxyClass(bean, classLoader, classToProxy);
+ }
+
+ return createProxyInstance(proxyClass, getInstanceProvider(classLoader, bean));
+ }
+
+ public Provider getInstanceProvider(ClassLoader classLoader, Bean<?> bean)
+ {
+ String scopeClassName = bean.getScope().getName();
+ Class<? extends Provider> instanceProviderClass = null;
+ String proxyMappingConfigKey = OpenWebBeansConfiguration.PROXY_MAPPING_PREFIX + scopeClassName;
+ String className = webBeansContext.getOpenWebBeansConfiguration().getProperty(proxyMappingConfigKey);
+ if (className == null || NormalScopedBeanInterceptorHandler.class.getName().equals(className))
+ {
+ return new NormalScopedBeanInterceptorHandler(webBeansContext.getBeanManagerImpl(), bean);
+ }
+
+ try
+ {
+ instanceProviderClass = (Class<? extends Provider>) Class.forName(className, true, classLoader);
+ Constructor<?> ct = instanceProviderClass.getConstructor(BeanManager.class, Bean.class);
+ return (Provider) ct.newInstance(webBeansContext.getBeanManagerImpl(), bean);
+ }
+ catch (NoSuchMethodException nsme)
+ {
+ throw new WebBeansConfigurationException("Configured InterceptorHandler " + className +" has wrong constructor" , nsme);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new WebBeansConfigurationException("Configured InterceptorHandler " + className +" cannot be found", e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new WebBeansConfigurationException("Configured InterceptorHandler " + className +" creation exception", e);
+ }
+ catch (InstantiationException e)
+ {
+ throw new WebBeansConfigurationException("Configured InterceptorHandler " + className +" creation exception", e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new WebBeansConfigurationException("Configured InterceptorHandler " + className +" creation exception", e);
+ }
+ }
+
+ public synchronized <T> Class<T> createProxyClass(Bean<T> bean, ClassLoader classLoader, Class<T> classToProxy)
+ {
+ Class<T> proxyClass = (Class<T>) cachedProxyClasses.get(bean);
+
+ if (proxyClass == null)
+ {
+ proxyClass = createProxyClass(classLoader, classToProxy);
+ cachedProxyClasses.putIfAbsent(bean, proxyClass);
+ }
+
+ return proxyClass;
+ }
+
+ @Override
+ protected void createSerialisation(ClassWriter cw, String proxyClassFileName, Class<?> classToProxy, String classFileName)
+ {
+ String[] exceptionTypeNames = {Type.getType(ObjectStreamException.class).getInternalName()};
+ MethodVisitor mv = cw.visitMethod(Modifier.PUBLIC, "writeReplace", "()Ljava/lang/Object;", null, exceptionTypeNames);
+
+ // fill method body
+ mv.visitCode();
+
+ // load the contextual instance Provider
+ mv.visitVarInsn(Opcodes.ALOAD, 0);
+ mv.visitFieldInsn(Opcodes.GETFIELD, proxyClassFileName, FIELD_INSTANCE_PROVIDER, Type.getDescriptor(Provider.class));
+
+ mv.visitInsn(Opcodes.ARETURN);
+
+ mv.visitMaxs(-1, -1);
+ mv.visitEnd();
+ }
+
+ /**
+ * @param classLoader to use for creating the class in
+ * @param classToProxy the class for which a subclass will get generated
+ * @param <T>
+ * @return the proxy class
+ */
+ public <T> Class<T> createProxyClass(ClassLoader classLoader, Class<T> classToProxy)
+ throws ProxyGenerationException
+ {
+ String proxyClassName = getUnusedProxyClassName(classLoader, classToProxy.getName() + "$$OwbNormalScopeProxy");
+
+ Method[] nonInterceptedMethods;
+ Method[] interceptedMethods = null;
+ if (classToProxy.isInterface())
+ {
+ nonInterceptedMethods = classToProxy.getMethods();
+ }
+ else
+ {
+ List<Method> methods = new ArrayList<Method>();
+ List<Method> protectedMethods = new ArrayList<Method>();
+
+
+ for (Method method : ClassUtil.getNonPrivateMethods(classToProxy, true))
+ {
+ if (unproxyableMethod(method))
+ {
+ continue;
+ }
+ if (Modifier.isProtected(method.getModifiers()))
+ {
+ protectedMethods.add(method);
+ }
+ else
+ {
+ methods.add(method);
+ }
+ }
+
+ nonInterceptedMethods = methods.toArray(new Method[methods.size()]);
+ interceptedMethods = protectedMethods.toArray(new Method[protectedMethods.size()]);
+ }
+
+ Class<T> clazz = createProxyClass(classLoader, proxyClassName, classToProxy, interceptedMethods, nonInterceptedMethods);
+
+ if (interceptedMethods != null && interceptedMethods.length > 0)
+ {
+ try
+ {
+ Field protectedMethodsField = clazz.getDeclaredField(FIELD_PROTECTED_METHODS);
+ protectedMethodsField.setAccessible(true);
+ protectedMethodsField.set(null, interceptedMethods);
+ }
+ catch (Exception e)
+ {
+ throw new ProxyGenerationException(e);
+ }
+ }
+ return clazz;
+ }
+
+ public <T> T createProxyInstance(Class<T> proxyClass, Provider provider)
+ throws ProxyGenerationException
+ {
+ try
+ {
+ T proxy = unsafeNewInstance(proxyClass);
+
+ Field delegateField = proxy.getClass().getDeclaredField(FIELD_INSTANCE_PROVIDER);
+ delegateField.setAccessible(true);
+ delegateField.set(proxy, provider);
+
+ return proxy;
+ }
+ catch (Exception e)
+ {
+ throw new ProxyGenerationException(e);
+ }
+ }
+
+
+ @Override
+ protected void createConstructor(ClassWriter cw, String proxyClassFileName, Class<?> classToProxy, String classFileName) throws ProxyGenerationException
+ {
+ try
+ {
+ Constructor superDefaultCt;
+ String parentClassFileName;
+ if (classToProxy.isInterface())
+ {
+ parentClassFileName = Type.getInternalName(Object.class);
+ superDefaultCt = Object.class.getConstructor(null);
+ }
+ else
+ {
+ parentClassFileName = classFileName;
+ superDefaultCt = classToProxy.getDeclaredConstructor(null);
+ }
+
+ final String descriptor = Type.getConstructorDescriptor(superDefaultCt);
+ final MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "<init>", descriptor, null, null);
+ mv.visitCode();
+ mv.visitVarInsn(Opcodes.ALOAD, 0);
+ mv.visitMethodInsn(Opcodes.INVOKESPECIAL, parentClassFileName, "<init>", descriptor, false);
+
+ // the instance provider field
+ mv.visitVarInsn(Opcodes.ALOAD, 0);
+ mv.visitInsn(Opcodes.ACONST_NULL);
+ mv.visitFieldInsn(Opcodes.PUTFIELD, proxyClassFileName, FIELD_INSTANCE_PROVIDER, Type.getDescriptor(Provider.class));
+
+ mv.visitInsn(Opcodes.RETURN);
+ mv.visitMaxs(-1, -1);
+ mv.visitEnd();
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new ProxyGenerationException(e);
+ }
+ }
+
+ @Override
+ protected void createInstanceVariables(ClassWriter cw, Class<?> classToProxy, String classFileName)
+ {
+ // variable #1, the Provider<?> for the Contextual Instance
+ cw.visitField(Opcodes.ACC_PRIVATE,
+ FIELD_INSTANCE_PROVIDER, Type.getDescriptor(Provider.class), null, null).visitEnd();
+
+ // variable #2, the Method[] for all protected methods
+ cw.visitField(Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC,
+ FIELD_PROTECTED_METHODS, Type.getDescriptor(Method[].class), null, null).visitEnd();
+ }
+
+ /**
+ * In the NormalScope proxying case this is used for all the protected methods
+ * as they need to get invoked via reflection.
+ */
+ @Override
+ protected void delegateInterceptedMethods(ClassLoader classLoader, ClassWriter cw, String proxyClassFileName,
+ Class<?> classToProxy, Method[] interceptedMethods)
+ throws ProxyGenerationException
+ {
+ if (interceptedMethods == null)
+ {
+ return;
+ }
+
+ for (int i = 0; i < interceptedMethods.length; i++)
+ {
+ Method proxiedMethod = interceptedMethods[i];
+ generateDelegationMethod(cw, proxiedMethod, i, classToProxy, proxyClassFileName);
+ }
+ }
+
+ @Override
+ protected void delegateNonInterceptedMethods(ClassLoader classLoader, ClassWriter cw, String proxyClassFileName,
+ Class<?> classToProxy, Method[] noninterceptedMethods)
+ throws ProxyGenerationException
+ {
+
+ for (Method delegatedMethod : noninterceptedMethods)
+ {
+ String methodDescriptor = Type.getMethodDescriptor(delegatedMethod);
+
+ //X TODO handle generic exception types?
+ Class[] exceptionTypes = delegatedMethod.getExceptionTypes();
+ String[] exceptionTypeNames = new String[exceptionTypes.length];
+ for (int i = 0; i < exceptionTypes.length; i++)
+ {
+ exceptionTypeNames[i] = Type.getType(exceptionTypes[i]).getInternalName();
+ }
+
+ int targetModifiers = delegatedMethod.getModifiers() & (Modifier.PROTECTED | Modifier.PUBLIC);
+
+ MethodVisitor mv = cw.visitMethod(targetModifiers, delegatedMethod.getName(), methodDescriptor, null, exceptionTypeNames);
+
+ // fill method body
+ mv.visitCode();
+
+ // load the contextual instance Provider
+ mv.visitVarInsn(Opcodes.ALOAD, 0);
+ mv.visitFieldInsn(Opcodes.GETFIELD, proxyClassFileName, FIELD_INSTANCE_PROVIDER, Type.getDescriptor(Provider.class));
+
+ // invoke the get() method on the Provider
+ mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(Provider.class), "get", "()Ljava/lang/Object;", true);
+
+ // and convert the Object to the target class type
+ mv.visitTypeInsn(Opcodes.CHECKCAST, Type.getInternalName(classToProxy));
+
+
+ // now calculate the parameters
+ int offset = 1;
+ for (Class<?> aClass : delegatedMethod.getParameterTypes())
+ {
+ final Type type = Type.getType(aClass);
+ mv.visitVarInsn(type.getOpcode(Opcodes.ILOAD), offset);
+ offset += type.getSize();
+ }
+
+ // and finally invoke the target method on the provided Contextual Instance
+ final Type declaringClass = Type.getType(delegatedMethod.getDeclaringClass());
+ boolean interfaceMethod = Modifier.isInterface(delegatedMethod.getDeclaringClass().getModifiers());
+ mv.visitMethodInsn(interfaceMethod ? Opcodes.INVOKEINTERFACE : Opcodes.INVOKEVIRTUAL,
+ declaringClass.getInternalName(), delegatedMethod.getName(), methodDescriptor, interfaceMethod);
+
+ generateReturn(mv, delegatedMethod);
+
+ mv.visitMaxs(-1, -1);
+
+ mv.visitEnd();
+ }
+
+ }
+
+ private void generateDelegationMethod(ClassWriter cw, Method method, int methodIndex, Class<?> classToProxy, String proxyClassFileName)
+ {
+ final Class<?> returnType = method.getReturnType();
+ final Class<?>[] parameterTypes = method.getParameterTypes();
+ final int modifiers = method.getModifiers();
+
+ // push the method definition
+ int modifier = modifiers & (Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED);
+
+ MethodVisitor mv = cw.visitMethod(modifier, method.getName(), Type.getMethodDescriptor(method), null, null);
+ mv.visitCode();
+
+
+ mv.visitVarInsn(Opcodes.ALOAD, 0);
+
+ // add the Method from the static array as first parameter
+ mv.visitFieldInsn(Opcodes.GETSTATIC, proxyClassFileName, FIELD_PROTECTED_METHODS, Type.getDescriptor(Method[].class));
+
+ // push the methodIndex of the current method
+ mv.visitIntInsn(Opcodes.BIPUSH, methodIndex);
+
+ // and now load the Method from the array
+ mv.visitInsn(Opcodes.AALOAD);
+
+
+ // now invoke the get() on the contextual instance Provider<T>
+ mv.visitVarInsn(Opcodes.ALOAD, 0);
+ mv.visitFieldInsn(Opcodes.GETFIELD, proxyClassFileName, FIELD_INSTANCE_PROVIDER, Type.getDescriptor(Provider.class));
+
+ // invoke the get() method on the Provider
+ mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getInternalName(Provider.class), "get", "()Ljava/lang/Object;", true);
+
+
+ // prepare the parameter array as Object[] and store it on the stack
+ pushMethodParameterArray(mv, parameterTypes);
+
+
+ // this invokes NormalScopeProxyFactory.delegateProtectedMethod
+ mv.visitMethodInsn(Opcodes.INVOKESTATIC, Type.getInternalName(NormalScopeProxyFactory.class), "delegateProtectedMethod",
+ "(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;", false);
+
+ // cast the result
+ mv.visitTypeInsn(Opcodes.CHECKCAST, getCastType(returnType));
+
+
+ if (returnType.isPrimitive() && (!Void.TYPE.equals(returnType)))
+ {
+ // get the primitive value
+ mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, getWrapperType(returnType), getPrimitiveMethod(returnType),
+ "()" + Type.getDescriptor(returnType), false);
+ }
+
+ mv.visitInsn(getReturnInsn(returnType));
+
+ // finish this method
+ mv.visitMaxs(0, 0);
+ mv.visitEnd();
+ }
+
+
+
+ /**
+ * This method get invoked via generated ASM code.
+ * It delegates to the underlying protected Method so we don't need to do
+ * all the reflection stuff in our generated bytecode.
+ * This is needed as we cannot invoke instanceProvider.get().targetMethod() directly
+ * if targetMethod is protected. Please see Java LangSpec 6.6.2 about the complex
+ * rules for calling 'protected' methods.
+ *
+ * @see #generateDelegationMethod(org.apache.xbean.asm5.ClassWriter, java.lang.reflect.Method, int, Class, String)
+ */
+ @SuppressWarnings("unused")
+ public static Object delegateProtectedMethod(Method method, Object instance, Object[] params)
+ {
+ try
+ {
+ if (!method.isAccessible())
+ {
+ method.setAccessible(true);
+ }
+ return method.invoke(instance, params);
+ }
+ catch (InvocationTargetException ite)
+ {
+ throw ExceptionUtil.throwAsRuntimeException(ite.getCause());
+ }
+ catch (Exception e)
+ {
+ throw ExceptionUtil.throwAsRuntimeException(e);
+ }
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/OwbDecoratorProxy.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/OwbDecoratorProxy.java
new file mode 100644
index 0000000..e6c6b5f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/OwbDecoratorProxy.java
@@ -0,0 +1,29 @@
+/*
+ * 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.webbeans.proxy;
+
+
+import java.io.Serializable;
+
+/**
+ * <p>Interface for all OpenWebBeans abstract Decorator subclasses.
+ */
+public interface OwbDecoratorProxy extends Serializable
+{
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/OwbInterceptorProxy.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/OwbInterceptorProxy.java
new file mode 100644
index 0000000..1084768
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/OwbInterceptorProxy.java
@@ -0,0 +1,26 @@
+/*
+ * 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.webbeans.proxy;
+
+/**
+ * Marker Interface for all OpenWebBeans Interceptor+Decorator Proxies.
+ */
+public interface OwbInterceptorProxy
+{
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/OwbNormalScopeProxy.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/OwbNormalScopeProxy.java
new file mode 100644
index 0000000..b1e6a9b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/OwbNormalScopeProxy.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.proxy;
+
+
+import java.io.Serializable;
+
+/**
+ * <p>Interface for all OpenWebBeans {@link javax.enterprise.context.NormalScope} Proxies.
+ * A normalscoping proxy just resolves the underlying Contextual Instance
+ * and directly invokes the target method onto it.</p>
+ *
+ * <p>Each <code>OwbNormalScopeProxy</code> contains a {@link javax.inject.Provider}
+ * which returns the current Contextual Instance.</p>
+ *
+ * <p>This interface extends Serializable because every NormalScoped bean proxy must
+ * be Serializable!</p>
+ */
+public interface OwbNormalScopeProxy extends Serializable
+{
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyGenerationException.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyGenerationException.java
new file mode 100644
index 0000000..1b31a53
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyGenerationException.java
@@ -0,0 +1,46 @@
+/*
+ * 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.webbeans.proxy;
+
+/**
+ * Exceptions which might happen during proxy creation.
+ */
+public class ProxyGenerationException extends RuntimeException
+{
+ public ProxyGenerationException()
+ {
+ super();
+ }
+
+ public ProxyGenerationException(String message)
+ {
+ super(message);
+ }
+
+ public ProxyGenerationException(Throwable cause)
+ {
+ super(cause);
+ }
+
+ public ProxyGenerationException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+}
+
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/SubclassProxyFactory.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/SubclassProxyFactory.java
new file mode 100644
index 0000000..c33c04e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/SubclassProxyFactory.java
@@ -0,0 +1,228 @@
+/*
+ * 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.webbeans.proxy;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.List;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.util.ClassUtil;
+import org.apache.xbean.asm5.ClassWriter;
+import org.apache.xbean.asm5.MethodVisitor;
+import org.apache.xbean.asm5.Opcodes;
+import org.apache.xbean.asm5.Type;
+
+/**
+ * This factory creates subclasses for abstract classes.
+ * This is being used for Abstract Decorators.
+ */
+public class SubclassProxyFactory extends AbstractProxyFactory
+{
+
+ public SubclassProxyFactory(WebBeansContext webBeansContext)
+ {
+ super(webBeansContext);
+ }
+
+ @Override
+ protected Class getMarkerInterface()
+ {
+ return OwbDecoratorProxy.class;
+ }
+
+
+ public <T> Class<T> createImplementedSubclass(ClassLoader classLoader, Class<T> classToProxy)
+ {
+ if (!Modifier.isAbstract(classToProxy.getModifiers()))
+ {
+ throw new WebBeansConfigurationException("Only abstract classes should get subclassed, not " + classToProxy);
+ }
+
+
+ Class<T> proxyClass = tryToLoadClass(classLoader, classToProxy);
+ if (proxyClass != null)
+ {
+ return proxyClass;
+ }
+
+ proxyClass = createSubClass(classLoader, classToProxy);
+
+ return proxyClass;
+ }
+
+ private <T> Class<T> tryToLoadClass(ClassLoader classLoader, Class<T> classToProxy)
+ {
+ String proxyClassName = getSubClassName(classToProxy);
+ try
+ {
+ // if the class is already registered, then use this one.
+ return (Class<T>) Class.forName(proxyClassName, true, classLoader);
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ // this means we need to generate that class
+ }
+ return null;
+ }
+
+ private <T> String getSubClassName(Class<T> classToProxy)
+ {
+ return fixPreservedPackages(classToProxy.getName() + "$$OwbSubClass");
+ }
+
+ /**
+ * @param classLoader to use for creating the class in
+ * @param classToProxy the class for which a subclass will get generated
+ * @param <T>
+ * @return the proxy class
+ */
+ public synchronized <T> Class<T> createSubClass(ClassLoader classLoader, Class<T> classToProxy)
+ throws ProxyGenerationException
+ {
+ Class<T> clazz = tryToLoadClass(classLoader, classToProxy);
+ if (clazz != null)
+ {
+ return clazz;
+ }
+
+ String proxyClassName = getSubClassName(classToProxy);
+
+ List<Method> methods = ClassUtil.getNonPrivateMethods(classToProxy, true);
+ Method[] businessMethods = methods.toArray(new Method[methods.size()]);
+
+ clazz = createProxyClass(classLoader, proxyClassName, classToProxy, businessMethods, new Method[0]);
+
+ return clazz;
+ }
+
+
+ @Override
+ protected void createConstructor(ClassWriter cw, String proxyClassFileName, Class<?> classToProxy, String classFileName) throws ProxyGenerationException
+ {
+ try
+ {
+ Constructor superDefaultCt;
+ String parentClassFileName;
+ if (classToProxy.isInterface())
+ {
+ parentClassFileName = Type.getInternalName(Object.class);
+ superDefaultCt = Object.class.getConstructor(null);
+ }
+ else
+ {
+ parentClassFileName = classFileName;
+ superDefaultCt = classToProxy.getConstructor(null);
+ }
+
+ final String descriptor = Type.getConstructorDescriptor(superDefaultCt);
+ final MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "<init>", descriptor, null, null);
+ mv.visitCode();
+ mv.visitVarInsn(Opcodes.ALOAD, 0);
+ mv.visitMethodInsn(Opcodes.INVOKESPECIAL, parentClassFileName, "<init>", descriptor, false);
+
+ mv.visitInsn(Opcodes.RETURN);
+ mv.visitMaxs(-1, -1);
+ mv.visitEnd();
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new ProxyGenerationException(e);
+ }
+ }
+
+ @Override
+ protected void createInstanceVariables(ClassWriter cw, Class<?> classToProxy, String classFileName)
+ {
+ }
+
+ @Override
+ protected void delegateInterceptedMethods(ClassLoader classLoader, ClassWriter cw, String proxyClassFileName, Class<?> classToProxy,
+ Method[] interceptedMethods) throws ProxyGenerationException
+ {
+ }
+
+ @Override
+ protected void createSerialisation(ClassWriter cw, String proxyClassFileName, Class<?> classToProxy, String classFileName)
+ {
+ // nothing to do ;)
+ }
+
+ @Override
+ protected void delegateNonInterceptedMethods(ClassLoader classLoader, ClassWriter cw, String proxyClassFileName, Class<?> classToProxy,
+ Method[] noninterceptedMethods) throws ProxyGenerationException
+ {
+ for (Method delegatedMethod : noninterceptedMethods)
+ {
+ if (unproxyableMethod(delegatedMethod))
+ {
+ continue;
+ }
+
+ String methodDescriptor = Type.getMethodDescriptor(delegatedMethod);
+
+ //X TODO handle generic exception types?
+ Class[] exceptionTypes = delegatedMethod.getExceptionTypes();
+ String[] exceptionTypeNames = new String[exceptionTypes.length];
+ for (int i = 0; i < exceptionTypes.length; i++)
+ {
+ exceptionTypeNames[i] = Type.getType(exceptionTypes[i]).getInternalName();
+ }
+
+ int targetModifiers = delegatedMethod.getModifiers() & (Modifier.PROTECTED | Modifier.PUBLIC);
+
+ MethodVisitor mv = cw.visitMethod(targetModifiers, delegatedMethod.getName(), methodDescriptor, null, exceptionTypeNames);
+
+ // fill method body
+ mv.visitCode();
+
+ boolean abstractMethod = Modifier.isAbstract(delegatedMethod.getModifiers());
+
+ // now calculate the parameters
+ int offset = 1;
+ for (Class<?> aClass : delegatedMethod.getParameterTypes())
+ {
+ final Type type = Type.getType(aClass);
+ mv.visitVarInsn(type.getOpcode(Opcodes.ILOAD), offset);
+ offset += type.getSize();
+ }
+
+ // and finally invoke the target method on the provided Contextual Instance
+ final Type declaringClass = Type.getType(delegatedMethod.getDeclaringClass());
+ if (abstractMethod)
+ {
+ // generate an empty return block
+ }
+ else
+ {
+ // invoke the method on the super class;
+ mv.visitMethodInsn(Opcodes.INVOKESPECIAL, declaringClass.getInternalName(), delegatedMethod.getName(), methodDescriptor, false);
+ }
+
+ generateReturn(mv, delegatedMethod);
+
+ mv.visitMaxs(-1, -1);
+
+ mv.visitEnd();
+ }
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/service/DefaultLoaderService.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/service/DefaultLoaderService.java
new file mode 100644
index 0000000..86e1700
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/service/DefaultLoaderService.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.service;
+
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.spi.LoaderService;
+import org.apache.webbeans.util.WebBeansUtil;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ServiceLoader;
+import java.util.logging.Logger;
+
+/**
+ * Default implementation which delegates to the s{@link ServiceLoader} of Java 1.6 and
+ * uses a fallback for Java 1.5
+ */
+public class DefaultLoaderService implements LoaderService
+{
+ private static final Logger logger = WebBeansLoggerFacade.getLogger(DefaultLoaderService.class);
+
+ private static final boolean JAVA_6_AVAILABLE = isJava6();
+
+ @Override
+ public <T> List<T> load(Class<T> serviceType)
+ {
+ return load(serviceType, WebBeansUtil.getCurrentClassLoader());
+ }
+
+ @Override
+ public <T> List<T> load(Class<T> serviceType, ClassLoader classLoader)
+ {
+ if(JAVA_6_AVAILABLE)
+ {
+ List<T> result = new ArrayList<T>();
+ ServiceLoader<T> services = ServiceLoader.load(serviceType, classLoader);
+
+ for (T service : services)
+ {
+ result.add(service);
+ }
+
+ return result;
+ }
+
+ return new ManualImplementationLoaderService<T>(serviceType, classLoader).loadServiceImplementations();
+ }
+
+ private static boolean isJava6()
+ {
+ try
+ {
+ ServiceLoader.class.getName();
+ return true;
+ }
+ catch (NoClassDefFoundError error)
+ {
+ logger.info("Using Java 5 compatibility mode, because didn't find ServiceLoader: " + error);
+ return false;
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/service/ManualImplementationLoaderService.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/service/ManualImplementationLoaderService.java
new file mode 100644
index 0000000..4123e0e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/service/ManualImplementationLoaderService.java
@@ -0,0 +1,228 @@
+/*
+ * 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.webbeans.service;
+
+import org.apache.webbeans.util.ClassUtil;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.lang.reflect.Constructor;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.List;
+
+/**
+ * Manual service loader as fallback for Java 1.5
+ */
+class ManualImplementationLoaderService<T>
+{
+ private static final String SERVICE_CONFIG = "META-INF/services/";
+ private static final String FILE_ENCODING = "UTF-8";
+
+ protected List<Class<?>> foundServiceClasses = new ArrayList<Class<?>>();
+ private Class<T> serviceType;
+ private ClassLoader currentClassLoader;
+
+ ManualImplementationLoaderService(Class<T> serviceType, ClassLoader currentClassLoader)
+ {
+ this.serviceType = serviceType;
+ this.currentClassLoader = currentClassLoader;
+ }
+
+ List<T> loadServiceImplementations()
+ {
+ List<Class<?>> result = resolveServiceImplementations();
+
+ if (result == null)
+ {
+ return Collections.emptyList();
+ }
+
+ List<T> foundServices = new ArrayList<T>();
+
+ for (Class<?> serviceClass : result)
+ {
+ foundServices.add(createInstance(serviceClass));
+ }
+
+ return foundServices;
+ }
+
+ private List<Class<?>> resolveServiceImplementations()
+ {
+ for (URL configFile : getConfigFileList())
+ {
+ loadConfiguredServices(configFile);
+ }
+
+ return foundServiceClasses;
+ }
+
+ private List<URL> getConfigFileList()
+ {
+ List<URL> serviceFiles = new ArrayList<URL>();
+
+ try
+ {
+ Enumeration<URL> serviceFileEnumerator = currentClassLoader.getResources(getConfigFileLocation());
+
+ while (serviceFileEnumerator.hasMoreElements())
+ {
+ serviceFiles.add(serviceFileEnumerator.nextElement());
+ }
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException(
+ "Failed to load " + serviceType.getName() + " configured in " + getConfigFileLocation(), e);
+ }
+ return serviceFiles;
+ }
+
+ private String getConfigFileLocation()
+ {
+ return SERVICE_CONFIG + serviceType.getName();
+ }
+
+ private void loadConfiguredServices(URL serviceFile)
+ {
+ InputStream inputStream = null;
+
+ try
+ {
+ String serviceClassName;
+ inputStream = serviceFile.openStream();
+ BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, FILE_ENCODING));
+
+ while ((serviceClassName = bufferedReader.readLine()) != null)
+ {
+ serviceClassName = extractConfiguredServiceClassName(serviceClassName);
+ if (!"".equals(serviceClassName))
+ {
+ loadService(serviceClassName);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException("Failed to process service-config: " + serviceFile, e);
+ }
+ finally
+ {
+ if (inputStream != null)
+ {
+ try
+ {
+ inputStream.close();
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException("Failed to close " + serviceFile, e);
+ }
+ }
+ }
+ }
+
+ private String extractConfiguredServiceClassName(String currentConfigLine)
+ {
+ int startOfComment = currentConfigLine.indexOf('#');
+
+ if (startOfComment > -1)
+ {
+ currentConfigLine = currentConfigLine.substring(0, startOfComment);
+ }
+ return currentConfigLine.trim();
+ }
+
+ private void loadService(String serviceClassName)
+ {
+ Class<T> serviceClass = (Class<T>) loadClass(serviceClassName);
+
+ if (serviceClass != null && !foundServiceClasses.contains(serviceClass))
+ {
+ foundServiceClasses.add(serviceClass);
+ }
+ else if (serviceClass == null)
+ {
+ throw new IllegalStateException(serviceClassName + " couldn't be loaded. " +
+ "Please ensure that this class is in the classpath or remove the entry from "
+ + getConfigFileLocation() + ".");
+ }
+ }
+
+ private Class<? extends T> loadClass(String serviceClassName)
+ {
+ Class<?> targetClass = ClassUtil.getClassFromName(serviceClassName);
+
+ if (targetClass == null)
+ {
+ targetClass = loadClassForName(serviceClassName, currentClassLoader);
+
+ if (targetClass == null)
+ {
+ return null;
+ }
+ }
+
+ return targetClass.asSubclass(serviceType);
+ }
+
+ private static Class<?> loadClassForName(String serviceClassName, ClassLoader classLoader)
+ {
+ if (classLoader == null)
+ {
+ return null;
+ }
+
+ try
+ {
+ return classLoader.loadClass(serviceClassName);
+ }
+ catch (Exception e)
+ {
+ return loadClassForName(serviceClassName, classLoader.getParent());
+ }
+ }
+
+ private T createInstance(Class<?> serviceClass)
+ {
+ try
+ {
+ Constructor<?> constructor = serviceClass.getDeclaredConstructor();
+ constructor.setAccessible(true);
+ return (T) constructor.newInstance();
+ }
+ catch (Exception e)
+ {
+ return null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString()
+ {
+ return "Config file: " + getConfigFileLocation();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
new file mode 100644
index 0000000..54ab8ce
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
@@ -0,0 +1,668 @@
+/*
+ * 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.webbeans.util;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.util.Nonbinding;
+
+import org.apache.webbeans.annotation.AnyLiteral;
+import org.apache.webbeans.annotation.DefaultLiteral;
+import org.apache.webbeans.exception.WebBeansException;
+
+/**
+ * Utility class related with {@link Annotation} operations.
+ *
+ * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
+ * @since 1.0
+ */
+public final class AnnotationUtil
+{
+ public static final Annotation[] EMPTY_ANNOTATION_ARRAY = new Annotation[0];
+
+ public static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
+
+ public static final Set<Annotation> DEFAULT_AND_ANY_ANNOTATION
+ = Collections.unmodifiableSet(new HashSet<Annotation>(Arrays.<Annotation>asList(DefaultLiteral.INSTANCE, AnyLiteral.INSTANCE)));
+
+ // No instantiate
+ private AnnotationUtil()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Checks, if the given class declares the specified annotation
+ */
+ public static boolean isDeclaringClass(Class<?> declaringClass, Annotation declaredAnnotation)
+ {
+ for (Annotation annotation: declaringClass.getDeclaredAnnotations())
+ {
+ if (annotation.equals(declaredAnnotation))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns the declaring class for the specified annotation, using the specified type hierarchy.
+ */
+ public static Class<?> getDeclaringClass(Annotation declaredAnnotation, Class<?> typeHierarchy)
+ {
+ if (typeHierarchy == null)
+ {
+ return null;
+ }
+ if (isDeclaringClass(typeHierarchy, declaredAnnotation))
+ {
+ return typeHierarchy;
+ }
+ return getDeclaringClass(declaredAnnotation, typeHierarchy.getSuperclass());
+ }
+
+
+ /**
+ * Check given annotation exist on the method.
+ *
+ * @param method method
+ * @param clazz annotation class
+ * @return true or false
+ */
+ public static boolean hasMethodAnnotation(Method method, Class<? extends Annotation> clazz)
+ {
+ final AnnotatedElement element = method;
+ Annotation[] anns = getDeclaredAnnotations(element);
+ for (Annotation annotation : anns)
+ {
+ if (annotation.annotationType().equals(clazz))
+ {
+ return true;
+ }
+ }
+
+ return false;
+
+ }
+
+ /**
+ * Utility method to get around some errors caused by
+ * interactions between the Equinox class loaders and
+ * the OpenJPA transformation process. There is a window
+ * where the OpenJPA transformation process can cause
+ * an annotation being processed to get defined in a
+ * classloader during the actual defineClass call for
+ * that very class (e.g., recursively). This results in
+ * a LinkageError exception. If we see one of these,
+ * retry the request. Since the annotation will be
+ * defined on the second pass, this should succeed. If
+ * we get a second exception, then it's likely some
+ * other problem.
+ *
+ * @param element The AnnotatedElement we need information for.
+ *
+ * @return An array of the Annotations defined on the element.
+ */
+ private static Annotation[] getDeclaredAnnotations(AnnotatedElement element)
+ {
+ try
+ {
+ return element.getDeclaredAnnotations();
+ }
+ catch (LinkageError e)
+ {
+ return element.getDeclaredAnnotations();
+ }
+ }
+
+
+
+ public static <X> boolean hasAnnotatedMethodParameterAnnotation(AnnotatedMethod<X> annotatedMethod, Class<? extends Annotation> clazz)
+ {
+ Asserts.assertNotNull(annotatedMethod, "annotatedMethod argument can not be null");
+ Asserts.nullCheckForClass(clazz);
+
+ List<AnnotatedParameter<X>> parameters = annotatedMethod.getParameters();
+ for(AnnotatedParameter<X> parameter : parameters)
+ {
+ if(parameter.isAnnotationPresent(clazz))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public static <X> boolean hasAnnotatedMethodMultipleParameterAnnotation(AnnotatedMethod<X> annotatedMethod, Class<? extends Annotation> clazz)
+ {
+ Asserts.assertNotNull(annotatedMethod, "annotatedMethod argument can not be null");
+ Asserts.nullCheckForClass(clazz);
+
+ boolean found = false;
+
+ List<AnnotatedParameter<X>> parameters = annotatedMethod.getParameters();
+ for(AnnotatedParameter<X> parameter : parameters)
+ {
+ if(parameter.isAnnotationPresent(clazz))
+ {
+ if(!found)
+ {
+ found = true;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ }
+
+
+ return false;
+ }
+
+ public static <X> Type getAnnotatedMethodFirstParameterWithAnnotation(AnnotatedMethod<X> annotatedMethod, Class<? extends Annotation> clazz)
+ {
+ Asserts.assertNotNull(annotatedMethod, "annotatedMethod argument can not be null");
+ Asserts.nullCheckForClass(clazz);
+
+ List<AnnotatedParameter<X>> parameters = annotatedMethod.getParameters();
+ for(AnnotatedParameter<X> parameter : parameters)
+ {
+ if(parameter.isAnnotationPresent(clazz))
+ {
+ return parameter.getBaseType();
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Get the Type of the method parameter which has the given annotation
+ * @param method which need to be scanned
+ * @param clazz the annotation to scan the method parameters for
+ * @return the Type of the method parameter which has the given annotation, or <code>null</code> if not found.
+ */
+ public static Type getTypeOfParameterWithGivenAnnotation(Method method, Class<? extends Annotation> clazz)
+ {
+ Asserts.assertNotNull(method, "Method argument can not be null");
+ Asserts.nullCheckForClass(clazz);
+
+ Annotation[][] parameterAnns = method.getParameterAnnotations();
+ Type result = null;
+
+ int index = 0;
+ for (Annotation[] parameters : parameterAnns)
+ {
+ boolean found = false;
+ for (Annotation param : parameters)
+ {
+ Class<? extends Annotation> btype = param.annotationType();
+ if (btype.equals(clazz))
+ {
+ found = true;
+ //Adding Break instead of continue
+ break;
+ }
+ }
+
+ if (found)
+ {
+ result = method.getGenericParameterTypes()[index];
+ break;
+ }
+
+ index++;
+
+ }
+ return result;
+ }
+
+ public static <X,T extends Annotation> T getAnnotatedMethodFirstParameterAnnotation(AnnotatedMethod<X> annotatedMethod, Class<T> clazz)
+ {
+ Asserts.assertNotNull(annotatedMethod, "annotatedMethod argument can not be null");
+ Asserts.nullCheckForClass(clazz);
+
+
+ List<AnnotatedParameter<X>> parameters = annotatedMethod.getParameters();
+ for(AnnotatedParameter<X> parameter : parameters)
+ {
+ if(parameter.isAnnotationPresent(clazz))
+ {
+ return clazz.cast(parameter.getAnnotation(clazz));
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Checks if the given cdi annotations are equal. cdi annotations may either be qualifiers or interceptor bindings.
+ *
+ * CDI annotations are equal if they have the same annotationType and all their
+ * methods, except those annotated with @Nonbinding, return the same value.
+ *
+ * @param annotation1
+ * @param annotation2
+ * @return
+ */
+ public static boolean isCdiAnnotationEqual(Annotation annotation1, Annotation annotation2)
+ {
+ Asserts.assertNotNull(annotation1, "annotation1 argument can not be null");
+ Asserts.assertNotNull(annotation2, "annotation2 argument can not be null");
+
+ Class<? extends Annotation> qualifier1AnnotationType
+ = annotation1.annotationType();
+
+ // check if the annotationTypes are equal
+ if (qualifier1AnnotationType == null
+ || !qualifier1AnnotationType.equals(annotation2.annotationType()))
+ {
+ return false;
+ }
+
+ // check the values of all qualifier-methods
+ // except those annotated with @Nonbinding
+ List<Method> bindingCdiAnnotationMethods
+ = getBindingCdiAnnotationMethods(qualifier1AnnotationType);
+
+ for (Method method : bindingCdiAnnotationMethods)
+ {
+ Object value1 = callMethod(annotation1, method);
+ Object value2 = callMethod(annotation2, method);
+
+ if (!checkEquality(value1, value2))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Computes a hash code for the specified cdi annoation. cdi annotations may either be qualifiers or interceptor bindings.
+ *
+ * The hash code of CDI annotations consists of the hash code of the annotationType and all its
+ * method values, except those annotated with @Nonbinding.
+ *
+ * @param annotation
+ * @return
+ */
+ public static int getCdiAnnotationHashCode(Annotation annotation)
+ {
+ Asserts.assertNotNull(annotation, "annotation argument can not be null");
+
+ int hashCode = 0;
+
+ Class<? extends Annotation> qualifierAnnotationType = annotation.annotationType();
+ if (qualifierAnnotationType != null)
+ {
+ hashCode = qualifierAnnotationType.hashCode();
+ }
+
+ // check the values of all qualifier-methods
+ // except those annotated with @Nonbinding
+ List<Method> bindingCdiAnnotationMethods
+ = getBindingCdiAnnotationMethods(qualifierAnnotationType);
+
+ for (Method method : bindingCdiAnnotationMethods)
+ {
+ Object value = callMethod(annotation, method);
+ if (value != null)
+ {
+ hashCode ^= value.hashCode();
+ }
+ }
+
+ return hashCode;
+ }
+
+ /**
+ * Quecks if the two values are equal.
+ *
+ * @param value1
+ * @param value2
+ * @return
+ */
+ private static boolean checkEquality(Object value1, Object value2)
+ {
+ if ((value1 == null && value2 != null) ||
+ (value1 != null && value2 == null))
+ {
+ return false;
+ }
+
+ if (value1 == null)
+ {
+ return true;
+ }
+
+ // now both values are != null
+
+ Class<?> valueClass = value1.getClass();
+
+ if (!valueClass.equals(value2.getClass()))
+ {
+ return false;
+ }
+
+ if (valueClass.isPrimitive())
+ {
+ // primitive types can be checked with ==
+ return value1 == value2;
+ }
+ else if (valueClass.isArray())
+ {
+ Class<?> arrayType = valueClass.getComponentType();
+
+ if (arrayType.isPrimitive())
+ {
+ if (Long.TYPE == arrayType)
+ {
+ return Arrays.equals(((long[]) value1), (long[]) value2);
+ }
+ else if (Integer.TYPE == arrayType)
+ {
+ return Arrays.equals(((int[]) value1), (int[]) value2);
+ }
+ else if (Short.TYPE == arrayType)
+ {
+ return Arrays.equals(((short[]) value1), (short[]) value2);
+ }
+ else if (Double.TYPE == arrayType)
+ {
+ return Arrays.equals(((double[]) value1), (double[]) value2);
+ }
+ else if (Float.TYPE == arrayType)
+ {
+ return Arrays.equals(((float[]) value1), (float[]) value2);
+ }
+ else if (Boolean.TYPE == arrayType)
+ {
+ return Arrays.equals(((boolean[]) value1), (boolean[]) value2);
+ }
+ else if (Byte.TYPE == arrayType)
+ {
+ return Arrays.equals(((byte[]) value1), (byte[]) value2);
+ }
+ else if (Character.TYPE == arrayType)
+ {
+ return Arrays.equals(((char[]) value1), (char[]) value2);
+ }
+ return false;
+ }
+ else
+ {
+ return Arrays.equals(((Object[]) value1), (Object[]) value2);
+ }
+ }
+ else
+ {
+ return value1.equals(value2);
+ }
+ }
+
+ /**
+ * Calls the given method on the given instance.
+ * Used to determine the values of annotation instances.
+ *
+ * @param instance
+ * @param method
+ * @return
+ */
+ private static Object callMethod(Object instance, Method method)
+ {
+ try
+ {
+ if (!method.isAccessible())
+ {
+ method.setAccessible(true);
+ }
+
+ return method.invoke(instance, EMPTY_OBJECT_ARRAY);
+ }
+ catch (Exception e)
+ {
+ throw new WebBeansException("Exception in method call : " + method.getName(), e);
+ }
+ }
+
+ /**
+ * Return a List of all methods of the qualifier,
+ * which are not annotated with @Nonbinding.
+ *
+ * @param qualifierAnnotationType
+ */
+ private static List<Method> getBindingCdiAnnotationMethods(
+ Class<? extends Annotation> qualifierAnnotationType)
+ {
+ Method[] qualifierMethods = qualifierAnnotationType.getDeclaredMethods();
+
+ if (qualifierMethods.length > 0)
+ {
+ List<Method> bindingMethods = new ArrayList<Method>();
+
+ for (Method qualifierMethod : qualifierMethods)
+ {
+ Annotation[] qualifierMethodAnnotations = getDeclaredAnnotations(qualifierMethod);
+
+ if (qualifierMethodAnnotations.length > 0)
+ {
+ // look for @Nonbinding
+ boolean nonbinding = false;
+
+ for (Annotation qualifierMethodAnnotation : qualifierMethodAnnotations)
+ {
+ if (Nonbinding.class.equals(
+ qualifierMethodAnnotation.annotationType()))
+ {
+ nonbinding = true;
+ break;
+ }
+ }
+
+ if (!nonbinding)
+ {
+ // no @Nonbinding found - add to list
+ bindingMethods.add(qualifierMethod);
+ }
+ }
+ else
+ {
+ // no method-annotations - add to list
+ bindingMethods.add(qualifierMethod);
+ }
+ }
+
+ return bindingMethods;
+ }
+
+ // annotation has no methods
+ return Collections.emptyList();
+ }
+
+ /**
+ * Check whether or not class contains the given annotation.
+ *
+ * @param clazz class instance
+ * @param annotation annotation class
+ * @return return true or false
+ */
+ public static boolean hasClassAnnotation(Class<?> clazz, Class<? extends Annotation> annotation)
+ {
+ Asserts.nullCheckForClass(clazz);
+ Asserts.assertNotNull(annotation, "Annotation argument can not be null");
+
+ try
+ {
+ Annotation a = clazz.getAnnotation(annotation);
+
+ if (a != null)
+ {
+ return true;
+ }
+ }
+ catch (ArrayStoreException e)
+ {
+ //log this? It is probably already logged in AnnotatedElementFactory
+ }
+
+ return false;
+ }
+
+ public static boolean hasMetaAnnotation(Annotation[] anns, Class<? extends Annotation> metaAnnotation)
+ {
+ Asserts.assertNotNull(anns, "Anns argument can not be null");
+ Asserts.assertNotNull(metaAnnotation, "MetaAnnotation argument can not be null");
+
+ for (Annotation annot : anns)
+ {
+ if (annot.annotationType().isAnnotationPresent(metaAnnotation))
+ {
+ return true;
+ }
+ }
+
+ return false;
+
+ }
+
+ public static boolean hasAnnotation(Annotation[] anns, Class<? extends Annotation> annotation)
+ {
+ return getAnnotation(anns, annotation) != null;
+ }
+
+ /**
+ * get the annotation of the given type from the array.
+ * @param anns
+ * @param annotation
+ * @return the Annotation with the given type or <code>null</code> if no such found.
+ */
+ @SuppressWarnings("unchecked")
+ public static <T extends Annotation> T getAnnotation(Annotation[] anns, Class<T> annotation)
+ {
+ Asserts.assertNotNull(anns, "anns argument can not be null");
+ Asserts.assertNotNull(annotation, "annotation argument can not be null");
+ for (Annotation annot : anns)
+ {
+ if (annot.annotationType().equals(annotation))
+ {
+ return (T)annot;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns a subset of annotations that are annotated with the specified meta-annotation
+ *
+ * @param anns
+ * @param metaAnnotation
+ * @return
+ */
+ public static Annotation[] getMetaAnnotations(Annotation[] anns, Class<? extends Annotation> metaAnnotation)
+ {
+ List<Annotation> annots = new ArrayList<Annotation>();
+ Annotation[] result;
+ Asserts.assertNotNull(anns, "Anns argument can not be null");
+ Asserts.assertNotNull(metaAnnotation, "MetaAnnotation argument can not be null");
+
+ for (Annotation annot : anns)
+ {
+ if (annot.annotationType().isAnnotationPresent(metaAnnotation))
+ {
+ annots.add(annot);
+ }
+ }
+
+ result = new Annotation[annots.size()];
+ result = annots.toArray(result);
+
+ return result;
+ }
+
+ /**
+ * Search in the given Set of Annotations for the one with the given AnnotationClass.
+ * @param annotations to scan
+ * @param annotationClass to search for
+ * @return the annotation with the given annotationClass or <code>null</code> if not found.
+ */
+ public static <T extends Annotation> T getAnnotation(Set<Annotation> annotations, Class<T> annotationClass)
+ {
+ if (annotations == null)
+ {
+ return null;
+ }
+
+ for(Annotation ann : annotations)
+ {
+ if(ann.annotationType().equals(annotationClass))
+ {
+ return (T) ann;
+ }
+ }
+
+ return null;
+ }
+
+
+ public static Annotation hasOwbInjectableResource(Annotation[] annotations)
+ {
+ for (Annotation anno : annotations)
+ {
+ for(String name : WebBeansConstants.OWB_INJECTABLE_RESOURCE_ANNOTATIONS)
+ {
+ if(anno.annotationType().getName().equals(name))
+ {
+ return anno;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public static Annotation[] asArray(Set<Annotation> set)
+ {
+ if(set != null)
+ {
+ Annotation[] anns = new Annotation[set.size()];
+ anns = set.toArray(anns);
+
+ return anns;
+ }
+
+ return EMPTY_ANNOTATION_ARRAY;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/ArrayUtil.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/ArrayUtil.java
new file mode 100644
index 0000000..ac5da42
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/ArrayUtil.java
@@ -0,0 +1,102 @@
+/*
+ * 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.webbeans.util;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+public final class ArrayUtil
+{
+
+ private ArrayUtil()
+ {
+
+ }
+
+ /**
+ * Compare two arrays regardless of the position of the elements
+ * in the arrays. The complex handling with temporary flags is necessary due
+ * to the possibility of having multiple occurrences of the same element in
+ * the arrays. In this case both arrays have to contain the exactly same
+ * amount of those elements. This is only suited for smaller arrays (e.g.
+ * count < 100) since the algorithm uses a product of both arrays. If one
+ * likes to use this for larger arrays, we'd have to use hashes.
+ *
+ * @param arr1
+ * @param arr2
+ * @return
+ */
+ public static boolean equalsIgnorePosition(Object[] arr1, Object[] arr2)
+ {
+ if (arr1 == null && arr2 == null)
+ {
+ return true;
+ }
+
+ if (arr1 == null || arr2 == null)
+ {
+ return false;
+ }
+
+ if (arr1.length != arr2.length)
+ {
+ return false;
+ }
+
+ boolean[] found1 = new boolean[arr1.length];
+ boolean[] found2 = new boolean[arr2.length];
+
+ for (int i1 = 0; i1 < arr1.length; i1++)
+ {
+ Object o1 = arr1[i1];
+
+ for (int i2 = 0; i2 < arr2.length; i2++)
+ {
+ Object o2 = arr2[i2];
+
+ // if they are equal and not found already
+ if (o1.equals(o2) && !found2[i2])
+ {
+ // mark the entries in both arrays as found
+ found1[i1] = true;
+ found2[i2] = true;
+ break;
+ }
+ }
+ }
+
+ for (int i = 0; i < found1.length; i++)
+ {
+ if (!found1[i] || !found2[i])
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static <T> Set<T> asSet(T... items)
+ {
+ Set<T> set = new HashSet<T>(items.length);
+ Collections.addAll(set, items);
+
+ return set;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/Asserts.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/Asserts.java
new file mode 100644
index 0000000..e0153ac
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/Asserts.java
@@ -0,0 +1,97 @@
+/*
+ * 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.webbeans.util;
+
+import java.lang.reflect.Method;
+
+/**
+ * Simple utility classes with some assertions methods.
+ *
+ * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
+ * @since 1.0
+ */
+public final class Asserts
+{
+
+ /*
+ * Private constructor
+ */
+ private Asserts()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Check the object is null or not
+ *
+ * @param obj null check object
+ * @param message exception message
+ */
+ public static void assertNotNull(Object obj, String message)
+ {
+ if (obj == null)
+ {
+ throw new NullPointerException(message);
+ }
+ }
+
+ /**
+ * Check the object is null or not
+ *
+ * @param obj null check object
+ */
+ public static void assertNotNull(Object obj)
+ {
+ if (obj == null)
+ {
+ throw new NullPointerException();
+ }
+ }
+
+ /**
+ * Null check for class parameter.
+ *
+ * @param clazz parameter
+ */
+ public static void nullCheckForClass(Class<?> clazz)
+ {
+ Asserts.assertNotNull(clazz, "clazz argument can not be null");
+ }
+
+ /**
+ * Null check for class parameter.
+ *
+ * @param clazz parameter
+ */
+ public static void nullCheckForClass(Class<?> clazz, String message)
+ {
+ Asserts.assertNotNull(clazz, message);
+ }
+
+ /**
+ * Null check for method parameter.
+ *
+ * @param method parameter
+ */
+ public static void nullCheckForMethod(Method method)
+ {
+ Asserts.assertNotNull(method, "method argument can not be null");
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/CDI11s.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/CDI11s.java
new file mode 100644
index 0000000..49f9d46
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/CDI11s.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.util;
+
+import javax.enterprise.inject.spi.InterceptionType;
+
+public class CDI11s
+{
+ public static final InterceptionType AROUND_CONSTRUCT;
+ static {
+ InterceptionType type;
+ try
+ {
+ type = InterceptionType.class.cast(InterceptionType.class.getDeclaredField("AROUND_CONSTRUCT").get(null));
+ }
+ catch (final Throwable e)
+ {
+ type = null;
+ }
+ AROUND_CONSTRUCT = type;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
new file mode 100644
index 0000000..c445d5d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
@@ -0,0 +1,1048 @@
+/*
+ * 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.webbeans.util;
+
+import java.lang.reflect.GenericArrayType;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.lang.reflect.WildcardType;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.exception.inject.DefinitionException;
+
+/**
+ * Utility classes with respect to the class operations.
+ *
+ * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
+ * @since 1.0
+ */
+public final class ClassUtil
+{
+ public static final Map<Class<?>, Class<?>> PRIMITIVE_TO_WRAPPERS_MAP = new HashMap<Class<?>, Class<?>>();
+
+ static
+ {
+ PRIMITIVE_TO_WRAPPERS_MAP.put(Integer.TYPE,Integer.class);
+ PRIMITIVE_TO_WRAPPERS_MAP.put(Float.TYPE,Float.class);
+ PRIMITIVE_TO_WRAPPERS_MAP.put(Double.TYPE,Double.class);
+ PRIMITIVE_TO_WRAPPERS_MAP.put(Character.TYPE,Character.class);
+ PRIMITIVE_TO_WRAPPERS_MAP.put(Long.TYPE,Long.class);
+ PRIMITIVE_TO_WRAPPERS_MAP.put(Byte.TYPE,Byte.class);
+ PRIMITIVE_TO_WRAPPERS_MAP.put(Short.TYPE,Short.class);
+ PRIMITIVE_TO_WRAPPERS_MAP.put(Boolean.TYPE,Boolean.class);
+ PRIMITIVE_TO_WRAPPERS_MAP.put(Void.TYPE,Void.class);
+ }
+
+ /*
+ * Private constructor
+ */
+ private ClassUtil()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public static Class<?> getClassFromName(String name)
+ {
+ Class<?> clazz;
+ ClassLoader loader;
+ try
+ {
+ loader = WebBeansUtil.getCurrentClassLoader();
+ clazz = Class.forName(name, true , loader);
+ return clazz;
+
+ }
+ catch (ClassNotFoundException e)
+ {
+ try
+ {
+ loader = ClassUtil.class.getClassLoader();
+ clazz = Class.forName(name, true , loader);
+
+ return clazz;
+
+ }
+ catch (ClassNotFoundException e1)
+ {
+ try
+ {
+ loader = ClassLoader.getSystemClassLoader();
+ clazz = Class.forName(name, true , loader);
+
+ return clazz;
+
+ }
+ catch (ClassNotFoundException e2)
+ {
+ return null;
+ }
+ }
+ }
+ }
+
+ /**
+ * Check the class is inner or not
+ *
+ * @param clazz to check
+ * @return true or false
+ */
+ public static boolean isInnerClazz(Class<?> clazz)
+ {
+ Asserts.nullCheckForClass(clazz);
+
+ return clazz.isMemberClass();
+ }
+
+ public static boolean isSame(Type type1, Type type2)
+ {
+ if ((type1 instanceof Class) && ((Class<?>)type1).isPrimitive())
+ {
+ type1 = PRIMITIVE_TO_WRAPPERS_MAP.get(type1);
+ }
+ if ((type2 instanceof Class) && ((Class<?>)type2).isPrimitive())
+ {
+ type2 = PRIMITIVE_TO_WRAPPERS_MAP.get(type2);
+ }
+ return type1 == type2;
+ }
+
+ public static Class<?> getPrimitiveWrapper(Class<?> clazz)
+ {
+ Asserts.nullCheckForClass(clazz);
+
+ return PRIMITIVE_TO_WRAPPERS_MAP.get(clazz);
+
+ }
+
+ /**
+ * Gets the class of the given type arguments.
+ * <p>
+ * If the given type {@link Type} parameters is an instance of the
+ * {@link ParameterizedType}, it returns the raw type otherwise it return
+ * the casted {@link Class} of the type argument.
+ * </p>
+ *
+ * @param type class or parametrized type
+ * @return
+ */
+ public static Class<?> getClass(Type type)
+ {
+ return getClazz(type);
+ }
+
+
+ /**
+ * Check method throws checked exception or not.
+ *
+ * @param method method instance
+ */
+ public static boolean isMethodHasCheckedException(Method method)
+ {
+ Asserts.nullCheckForMethod(method);
+
+ Class<?>[] et = method.getExceptionTypes();
+
+ if (et.length > 0)
+ {
+ for (Class<?> type : et)
+ {
+ if (!Error.class.isAssignableFrom(type) && !RuntimeException.class.isAssignableFrom(type))
+ {
+ return true;
+ }
+ }
+
+ }
+
+ return false;
+ }
+
+ /**
+ * Call method on the instance with given arguments.
+ *
+ * @param method method instance
+ * @param instance object instance
+ * @param args arguments
+ * @return the method result
+ */
+ public static Object callInstanceMethod(Method method, Object instance, Object[] args)
+ {
+ Asserts.nullCheckForMethod(method);
+ Asserts.assertNotNull(instance, "instance parameter can not be null");
+
+ try
+ {
+ if (args == null)
+ {
+ args = new Object[] {};
+ }
+ return method.invoke(instance, args);
+
+ }
+ catch (Exception e)
+ {
+ throw new WebBeansException("Exception occurs in the method call with method : " + method.getName() + " in class : " + instance.getClass().getName(), e);
+ }
+
+ }
+
+ private static Set<String> getObjectMethodNames()
+ {
+ if (objectMethodNames == null)
+ {
+ // not much synchronisation needed...
+ Set<String> list = new HashSet<String>();
+ Class<?> clazz = Object.class;
+
+ Method[] methods = SecurityUtil.doPrivilegedGetDeclaredMethods(clazz);
+ for (Method method : methods)
+ {
+ list.add(method.getName());
+ }
+ objectMethodNames = list;
+ }
+
+ return objectMethodNames;
+ }
+ private static volatile Set<String> objectMethodNames= null;
+
+ /**
+ * collect all non-private, non-static and non-abstract methods from the given class.
+ * This method removes any overloaded methods from the list automatically.
+ * We also do skip bridge methods as they exist for and are handled solely
+ * by the JVM itself.
+ *
+ * The returned Map contains the methods divided by the methodName as key in the map
+ * following all the methods with the same methodName in a List.
+ *
+ * There is some special rule for package-private methods. Any non-visible
+ * package-private method will get skipped and treated similarly to private methods.
+ *
+ * Note: we filter out the {@link Object#finalize()} method as users must not deal with it.
+ * @param topClass the class to start with. Then move up the hierarchy
+ * @param excludeFinalMethods whether final classes should get excluded from the result
+ */
+ public static List<Method> getNonPrivateMethods(Class<?> topClass, boolean excludeFinalMethods)
+ {
+ Map<String, List<Method>> methodMap = new HashMap<String, List<Method>>();
+ List<Method> allMethods = new ArrayList<Method>(10);
+
+ Class<?> clazz = topClass;
+
+ while (clazz != null)
+ {
+ for (Method method : clazz.getDeclaredMethods())
+ {
+ if (method.isBridge())
+ {
+ // we have no interest in generics bridge methods
+ continue;
+ }
+
+ final int modifiers = method.getModifiers();
+
+ if (Modifier.isPrivate(modifiers) || Modifier.isStatic(modifiers))
+ {
+ continue;
+ }
+ if (excludeFinalMethods && Modifier.isFinal(modifiers))
+ {
+ continue;
+ }
+
+ if ("finalize".equals(method.getName()))
+ {
+ // we do not proxy finalize()
+ continue;
+ }
+
+ // check for package-private methods from a different package
+ if (!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers))
+ {
+ // private already got handled above, so we only had to check for not public nor protected
+ // we cannot see those methods if they are not in the same package as the rootClazz
+ if (!clazz.getPackage().getName().equals(topClass.getPackage().getName()))
+ {
+ continue;
+ }
+
+ }
+
+ List<Method> methods = methodMap.get(method.getName());
+ if (methods == null)
+ {
+ methods = new ArrayList<Method>();
+ methods.add(method);
+ allMethods.add(method);
+ methodMap.put(method.getName(), methods);
+ }
+ else
+ {
+ if (isOverridden(methods, method))
+ {
+ // method is overridden in superclass, so do nothing
+ }
+ else
+ {
+ // method is not overridden, so add it
+ methods.add(method);
+ allMethods.add(method);
+ }
+ }
+ }
+
+ clazz = clazz.getSuperclass();
+ }
+
+ return allMethods;
+ }
+
+ /**
+ * Check if the method is already defined in a subclass
+ * @param subclassMethods
+ * @param superclassMethod
+ */
+ public static boolean isOverridden(final List<Method> subclassMethods, final Method superclassMethod)
+ {
+ for (final Method m : subclassMethods)
+ {
+ if (isOverridden(m, superclassMethod))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ /**
+ * Checks if the given method if from Object.class
+ * @param methodName
+ * @return <code>true</code> if the given method is from Object.class (either directly or overloaded)
+ */
+ public static boolean isObjectMethod(String methodName)
+ {
+ return getObjectMethodNames().contains(methodName);
+ }
+
+ /**
+ * Returns true if type is an instance of <code>ParameterizedType</code>
+ * else otherwise.
+ *
+ * @param type type of the artifact
+ * @return true if type is an instance of <code>ParameterizedType</code>
+ */
+ public static boolean isParametrizedType(Type type)
+ {
+ Asserts.assertNotNull(type, "type parameter can not be null");
+
+ return type instanceof ParameterizedType;
+ }
+
+ /**
+ * Returns true if type is an instance of <code>WildcardType</code>
+ * else otherwise.
+ *
+ * @param type type of the artifact
+ * @return true if type is an instance of <code>WildcardType</code>
+ */
+ public static boolean isWildCardType(Type type)
+ {
+ Asserts.assertNotNull(type, "type parameter can not be null");
+
+ return type instanceof WildcardType;
+ }
+
+ public static boolean isUnboundedTypeVariable(Type type)
+ {
+ Asserts.assertNotNull(type, "type parameter can not be null");
+
+ if (type instanceof TypeVariable)
+ {
+ TypeVariable wc = (TypeVariable)type;
+ Type[] upper = wc.getBounds();
+
+
+ if(upper.length > 1)
+ {
+ return false;
+ }
+ else
+ {
+ Type arg = upper[0];
+ if(!(arg instanceof Class))
+ {
+ return false;
+ }
+ else
+ {
+ Class<?> clazz = (Class<?>)arg;
+ if(!clazz.equals(Object.class))
+ {
+ return false;
+ }
+ }
+ }
+ }
+ else
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+
+ /**
+ * Returns true if type is an instance of <code>TypeVariable</code>
+ * else otherwise.
+ *
+ * @param type type of the artifact
+ * @return true if type is an instance of <code>TypeVariable</code>
+ */
+ public static boolean isTypeVariable(Type type)
+ {
+ Asserts.assertNotNull(type, "type parameter can not be null");
+
+ return type instanceof TypeVariable;
+ }
+
+
+ /**
+ * Returna true if the class is not abstract and interface.
+ *
+ * @param clazz class type
+ * @return true if the class is not abstract and interface
+ */
+ public static boolean isConcrete(Class<?> clazz)
+ {
+ Asserts.nullCheckForClass(clazz);
+
+ Integer modifier = clazz.getModifiers();
+
+ return !Modifier.isAbstract(modifier) && !Modifier.isInterface(modifier);
+ }
+
+ /**
+ * Checks that event is applicable
+ * for the given observer type.
+ * @param eventType event type
+ * @param observerType observer type
+ * @return true if event is applicable
+ */
+ public static boolean checkEventTypeAssignability(Type eventType, Type observerType)
+ {
+ //Observer type is a TypeVariable
+ if(isTypeVariable(observerType))
+ {
+ Class<?> eventClass = getClass(eventType);
+
+ TypeVariable<?> tvBeanTypeArg = (TypeVariable<?>)observerType;
+ Type tvBound = tvBeanTypeArg.getBounds()[0];
+
+ if(tvBound instanceof Class)
+ {
+ Class<?> clazzTvBound = (Class<?>)tvBound;
+ if(clazzTvBound.isAssignableFrom(eventClass))
+ {
+ return true;
+ }
+ }
+ }
+ //Both of them are ParametrizedType
+ else if(observerType instanceof ParameterizedType && eventType instanceof ParameterizedType)
+ {
+ return isAssignableForParametrized((ParameterizedType)eventType, (ParameterizedType)observerType);
+ }
+ //Observer is class and Event type is Parametrized
+ else if(observerType instanceof Class && eventType instanceof ParameterizedType)
+ {
+ Class<?> clazzBeanType = (Class<?>)observerType;
+ ParameterizedType ptEvent = (ParameterizedType)eventType;
+ Class<?> eventClazz = (Class<?>)ptEvent.getRawType();
+
+ if(isClassAssignable(clazzBeanType, eventClazz))
+ {
+ return true;
+ }
+
+ return false;
+ }
+ //Both of them is class type
+ else if(observerType instanceof Class && eventType instanceof Class)
+ {
+ return isClassAssignable((Class<?>)observerType, (Class<?>) eventType);
+ }
+
+ return false;
+ }
+
+
+ /**
+ * Returns true if rhs is assignable type
+ * to the lhs, false otherwise.
+ *
+ * @param lhs left hand side class
+ * @param rhs right hand side class
+ * @return true if rhs is assignable to lhs
+ */
+ public static boolean isClassAssignable(Class<?> lhs, Class<?> rhs)
+ {
+ Asserts.assertNotNull(lhs, "lhs parameter can not be null");
+ Asserts.assertNotNull(rhs, "rhs parameter can not be null");
+
+ if(lhs.isPrimitive())
+ {
+ lhs = getPrimitiveWrapper(lhs);
+ }
+
+ if(rhs.isPrimitive())
+ {
+ rhs = getPrimitiveWrapper(rhs);
+ }
+
+ if (lhs.isAssignableFrom(rhs))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Returns true if given bean's api type is injectable to
+ * injection point required type.
+ *
+ * @param beanType bean parametrized api type
+ * @param requiredType injection point parametrized api type
+ * @return if injection is possible false otherwise
+ */
+ public static boolean isAssignableForParametrized(ParameterizedType beanType, ParameterizedType requiredType)
+ {
+ Class<?> beanRawType = (Class<?>) beanType.getRawType();
+ Class<?> requiredRawType = (Class<?>) requiredType.getRawType();
+
+ if (ClassUtil.isClassAssignable(requiredRawType,beanRawType))
+ {
+ //Bean api type actual type arguments
+ Type[] beanTypeArgs = beanType.getActualTypeArguments();
+
+ //Injection point type actual arguments
+ Type[] requiredTypeArgs = requiredType.getActualTypeArguments();
+
+ if(beanTypeArgs.length != requiredTypeArgs.length)
+ {
+ return false;
+ }
+ else
+ {
+ return isAssignableForParametrizedCheckArguments(beanTypeArgs, requiredTypeArgs);
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Check parametrized type actual type arguments.
+ * @param beanTypeArgs bean type actual type arguments
+ * @param requiredTypeArgs required type actual type arguments.
+ * @return true if assignment applicable
+ */
+ private static boolean isAssignableForParametrizedCheckArguments(Type[] beanTypeArgs, Type[] requiredTypeArgs)
+ {
+ Type requiredTypeArg = null;
+ Type beanTypeArg = null;
+ int ok = 0;
+ for(int i = 0; i< requiredTypeArgs.length;i++)
+ {
+ requiredTypeArg = requiredTypeArgs[i];
+ beanTypeArg = beanTypeArgs[i];
+
+ //Required type is parametrized and bean type is parametrized
+ if(ClassUtil.isParametrizedType(requiredTypeArg) && ClassUtil.isParametrizedType(beanTypeArg))
+ {
+ if (checkBeanAndRequiredTypeIsParametrized(beanTypeArg, requiredTypeArg))
+ {
+ ok++;
+ }
+ }
+ //Required type is wildcard
+ else if(ClassUtil.isWildCardType(requiredTypeArg))
+ {
+ if (checkRequiredTypeIsWildCard(beanTypeArg, requiredTypeArg))
+ {
+ ok++;
+ }
+ }
+ //Required type is actual type and bean type is type variable
+ else if(requiredTypeArg instanceof Class && ClassUtil.isTypeVariable(beanTypeArg))
+ {
+ if (checkRequiredTypeIsClassAndBeanTypeIsVariable(beanTypeArg, requiredTypeArg))
+ {
+ ok++;
+ }
+ }
+ //Required type is Type variable and bean type is type variable
+ else if(ClassUtil.isTypeVariable(requiredTypeArg) && ClassUtil.isTypeVariable(beanTypeArg))
+ {
+ if ( checkBeanTypeAndRequiredIsTypeVariable(beanTypeArg, requiredTypeArg))
+ {
+ ok++;
+ }
+ }
+ else if (requiredTypeArg instanceof ParameterizedType && beanTypeArg instanceof TypeVariable)
+ {
+ if (checkRequiredTypeIsParameterizedAndBeanTypeIsVariable(beanTypeArg, requiredTypeArg))
+ {
+ ok++;
+ }
+ }
+ //Both type is actual type
+ else if((beanTypeArg instanceof Class) && (requiredTypeArg instanceof Class))
+ {
+ if(isClassAssignable((Class<?>)requiredTypeArg,(Class<?>)beanTypeArg))
+ {
+ ok++;
+ }
+ }
+ //Bean type is actual type and required type is type variable
+ else if((beanTypeArg instanceof Class) && (ClassUtil.isTypeVariable(requiredTypeArg)))
+ {
+ if (checkRequiredTypeIsTypeVariableAndBeanTypeIsClass(beanTypeArg, requiredTypeArg))
+ {
+ ok++;
+ }
+ }
+ }
+
+ return ok == requiredTypeArgs.length;
+ }
+
+ /**
+ * Check parametrized bean type and parametrized
+ * required types.
+ * @param beanTypeArg parametrized bean type
+ * @param requiredTypeArg parametrized required type
+ * @return true if types are assignables
+ * @since 1.1.1
+ */
+ public static boolean checkBeanAndRequiredTypeIsParametrized(Type beanTypeArg, Type requiredTypeArg)
+ {
+ ParameterizedType ptRequiredTypeArg = (ParameterizedType)requiredTypeArg;
+ ParameterizedType ptBeanTypeArg = (ParameterizedType)beanTypeArg;
+
+ //Equal raw types
+ if(ptRequiredTypeArg.getRawType().equals(ptBeanTypeArg.getRawType()))
+ {
+ //Check arguments
+ Type[] actualArgsRequiredType = ptRequiredTypeArg.getActualTypeArguments();
+ Type[] actualArgsBeanType = ptRequiredTypeArg.getActualTypeArguments();
+
+ if(actualArgsRequiredType.length > 0 && actualArgsBeanType.length == actualArgsRequiredType.length)
+ {
+ return isAssignableForParametrizedCheckArguments(actualArgsBeanType, actualArgsRequiredType);
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Check bean type and required type.
+ * <p>
+ * Required type is a wildcard type.
+ * </p>
+ * @param beanTypeArg bean type
+ * @param requiredTypeArg required type
+ * @return true if condition satisfies
+ * @since 1.1.1
+ */
+ public static boolean checkRequiredTypeIsWildCard(Type beanTypeArg, Type requiredTypeArg)
+ {
+ WildcardType wctRequiredTypeArg = (WildcardType)requiredTypeArg;
+ Type upperBoundRequiredTypeArg = wctRequiredTypeArg.getUpperBounds()[0];
+ Type[] lowerBoundRequiredTypeArgs = wctRequiredTypeArg.getLowerBounds();
+
+ if(beanTypeArg instanceof Class)
+ {
+ Class<?> clazzBeanTypeArg = (Class<?>)beanTypeArg;
+ if(upperBoundRequiredTypeArg instanceof Class)
+ {
+ //Check upper bounds
+ Class<?> clazzUpperBoundTypeArg = (Class<?>)upperBoundRequiredTypeArg;
+ if(clazzUpperBoundTypeArg != Object.class)
+ {
+ if(!clazzUpperBoundTypeArg.isAssignableFrom(clazzBeanTypeArg))
+ {
+ return false;
+ }
+ }
+
+ //Check lower bounds
+ if(lowerBoundRequiredTypeArgs.length > 0 && lowerBoundRequiredTypeArgs[0] instanceof Class)
+ {
+ Class<?> clazzLowerBoundTypeArg = (Class<?>)lowerBoundRequiredTypeArgs[0];
+
+ if(clazzLowerBoundTypeArg != Object.class)
+ {
+ if(!clazzBeanTypeArg.isAssignableFrom(clazzLowerBoundTypeArg))
+ {
+ return false;
+ }
+ }
+ }
+ }
+ }
+ else if(ClassUtil.isTypeVariable(beanTypeArg))
+ {
+ TypeVariable<?> tvBeanTypeArg = (TypeVariable<?>)beanTypeArg;
+ Type tvBound = tvBeanTypeArg.getBounds()[0];
+
+ if(tvBound instanceof Class)
+ {
+ Class<?> clazzTvBound = (Class<?>)tvBound;
+
+ if(upperBoundRequiredTypeArg instanceof Class)
+ {
+ Class<?> clazzUpperBoundTypeArg = (Class<?>)upperBoundRequiredTypeArg;
+ if(clazzUpperBoundTypeArg != Object.class && clazzTvBound != Object.class)
+ {
+ if(!clazzUpperBoundTypeArg.isAssignableFrom(clazzTvBound))
+ {
+ return false;
+ }
+ }
+
+ //Check lower bounds
+ if(lowerBoundRequiredTypeArgs.length > 0 && lowerBoundRequiredTypeArgs[0] instanceof Class)
+ {
+ Class<?> clazzLowerBoundTypeArg = (Class<?>)lowerBoundRequiredTypeArgs[0];
+
+ if(clazzLowerBoundTypeArg != Object.class)
+ {
+ if(!clazzTvBound.isAssignableFrom(clazzLowerBoundTypeArg))
+ {
+ return false;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Checking bean type and required type.
+ * <p>
+ * Required type is class and bean type is
+ * a type variable.
+ * </p>
+ * @param beanTypeArg bean type
+ * @param requiredTypeArg required type
+ * @return true if condition satisfy
+ */
+ public static boolean checkRequiredTypeIsClassAndBeanTypeIsVariable(Type beanTypeArg, Type requiredTypeArg)
+ {
+ Class<?> clazzRequiredType = (Class<?>)requiredTypeArg;
+
+ TypeVariable<?> tvBeanTypeArg = (TypeVariable<?>)beanTypeArg;
+ //TODO respect other bounds
+ Type tvBound = tvBeanTypeArg.getBounds()[0];
+
+ if(tvBound instanceof Class)
+ {
+ Class<?> clazzTvBound = (Class<?>)tvBound;
+
+ if(clazzTvBound != Object.class)
+ {
+ if(!clazzTvBound.isAssignableFrom(clazzRequiredType))
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean checkRequiredTypeIsParameterizedAndBeanTypeIsVariable(Type beanTypeArg, Type requiredTypeArg)
+ {
+ ParameterizedType requiredType = (ParameterizedType)requiredTypeArg;
+ //TODO respect parameters of required type
+ return checkRequiredTypeIsClassAndBeanTypeIsVariable(beanTypeArg, requiredType.getRawType());
+ }
+
+ public static boolean checkRequiredTypeIsTypeVariableAndBeanTypeIsClass(Type beanTypeArg, Type requiredTypeArg)
+ {
+ Class<?> clazzBeanType = (Class<?>)beanTypeArg;
+
+ TypeVariable<?> tvRequiredTypeArg = (TypeVariable<?>)requiredTypeArg;
+ Type tvBound = tvRequiredTypeArg.getBounds()[0];
+
+ if(tvBound instanceof Class)
+ {
+ Class<?> clazzTvBound = (Class<?>)tvBound;
+
+ if(clazzTvBound.isAssignableFrom(clazzBeanType))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+
+ public static boolean checkBeanTypeAndRequiredIsTypeVariable(Type beanTypeArg, Type requiredTypeArg)
+ {
+ TypeVariable<?> tvBeanTypeArg = (TypeVariable<?>)beanTypeArg;
+ Type tvBeanBound = tvBeanTypeArg.getBounds()[0];
+
+ TypeVariable<?> tvRequiredTypeArg = (TypeVariable<?>)requiredTypeArg;
+ Type tvRequiredBound = tvRequiredTypeArg.getBounds()[0];
+
+ if(tvBeanBound instanceof Class && tvRequiredBound instanceof Class)
+ {
+ Class<?> clazzTvBeanBound = (Class<?>)tvBeanBound;
+ Class<?> clazzTvRequiredBound = (Class<?>)tvRequiredBound;
+
+ if(clazzTvBeanBound.isAssignableFrom(clazzTvRequiredBound))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Learn whether the specified class is defined with type parameters.
+ * @param type to check
+ * @return true if there are type parameters
+ * @since 1.1.1
+ */
+ public static boolean isDefinitionContainsTypeVariables(Type type)
+ {
+ Class<?> clazz = ClassUtil.getClass(type);
+ Asserts.nullCheckForClass(clazz);
+
+ return clazz.getTypeParameters().length > 0;
+ }
+
+ /**
+ * Returns declared type arguments if {@code type} is a
+ * {@link ParameterizedType} instance, else an empty array.
+ * Get the actual type arguments of a type.
+ * @param type
+ * @return array of type arguments available
+ * @since 1.1.1
+ */
+ public static Type[] getActualTypeArguments(Type type)
+ {
+ Asserts.assertNotNull(type, "type parameter can not be null");
+
+ if (type instanceof ParameterizedType)
+ {
+ return ((ParameterizedType) type).getActualTypeArguments();
+
+ }
+ else
+ {
+ return new Type[0];
+ }
+ }
+
+ /**
+ * Return raw class type for given type.
+ * @param type base type instance
+ * @return class type for given type
+ */
+ public static Class<?> getClazz(Type type)
+ {
+ if(type instanceof ParameterizedType)
+ {
+ ParameterizedType pt = (ParameterizedType)type;
+ return (Class<?>)pt.getRawType();
+ }
+ else if(type instanceof Class)
+ {
+ return (Class<?>)type;
+ }
+ else if(type instanceof GenericArrayType)
+ {
+ GenericArrayType arrayType = (GenericArrayType)type;
+ return getClazz(arrayType.getGenericComponentType());
+ }
+ else if (type instanceof WildcardType)
+ {
+ WildcardType wildcardType = (WildcardType)type;
+ Type[] bounds = wildcardType.getUpperBounds();
+ if (bounds.length > 1)
+ {
+ throw new DefinitionException("Illegal use of wild card type with more than one upper bound: " + wildcardType);
+ }
+ else if (bounds.length == 0)
+ {
+ return Object.class;
+ }
+ else
+ {
+ return getClass(bounds[0]);
+ }
+ }
+ else if (type instanceof TypeVariable)
+ {
+ TypeVariable<?> typeVariable = (TypeVariable<?>)type;
+ if (typeVariable.getBounds().length > 1)
+ {
+ throw new DefinitionException("Illegal use of type variable with more than one bound: " + typeVariable);
+ }
+ else
+ {
+ Type[] bounds = typeVariable.getBounds();
+ if (bounds.length == 0)
+ {
+ return Object.class;
+ }
+ else
+ {
+ return getClass(bounds[0]);
+ }
+ }
+ }
+ else
+ {
+ throw new DefinitionException("Unsupported type " + type);
+ }
+ }
+
+ /**
+ * Return true if it does not contain type variable for wildcard type
+ * false otherwise.
+ *
+ * @param pType parameterized type
+ * @return true if it does not contain type variable for wildcard type
+ */
+ public static boolean checkParametrizedType(ParameterizedType pType)
+ {
+ Asserts.assertNotNull(pType, "pType argument can not be null");
+
+ Type[] types = pType.getActualTypeArguments();
+
+ for (Type type : types)
+ {
+ if (type instanceof ParameterizedType)
+ {
+ return checkParametrizedType((ParameterizedType) type);
+ }
+ else if ((type instanceof TypeVariable) || (type instanceof WildcardType))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+
+ /**
+ * Returns injection point raw type.
+ *
+ * @param injectionPoint injection point definition
+ * @return injection point raw type
+ */
+ public static Class<?> getRawTypeForInjectionPoint(InjectionPoint injectionPoint)
+ {
+ Class<?> rawType = null;
+ Type type = injectionPoint.getType();
+
+ if(type instanceof Class)
+ {
+ rawType = (Class<?>) type;
+ }
+ else if(type instanceof ParameterizedType)
+ {
+ ParameterizedType pt = (ParameterizedType)type;
+ rawType = (Class<?>)pt.getRawType();
+ }
+
+ return rawType;
+ }
+
+ /**
+ * Check whether <code>superClassMethod</code> is overridden by <code>subClassMethod</code>.
+ * @param subClassMethod potentially overriding
+ * @param superClassMethod potentially overridden
+ * @return true if overridden
+ * @since 1.1.1
+ */
+ public static boolean isOverridden(Method subClassMethod, Method superClassMethod)
+ {
+ if (isSuperClass(superClassMethod.getDeclaringClass(), subClassMethod.getDeclaringClass())
+ && subClassMethod.getName().equals(superClassMethod.getName())
+ && Arrays.equals(subClassMethod.getParameterTypes(), superClassMethod.getParameterTypes()))
+ {
+ int modifiers = superClassMethod.getModifiers();
+ if(Modifier.isPrivate(modifiers) || Modifier.isStatic(modifiers))
+ {
+ return false;
+ }
+
+ if(!Modifier.isProtected(modifiers) && !Modifier.isPublic(modifiers))
+ {
+ Class<?> superClass = superClassMethod.getDeclaringClass();
+ Class<?> subClass = subClassMethod.getDeclaringClass();
+
+ //Same package
+ if(!subClass.getPackage().getName().equals(superClass.getPackage().getName()))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+
+ private static boolean isSuperClass(Class<?> superClass, Class<?> subClass)
+ {
+ return superClass.isAssignableFrom(subClass) && !superClass.equals(subClass);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/CollectionUtil.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/CollectionUtil.java
new file mode 100644
index 0000000..734d7da
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/CollectionUtil.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.util;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+public class CollectionUtil
+{
+
+ public static <T> Set<T> unmodifiableSet(T... entries)
+ {
+ Set<T> set = new HashSet<T>(Arrays.asList(entries));
+ return Collections.unmodifiableSet(set);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/ExceptionUtil.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/ExceptionUtil.java
new file mode 100644
index 0000000..a024dc2
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/ExceptionUtil.java
@@ -0,0 +1,63 @@
+/*
+ * 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.webbeans.util;
+
+public abstract class ExceptionUtil
+{
+ private ExceptionUtil()
+ {
+ // prevent instantiation
+ }
+
+ public static RuntimeException throwAsRuntimeException(Throwable throwable)
+ {
+ //Attention: helper which allows to use a trick to throw
+ // a catched checked exception without a wrapping exception
+ new ExceptionHelper<RuntimeException>().throwException(throwable);
+ return null; //not needed due to the helper trick, but it's easier for using it
+ }
+
+ @SuppressWarnings({ "unchecked" })
+ private static class ExceptionHelper<T extends Throwable>
+ {
+ private void throwException(Throwable exception) throws T
+ {
+ try
+ {
+ //exception-type is only checked at compile-time
+ throw (T) exception;
+ }
+ catch (ClassCastException e)
+ {
+ //doesn't happen with existing JVMs! - if that changes the local ClassCastException needs to be ignored
+ //-> throw original exception
+ if (e.getStackTrace()[0].toString().contains(getClass().getName()))
+ {
+ if (exception instanceof RuntimeException)
+ {
+ throw (RuntimeException) exception;
+ }
+ throw new RuntimeException(exception);
+ }
+ //if the exception to throw is a ClassCastException, throw it
+ throw e;
+ }
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/GenericsUtil.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/GenericsUtil.java
new file mode 100644
index 0000000..6657f4d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/GenericsUtil.java
@@ -0,0 +1,643 @@
+/*
+ * 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.webbeans.util;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.GenericArrayType;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.lang.reflect.WildcardType;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.webbeans.config.OwbParametrizedTypeImpl;
+
+/**
+ * Utility classes for generic type operations.
+ */
+public final class GenericsUtil
+{
+ public static boolean satisfiesDependency(boolean isDelegate, Type injectionPointType, Type beanType)
+ {
+ if (beanType instanceof TypeVariable || beanType instanceof WildcardType || beanType instanceof GenericArrayType)
+ {
+ return isAssignableFrom(isDelegate, injectionPointType, beanType);
+ }
+ else
+ {
+ Type injectionPointRawType = injectionPointType instanceof ParameterizedType? ((ParameterizedType)injectionPointType).getRawType(): injectionPointType;
+ Type beanRawType = beanType instanceof ParameterizedType? ((ParameterizedType)beanType).getRawType(): beanType;
+
+ if (ClassUtil.isSame(injectionPointRawType, beanRawType))
+ {
+ return isAssignableFrom(isDelegate, injectionPointType, beanType);
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * 5.2.3 and 5.2.4
+ */
+ public static boolean isAssignableFrom(boolean isDelegate, Type requiredType, Type beanType)
+ {
+ if (requiredType instanceof Class)
+ {
+ return isAssignableFrom(isDelegate, (Class<?>)requiredType, beanType);
+ }
+ else if (requiredType instanceof ParameterizedType)
+ {
+ return isAssignableFrom(isDelegate, (ParameterizedType)requiredType, beanType);
+ }
+ else if (requiredType instanceof TypeVariable)
+ {
+ return isAssignableFrom(isDelegate, (TypeVariable<?>)requiredType, beanType);
+ }
+ else if (requiredType instanceof GenericArrayType)
+ {
+ return isAssignableFrom(isDelegate, (GenericArrayType)requiredType, beanType);
+ }
+ else if (requiredType instanceof WildcardType)
+ {
+ return isAssignableFrom(isDelegate, (WildcardType)requiredType, beanType);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unsupported type " + requiredType.getClass());
+ }
+ }
+
+ private static boolean isAssignableFrom(boolean isDelegate, Class<?> injectionPointType, Type beanType)
+ {
+ if (beanType instanceof Class)
+ {
+ return isAssignableFrom(isDelegate, injectionPointType, (Class<?>)beanType);
+ }
+ else if (beanType instanceof TypeVariable)
+ {
+ return isAssignableFrom(isDelegate, injectionPointType, (TypeVariable<?>)beanType);
+ }
+ else if (beanType instanceof ParameterizedType)
+ {
+ return isAssignableFrom(isDelegate, injectionPointType, (ParameterizedType)beanType);
+ }
+ else if (beanType instanceof GenericArrayType)
+ {
+ return isAssignableFrom(isDelegate, injectionPointType, (GenericArrayType)beanType);
+ }
+ else if (beanType instanceof WildcardType)
+ {
+ return isAssignableFrom(isDelegate, (Type)injectionPointType, (WildcardType)beanType);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unsupported type " + injectionPointType.getClass());
+ }
+ }
+
+ private static boolean isAssignableFrom(boolean isDelegate, Class<?> injectionPointType, Class<?> beanType)
+ {
+ return ClassUtil.isClassAssignable(injectionPointType, beanType);
+ }
+
+ private static boolean isAssignableFrom(boolean isDelegate, Class<?> injectionPointType, TypeVariable<?> beanType)
+ {
+ for (Type bounds: beanType.getBounds())
+ {
+ if (isAssignableFrom(isDelegate, injectionPointType, bounds))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * CDI Spec. 5.2.4: "A parameterized bean type is considered assignable to a raw required type
+ * if the raw types are identical and all type parameters of the bean type are either unbounded type variables or java.lang.Object."
+ */
+ private static boolean isAssignableFrom(boolean isDelegate, Class<?> injectionPointType, ParameterizedType beanType)
+ {
+ if (beanType.getRawType() != injectionPointType)
+ {
+ return false; //raw types don't match
+ }
+ for (Type typeArgument: beanType.getActualTypeArguments())
+ {
+ if (typeArgument == Object.class)
+ {
+ continue;
+ }
+ if (!(typeArgument instanceof TypeVariable))
+ {
+ return false; //neither object nor type variable
+ }
+ TypeVariable<?> typeVariable = (TypeVariable<?>)typeArgument;
+ for (Type bounds: typeVariable.getBounds())
+ {
+ if (bounds != Object.class)
+ {
+ return false; //bound type variable
+ }
+ }
+ }
+ return true;
+ }
+
+ private static boolean isAssignableFrom(boolean isDelegate, Class<?> injectionPointType, GenericArrayType beanType)
+ {
+ if (!injectionPointType.isArray())
+ {
+ return false;
+ }
+ return isAssignableFrom(isDelegate, injectionPointType.getComponentType(), beanType.getGenericComponentType());
+ }
+
+ private static boolean isAssignableFrom(boolean isDelegate, Type injectionPointType, WildcardType beanType)
+ {
+ for (Type bounds: beanType.getLowerBounds())
+ {
+ if (!isAssignableFrom(isDelegate, bounds, injectionPointType))
+ {
+ return false;
+ }
+ }
+ for (Type bounds: beanType.getUpperBounds())
+ {
+ if (isAssignableFrom(isDelegate, injectionPointType, bounds))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static boolean isAssignableFrom(boolean isDelegate, ParameterizedType injectionPointType, Type beanType)
+ {
+ if (beanType instanceof Class)
+ {
+ return isAssignableFrom(isDelegate, injectionPointType, (Class<?>)beanType);
+ }
+ else if (beanType instanceof TypeVariable)
+ {
+ return isAssignableFrom(isDelegate, injectionPointType, (TypeVariable<?>)beanType);
+ }
+ else if (beanType instanceof ParameterizedType)
+ {
+ return isAssignableFrom(isDelegate, injectionPointType, (ParameterizedType)beanType);
+ }
+ else if (beanType instanceof WildcardType)
+ {
+ return isAssignableFrom(isDelegate, (Type)injectionPointType, (WildcardType)beanType);
+ }
+ else if (beanType instanceof GenericArrayType)
+ {
+ return false;
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unsupported type " + injectionPointType.getClass());
+ }
+ }
+
+ private static boolean isAssignableFrom(boolean isDelegate, ParameterizedType injectionPointType, Class<?> beanType)
+ {
+ return isAssignableFrom(isDelegate, injectionPointType.getRawType(), beanType);
+ }
+
+ private static boolean isAssignableFrom(boolean isDelegate, ParameterizedType injectionPointType, TypeVariable<?> beanType)
+ {
+ for (Type bounds: beanType.getBounds())
+ {
+ if (isAssignableFrom(isDelegate, injectionPointType, bounds))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * CDI Spec. 5.2.4
+ */
+ private static boolean isAssignableFrom(boolean isDelegate, ParameterizedType injectionPointType, ParameterizedType beanType)
+ {
+ if (injectionPointType.getRawType() != beanType.getRawType())
+ {
+ return false;
+ }
+ Type[] injectionPointTypeArguments = injectionPointType.getActualTypeArguments();
+ Type[] beanTypeArguments = beanType.getActualTypeArguments();
+ for (int i = 0; i < injectionPointTypeArguments.length; i++)
+ {
+ Type injectionPointTypeArgument = injectionPointTypeArguments[i];
+ Type beanTypeArgument = beanTypeArguments[i];
+
+ // for this special case it's actually an 'assignable to', thus we swap the params, see CDI-389
+ // but this special rule does not apply to Delegate injection points...
+ if (!isDelegate &&
+ injectionPointTypeArgument instanceof Class &&
+ beanTypeArgument instanceof TypeVariable)
+ {
+ for (Type upperBound: ((TypeVariable) beanTypeArgument).getBounds())
+ {
+ if (!isAssignableFrom(isDelegate, upperBound, injectionPointTypeArgument))
+ {
+ return false;
+ }
+ }
+
+ }
+ else if (!isAssignableFrom(isDelegate, injectionPointTypeArgument, beanTypeArgument))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private static boolean isAssignableFrom(boolean isDelegate, TypeVariable<?> injectionPointType, Type beanType)
+ {
+ for (Type bounds: injectionPointType.getBounds())
+ {
+ if (!isAssignableFrom(isDelegate, bounds, beanType))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private static boolean isAssignableFrom(boolean isDelegate, GenericArrayType injectionPointType, Type beanType)
+ {
+ throw new UnsupportedOperationException("Not yet implementeds");
+ }
+
+ private static boolean isAssignableFrom(boolean isDelegate, WildcardType injectionPointType, Type beanType)
+ {
+ for (Type bounds: injectionPointType.getLowerBounds())
+ {
+ if (!isAssignableFrom(isDelegate, beanType, bounds))
+ {
+ return false;
+ }
+ }
+ for (Type bounds: injectionPointType.getUpperBounds())
+ {
+ if (!isAssignableFrom(isDelegate, bounds, beanType))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Resolves the actual type of the specified field for the type hierarchy specified by the given subclass
+ */
+ public static Type resolveType(Class<?> subclass, Field field)
+ {
+ return resolveType(field.getGenericType(), new TypeVariableResolver(subclass, field.getDeclaringClass()));
+ }
+
+ /**
+ * Resolves the actual return type of the specified method for the type hierarchy specified by the given subclass
+ */
+ public static Type resolveReturnType(Class<?> subclass, Method method)
+ {
+ return resolveType(method.getGenericReturnType(), new TypeVariableResolver(subclass, method.getDeclaringClass()));
+ }
+
+ /**
+ * Resolves the actual parameter types of the specified constructor for the type hierarchy specified by the given subclass
+ */
+ public static Type[] resolveParameterTypes(Class<?> subclass, Constructor<?> constructor)
+ {
+ return resolveTypes(constructor.getGenericParameterTypes(), new TypeVariableResolver(subclass, constructor.getDeclaringClass()));
+ }
+
+ /**
+ * Resolves the actual parameter types of the specified method for the type hierarchy specified by the given subclass
+ */
+ public static Type[] resolveParameterTypes(Class<?> subclass, Method method)
+ {
+ return resolveTypes(method.getGenericParameterTypes(), new TypeVariableResolver(subclass, method.getDeclaringClass()));
+ }
+
+ /**
+ * Resolves the actual type of the specified type for the type hierarchy specified by the given subclass
+ */
+ public static Type resolveType(Type type, Class<?> subclass, Member member)
+ {
+ return resolveType(type, new TypeVariableResolver(subclass, member.getDeclaringClass()));
+ }
+
+ private static Type resolveType(Type type, TypeVariableResolver resolver)
+ {
+ if (type instanceof Class)
+ {
+ return type;
+ }
+ else if (type instanceof ParameterizedType)
+ {
+ ParameterizedType parameterizedType = (ParameterizedType)type;
+ Type[] resolvedTypes = resolveTypes(parameterizedType.getActualTypeArguments(), resolver);
+ return new OwbParametrizedTypeImpl(parameterizedType.getOwnerType(), parameterizedType.getRawType(), resolvedTypes);
+ }
+ else if (type instanceof TypeVariable)
+ {
+ TypeVariable<?> variable = (TypeVariable<?>)type;
+ return resolver.resolve(variable);
+ }
+ else if (type instanceof WildcardType)
+ {
+ WildcardType wildcardType = (WildcardType) type;
+ if (wildcardType.getLowerBounds().length > 0)
+ {
+ return type;
+ }
+ Type[] resolvedTypes = resolveTypes(wildcardType.getUpperBounds(), resolver);
+ return resolveType(getMostSpecificType(getRawTypes(resolvedTypes, resolver), resolvedTypes), resolver);
+ }
+ else if (type instanceof GenericArrayType)
+ {
+ Type componentType = resolveType(((GenericArrayType)type).getGenericComponentType(), resolver);
+ Class<?> componentClass = getRawType(componentType, resolver);
+ return Array.newInstance(componentClass, 0).getClass();
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unsupported type " + type.getClass().getName());
+ }
+ }
+
+ public static Type[] resolveTypes(Type[] types, TypeVariableResolver resolution)
+ {
+ Type[] resolvedTypeArguments = new Type[types.length];
+ for (int i = 0; i < types.length; i++)
+ {
+ resolvedTypeArguments[i] = resolveType(types[i], resolution);
+ }
+ return resolvedTypeArguments;
+ }
+
+ public static Set<Type> getTypeClosure(Type type, Class<?> owningClass, Class<?> declaringClass)
+ {
+ Set<Type> typeClosure = new HashSet<Type>();
+ typeClosure.add(Object.class);
+ fillTypeHierarchy(typeClosure, type, new TypeVariableResolver(owningClass, declaringClass));
+ return typeClosure;
+ }
+
+ private static void fillTypeHierarchy(Set<Type> set, Type type, TypeVariableResolver resolver)
+ {
+ if (type == null)
+ {
+ return;
+ }
+ Type resolvedType = GenericsUtil.resolveType(type, resolver);
+ set.add(resolvedType);
+ Class<?> resolvedClass = GenericsUtil.getRawType(resolvedType, resolver);
+ if (resolvedClass.getSuperclass() != null)
+ {
+ fillTypeHierarchy(set, resolvedClass.getGenericSuperclass(), resolver.add(resolvedClass));
+ }
+ for (Type interfaceType: resolvedClass.getGenericInterfaces())
+ {
+ fillTypeHierarchy(set, interfaceType, resolver.add(resolvedClass, interfaceType));
+ }
+ }
+
+ static <T> Class<T> getRawType(Type type, TypeVariableResolver resolver)
+ {
+ if (type instanceof Class)
+ {
+ return (Class<T>)type;
+ }
+ else if (type instanceof ParameterizedType)
+ {
+ return getRawType(((ParameterizedType) type).getRawType(), resolver);
+ }
+ else if ((type instanceof TypeVariable) || (type instanceof WildcardType) || (type instanceof GenericArrayType))
+ {
+ Type resolvedType = resolveType(type, resolver);
+ if (resolvedType instanceof TypeVariable)
+ {
+ TypeVariable<?> variable = (TypeVariable<?>)resolvedType;
+ return getRawType(resolveType(getRawType(variable.getBounds(), resolver), resolver), resolver);
+ }
+ else
+ {
+ return getRawType(resolvedType, resolver);
+ }
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unsupported type " + type.getClass().getName());
+ }
+ }
+
+ private static Type getRawType(Type[] types, TypeVariableResolver resolver)
+ {
+ Class<?>[] rawTypes = getRawTypes(types, resolver);
+ Class<?>[] classTypes = getClassTypes(rawTypes);
+ if (classTypes.length > 0)
+ {
+ return getMostSpecificType(classTypes, types);
+ }
+ else
+ {
+ return getMostSpecificType(rawTypes, types);
+ }
+ }
+
+ private static <T> Class<T>[] getRawTypes(Type[] types, TypeVariableResolver resolver)
+ {
+ Class<T>[] rawTypes = new Class[types.length];
+ for (int i = 0; i < types.length; i++)
+ {
+ rawTypes[i] = getRawType(types[i], resolver);
+ }
+ return rawTypes;
+ }
+
+ private static Type getMostSpecificType(Class<?>[] types, Type[] genericTypes)
+ {
+ Class<?> mostSpecificType = types[0];
+ int mostSpecificIndex = 0;
+ for (int i = 0; i < types.length; i++)
+ {
+ if (mostSpecificType.isAssignableFrom(types[i]))
+ {
+ mostSpecificType = types[i];
+ mostSpecificIndex = i;
+ }
+ }
+ return genericTypes[mostSpecificIndex];
+ }
+
+ private static Class<?>[] getClassTypes(Class<?>[] rawTypes)
+ {
+ List<Class<?>> classTypes = new ArrayList<Class<?>>();
+ for (Class<?> rawType : rawTypes)
+ {
+ if (!rawType.isInterface())
+ {
+ classTypes.add(rawType);
+ }
+ }
+ return classTypes.toArray(new Class[classTypes.size()]);
+ }
+
+ /**
+ * resolves actual types of a TypeVariable for a specific type hierarchy
+ */
+ private static class TypeVariableResolver
+ {
+ private List<TypeVariableDeclaration> declarations = new ArrayList<TypeVariableDeclaration>();
+
+ private TypeVariableResolver(List<TypeVariableDeclaration> implementation)
+ {
+ declarations = implementation;
+ }
+
+ public TypeVariableResolver(Class<?> subclass, Class<?> declaringClass)
+ {
+ declarations.add(new TypeVariableDeclaration(subclass, subclass.getGenericSuperclass()));
+ while (declaringClass != subclass && declaringClass.isAssignableFrom(subclass))
+ {
+ subclass = subclass.getSuperclass();
+ declarations.add(new TypeVariableDeclaration(subclass, subclass.getGenericSuperclass()));
+ }
+ }
+
+ public Type resolve(TypeVariable<?> variable)
+ {
+ if (declarations.size() < 2)
+ {
+ return variable;
+ //X TODO better handling needed: return getRawType(variable.getBounds(), this);
+ }
+ int hierarchyIndex = declarations.size() - 1;
+ TypeVariableDeclaration typeVariableImplementation = declarations.get(hierarchyIndex);
+ TypeVariable<?>[] typeParameters = typeVariableImplementation.getDeclaredTypeParameters();
+ int typeIndex = -1;
+ for (int i = 0; i < typeParameters.length; i++)
+ {
+ if (variable.getName().equals(typeParameters[i].getName()))
+ {
+ typeIndex = i;
+ break;
+ }
+ }
+ if (typeIndex == -1)
+ {
+ // type erasure
+ return Object.class;
+ }
+ TypeVariableDeclaration declaration = declarations.get(hierarchyIndex - 1);
+ Type genericClass = declaration.getAssignment();
+ if (genericClass instanceof ParameterizedType)
+ {
+ ParameterizedType classType = (ParameterizedType)genericClass;
+ final Type[] actualTypeArguments = classType.getActualTypeArguments();
+ if (actualTypeArguments.length > typeIndex)
+ {
+ return resolveType(actualTypeArguments[typeIndex], remove());
+ }
+ else
+ {
+ return Object.class;
+ }
+ }
+ else
+ {
+ TypeVariable<?>[] typeVariables = declaration.getDeclaredTypeParameters();
+ if (typeVariables.length > typeIndex)
+ {
+ return resolveType(typeVariables[typeIndex], remove());
+ }
+ else
+ {
+ return Object.class; //type erasure
+ }
+ }
+ }
+
+ public TypeVariableResolver add(Class<?> type)
+ {
+ return add(type, type.getGenericSuperclass());
+ }
+
+ public TypeVariableResolver add(Class<?> declaringClass, Type assignment)
+ {
+ List<TypeVariableDeclaration> declarations = new ArrayList<TypeVariableDeclaration>(this.declarations);
+ declarations.add(new TypeVariableDeclaration(declaringClass, assignment));
+ return new TypeVariableResolver(declarations);
+ }
+
+ public TypeVariableResolver remove()
+ {
+ List<TypeVariableDeclaration> declarations = new ArrayList<TypeVariableDeclaration>(this.declarations);
+ declarations.remove(declarations.size() - 1);
+ return new TypeVariableResolver(declarations);
+ }
+ }
+
+ /**
+ * A declaration of type variables along with its assignments
+ */
+ private static class TypeVariableDeclaration
+ {
+ private Class<?> declaringClass;
+ private Type assignment;
+
+ public TypeVariableDeclaration(Class<?> declaringClass, Type assignment)
+ {
+ this.declaringClass = declaringClass;
+ this.assignment = assignment;
+ }
+
+ public Type getAssignment()
+ {
+ return assignment;
+ }
+
+ public TypeVariable<?>[] getDeclaredTypeParameters()
+ {
+ return declaringClass.getTypeParameters();
+ }
+ }
+
+ private static class TypeErasureException extends Exception
+ {
+ public TypeErasureException()
+ {
+ super("generic type information not available");
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/InjectionExceptionUtil.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/InjectionExceptionUtil.java
new file mode 100644
index 0000000..3c0b79b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/InjectionExceptionUtil.java
@@ -0,0 +1,152 @@
+/*
+ * 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.webbeans.util;
+
+import org.apache.webbeans.exception.helper.ViolationMessageBuilder;
+import static org.apache.webbeans.exception.helper.ViolationMessageBuilder.newViolation;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.AmbiguousResolutionException;
+import javax.enterprise.inject.UnsatisfiedResolutionException;
+import javax.enterprise.inject.UnproxyableResolutionException;
+import java.util.Set;
+import java.lang.annotation.Annotation;
+
+public class InjectionExceptionUtil
+{
+ private InjectionExceptionUtil()
+ {
+ // utility class ct
+ }
+
+ public static void throwUnproxyableResolutionException(ViolationMessageBuilder violationMessage)
+ {
+ throw new UnproxyableResolutionException(
+ newViolation("WebBeans with api type with normal scope must be proxyable.")
+ .addLine(violationMessage.toString())
+ .toString());
+ }
+
+ public static void throwUnsatisfiedResolutionException(
+ Class type, InjectionPoint injectionPoint, Annotation... qualifiers)
+ {
+ ViolationMessageBuilder violationMessage =
+ newViolation("Api type [", type.getName(), "] is not found with the qualifiers ");
+
+ violationMessage.addLine(createQualifierMessage(qualifiers));
+
+ if (injectionPoint != null)
+ {
+ violationMessage.addLine("for injection into ", injectionPoint.toString());
+ }
+
+ throw new UnsatisfiedResolutionException(violationMessage.toString());
+ }
+
+ public static void throwAmbiguousResolutionExceptionForBeanName(Set<Bean<?>> beans, String beanName)
+ {
+ throwAmbiguousResolutionExceptionForBeans(beans,
+ newViolation("There are more than one WebBeans with name : ", beanName));
+ }
+
+ public static void throwAmbiguousResolutionException(Set<Bean<?>> beans)
+ {
+ throwAmbiguousResolutionException(beans, null, null);
+ }
+
+ public static void throwAmbiguousResolutionException(Set<Bean<?>> beans, Class type, InjectionPoint injectionPoint, Annotation... qualifiers)
+ {
+ String qualifierMessage = createQualifierMessage(qualifiers);
+
+ ViolationMessageBuilder violationMessage;
+
+ if(type != null)
+ {
+ violationMessage = newViolation("There is more than one api type with : ",
+ ClassUtil.getClass(type).getName(), " with qualifiers : ", qualifierMessage);
+ if (injectionPoint != null)
+ {
+ violationMessage.addLine("for injection into ", injectionPoint.toString());
+ }
+ }
+ else
+ {
+ violationMessage = newViolation("Ambiguous resolution");
+ }
+
+ throwAmbiguousResolutionExceptionForBeans(beans, violationMessage);
+ }
+
+ private static void throwAmbiguousResolutionExceptionForBeans(
+ Set<Bean<?>> beans, ViolationMessageBuilder violationMessage)
+ {
+ violationMessage.addLine("found beans: ");
+
+ addBeanInfo(beans, violationMessage);
+
+ throw new AmbiguousResolutionException(violationMessage.toString());
+ }
+
+ private static void addBeanInfo(Set<Bean<?>> beans, ViolationMessageBuilder violationMessage)
+ {
+ String sourcePath;
+ for(Bean<?> currentBean : beans)
+ {
+ try
+ {
+ Class beanClass = currentBean.getBeanClass();
+ sourcePath = beanClass.getResource(beanClass.getSimpleName() + ".class").toExternalForm();
+ }
+ catch (RuntimeException e)
+ {
+ sourcePath = "unknown path";
+ }
+
+ violationMessage.addLine(currentBean.toString() + " from " + sourcePath);
+ }
+ }
+
+ private static String createQualifierMessage(Annotation... qualifiers)
+ {
+ if(qualifiers == null || qualifiers.length == 0)
+ {
+ return null;
+ }
+
+ //reused source-code
+ StringBuilder qualifierMessage = new StringBuilder("Qualifiers: [");
+
+ int i = 0;
+ for(Annotation annot : qualifiers)
+ {
+ i++;
+ qualifierMessage.append(annot);
+
+ if(i != qualifiers.length)
+ {
+ qualifierMessage.append(",");
+ }
+ }
+
+ qualifierMessage.append("]");
+
+ return qualifierMessage.toString();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/JNDIUtil.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/JNDIUtil.java
new file mode 100644
index 0000000..345a41a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/JNDIUtil.java
@@ -0,0 +1,112 @@
+/*
+ * 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.webbeans.util;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingException;
+
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * This is the internal helper class for low level access to JNDI
+ * @see org.apache.webbeans.spi.JNDIService for transparent access over SPI
+ */
+public final class JNDIUtil
+{
+ private static final Logger LOGGER = WebBeansLoggerFacade.getLogger(JNDIUtil.class);
+
+ private JNDIUtil()
+ {
+
+ }
+
+ public static void bind(String name, Object object)
+ {
+ Asserts.assertNotNull(name, "name parameter can not be null");
+ Asserts.assertNotNull(object, "object parameter can not be null");
+
+ try
+ {
+ InitialContext initialContext = new InitialContext();
+ Context context = initialContext;
+
+ String[] parts = name.split("/");
+
+ for(int i=0;i< parts.length -1;i++)
+ {
+ try
+ {
+ context = (Context)initialContext.lookup(parts[i]);
+
+ }
+ catch(NameNotFoundException e)
+ {
+ context = initialContext.createSubcontext(parts[i]);
+ }
+
+ }
+
+ context.bind(parts[parts.length -1], object);
+ }
+ catch (NamingException e)
+ {
+ LOGGER.log(Level.SEVERE, WebBeansLoggerFacade.constructMessage(OWBLogConst.ERROR_0005, name), e);
+ }
+ }
+
+ public static void unbind(String name)
+ {
+ Asserts.assertNotNull(name, "name parameter can not be null");
+
+ try
+ {
+ new InitialContext().unbind(name);
+
+ }
+ catch (NamingException e)
+ {
+ LOGGER.log(Level.SEVERE, e.getMessage(), e);
+ throw new WebBeansException(WebBeansLoggerFacade.getTokenString(OWBLogConst.EXCEPT_0009) + name, e);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T> T lookup(String name, Class<? extends T> expectedClass) throws WebBeansException
+ {
+ Asserts.assertNotNull(name, "name parameter can not be null");
+
+ try
+ {
+ return (T) new InitialContext().lookup(name);
+ }
+ catch (NamingException e)
+ {
+ LOGGER.log(Level.SEVERE, e.getMessage(), e);
+ throw new WebBeansException(WebBeansLoggerFacade.getTokenString(OWBLogConst.EXCEPT_0010) + name, e);
+ }
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/OwbCustomObjectInputStream.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/OwbCustomObjectInputStream.java
new file mode 100644
index 0000000..8cfdc57
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/OwbCustomObjectInputStream.java
@@ -0,0 +1,61 @@
+/*
+ * 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.webbeans.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectStreamClass;
+import java.lang.reflect.Proxy;
+
+public class OwbCustomObjectInputStream extends ObjectInputStream
+{
+ private ClassLoader classLoader;
+
+ public OwbCustomObjectInputStream(InputStream in, ClassLoader classLoader) throws IOException
+ {
+ super(in);
+ this.classLoader = classLoader;
+ }
+
+ @Override
+ protected Class<?> resolveClass(ObjectStreamClass desc) throws ClassNotFoundException
+ {
+ return Class.forName(desc.getName(), false, classLoader);
+ }
+
+ @Override
+ protected Class resolveProxyClass(String[] interfaces) throws IOException, ClassNotFoundException
+ {
+ final Class[] cinterfaces = new Class[interfaces.length];
+ for (int i = 0; i < interfaces.length; i++)
+ {
+ cinterfaces[i] = Class.forName(interfaces[i], false, classLoader);
+ }
+
+ try
+ {
+ return Proxy.getProxyClass(classLoader, cinterfaces);
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new ClassNotFoundException(null, e);
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/SecurityUtil.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/SecurityUtil.java
new file mode 100644
index 0000000..a1946fe
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/SecurityUtil.java
@@ -0,0 +1,66 @@
+/*
+ * 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.webbeans.util;
+
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/** @deprecated use SecurityService instead */
+public class SecurityUtil
+{
+
+ private static final int METHOD_CLASS_GETDECLAREDMETHODS = 0x04;
+
+ public static <T> Method[] doPrivilegedGetDeclaredMethods(Class<T> clazz)
+ {
+ if (System.getSecurityManager() == null)
+ {
+ return clazz.getDeclaredMethods();
+ }
+
+ Object obj = AccessController.doPrivileged(
+ new PrivilegedActionForClass(clazz, null, METHOD_CLASS_GETDECLAREDMETHODS));
+ return (Method[])obj;
+ }
+
+ protected static class PrivilegedActionForClass implements PrivilegedAction<Object>
+ {
+ private Class<?> clazz;
+
+ protected PrivilegedActionForClass(Class<?> clazz, Object parameters, int method)
+ {
+ this.clazz = clazz;
+ }
+
+ @Override
+ public Object run()
+ {
+ try
+ {
+ return clazz.getDeclaredMethods();
+ }
+ catch (Exception exception)
+ {
+ return exception;
+ }
+ }
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/SortedListHelper.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/SortedListHelper.java
new file mode 100644
index 0000000..7ce39cf
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/SortedListHelper.java
@@ -0,0 +1,64 @@
+/*
+ * 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.webbeans.util;
+
+import java.util.List;
+import java.util.Comparator;
+
+public class SortedListHelper<E>
+{
+
+ private List<E> list;
+ private Comparator<E> comparator;
+
+ public SortedListHelper(List<E>list, Comparator<E> comparator)
+ {
+ this.list = list;
+ this.comparator = comparator;
+ }
+
+ public List<E> getList()
+ {
+ return list;
+ }
+
+ public boolean add(E object)
+ {
+ if (list.isEmpty())
+ {
+ list.add(object);
+ return true;
+ }
+ for(int i=0; i<list.size(); i++)
+ {
+ E obj = list.get(i);
+ if (comparator.compare(object, obj) < 0)
+ {
+ list.add(i, object);
+ return true;
+ }
+ }
+ return list.add(object);
+ }
+
+ public void clear()
+ {
+ list.clear();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/UrlSet.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/UrlSet.java
new file mode 100644
index 0000000..28f4ecf
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/UrlSet.java
@@ -0,0 +1,128 @@
+/*
+ * 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.webbeans.util;
+
+import java.net.URL;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * A {@link java.util.Set} which only takes the externalForm
+ * as key instead the very expensive hashCode.
+ */
+public class UrlSet implements Set<URL>
+{
+ private Map<String, URL> urlMap = new HashMap<String, URL>();
+
+
+ @Override
+ public boolean add(URL url)
+ {
+ return urlMap.put(url.toExternalForm(), url) == null;
+ }
+
+ @Override
+ public int size()
+ {
+ return urlMap.size();
+ }
+
+ @Override
+ public boolean isEmpty()
+ {
+ return urlMap.isEmpty();
+ }
+
+ @Override
+ public boolean contains(Object o)
+ {
+ if (o instanceof URL && o != null)
+ {
+ return urlMap.containsKey(((URL) o).toExternalForm());
+ }
+
+ return false;
+ }
+
+ @Override
+ public Iterator<URL> iterator()
+ {
+ return urlMap.values().iterator();
+ }
+
+ @Override
+ public Object[] toArray()
+ {
+ return urlMap.values().toArray();
+ }
+
+ @Override
+ public <T> T[] toArray(T[] a)
+ {
+ return urlMap.values().toArray(a);
+ }
+
+ @Override
+ public boolean remove(Object o)
+ {
+ if (o instanceof URL && o != null)
+ {
+ return urlMap.remove(((URL) o).toExternalForm()) != null;
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean containsAll(Collection<?> c)
+ {
+ // not implemented
+ return false;
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends URL> c)
+ {
+ // not implemented
+ return false;
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c)
+ {
+ // not implemented
+ return false;
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c)
+ {
+ // not implemented
+ return false;
+ }
+
+ @Override
+ public void clear()
+ {
+ urlMap.clear();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansConstants.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansConstants.java
new file mode 100644
index 0000000..0fe30b1
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansConstants.java
@@ -0,0 +1,59 @@
+/*
+ * 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.webbeans.util;
+
+
+/**
+ * Web beans related constants.
+ *
+ * @version $Rev$ $Date$
+ */
+public final class WebBeansConstants
+{
+
+ private WebBeansConstants()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public static final String [] OWB_INJECTABLE_RESOURCE_ANNOTATIONS = {"javax.ejb.EJB",
+ "javax.annotation.Resource",
+ "javax.xml.ws.WebServiceRef",
+ "javax.persistence.PersistenceUnit",
+ "javax.persistence.PersistenceContext"};
+
+ public static final String WEB_BEANS_XML_SPEC_SPECIFIC_INTERCEPTORS_ELEMENT = "interceptors";
+
+ public static final String WEB_BEANS_XML_SPEC_SPECIFIC_DECORATORS_ELEMENT = "decorators";
+
+
+ public static final String WEB_BEANS_XML_SPEC_SPECIFIC_ALTERNATIVES = "alternatives";
+
+ public static final String WEB_BEANS_XML_SPEC_SPECIFIC_CLASS = "class";
+
+ public static final String WEB_BEANS_XML_SPEC_SPECIFIC_STEREOTYPE = "stereotype";
+
+ public static final String WEB_BEANS_XML_OWB_SPECIFIC_CLASS = "Class";
+
+ public static final String WEB_BEANS_XML_OWB_SPECIFIC_STEREOTYPE = "Stereotype";
+
+ /**JNDI name of the {@link javax.enterprise.inject.spi.BeanManager} instance*/
+ public static final String WEB_BEANS_MANAGER_JNDI_NAME = "java:comp/BeanManager";
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
new file mode 100644
index 0000000..3b3a6f1
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
@@ -0,0 +1,1801 @@
+/*
+ * 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.webbeans.util;
+
+import org.apache.webbeans.annotation.AnnotationManager;
+import org.apache.webbeans.annotation.NewLiteral;
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.component.AbstractProducerBean;
+import org.apache.webbeans.component.BeanAttributesImpl;
+import org.apache.webbeans.component.BeanManagerBean;
+import org.apache.webbeans.component.BeanMetadataBean;
+import org.apache.webbeans.component.ConversationBean;
+import org.apache.webbeans.component.DecoratorMetadataBean;
+import org.apache.webbeans.component.EnterpriseBeanMarker;
+import org.apache.webbeans.component.EventBean;
+import org.apache.webbeans.component.ExtensionBean;
+import org.apache.webbeans.component.InjectionPointBean;
+import org.apache.webbeans.component.InjectionTargetBean;
+import org.apache.webbeans.component.InstanceBean;
+import org.apache.webbeans.component.InterceptedOrDecoratedBeanMetadataBean;
+import org.apache.webbeans.component.InterceptorMetadataBean;
+import org.apache.webbeans.component.ManagedBean;
+import org.apache.webbeans.component.NewBean;
+import org.apache.webbeans.component.NewManagedBean;
+import org.apache.webbeans.component.OwbBean;
+import org.apache.webbeans.component.ProducerFieldBean;
+import org.apache.webbeans.component.ProducerMethodBean;
+import org.apache.webbeans.component.ResourceBean;
+import org.apache.webbeans.component.WebBeansType;
+import org.apache.webbeans.component.creation.BeanAttributesBuilder;
+import org.apache.webbeans.component.creation.ExtensionBeanBuilder;
+import org.apache.webbeans.component.creation.ManagedBeanBuilder;
+import org.apache.webbeans.component.creation.ObserverMethodsBuilder;
+import org.apache.webbeans.component.creation.ProducerFieldBeansBuilder;
+import org.apache.webbeans.component.creation.ProducerMethodBeansBuilder;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.container.InjectionResolver;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.exception.WebBeansDeploymentException;
+import org.apache.webbeans.exception.inject.DefinitionException;
+import org.apache.webbeans.exception.inject.InconsistentSpecializationException;
+import org.apache.webbeans.inject.AlternativesManager;
+import org.apache.webbeans.plugins.PluginLoader;
+import org.apache.webbeans.portable.AbstractProducer;
+import org.apache.webbeans.portable.InjectionTargetImpl;
+import org.apache.webbeans.portable.ProducerMethodProducer;
+import org.apache.webbeans.portable.events.discovery.ErrorStack;
+import org.apache.webbeans.portable.events.generics.GProcessAnnotatedType;
+import org.apache.webbeans.portable.events.generics.GProcessBean;
+import org.apache.webbeans.portable.events.generics.GProcessInjectionTarget;
+import org.apache.webbeans.portable.events.generics.GProcessManagedBean;
+import org.apache.webbeans.portable.events.generics.GProcessObservableMethod;
+import org.apache.webbeans.portable.events.generics.GProcessProducer;
+import org.apache.webbeans.portable.events.generics.GProcessProducerField;
+import org.apache.webbeans.portable.events.generics.GProcessProducerMethod;
+import org.apache.webbeans.portable.events.generics.GProcessSessionBean;
+import org.apache.webbeans.spi.plugins.OpenWebBeansEjbPlugin;
+import org.apache.webbeans.spi.plugins.OpenWebBeansPlugin;
+
+import javax.decorator.Decorator;
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.IllegalProductException;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.Specializes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.AfterDeploymentValidation;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMember;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.BeforeShutdown;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.ObserverMethod;
+import javax.enterprise.inject.spi.PassivationCapable;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+import javax.enterprise.inject.spi.ProcessBean;
+import javax.enterprise.inject.spi.ProcessInjectionTarget;
+import javax.enterprise.inject.spi.ProcessManagedBean;
+import javax.enterprise.inject.spi.ProcessObserverMethod;
+import javax.enterprise.inject.spi.ProcessProducer;
+import javax.enterprise.inject.spi.ProcessProducerField;
+import javax.enterprise.inject.spi.ProcessProducerMethod;
+import javax.enterprise.inject.spi.ProcessSessionBean;
+import javax.enterprise.inject.spi.Producer;
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Contains some utility methods used in the all project.
+ */
+@SuppressWarnings("unchecked")
+public final class WebBeansUtil
+{
+ private final WebBeansContext webBeansContext;
+
+ public WebBeansUtil(WebBeansContext webBeansContext)
+ {
+ this.webBeansContext = webBeansContext;
+ }
+
+ /**
+ * Gets current classloader with current thread.
+ *
+ * @return Current class loader instance
+ */
+ public static ClassLoader getCurrentClassLoader()
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+
+ if (loader == null)
+ {
+ loader = WebBeansUtil.class.getClassLoader();
+ }
+
+ return loader;
+ }
+
+ /**
+ * Checks the generic type requirements.
+ */
+ public static void checkGenericType(Class<?> clazz, Class<? extends Annotation> scope)
+ {
+ Asserts.assertNotNull(clazz);
+
+ if (ClassUtil.isDefinitionContainsTypeVariables(clazz))
+ {
+ if(!scope.equals(Dependent.class))
+ {
+ throw new WebBeansConfigurationException("Generic type may only defined with scope @Dependent " +
+ "for ManagedBean class : " + clazz.getName());
+ }
+ }
+ }
+
+
+ /**
+ * Check producer method/field bean return type.
+ * @param bean producer bean instance
+ * @param member related member instance
+ */
+ public static void checkProducerGenericType(Bean<?> bean,Member member)
+ {
+ Asserts.assertNotNull(bean,"Bean is null");
+
+ Type type = null;
+
+ if(bean instanceof ProducerMethodBean)
+ {
+ type = ((ProducerMethodBean<?>)bean).getCreatorMethod().getGenericReturnType();
+ }
+ else if(bean instanceof ProducerFieldBean)
+ {
+ type = ((ProducerFieldBean<?>)bean).getCreatorField().getGenericType();
+ }
+ else
+ {
+ throw new IllegalArgumentException("Bean must be Producer Field or Method Bean instance : " + bean);
+ }
+
+ String messageTemplate = "Producer Field/Method Bean with name : %s" +
+ " in bean class : %s";
+
+ String memberName = member.getName();
+ String declaringClassName = member.getDeclaringClass().getName();
+ if(checkGenericForProducers(type, messageTemplate, memberName, declaringClassName))
+ {
+ if(!bean.getScope().equals(Dependent.class))
+ {
+ String message = format(messageTemplate, memberName, declaringClassName);
+ throw new WebBeansConfigurationException(message + " scope must bee @Dependent");
+ }
+ }
+ }
+
+ /**
+ * Check generic types for producer method and fields.
+ * @param type generic return type
+ * @param messageTemplate error message
+ * @return true if parametrized type argument is TypeVariable
+ */
+ //Helper method
+ private static boolean checkGenericForProducers(Type type, String messageTemplate, Object... errorMessageArgs)
+ {
+ boolean result = false;
+
+ if(type instanceof TypeVariable)
+ {
+ String message = format(messageTemplate, errorMessageArgs);
+ throw new WebBeansConfigurationException(message + " return type can not be type variable");
+ }
+
+ if(ClassUtil.isParametrizedType(type))
+ {
+ Type[] actualTypes = ClassUtil.getActualTypeArguments(type);
+
+ if(actualTypes.length == 0)
+ {
+ String message = format(messageTemplate, errorMessageArgs);
+ throw new WebBeansConfigurationException(message +
+ " return type must define actual type arguments or type variable");
+ }
+
+ for(Type actualType : actualTypes)
+ {
+ if(ClassUtil.isWildCardType(actualType))
+ {
+ String message = format(messageTemplate, errorMessageArgs);
+ throw new WebBeansConfigurationException(message +
+ " return type can not define wildcard actual type argument");
+ }
+
+ if(ClassUtil.isTypeVariable(actualType))
+ {
+ result = true;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns true if this class can be candidate for simple web bean, false otherwise.
+ *
+ * @param clazz implementation class
+ * @throws WebBeansConfigurationException if any configuration exception occurs
+ */
+ public void checkManagedBean(Class<?> clazz)
+ {
+ Asserts.nullCheckForClass(clazz, "Class is null");
+
+ int modifier = clazz.getModifiers();
+
+ if (!Modifier.isStatic(modifier) && ClassUtil.isInnerClazz(clazz))
+ {
+ throw new WebBeansConfigurationException("Skipping CDI bean detection for non-static inner class: "
+ + clazz.getName() );
+ }
+
+ if(Extension.class.isAssignableFrom(clazz))
+ {
+ throw new WebBeansConfigurationException("Skipping CDI bean detection for CDI Extension class"
+ + clazz.getName());
+ }
+
+ // and finally call all checks which are defined in plugins like JSF, JPA, etc
+ List<OpenWebBeansPlugin> plugins = webBeansContext.getPluginLoader().getPlugins();
+ for (OpenWebBeansPlugin plugin : plugins)
+ {
+ try
+ {
+ plugin.isManagedBean(clazz);
+ }
+ catch (Exception e)
+ {
+ PluginLoader.throwsException(e);
+ }
+ }
+ }
+
+ public void checkManagedBeanCondition(Class<?> clazz) throws WebBeansConfigurationException
+ {
+ if (AnnotationUtil.hasClassAnnotation(clazz, Decorator.class) && AnnotationUtil.hasClassAnnotation(clazz, javax.interceptor.Interceptor.class))
+ {
+ throw new WebBeansConfigurationException("ManagedBean implementation class : " + clazz.getName()
+ + " may not annotated with both @Interceptor and @Decorator annotation");
+ }
+
+ if (!AnnotationUtil.hasClassAnnotation(clazz, Decorator.class) && !AnnotationUtil.hasClassAnnotation(clazz, javax.interceptor.Interceptor.class))
+ {
+ webBeansContext.getInterceptorUtil().checkSimpleWebBeansInterceptorConditions(clazz);
+ }
+ }
+
+ /**
+ * Returns true if given class supports injections,
+ * false otherwise.
+ * <p>
+ * Each plugin is asked with given class that supports
+ * injections or not.
+ * </p>
+ * @param clazz scanned class
+ * @return true if given class supports injections
+ */
+ public boolean supportsJavaEeComponentInjections(Class<?> clazz)
+ {
+ if (clazz.isInterface() || clazz.isAnnotation() || clazz.isEnum())
+ {
+ // interfaces, annotations and enums are no subject of injection
+ return false;
+ }
+
+ // and finally call all checks which are defined in plugins like JSF, JPA, etc
+ List<OpenWebBeansPlugin> plugins = webBeansContext.getPluginLoader().getPlugins();
+ for (OpenWebBeansPlugin plugin : plugins)
+ {
+ //Ejb plugin handles its own events
+ //Also EJb beans supports injections
+ if(!(plugin instanceof OpenWebBeansEjbPlugin))
+ {
+ if(plugin.supportsJavaEeComponentInjections(clazz))
+ {
+ return true;
+ }
+ }
+ else
+ {
+ return ((OpenWebBeansEjbPlugin) plugin).isSessionBean(clazz);
+ }
+ }
+
+ return false;
+ }
+
+
+ /**
+ * Check that simple web beans class has compatible constructor.
+ * @param clazz web beans simple class
+ * @throws WebBeansConfigurationException if the web beans has incompatible
+ * constructor
+ */
+ public boolean isConstructorOk(Class<?> clazz) throws WebBeansConfigurationException
+ {
+ Asserts.nullCheckForClass(clazz);
+
+ if (getNoArgConstructor(clazz) != null)
+ {
+ return true;
+ }
+
+ Constructor<?>[] constructors = webBeansContext.getSecurityService().doPrivilegedGetDeclaredConstructors(clazz);
+
+ for (Constructor<?> constructor : constructors)
+ {
+ if (constructor.getAnnotation(Inject.class) != null)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public <T> Bean<T> createNewComponent(Class<T> type)
+ {
+ Asserts.nullCheckForClass(type);
+
+ final OpenWebBeansEjbPlugin ejbPlugin = webBeansContext.getPluginLoader().getEjbPlugin();
+ if (ejbPlugin != null && ejbPlugin.isNewSessionBean(type))
+ {
+ return ejbPlugin.defineNewSessionBean(type);
+ }
+
+ AnnotatedType<T> annotatedType = webBeansContext.getAnnotatedElementFactory().newAnnotatedType(type);
+ BeanAttributesImpl<T> defaultBeanAttributes = BeanAttributesBuilder.forContext(webBeansContext).newBeanAttibutes(annotatedType).build();
+ BeanAttributesImpl<T> newBeanAttributes = new BeanAttributesImpl<T>(defaultBeanAttributes.getTypes(), Collections.<Annotation>singleton(new NewLiteral(type)));
+ // TODO replace this by InjectionPointBuilder
+ ManagedBeanBuilder<T, ManagedBean<T>> beanBuilder = new ManagedBeanBuilder<T, ManagedBean<T>>(webBeansContext, annotatedType, newBeanAttributes);
+ NewManagedBean<T> newBean
+ = new NewManagedBean<T>(webBeansContext, WebBeansType.MANAGED, annotatedType, newBeanAttributes, type, beanBuilder.getBean().getInjectionPoints());
+ return newBean;
+ }
+
+ /**
+ * New WebBeans component class.
+ *
+ * @return the new component
+ */
+ public <T> NewManagedBean<T> createNewComponent(OwbBean<T> bean, Class<T> type)
+ {
+ Asserts.assertNotNull(bean, "bean may not be null");
+ if (!EnumSet.of(WebBeansType.MANAGED, WebBeansType.ENTERPRISE, WebBeansType.PRODUCERMETHOD, WebBeansType.PRODUCERFIELD).contains(bean.getWebBeansType()))
+ {
+ throw new WebBeansConfigurationException("@New annotation on type : " + bean.getBeanClass()
+ + " must defined as a simple or an enterprise web bean");
+ }
+
+ AnnotatedType<T> annotatedType = webBeansContext.getAnnotatedElementFactory().newAnnotatedType(type);
+ BeanAttributesImpl<T> newBeanAttributes = new BeanAttributesImpl<T>(bean.getTypes(), Collections.<Annotation>singleton(new NewLiteral(type)));
+ NewManagedBean<T> newBean = new NewManagedBean<T>(bean.getWebBeansContext(), bean.getWebBeansType(), annotatedType, newBeanAttributes, type, bean.getInjectionPoints());
+ //TODO XXX set producer
+ return newBean;
+ }
+
+ /**
+ * Creates a new extension bean.
+ *
+ * @param <T> extension service class
+ * @param clazz impl. class
+ * @return a new extension service bean
+ */
+ public <T> ExtensionBean<T> createExtensionComponent(Class<T> clazz)
+ {
+ Asserts.nullCheckForClass(clazz);
+ ExtensionBeanBuilder<T> extensionBeanBuilder = new ExtensionBeanBuilder<T>(webBeansContext, clazz);
+ ExtensionBean<T> bean = extensionBeanBuilder.getBean();
+ new ObserverMethodsBuilder<T, InjectionTargetBean<T>>(webBeansContext, extensionBeanBuilder.getAnnotatedType()).defineObserverMethods(bean);
+ return bean;
+ }
+
+
+ /**
+ * Creates a new manager bean instance.
+ * @return new manager bean instance
+ */
+ public BeanManagerBean getManagerBean()
+ {
+ return new BeanManagerBean(webBeansContext);
+ }
+
+ /**
+ * Creates a new instance bean.
+ * @return new instance bean
+ */
+ public <T> InstanceBean<T> getInstanceBean()
+ {
+ return new InstanceBean<T>(webBeansContext);
+ }
+
+ /**
+ * Creates a new event bean.
+ * @return new event bean
+ */
+ public <T> EventBean<T> getEventBean()
+ {
+ return new EventBean<T>(webBeansContext);
+ }
+
+ /**
+ * Creates a new bean metadata bean.
+ * @return new bean
+ */
+ public <T> BeanMetadataBean<T> getBeanMetadataBean()
+ {
+ return new BeanMetadataBean<T>(webBeansContext);
+ }
+
+ /**
+ * Creates a new interceptor metadata bean.
+ * @return new bean
+ */
+ public <T> InterceptorMetadataBean<T> getInterceptorMetadataBean()
+ {
+ return new InterceptorMetadataBean<T>(webBeansContext);
+ }
+
+ /**
+ * Creates a new decorator metadata bean.
+ * @return new bean
+ */
+ public <T> DecoratorMetadataBean<T> getDecoratorMetadataBean()
+ {
+ return new DecoratorMetadataBean<T>(webBeansContext);
+ }
+
+ /**
+ * Creates a new metadata bean.
+ * @return new bean
+ */
+ public <T> InterceptedOrDecoratedBeanMetadataBean<T> getInterceptedOrDecoratedBeanMetadataBean()
+ {
+ return new InterceptedOrDecoratedBeanMetadataBean<T>(webBeansContext);
+ }
+
+ /**
+ * Returns new conversation bean instance.
+ * The name is explicitly specified in 6.7.2 and is not the normal default name.
+ * @return new conversation bean
+ */
+ public ConversationBean getConversationBean()
+ {
+ ConversationBean conversationComp = new ConversationBean(webBeansContext);
+
+ return conversationComp;
+ }
+
+ /**
+ * Returns a new injected point bean instance.
+ * @return new injected point bean
+ */
+ public InjectionPointBean getInjectionPointBean()
+ {
+ return new InjectionPointBean(webBeansContext);
+ }
+
+ public static String getManagedBeanDefaultName(String clazzName)
+ {
+ Asserts.assertNotNull(clazzName);
+
+ if(clazzName.length() > 0)
+ {
+ StringBuilder name = new StringBuilder(clazzName);
+ name.setCharAt(0, Character.toLowerCase(name.charAt(0)));
+
+ return name.toString();
+ }
+
+ return clazzName;
+ }
+
+ public static String getProducerDefaultName(String methodName)
+ {
+ StringBuilder buffer = new StringBuilder(methodName);
+
+ if (buffer.length() > 3 && (buffer.substring(0, 3).equals("get") || buffer.substring(0, 3).equals("set")))
+ {
+
+ if(Character.isUpperCase(buffer.charAt(3)))
+ {
+ buffer.setCharAt(3, Character.toLowerCase(buffer.charAt(3)));
+ }
+
+ return buffer.substring(3);
+ }
+ else if ((buffer.length() > 2 && buffer.substring(0, 2).equals("is")))
+ {
+ if(Character.isUpperCase(buffer.charAt(2)))
+ {
+ buffer.setCharAt(2, Character.toLowerCase(buffer.charAt(2)));
+ }
+
+ return buffer.substring(2);
+ }
+
+ else
+ {
+ buffer.setCharAt(0, Character.toLowerCase(buffer.charAt(0)));
+ return buffer.toString();
+ }
+ }
+
+ /**
+ * Return true if a list of beans are directly specialized/extended each other.
+ *
+ * @param beans, a set of specialized beans.
+ *
+ * @return
+ */
+ protected static boolean isDirectlySpecializedBeanSet(Set<Bean<?>> beans)
+ {
+
+ ArrayList<AbstractOwbBean<?>> beanList = new ArrayList<AbstractOwbBean<?>>();
+
+ for(Bean<?> bb : beans)
+ {
+ AbstractOwbBean<?>bean = (AbstractOwbBean<?>)bb;
+ beanList.add(bean);
+ }
+
+ java.util.Collections.sort(beanList, new java.util.Comparator()
+ {
+ @Override
+ public int compare(Object o1, Object o2)
+ {
+ AbstractOwbBean<?> b1 = (AbstractOwbBean<?>)o1;
+ AbstractOwbBean<?> b2 = (AbstractOwbBean<?>)o2;
+ Class c1 = b1.getReturnType();
+ Class c2 = b2.getReturnType();
+ if (c2.isAssignableFrom(c1))
+ {
+ return 1;
+ }
+
+ if (c1.isAssignableFrom(c2))
+ {
+ return -1;
+ }
+
+ throw new InconsistentSpecializationException(c1 + " and " + c2 + "are not assignable to each other." );
+ }
+ });
+
+ for(int i=0; i<beanList.size() - 1; i++)
+ {
+ if (!beanList.get(i).getReturnType().equals(beanList.get(i+1).getReturnType().getSuperclass()))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public void configureSpecializations(List<Class<?>> beanClasses)
+ {
+ for(Class<?> clazz : beanClasses)
+ {
+ configureSpecializations(clazz, beanClasses);
+ }
+ }
+
+ /**
+ * Configures the bean specializations.
+ * <p>
+ * Specialized beans inherit the <code>name</code> property
+ * from their parents. Specialized bean deployment priority
+ * must be higher than its super class related bean.
+ * </p>
+ *
+ * <p>from the spec:<br/>
+ * "If Y has a name and X declares a name explicitly, using @Named,
+ * the container automatically detects the problem and treats it as a definition error.</p>
+ *
+ * @param specializedClass specialized class
+ * @param beanClasses all Classes which are either @Specializes or specialized.
+ * @throws DefinitionException if name is defined
+ * @throws InconsistentSpecializationException related with priority
+ * @throws WebBeansConfigurationException any other exception
+ */
+ protected void configureSpecializations(Class<?> specializedClass, List<Class<?>> beanClasses)
+ {
+ Asserts.nullCheckForClass(specializedClass);
+
+ Bean<?> superBean = null;
+ Bean<?> specialized;
+ Set<Bean<?>> resolvers = isConfiguredWebBeans(specializedClass, true);
+ AlternativesManager altManager = webBeansContext.getAlternativesManager();
+
+ if (resolvers != null && !resolvers.isEmpty())
+ {
+ specialized = resolvers.iterator().next();
+
+ if(resolvers.size() > 1)
+ {
+ if (!isDirectlySpecializedBeanSet(resolvers))
+ {
+ throw new InconsistentSpecializationException("More than one specialized bean for class : "
+ + specializedClass + " is enabled in the deployment.");
+ }
+ // find the widest bean which satisfies the specializedClass
+ for( Bean<?> sp : resolvers)
+ {
+ if (sp == specialized)
+ {
+ continue;
+ }
+
+ if (sp.getTypes().size() > specialized.getTypes().size() && sp.getTypes().containsAll(specialized.getTypes()))
+ {
+ specialized = sp;
+ }
+ }
+ }
+
+ Class<?> superClass = specializedClass.getSuperclass();
+
+ resolvers = isConfiguredWebBeans(superClass,false);
+
+ for(Bean<?> candidates : resolvers)
+ {
+ AbstractOwbBean<?> candidate = (AbstractOwbBean<?>)candidates;
+
+ if(!(candidate instanceof NewBean))
+ {
+ if(candidate.getReturnType().equals(superClass))
+ {
+ superBean = candidates;
+ break;
+ }
+ }
+ }
+
+ if (superBean != null)
+ {
+ for (Class<?> beanClass: beanClasses)
+ {
+ if (beanClass.equals(specializedClass))
+ {
+ continue;
+ }
+ if (beanClass.getSuperclass().equals(superClass))
+ {
+ InconsistentSpecializationException exception = new InconsistentSpecializationException(superClass.getName()
+ + " is @Specialized by two classes: " + beanClass.getName() + " and " + specializedClass.getName());
+ throw new WebBeansDeploymentException(exception);
+ }
+ }
+ if (!specialized.getTypes().containsAll(superBean.getTypes()))
+ {
+ throw new DefinitionException("@Specialized Class : " + specializedClass.getName()
+ + " must have all bean types of its super class");
+ }
+ webBeansContext.getBeanManagerImpl().getNotificationManager().disableOverriddenObservers(specializedClass);
+
+ // Recursively configure super class first if super class is also a special bean.
+ // So the name and bean meta data could be populated to this beanclass.
+ if (beanClasses.contains(superClass) && ((AbstractOwbBean<?>)superBean).isEnabled())
+ {
+ configureSpecializations(superClass, beanClasses);
+ }
+
+ if (!AnnotationUtil.hasClassAnnotation(specializedClass, Alternative.class))
+ {
+ //disable superbean if the current bean is not an alternative
+ ((AbstractOwbBean<?>)superBean).setEnabled(false);
+ }
+ else if(altManager.isClassAlternative(specializedClass))
+ {
+ //disable superbean if the current bean is an enabled alternative
+ ((AbstractOwbBean<?>)superBean).setEnabled(false);
+ }
+
+ AbstractOwbBean<?> comp = (AbstractOwbBean<?>)specialized;
+ if (comp.isSpecializedBean())
+ {
+ // This comp is already configured in previous invocation
+ // return directly, else Exception might be fired when set
+ // bean name again.
+ return;
+ }
+
+ //Check types of the beans
+ if(comp.getClass() != superBean.getClass())
+ {
+ throw new InconsistentSpecializationException("@Specialized Class : " + specializedClass.getName()
+ + " and its super class may be the same type of bean,i.e, ManagedBean, SessionBean etc.");
+ }
+
+ if(superBean.getName() != null)
+ {
+ if (!superBean.getName().equals(comp.getName()))
+ {
+ throw new InconsistentSpecializationException("@Specialized Class : " + specializedClass.getName()
+ + " may not explicitly declare a bean name");
+ }
+
+ }
+ comp.setSpecializedBean(true);
+
+ final Map<Class<?>, ProducerMethodBean<?>> parentProducers = new HashMap<Class<?>, ProducerMethodBean<?>>();
+ final Map<Class<?>, ProducerMethodBean<?>> beanProducers = new HashMap<Class<?>, ProducerMethodBean<?>>();
+ for (Bean<?> bean: webBeansContext.getBeanManagerImpl().getComponents())
+ {
+ if (bean instanceof ProducerMethodBean)
+ {
+ final ProducerMethodBean<?> producerBean = (ProducerMethodBean<?>)bean;
+ final Class<?> returnType = producerBean.getReturnType();
+ if (producerBean.getBeanClass() == superBean.getBeanClass() && producerBean.getProducer() instanceof ProducerMethodProducer)
+ {
+ final ProducerMethodProducer<?, ?> producer = (ProducerMethodProducer<?, ?>) producerBean.getProducer();
+ producer.specializeBy((Bean) comp);
+
+ if (beanProducers.keySet().contains(returnType))
+ {
+ beanProducers.get(returnType).setSpecializedBean(true);
+ }
+ else
+ {
+ parentProducers.put(returnType, producerBean);
+ }
+ }
+ else if (specializedClass == bean.getBeanClass())
+ {
+ if (parentProducers.keySet().contains(returnType))
+ {
+ producerBean.setSpecializedBean(true);
+ }
+ else
+ {
+ beanProducers.put(returnType, producerBean);
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ throw new DefinitionException("WebBean component class : " + specializedClass.getName()
+ + " is not enabled for specialized by the " + specializedClass + " class");
+ }
+ }
+
+ }
+
+ /**
+ * Configure a list of producer method beans, which override the same method
+ * and the bean classes are directly extended each other.
+ *
+ * @param sortedProducerBeans
+ */
+ protected void configSpecializedProducerMethodBeans(List<ProducerMethodBean> sortedProducerBeans)
+ {
+ if (sortedProducerBeans.isEmpty())
+ {
+ return;
+ }
+
+ AlternativesManager altManager = webBeansContext.getAlternativesManager();
+ Method superMethod = sortedProducerBeans.get(0).getCreatorMethod();
+
+ for(int i=1; i<sortedProducerBeans.size(); i++)
+ {
+ ProducerMethodBean bean = sortedProducerBeans.get(i);
+ ProducerMethodBean superBean = sortedProducerBeans.get(i - 1);
+
+ // inherit name is super class has name
+ boolean isSuperHasName = isSuperMethodNamed(bean, bean.getCreatorMethod(), superMethod);
+
+ // disable super bean if needed
+ if (bean.getCreatorMethod().getAnnotation(Alternative.class) == null)
+ {
+ //disable superbean if the current bean is not an alternative
+ superBean.setEnabled(false);
+ }
+ else if(altManager.isClassAlternative(bean.getBeanClass()))
+ {
+ //disable superbean if the current bean is an enabled alternative
+ superBean.setEnabled(false);
+ }
+
+ //if no name defined, set superMethod to this bean since this
+ //bean's method might have name defined.
+ if (!isSuperHasName)
+ {
+ superMethod = bean.getCreatorMethod();
+ }
+ }
+ }
+
+ /**
+ * Configure direct/indirect specialized producer method beans.
+ */
+ public void configureProducerMethodSpecializations()
+ {
+ Method method;
+ ProducerMethodBean pbean;
+ ProducerMethodBean pLeft;
+ ProducerMethodBean pRight;
+
+ // collect all producer method beans
+ Set<Bean<?>> beans = webBeansContext.getBeanManagerImpl().getBeans();
+ List<ProducerMethodBean> producerBeans = new ArrayList<ProducerMethodBean>();
+ for(Bean b : beans)
+ {
+ if (b instanceof ProducerMethodBean)
+ {
+ producerBeans.add((ProducerMethodBean)b);
+ }
+ }
+
+ // create sorted bean helper.
+ SortedListHelper<ProducerMethodBean> producerBeanListHelper = new
+ SortedListHelper<ProducerMethodBean>(new ArrayList<ProducerMethodBean>(),
+ new Comparator<ProducerMethodBean> ()
+ {
+ @Override
+ public int compare(ProducerMethodBean e1, ProducerMethodBean e2)
+ {
+ if (e1.getBeanClass().isAssignableFrom(e2.getBeanClass()))
+ {
+ return -1;
+ }
+ else if (e1.equals(e2))
+ {
+ return 0;
+ }
+ return 1;
+ }
+ });
+
+ while(true)
+ {
+ pbean = null;
+ method = null;
+ producerBeanListHelper.clear();
+
+ //locate a specialized bean
+ for(ProducerMethodBean pb : producerBeans)
+ {
+ if (pb.isSpecializedBean())
+ {
+ pbean = pb;
+ method = pb.getCreatorMethod();
+ producerBeanListHelper.add(pb);
+ break;
+ }
+ }
+ if (pbean == null)
+ {
+ break;
+ }
+
+ pRight = pbean;
+ pLeft = pRight;
+ boolean pLeftContinue = true;
+ boolean pRightContinue = true;
+
+ // find all pbean's super beans and sub sub beans
+ while(pLeftContinue || pRightContinue)
+ {
+ pRightContinue = false;
+ pLeftContinue = false;
+ for(ProducerMethodBean pb : producerBeans)
+ {
+ //left
+ if (pLeft!= null &&
+ pLeft.getBeanClass().getSuperclass().equals(pb.getBeanClass()))
+ {
+ Method superMethod = webBeansContext.getSecurityService().doPrivilegedGetDeclaredMethod(pb.getBeanClass(), method.getName(), method.getParameterTypes());
+
+ //Added by GE, method check is necessary otherwise getting wrong method qualifier annotations
+ if (superMethod != null && superMethod.equals(pb.getCreatorMethod()))
+ {
+ producerBeanListHelper.add(pb);
+ pLeft = (pb.isSpecializedBean()) ? pb : null;
+ }
+ else
+ {
+ pLeft = null;
+ }
+ if (pLeft != null)
+ {
+ pLeftContinue = true;
+ }
+ }
+ //right
+ if (pRight != null &&
+ pb.getBeanClass().getSuperclass().equals(pRight.getBeanClass()))
+ {
+ if (!pb.isSpecializedBean())
+ {
+ pRight = null;
+ }
+ else
+ {
+ Method superMethod = webBeansContext.getSecurityService().doPrivilegedGetDeclaredMethod(pb.getBeanClass(),
+ method.getName(), method.getParameterTypes());
+ //Added by GE, method check is necessary otherwise getting wrong method qualifier annotations
+ if (superMethod != null && superMethod.equals(pb.getCreatorMethod()))
+ {
+ producerBeanListHelper.add(pb);
+ pRight = pb;
+ }
+ else
+ {
+ pRight = null;
+ }
+ }
+ if (pRight != null)
+ {
+ pRightContinue = true;
+ }
+ }
+ } // for
+ } // while
+
+ //remove the group from producer bean list
+ for(ProducerMethodBean pb : producerBeanListHelper.getList())
+ {
+ producerBeans.remove(pb);
+ }
+ //configure the directly extended producer beans
+ configSpecializedProducerMethodBeans(producerBeanListHelper.getList());
+ }
+ }
+
+
+ public Set<Bean<?>> isConfiguredWebBeans(Class<?> clazz,boolean annotate)
+ {
+ Asserts.nullCheckForClass(clazz);
+
+ Set<Bean<?>> beans = new HashSet<Bean<?>>();
+
+ Set<Bean<?>> components = webBeansContext.getBeanManagerImpl().getComponents();
+ Iterator<Bean<?>> it = components.iterator();
+
+ while (it.hasNext())
+ {
+ AbstractOwbBean<?> bean = (AbstractOwbBean<?>)it.next();
+
+ if (bean.getTypes().contains(clazz)
+ || (EnterpriseBeanMarker.class.isInstance(bean) && bean.getBeanClass().isAssignableFrom(clazz)))
+ {
+ if(annotate)
+ {
+ if(bean.getReturnType().isAnnotationPresent(Specializes.class))
+ {
+ if(!(bean instanceof NewBean))
+ {
+ beans.add(bean);
+ }
+ }
+ }
+ else
+ {
+ beans.add(bean);
+ }
+ }
+ }
+
+ return beans;
+ }
+
+ public <T> Constructor<T> getNoArgConstructor(Class<T> clazz)
+ {
+ return webBeansContext.getSecurityService().doPrivilegedGetDeclaredConstructor(clazz);
+ }
+
+ /**
+ * Configures the name of the producer method for specializing the parent.
+ *
+ * @param component producer method component
+ * @param method specialized producer method
+ * @param superMethod overriden super producer method
+ */
+ public boolean isSuperMethodNamed(AbstractOwbBean<?> component, Method method, Method superMethod)
+ {
+ return webBeansContext.getAnnotationManager().isSuperMethodNamed(component, method, superMethod);
+ }
+
+ /**
+ * Returns true if instance injection point false otherwise.
+ *
+ * @param injectionPoint injection point definition
+ * @return true if instance injection point
+ */
+ public static boolean checkObtainsInjectionPointConditions(InjectionPoint injectionPoint)
+ {
+ Type type = injectionPoint.getType();
+
+ Class<?> candidateClazz = ClassUtil.getClass(type);
+
+ if(!candidateClazz.isAssignableFrom(Instance.class))
+ {
+ return false;
+ }
+
+ Class<?> rawType;
+
+ if(ClassUtil.isParametrizedType(injectionPoint.getType()))
+ {
+ ParameterizedType pt = (ParameterizedType)injectionPoint.getType();
+
+ rawType = (Class<?>) pt.getRawType();
+
+ Type[] typeArgs = pt.getActualTypeArguments();
+
+ if(!(rawType.isAssignableFrom(Instance.class)))
+ {
+ throw new WebBeansConfigurationException("<Instance> field injection " + injectionPoint.toString()
+ + " must have type javax.inject.Instance");
+ }
+ else
+ {
+ if(typeArgs.length != 1)
+ {
+ throw new WebBeansConfigurationException("<Instance> field injection " + injectionPoint.toString()
+ + " must not have more than one actual type argument");
+ }
+ }
+ }
+ else
+ {
+ throw new WebBeansConfigurationException("<Instance> field injection " + injectionPoint.toString()
+ + " must be defined as ParameterizedType with one actual type argument");
+ }
+
+ return true;
+ }
+
+ public static void checkNullInstance(Object instance, Class<? > scopeType, String errorMessage,
+ Object... errorMessageArgs)
+ {
+ if (instance == null)
+ {
+ if (!scopeType.equals(Dependent.class))
+ {
+ String message = format(errorMessage, errorMessageArgs);
+ throw new IllegalProductException(message);
+ }
+ }
+ }
+
+ public void checkSerializableScopeType(Class<? extends Annotation> scopeType, boolean isSerializable, String errorMessage,
+ Object... errorMessageArgs)
+ {
+ if (webBeansContext.getBeanManagerImpl().isPassivatingScope(scopeType))
+ {
+ if (!isSerializable)
+ {
+ String message = format(errorMessage, errorMessageArgs);
+ throw new IllegalProductException(message);
+ }
+ }
+ }
+
+ public static Bean<?> getMostSpecializedBean(BeanManager manager, Bean<?> component)
+ {
+ Set<Bean<?>> beans;
+
+ if (component instanceof EnterpriseBeanMarker)
+ {
+ beans = new HashSet<Bean<?>>();
+ Set<Bean<?>> allBeans = manager.getBeans(Object.class, AnnotationUtil.asArray(component.getQualifiers()));
+
+ for(Bean<?> candidateBean : allBeans)
+ {
+ if (candidateBean instanceof EnterpriseBeanMarker)
+ {
+ /*
+ * If a bean class of a session bean X is annotated @Specializes, then the bean class of X must directly extend
+ * the bean class of another session bean Y. Then X directly specializes Y, as defined in Section 4.3, ‚"Specialization".
+ */
+ Class<?> candidateSuperClass = candidateBean.getBeanClass().getSuperclass();
+ if (candidateSuperClass.equals(component.getBeanClass()))
+ {
+ beans.add(candidateBean);
+ }
+ }
+ }
+ }
+ else
+ {
+ beans = manager.getBeans(component.getBeanClass(),
+ AnnotationUtil.asArray(component.getQualifiers()));
+ }
+
+ for(Bean<?> bean : beans)
+ {
+ Bean<?> find = bean;
+
+ if(!find.equals(component))
+ {
+ if(AnnotationUtil.hasClassAnnotation(find.getBeanClass(), Specializes.class))
+ {
+ return getMostSpecializedBean(manager, find);
+ }
+ }
+ }
+
+ return component;
+ }
+
+ /**
+ * Returns <code>ProcessAnnotatedType</code> event.
+ * @param <T> bean type
+ * @param annotatedType bean class
+ * @return event
+ */
+ public <T> GProcessAnnotatedType fireProcessAnnotatedTypeEvent(AnnotatedType<T> annotatedType)
+ {
+ GProcessAnnotatedType processAnnotatedEvent = new GProcessAnnotatedType(annotatedType);
+
+ //Fires ProcessAnnotatedType
+ webBeansContext.getBeanManagerImpl().fireEvent(processAnnotatedEvent,AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
+
+ if (processAnnotatedEvent.isModifiedAnnotatedType())
+ {
+ webBeansContext.getAnnotatedElementFactory().setAnnotatedType(processAnnotatedEvent.getAnnotatedType());
+ }
+
+ return processAnnotatedEvent;
+ }
+
+ /**
+ * Returns <code>ProcessInjectionTarget</code> event.
+ * @param <T> bean type
+ * @return event
+ */
+ public <T> GProcessInjectionTarget fireProcessInjectionTargetEvent(InjectionTargetImpl<T> injectionTarget, AnnotatedType<T> annotatedType)
+ {
+ final GProcessInjectionTarget processInjectionTargetEvent = new GProcessInjectionTarget(injectionTarget, annotatedType);
+ return fireProcessInjectionTargetEvent(processInjectionTargetEvent);
+ }
+
+ private GProcessInjectionTarget fireProcessInjectionTargetEvent(GProcessInjectionTarget processInjectionTargetEvent)
+ {
+ //Fires ProcessInjectionTarget
+ webBeansContext.getBeanManagerImpl().fireEvent(processInjectionTargetEvent, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
+ return processInjectionTargetEvent;
+ }
+
+ /**
+ * Returns <code>ProcessInjectionTarget</code> event.
+ * @param <T> bean type
+ * @return event
+ */
+ public <T> GProcessInjectionTarget fireProcessInjectionTargetEventForJavaEeComponents(Class<T> componentClass)
+ {
+ final AnnotatedType<T> annotatedType = webBeansContext.getAnnotatedElementFactory().newAnnotatedType(componentClass);
+ final InjectionTargetImpl<T> injectionTarget = InjectionTargetImpl.class.cast(webBeansContext.getBeanManagerImpl().createInjectionTarget(annotatedType));
+ final GProcessInjectionTarget processInjectionTargetEvent = new GProcessInjectionTarget(injectionTarget,annotatedType);
+
+ //Fires ProcessInjectionTarget
+ return fireProcessInjectionTargetEvent(processInjectionTargetEvent);
+
+ }
+
+ public <T> Producer<T> fireProcessProducerEvent(Producer<T> producer, AnnotatedMember<?> annotatedMember)
+ {
+ GProcessProducer processProducerEvent = new GProcessProducer(producer, annotatedMember);
+ //Fires ProcessProducer
+ webBeansContext.getBeanManagerImpl().fireEvent(processProducerEvent, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
+ webBeansContext.getWebBeansUtil().inspectErrorStack("There are errors that are added by ProcessProducer event observers. Look at logs for further details");
+ return processProducerEvent.getProducer();
+ }
+
+ public void fireProcessProducerMethodBeanEvent(Map<ProducerMethodBean<?>, AnnotatedMethod<?>> annotatedMethods, AnnotatedType<?> annotatedType)
+ {
+ WebBeansContext webBeansContext = this.webBeansContext;
+ AnnotationManager annotationManager = webBeansContext.getAnnotationManager();
+
+ for(Map.Entry<ProducerMethodBean<?>, AnnotatedMethod<?>> beanEntry : annotatedMethods.entrySet())
+ {
+ ProducerMethodBean<?> bean = beanEntry.getKey();
+ AnnotatedMethod<?> annotatedMethod = beanEntry.getValue();
+ Annotation[] annotationsFromSet = AnnotationUtil.asArray(bean.getQualifiers());
+ Method disposal = annotationManager.getDisposalWithGivenAnnotatedMethod(annotatedType, bean.getReturnType(), annotationsFromSet);
+
+ AnnotatedMethod<?> disposalAnnotated = null;
+ GProcessProducerMethod processProducerMethodEvent = null;
+ if(disposal != null)
+ {
+ disposalAnnotated = webBeansContext.getAnnotatedElementFactory().newAnnotatedMethod(disposal, annotatedType);
+ processProducerMethodEvent = new GProcessProducerMethod(bean,annotatedMethod,
+ disposalAnnotated.getParameters().get(0));
+ }
+ else
+ {
+ processProducerMethodEvent = new GProcessProducerMethod(bean,annotatedMethod,null);
+ }
+
+
+ //Fires ProcessProducer
+ webBeansContext.getBeanManagerImpl().fireEvent(processProducerMethodEvent, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
+ }
+ }
+
+ public void fireProcessObservableMethodBeanEvent(Map<ObserverMethod<?>,AnnotatedMethod<?>> annotatedMethods)
+ {
+ for(Map.Entry<ObserverMethod<?>, AnnotatedMethod<?>> observableMethodEntry : annotatedMethods.entrySet())
+ {
+ ObserverMethod<?> observableMethod = observableMethodEntry.getKey();
+ AnnotatedMethod<?> annotatedMethod = observableMethodEntry.getValue();
+
+ GProcessObservableMethod event = new GProcessObservableMethod(annotatedMethod, observableMethod);
+
+ //Fires ProcessProducer
+ webBeansContext.getBeanManagerImpl().fireEvent(event, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
+ }
+ }
+
+
+ public void fireProcessProducerFieldBeanEvent(Map<ProducerFieldBean<?>,AnnotatedField<?>> annotatedFields)
+ {
+ for(Map.Entry<ProducerFieldBean<?>, AnnotatedField<?>> beanEntry : annotatedFields.entrySet())
+ {
+ ProducerFieldBean<?> bean = beanEntry.getKey();
+ AnnotatedField<?> field = beanEntry.getValue();
+
+ GProcessProducerField processProducerFieldEvent = new GProcessProducerField(bean, field, null);
+
+ //Fire ProcessProducer
+ webBeansContext.getBeanManagerImpl().fireEvent(processProducerFieldEvent, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
+ }
+ }
+
+ public static void checkInjectionPointNamedQualifier(InjectionPoint injectionPoint)
+ {
+ Set<Annotation> qualifierset = injectionPoint.getQualifiers();
+ Named namedQualifier = null;
+ for(Annotation qualifier : qualifierset)
+ {
+ if(qualifier.annotationType().equals(Named.class))
+ {
+ namedQualifier = (Named)qualifier;
+ break;
+ }
+ }
+
+ if(namedQualifier != null)
+ {
+ String value = namedQualifier.value();
+
+ if(value == null || value.equals(""))
+ {
+ Member member = injectionPoint.getMember();
+ if(!(member instanceof Field))
+ {
+ throw new WebBeansConfigurationException("Injection point type : " + injectionPoint
+ + " can not define @Named qualifier without value!");
+ }
+ }
+ }
+
+ }
+
+ /**
+ * Sets bean enabled flag.
+ * @param bean bean instance
+ */
+ public void setInjectionTargetBeanEnableFlag(InjectionTargetBean<?> bean)
+ {
+ bean.setEnabled(isBeanEnabled(bean.getAnnotatedType(), bean.getStereotypes()));
+ }
+
+ public boolean isBeanEnabled(AnnotatedType<?> at, Set<Class<? extends Annotation>> stereotypes)
+ {
+ boolean isAlternative = hasInjectionTargetBeanAnnotatedWithAlternative(at, stereotypes);
+
+ return !isAlternative || webBeansContext.getAlternativesManager().isAlternative(at.getJavaClass(), stereotypes);
+ }
+
+ public static boolean hasInjectionTargetBeanAnnotatedWithAlternative(InjectionTargetBean<?> bean)
+ {
+ return hasInjectionTargetBeanAnnotatedWithAlternative(bean.getAnnotatedType(), bean.getStereotypes());
+ }
+
+ public static boolean hasInjectionTargetBeanAnnotatedWithAlternative(AnnotatedType<?> beanType, Set<Class<? extends Annotation>> stereotypes)
+ {
+ Asserts.assertNotNull(beanType, "bean type can not be null");
+ Asserts.assertNotNull(stereotypes, "stereotypes can not be null");
+
+ boolean alternative = false;
+
+ if(beanType.getAnnotation(Alternative.class) != null)
+ {
+ alternative = true;
+ }
+
+ if(!alternative)
+ {
+ for(Class<? extends Annotation> stereoType : stereotypes)
+ {
+ if(AnnotationUtil.hasClassAnnotation(stereoType, Alternative.class))
+ {
+ alternative = true;
+ break;
+ }
+ }
+
+ }
+
+ return alternative;
+
+ }
+
+ public void setBeanEnableFlagForProducerBean(InjectionTargetBean<?> parent, AbstractProducerBean<?> producer, Annotation[] annotations)
+ {
+ Asserts.assertNotNull(parent, "parent can not be null");
+ Asserts.assertNotNull(producer, "producer can not be null");
+ producer.setEnabled(isProducerBeanEnabled(parent, producer.getStereotypes(), annotations));
+ }
+
+ public boolean isProducerBeanEnabled(InjectionTargetBean<?> parent, Set<Class<? extends Annotation>> stereotypes, Annotation[] annotations)
+ {
+
+ boolean alternative = false;
+
+ if (AnnotationUtil.hasAnnotation(annotations, Alternative.class))
+ {
+ alternative = true;
+ }
+
+ if (!alternative)
+ {
+ for (Class<? extends Annotation> stereoType : stereotypes)
+ {
+ if (AnnotationUtil.hasClassAnnotation(stereoType, Alternative.class))
+ {
+ alternative = true;
+ break;
+ }
+ }
+ }
+
+ if (alternative)
+ {
+ return hasInjectionTargetBeanAnnotatedWithAlternative(parent) &&
+ webBeansContext.getAlternativesManager().isBeanHasAlternative(parent);
+ }
+ else
+ {
+ return parent.isEnabled();
+ }
+ }
+
+ public static boolean isExtensionEventType(Type type)
+ {
+ return type.equals(BeforeBeanDiscovery.class) ||
+ type.equals(AfterBeanDiscovery.class) ||
+ type.equals(AfterDeploymentValidation.class) ||
+ type.equals(BeforeShutdown.class) ||
+ type.equals(GProcessAnnotatedType.class) ||
+ type.equals(GProcessInjectionTarget.class) ||
+ type.equals(GProcessProducer.class) ||
+ type.equals(GProcessProducerField.class) ||
+ type.equals(GProcessProducerMethod.class) ||
+ type.equals(GProcessManagedBean.class) ||
+ type.equals(GProcessBean.class) ||
+ type.equals(GProcessSessionBean.class) ||
+ type.equals(GProcessObservableMethod.class);
+ }
+
+ public static boolean isExtensionBeanEventType(Type type)
+ {
+ return type.equals(GProcessAnnotatedType.class) ||
+ type.equals(GProcessInjectionTarget.class) ||
+ type.equals(GProcessManagedBean.class) ||
+ type.equals(GProcessSessionBean.class) ||
+ type.equals(GProcessBean.class);
+ }
+
+ public static boolean isDefaultExtensionBeanEventType(Class<?> clazz)
+ {
+ return clazz.equals(ProcessAnnotatedType.class) ||
+ clazz.equals(ProcessInjectionTarget.class) ||
+ clazz.equals(ProcessManagedBean.class) ||
+ clazz.equals(ProcessBean.class) ||
+ clazz.equals(ProcessSessionBean.class);
+ }
+
+ public static boolean isExtensionProducerOrObserverEventType(Type type)
+ {
+ return type.equals(GProcessProducer.class) ||
+ type.equals(GProcessProducerField.class) ||
+ type.equals(GProcessProducerMethod.class) ||
+ type.equals(GProcessObservableMethod.class);
+ }
+
+ public static boolean isDefaultExtensionProducerOrObserverEventType(Class<?> clazz)
+ {
+ return clazz.equals(ProcessProducer.class) ||
+ clazz.equals(ProcessProducerField.class) ||
+ clazz.equals(ProcessProducerMethod.class) ||
+ clazz.equals(ProcessObserverMethod.class);
+
+ }
+
+ public static boolean isDependent(Bean<?> bean)
+ {
+ if(!(bean instanceof OwbBean))
+ {
+ return bean.getScope().equals(Dependent.class);
+ }
+
+ return ((OwbBean) bean).isDependent();
+ }
+
+ public void inspectErrorStack(String logMessage)
+ {
+ BeanManagerImpl manager = webBeansContext.getBeanManagerImpl();
+ //Looks for errors
+ ErrorStack stack = manager.getErrorStack();
+ try
+ {
+ if(stack.hasErrors())
+ {
+ stack.logErrors();
+ throw new WebBeansConfigurationException(logMessage);
+ }
+ }
+ finally
+ {
+ stack.clear();
+ }
+ }
+
+ /**
+ *
+ * @param contextual the {@link Bean} to check
+ * @return the uniqueId if it is {@link PassivationCapable} and enabled
+ */
+ public static String getPassivationId(Contextual<?> contextual)
+ {
+ if(contextual instanceof Bean)
+ {
+ if(contextual instanceof AbstractOwbBean)
+ {
+ if( ((AbstractOwbBean<?>)contextual).isPassivationCapable())
+ {
+ return ((AbstractOwbBean<?>)contextual).getId();
+ }
+ }
+
+ else if(contextual instanceof PassivationCapable)
+ {
+ PassivationCapable pc = (PassivationCapable)contextual;
+
+ return pc.getId();
+ }
+ }
+ else
+ {
+ if((contextual instanceof PassivationCapable) && (contextual instanceof Serializable))
+ {
+ PassivationCapable pc = (PassivationCapable)contextual;
+
+ return pc.getId();
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * This method will be used in {@link AfterBeanDiscovery#addBean(javax.enterprise.inject.spi.Bean)}}
+ */
+ public <T> ManagedBean<T> defineManagedBeanWithoutFireEvents(AnnotatedType<T> type)
+ {
+ BeanAttributesImpl<T> beanAttributes = BeanAttributesBuilder.forContext(webBeansContext).newBeanAttibutes(type).build();
+ ManagedBeanBuilder<T, ManagedBean<T>> managedBeanCreator = new ManagedBeanBuilder<T, ManagedBean<T>>(webBeansContext, type, beanAttributes);
+
+ //Check for Enabled via Alternative
+ setInjectionTargetBeanEnableFlag(managedBeanCreator.getBean());
+ ManagedBean<T> managedBean = managedBeanCreator.getBean();
+ new ProducerMethodBeansBuilder(managedBean.getWebBeansContext(), managedBean.getAnnotatedType()).defineProducerMethods(managedBean);
+ new ProducerFieldBeansBuilder(managedBean.getWebBeansContext(), managedBean.getAnnotatedType()).defineProducerFields(managedBean);
+ new ObserverMethodsBuilder<T, InjectionTargetBean<T>>(webBeansContext, managedBean.getAnnotatedType()).defineObserverMethods(managedBean);
+
+ if (managedBean.getProducer() instanceof AbstractProducer)
+ {
+ AbstractProducer<T> producer = (AbstractProducer<T>)managedBean.getProducer();
+ producer.defineInterceptorStack(managedBean, managedBean.getAnnotatedType(), webBeansContext);
+ }
+
+ return managedBean;
+ }
+
+ public boolean isPassivationCapableDependency(InjectionPoint injectionPoint)
+ {
+ //Don't attempt to get an instance of the delegate injection point
+ if (injectionPoint.isDelegate())
+ {
+ return true;
+ }
+ InjectionResolver instance = webBeansContext.getBeanManagerImpl().getInjectionResolver();
+
+ Bean<?> bean = instance.getInjectionPointBean(injectionPoint);
+ if((bean instanceof EnterpriseBeanMarker) ||
+ (bean instanceof ResourceBean) ||
+ (bean instanceof InstanceBean) ||
+ (bean instanceof EventBean) ||
+ (bean instanceof InjectionPointBean) ||
+ (bean instanceof BeanManagerBean)
+ )
+ {
+ return true;
+ }
+
+ else if(webBeansContext.getBeanManagerImpl().isNormalScope(bean.getScope()))
+ {
+ return true;
+ }
+ else
+ {
+ if(getPassivationId(bean) != null)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static void throwRuntimeExceptions(Exception e)
+ {
+ if(RuntimeException.class.isAssignableFrom(e.getClass()))
+ {
+ throw (RuntimeException)e;
+ }
+
+ throw new RuntimeException(e);
+ }
+
+ /**
+ * @return <code>true</code> if this annotated type represents a decorator.
+ */
+ public static boolean isDecorator(AnnotatedType<?> annotatedType)
+ {
+ return annotatedType.isAnnotationPresent(Decorator.class);
+ }
+
+ /**
+ * Return true if this annotated type represents a decorator.
+ * @param annotatedType annotated type
+ * @return true if decorator
+ */
+ public boolean isAnnotatedTypeDecoratorOrInterceptor(AnnotatedType<?> annotatedType)
+ {
+ if(isDecorator(annotatedType) ||
+ isCdiInterceptor(annotatedType))
+ {
+ return true;
+ }
+ else if(webBeansContext.getInterceptorsManager().isInterceptorClassEnabled(annotatedType.getJavaClass()))
+ {
+ return true;
+ }
+ else if(webBeansContext.getDecoratorsManager().isDecoratorEnabled(annotatedType.getJavaClass()))
+ {
+ return true;
+ }
+
+
+ return false;
+ }
+
+ /**
+ * @return <code>true</code> if this AnnotatedType represents a CDI Interceptor
+ * defined via a {@link javax.interceptor.Interceptor} annotation
+ */
+ public static boolean isCdiInterceptor(AnnotatedType<?> annotatedType)
+ {
+ return annotatedType.isAnnotationPresent(javax.interceptor.Interceptor.class);
+ }
+
+ public <T> ManagedBean<T> defineManagedBean(AnnotatedType<T> type)
+ {
+ BeanAttributesImpl<T> beanAttributes = BeanAttributesBuilder.forContext(webBeansContext).newBeanAttibutes(type).build();
+ ManagedBeanBuilder<T, ManagedBean<T>> managedBeanCreator = new ManagedBeanBuilder<T, ManagedBean<T>>(webBeansContext, type, beanAttributes);
+
+ //Check for Enabled via Alternative
+ ManagedBean<T> managedBean = managedBeanCreator.getBean();
+ new ProducerMethodBeansBuilder(managedBean.getWebBeansContext(), managedBean.getAnnotatedType()).defineProducerMethods(managedBean);
+ new ProducerFieldBeansBuilder(managedBean.getWebBeansContext(), managedBean.getAnnotatedType()).defineProducerFields(managedBean);
+ new ObserverMethodsBuilder<T, InjectionTargetBean<T>>(webBeansContext, managedBean.getAnnotatedType()).defineObserverMethods(managedBean);
+
+ if (managedBean.getProducer() instanceof AbstractProducer)
+ {
+ AbstractProducer<T> producer = (AbstractProducer<T>)managedBean.getProducer();
+ producer.defineInterceptorStack(managedBean, managedBean.getAnnotatedType(), webBeansContext);
+ }
+ return managedBean;
+ }
+
+ /**
+ * Checks the implementation class for checking conditions.
+ *
+ * @param type implementation class
+ * @throws org.apache.webbeans.exception.WebBeansConfigurationException if any configuration exception occurs
+ */
+ public <X> void checkManagedBeanCondition(AnnotatedType<X> type) throws WebBeansConfigurationException
+ {
+ int modifier = type.getJavaClass().getModifiers();
+
+ if (type.isAnnotationPresent(Decorator.class) && type.isAnnotationPresent(javax.interceptor.Interceptor.class))
+ {
+ throw new WebBeansConfigurationException("Annotated type "+ type + " may not annotated with both @Interceptor and @Decorator annotation");
+ }
+
+ if (!type.isAnnotationPresent(Decorator.class) && !type.isAnnotationPresent(javax.interceptor.Interceptor.class))
+ {
+ checkManagedWebBeansInterceptorConditions(type);
+ }
+
+ if (Modifier.isInterface(modifier))
+ {
+ throw new WebBeansConfigurationException("ManagedBean implementation class : " + type.getJavaClass().getName() + " may not defined as interface");
+ }
+ }
+
+ private <X> void checkManagedWebBeansInterceptorConditions(AnnotatedType<X> type)
+ {
+ Annotation[] anns = AnnotationUtil.asArray(type.getAnnotations());
+
+ Class<?> clazz = type.getJavaClass();
+ boolean hasClassInterceptors = false;
+ AnnotationManager annotationManager = webBeansContext.getAnnotationManager();
+ if (annotationManager.getInterceptorBindingMetaAnnotations(anns).length > 0)
+ {
+ hasClassInterceptors = true;
+ }
+ else
+ {
+ Annotation[] stereoTypes = annotationManager.getStereotypeMetaAnnotations(anns);
+ for (Annotation stero : stereoTypes)
+ {
+ if (annotationManager.hasInterceptorBindingMetaAnnotation(stero.annotationType().getDeclaredAnnotations()))
+ {
+ hasClassInterceptors = true;
+ break;
+ }
+ }
+ }
+
+ if(Modifier.isFinal(clazz.getModifiers()) && hasClassInterceptors)
+ {
+ throw new WebBeansConfigurationException("Final managed bean class with name : " + clazz.getName() + " can not define any InterceptorBindings");
+ }
+
+ Set<AnnotatedMethod<? super X>> methods = type.getMethods();
+ for(AnnotatedMethod<? super X> methodA : methods)
+ {
+ Method method = methodA.getJavaMember();
+ int modifiers = method.getModifiers();
+ if (!method.isSynthetic() && !method.isBridge() && !Modifier.isStatic(modifiers) && !Modifier.isPrivate(modifiers) && Modifier.isFinal(modifiers))
+ {
+ if (hasClassInterceptors)
+ {
+ throw new WebBeansConfigurationException("Maanged bean class : " + clazz.getName()
+ + " can not define non-static, non-private final methods. Because it is annotated with at least one @InterceptorBinding");
+ }
+
+ if (annotationManager.hasInterceptorBindingMetaAnnotation(
+ AnnotationUtil.asArray(methodA.getAnnotations())))
+ {
+ throw new WebBeansConfigurationException("Method : " + method.getName() + "in managed bean class : " + clazz.getName()
+ + " can not be defined as non-static, non-private and final . Because it is annotated with at least one @InterceptorBinding");
+ }
+ }
+
+ }
+ }
+
+ // Note: following code for method 'format' is taken from google guava - apache 2.0 licenced library
+ // com.google.common.base.Preconditions.format(String, Object...)
+ /**
+ * Substitutes each {@code %s} in {@code template} with an argument. These
+ * are matched by position - the first {@code %s} gets {@code args[0]}, etc.
+ * If there are more arguments than placeholders, the unmatched arguments will
+ * be appended to the end of the formatted message in square braces.
+ *
+ * @param template a non-null string containing 0 or more {@code %s}
+ * placeholders.
+ * @param args the arguments to be substituted into the message
+ * template. Arguments are converted to strings using
+ * {@link String#valueOf(Object)}. Arguments can be null.
+ */
+ private static String format(String template,
+ Object... args)
+ {
+ template = String.valueOf(template); // null -> "null"
+
+ // start substituting the arguments into the '%s' placeholders
+ StringBuilder builder = new StringBuilder(
+ template.length() + 16 * args.length);
+ int templateStart = 0;
+ int i = 0;
+ while (i < args.length)
+ {
+ int placeholderStart = template.indexOf("%s", templateStart);
+ if (placeholderStart == -1)
+ {
+ break;
+ }
+ builder.append(template.substring(templateStart, placeholderStart));
+ builder.append(args[i++]);
+ templateStart = placeholderStart + 2;
+ }
+ builder.append(template.substring(templateStart));
+
+ // if we run out of placeholders, append the extra args in square braces
+ if (i < args.length)
+ {
+ builder.append(" [");
+ builder.append(args[i++]);
+ while (i < args.length)
+ {
+ builder.append(", ");
+ builder.append(args[i++]);
+ }
+ builder.append(']');
+ }
+
+ return builder.toString();
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansErrorHandler.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansErrorHandler.java
new file mode 100644
index 0000000..d0f9d0b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansErrorHandler.java
@@ -0,0 +1,63 @@
+/*
+ * 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.webbeans.xml;
+
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Implementation of the {@link ErrorHandler} .
+ * <p>
+ * Error handler that is used for handling errors while parsing the document.
+ * </p>
+ *
+ * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
+ * @since 1.0
+ */
+public class WebBeansErrorHandler implements ErrorHandler
+{
+ private static Logger logger = WebBeansLoggerFacade.getLogger(WebBeansErrorHandler.class);
+
+ @Override
+ public void error(SAXParseException exception) throws SAXException
+ {
+ logger.log(Level.SEVERE, exception.getMessage(), exception.getCause());
+ throw new WebBeansException(exception);
+ }
+
+ @Override
+ public void fatalError(SAXParseException exception) throws SAXException
+ {
+ logger.log(Level.SEVERE, exception.getMessage(), exception.getCause());
+ throw new WebBeansException(exception);
+ }
+
+ @Override
+ public void warning(SAXParseException exception) throws SAXException
+ {
+ logger.log(Level.WARNING, exception.getMessage(), exception.getCause());
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
new file mode 100644
index 0000000..a2bbfe2
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
@@ -0,0 +1,467 @@
+/*
+ * 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.webbeans.xml;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.interceptor.Interceptor;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.decorator.DecoratorsManager;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.inject.AlternativesManager;
+import org.apache.webbeans.intercept.InterceptorsManager;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.portable.events.ProcessAnnotatedTypeImpl;
+import org.apache.webbeans.spi.ScannerService;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.Asserts;
+import org.apache.webbeans.util.ClassUtil;
+import org.apache.webbeans.util.WebBeansConstants;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Configures the web beans from the xml declerations.
+ */
+@SuppressWarnings("unchecked")
+public final class WebBeansXMLConfigurator
+{
+ private static final Logger logger = WebBeansLoggerFacade.getLogger(WebBeansXMLConfigurator.class);
+
+ /**
+ * Current configuration file name
+ */
+ private String currentScanFileName = null;
+
+ /**
+ * Creates a new instance of the <code>WebBeansXMLConfigurator</code>
+ */
+ public WebBeansXMLConfigurator()
+ {
+ }
+
+ /**
+ * Configures XML configuration file.
+ *
+ * @param xmlStream xml configuration file
+ */
+ public void configure(InputStream xmlStream)
+ {
+ try
+ {
+ if (xmlStream.available() > 0)
+ {
+ configureSpecSpecific(xmlStream, "No-name XML Stream");
+ }
+ }
+ catch (IOException e)
+ {
+ throw new WebBeansConfigurationException(e);
+ }
+
+ }
+
+ /**
+ * Configures XML configuration file.
+ *
+ * @param xmlStream xml configuration file
+ * @param fileName file name
+ * @param scanner null or current ScannerService ref
+ */
+ public void configure(InputStream xmlStream, String fileName, ScannerService scanner)
+ {
+ try
+ {
+ if (xmlStream.available() > 0)
+ {
+ configureSpecSpecific(xmlStream, fileName,scanner);
+ }
+ }
+ catch (IOException e)
+ {
+ throw new WebBeansConfigurationException(e);
+ }
+
+ }
+
+ /**
+ * Configures the web beans from the given input stream.
+ *
+ * @param xmlStream xml file containing the web beans definitions.
+ * @param fileName name of the configuration file
+ */
+ public void configureSpecSpecific(InputStream xmlStream, String fileName)
+ {
+ configureSpecSpecific(xmlStream, fileName, null);
+ }
+
+
+ /**
+ * Configures the web beans from the given input stream.
+ *
+ * @param xmlStream xml file containing the web beans definitions.
+ * @param fileName name of the configuration file
+ * @param scanner null or scanner ref
+ */
+ public void configureSpecSpecific(InputStream xmlStream, String fileName,ScannerService scanner)
+ {
+ try
+ {
+ if (xmlStream.available() > 0)
+ {
+ Asserts.assertNotNull(xmlStream, "xmlStream parameter can not be null!");
+ Asserts.assertNotNull(fileName, "fileName parameter can not be null!");
+
+ currentScanFileName = fileName;
+
+ //Get root element of the XML document
+ Element webBeansRoot = getSpecStrictRootElement(xmlStream);
+
+ //Start configuration
+ configureSpecSpecific(webBeansRoot,fileName,scanner);
+ }
+ }
+ catch (IOException e)
+ {
+ throw new WebBeansConfigurationException(e);
+ }
+ }
+
+ /**
+ * Gets the root element of the parsed document.
+ *
+ * @param stream parsed document
+ * @return root element of the document
+ * @throws WebBeansException if any runtime exception occurs
+ */
+ private Element getSpecStrictRootElement(InputStream stream) throws WebBeansException
+ {
+ try
+ {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setCoalescing(false);
+ factory.setExpandEntityReferences(true);
+ factory.setIgnoringComments(true);
+ factory.setIgnoringElementContentWhitespace(true);
+ factory.setNamespaceAware(true);
+ factory.setValidating(false);
+ DocumentBuilder documentBuilder = factory.newDocumentBuilder();
+ documentBuilder.setErrorHandler(new WebBeansErrorHandler());
+
+ Element root = documentBuilder.parse(stream).getDocumentElement();
+ return root;
+ }
+ catch (Exception e)
+ {
+ logger.log(Level.SEVERE, OWBLogConst.FATAL_0002, e);
+ throw new WebBeansException(WebBeansLoggerFacade.getTokenString(OWBLogConst.EXCEPT_0013), e);
+ }
+ }
+
+ private String getName(Element element)
+ {
+ Asserts.assertNotNull(element, "element argument can not be null");
+ return element.getLocalName();
+ }
+
+ /**
+ * Configures the xml file root element.
+ *
+ * @param webBeansRoot root element of the configuration xml file
+ */
+ private void configureSpecSpecific(Element webBeansRoot, String fileName,ScannerService scanner)
+ {
+ Node node;
+ Element child;
+ NodeList ns = webBeansRoot.getChildNodes();
+ for (int i = 0; i < ns.getLength(); i++)
+ {
+ node = ns.item(i);
+ if (!(node instanceof Element))
+ {
+ continue;
+ }
+ child = (Element) node;
+
+ /* <Interceptors> element decleration */
+ if (getName(child).equals(WebBeansConstants.WEB_BEANS_XML_SPEC_SPECIFIC_INTERCEPTORS_ELEMENT))
+ {
+ configureInterceptorsElement(child,fileName,scanner);
+ }
+ /* <Decorators> element decleration */
+ else if (getName(child).equals(WebBeansConstants.WEB_BEANS_XML_SPEC_SPECIFIC_DECORATORS_ELEMENT))
+ {
+ configureDecoratorsElement(child,fileName,scanner);
+ }
+ else if (getName(child).equals(WebBeansConstants.WEB_BEANS_XML_SPEC_SPECIFIC_ALTERNATIVES))
+ {
+ configureAlternativesElement(child,fileName,scanner);
+ }
+ }
+
+ }
+
+
+ /**
+ * Configures enablements of the interceptors.
+ *
+ * @param interceptorsElement interceptors element
+ */
+ private void configureInterceptorsElement(Element interceptorsElement, String fileName, ScannerService scanner)
+ {
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ InterceptorsManager manager = webBeansContext.getInterceptorsManager();
+ Node node;
+ Element child;
+
+ // the interceptors in this beans.xml
+ // this gets used to detect multiple definitions of the
+ // same interceptor in one beans.xml file.
+ Set<Class> interceptorsInFile = new HashSet<Class>();
+
+ NodeList ns = interceptorsElement.getChildNodes();
+ for (int i = 0; i < ns.getLength(); i++)
+ {
+ node = ns.item(i);
+ if (!(node instanceof Element))
+ {
+ continue;
+ }
+ child = (Element) node;
+ Class<?> clazz = null;
+
+ clazz = ClassUtil.getClassFromName(child.getTextContent().trim());
+
+ if (clazz == null)
+ {
+ throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "Interceptor class : " +
+ child.getTextContent().trim() + " not found");
+ }
+ else
+ {
+ Annotation[] classAnnotations;
+ AnnotatedType<?> annotatedType = webBeansContext.getAnnotatedElementFactory().newAnnotatedType(clazz);
+
+ ProcessAnnotatedTypeImpl<?> processAnnotatedEvent =
+ webBeansContext.getWebBeansUtil().fireProcessAnnotatedTypeEvent(annotatedType);
+
+ // if veto() is called
+ if (processAnnotatedEvent.isVeto())
+ {
+ return;
+ }
+
+ annotatedType = processAnnotatedEvent.getAnnotatedType();
+
+ Set<Annotation> annTypeAnnotations = annotatedType.getAnnotations();
+ if (annTypeAnnotations != null)
+ {
+ classAnnotations = annTypeAnnotations.toArray(new Annotation[annTypeAnnotations.size()]);
+ }
+ else
+ {
+ classAnnotations = new Annotation[0];
+ }
+
+ if (AnnotationUtil.hasAnnotation(classAnnotations, Interceptor.class) &&
+ !webBeansContext.getAnnotationManager().
+ hasInterceptorBindingMetaAnnotation(classAnnotations))
+ {
+ throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "Interceptor class : "
+ + child.getTextContent().trim()
+ + " must have at least one @InterceptorBinding");
+ }
+
+ // check if the interceptor got defined twice in this beans.xml
+ if (interceptorsInFile.contains(clazz))
+ {
+ throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "Interceptor class : "
+ + child.getTextContent().trim()
+ + " already defined in this beans.xml file!");
+ }
+ interceptorsInFile.add(clazz);
+
+ boolean isBDAScanningEnabled=(scanner!=null && scanner.isBDABeansXmlScanningEnabled());
+ if ((!isBDAScanningEnabled && manager.isInterceptorClassEnabled(clazz)) ||
+ (isBDAScanningEnabled && !scanner.getBDABeansXmlScanner().addInterceptor(clazz, fileName)))
+ {
+ logger.warning( "Interceptor class : " + child.getTextContent().trim() + " is already defined");
+ }
+ else
+ {
+ manager.addEnabledInterceptorClass(clazz);
+ }
+ }
+
+ }
+
+ }
+
+ /**
+ * Configures enablements of the decorators.
+ *
+ * @param decoratorsElement decorators element
+ */
+ private void configureDecoratorsElement(Element decoratorsElement,String fileName,ScannerService scanner)
+ {
+ DecoratorsManager manager = WebBeansContext.getInstance().getDecoratorsManager();
+ Node node;
+ Element child;
+ NodeList ns = decoratorsElement.getChildNodes();
+
+ Set<Class> decoratorsInFile = new HashSet<Class>();
+
+ for (int i = 0; i < ns.getLength(); i++)
+ {
+ node = ns.item(i);
+ if (!(node instanceof Element))
+ {
+ continue;
+ }
+ child = (Element) node;
+ Class<?> clazz = null;
+
+ clazz = ClassUtil.getClassFromName(child.getTextContent().trim());
+
+ if (clazz == null)
+ {
+ throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "Decorator class : " +
+ child.getTextContent().trim() + " not found");
+ }
+ else
+ {
+ boolean isBDAScanningEnabled=(scanner!=null && scanner.isBDABeansXmlScanningEnabled());
+ if ((isBDAScanningEnabled && !scanner.getBDABeansXmlScanner().addDecorator(clazz, fileName)) ||
+ decoratorsInFile.contains(clazz))
+ {
+ throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "Decorator class : " +
+ child.getTextContent().trim() + " is already defined");
+ }
+
+ manager.addEnabledDecorator(clazz);
+ decoratorsInFile.add(clazz);
+ }
+
+ }
+
+ }
+
+ /**
+ * Configures enablements of the decorators.
+ *
+ * @param alternativesElement alternatives element
+ */
+ private void configureAlternativesElement(Element alternativesElement,String fileName,ScannerService scanner)
+ {
+ Node node;
+ Element child;
+
+ // the alternatives in this beans.xml
+ // this gets used to detect multiple definitions of the
+ // same alternative in one beans.xml file.
+ Set<String> alternativesInFile = new HashSet<String>();
+
+ NodeList ns = alternativesElement.getChildNodes();
+ for (int i = 0; i < ns.getLength(); i++)
+ {
+ node = ns.item(i);
+ if (!(node instanceof Element))
+ {
+ continue;
+ }
+ child = (Element) node;
+ String alternativeName = child.getTextContent().trim();
+
+ if (alternativesInFile.contains(alternativeName))
+ {
+ throw new WebBeansConfigurationException("Given alternative : " + alternativeName
+ + " is already added as @Alternative" );
+ }
+ alternativesInFile.add(alternativeName);
+
+ if (getName(child).equals(WebBeansConstants.WEB_BEANS_XML_SPEC_SPECIFIC_STEREOTYPE) ||
+ getName(child).equals(WebBeansConstants.WEB_BEANS_XML_OWB_SPECIFIC_STEREOTYPE))
+ {
+ addAlternative(child, true,fileName,scanner);
+ }
+ else if (getName(child).equals(WebBeansConstants.WEB_BEANS_XML_SPEC_SPECIFIC_CLASS)
+ || getName(child).equals(WebBeansConstants.WEB_BEANS_XML_OWB_SPECIFIC_CLASS))
+ {
+ addAlternative(child, false,fileName,scanner);
+ }
+ else
+ {
+ if (logger.isLoggable(Level.WARNING))
+ {
+ logger.log(Level.WARNING, OWBLogConst.WARN_0002, getName(child));
+ }
+ }
+ }
+ }
+
+ private void addAlternative(Element child, boolean isStereoType,String fileName,ScannerService scanner)
+ {
+ Class<?> clazz = null;
+
+ clazz = ClassUtil.getClassFromName(child.getTextContent().trim());
+
+ if (clazz == null)
+ {
+ throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "Alternative class : " + getName(child) + " not found");
+ }
+ else
+ {
+ AlternativesManager manager = WebBeansContext.getInstance().getAlternativesManager();
+ if (isStereoType)
+ {
+ manager.addStereoTypeAlternative(clazz,fileName,scanner);
+ }
+ else
+ {
+ manager.addClazzAlternative(clazz,fileName,scanner);
+ }
+ }
+ }
+
+
+
+ /**
+ * Gets error message for XML parsing of the current XML file.
+ *
+ * @return the error messages
+ */
+ private String createConfigurationFailedMessage()
+ {
+ return "WebBeans XML configuration defined in " + currentScanFileName + " is failed. Reason is : ";
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/main/resources/META-INF/openwebbeans/openwebbeans.properties b/owb_1.2.x/webbeans-impl/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
new file mode 100644
index 0000000..56976f3
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
@@ -0,0 +1,103 @@
+#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.
+#---------------------------------------------------------------
+# The default configuration for OpenWebBeans
+#
+# The default configuration is intended for a JDK and a simple ServletContainer
+# like jetty, resin or tomcat.
+#
+#---------------------------------------------------------------
+
+
+################################################################################################
+################################### DEFAULT SPI CONFIGURATION SECTION ##########################
+################################################################################################
+
+# this is the basic configuration, thus it has a very low ordinal of 10
+configuration.ordinal=10
+
+################################### Default Container Lifecycle ################################
+#Default implementation of org.apache.webbeans.corespi.ContainerLifecycle.
+org.apache.webbeans.spi.ContainerLifecycle=org.apache.webbeans.lifecycle.StandaloneLifeCycle
+################################################################################################
+
+################################### Default JNDI Service #######################################
+#Default implementation of org.apache.webbeans.corespi.JNDIService.
+org.apache.webbeans.spi.JNDIService=org.apache.webbeans.corespi.se.DefaultJndiService
+################################################################################################
+
+################################### Default Scanner Service ####################################
+#Default implementation of org.apache.webbeans.corespi.ScannerService.
+org.apache.webbeans.spi.ScannerService=org.apache.webbeans.corespi.se.DefaultScannerService
+################################################################################################
+
+################################### Default Contexts Service ####################################
+#Default implementation of org.apache.webbeans.corespi.ContextsService.
+org.apache.webbeans.spi.ContextsService=org.apache.webbeans.corespi.se.DefaultContextsService
+################################################################################################
+
+################################### Default Contexts Service ####################################
+# Default SecurityService implementation which directly invokes underlying classes
+# without using a SecurityManager
+org.apache.webbeans.spi.SecurityService=org.apache.webbeans.corespi.security.SimpleSecurityService
+################################################################################################
+
+################################ Default Implementation-Loader Service ###########################################
+# Service which encapsulates the Service-Loader of Java 1.6+ to allow custom implementations to support Java 1.5
+org.apache.webbeans.spi.LoaderService=org.apache.webbeans.service.DefaultLoaderService
+
+################################################################################################
+#################################### SEVERAL CONFIGURATION PARAMETERS ##########################
+################################################################################################
+
+#################################### Use Embedded OpenEJB Discovery ############################
+#If it is true, it checks every bean class whether or not represent EJB Bean
+org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService=false
+################################################################################################
+
+################# Force not having Checked Exceptions in lifecycle methods ####################
+# If it is true, OWB forces that lifecycle methods like @PreDestroy and @PostConstruct must not
+# throw any checked exceptions. This is the behaviour which is defined in the EE interceptor
+# spec. Since this is sometimes way too restrictive, we allow to relax this rule by configuration
+# The default value is 'true' internally.
+# ATTENTION: this property works container wide!
+# org.apache.webbeans.forceNoCheckedExceptions=true
+################################################################################################
+
+################################## OWB Specific Injection ######################################
+#If false, uses spec. defined injection with @Inject. Not recommended use as true.
+#It will be removed in future development.
+org.apache.webbeans.fieldInjection.useOwbSpecificInjection=false
+################################################################################################
+
+################################# Conversation Support #########################################
+org.apache.webbeans.application.supportsConversation=false
+################################################################################################
+
+####################### Archive Centric Beans.xml Scanning #####################################
+# If true, will enable decorators, interceptors and alternatives based on the beans.xml
+# of the appropriate archive.
+org.apache.webbeans.useBDABeansXMLScanner=false
+################################################################################################
+
+########################### Proxy Implementation Mapping ######################################
+# This allows mapping a Scope Annotation class to a specific InterceptorProxy which are
+# typically sub classes of NormalScopedBeanInterceptorHandler
+#
+# org.apache.webbeans.proxy.mapping.javax.enterprise.context.RequestScoped=org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler
+org.apache.webbeans.proxy.mapping.javax.enterprise.context.ApplicationScoped=org.apache.webbeans.intercept.ApplicationScopedBeanInterceptorHandler
+################################################################################################
diff --git a/owb_1.2.x/webbeans-impl/src/main/resources/openwebbeans/Messages.properties b/owb_1.2.x/webbeans-impl/src/main/resources/openwebbeans/Messages.properties
new file mode 100644
index 0000000..25171fc
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/main/resources/openwebbeans/Messages.properties
@@ -0,0 +1,119 @@
+# Copyright 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.
+
+
+#========= BEGIN TRANSLATING MESSAGES HERE ============================
+
+#text bits... Check if translation required.
+TEXT_CONFIG_NOT_FOUND = Config properties [{0}] not found. Using default settings.
+TEXT_CONFIG_FOUND = Config properties [{0}] found at location \: [{1}]. Overriding default settings.
+TEXT_MB_IMPL = Managed Bean implementation class \:
+TEXT_SAME_SCOPE = stereotypes must declare the same @Scope annotations.
+TEXT_JAVA_TYPENAME = Java type with name \:
+
+
+#info messages:
+INFO_0001 = OpenWebBeans Container has started, it took [{0}] ms.
+INFO_0002 = OpenWebBeans Container was stopped for context path, [{0}]
+INFO_0003 = All injection points were validated successfully.
+INFO_0004 = Adding OpenWebBeansPlugin \: [{0}]
+INFO_0005 = OpenWebBeans Container is starting...
+INFO_0006 = Initializing OpenWebBeans Container.
+INFO_0008 = Stopping OpenWebBeans Container...
+INFO_0009 = OpenWebBeans Container has stopped.
+INFO_0010 = Cannot send event to bean in non-active context \: [{0}]
+INFO_0011 = Conversation with id {0} has been destroyed because it is not active for the period of configured time out interval.
+
+
+#warning messages:
+WARN_0001 = No plugins to shutDown.
+WARN_0002 = Alternative XML content is incorrect. Child of <alternatives> must be <class>,<stereotype> but found \: [{0}]
+WARN_0003 = Conversation with cid [{0}] already started
+WARN_0004 = Conversation with cid [{0}] already ended
+WARN_0005_1 = [{0}] has not DependentScope. If an interceptor or decorator has any scope other than @Dependent, non-portable behaviour results.
+WARN_0005_2 = [{0}] has a name. If an interceptor or decorator has name, non-portable behaviour results.
+WARN_0005_3 = [{0}] is Alternative. If an interceptor or decorator is @Alternative, non-portable behaviour results.
+WARN_0006 = Unable to close entity manager factory with name \: [{0}]
+WARN_0007 = Exception in ejbContext.proceed().
+WARN_0008 = Unable to find EJB bean with class \: [{0}] \: [{1}]
+WARN_0009 = Unable to find service with class name \: [{0}]
+WARN_0010 = Trying to serialize non-passivation capable bean proxy \: [{0}]
+WARN_0011 = Trying to de-serialize non-passivation capable bean proxy \: [{0}]
+WARN_0012 = No suitable constructor found for injection target class \: [{0}]. produce() method does not work\!
+WARN_0013 = Unable to clear ResourceFactory.
+WARN_0014 = Could not find [{0}] with name [{1}].
+WARN_0015 = Trying to serialize non-passivation capable bean proxy \: [{0}]
+WARN_0016 = Stereotypes can not annotated with @Typed but stereotype \: [{0}] has annotated, non-portable behaviour results.
+WARN_0017 = Stereotypes can not define qualifier other than @Named but stereotype \: [{0}] has defined [{1}] , non-portable behaviour results.
+WARN_0018 = Ignoring class [{0}] because it could not be loaded: {1}
+
+
+#error messages:
+ERROR_0001 = Unable to inject resource for \: [{0}]
+ERROR_0002 = Initialization of the WebBeans container has failed.
+ERROR_0003 = An exception occurred in the transactional observer.
+ERROR_0004 = Unable to initialize InitialContext object.
+ERROR_0005 = Unable to bind object with name \: [{0}]
+ERROR_0006 = Security exception. Cannot access decorator class \: [{0}] method \: [{1}]
+ERROR_0007 = Delegate field is not found on the given decorator class \: [{0}]
+ERROR_0008 = An error occurred while executing [{0}]
+ERROR_0009 = An error occurred while shutting down the plugin \: [{0}]
+ERROR_0010 = An error occurred while closing the JMS instance.
+ERROR_0011 = Method security access violation for method \: [{0}] in decorator class \: [{1}]
+ERROR_0012 = Exception in calling method \: [{0}] in decorator class \: [{1}]. Look in the log for target checked exception.
+ERROR_0013 = Caught an Exception while starting a fresh session!
+ERROR_0014 = Illegal access exception for method \: [{0}] in decorator class \: [{1}]
+ERROR_0015 = Illegal access exception for field \: [{0}] in decorator class \: [{1}]
+ERROR_0016 = IllegalArgumentException has occurred while calling the field \: [{0}] on the class \: [{1}]
+ERROR_0017 = IllegalAccessException has occurred while calling the field \: [{0}] on the class \: [{1}]
+ERROR_0018 = An error occurred while starting application context path \: [{0}]
+ERROR_0019 = An error occurred while starting request \: [{0}]
+ERROR_0020 = An error occurred while starting session \: [{0}]
+ERROR_0021 = An error occurred while stopping the container.
+ERROR_0022 = Unable to inject dependencies of EJB interceptor instance with class \: [{0}]
+ERROR_0023 = An error occurred while injecting Java EE Resources for the bean instance \: [{0}]
+ERROR_0024 = Unable to get resource with class [{0}] in [{1}] with name [{2}].
+ERROR_0025 = Unable to inject field \: [{0}]
+ERROR_0026 = An error occurred while injecting dependencies of bean \: [{0}]
+ERROR_0027 = Unable to create AnnotatedType for class \: [{0}]. Exception cause \: [{1}]
+
+#fatal messages:
+FATAL_0001 = Exception thrown while destroying bean instance \: [{0}]
+FATAL_0002 = Unable to read root element of the given input stream.
+
+
+#Text used in thrown exceptions:
+CRITICAL_DEFAULT_CONFIG_FAILURE = Problem while loading OpenWebBeans default configuration.
+EXCEPT_0002 = Wrong termination object.
+EXCEPT_0003 = Specialized class [
+EXCEPT_0004 = ] must extend another class.
+EXCEPT_XML = XML Specialization Error \:
+EXCEPT_0005 = More than one class specialized the same super class \:
+EXCEPT_0006 = Caught Exceptions while sending shutdown to the following plugins \:
+EXCEPT_0007 = TransactionPhase not supported \:
+EXCEPT_0008 = Caught Exception while handling event object with type \:
+EXCEPT_0009 = Unable to unbind object with name \:
+EXCEPT_0010 = Unable to lookup object with name \:
+EXCEPT_0012 = All elements in the beans.xml file have to declare name space.
+EXCEPT_0013 = Unable to read root element of the given input stream.
+EXCEPT_0014 = Multiple classes with name \:
+EXCEPT_0015 = Passivation bean \: [{0}] decorators must be passivating capable.
+EXCEPT_0016 = Passivation bean \: [{0}] interceptors must be passivating capable.
+EXCEPT_0017 = Passivation bean \: [{0}] interceptor \: [{1}] must have serializable injection points.
+EXCEPT_0018 = Wrong startup object.
+
+DEBUG_ADD_BYTYPE_CACHE_BEANS = Adding resolved beans with key [{0}] to cache.
+DEBUG_ADD_BYNAME_CACHE_BEANS = Adding resolved EL beans with key [{0}] to cache.
+
+#========= END OF TRANSLATED MESSAGES =================================
diff --git a/owb_1.2.x/webbeans-impl/src/site/apt/index.apt b/owb_1.2.x/webbeans-impl/src/site/apt/index.apt
new file mode 100644
index 0000000..15355c7
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/site/apt/index.apt
@@ -0,0 +1,27 @@
+~~ 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.
+Apache OpenWebBeans Core
+
+ Apache OpenWebBeans is an implementation of the JSR-299 CDI specification.
+
+ The openwebbeams-impl module contains the core implementation of the OpenWebBeans container.
+ This openwebbeans-impl itself only needs Java-SE to run. All Java-EE features can be enabled by
+ simply adding the respective WebBeans-plugin JARs into the classpath. This way we don't always
+ need all heavyweight dependencies and a fully blown Java-EE server.
+
+ Instead OpenWebBeans scales significantly better than other CDI implementations and
+ can be used in standalone applications, web application servers like tomcat, as well
+ as in full scale Java EE clusters.
+
+
+
+
diff --git a/owb_1.2.x/webbeans-impl/src/site/site.xml b/owb_1.2.x/webbeans-impl/src/site/site.xml
new file mode 100644
index 0000000..2d765bd
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/site/site.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<project name="OpenWebBeans-Impl">
+ <bannerLeft>
+ <name>Apache OpenWebBeans</name>
+ <src>http://openwebbeans.apache.org/images/openwebbeans.png</src>
+ <href>http://openwebbeans.apache.org</href>
+ </bannerLeft>
+
+ <bannerRight>
+ <name>Apache Banner</name>
+ <src>http://www.apache.org/images/asf-logo.gif</src>
+ <href>http://www.apache.org</href>
+ </bannerRight>
+
+ <publishDate format="dd MMM yyyy" />
+ <version position="left"/>
+
+ <body>
+ <breadcrumbs>
+ <item name="Apache" href="http://www.apache.org"/>
+ <item name="OpenWebBeans" href="http://openwebbeans.apache.org"/>
+ <item name="OWB-Core" href="http://openwebbeans.apache.org/${project.version}/openwebbeans-impl"/>
+ </breadcrumbs>
+
+ <menu name="Overview">
+ <item name="Introduction" href="index.html" />
+ </menu>
+
+ <menu ref="reports"/>
+ </body>
+</project>
+
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/AbstractUnitTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/AbstractUnitTest.java
new file mode 100644
index 0000000..cfc6244
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/AbstractUnitTest.java
@@ -0,0 +1,254 @@
+/*
+ * 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.webbeans.newtests;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.config.WebBeansFinder;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.inject.OWBInjector;
+import org.apache.webbeans.lifecycle.test.OpenWebBeansTestLifeCycle;
+import org.apache.webbeans.lifecycle.test.OpenWebBeansTestMetaDataDiscoveryService;
+import org.apache.webbeans.spi.ContainerLifecycle;
+import org.apache.webbeans.util.WebBeansUtil;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.Extension;
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+
+public abstract class AbstractUnitTest
+{
+ private OpenWebBeansTestLifeCycle testLifecycle;
+ private List<Extension> extensions = new ArrayList<Extension>();
+ private List<Class<?>> interceptors = new ArrayList<Class<?>>();
+ private List<Class<?>> decorators = new ArrayList<Class<?>>();
+ private WebBeansContext webBeansContext;
+
+ protected AbstractUnitTest()
+ {
+
+ }
+
+ @Before
+ public void cleanup()
+ {
+ extensions.clear();
+ interceptors.clear();
+ decorators.clear();
+ }
+
+ /**
+ * always shut down the container after each test.
+ */
+ @After
+ public void shutdown()
+ {
+ shutDownContainer();
+ }
+
+ protected void startContainer(Class<?>... beanClasses)
+ {
+ startContainer(new ArrayList<Class<?>>(Arrays.asList(beanClasses)), null);
+ }
+
+ protected void startContainer(Collection<Class<?>> beanClasses)
+ {
+ startContainer(beanClasses, null);
+ }
+
+ protected void startContainer(Collection<Class<?>> beanClasses, Collection<String> beanXmls)
+ {
+ startContainer(beanClasses, beanXmls, false);
+ }
+
+ protected void startContainer(Collection<Class<?>> rawBeanClasses, Collection<String> beanXmls, boolean inject)
+ {
+ final Collection<Class<?>> beanClasses = new ArrayList<Class<?>>(); // ensure it is updatable
+ beanClasses.addAll(rawBeanClasses);
+
+ WebBeansFinder.clearInstances(WebBeansUtil.getCurrentClassLoader());
+ //Creates a new container
+ testLifecycle = new OpenWebBeansTestLifeCycle();
+
+ webBeansContext = WebBeansContext.getInstance();
+ for (Extension ext : extensions)
+ {
+ webBeansContext.getExtensionLoader().addExtension(ext);
+ }
+
+ for (Class interceptor : interceptors)
+ {
+ // add it as enabled interceptor class, like it would be listed in beans.xml
+ webBeansContext.getInterceptorsManager().addEnabledInterceptorClass(interceptor);
+
+ // but also add it for scanning
+ beanClasses.add(interceptor);
+ }
+
+ for (Class decorator : decorators)
+ {
+ // add it as enabled decorator class, like it would be listed in beans.xml
+ webBeansContext.getDecoratorsManager().addEnabledDecorator(decorator);
+
+ // but also add it for scanning
+ beanClasses.add(decorator);
+ }
+
+ //Deploy bean classes
+ OpenWebBeansTestMetaDataDiscoveryService discoveryService = (OpenWebBeansTestMetaDataDiscoveryService)webBeansContext.getScannerService();
+ discoveryService.deployClasses(beanClasses);
+ if (beanXmls != null)
+ {
+ discoveryService.deployXMLs(beanXmls);
+ }
+
+ //Start application
+ try
+ {
+ testLifecycle.startApplication(null);
+ }
+ catch (Exception e)
+ {
+ throw new WebBeansConfigurationException(e);
+ }
+
+ if (inject)
+ {
+ try
+ {
+ OWBInjector.inject(getBeanManager(), this, null);
+ }
+ catch (Exception e)
+ {
+ throw new WebBeansConfigurationException(e);
+ }
+ }
+ }
+
+ protected ContainerLifecycle getLifecycle()
+ {
+ return testLifecycle;
+ }
+
+ protected void shutDownContainer()
+ {
+ //Shutdown application
+ if(this.testLifecycle != null)
+ {
+ this.testLifecycle.stopApplication(null);
+ this.testLifecycle = null;
+ cleanup();
+ }
+ }
+
+ protected WebBeansContext getWebBeansContext()
+ {
+ return this.webBeansContext;
+ }
+
+ protected BeanManager getBeanManager()
+ {
+ return this.webBeansContext.getBeanManagerImpl();
+ }
+
+ @SuppressWarnings("unchecked")
+ protected <T> Bean<T> getBean(Class<T> type, Annotation... qualifiers)
+ {
+ Set beans = getBeanManager().getBeans(type, qualifiers);
+ return (Bean<T>) getBeanManager().resolve(beans);
+ }
+
+ protected <T> T getInstance(Class<T> type, Annotation... qualifiers)
+ {
+ Set<Bean<?>> beans = getBeanManager().getBeans(type, qualifiers);
+ Assert.assertNotNull(beans);
+
+ Bean<?> bean = getBeanManager().resolve(beans);
+ Assert.assertNotNull("Bean with type " + type + " could not be found!", bean);
+
+ return (T) getBeanManager().getReference(bean, type, getBeanManager().createCreationalContext(bean));
+ }
+
+ @SuppressWarnings("unchecked")
+ protected <T> T getInstance(String elName)
+ {
+ Set<Bean<?>> beans = getBeanManager().getBeans(elName);
+ Assert.assertNotNull(beans);
+
+ Bean<?> bean = getBeanManager().resolve(beans);
+ Assert.assertNotNull("Bean with name " + elName + " could not be found!", bean);
+
+ return (T) getBeanManager().getReference(bean, Object.class, getBeanManager().createCreationalContext(bean));
+ }
+
+
+
+ protected String getXmlPath(String packageName, String fileName)
+ {
+ StringBuilder prefix = new StringBuilder(packageName.replace('.', '/'));
+ prefix.append("/");
+ prefix.append(fileName);
+ prefix.append(".xml");
+
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ return loader.getResource(prefix.toString()).toExternalForm();
+ }
+
+ /**
+ * Add a CDI Extension which should get used in the test case.
+ * Use this function instead of defining test Extensions via the usual
+ * META-INF/services/javax.enterprise.inject.spi.Extension file!
+ *
+ * @param ext the {@link Extension} which should get loaded
+ */
+ public void addExtension(Extension ext) {
+ this.extensions.add(ext);
+ }
+
+ /**
+ * Add the given interceptor class to get picked up
+ * by startContainer.
+ * This has the same effect as adding it to the
+ * <interceptors> section in beans.xml.
+ */
+ public void addInterceptor(Class interceptorClass)
+ {
+ interceptors.add(interceptorClass);
+ }
+
+ /**
+ * Add the given interceptor class to get picked up
+ * by startContainer.
+ * This has the same effect as adding it to the
+ * <interceptors> section in beans.xml.
+ */
+ public void addDecorator(Class decoratorClass)
+ {
+ decorators.add(decoratorClass);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/AlternativeBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/AlternativeBean.java
new file mode 100644
index 0000000..7fc660d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/AlternativeBean.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.newtests.concepts.alternatives.common;
+
+import javax.enterprise.inject.Alternative;
+
+@Alternative
+public class AlternativeBean implements SimpleInterface
+{
+
+ @Override
+ public Class<?> getImplementationType()
+ {
+ return AlternativeBean.class;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/AlternativeOnClassAndProducerMethodBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/AlternativeOnClassAndProducerMethodBean.java
new file mode 100644
index 0000000..512582b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/AlternativeOnClassAndProducerMethodBean.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.concepts.alternatives.common;
+
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Produces;
+
+/**
+ * This one has the @Alternative on the class
+ * AND also an @Alternative on the producer method
+ */
+@Alternative
+public class AlternativeOnClassAndProducerMethodBean
+{
+
+ @Produces
+ @Alternative
+ @QualifierProducerBased
+ public IProducedBean generateBean2()
+ {
+ return new ProducedBean("AlternativeOnClassAndProducerMethodBean", this);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/AlternativeOnClassOnlyBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/AlternativeOnClassOnlyBean.java
new file mode 100644
index 0000000..f205db2
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/AlternativeOnClassOnlyBean.java
@@ -0,0 +1,45 @@
+/*
+ * 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.webbeans.newtests.concepts.alternatives.common;
+
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Produces;
+
+
+/**
+ * This one has the @Alternative on the class and NOT on the producer method
+ *
+ * See Spec 5.1.1
+ * <pre>
+ * An alternative is selected for the bean archive if ...
+ * * the alternative is a producer method, field or resource, and the bean class
+ * that declares the method or field is listed ..
+ * </pre>
+ */
+@Alternative
+public class AlternativeOnClassOnlyBean
+{
+
+ @Produces
+ @QualifierProducerBased
+ public IProducedBean generateBean1()
+ {
+ return new ProducedBean("AlternativeOnClassOnlyBean", this);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/AlternativeOnProducerMethodOnlyBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/AlternativeOnProducerMethodOnlyBean.java
new file mode 100644
index 0000000..d04eb5f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/AlternativeOnProducerMethodOnlyBean.java
@@ -0,0 +1,39 @@
+/*
+ * 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.webbeans.newtests.concepts.alternatives.common;
+
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Produces;
+
+/**
+ * This one has the @Alternative ONLY on the producer method.
+ * This must result in an Exception.
+ */
+public class AlternativeOnProducerMethodOnlyBean
+{
+
+ @Produces
+ @Alternative
+ @QualifierProducerBased
+ public IProducedBean generateBean2()
+ {
+ return new ProducedBean("AlternativeOnProducerMethodOnlyBean", this);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/DefaultBeanProducer.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/DefaultBeanProducer.java
new file mode 100644
index 0000000..4d20f2b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/DefaultBeanProducer.java
@@ -0,0 +1,39 @@
+/*
+ * 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.webbeans.newtests.concepts.alternatives.common;
+
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+
+
+public class DefaultBeanProducer
+{
+ public static boolean gotDumped = false;
+
+ @Produces @QualifierProducerBased
+ public IProducedBean generateBean()
+ {
+ return new ProducedBean("default", this);
+ }
+
+ public void dumpBean(@Disposes @QualifierProducerBased IProducedBean bean)
+ {
+ gotDumped = true;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/DefaultBeanProducerWithoutDisposes.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/DefaultBeanProducerWithoutDisposes.java
new file mode 100644
index 0000000..15611e4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/DefaultBeanProducerWithoutDisposes.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.newtests.concepts.alternatives.common;
+
+import javax.enterprise.inject.Produces;
+
+public class DefaultBeanProducerWithoutDisposes
+{
+
+ public @Produces @QualifierProducerBased
+ IProducedBean generateBean()
+ {
+ return new ProducedBean("defaultwithoutdisposes", this);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/IProducedBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/IProducedBean.java
new file mode 100644
index 0000000..c081a2b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/IProducedBean.java
@@ -0,0 +1,30 @@
+/*
+ * 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.webbeans.newtests.concepts.alternatives.common;
+
+
+public interface IProducedBean
+{
+
+ public String getID();
+
+ public String getProducerID();
+
+ public String getProducerType();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/Pen.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/Pen.java
new file mode 100644
index 0000000..574b7bd
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/Pen.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.concepts.alternatives.common;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@Qualifier
+public @interface Pen
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/Pencil.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/Pencil.java
new file mode 100644
index 0000000..b67d381
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/Pencil.java
@@ -0,0 +1,30 @@
+/*
+ * 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.webbeans.newtests.concepts.alternatives.common;
+
+
+public class Pencil
+{
+ private int nr = 42;
+
+ public int getNr()
+ {
+ return nr;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/PencilProducerBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/PencilProducerBean.java
new file mode 100644
index 0000000..2ffb70f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/PencilProducerBean.java
@@ -0,0 +1,29 @@
+/*
+ * 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.webbeans.newtests.concepts.alternatives.common;
+
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Produces;
+
+@Alternative
+public class PencilProducerBean
+{
+ @Produces @Alternative @Pen
+ public static Pencil pencil = new Pencil();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/ProducedBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/ProducedBean.java
new file mode 100644
index 0000000..650fc5b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/ProducedBean.java
@@ -0,0 +1,49 @@
+/*
+ * 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.webbeans.newtests.concepts.alternatives.common;
+
+public class ProducedBean implements IProducedBean
+{
+ String str;
+ Object producer;
+
+ public ProducedBean(String s, Object producer)
+ {
+ str = s;
+ this.producer = producer;
+ }
+
+ @Override
+ public String getID()
+ {
+ return str + "," + getProducerID() + "," + this;
+ }
+
+ @Override
+ public String getProducerID()
+ {
+ return producer.toString();
+ }
+
+ @Override
+ public String getProducerType()
+ {
+ return str;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/QualifierProducerBased.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/QualifierProducerBased.java
new file mode 100644
index 0000000..6f613f7
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/QualifierProducerBased.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.concepts.alternatives.common;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.PARAMETER, ElementType.METHOD,ElementType.CONSTRUCTOR,ElementType.FIELD})
+public @interface QualifierProducerBased
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/SimpleBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/SimpleBean.java
new file mode 100644
index 0000000..d9a1476
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/SimpleBean.java
@@ -0,0 +1,29 @@
+/*
+ * 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.webbeans.newtests.concepts.alternatives.common;
+
+public class SimpleBean implements SimpleInterface
+{
+
+ @Override
+ public Class<?> getImplementationType()
+ {
+ return SimpleBean.class;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/SimpleInjectionTarget.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/SimpleInjectionTarget.java
new file mode 100644
index 0000000..1f89d3f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/SimpleInjectionTarget.java
@@ -0,0 +1,61 @@
+/*
+ * 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.webbeans.newtests.concepts.alternatives.common;
+
+import java.util.Iterator;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+public class SimpleInjectionTarget
+{
+
+ @Inject
+ private SimpleInterface simpleInterface1;
+
+ @Inject
+ private Instance<SimpleInterface> simpleInterface2Instance;
+
+ private SimpleInterface simpleInterface2;
+
+ @PostConstruct
+ public void initialize()
+ {
+ simpleInterface2 = simpleInterface2Instance.get();
+ }
+
+ public SimpleInterface getSimpleInterface1()
+ {
+ return simpleInterface1;
+ }
+
+ public SimpleInterface getSimpleInterface2()
+ {
+ return simpleInterface2;
+ }
+
+ public boolean isSimpleInterfaceAmbiguous() {
+ return simpleInterface2Instance.isAmbiguous();
+ }
+
+ public Iterator<SimpleInterface> getSimpleInterfaceInstances() {
+ return simpleInterface2Instance.iterator();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/SimpleInterface.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/SimpleInterface.java
new file mode 100644
index 0000000..03bc8bd
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/SimpleInterface.java
@@ -0,0 +1,25 @@
+/*
+ * 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.webbeans.newtests.concepts.alternatives.common;
+
+public interface SimpleInterface
+{
+
+ Class<?> getImplementationType();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/YetAnotherPencil.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/YetAnotherPencil.java
new file mode 100644
index 0000000..0db778c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/common/YetAnotherPencil.java
@@ -0,0 +1,27 @@
+/*
+ * 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.webbeans.newtests.concepts.alternatives.common;
+
+import javax.enterprise.context.RequestScoped;
+
+@Pen
+@RequestScoped
+public class YetAnotherPencil
+{
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/tests/AlternativeBeanResolvingTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/tests/AlternativeBeanResolvingTest.java
new file mode 100644
index 0000000..c232359
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/tests/AlternativeBeanResolvingTest.java
@@ -0,0 +1,116 @@
+/*
+ * 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.webbeans.newtests.concepts.alternatives.tests;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.util.AnnotationLiteral;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.concepts.alternatives.common.AlternativeBean;
+import org.apache.webbeans.newtests.concepts.alternatives.common.AlternativeOnClassAndProducerMethodBean;
+import org.apache.webbeans.newtests.concepts.alternatives.common.AlternativeOnClassOnlyBean;
+import org.apache.webbeans.newtests.concepts.alternatives.common.DefaultBeanProducerWithoutDisposes;
+import org.apache.webbeans.newtests.concepts.alternatives.common.Pen;
+import org.apache.webbeans.newtests.concepts.alternatives.common.Pencil;
+import org.apache.webbeans.newtests.concepts.alternatives.common.PencilProducerBean;
+import org.apache.webbeans.newtests.concepts.alternatives.common.YetAnotherPencil;
+import org.junit.Test;
+import org.junit.Assert;
+
+/**
+ * Test bean resolving if @Alternative annotated beans are involved
+ * See OWB-658 for the original problem.
+ */
+public class AlternativeBeanResolvingTest extends AbstractUnitTest
+{
+ private static final String PACKAGE_NAME = AlternativeProducerMethodTest.class.getPackage().getName();
+
+ /**
+ * see OWB-658
+ */
+ @Test
+ public void testObjectBeanQuery()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "AlternativeOnProducerFieldTest"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(Pen.class);
+ beanClasses.add(Pencil.class);
+ beanClasses.add(PencilProducerBean.class);
+ beanClasses.add(DefaultBeanProducerWithoutDisposes.class);
+ beanClasses.add(AlternativeOnClassAndProducerMethodBean.class);
+ beanClasses.add(YetAnotherPencil.class);
+
+ // available but not enabled in beans.xml
+ beanClasses.add(AlternativeOnClassOnlyBean.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans(Object.class, new AnnotationLiteral<Pen>(){});
+ Assert.assertNotNull(beans);
+ Assert.assertEquals(2, beans.size());
+ }
+
+
+ /**
+ * Having the same alternative enabled multiple times in the same beans.xml
+ * This must abort with a deployment error.
+ */
+ @Test(expected = WebBeansConfigurationException.class)
+ public void testMultipleAlternativeInSameFile()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "MultipleAlternativesInSameFile_broken"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(Pen.class);
+ beanClasses.add(Pencil.class);
+ beanClasses.add(PencilProducerBean.class);
+ beanClasses.add(DefaultBeanProducerWithoutDisposes.class);
+ beanClasses.add(AlternativeOnClassAndProducerMethodBean.class);
+ beanClasses.add(YetAnotherPencil.class);
+
+ startContainer(beanClasses, beanXmls, true);
+ }
+
+
+ @Test
+ public void testMultipleAlternativeInDifferentFiles()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "simpleAlternative"));
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "simpleAlternative_2"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(AlternativeBean.class);
+
+ startContainer(beanClasses, beanXmls, true);
+
+ AlternativeBean alternativeBean = getInstance(AlternativeBean.class);
+ Assert.assertNotNull(alternativeBean);
+ Assert.assertEquals(AlternativeBean.class, alternativeBean.getImplementationType());
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/tests/AlternativeInstanceTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/tests/AlternativeInstanceTest.java
new file mode 100644
index 0000000..58279f0
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/tests/AlternativeInstanceTest.java
@@ -0,0 +1,97 @@
+/*
+ * 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.webbeans.newtests.concepts.alternatives.tests;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.concepts.alternatives.common.AlternativeBean;
+import org.apache.webbeans.newtests.concepts.alternatives.common.SimpleBean;
+import org.apache.webbeans.newtests.concepts.alternatives.common.SimpleInjectionTarget;
+import org.apache.webbeans.newtests.concepts.alternatives.common.SimpleInterface;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * see OWB-742
+ */
+public class AlternativeInstanceTest extends AbstractUnitTest
+{
+ private static final String PACKAGE_NAME = AlternativeProducerMethodTest.class.getPackage().getName();
+
+ @Test
+ public void testAlternativeDisabled()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(SimpleBean.class);
+ beanClasses.add(AlternativeBean.class);
+ beanClasses.add(SimpleInjectionTarget.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ Bean<?> simpleInjectionTargetBean = getBeanManager().getBeans(SimpleInjectionTarget.class).iterator().next();
+ CreationalContext<?> context = getBeanManager().createCreationalContext(simpleInjectionTargetBean);
+ SimpleInjectionTarget target = (SimpleInjectionTarget) getBeanManager().getReference(simpleInjectionTargetBean, SimpleInjectionTarget.class, context);
+
+ Assert.assertFalse(target.isSimpleInterfaceAmbiguous());
+ Iterator<SimpleInterface> simpleInterfaceInstances = target.getSimpleInterfaceInstances();
+ Assert.assertTrue(simpleInterfaceInstances.hasNext());
+ Assert.assertEquals(SimpleBean.class, simpleInterfaceInstances.next().getImplementationType());
+ Assert.assertFalse(simpleInterfaceInstances.hasNext());
+ Assert.assertEquals(SimpleBean.class, target.getSimpleInterface1().getImplementationType());
+ Assert.assertEquals(SimpleBean.class, target.getSimpleInterface2().getImplementationType());
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testAlternativeEnabled()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "simpleAlternative"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(SimpleBean.class);
+ beanClasses.add(AlternativeBean.class);
+ beanClasses.add(SimpleInjectionTarget.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ Bean<?> simpleInjectionTargetBean = getBeanManager().getBeans(SimpleInjectionTarget.class).iterator().next();
+ CreationalContext<?> context = getBeanManager().createCreationalContext(simpleInjectionTargetBean);
+ SimpleInjectionTarget target = (SimpleInjectionTarget) getBeanManager().getReference(simpleInjectionTargetBean, SimpleInjectionTarget.class, context);
+
+ Assert.assertFalse(target.isSimpleInterfaceAmbiguous());
+ Iterator<SimpleInterface> simpleInterfaceInstances = target.getSimpleInterfaceInstances();
+ Assert.assertTrue(simpleInterfaceInstances.hasNext());
+ Assert.assertEquals(AlternativeBean.class, simpleInterfaceInstances.next().getImplementationType());
+ Assert.assertFalse(simpleInterfaceInstances.hasNext());
+ Assert.assertEquals(AlternativeBean.class, target.getSimpleInterface1().getImplementationType());
+ Assert.assertEquals(AlternativeBean.class, target.getSimpleInterface2().getImplementationType());
+
+ shutDownContainer();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/tests/AlternativeOnProducerFieldTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/tests/AlternativeOnProducerFieldTest.java
new file mode 100644
index 0000000..a5eea2a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/tests/AlternativeOnProducerFieldTest.java
@@ -0,0 +1,82 @@
+/*
+ * 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.webbeans.newtests.concepts.alternatives.tests;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.util.AnnotationLiteral;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.concepts.alternatives.common.Pen;
+import org.apache.webbeans.newtests.concepts.alternatives.common.Pencil;
+import org.apache.webbeans.newtests.concepts.alternatives.common.PencilProducerBean;
+import org.junit.Test;
+
+public class AlternativeOnProducerFieldTest extends AbstractUnitTest
+{
+ private static final String PACKAGE_NAME = AlternativeOnProducerFieldTest.class.getPackage().getName();
+
+ @Test
+ public void testProducerFieldAlternativeNotEnabled()
+ {
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(PencilProducerBean.class);
+ beanClasses.add(Pencil.class);
+
+ startContainer(beanClasses, null);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans(Pencil.class, new AnnotationLiteral<Pen>(){});
+ Assert.assertEquals(0, beans.size());
+
+ Assert.assertNull(getBeanManager().resolve(beans));
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testProducerFieldAlternativeEnabled()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "AlternativeOnProducerFieldTest"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(PencilProducerBean.class);
+ beanClasses.add(Pencil.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans(Pencil.class, new AnnotationLiteral<Pen>(){});
+ Assert.assertEquals(1, beans.size());
+ Pencil pencil = getInstance(Pencil.class, new AnnotationLiteral<Pen>(){});
+ Assert.assertNotNull(pencil);
+ Assert.assertEquals(42, pencil.getNr());
+
+ beans = getBeanManager().getBeans(PencilProducerBean.class);
+ Assert.assertEquals(1, beans.size());
+
+ shutDownContainer();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/tests/AlternativeProducerMethodTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/tests/AlternativeProducerMethodTest.java
new file mode 100644
index 0000000..5d55322
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/tests/AlternativeProducerMethodTest.java
@@ -0,0 +1,117 @@
+/*
+ * 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.webbeans.newtests.concepts.alternatives.tests;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.Collection;
+import javax.enterprise.util.AnnotationLiteral;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.concepts.alternatives.common.AlternativeOnClassAndProducerMethodBean;
+import org.apache.webbeans.newtests.concepts.alternatives.common.AlternativeOnClassOnlyBean;
+import org.apache.webbeans.newtests.concepts.alternatives.common.DefaultBeanProducer;
+import org.apache.webbeans.newtests.concepts.alternatives.common.DefaultBeanProducerWithoutDisposes;
+import org.apache.webbeans.newtests.concepts.alternatives.common.IProducedBean;
+import org.apache.webbeans.newtests.concepts.alternatives.common.QualifierProducerBased;
+import org.junit.Test;
+import org.junit.Ignore;
+
+public class AlternativeProducerMethodTest extends AbstractUnitTest {
+
+ private static final String PACKAGE_NAME = AlternativeProducerMethodTest.class.getPackage().getName();
+
+ @Test
+ public void testNotEnabledAlternativeOnClassOnlyBean()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(DefaultBeanProducer.class);
+
+ // available but not enabled in beans.xml
+ beanClasses.add(AlternativeOnClassOnlyBean.class);
+
+ startContainer(beanClasses, null);
+
+ Annotation[] anns = new Annotation[1];
+ anns[0] = new AnnotationLiteral<QualifierProducerBased>()
+ {
+ };
+
+ IProducedBean model = getInstance(IProducedBean.class, anns);
+ Assert.assertNotNull(model);
+ Assert.assertEquals("default", model.getProducerType());
+
+ shutDownContainer();
+ }
+
+ @Test
+ @Ignore("need to clarify this with the EG")
+ //X TODO It's not yet clear how paragraph 5.1.1 is to be interpreted
+ public void testAlternativeOnClassOnlyBean()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "AlternativeOnClassOnly"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(DefaultBeanProducer.class);
+ beanClasses.add(AlternativeOnClassOnlyBean.class);
+
+ startContainer(beanClasses, null);
+
+ Annotation[] anns = new Annotation[1];
+ anns[0] = new AnnotationLiteral<QualifierProducerBased>()
+ {
+ };
+
+ IProducedBean model = getInstance(IProducedBean.class, anns);
+ Assert.assertNotNull(model);
+ Assert.assertEquals("AlternativeOnClassOnlyBean", model.getProducerType());
+
+ shutDownContainer();
+ }
+
+
+ @Test
+ public void testAlternativeOnClassAndProducerMethodBean()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "AlternativeOnClassAndProducerMethod"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(IProducedBean.class);
+ beanClasses.add(DefaultBeanProducerWithoutDisposes.class);
+
+ // available but not enabled in beans.xml
+ beanClasses.add(AlternativeOnClassAndProducerMethodBean.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ IProducedBean producedBean = getInstance(IProducedBean.class, new AnnotationLiteral<QualifierProducerBased>(){});
+ Assert.assertNotNull(producedBean);
+ Assert.assertEquals("AlternativeOnClassAndProducerMethodBean", producedBean.getProducerType());
+
+ shutDownContainer();
+ }
+
+
+ //X TODO add tests for disposal methods
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/apiTypes/common/ApiTypeBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/apiTypes/common/ApiTypeBean.java
new file mode 100644
index 0000000..df88b2d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/apiTypes/common/ApiTypeBean.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.concepts.apiTypes.common;
+
+import java.io.Serializable;
+import java.util.AbstractMap;
+import java.util.Set;
+
+public class ApiTypeBean extends AbstractMap<String, String> implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public Set<java.util.Map.Entry<String, String>> entrySet()
+ {
+ return null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/initializerMethods/beans/BrokenInitializerMethodBecauseofGeneric.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/initializerMethods/beans/BrokenInitializerMethodBecauseofGeneric.java
new file mode 100644
index 0000000..0966f97
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/initializerMethods/beans/BrokenInitializerMethodBecauseofGeneric.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.newtests.concepts.initializerMethods.beans;
+
+import java.util.ArrayList;
+
+import javax.enterprise.inject.New;
+import javax.inject.Inject;
+
+public class BrokenInitializerMethodBecauseofGeneric
+{
+ @Inject
+ public <T> ArrayList<T> initializer(@New ArrayList<T> list)
+ {
+ return new ArrayList<T>();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/initializerMethods/tests/BrokenInitializerMethodBecauseofGenericTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/initializerMethods/tests/BrokenInitializerMethodBecauseofGenericTest.java
new file mode 100644
index 0000000..adb45ad
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/initializerMethods/tests/BrokenInitializerMethodBecauseofGenericTest.java
@@ -0,0 +1,50 @@
+/*
+ * 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.webbeans.newtests.concepts.initializerMethods.tests;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.concepts.initializerMethods.beans.BrokenInitializerMethodBecauseofGeneric;
+import org.junit.Test;
+
+public class BrokenInitializerMethodBecauseofGenericTest extends AbstractUnitTest
+{
+ @Test(expected=WebBeansConfigurationException.class)
+ public void testBrokenInitializerBecauseofGeneric()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(BrokenInitializerMethodBecauseofGeneric.class);
+
+ try
+ {
+ startContainer(beanClasses, beanXmls);
+ }
+ finally
+ {
+ shutDownContainer();
+ }
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/stereotypes/MyStereoType1.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/stereotypes/MyStereoType1.java
new file mode 100644
index 0000000..8a69f26
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/stereotypes/MyStereoType1.java
@@ -0,0 +1,39 @@
+/*
+ * 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.webbeans.newtests.concepts.stereotypes;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.Stereotype;
+
+import org.apache.webbeans.test.annotation.binding.AnnotationWithBindingMember;
+
+@Target(value = ElementType.TYPE)
+@Retention(value = RetentionPolicy.RUNTIME)
+@Documented
+@Stereotype
+@AnnotationWithBindingMember
+public @interface MyStereoType1
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/stereotypes/MyStereoType2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/stereotypes/MyStereoType2.java
new file mode 100644
index 0000000..fc9c850
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/stereotypes/MyStereoType2.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.newtests.concepts.stereotypes;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.Stereotype;
+import javax.enterprise.inject.Typed;
+
+@Target(value = ElementType.TYPE)
+@Retention(value = RetentionPolicy.RUNTIME)
+@Documented
+@Stereotype
+@Typed
+public @interface MyStereoType2
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/stereotypes/WarningStereotypeTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/stereotypes/WarningStereotypeTest.java
new file mode 100644
index 0000000..46026d2
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/stereotypes/WarningStereotypeTest.java
@@ -0,0 +1,43 @@
+/*
+ * 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.webbeans.newtests.concepts.stereotypes;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Test;
+
+public class WarningStereotypeTest extends AbstractUnitTest
+{
+ @Test
+ public void testWarning()
+ {
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(MyStereoType1.class);
+ classes.add(MyStereoType2.class);
+
+ Collection<String> xmls = new ArrayList<String>();
+
+ startContainer(classes,xmls);
+
+ shutDownContainer();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/typeliterals/Animal.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/typeliterals/Animal.java
new file mode 100644
index 0000000..1b551a7
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/typeliterals/Animal.java
@@ -0,0 +1,24 @@
+/*
+* 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.webbeans.newtests.concepts.typeliterals;
+
+public class Animal<T>
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/typeliterals/Cow.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/typeliterals/Cow.java
new file mode 100644
index 0000000..fc6df43
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/typeliterals/Cow.java
@@ -0,0 +1,24 @@
+/*
+* 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.webbeans.newtests.concepts.typeliterals;
+
+public class Cow
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/typeliterals/MyType.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/typeliterals/MyType.java
new file mode 100644
index 0000000..5c9913b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/typeliterals/MyType.java
@@ -0,0 +1,36 @@
+/*
+* 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.webbeans.newtests.concepts.typeliterals;
+
+import java.lang.reflect.Type;
+
+import javax.enterprise.util.TypeLiteral;
+
+public class MyType<F extends Cow>
+{
+ public TypeLiteral<Animal<F>> ANIMAL = new TypeLiteral<Animal<F>>()
+ {
+
+ };
+
+ public Type getType()
+ {
+ return ANIMAL.getType();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/typeliterals/TypeLiteralTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/typeliterals/TypeLiteralTest.java
new file mode 100644
index 0000000..3e61f18
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/typeliterals/TypeLiteralTest.java
@@ -0,0 +1,38 @@
+/*
+* 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.webbeans.newtests.concepts.typeliterals;
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+
+import org.junit.Test;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+public class TypeLiteralTest extends TestCase
+{
+
+ @Test
+ public void testTypeLiteral()
+ {
+ Type type = new MyType<Cow>().getType();
+ Assert.assertTrue(type instanceof ParameterizedType);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/config/MockPropertyLoader.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/config/MockPropertyLoader.java
new file mode 100644
index 0000000..979baa8
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/config/MockPropertyLoader.java
@@ -0,0 +1,115 @@
+/*
+ * 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.webbeans.newtests.config;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.webbeans.config.PropertyLoader;
+
+/**
+ *
+ * For tesing pruposes. Methods are taken
+ * from {@link PropertyLoader} class.
+ *
+ */
+class MockPropertyLoader
+{
+ /**
+ * Implement a quick and dirty sorting mechanism for the given Properties.
+ * @param allProperties
+ * @return the Properties list sorted by it's 'configuration.ordinal' in ascending order.
+ */
+ static List<Properties> sortProperties(List<Properties> allProperties)
+ {
+ List<Properties> sortedProperties = new ArrayList<Properties>();
+ for (Properties p : allProperties)
+ {
+ int configOrder = getConfigurationOrdinal(p);
+
+ int i;
+ for (i = 0; i < sortedProperties.size(); i++)
+ {
+ int listConfigOrder = getConfigurationOrdinal(sortedProperties.get(i));
+ if (listConfigOrder > configOrder)
+ {
+ // only go as far as we found a higher priority Properties file
+ break;
+ }
+ }
+ sortedProperties.add(i, p);
+ }
+ return sortedProperties;
+ }
+
+ /**
+ * Determine the 'configuration.ordinal' of the given properties.
+ * {@link #CONFIGURATION_ORDINAL_DEFAULT_VALUE} if
+ * {@link #CONFIGURATION_ORDINAL_PROPERTY_NAME} is not set in the
+ * Properties file.
+ *
+ * @param p the Properties from the file.
+ * @return the ordinal number of the given Properties file.
+ */
+ static int getConfigurationOrdinal(Properties p)
+ {
+ int configOrder = PropertyLoader.CONFIGURATION_ORDINAL_DEFAULT_VALUE;
+
+ String configOrderString = p.getProperty(PropertyLoader.CONFIGURATION_ORDINAL_PROPERTY_NAME);
+ if (configOrderString != null && configOrderString.length() > 0)
+ {
+ try
+ {
+ configOrder = Integer.parseInt(configOrderString);
+ }
+ catch(NumberFormatException nfe)
+ {
+ throw nfe;
+ }
+ }
+
+ return configOrder;
+ }
+
+ /**
+ * Merge the given Properties in order of appearance.
+ * @param sortedProperties
+ * @return the merged Properties
+ */
+ static Properties mergeProperties(List<Properties> sortedProperties)
+ {
+ Properties mergedProperties = new Properties();
+ for (Properties p : sortedProperties)
+ {
+ for (Map.Entry<?,?> entry : p.entrySet())
+ {
+ String key = (String) entry.getKey();
+ String value = (String) entry.getValue();
+
+ // simply overwrite the old properties with the new ones.
+ mergedProperties.setProperty(key, value);
+ }
+ }
+
+ return mergedProperties;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/config/PropertyLoaderTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/config/PropertyLoaderTest.java
new file mode 100644
index 0000000..0d9429a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/config/PropertyLoaderTest.java
@@ -0,0 +1,77 @@
+/*
+ * 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.webbeans.newtests.config;
+
+import org.apache.webbeans.config.PropertyLoader;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+public class PropertyLoaderTest
+{
+ private static final String PROPERTY_FILE = "org/apache/webbeans/newtests/config/propertyloadertest.properties";
+ private static final String PROPERTY_FILE2 = "org/apache/webbeans/newtests/config/propertyloadertest2.properties";
+ private static final String PROPERTY_FILE3 = "org/apache/webbeans/newtests/config/propertyloadertest3.properties";
+
+ @Test
+ public void testPropertyLoader() throws Exception
+ {
+ Properties p = PropertyLoader.getProperties(PROPERTY_FILE);
+ Assert.assertNotNull(p);
+
+ String testValue = p.getProperty("testConfig");
+ Assert.assertNotNull(testValue);
+ Assert.assertEquals("testValue", testValue);
+ }
+
+ @Test
+ public void testNonExistentProperties()
+ {
+ Properties p = PropertyLoader.getProperties("notexisting.properties");
+ Assert.assertNull(p);
+ }
+
+ @Test
+ public void testOrdinal()
+ {
+ Properties p15 = PropertyLoader.getProperties(PROPERTY_FILE);
+ Properties p16 = PropertyLoader.getProperties(PROPERTY_FILE2);
+ Properties p20 = PropertyLoader.getProperties(PROPERTY_FILE3);
+
+ List<Properties> properties = new ArrayList<Properties>();
+ properties.add(p15);
+ properties.add(p16);
+ properties.add(p20);
+
+ Properties prop = MockPropertyLoader.mergeProperties(MockPropertyLoader.sortProperties(properties));
+ Assert.assertEquals("testValue16", prop.get("testConfig"));
+ Assert.assertEquals("16", prop.get("test16"));
+ Assert.assertEquals("15", prop.get("test15"));
+ Assert.assertEquals("20", prop.get("configuration.ordinal"));
+ Assert.assertEquals("z", prop.get("override_y"));
+ Assert.assertEquals("20", prop.get("override_all"));
+ Assert.assertEquals("15", prop.get("unique_1"));
+ Assert.assertEquals("16", prop.get("unique_2"));
+ Assert.assertEquals("20", prop.get("unique_3"));
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/contexts/SerializationTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/contexts/SerializationTest.java
new file mode 100644
index 0000000..21da99c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/contexts/SerializationTest.java
@@ -0,0 +1,217 @@
+/*
+* 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.webbeans.newtests.contexts;
+
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.SerializableBean;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.contexts.serialize.AppScopedBean;
+import org.apache.webbeans.newtests.contexts.serialize.SessScopedBean;
+import org.apache.webbeans.newtests.contexts.session.common.PersonalDataBean;
+import org.apache.webbeans.newtests.decorators.multiple.Decorator1;
+import org.apache.webbeans.newtests.decorators.multiple.OutputProvider;
+import org.apache.webbeans.newtests.decorators.multiple.RequestStringBuilder;
+import org.apache.webbeans.newtests.injection.circular.beans.CircularApplicationScopedBean;
+import org.apache.webbeans.newtests.injection.circular.beans.CircularConstructorOrProducerMethodParameterBean;
+import org.apache.webbeans.newtests.injection.circular.beans.CircularDependentScopedBean;
+import org.apache.webbeans.newtests.injection.circular.beans.CircularNormalInConstructor;
+import org.apache.webbeans.proxy.OwbNormalScopeProxy;
+import org.apache.webbeans.test.component.CheckWithCheckPayment;
+import org.apache.webbeans.test.component.CheckWithMoneyPayment;
+import org.apache.webbeans.test.component.IPayment;
+import org.apache.webbeans.test.component.PaymentProcessorComponent;
+import org.apache.webbeans.test.component.event.normal.ComponentWithObserves1;
+import org.apache.webbeans.test.component.event.normal.ComponentWithObserves2;
+import org.apache.webbeans.test.component.event.normal.TransactionalInterceptor;
+import org.apache.webbeans.util.WebBeansUtil;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+
+
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import java.io.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+
+/**
+ * Tests for various serialization issues
+ */
+public class SerializationTest extends AbstractUnitTest
+{
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testCreationalContextSerialization() throws Exception
+ {
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+
+ // add a few random classes
+ classes.add(PersonalDataBean.class);
+ classes.add(CircularDependentScopedBean.class);
+ classes.add(CircularApplicationScopedBean.class);
+ startContainer(classes);
+
+ BeanManager bm = getBeanManager();
+ Set<Bean<?>> beans = getBeanManager().getBeans(PersonalDataBean.class);
+ Assert.assertNotNull(beans);
+ Assert.assertTrue(beans.size() == 1);
+ Bean pdbBean = beans.iterator().next();
+ CreationalContext<PersonalDataBean> pdbCreational = bm.createCreationalContext(pdbBean);
+ Assert.assertNotNull(pdbCreational);
+
+ // oki, now let's serializeBean the CreationalContext
+ byte[] serial = serializeObject(pdbCreational);
+ CreationalContext<?> cc2 = (CreationalContext<?>) deSerializeObject(serial);
+ Assert.assertNotNull(cc2);
+ }
+
+ @Test
+ public void testPersonalDataBean() throws ClassNotFoundException, IOException
+ {
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+
+ // add a few random classes
+ classes.add(PersonalDataBean.class);
+ classes.add(OutputProvider.class);
+ classes.add(Decorator1.class);
+ classes.add(CircularApplicationScopedBean.class);
+ classes.add(CircularDependentScopedBean.class);
+ classes.add(RequestStringBuilder.class);
+ classes.add(CircularConstructorOrProducerMethodParameterBean.class);
+ classes.add(CircularDependentScopedBean.class);
+ classes.add(CircularNormalInConstructor.class);
+ classes.add(TransactionalInterceptor.class);
+ classes.add(ComponentWithObserves1.class);
+ classes.add(ComponentWithObserves2.class);
+ classes.add(PaymentProcessorComponent.class);
+ classes.add(IPayment.class);
+ classes.add(CheckWithCheckPayment.class);
+ classes.add(CheckWithMoneyPayment.class);
+
+ startContainer(classes);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans(Object.class);
+ Assert.assertNotNull(beans);
+ Assert.assertTrue(beans.size() > 7);
+
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ for (Bean<?> bean : beans)
+ {
+ String id = null;
+ if((id = WebBeansUtil.getPassivationId(bean)) != null)
+ {
+ bean = (Bean<?>) webBeansContext.getSerializableBeanVault().getSerializableBean(bean);
+
+ byte[] serial = serializeBean(bean);
+ Bean<?> b2 = deSerializeBean(serial);
+
+ Assert.assertEquals(((SerializableBean<?>)bean).getBean(), ((SerializableBean<?>)b2).getBean());
+
+ }
+ }
+
+ // and now we are keen and try to serialize the whole passivatable Contexts!
+ PersonalDataBean pdb = getInstance(PersonalDataBean.class);
+ pdb.business();
+
+ // first we need to actually create a few instances
+
+ Context sessionContext = webBeansContext.getContextFactory().getStandardContext(SessionScoped.class);
+ Assert.assertNotNull(sessionContext);
+ byte[] ba = serializeObject(sessionContext);
+ Assert.assertNotNull(ba);
+ Context sessContext2 = (Context) deSerializeObject(ba);
+ Assert.assertNotNull(sessContext2);
+ }
+
+ @Test
+ public void testProxySerialization() throws Exception
+ {
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+
+ // add a few random classes
+ classes.add(SessScopedBean.class);
+ classes.add(AppScopedBean.class);
+
+ startContainer(classes);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans(SessScopedBean.class);
+ Assert.assertNotNull(beans);
+ Assert.assertTrue(beans.size() == 1);
+
+ @SuppressWarnings("unchecked")
+ Bean<SessScopedBean> bean = (Bean<SessScopedBean>) beans.iterator().next();
+ CreationalContext<SessScopedBean> ssbCreational = getBeanManager().createCreationalContext(bean);
+ Assert.assertNotNull(ssbCreational);
+
+ SessScopedBean reference = (SessScopedBean) getBeanManager().getReference(bean, SessScopedBean.class, ssbCreational);
+ Assert.assertNotNull(reference);
+ Assert.assertTrue(reference instanceof OwbNormalScopeProxy);
+
+ reference.getApp().setI(4711);
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(reference);
+ byte[] ba = baos.toByteArray();
+
+ ByteArrayInputStream bais = new ByteArrayInputStream(ba);
+ ObjectInputStream ois = new ObjectInputStream(bais);
+ SessScopedBean ssb2 = (SessScopedBean) ois.readObject();
+ Assert.assertNotNull(ssb2);
+
+ Assert.assertNotNull(ssb2.getApp());
+ Assert.assertTrue(ssb2.getApp().getI() == 4711);
+ }
+
+ public static byte[] serializeBean(Bean<?> bean) throws IOException
+ {
+ return serializeObject(bean);
+ }
+
+ public static byte[] serializeObject(Object o) throws IOException
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(o);
+ return baos.toByteArray();
+ }
+
+ public static Bean<?> deSerializeBean(byte[] serial) throws IOException, ClassNotFoundException
+ {
+ return (Bean<?>) deSerializeObject(serial);
+ }
+
+ public static Object deSerializeObject(byte[] serial) throws IOException, ClassNotFoundException
+ {
+ ByteArrayInputStream bais = new ByteArrayInputStream(serial);
+ ObjectInputStream ois = new ObjectInputStream(bais);
+ return ois.readObject();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/contexts/serialize/AppScopedBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/contexts/serialize/AppScopedBean.java
new file mode 100644
index 0000000..d570551
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/contexts/serialize/AppScopedBean.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ package org.apache.webbeans.newtests.contexts.serialize;
+
+import javax.enterprise.context.ApplicationScoped;
+
+@ApplicationScoped
+public class AppScopedBean {
+
+ private int i;
+
+ public int getI() {
+ return i;
+ }
+
+ public void setI(int i) {
+ this.i = i;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/contexts/serialize/SessScopedBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/contexts/serialize/SessScopedBean.java
new file mode 100644
index 0000000..ed6338b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/contexts/serialize/SessScopedBean.java
@@ -0,0 +1,39 @@
+/*
+ * 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.webbeans.newtests.contexts.serialize;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+
+@SessionScoped
+public class SessScopedBean implements Serializable {
+
+ private @Inject AppScopedBean app;
+
+ public AppScopedBean getApp() {
+ return app;
+ }
+
+ public void setApp(AppScopedBean app) {
+ this.app = app;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/contexts/session/common/AppScopedBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/contexts/session/common/AppScopedBean.java
new file mode 100644
index 0000000..54cb799
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/contexts/session/common/AppScopedBean.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.newtests.contexts.session.common;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+
+@ApplicationScoped
+public class AppScopedBean {
+
+ private @Inject PersonalDataBean pdb;
+
+ public PersonalDataBean getPdb() {
+ return pdb;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/contexts/session/common/PersonalDataBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/contexts/session/common/PersonalDataBean.java
new file mode 100644
index 0000000..8a5f9bf
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/contexts/session/common/PersonalDataBean.java
@@ -0,0 +1,76 @@
+/*
+ * 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.webbeans.newtests.contexts.session.common;
+
+import java.io.Serializable;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+
+import org.apache.webbeans.newtests.injection.circular.beans.CircularDependentScopedBean;
+import org.apache.webbeans.test.component.event.normal.Transactional;
+
+@SessionScoped
+public class PersonalDataBean implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ public static boolean POST_CONSTRUCT = false;
+
+ public static boolean PRE_DESTROY = false;
+
+ private @Inject CircularDependentScopedBean dependentInstance;
+
+ public PersonalDataBean()
+ {
+
+ }
+
+ @Transactional
+ public void business(){}
+
+ @PostConstruct
+ public void postConstruct()
+ {
+ POST_CONSTRUCT = true;
+ }
+
+ @PreDestroy
+ public void preDestroy()
+ {
+ PRE_DESTROY = true;
+ }
+
+ public PersonalDataBean getInstance()
+ {
+ return this;
+ }
+
+ public CircularDependentScopedBean getDependentInstance()
+ {
+ return dependentInstance;
+ }
+
+ public void setDependentInstance(CircularDependentScopedBean dependentInstance)
+ {
+ this.dependentInstance = dependentInstance;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/contexts/session/tests/SessionContextTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/contexts/session/tests/SessionContextTest.java
new file mode 100644
index 0000000..d09c124
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/contexts/session/tests/SessionContextTest.java
@@ -0,0 +1,93 @@
+/*
+ * 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.webbeans.newtests.contexts.session.tests;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.enterprise.context.SessionScoped;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.contexts.session.common.AppScopedBean;
+import org.apache.webbeans.newtests.contexts.session.common.PersonalDataBean;
+import org.apache.webbeans.newtests.injection.circular.beans.CircularApplicationScopedBean;
+import org.apache.webbeans.newtests.injection.circular.beans.CircularDependentScopedBean;
+import org.junit.Test;
+
+public class SessionContextTest extends AbstractUnitTest
+{
+ public SessionContextTest()
+ {
+
+ }
+
+ @Test
+ public void testPersonalDataBean()
+ {
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(PersonalDataBean.class);
+ classes.add(CircularDependentScopedBean.class);
+ classes.add(CircularApplicationScopedBean.class);
+
+ startContainer(classes);
+
+ PersonalDataBean.POST_CONSTRUCT = false;
+ PersonalDataBean.PRE_DESTROY = false;
+
+ PersonalDataBean dataBean = getInstance(PersonalDataBean.class);
+ Assert.assertNotNull(dataBean);
+
+ dataBean.business();
+
+ Assert.assertTrue(PersonalDataBean.POST_CONSTRUCT);
+
+ shutDownContainer();
+
+ Assert.assertTrue(PersonalDataBean.PRE_DESTROY);
+ }
+
+ @Test
+ public void testInstanceCreation()
+ {
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(PersonalDataBean.class);
+ classes.add(AppScopedBean.class);
+ classes.add(CircularDependentScopedBean.class);
+ classes.add(CircularApplicationScopedBean.class);
+
+ startContainer(classes);
+
+ AppScopedBean appBeanInstance = getInstance(AppScopedBean.class);
+ Assert.assertNotNull(appBeanInstance);
+ PersonalDataBean pdb1 = appBeanInstance.getPdb().getInstance();
+ Assert.assertNotNull(pdb1);
+
+ // now we reset the session Context so we should get a new contextual instance.
+ getWebBeansContext().getContextsService().endContext(SessionScoped.class, null);
+ getWebBeansContext().getContextsService().startContext(SessionScoped.class, null);
+
+ PersonalDataBean pdb2 = appBeanInstance.getPdb().getInstance();
+ Assert.assertNotNull(pdb2);
+
+ // pdb1 and pdb2 are in different sessions, so they must not be the same instance!
+ Assert.assertTrue(pdb1 != pdb2);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/contexts/threadsafety/LongInitApplicationBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/contexts/threadsafety/LongInitApplicationBean.java
new file mode 100644
index 0000000..4a0ca68
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/contexts/threadsafety/LongInitApplicationBean.java
@@ -0,0 +1,63 @@
+/*
+ * 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.webbeans.newtests.contexts.threadsafety;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
+import java.util.logging.Logger;
+
+/**
+ * This sample bean takes a long time to initialize (sleep for 0.5 second)
+ * Each time this bean gets created it will increase the {@link #initCounter}.
+ */
+@ApplicationScoped
+public class LongInitApplicationBean
+{
+ private static int initCounter = 0;
+
+ private final static Logger log = Logger.getLogger(LongInitApplicationBean.class.getName());
+
+ @PostConstruct
+ public void init()
+ {
+ log.info("starting LongInitApplicationBean");
+
+ initCounter++;
+ try
+ {
+ Thread.sleep(500);
+ }
+ catch (InterruptedException e)
+ {
+ e.printStackTrace();
+ }
+
+ log.info("LongInitApplicationBean initialisation finished");
+ }
+
+ public int getI()
+ {
+ return initCounter;
+ }
+
+ public LongInitApplicationBean getThis()
+ {
+ return this;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/contexts/threadsafety/ThreadSafeBeanInitialisationTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/contexts/threadsafety/ThreadSafeBeanInitialisationTest.java
new file mode 100644
index 0000000..1f9202d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/contexts/threadsafety/ThreadSafeBeanInitialisationTest.java
@@ -0,0 +1,131 @@
+/*
+ * 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.webbeans.newtests.contexts.threadsafety;
+
+import junit.framework.Assert;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.spi.ContextsService;
+import org.junit.Test;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * This test will check if our bean creation mechanism is
+ * thread safe.
+ */
+public class ThreadSafeBeanInitialisationTest extends AbstractUnitTest
+{
+ private final static Logger log = Logger.getLogger(ThreadSafeBeanInitialisationTest.class.getName());
+
+
+ /**
+ * Test our bean creation for thread safety.
+ */
+ @Test
+ public void testBeanCreation() throws Exception
+ {
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+
+ // add a few random classes
+ classes.add(LongInitApplicationBean.class);
+ startContainer(classes);
+
+ BeanManager bm = getBeanManager();
+
+ ParallelBeanStarter bs1 = new ParallelBeanStarter(bm, getWebBeansContext().getContextsService());
+ ParallelBeanStarter bs2 = new ParallelBeanStarter(bm, getWebBeansContext().getContextsService());
+ ParallelBeanStarter bs3 = new ParallelBeanStarter(bm, getWebBeansContext().getContextsService());
+
+ bs1.start();
+ bs2.start();
+ bs3.start();
+
+ bs1.join();
+ bs2.join();
+ bs3.join();
+
+ Assert.assertTrue(bs1.getLongInitBean().getThis() == bs2.getLongInitBean().getThis());
+ Assert.assertTrue(bs1.getLongInitBean().getThis() == bs3.getLongInitBean().getThis());
+
+ Assert.assertFalse(bs1.isFailed());
+ Assert.assertFalse(bs2.isFailed());
+ Assert.assertFalse(bs3.isFailed());
+ }
+
+ private static class ParallelBeanStarter extends Thread
+ {
+ private BeanManager bm;
+
+ private LongInitApplicationBean longInitBean;
+ private ContextsService cs;
+ private boolean failed = true;
+
+ public ParallelBeanStarter(BeanManager bm, ContextsService cs)
+ {
+ this.bm = bm;
+ this.cs = cs;
+ }
+
+ public LongInitApplicationBean getLongInitBean()
+ {
+ return longInitBean;
+ }
+
+ public boolean isFailed()
+ {
+ return failed;
+ }
+
+ @Override
+ public void run()
+ {
+ try
+ {
+ cs.startContext(RequestScoped.class, null);
+
+ Set<Bean<?>> beans = bm.getBeans(LongInitApplicationBean.class);
+ Assert.assertNotNull(beans);
+ Assert.assertTrue(beans.size() == 1);
+ Bean lrBean = beans.iterator().next();
+ CreationalContext<LongInitApplicationBean> lrCreational = bm.createCreationalContext(lrBean);
+ Assert.assertNotNull(lrCreational);
+
+ longInitBean = (LongInitApplicationBean) bm.getReference(lrBean, LongInitApplicationBean.class, lrCreational);
+ int i = longInitBean.getI();
+ Assert.assertEquals(1, i);
+
+ // all ok? then we didn't fail
+ failed = false;
+ }
+ catch(Exception e)
+ {
+ log.log(Level.SEVERE, "ThreadSafeTest", e);
+ Assert.fail();
+ }
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/broken/BrokenAlternative.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/broken/BrokenAlternative.java
new file mode 100644
index 0000000..e40e4e1
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/broken/BrokenAlternative.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.newtests.decorators.broken;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.enterprise.inject.Alternative;
+import javax.inject.Inject;
+
+@Decorator
+@Alternative
+public class BrokenAlternative implements IBroken
+{
+ private @Inject @Delegate IBroken borken;
+
+ @Override
+ public void broke()
+ {
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/broken/BrokenName.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/broken/BrokenName.java
new file mode 100644
index 0000000..61cbf3b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/broken/BrokenName.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.newtests.decorators.broken;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@Decorator
+@Named
+public class BrokenName implements IBroken
+{
+ private @Inject @Delegate IBroken borken;
+
+ @Override
+ public void broke()
+ {
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/broken/BrokenScope.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/broken/BrokenScope.java
new file mode 100644
index 0000000..c209313
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/broken/BrokenScope.java
@@ -0,0 +1,39 @@
+/*
+ * 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.webbeans.newtests.decorators.broken;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+
+
+@Decorator
+@RequestScoped
+public class BrokenScope implements IBroken
+{
+ private @Inject @Delegate IBroken broken;
+
+ @Override
+ public void broke()
+ {
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/broken/FinalMethodDecoratedBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/broken/FinalMethodDecoratedBean.java
new file mode 100644
index 0000000..ba67178
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/broken/FinalMethodDecoratedBean.java
@@ -0,0 +1,31 @@
+/*
+ * 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.webbeans.newtests.decorators.broken;
+
+/**
+ *
+ */
+public class FinalMethodDecoratedBean implements IBroken
+{
+ @Override
+ public final void broke()
+ {
+ System.out.println("this should not get reached at all!");
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/broken/IBroken.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/broken/IBroken.java
new file mode 100644
index 0000000..276066b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/broken/IBroken.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.newtests.decorators.broken;
+
+public interface IBroken
+{
+ public void broke();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/broken/SomeBrokenDecorated.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/broken/SomeBrokenDecorated.java
new file mode 100644
index 0000000..233852f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/broken/SomeBrokenDecorated.java
@@ -0,0 +1,30 @@
+/*
+ * 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.webbeans.newtests.decorators.broken;
+
+public class SomeBrokenDecorated implements IBroken
+{
+
+ @Override
+ public void broke()
+ {
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/broken/ValidDecorator.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/broken/ValidDecorator.java
new file mode 100644
index 0000000..7be0ccf
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/broken/ValidDecorator.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.decorators.broken;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * In this test not the decorator is broken, but the decorated bean is.
+ */
+@Decorator
+public class ValidDecorator implements IBroken
+{
+ @Inject
+ @Delegate
+ private IBroken broken;
+
+ @Override
+ public void broke()
+ {
+ broken.broke();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/common/Animal.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/common/Animal.java
new file mode 100644
index 0000000..ff10d1e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/common/Animal.java
@@ -0,0 +1,36 @@
+/*
+* 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.webbeans.newtests.decorators.common;
+
+public class Animal
+{
+ private String name;
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/common/Breeded.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/common/Breeded.java
new file mode 100644
index 0000000..095f297
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/common/Breeded.java
@@ -0,0 +1,29 @@
+/*
+ * 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.webbeans.newtests.decorators.common;
+
+/**
+ * Breeded animals
+ */
+public interface Breeded
+{
+ int getAge();
+
+ String getFarmer();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/common/ConversationDecorator.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/common/ConversationDecorator.java
new file mode 100644
index 0000000..8aa0248
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/common/ConversationDecorator.java
@@ -0,0 +1,81 @@
+/*
+ * 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.webbeans.newtests.decorators.common;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.enterprise.context.Conversation;
+import javax.inject.Inject;
+
+@Decorator
+public class ConversationDecorator implements Conversation
+{
+ private @Inject @Delegate Conversation conversation;
+
+ public static boolean CALLED = false;
+
+ @Override
+ public void begin()
+ {
+ CALLED = true;
+ }
+
+ @Override
+ public void begin(String id)
+ {
+
+
+ }
+
+ @Override
+ public void end()
+ {
+
+
+ }
+
+ @Override
+ public String getId()
+ {
+
+ return null;
+ }
+
+ @Override
+ public long getTimeout()
+ {
+
+ return 0;
+ }
+
+ @Override
+ public boolean isTransient()
+ {
+
+ return false;
+ }
+
+ @Override
+ public void setTimeout(long milliseconds)
+ {
+
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/common/Cow.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/common/Cow.java
new file mode 100644
index 0000000..4922b4f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/common/Cow.java
@@ -0,0 +1,46 @@
+/*
+* 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.webbeans.newtests.decorators.common;
+
+public class Cow extends Animal implements Breeded
+{
+ private String color;
+
+ @Override
+ public int getAge()
+ {
+ return 7;
+ }
+
+ public String getColor()
+ {
+ return color;
+ }
+
+ public void setColor(String color)
+ {
+ this.color = color;
+ }
+
+ @Override
+ public String getFarmer()
+ {
+ return "Deary Farmer";
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/common/Garphly.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/common/Garphly.java
new file mode 100644
index 0000000..6add8ca
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/common/Garphly.java
@@ -0,0 +1,24 @@
+/*
+* 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.webbeans.newtests.decorators.common;
+
+public class Garphly<T>
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/common/GarphlyDecorator.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/common/GarphlyDecorator.java
new file mode 100644
index 0000000..be022a9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/common/GarphlyDecorator.java
@@ -0,0 +1,31 @@
+/*
+* 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.webbeans.newtests.decorators.common;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+@Decorator
+public class GarphlyDecorator<T extends Animal>
+{
+ private @Inject @Delegate
+ Garphly<T> delegate;
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/dependent/DependentDecorator.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/dependent/DependentDecorator.java
new file mode 100644
index 0000000..dadef56
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/dependent/DependentDecorator.java
@@ -0,0 +1,45 @@
+/*
+ * 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.webbeans.newtests.decorators.dependent;
+
+import javax.annotation.PreDestroy;
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+@Decorator
+public class DependentDecorator implements IDestroy
+{
+ private @Inject @Delegate IDestroy destroy;
+ public static boolean dispose = false;
+
+ @Override
+ public void destroy()
+ {
+ destroy.destroy();
+
+ }
+
+ @PreDestroy
+ public void dispose()
+ {
+ dispose = true;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/dependent/IDestroy.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/dependent/IDestroy.java
new file mode 100644
index 0000000..bf57335
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/dependent/IDestroy.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.newtests.decorators.dependent;
+
+public interface IDestroy
+{
+ public void destroy();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/dependent/MyDestory.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/dependent/MyDestory.java
new file mode 100644
index 0000000..d5016b3
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/dependent/MyDestory.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.decorators.dependent;
+
+import org.apache.webbeans.test.component.event.normal.Transactional;
+
+public class MyDestory implements IDestroy
+{
+ public static boolean destroyed = false;
+
+ @Override
+ @Transactional
+ public void destroy()
+ {
+ destroyed = true;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/generic/DecoratedBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/generic/DecoratedBean.java
new file mode 100644
index 0000000..542e21b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/generic/DecoratedBean.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.newtests.decorators.generic;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Scope;
+
+@ApplicationScoped
+public class DecoratedBean implements GenericInterface<Scope>
+{
+
+ @Override
+ public boolean isDecoratorCalled()
+ {
+ return false;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/generic/GenericInterface.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/generic/GenericInterface.java
new file mode 100644
index 0000000..f439c2c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/generic/GenericInterface.java
@@ -0,0 +1,27 @@
+/*
+ * 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.webbeans.newtests.decorators.generic;
+
+import java.lang.annotation.Annotation;
+
+public interface GenericInterface<A extends Annotation>
+{
+ boolean isDecoratorCalled();
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/generic/SampleDecorator.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/generic/SampleDecorator.java
new file mode 100644
index 0000000..dc4dd5c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/generic/SampleDecorator.java
@@ -0,0 +1,45 @@
+/*
+ * 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.webbeans.newtests.decorators.generic;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.enterprise.inject.Any;
+import javax.inject.Inject;
+import java.lang.annotation.Annotation;
+
+@Decorator
+public class SampleDecorator<T extends Annotation> implements GenericInterface<T>
+{
+
+ @Inject
+ @Any
+ @Delegate
+ private GenericInterface<T> delegate;
+
+ @Override
+ public boolean isDecoratorCalled()
+ {
+ if (delegate.isDecoratorCalled())
+ {
+ throw new IllegalStateException();
+ }
+ return true;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/Decorator1.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/Decorator1.java
new file mode 100644
index 0000000..5106c22
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/Decorator1.java
@@ -0,0 +1,61 @@
+/*
+ * 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.webbeans.newtests.decorators.multiple;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+@Decorator
+public class Decorator1 implements IOutputProvider
+{
+
+ @Inject @Delegate IOutputProvider op;
+
+ @Inject RequestStringBuilder rsb;
+
+ public void init()
+ {
+ System.out.println("decorator created!");
+ }
+
+ @Override
+ public String getOutput()
+ {
+ rsb.addOutput("Decorator1\n");
+ return op.getOutput();
+ }
+
+ @Override
+ public String trace()
+ {
+ return "Decorator1/trace," + op.trace();
+ }
+ @Override
+ public String otherMethod()
+ {
+ return "Decorator1/otherMethod," + op.otherMethod();
+ }
+
+ @Override
+ public String getDelayedOutput() throws InterruptedException
+ {
+ return op.getDelayedOutput();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/Decorator2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/Decorator2.java
new file mode 100644
index 0000000..c803856
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/Decorator2.java
@@ -0,0 +1,59 @@
+/*
+ * 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.webbeans.newtests.decorators.multiple;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Default;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@Decorator
+public class Decorator2 implements IOutputProvider
+{
+ @Inject @Delegate @Default @Any @Named IOutputProvider op;
+ @Inject @Default RequestStringBuilder rsb;
+
+ @Override
+ public String getOutput()
+ {
+ rsb.addOutput("Decorator2\n");
+ return op.getOutput();
+ }
+
+ // change biz method
+ @Override
+ public String trace()
+ {
+ return "Decorator2/trace," + op.otherMethod();
+ }
+
+ @Override
+ public String otherMethod()
+ {
+ return "Decorator2/otherMethod," + op.otherMethod();
+ }
+
+ @Override
+ public String getDelayedOutput() throws InterruptedException
+ {
+ return op.getDelayedOutput();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/Decorator3.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/Decorator3.java
new file mode 100644
index 0000000..e182a57
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/Decorator3.java
@@ -0,0 +1,41 @@
+/*
+ * 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.webbeans.newtests.decorators.multiple;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Default;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+
+@Decorator
+public abstract class Decorator3 implements IOutputProvider
+{
+ @Inject @Delegate @Default @Any @Named IOutputProvider op;
+ @Inject @Default RequestStringBuilder rsb;
+
+ @Override
+ public String getOutput()
+ {
+ rsb.addOutput("Decorator3\n");
+ return op.getOutput();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/Decorator4.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/Decorator4.java
new file mode 100644
index 0000000..ca3a230
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/Decorator4.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.decorators.multiple;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Default;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+
+@Decorator
+public abstract class Decorator4 implements IOutputProvider
+{
+ @Inject @Delegate @Default @Any @Named IOutputProvider op;
+ @Inject @Default RequestStringBuilder rsb;
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/IOutputProvider.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/IOutputProvider.java
new file mode 100644
index 0000000..1f98609
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/IOutputProvider.java
@@ -0,0 +1,29 @@
+/*
+ * 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.webbeans.newtests.decorators.multiple;
+
+public interface IOutputProvider
+{
+
+ public String getOutput();
+ public String trace();
+ public String otherMethod();
+
+ public String getDelayedOutput() throws InterruptedException;
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/MultipleCallDecorator.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/MultipleCallDecorator.java
new file mode 100644
index 0000000..6464331
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/MultipleCallDecorator.java
@@ -0,0 +1,51 @@
+/*
+ * 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.webbeans.newtests.decorators.multiple;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+@Decorator
+public class MultipleCallDecorator implements IOutputProvider {
+
+ @Inject
+ @Delegate
+ IOutputProvider op;
+
+ @Override
+ public String getOutput() {
+ return null;
+ }
+
+ @Override
+ public String trace() {
+ return op.trace() + op.toString() + op.hashCode() + op.trace();
+ }
+
+ @Override
+ public String otherMethod() {
+ return null;
+ }
+
+ @Override
+ public String getDelayedOutput() throws InterruptedException {
+ return null;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/MyIntercept.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/MyIntercept.java
new file mode 100644
index 0000000..c955403
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/MyIntercept.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.decorators.multiple;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.interceptor.InterceptorBinding;
+
+@Inherited
+@InterceptorBinding
+@Target({ElementType.TYPE, ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface MyIntercept {}
+
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/OutputInterceptor.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/OutputInterceptor.java
new file mode 100644
index 0000000..335443e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/OutputInterceptor.java
@@ -0,0 +1,42 @@
+/*
+ * 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.webbeans.newtests.decorators.multiple;
+
+import javax.inject.Inject;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+@MyIntercept @Interceptor
+public class OutputInterceptor {
+
+ @Inject RequestStringBuilder rb;
+
+ public OutputInterceptor()
+ {
+
+ }
+
+ @AroundInvoke
+ public Object myHook(InvocationContext ctx) throws Exception{
+ rb.addOutput("OutputInterceptor\n");
+ return ctx.proceed();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/OutputProvider.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/OutputProvider.java
new file mode 100644
index 0000000..a491dc9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/OutputProvider.java
@@ -0,0 +1,61 @@
+/*
+ * 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.webbeans.newtests.decorators.multiple;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@ApplicationScoped
+@Named("op")
+public class OutputProvider implements IOutputProvider
+{
+
+ @Inject
+ RequestStringBuilder rsb = null;
+
+ @Override
+ @MyIntercept
+ public String getOutput()
+ {
+ rsb.addOutput("OutputProvider\n");
+ return rsb.toString();
+ }
+
+ @Override
+ public String trace() {
+ return "delegate/trace";
+ }
+
+ @Override
+ public String otherMethod() {
+ return "delegate/otherMethod";
+ }
+
+
+ @Override
+ @MyIntercept
+ public String getDelayedOutput() throws InterruptedException
+ {
+ Thread.sleep(5L);
+ rsb.addOutput("OutputProvider\n");
+ return rsb.toString();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/OutsideBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/OutsideBean.java
new file mode 100644
index 0000000..f3fcff2
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/OutsideBean.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.decorators.multiple;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+
+@ApplicationScoped
+//X @MyIntercept
+public class OutsideBean
+{
+ private @Inject IOutputProvider outputProvider;
+
+ public void doThaStuff() throws Exception
+ {
+ outputProvider.getDelayedOutput();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/RequestStringBuilder.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/RequestStringBuilder.java
new file mode 100644
index 0000000..d434ab0
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/multiple/RequestStringBuilder.java
@@ -0,0 +1,39 @@
+/*
+ * 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.webbeans.newtests.decorators.multiple;
+
+import javax.enterprise.inject.Model;
+
+@Model
+public class RequestStringBuilder
+{
+
+ private StringBuilder sb = new StringBuilder();
+
+ public void addOutput(String s)
+ {
+ sb.append(s);
+ }
+
+ public String toString()
+ {
+ return sb.toString();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/ILog.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/ILog.java
new file mode 100644
index 0000000..339dc4e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/ILog.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.newtests.decorators.simple;
+
+public interface ILog
+{
+ public void log(String logMessage);
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/LogDecorator.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/LogDecorator.java
new file mode 100644
index 0000000..20b9907
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/LogDecorator.java
@@ -0,0 +1,44 @@
+/*
+ * 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.webbeans.newtests.decorators.simple;
+
+import java.io.Serializable;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@Named("org.apache.webbeans.newtests.decorators.simple.LogDecorator")
+@Decorator
+public class LogDecorator implements ILog, Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ public static String MESSAGE = "";
+ private @Inject @Delegate ILog ilog;
+
+ @Override
+ public void log(String logMessage)
+ {
+ MESSAGE = logMessage;
+ ilog.log(logMessage);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/MyLog.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/MyLog.java
new file mode 100644
index 0000000..2ab4c9d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/MyLog.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.newtests.decorators.simple;
+
+import javax.inject.Named;
+
+@Named("org.apache.webbeans.newtests.decorators.simple.MyLog")
+public class MyLog implements ILog
+{
+
+ @Override
+ public void log(String logMessage)
+ {
+ System.out.println(logMessage);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/OtherLog.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/OtherLog.java
new file mode 100644
index 0000000..499f74a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/OtherLog.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.newtests.decorators.simple;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+
+@SessionScoped
+public class OtherLog implements ILog, Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void log(String logMessage)
+ {
+ System.out.println("other :" + logMessage);
+ }
+
+}
+
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/SimpleDecoratorTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/SimpleDecoratorTest.java
new file mode 100644
index 0000000..1c025e9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/SimpleDecoratorTest.java
@@ -0,0 +1,92 @@
+/*
+ * 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.webbeans.newtests.decorators.simple;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Decorator;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class SimpleDecoratorTest extends AbstractUnitTest
+{
+ public static final String PACKAGE_NAME = SimpleDecoratorTest.class.getPackage().getName();
+
+ @Test
+ public void testSimpleDecorator()
+ {
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(LogDecorator.class);
+ classes.add(MyLog.class);
+
+
+ Collection<String> xmls = new ArrayList<String>();
+ xmls.add(getXmlPath(PACKAGE_NAME, "SimpleDecoratorTest"));
+
+ startContainer(classes, xmls);
+
+ Set<Type> types = new LinkedHashSet<Type>();
+ types.add(ILog.class);
+
+ Decorator<?> decorator = getBeanManager().resolveDecorators(types, new Annotation[0]).iterator().next();
+ InjectionPoint injectionPoint = decorator.getInjectionPoints().iterator().next();
+
+ //Check that injection point is delegate
+ Assert.assertTrue(injectionPoint.isDelegate());
+
+ Bean<?> bean = getBeanManager().getBeans("org.apache.webbeans.newtests.decorators.simple.MyLog").iterator().next();
+
+ ILog ilog = (ILog) getBeanManager().getReference(bean, ILog.class, getBeanManager().createCreationalContext(bean));
+ ilog.log("DELEGATE TEST");
+
+ //Check that decorator is called succesfully
+ Assert.assertEquals("DELEGATE TEST", LogDecorator.MESSAGE);
+
+ shutDownContainer();
+ }
+
+ /**
+ * Ensure that if we have multiple beans that can resolve to the @Delegate injection point we don't report an error
+ * even if one of those beans has a passivating scope.
+ */
+ @Test
+ public void testDecorateTwoBeans(){
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(LogDecorator.class);
+ classes.add(MyLog.class);
+ classes.add(OtherLog.class);
+
+
+ Collection<String> xmls = new ArrayList<String>();
+ xmls.add(getXmlPath(PACKAGE_NAME, "SimpleDecoratorTest"));
+
+ startContainer(classes, xmls);
+
+ shutDownContainer();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/AbstractDecoratorTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/AbstractDecoratorTest.java
new file mode 100644
index 0000000..5bf239f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/AbstractDecoratorTest.java
@@ -0,0 +1,89 @@
+/*
+ * 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.webbeans.newtests.decorators.tests;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.decorators.multiple.Decorator1;
+import org.apache.webbeans.newtests.decorators.multiple.Decorator2;
+import org.apache.webbeans.newtests.decorators.multiple.Decorator3;
+import org.apache.webbeans.newtests.decorators.multiple.Decorator4;
+import org.apache.webbeans.newtests.decorators.multiple.IOutputProvider;
+import org.apache.webbeans.newtests.decorators.multiple.OutputProvider;
+import org.apache.webbeans.newtests.decorators.multiple.RequestStringBuilder;
+import org.junit.Test;
+
+public class AbstractDecoratorTest extends AbstractUnitTest
+{
+ public static final String PACKAGE_NAME = MultipleDecoratorStackTests.class.getPackage().getName();
+
+ @Test
+ public void testDecoratorStackWithAbstractAtEnd()
+ {
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(Decorator1.class);
+ classes.add(Decorator2.class);
+
+ //Abstract Decorator with a single method, at the end of the execution order
+ classes.add(Decorator3.class);
+
+ //Abstract Decorator with no methods, in the middle of the execution order
+ classes.add(Decorator4.class);
+
+ classes.add(IOutputProvider.class);
+ classes.add(OutputProvider.class);
+ classes.add(RequestStringBuilder.class);
+
+ Collection<String> xmls = new ArrayList<String>();
+ xmls.add(getXmlPath(PACKAGE_NAME, "AbstractDecoratorTest"));
+
+ startContainer(classes, xmls);
+
+ OutputProvider outputProvider = getInstance(OutputProvider.class);
+ Assert.assertTrue(outputProvider != null);
+
+ String result = outputProvider.getOutput();
+ // Verify that the Decorators were called in order, and in a stack, including the Abstract Decorator 3
+ Assert.assertTrue(result.equalsIgnoreCase("Decorator1\nDecorator2\nDecorator3\nOutputProvider\n"));
+
+ String hijackedStack = outputProvider.trace();
+ // Verify that the a method change in Decorator2 from trace->otherMethod results in the right stack
+ Assert.assertEquals("Decorator1/trace,Decorator2/trace,delegate/otherMethod", hijackedStack);
+ }
+
+ @Test
+ public void testPureAbstractDecorator() throws Exception
+ {
+ addDecorator(Decorator3.class);
+ startContainer(Decorator3.class, IOutputProvider.class, OutputProvider.class, RequestStringBuilder.class);
+
+ OutputProvider outputProvider = getInstance(OutputProvider.class);
+ Assert.assertTrue(outputProvider != null);
+
+ String result = outputProvider.getOutput();
+ Assert.assertEquals("Decorator3\nOutputProvider\n", result);
+
+ String trace = outputProvider.trace();
+ Assert.assertEquals("delegate/trace", trace);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/BrokenDecoratorTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/BrokenDecoratorTest.java
new file mode 100644
index 0000000..108bfb4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/BrokenDecoratorTest.java
@@ -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.webbeans.newtests.decorators.tests;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.decorators.broken.BrokenAlternative;
+import org.apache.webbeans.newtests.decorators.broken.FinalMethodDecoratedBean;
+import org.apache.webbeans.newtests.decorators.broken.SomeBrokenDecorated;
+import org.apache.webbeans.newtests.decorators.broken.BrokenName;
+import org.apache.webbeans.newtests.decorators.broken.BrokenScope;
+import org.apache.webbeans.newtests.decorators.broken.ValidDecorator;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class BrokenDecoratorTest extends AbstractUnitTest
+{
+ public static final String PACKAGE_NAME = BrokenDecoratorTest.class.getPackage().getName();
+
+ @Test
+ public void testWarnings()
+ {
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(SomeBrokenDecorated.class);
+ classes.add(BrokenScope.class);
+ classes.add(BrokenAlternative.class);
+ classes.add(BrokenName.class);
+
+ Collection<String> xmls = new ArrayList<String>();
+ xmls.add(getXmlPath(PACKAGE_NAME, "BrokenDecoratorTest"));
+
+ startContainer(classes, xmls);
+
+
+
+ shutDownContainer();
+ }
+
+ @Test(expected = WebBeansConfigurationException.class)
+ public void testDecoratingFinalMethod() throws Exception
+ {
+ addDecorator(ValidDecorator.class);
+
+ startContainer(FinalMethodDecoratedBean.class);
+
+ Assert.fail("this point should not get reached because we had a final method decorated");
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/ConversationDecoratorTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/ConversationDecoratorTest.java
new file mode 100644
index 0000000..fb0c8f9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/ConversationDecoratorTest.java
@@ -0,0 +1,84 @@
+/*
+ * 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.webbeans.newtests.decorators.tests;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.enterprise.context.Conversation;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.util.AnnotationLiteral;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.decorators.common.ConversationDecorator;
+import org.apache.webbeans.spi.ConversationService;
+import org.junit.Ignore;
+import org.junit.Test;
+
+@Ignore("Should it really be possible to decorate a Conversation?")
+public class ConversationDecoratorTest extends AbstractUnitTest
+{
+ public static final String PACKAGE_NAME = ConversationDecoratorTest.class.getPackage().getName();
+
+ public static class DummyConversationService implements ConversationService
+ {
+
+ @Override
+ public String getConversationId()
+ {
+ return null;
+ }
+
+ @Override
+ public String getConversationSessionId()
+ {
+ return null;
+ }
+
+ }
+
+ @Test
+ public void testConversationDecorator()
+ {
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(ConversationDecorator.class);
+
+ Collection<String> xmls = new ArrayList<String>();
+ xmls.add(getXmlPath(PACKAGE_NAME, "ConversationDecoratorTest"));
+
+ startContainer(classes,xmls);
+
+ Bean<?> bean = getBeanManager().getBeans(Conversation.class , new AnnotationLiteral<Default>(){}).iterator().next();
+ Object instance = getBeanManager().getReference(bean, Conversation.class, getBeanManager().createCreationalContext(bean));
+
+ WebBeansContext.getInstance().getOpenWebBeansConfiguration().setProperty("org.apache.webbeans.spi.ConversationService", DummyConversationService.class.getName());
+
+ Assert.assertTrue(instance instanceof Conversation);
+ Conversation conversation = (Conversation)instance;
+ conversation.begin();
+
+ Assert.assertTrue(ConversationDecorator.CALLED);
+
+ shutDownContainer();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/DecoratorAndInterceptorStackTests.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/DecoratorAndInterceptorStackTests.java
new file mode 100644
index 0000000..9e67a24
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/DecoratorAndInterceptorStackTests.java
@@ -0,0 +1,157 @@
+/*
+ * 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.webbeans.newtests.decorators.tests;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.util.AnnotationLiteral;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.decorators.multiple.Decorator1;
+import org.apache.webbeans.newtests.decorators.multiple.Decorator2;
+import org.apache.webbeans.newtests.decorators.multiple.IOutputProvider;
+import org.apache.webbeans.newtests.decorators.multiple.MyIntercept;
+import org.apache.webbeans.newtests.decorators.multiple.OutputInterceptor;
+import org.apache.webbeans.newtests.decorators.multiple.OutputProvider;
+import org.apache.webbeans.newtests.decorators.multiple.OutsideBean;
+import org.apache.webbeans.newtests.decorators.multiple.RequestStringBuilder;
+import org.junit.Test;
+
+public class DecoratorAndInterceptorStackTests extends AbstractUnitTest
+{
+
+ public static final String PACKAGE_NAME = DecoratorAndInterceptorStackTests.class.getPackage().getName();
+ private static final int NUM_THREADS = 20;
+
+ private static final Logger log = Logger.getLogger(DecoratorAndInterceptorStackTests.class.getName());
+
+ @Test
+ public void testDecoratorStack()
+ {
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(Decorator1.class);
+ classes.add(Decorator2.class);
+ classes.add(IOutputProvider.class);
+ classes.add(OutputProvider.class);
+ classes.add(RequestStringBuilder.class);
+ classes.add(MyIntercept.class);
+ classes.add(OutputInterceptor.class);
+
+ Collection<String> xmls = new ArrayList<String>();
+ xmls.add(getXmlPath(PACKAGE_NAME, "DecoratorAndInterceptorStack"));
+
+ startContainer(classes, xmls);
+
+ Bean<?> bean = getBeanManager().getBeans(OutputProvider.class, new AnnotationLiteral<Default>()
+ {
+ }).iterator().next();
+ Object instance = getBeanManager().getReference(bean, OutputProvider.class, getBeanManager().createCreationalContext(bean));
+
+ OutputProvider outputProvider = (OutputProvider) instance;
+
+ Assert.assertTrue(outputProvider != null);
+
+ String result = outputProvider.getOutput();
+ System.out.println(result);
+ // Verify that the Interceptors and Decorators were called in order, and in a stack.
+ Assert.assertTrue(result.equalsIgnoreCase("OutputInterceptor\nDecorator1\nDecorator2\nOutputProvider\n"));
+ }
+
+
+ @Test
+ public void testParallelInterceptorInvocation() throws Exception
+ {
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(Decorator1.class);
+ classes.add(IOutputProvider.class);
+ classes.add(OutputProvider.class);
+ classes.add(RequestStringBuilder.class);
+ classes.add(MyIntercept.class);
+ classes.add(OutsideBean.class);
+ classes.add(OutputInterceptor.class);
+
+ Collection<String> xmls = new ArrayList<String>();
+ xmls.add(getXmlPath(PACKAGE_NAME, "DecoratorAndInterceptorStack"));
+
+ startContainer(classes, xmls);
+
+ OutsideBean outsideBean = getInstance(OutsideBean.class);
+ Assert.assertNotNull(outsideBean);
+
+ InterceptorTestRunner[] threads = new InterceptorTestRunner[NUM_THREADS];
+ for (int i= 0 ; i < NUM_THREADS; i++)
+ {
+ threads[i] = new InterceptorTestRunner(outsideBean);
+ threads[i].setName("testthread_" + i);
+ threads[i].start();
+ }
+
+ for (int i= 0 ; i < NUM_THREADS; i++)
+ {
+ threads[i].join();
+ Assert.assertFalse(threads[i].isFailed());
+ }
+
+ }
+
+
+ public static class InterceptorTestRunner extends Thread
+ {
+ private OutsideBean outsideBean;
+ private boolean failed = false;
+
+ public InterceptorTestRunner(OutsideBean outsideBean)
+ {
+ this.outsideBean = outsideBean;
+ }
+
+ @Override
+ public void run()
+ {
+ try
+ {
+ // this starts the RequestContext for this very thread
+ WebBeansContext.currentInstance().getContextFactory().initRequestContext(null);
+
+ for (int i=0; i < 10; i++)
+ {
+ outsideBean.doThaStuff();
+ }
+ }
+ catch (Exception e)
+ {
+ log.log(Level.SEVERE, "Error while executing Decorators in parallel!", e);
+ failed = true;
+ }
+ }
+
+ public boolean isFailed()
+ {
+ return failed;
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/DecoratorConfigurationTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/DecoratorConfigurationTest.java
new file mode 100644
index 0000000..b41944d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/DecoratorConfigurationTest.java
@@ -0,0 +1,70 @@
+/*
+ * 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.webbeans.newtests.decorators.tests;
+
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.decorators.multiple.Decorator1;
+import org.apache.webbeans.newtests.decorators.multiple.OutputProvider;
+import org.apache.webbeans.newtests.decorators.multiple.RequestStringBuilder;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+public class DecoratorConfigurationTest extends AbstractUnitTest
+{
+ public static final String PACKAGE_NAME = DecoratorConfigurationTest.class.getPackage().getName();
+
+ @Test(expected = WebBeansConfigurationException.class)
+ public void testMultipleDecoratorsInSameFile()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "SameDecorator_broken"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(Decorator1.class);
+ beanClasses.add(OutputProvider.class);
+
+ startContainer(beanClasses, beanXmls, true);
+ Assert.fail("should have thrown a deployment error");
+ }
+
+ @Test
+ public void testMultipleDecoratorsInMultipleFiles()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "SimpleDecorator_1"));
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "SimpleDecorator_2"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(Decorator1.class);
+ beanClasses.add(OutputProvider.class);
+ beanClasses.add(RequestStringBuilder.class);
+
+ startContainer(beanClasses, beanXmls, true);
+
+ OutputProvider op = getInstance(OutputProvider.class);
+ Assert.assertNotNull(op);
+ op.getOutput();
+
+ }
+}
+
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/DecoratorInheritanceTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/DecoratorInheritanceTest.java
new file mode 100644
index 0000000..bcb0adb
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/DecoratorInheritanceTest.java
@@ -0,0 +1,119 @@
+/*
+ * 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.webbeans.newtests.decorators.tests;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Test;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+import static org.junit.Assert.assertEquals;
+
+// OWB-861
+public class DecoratorInheritanceTest extends AbstractUnitTest
+{
+ @Test
+ public void checkItWorks()
+ {
+ addDecorator(ServiceDecorator.class);
+ startContainer(BaseDecorator.class, BaseModuleDecorator.class, ServiceDecorator.class, TheService.class);
+
+ assertEquals("the decorator", getInstance(TheService.class).name());
+ shutDownContainer();
+ }
+
+ @Test
+ public void checkItWorksWithGenerics()
+ {
+ addDecorator(GServiceDecorator.class);
+ startContainer(GBaseDecorator.class, GBaseModuleDecorator.class, GServiceDecorator.class, TheService.class);
+
+ assertEquals("the decorator 1", getInstance(TheService.class).name());
+ shutDownContainer();
+ }
+
+ public static abstract class BaseDecorator implements AService
+ {
+
+ }
+
+ public static abstract class BaseModuleDecorator extends BaseDecorator
+ {
+
+ }
+
+ @Decorator
+ public static class ServiceDecorator extends BaseModuleDecorator
+ {
+ @Delegate
+ @Inject
+ private AService service;
+
+ @Override
+ public String name()
+ {
+ return service.name() + "decorator";
+ }
+ }
+
+ public static class TheService implements AService
+ {
+ @Override
+ public String name()
+ {
+ return "the ";
+ }
+ }
+
+ public static interface AService
+ {
+ String name();
+ }
+
+ public static abstract class GBaseDecorator<T> implements AService
+ {
+ abstract T generateT();
+ }
+
+ public static abstract class GBaseModuleDecorator<T> extends GBaseDecorator<T>
+ {
+
+ }
+
+ @Decorator
+ public static class GServiceDecorator extends GBaseModuleDecorator<Integer>
+ {
+ @Delegate
+ @Inject
+ private AService service;
+
+ @Override
+ public String name()
+ {
+ return service.name() + "decorator " + generateT();
+ }
+
+ @Override
+ Integer generateT() {
+ return 1;
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/DependentDecoratorDestroyTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/DependentDecoratorDestroyTest.java
new file mode 100644
index 0000000..212b850
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/DependentDecoratorDestroyTest.java
@@ -0,0 +1,72 @@
+/*
+ * 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.webbeans.newtests.decorators.tests;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.util.AnnotationLiteral;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.decorators.dependent.DependentDecorator;
+import org.apache.webbeans.newtests.decorators.dependent.IDestroy;
+import org.apache.webbeans.newtests.decorators.dependent.MyDestory;
+import org.apache.webbeans.test.component.event.normal.TransactionalInterceptor;
+import org.junit.Test;
+
+public class DependentDecoratorDestroyTest extends AbstractUnitTest
+{
+ public static final String PACKAGE_NAME = DependentDecoratorDestroyTest.class.getPackage().getName();
+
+ @Test
+ @SuppressWarnings("unchecked")
+ public void testDecoratorStack()
+ {
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(DependentDecorator.class);
+ classes.add(TransactionalInterceptor.class);
+ classes.add(MyDestory.class);
+
+ Collection<String> xmls = new ArrayList<String>();
+ xmls.add(getXmlPath(PACKAGE_NAME, "DependentDecoratorDestroy"));
+
+ startContainer(classes, xmls);
+
+ @SuppressWarnings("serial")
+ Bean<IDestroy> bean = (Bean<IDestroy>)getBeanManager().getBeans(IDestroy.class, new AnnotationLiteral<Default>(){}).iterator().next();
+ CreationalContext<IDestroy> creationalContext = getBeanManager().createCreationalContext(bean);
+ Object instance = getBeanManager().getReference(bean, IDestroy.class, creationalContext);
+ IDestroy outputProvider = (IDestroy) instance;
+
+ Assert.assertTrue(outputProvider != null);
+ outputProvider.destroy();
+ Assert.assertTrue(MyDestory.destroyed);
+
+ bean.destroy(outputProvider,creationalContext);
+
+ Assert.assertTrue(DependentDecorator.dispose);
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/GenericDecoratorTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/GenericDecoratorTest.java
new file mode 100644
index 0000000..f3d3c6d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/GenericDecoratorTest.java
@@ -0,0 +1,89 @@
+/*
+* 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.webbeans.newtests.decorators.tests;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Decorator;
+import javax.enterprise.util.TypeLiteral;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.decorators.common.Cow;
+import org.apache.webbeans.newtests.decorators.common.Garphly;
+import org.apache.webbeans.newtests.decorators.common.GarphlyDecorator;
+import org.apache.webbeans.newtests.decorators.generic.DecoratedBean;
+import org.apache.webbeans.newtests.decorators.generic.GenericInterface;
+import org.apache.webbeans.newtests.decorators.generic.SampleDecorator;
+import org.junit.Test;
+
+public class GenericDecoratorTest extends AbstractUnitTest
+{
+ public static final String PACKAGE_NAME = GenericDecoratorTest.class.getPackage().getName();
+
+
+ @Test
+ public void testGenericDecorator()
+ {
+
+ TypeLiteral<Garphly<Cow>> GARPHLY_LITERAL = new TypeLiteral<Garphly<Cow>>()
+ {
+ };
+
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(Garphly.class);
+ classes.add(GarphlyDecorator.class);
+
+ Collection<String> xmls = new ArrayList<String>();
+ xmls.add(getXmlPath(PACKAGE_NAME, "GenericDecoratorTest"));
+
+ startContainer(classes,xmls);
+
+ Set<Type> types = new HashSet<Type>();
+ types.add(GARPHLY_LITERAL.getType());
+ List<Decorator<?>> decorators = getBeanManager().resolveDecorators(types, new Annotation[]{});
+
+ Assert.assertTrue(decorators.size() > 0);
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void injection() throws Exception {
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(DecoratedBean.class);
+ classes.add(GenericInterface.class);
+ classes.add(SampleDecorator.class);
+
+ Collection<String> xmls = new ArrayList<String>();
+ xmls.add(getXmlPath(PACKAGE_NAME, "GenericDecoratorTest"));
+
+ startContainer(classes, xmls);
+
+ DecoratedBean decoratedBean = getInstance(DecoratedBean.class);
+ Assert.assertTrue(decoratedBean.isDecoratorCalled());
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/MultipleCallDecoratorTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/MultipleCallDecoratorTest.java
new file mode 100644
index 0000000..a3a79c5
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/MultipleCallDecoratorTest.java
@@ -0,0 +1,65 @@
+/*
+ * 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.webbeans.newtests.decorators.tests;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.decorators.multiple.IOutputProvider;
+import org.apache.webbeans.newtests.decorators.multiple.MultipleCallDecorator;
+import org.apache.webbeans.newtests.decorators.multiple.OutputProvider;
+import org.apache.webbeans.newtests.decorators.multiple.RequestStringBuilder;
+import org.junit.Test;
+
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.util.AnnotationLiteral;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import static org.junit.Assert.assertTrue;
+
+public class MultipleCallDecoratorTest extends AbstractUnitTest
+{
+ public static final String PACKAGE_NAME = MultipleDecoratorStackTests.class.getPackage().getName();
+
+ @Test
+ // this test is just a standard decorator calling a bunch of method
+ // it tests we don't have recusive issues in DelegateHandler
+ public void testDecoratorStackWithAbstractAtEnd()
+ {
+ final Collection<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(MultipleCallDecorator.class);
+ classes.add(IOutputProvider.class);
+ classes.add(OutputProvider.class);
+ classes.add(RequestStringBuilder.class);
+
+ final Collection<String> xmls = new ArrayList<String>();
+ xmls.add(getXmlPath(PACKAGE_NAME, "MultipleCallDecoratorTest"));
+
+ startContainer(classes, xmls);
+
+ final Bean<?> bean = getBeanManager().getBeans(OutputProvider.class, new AnnotationLiteral<Default>()
+ {
+ }).iterator().next();
+
+ final IOutputProvider instance = (IOutputProvider) getBeanManager().getReference(bean, IOutputProvider.class, getBeanManager().createCreationalContext(bean));
+ final String expected = "delegate/traceorg.apache.webbeans.newtests.decorators.multiple.OutputProvider@.*delegate/trace";
+ final String actual = instance.trace();
+ assertTrue("'" + actual + "' doesn't match with '" + expected + "'", actual.matches(expected));
+ }
+}
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/MultipleDecoratorStackTests.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/MultipleDecoratorStackTests.java
new file mode 100644
index 0000000..97eead9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/tests/MultipleDecoratorStackTests.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.decorators.tests;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.util.AnnotationLiteral;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.decorators.multiple.Decorator1;
+import org.apache.webbeans.newtests.decorators.multiple.Decorator2;
+import org.apache.webbeans.newtests.decorators.multiple.IOutputProvider;
+import org.apache.webbeans.newtests.decorators.multiple.OutputProvider;
+import org.apache.webbeans.newtests.decorators.multiple.RequestStringBuilder;
+import org.junit.Test;
+
+public class MultipleDecoratorStackTests extends AbstractUnitTest
+{
+
+ public static final String PACKAGE_NAME = MultipleDecoratorStackTests.class.getPackage().getName();
+
+ @Test
+ public void testDecoratorStack()
+ {
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(Decorator1.class);
+ classes.add(Decorator2.class);
+ classes.add(IOutputProvider.class);
+ classes.add(OutputProvider.class);
+ classes.add(RequestStringBuilder.class);
+
+ Collection<String> xmls = new ArrayList<String>();
+ xmls.add(getXmlPath(PACKAGE_NAME, "MultipleDecoratorStack"));
+
+ startContainer(classes, xmls);
+
+ Bean<?> bean = getBeanManager().getBeans(OutputProvider.class, new AnnotationLiteral<Default>()
+ {
+ }).iterator().next();
+ Object instance = getBeanManager().getReference(bean, OutputProvider.class, getBeanManager().createCreationalContext(bean));
+
+ OutputProvider outputProvider = (OutputProvider) instance;
+
+ Assert.assertTrue(outputProvider != null);
+
+ String result = outputProvider.getOutput();
+ System.out.println(result);
+ // Verify that the Decorators were called in order, and in a stack.
+ Assert.assertTrue(result.equalsIgnoreCase("Decorator1\nDecorator2\nOutputProvider\n"));
+
+ String hijackedStack = outputProvider.trace();
+ // Verify that the a method change in Decorator2 from trace->otherMethod results in the right stack
+ Assert.assertEquals("Decorator1/trace,Decorator2/trace,delegate/otherMethod", hijackedStack);
+
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/definition/proxyable/ProxyableBeanTypeTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/definition/proxyable/ProxyableBeanTypeTest.java
new file mode 100644
index 0000000..f389cf7
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/definition/proxyable/ProxyableBeanTypeTest.java
@@ -0,0 +1,86 @@
+/*
+ * 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.webbeans.newtests.definition.proxyable;
+
+
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.definition.proxyable.beans.*;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * This test checks for various conditions about NormalScope
+ * Bean criteria regarding the ability to proxy those classes.
+ * See CDI-spec 5.4.1. This got changed in CDI-1.1 to also allow
+ * static and private methods to be final.
+ */
+public class ProxyableBeanTypeTest extends AbstractUnitTest
+{
+ @Test
+ public void testBeanWithPrivateFinalMethods()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(BeanWithPrivateFinalMethod.class);
+
+ try
+ {
+ startContainer(beanClasses, null);
+
+ BeanWithPrivateFinalMethod testInstance = getInstance(BeanWithPrivateFinalMethod.class);
+ Assert.assertNotNull(testInstance);
+
+ Assert.assertEquals(42, testInstance.externalMethod());
+ Assert.assertEquals(4711, testInstance.staticMethod());
+ }
+ finally
+ {
+ shutDownContainer();
+ }
+
+ }
+
+ @Test(expected = WebBeansConfigurationException.class)
+ public void testBeanWithPublicFinalMethods()
+ {
+ startContainer(BeanWithPublicFinalMethod.class);
+ }
+
+ @Test(expected = WebBeansConfigurationException.class)
+ public void testSubclassBeanWithPublicFinalMethods()
+ {
+ startContainer(SubClassWithNormalScope.class, BaseClassWithPublicFinalMethod.class);
+ }
+
+ @Test
+ public void testNotInjectedBeanWithoutDefaultCt()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(DependentBeanWithoutDefaultCt.class);
+ beanClasses.add(NonAbstractSubClassBean.class);
+
+ startContainer(beanClasses, beanXmls);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/definition/proxyable/beans/BaseClassWithPublicFinalMethod.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/definition/proxyable/beans/BaseClassWithPublicFinalMethod.java
new file mode 100644
index 0000000..7056d34
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/definition/proxyable/beans/BaseClassWithPublicFinalMethod.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.definition.proxyable.beans;
+
+/**
+ * This class has a public final method and is itself
+ * Dependent scoped. So it won't have any problems getting proxied
+ * itself. The problems arise if you subclass it in a class
+ * with a NormalScope.
+ */
+public class BaseClassWithPublicFinalMethod
+{
+
+ public final int getMeaningOfLife()
+ {
+ return 42;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/definition/proxyable/beans/BeanWithPrivateFinalMethod.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/definition/proxyable/beans/BeanWithPrivateFinalMethod.java
new file mode 100644
index 0000000..1d005e9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/definition/proxyable/beans/BeanWithPrivateFinalMethod.java
@@ -0,0 +1,44 @@
+/*
+ * 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.webbeans.newtests.definition.proxyable.beans;
+
+import javax.enterprise.context.RequestScoped;
+
+/**
+ * This bean has a private final method.
+ * It should be possible to create a proxy for it.
+ */
+@RequestScoped
+public class BeanWithPrivateFinalMethod
+{
+ private final int internalMethod()
+ {
+ return 42;
+ }
+
+ public static int staticMethod()
+ {
+ return 4711;
+ }
+
+ public int externalMethod()
+ {
+ return internalMethod();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/definition/proxyable/beans/BeanWithPublicFinalMethod.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/definition/proxyable/beans/BeanWithPublicFinalMethod.java
new file mode 100644
index 0000000..731514e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/definition/proxyable/beans/BeanWithPublicFinalMethod.java
@@ -0,0 +1,39 @@
+/*
+ * 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.webbeans.newtests.definition.proxyable.beans;
+
+import javax.enterprise.context.RequestScoped;
+
+/**
+ * This bean has a public final method.
+ * It should NOT be possible to create a proxy for it!
+ */
+@RequestScoped
+public class BeanWithPublicFinalMethod
+{
+
+ /**
+ * public final methods must create an Exception because it cannot get proxied.
+ * @return
+ */
+ public final int externalMethod()
+ {
+ return 42;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/definition/proxyable/beans/DependentBeanWithoutDefaultCt.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/definition/proxyable/beans/DependentBeanWithoutDefaultCt.java
new file mode 100644
index 0000000..0949c23
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/definition/proxyable/beans/DependentBeanWithoutDefaultCt.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.newtests.definition.proxyable.beans;
+
+/**
+ * Dependent scoped beans without a default-ct are not a problem if they do not get injected.
+ */
+public abstract class DependentBeanWithoutDefaultCt
+{
+
+ protected DependentBeanWithoutDefaultCt(String someId)
+ {
+ // nothing to do in this test
+ }
+
+ public int getX() {
+ return 42;
+ }
+
+ public abstract int getY();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/definition/proxyable/beans/NonAbstractSubClassBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/definition/proxyable/beans/NonAbstractSubClassBean.java
new file mode 100644
index 0000000..13992a8
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/definition/proxyable/beans/NonAbstractSubClassBean.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.newtests.definition.proxyable.beans;
+
+import javax.enterprise.context.ApplicationScoped;
+
+/**
+ */
+@ApplicationScoped
+public class NonAbstractSubClassBean extends DependentBeanWithoutDefaultCt
+{
+ public NonAbstractSubClassBean() {
+ super("someId");
+ }
+
+ @Override
+ public int getY() {
+ return 43;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/definition/proxyable/beans/SubClassWithNormalScope.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/definition/proxyable/beans/SubClassWithNormalScope.java
new file mode 100644
index 0000000..290872a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/definition/proxyable/beans/SubClassWithNormalScope.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.newtests.definition.proxyable.beans;
+
+
+import javax.enterprise.context.ApplicationScoped;
+
+/**
+ * This class extends the base class which has a public final method.
+ * Thus this very class here cannot be proxied.
+ */
+@ApplicationScoped
+public class SubClassWithNormalScope extends BaseClassWithPublicFinalMethod
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/DependentMethodBeanTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/DependentMethodBeanTest.java
new file mode 100644
index 0000000..e2597c9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/DependentMethodBeanTest.java
@@ -0,0 +1,123 @@
+/*
+ * 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.webbeans.newtests.disposes;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.disposes.beans.AppScopedBean;
+import org.apache.webbeans.newtests.disposes.beans.DependentModelProducer;
+import org.apache.webbeans.newtests.disposes.beans.InjectedIntoBean;
+import org.apache.webbeans.newtests.disposes.beans.IntermediateDependentBean;
+import org.apache.webbeans.newtests.disposes.beans.RequestModelProducer;
+import org.apache.webbeans.newtests.disposes.common.DependentModel;
+import org.apache.webbeans.newtests.disposes.common.RequestModel;
+import org.junit.Test;
+
+public class DependentMethodBeanTest extends AbstractUnitTest
+{
+ @Test
+ @SuppressWarnings("unchecked")
+ public void testDisposerMethod()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(AppScopedBean.class);
+ beanClasses.add(RequestModelProducer.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ Bean<RequestModel> bean = (Bean<RequestModel>)getBeanManager().getBeans("rproduce").iterator().next();
+ CreationalContext<RequestModel> cc = getBeanManager().createCreationalContext(bean);
+ RequestModel model = (RequestModel) getBeanManager().getReference(bean, RequestModel.class, cc);
+ System.out.println(model.getID());
+
+ shutDownContainer();
+
+ Assert.assertTrue(AppScopedBean.OK);
+
+ }
+
+ @Test
+ @SuppressWarnings("unchecked")
+ public void testDisposerMethodWithIntermediateDependent()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(DependentModelProducer.class);
+ beanClasses.add(InjectedIntoBean.class);
+ beanClasses.add(IntermediateDependentBean.class);
+
+ startContainer(beanClasses, beanXmls);
+ Bean<InjectedIntoBean> bean = (Bean<InjectedIntoBean>)getBeanManager().getBeans("injectedIntoBean").iterator().next();
+
+ CreationalContext<InjectedIntoBean> cc = getBeanManager().createCreationalContext(bean);
+
+ InjectedIntoBean model = (InjectedIntoBean) getBeanManager().getReference(bean, InjectedIntoBean.class, cc);
+
+ Assert.assertFalse(model.isBeanNull());
+
+ shutDownContainer();
+
+ //Disposer should only be called once
+ Assert.assertEquals(1, DependentModelProducer.disposerCount);
+ }
+
+ //X @Test temporarily disabled
+ @SuppressWarnings("unchecked")
+ public void testDisposerMethodWithRequestScoped()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(DependentModelProducer.class);
+ beanClasses.add(DependentModel.class);
+ beanClasses.add(RequestModel.class);
+ beanClasses.add(RequestModelProducer.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ RequestModelProducer.producerGotDestroyed = false;
+ DependentModelProducer.producerGotDestroyed = false;
+ DependentModelProducer.disposerCount = 0;
+
+ RequestModel model = getInstance(RequestModel.class);
+
+ Assert.assertEquals(0, model.getID());
+
+ getLifecycle().getContextService().endContext(RequestScoped.class, null);
+
+ Assert.assertFalse(DependentModelProducer.producerGotDestroyed);
+ Assert.assertFalse(RequestModelProducer.producerGotDestroyed);
+
+ shutDownContainer();
+
+ //Disposer should only be called once
+ Assert.assertEquals(1, DependentModelProducer.disposerCount);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/DisposerMethodBeanTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/DisposerMethodBeanTest.java
new file mode 100644
index 0000000..1a2be55
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/DisposerMethodBeanTest.java
@@ -0,0 +1,96 @@
+/*
+ * 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.webbeans.newtests.disposes;
+
+import junit.framework.Assert;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.disposes.beans.DisposeModel;
+import org.apache.webbeans.newtests.disposes.beans.DisposerMethodBean;
+import org.junit.Test;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+
+public class DisposerMethodBeanTest extends AbstractUnitTest
+{
+ @Test
+ @SuppressWarnings("unchecked")
+ public void testDisposerMethod()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(DisposerMethodBean.class);
+
+ startContainer(beanClasses, beanXmls);
+ Bean<DisposeModel> bean = (Bean<DisposeModel>)getBeanManager().getBeans("produce").iterator().next();
+
+ CreationalContext<DisposeModel> cc = getBeanManager().createCreationalContext(bean);
+ DisposeModel model = (DisposeModel) getBeanManager().getReference(bean, DisposeModel.class, cc);
+ bean.destroy(model, cc);
+
+ Assert.assertTrue(DisposerMethodBean.OK);
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void multipleDisposes()
+ {
+ final Collection<String> beanXmls = new ArrayList<String>();
+
+ final Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(MultipleDispose.class);
+
+ startContainer(beanClasses, beanXmls); // we had a regression where we were not starting
+ shutDownContainer();
+ }
+
+ public static class MultipleDispose
+ {
+ @Produces
+ public InputStream is(final InjectionPoint ip)
+ {
+ return null;
+ }
+
+ @Produces
+ public URL url(final InjectionPoint ip)
+ {
+ return null;
+ }
+
+ public void dis(final @Disposes InputStream is)
+ {
+ // no-op
+ }
+
+ public void durl(final @Disposes URL url)
+ {
+ // no-op
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/AppScopedBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/AppScopedBean.java
new file mode 100644
index 0000000..813113f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/AppScopedBean.java
@@ -0,0 +1,63 @@
+/*
+ * 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.webbeans.newtests.disposes.beans;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.New;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+import org.apache.webbeans.newtests.concepts.alternatives.common.Pencil;
+import org.apache.webbeans.newtests.disposes.common.DependentModel;
+import org.apache.webbeans.newtests.disposes.common.HttpHeader;
+
+@ApplicationScoped
+@Named("DependentBean")
+public class AppScopedBean
+{
+ public static boolean OK = false;
+
+ static int index = 0;
+
+ static DependentModel producedModel = null;
+
+ @Produces @Dependent @HttpHeader
+ public static DependentModel dproduce(@New DependentModel model)
+ {
+ model.setValue(true);
+ model.setId(index++);
+ if (producedModel == null) {
+ producedModel = model;
+ }
+ System.out.println("produced DependentModel=" + model);
+ return model;
+ }
+
+
+ public static void ddispose(@Disposes @HttpHeader DependentModel model, @New Pencil pencil)
+ {
+ OK = model.isValue();
+ if (OK) {
+ OK = (model.getId() == producedModel.getId());
+ }
+ System.out.println("disposed DependentModel=" + model + "OK=" + OK);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/DependentModelProducer.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/DependentModelProducer.java
new file mode 100644
index 0000000..deba476
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/DependentModelProducer.java
@@ -0,0 +1,57 @@
+/*
+ * 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.webbeans.newtests.disposes.beans;
+
+import javax.annotation.PreDestroy;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+
+import org.apache.webbeans.newtests.disposes.common.DependentModel;
+import org.apache.webbeans.newtests.disposes.common.HttpHeader;
+
+@ApplicationScoped
+public class DependentModelProducer
+{
+ public static int disposerCount = 0;
+
+ public static boolean producerGotDestroyed = false;
+
+ @Produces @Dependent @HttpHeader
+ public static DependentModel dproduce()
+ {
+ System.out.println("produced DependentModel from DepenentProducer");
+ return new DependentModel();
+ }
+
+
+ public static void ddispose(@Disposes @HttpHeader DependentModel model)
+ {
+ DependentModelProducer.disposerCount++;
+ System.out.println("disposed DependentModel from DependentDisposer");
+ }
+
+ @PreDestroy
+ public void destroyMe()
+ {
+ producerGotDestroyed = true;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/DisposeModel.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/DisposeModel.java
new file mode 100644
index 0000000..228ba26
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/DisposeModel.java
@@ -0,0 +1,42 @@
+/*
+ * 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.webbeans.newtests.disposes.beans;
+
+public class DisposeModel
+{
+ public boolean value = false;
+
+ /**
+ * @return the value
+ */
+ public boolean isValue()
+ {
+ return value;
+ }
+
+ /**
+ * @param value the value to set
+ */
+ public void setValue(boolean value)
+ {
+ this.value = value;
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/DisposerMethodBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/DisposerMethodBean.java
new file mode 100644
index 0000000..7e3d0b5
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/DisposerMethodBean.java
@@ -0,0 +1,47 @@
+/*
+ * 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.webbeans.newtests.disposes.beans;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.New;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+import org.apache.webbeans.newtests.concepts.alternatives.common.Pencil;
+
+@Named("org.apache.webbeans.newtests.disposes.beans.DisposerMethodBean")
+public class DisposerMethodBean
+{
+ public static boolean OK = false;
+
+ @Produces @Dependent @Named
+ public DisposeModel produce(@New DisposeModel model)
+ {
+ model.setValue(true);
+
+ return model;
+ }
+
+
+ public void dispose(@Disposes DisposeModel model, @New Pencil pencil)
+ {
+ OK = model.isValue();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/InjectedIntoBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/InjectedIntoBean.java
new file mode 100644
index 0000000..93b00d1
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/InjectedIntoBean.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.disposes.beans;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@Named
+@RequestScoped
+public class InjectedIntoBean
+{
+ private @Inject IntermediateDependentBean bean;
+
+ public boolean isBeanNull(){
+ return bean == null;
+ }
+}
+
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/IntermediateDependentBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/IntermediateDependentBean.java
new file mode 100644
index 0000000..70fa7a7
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/IntermediateDependentBean.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.disposes.beans;
+
+import javax.inject.Inject;
+
+import org.apache.webbeans.newtests.disposes.common.DependentModel;
+import org.apache.webbeans.newtests.disposes.common.HttpHeader;
+
+public class IntermediateDependentBean
+{
+ private @Inject @HttpHeader DependentModel bean;
+
+ public DependentModel getBean()
+ {
+ return bean;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/RequestModelProducer.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/RequestModelProducer.java
new file mode 100644
index 0000000..e63afb8
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/RequestModelProducer.java
@@ -0,0 +1,55 @@
+/*
+ * 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.webbeans.newtests.disposes.beans;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.webbeans.newtests.disposes.common.DependentModel;
+import org.apache.webbeans.newtests.disposes.common.HttpHeader;
+import org.apache.webbeans.newtests.disposes.common.RequestModel;
+
+@ApplicationScoped
+@Named("org.apache.webbeans.newtests.disposes.beans.RequestBean")
+public class RequestModelProducer {
+
+ @Inject @HttpHeader
+ private DependentModel dependentModel;
+
+ public static boolean producerGotDestroyed = false;
+
+ @Produces @RequestScoped @Named("rproduce")
+ public RequestModel rproduce()
+ {
+ RequestModel rmodel = new RequestModel();
+ rmodel.setDisposeModel(dependentModel);
+
+ System.out.println("produced RequestModel=" + rmodel);
+ return rmodel;
+ }
+
+ public void rdispose(@Disposes RequestModel rmodel)
+ {
+ producerGotDestroyed = true;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/common/DependentModel.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/common/DependentModel.java
new file mode 100644
index 0000000..448be0a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/common/DependentModel.java
@@ -0,0 +1,54 @@
+/*
+ * 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.webbeans.newtests.disposes.common;
+
+public class DependentModel
+{
+ public boolean value = false;
+
+ public int id = 0;
+
+ public DependentModel() {
+ System.out.println(this.getClass().getSimpleName() + ".DependentModel() is constructed");
+ }
+ /**
+ * @return the value
+ */
+ public boolean isValue()
+ {
+ return value;
+ }
+
+ /**
+ * @param value the value to set
+ */
+ public void setValue(boolean value)
+ {
+ this.value = value;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/common/HttpHeader.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/common/HttpHeader.java
new file mode 100644
index 0000000..73387aa
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/common/HttpHeader.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.disposes.common;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@Qualifier
+public @interface HttpHeader
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/common/RequestModel.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/common/RequestModel.java
new file mode 100644
index 0000000..b19891c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/common/RequestModel.java
@@ -0,0 +1,48 @@
+/*
+ * 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.webbeans.newtests.disposes.common;
+
+import javax.annotation.PreDestroy;
+import javax.enterprise.inject.Typed;
+
+@Typed
+public class RequestModel
+{
+
+ private DependentModel disposeModel;
+
+ public int getID()
+ {
+ return disposeModel.getId();
+ }
+
+ public DependentModel getDisposeModel() {
+ return disposeModel;
+ }
+
+ public void setDisposeModel(DependentModel disposeModel) {
+ this.disposeModel = disposeModel;
+ }
+
+ @PreDestroy
+ public void destroyMe()
+ {
+ System.out.println("RequestModel got destroyed");
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/injectiontarget/ReplaceInjectionTargetTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/injectiontarget/ReplaceInjectionTargetTest.java
new file mode 100644
index 0000000..da32216
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/injectiontarget/ReplaceInjectionTargetTest.java
@@ -0,0 +1,117 @@
+/*
+ * 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.webbeans.newtests.events.injectiontarget;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.enterprise.inject.spi.ProcessInjectionTarget;
+import javax.inject.Inject;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+public class ReplaceInjectionTargetTest extends AbstractUnitTest
+{
+ public static class IJBean {
+ @Inject
+ private InjectedBean injection;
+ }
+
+ public static class InjectedBean {
+
+ }
+
+ public static class MyInjectionTarget implements InjectionTarget<IJBean> {
+ private static boolean injected = false;
+
+ private final InjectionTarget<IJBean> injectionTarget;
+
+ public MyInjectionTarget(InjectionTarget<IJBean> injectionTarget) {
+ this.injectionTarget = injectionTarget;
+ }
+
+ @Override
+ public void inject(IJBean instance, CreationalContext<IJBean> ctx) {
+ injected = true;
+ injectionTarget.inject(instance, ctx);
+ }
+
+ @Override
+ public void postConstruct(IJBean instance) {
+ injectionTarget.postConstruct(instance);
+ }
+
+ @Override
+ public void preDestroy(IJBean instance) {
+ injectionTarget.preDestroy(instance);
+ }
+
+ @Override
+ public IJBean produce(CreationalContext<IJBean> ijBeanCreationalContext) {
+ return injectionTarget.produce(ijBeanCreationalContext);
+ }
+
+ @Override
+ public void dispose(IJBean instance) {
+ injectionTarget.dispose(instance);
+ }
+
+ @Override
+ public Set<InjectionPoint> getInjectionPoints() {
+ return injectionTarget.getInjectionPoints();
+ }
+ }
+
+ public static class InjectionTargetReplacer implements Extension {
+ public void replaceInjectionTarget(@Observes ProcessInjectionTarget<IJBean> event) {
+ event.setInjectionTarget(new MyInjectionTarget(event.getInjectionTarget()));
+ }
+ }
+
+ @Test
+ public void checkCustomWrapperIsUsed() {
+ addExtension(new InjectionTargetReplacer());
+
+ final Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(IJBean.class);
+ beanClasses.add(InjectedBean.class);
+
+ startContainer(beanClasses, null);
+
+ final Set<Bean<?>> beans = getBeanManager().getBeans(IJBean.class);
+ assertNotNull(beans);
+ assertFalse(beans.isEmpty());
+ Bean<?> bean = getBeanManager().resolve(beans);
+ CreationalContext<?> cc = getBeanManager().createCreationalContext(bean);
+ assertNotNull(getBeanManager().getReference(beans.iterator().next(), IJBean.class, cc));
+ assertTrue(MyInjectionTarget.injected);
+
+ shutDownContainer();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/BeanA.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/BeanA.java
new file mode 100644
index 0000000..d08d263
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/BeanA.java
@@ -0,0 +1,42 @@
+/*
+ * 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.webbeans.newtests.events.observer;
+
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+
+@ApplicationScoped
+public class BeanA extends Superclass
+{
+
+ public static void observeTestEvent(@Observes StaticTestEvent testEvent) {
+ testEvent.addInvocation(BeanA.class.getSimpleName());
+ }
+
+ private void observeTestEvent(@Observes PrivateTestEvent testEvent) {
+ testEvent.addInvocation(getBeanName());
+ }
+
+ @Override
+ protected void observeTestEvent(@Observes TestEvent testEvent)
+ {
+ testEvent.addInvocation(getBeanName());
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/BeanB.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/BeanB.java
new file mode 100644
index 0000000..04d9944
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/BeanB.java
@@ -0,0 +1,44 @@
+/*
+ * 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.webbeans.newtests.events.observer;
+
+
+import java.io.Serializable;
+
+import javax.enterprise.context.ApplicationScoped;
+
+@ApplicationScoped
+public class BeanB extends Superclass implements Serializable
+{
+ private static final long serialVersionUID = 821164664338581947L;
+
+ public static void observeTestEvent(StaticTestEvent testEvent) {
+ testEvent.addInvocation(BeanB.class.getSimpleName());
+ }
+
+ private void observeTestEvent(PrivateTestEvent testEvent) {
+ testEvent.addInvocation(getBeanName());
+ }
+
+ @Override
+ protected void observeTestEvent(TestEvent testEvent)
+ {
+ testEvent.addInvocation(getBeanName());
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/EventTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/EventTest.java
new file mode 100644
index 0000000..cfbf9a3
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/EventTest.java
@@ -0,0 +1,153 @@
+/*
+ * 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.webbeans.newtests.events.observer;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class EventTest extends AbstractUnitTest {
+
+ @Test
+ public void multipleObserverMethodsWithSameName()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(Painter.class);
+ startContainer(beanClasses, null);
+
+ final Orange orange = new Orange();
+ getBeanManager().fireEvent(orange);
+
+ final Green green = new Green();
+ getBeanManager().fireEvent(green);
+
+ final Painter painter = getInstance(Painter.class);
+ Assert.assertEquals(2, painter.getObserved().size());
+ Assert.assertSame(orange, painter.getObserved().get(0));
+ Assert.assertSame(green, painter.getObserved().get(1));
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testOverriddenObserverMethodsInSubclasses()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(Superclass.class);
+ beanClasses.add(BeanA.class);
+ startContainer(beanClasses, null);
+
+ TestEvent testEvent = new TestEvent();
+ getBeanManager().fireEvent(testEvent);
+
+ Assert.assertEquals(1, testEvent.getCalledObservers().size());
+ Assert.assertTrue(testEvent.getCalledObservers().iterator().next().equals("BeanA"));
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testSubclassRemovesObserverAnnotationByOverriding()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(Superclass.class);
+ beanClasses.add(BeanB.class);
+ startContainer(beanClasses, null);
+
+ TestEvent testEvent = new TestEvent();
+ getBeanManager().fireEvent(testEvent);
+
+ Assert.assertEquals(0, testEvent.getCalledObservers().size());
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testObserverOnPrivateMethod() {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(Superclass.class);
+ beanClasses.add(BeanA.class);
+ startContainer(beanClasses, null);
+
+ PrivateTestEvent testEvent = new PrivateTestEvent();
+ getBeanManager().fireEvent(testEvent);
+
+ Assert.assertEquals(2, testEvent.getCalledObservers().size());
+ Assert.assertTrue(testEvent.getCalledObservers().contains("BeanA"));
+ Assert.assertTrue(testEvent.getCalledObservers().contains("BeanA[Superclass]"));
+
+ shutDownContainer();
+
+ }
+
+ @Test
+ public void testPrivateMethodCannotBeOverridden() {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(Superclass.class);
+ beanClasses.add(BeanB.class);
+ startContainer(beanClasses, null);
+
+ PrivateTestEvent testEvent = new PrivateTestEvent();
+ getBeanManager().fireEvent(testEvent);
+
+ Assert.assertEquals(1, testEvent.getCalledObservers().size());
+ Assert.assertEquals("BeanB[Superclass]", testEvent.getCalledObservers().iterator().next());
+
+ shutDownContainer();
+
+ }
+
+ @Test
+ public void testObserverOnStaticMethod() {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(Superclass.class);
+ beanClasses.add(BeanA.class);
+ startContainer(beanClasses, null);
+
+ StaticTestEvent testEvent = new StaticTestEvent();
+ getBeanManager().fireEvent(testEvent);
+
+ Assert.assertEquals(2, testEvent.getCalledObservers().size());
+ Assert.assertTrue(testEvent.getCalledObservers().contains("BeanA"));
+ Assert.assertTrue(testEvent.getCalledObservers().contains("Superclass"));
+
+ shutDownContainer();
+
+ }
+
+ @Test
+ public void testStaticMethodCannotBeOverridden() {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(Superclass.class);
+ beanClasses.add(BeanB.class);
+ startContainer(beanClasses, null);
+
+ StaticTestEvent testEvent = new StaticTestEvent();
+ getBeanManager().fireEvent(testEvent);
+
+ Assert.assertEquals(1, testEvent.getCalledObservers().size());
+ Assert.assertEquals("Superclass", testEvent.getCalledObservers().iterator().next());
+
+ shutDownContainer();
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/Green.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/Green.java
new file mode 100644
index 0000000..bef23d3
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/Green.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.events.observer;
+
+public class Green {
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/Orange.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/Orange.java
new file mode 100644
index 0000000..7d3ffed
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/Orange.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.events.observer;
+
+public class Orange {
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/Painter.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/Painter.java
new file mode 100644
index 0000000..8025a61
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/Painter.java
@@ -0,0 +1,44 @@
+/*
+ * 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.webbeans.newtests.events.observer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+
+@ApplicationScoped
+public class Painter {
+
+ private List<Object> observed = new ArrayList<Object>();
+
+ public void observe(@Observes Orange orange) {
+ observed.add(orange);
+ }
+
+ public void observe(@Observes Green green) {
+ observed.add(green);
+ }
+
+ public List<Object> getObserved() {
+ return observed;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/PrivateTestEvent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/PrivateTestEvent.java
new file mode 100644
index 0000000..14d6d9a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/PrivateTestEvent.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.newtests.events.observer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PrivateTestEvent
+{
+ private List<String> calledObserverNames = new ArrayList<String>();
+
+ public void addInvocation(String observerName)
+ {
+ this.calledObserverNames.add(observerName);
+ }
+
+ public List<String> getCalledObservers()
+ {
+ return calledObserverNames;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/StaticTestEvent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/StaticTestEvent.java
new file mode 100644
index 0000000..2e417bc
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/StaticTestEvent.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.newtests.events.observer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class StaticTestEvent
+{
+ private List<String> calledObserverNames = new ArrayList<String>();
+
+ public void addInvocation(String observerName)
+ {
+ this.calledObserverNames.add(observerName);
+ }
+
+ public List<String> getCalledObservers()
+ {
+ return calledObserverNames;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/Superclass.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/Superclass.java
new file mode 100644
index 0000000..8f8656b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/Superclass.java
@@ -0,0 +1,43 @@
+/*
+ * 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.webbeans.newtests.events.observer;
+
+import javax.enterprise.event.Observes;
+
+public abstract class Superclass
+{
+
+ public static void observeTestEvent(@Observes StaticTestEvent testEvent) {
+ testEvent.addInvocation(Superclass.class.getSimpleName());
+ }
+
+ private void observeTestEvent(@Observes PrivateTestEvent testEvent) {
+ testEvent.addInvocation(getBeanName() + "[" + Superclass.class.getSimpleName() + "]");
+ }
+
+ protected void observeTestEvent(@Observes TestEvent testEvent)
+ {
+ testEvent.addInvocation(getBeanName());
+ }
+
+ public String getBeanName()
+ {
+ return getClass().getSimpleName();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/TestEvent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/TestEvent.java
new file mode 100644
index 0000000..577a136
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/TestEvent.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.newtests.events.observer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class TestEvent
+{
+ private List<String> calledObserverNames = new ArrayList<String>();
+
+ public void addInvocation(String observerName)
+ {
+ this.calledObserverNames.add(observerName);
+ }
+
+ public List<String> getCalledObservers()
+ {
+ return calledObserverNames;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/beans/CircularApplicationScopedBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/beans/CircularApplicationScopedBean.java
new file mode 100644
index 0000000..7f38d5a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/beans/CircularApplicationScopedBean.java
@@ -0,0 +1,49 @@
+/*
+ * 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.webbeans.newtests.injection.circular.beans;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+
+@ApplicationScoped
+public class CircularApplicationScopedBean
+{
+ private @Inject
+ CircularDependentScopedBean dependent;
+
+ public static boolean success = false;
+
+ public void hello()
+ {
+ // nothing to do
+ }
+
+ public void callDependent()
+ {
+ dependent.hello();
+ }
+
+ @PostConstruct
+ public void postConstruct()
+ {
+ success = true;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/beans/CircularConstructorOrProducerMethodParameterBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/beans/CircularConstructorOrProducerMethodParameterBean.java
new file mode 100644
index 0000000..d9c8e20
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/beans/CircularConstructorOrProducerMethodParameterBean.java
@@ -0,0 +1,43 @@
+/*
+ * 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.webbeans.newtests.injection.circular.beans;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@RequestScoped
+@Named("org.apache.webbeans.newtests.injection.circular.beans.CircularConstructorOrProducerMethodParameterBean")
+public class CircularConstructorOrProducerMethodParameterBean
+{
+ private boolean SAY_HELLO = false;
+
+ private @Inject CircularNormalInConstructor A;
+
+ public void sayHello()
+ {
+ SAY_HELLO = true;
+ }
+
+ public boolean getSAYHELLO()
+ {
+ A.sayHello();
+ return this.SAY_HELLO;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/beans/CircularDependentScopedBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/beans/CircularDependentScopedBean.java
new file mode 100644
index 0000000..5318357
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/beans/CircularDependentScopedBean.java
@@ -0,0 +1,57 @@
+/*
+ * 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.webbeans.newtests.injection.circular.beans;
+
+import java.io.Serializable;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.Dependent;
+import javax.inject.Inject;
+
+import org.apache.webbeans.test.component.event.normal.Transactional;
+
+@Dependent
+public class CircularDependentScopedBean implements Serializable
+{
+ @Inject CircularApplicationScopedBean app;
+
+ public static boolean success = false;
+
+
+ @Transactional
+ public void hello()
+ {
+ // do nothing
+ }
+
+ public void callAppScoped()
+ {
+ app.hello();
+ }
+
+
+ @PostConstruct
+ public void postConstruct()
+ {
+ // removed! This is not allowed in JSR-299 according to mbg because it causes a
+ // cyclic reference in the creation of the beans!
+ // app.hello();
+ success = true;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/beans/CircularNormalInConstructor.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/beans/CircularNormalInConstructor.java
new file mode 100644
index 0000000..1cc4881
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/beans/CircularNormalInConstructor.java
@@ -0,0 +1,56 @@
+/*
+ * 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.webbeans.newtests.injection.circular.beans;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@RequestScoped
+@Named("org.apache.webbeans.newtests.injection.circular.beans.CircularNormalInConstructor")
+public class CircularNormalInConstructor
+{
+ CircularConstructorOrProducerMethodParameterBean B;
+
+ private boolean SAY_HELLO = false;
+
+ public CircularNormalInConstructor()
+ {
+
+ }
+
+ @Inject
+ public CircularNormalInConstructor(CircularConstructorOrProducerMethodParameterBean B)
+ {
+ this.B = B;
+ }
+
+ public void sayHello()
+ {
+ SAY_HELLO = true;
+
+ B.sayHello();
+ }
+
+ public boolean getSAYHELLO()
+ {
+ return this.SAY_HELLO;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/tests/CircularInjectionIntoConstructorTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/tests/CircularInjectionIntoConstructorTest.java
new file mode 100644
index 0000000..8aa59ed
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/tests/CircularInjectionIntoConstructorTest.java
@@ -0,0 +1,92 @@
+/*
+ * 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.webbeans.newtests.injection.circular.tests;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.injection.circular.beans.CircularConstructorOrProducerMethodParameterBean;
+import org.apache.webbeans.newtests.injection.circular.beans.CircularNormalInConstructor;
+import org.junit.Test;
+
+public class CircularInjectionIntoConstructorTest extends AbstractUnitTest
+{
+ public CircularInjectionIntoConstructorTest()
+ {
+
+ }
+
+ @Test
+ @SuppressWarnings("unchecked")
+ public void testOneNormalOneDependent()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(CircularNormalInConstructor.class);
+ beanClasses.add(CircularConstructorOrProducerMethodParameterBean.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans("org.apache.webbeans.newtests.injection.circular.beans.CircularNormalInConstructor");
+ Assert.assertNotNull(beans);
+
+ Bean<CircularNormalInConstructor> bean = (Bean<CircularNormalInConstructor>)beans.iterator().next();
+ CreationalContext<CircularNormalInConstructor> ctx = getBeanManager().createCreationalContext(bean);
+
+ Object reference = getBeanManager().getReference(bean, CircularNormalInConstructor.class, ctx);
+
+ Assert.assertTrue(reference instanceof CircularNormalInConstructor);
+
+ CircularNormalInConstructor beanInstance = (CircularNormalInConstructor)reference;
+ beanInstance.sayHello();
+
+ beans = getBeanManager().getBeans("org.apache.webbeans.newtests.injection.circular.beans.CircularConstructorOrProducerMethodParameterBean");
+ Assert.assertNotNull(beans);
+ Bean<CircularConstructorOrProducerMethodParameterBean> bean2 = (Bean<CircularConstructorOrProducerMethodParameterBean>)beans.iterator().next();
+
+ CreationalContext<CircularConstructorOrProducerMethodParameterBean> ctx2 = getBeanManager().createCreationalContext(bean2);
+
+ reference = getBeanManager().getReference(bean2, CircularConstructorOrProducerMethodParameterBean.class, ctx2);
+
+ Assert.assertTrue(reference instanceof CircularConstructorOrProducerMethodParameterBean);
+
+ CircularConstructorOrProducerMethodParameterBean beanInstance2 = (CircularConstructorOrProducerMethodParameterBean)reference;
+ Assert.assertTrue(beanInstance2.getSAYHELLO());
+
+ reference = getBeanManager().getReference(bean, CircularNormalInConstructor.class, ctx);
+
+ Assert.assertTrue(reference instanceof CircularNormalInConstructor);
+
+ beanInstance = (CircularNormalInConstructor)reference;
+
+ Assert.assertTrue(beanInstance.getSAYHELLO());
+
+ shutDownContainer();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/tests/CircularInjectionTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/tests/CircularInjectionTest.java
new file mode 100644
index 0000000..1bd0f1f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/tests/CircularInjectionTest.java
@@ -0,0 +1,81 @@
+/*
+ * 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.webbeans.newtests.injection.circular.tests;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.injection.circular.beans.CircularApplicationScopedBean;
+import org.apache.webbeans.newtests.injection.circular.beans.CircularDependentScopedBean;
+import org.junit.Test;
+
+public class CircularInjectionTest extends AbstractUnitTest
+{
+ public CircularInjectionTest()
+ {
+
+ }
+
+ @Test
+ @SuppressWarnings("unchecked")
+ public void testOneNormalOneDependent()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(CircularDependentScopedBean.class);
+ beanClasses.add(CircularApplicationScopedBean.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ CircularApplicationScopedBean beanInstance = getInstance(CircularApplicationScopedBean.class);
+ beanInstance.callDependent();
+
+ Assert.assertTrue(CircularDependentScopedBean.success);
+ Assert.assertTrue(CircularApplicationScopedBean.success);
+
+ shutDownContainer();
+ }
+
+ @Test
+ @SuppressWarnings("unchecked")
+ public void testOneDependentOneNormal()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(CircularDependentScopedBean.class);
+ beanClasses.add(CircularApplicationScopedBean.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ CircularDependentScopedBean reference = getInstance(CircularDependentScopedBean.class);
+ Assert.assertTrue(reference instanceof CircularDependentScopedBean);
+
+ reference.callAppScoped();
+
+ Assert.assertTrue(CircularDependentScopedBean.success);
+ Assert.assertTrue(CircularApplicationScopedBean.success);
+
+ shutDownContainer();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/constructor/ConstructorInjectionTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/constructor/ConstructorInjectionTest.java
new file mode 100644
index 0000000..db79a4a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/constructor/ConstructorInjectionTest.java
@@ -0,0 +1,69 @@
+/*
+ * 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.webbeans.newtests.injection.constructor;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.injection.constructor.beans.Administrator;
+import org.apache.webbeans.newtests.injection.constructor.beans.BeanWithSingleParamInjectConstructor;
+import org.apache.webbeans.newtests.injection.constructor.beans.BeanWithTwoParamInjectConstructor;
+import org.apache.webbeans.newtests.injection.constructor.beans.User;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Test @Inject constructors.
+ */
+public class ConstructorInjectionTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testSingleParamCtInjection() throws Exception
+ {
+ startContainer(BeanWithSingleParamInjectConstructor.class, User.class);
+
+ BeanWithSingleParamInjectConstructor instance = getInstance(BeanWithSingleParamInjectConstructor.class);
+ Assert.assertNotNull(instance);
+ Assert.assertNotNull(instance.getUser());
+
+ User user = getInstance(User.class);
+ Assert.assertNotNull(user);
+
+ Assert.assertTrue(user.getSelf() == instance.getUser().getSelf());
+ }
+
+ @Test
+ public void testTwoParamCtInjection() throws Exception
+ {
+ startContainer(BeanWithTwoParamInjectConstructor.class, User.class, Administrator.class);
+
+ BeanWithTwoParamInjectConstructor instance = getInstance(BeanWithTwoParamInjectConstructor.class);
+ Assert.assertNotNull(instance);
+ Assert.assertNotNull(instance.getUser());
+ Assert.assertNotNull(instance.getAdministrator());
+
+ User user = getInstance(User.class);
+ Assert.assertNotNull(user);
+ Assert.assertTrue(user.getSelf() == instance.getUser().getSelf());
+
+ Administrator administrator = getInstance(Administrator.class);
+ Assert.assertNotNull(administrator);
+ Assert.assertTrue(administrator.getSelf() == instance.getAdministrator().getSelf());
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/constructor/beans/Administrator.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/constructor/beans/Administrator.java
new file mode 100644
index 0000000..3c9c385
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/constructor/beans/Administrator.java
@@ -0,0 +1,39 @@
+/*
+ * 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.webbeans.newtests.injection.constructor.beans;
+
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.Typed;
+
+@SessionScoped
+@Typed(Administrator.class)
+public class Administrator extends User
+{
+ private String role;
+
+ public String getRole()
+ {
+ return role;
+ }
+
+ public void setRole(String role)
+ {
+ this.role = role;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/constructor/beans/BeanWithSingleParamInjectConstructor.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/constructor/beans/BeanWithSingleParamInjectConstructor.java
new file mode 100644
index 0000000..b5e7666
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/constructor/beans/BeanWithSingleParamInjectConstructor.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.newtests.injection.constructor.beans;
+
+import javax.inject.Inject;
+
+public class BeanWithSingleParamInjectConstructor
+{
+ private User user;
+
+ @Inject
+ public BeanWithSingleParamInjectConstructor(User user)
+ {
+ this.user = user;
+ }
+
+ public User getUser()
+ {
+ return user;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/constructor/beans/BeanWithTwoParamInjectConstructor.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/constructor/beans/BeanWithTwoParamInjectConstructor.java
new file mode 100644
index 0000000..63c9500
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/constructor/beans/BeanWithTwoParamInjectConstructor.java
@@ -0,0 +1,44 @@
+/*
+ * 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.webbeans.newtests.injection.constructor.beans;
+
+import javax.inject.Inject;
+
+public class BeanWithTwoParamInjectConstructor
+{
+ private User user;
+ private Administrator administrator;
+
+ @Inject
+ public BeanWithTwoParamInjectConstructor(User user, Administrator administrator)
+ {
+ this.user = user;
+ this.administrator = administrator;
+ }
+
+ public User getUser()
+ {
+ return user;
+ }
+
+ public Administrator getAdministrator()
+ {
+ return administrator;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/constructor/beans/User.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/constructor/beans/User.java
new file mode 100644
index 0000000..cdf3c3b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/constructor/beans/User.java
@@ -0,0 +1,46 @@
+/*
+ * 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.webbeans.newtests.injection.constructor.beans;
+
+import javax.enterprise.context.SessionScoped;
+import java.io.Serializable;
+
+/**
+ * Sample User Bean
+ */
+@SessionScoped
+public class User implements Serializable
+{
+ private String name;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public User getSelf()
+ {
+ return this;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/ArrayOuttOfBouncExceptionFromMLTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/ArrayOuttOfBouncExceptionFromMLTest.java
new file mode 100644
index 0000000..9192fef
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/ArrayOuttOfBouncExceptionFromMLTest.java
@@ -0,0 +1,70 @@
+/*
+ * 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.webbeans.newtests.injection.generics;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Test;
+
+import javax.inject.Inject;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+
+import static org.junit.Assert.assertNotNull;
+
+// http://openejb.979440.n4.nabble.com/ArrayIndexOutOfBoundsException-on-TomEE-1-6-0-td4665080.html
+public class ArrayOuttOfBouncExceptionFromMLTest extends AbstractUnitTest
+{
+ @Inject
+ private TwoKeyHashMap<String, Integer, Value> injected;
+
+ @Test
+ public void testGenericBeanInjection()
+ {
+ startContainer(Arrays.<Class<?>>asList(TwoKeyHashMap.class), Collections.<String>emptyList(), true);
+
+ assertNotNull(injected);
+
+ shutDownContainer();
+ }
+
+ public static class TwoKeyHashMap<K1, K2, V extends TwoKeyHashMap.TwoKeyValue<K1, K2>> extends HashMap<K1, V>
+ {
+ public static interface TwoKeyValue<K1, K2>
+ {
+ K1 getKey1();
+ K2 getKey2();
+ }
+ }
+
+ public static class Value implements TwoKeyHashMap.TwoKeyValue<String, Integer>
+ {
+ @Override
+ public String getKey1()
+ {
+ return "1";
+ }
+
+ @Override
+ public Integer getKey2()
+ {
+ return 2;
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/Bar.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/Bar.java
new file mode 100644
index 0000000..c211b84
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/Bar.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.injection.generics;
+
+import java.util.List;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Typed;
+import javax.inject.Inject;
+
+@Typed
+public class Bar<A, B> {
+
+ @Inject
+ //X @GenericQualifier
+ private Baz<A> baz;
+
+ @Inject
+ @GenericQualifier
+ private A a;
+
+ @Inject
+ private Baz<List<B>> bBazList;
+
+ private A[] aArray;
+ private Baz<A> aBazEvent;
+ private A aObserverInjectionPoint;
+
+ @Inject
+ public void setAArray(A[] aArray) {
+ this.aArray = aArray;
+ }
+
+ public void observeBaz(@Observes Baz<A> baz, @GenericQualifier A a) {
+ this.aBazEvent = baz;
+ this.aObserverInjectionPoint = a;
+ }
+
+ public Baz<A> getBaz() {
+ return this.baz;
+ }
+
+ public Baz<List<B>> getBBazList() {
+ return this.bBazList;
+ }
+
+ public A getA() {
+ return this.a;
+ }
+
+ public A[] getAArray() {
+ return this.aArray;
+ }
+
+ public Baz<A> getABazEvent() {
+ return this.aBazEvent;
+ }
+
+ public A getAObserverInjectionPoint() {
+ return this.aObserverInjectionPoint;
+ }
+}
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/BarVetoExtension.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/BarVetoExtension.java
new file mode 100644
index 0000000..7f1dd10
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/BarVetoExtension.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.injection.generics;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+
+public class BarVetoExtension implements Extension {
+
+ public void vetoBar(@Observes ProcessAnnotatedType<?> annotatedTypeEvent)
+ {
+ if (annotatedTypeEvent.getAnnotatedType().getJavaClass().equals(Bar.class))
+ {
+ annotatedTypeEvent.veto();
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/Baz.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/Baz.java
new file mode 100644
index 0000000..11f4072
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/Baz.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.injection.generics;
+
+public class Baz<T> {
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/BazSubclass.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/BazSubclass.java
new file mode 100644
index 0000000..7180785
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/BazSubclass.java
@@ -0,0 +1,27 @@
+/*
+ * 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.webbeans.newtests.injection.generics;
+
+
+public class BazSubclass extends Baz<String> {
+
+ public BazSubclass(String string)
+ {
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/Foo.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/Foo.java
new file mode 100644
index 0000000..0088c0d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/Foo.java
@@ -0,0 +1,25 @@
+/*
+ * 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.webbeans.newtests.injection.generics;
+
+import javax.enterprise.context.RequestScoped;
+
+@RequestScoped
+public class Foo extends Bar<String, BazSubclass> {
+}
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/GenericBeanTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/GenericBeanTest.java
new file mode 100644
index 0000000..dd53ba5
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/GenericBeanTest.java
@@ -0,0 +1,41 @@
+/*
+ * 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.webbeans.newtests.injection.generics;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.test.component.inject.generic.GenericComponent;
+import org.apache.webbeans.test.component.inject.generic.GenericComponentInjector;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class GenericBeanTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testGenericBeanInjection()
+ {
+ startContainer(GenericComponent.class, GenericComponentInjector.class);
+
+ GenericComponentInjector<?> instance = getInstance(GenericComponentInjector.class);
+ Assert.assertNotNull(instance.getInjection1());
+ Assert.assertNotNull(instance.getInjection2());
+ Assert.assertNotNull(instance.getInjection3());
+ Assert.assertNotNull(instance.getInjection4());
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/GenericFactory.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/GenericFactory.java
new file mode 100644
index 0000000..95798b0
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/GenericFactory.java
@@ -0,0 +1,41 @@
+/*
+ * 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.webbeans.newtests.injection.generics;
+
+import java.util.List;
+
+import javax.enterprise.inject.Produces;
+
+public class GenericFactory {
+ @Produces
+ @GenericQualifier
+ public String produceString() {
+ return "a produced String";
+ }
+
+ @Produces
+ public String[] produceStringArray() {
+ return new String[0];
+ }
+
+ @Produces
+ public Baz<List<BazSubclass>> produceBazBazBazSubclass() {
+ return new Baz();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/GenericQualifier.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/GenericQualifier.java
new file mode 100644
index 0000000..dd5d584
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/GenericQualifier.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.newtests.injection.generics;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Target({ TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Qualifier
+public @interface GenericQualifier {
+}
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/GenericsTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/GenericsTest.java
new file mode 100644
index 0000000..241025a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/GenericsTest.java
@@ -0,0 +1,119 @@
+/*
+ * 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.webbeans.newtests.injection.generics;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.ObserverMethod;
+import javax.enterprise.util.TypeLiteral;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Ignore;
+import org.junit.Test;
+
+
+public class GenericsTest extends AbstractUnitTest
+{
+
+ @Test
+ @Ignore("TODO not yet working!")
+ public void injectionPoint() throws Exception
+ {
+ addExtension(new BarVetoExtension());
+ startContainer(Foo.class, Bar.class, Baz.class, BazSubclass.class, GenericFactory.class, GenericQualifier.class);
+
+ Bean<Foo> fooBean = getBean(Foo.class);
+ Set<InjectionPoint> injectionPoints = fooBean.getInjectionPoints();
+
+ assertEquals(4, injectionPoints.size());
+
+ for (InjectionPoint injectionPoint : injectionPoints)
+ {
+ if ("baz".equals(injectionPoint.getMember().getName()))
+ {
+ assertEquals(new TypeLiteral<Baz<String>>() { }.getType(), injectionPoint.getType());
+ }
+ else if ("a".equals(injectionPoint.getMember().getName()))
+ {
+ assertEquals(String.class, injectionPoint.getType());
+ }
+ else if ("bBazList".equals(injectionPoint.getMember().getName()))
+ {
+ assertEquals(new TypeLiteral<Baz<List<BazSubclass>>>() { }.getType(), injectionPoint.getType());
+ }
+ else if ("setAArray".equals(injectionPoint.getMember().getName()))
+ {
+ assertEquals(String[].class, injectionPoint.getType());
+ }
+ else
+ {
+ fail("Unexpected injection point");
+ }
+ }
+ }
+
+ @Test
+ @Ignore("TODO not yet working!")
+ public void testInjected() throws Exception
+ {
+ addExtension(new BarVetoExtension());
+ startContainer(Foo.class, Bar.class, Baz.class, BazSubclass.class, GenericFactory.class, GenericQualifier.class);
+
+ Foo foo = getInstance(Foo.class);
+ assertNotNull(foo);
+ assertNotNull(foo.getBaz());
+ assertNotNull(foo.getAArray());
+ assertNotNull(foo.getBBazList());
+ }
+
+ @Test
+ @Ignore("TODO not yet working!")
+ public void observerResolution() throws Exception
+ {
+ addExtension(new BarVetoExtension());
+ startContainer(Foo.class, Bar.class, Baz.class, BazSubclass.class, GenericFactory.class);
+
+ Set<ObserverMethod<? super BazSubclass>> observerMethods = getBeanManager().resolveObserverMethods(new BazSubclass(null));
+ assertEquals(observerMethods.size(), 1);
+ ObserverMethod<? super Class<BazSubclass>> observerMethod = (ObserverMethod<? super Class<BazSubclass>>)observerMethods.iterator().next();
+ assertEquals(observerMethod.getBeanClass(), Foo.class);
+ assertEquals(observerMethod.getObservedType(), new TypeLiteral<Baz<String>>() { }.getType());
+ }
+
+ @Test
+ @Ignore("TODO not yet working!")
+ public void testObserver() throws Exception
+ {
+ addExtension(new BarVetoExtension());
+ startContainer(Foo.class, Bar.class, Baz.class, BazSubclass.class, GenericFactory.class);
+
+ Foo foo = getInstance(Foo.class);
+ assertNotNull(foo);
+ getBeanManager().fireEvent(new BazSubclass(null));
+ assertNotNull(foo.getABazEvent());
+ assertEquals((String) foo.getAObserverInjectionPoint(), "a produced String");
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/UsingBaz.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/UsingBaz.java
new file mode 100644
index 0000000..aaee7c9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/UsingBaz.java
@@ -0,0 +1,31 @@
+/*
+ * 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.webbeans.newtests.injection.generics;
+
+
+import javax.inject.Inject;
+
+public class UsingBaz {
+ @Inject
+ private Baz baz;
+
+ public Baz getBaz() {
+ return baz;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/zoo/Animal.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/zoo/Animal.java
new file mode 100644
index 0000000..13adc3e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/zoo/Animal.java
@@ -0,0 +1,28 @@
+/*
+ * 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.webbeans.newtests.injection.generics.zoo;
+
+/**
+ */
+public interface Animal
+{
+ int getLegCount();
+
+ String getName();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/zoo/GenericsInTheZooTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/zoo/GenericsInTheZooTest.java
new file mode 100644
index 0000000..ef75a70
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/zoo/GenericsInTheZooTest.java
@@ -0,0 +1,88 @@
+/*
+ * 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.webbeans.newtests.injection.generics.zoo;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.enterprise.context.Dependent;
+import javax.inject.Inject;
+
+/**
+ * A few simple generics handling tests.
+ */
+public class GenericsInTheZooTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testSpecificAnimalStable() throws Exception
+ {
+ // create the stables via explicit subclasses;
+ startContainer(Animal.class, Stable.class, Horse.class, Pig.class, HorseStable.class, PigStable.class,
+ MySpecificAnimalStables.class);
+
+ verifyAnimalStables();
+ }
+
+ @Dependent
+ public static class MySpecificAnimalStables
+ {
+ @Inject
+ private Stable<Horse> horseStable;
+
+ @Inject
+ private Stable<Pig> pigStable;
+
+
+ public Stable<Horse> getHorseStable()
+ {
+ return horseStable;
+ }
+
+ public Stable<Pig> getPigStable()
+ {
+ return pigStable;
+ }
+ }
+
+ @Test
+ public void testGenericProducer() throws Exception
+ {
+ // create the stables via a single producer method
+ startContainer(Stable.class, StableProducer.class, MySpecificAnimalStables.class);
+
+ verifyAnimalStables();
+ }
+
+
+ private void verifyAnimalStables()
+ {
+ MySpecificAnimalStables stables = getInstance(MySpecificAnimalStables.class);
+ Assert.assertNotNull(stables);
+ Assert.assertNotNull(stables.getHorseStable());
+ Assert.assertNotNull(stables.getHorseStable());
+ Assert.assertEquals("horse", stables.getHorseStable().getPet().getName());
+
+ Assert.assertNotNull(stables.getPigStable());
+ Assert.assertNotNull(stables.getPigStable());
+ Assert.assertEquals("pig", stables.getPigStable().getPet().getName());
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/zoo/Horse.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/zoo/Horse.java
new file mode 100644
index 0000000..8d50e24
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/zoo/Horse.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.newtests.injection.generics.zoo;
+
+/**
+ */
+public class Horse implements Animal
+{
+ @Override
+ public int getLegCount()
+ {
+ return 4;
+ }
+
+ @Override
+ public String getName()
+ {
+ return "horse";
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/zoo/HorseStable.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/zoo/HorseStable.java
new file mode 100644
index 0000000..d6db4bd
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/zoo/HorseStable.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.newtests.injection.generics.zoo;
+
+import javax.annotation.PostConstruct;
+
+/**
+ * A stable for horses, pigs, etc
+ */
+public class HorseStable extends Stable<Horse>
+{
+ @PostConstruct
+ public void init()
+ {
+ setPet(new Horse());
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/zoo/Pig.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/zoo/Pig.java
new file mode 100644
index 0000000..8e7c734
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/zoo/Pig.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.newtests.injection.generics.zoo;
+
+/**
+ */
+public class Pig implements Animal
+{
+ @Override
+ public int getLegCount()
+ {
+ return 4;
+ }
+
+ @Override
+ public String getName()
+ {
+ return "pig";
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/zoo/PigStable.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/zoo/PigStable.java
new file mode 100644
index 0000000..53d1184
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/zoo/PigStable.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.injection.generics.zoo;
+
+import javax.annotation.PostConstruct;
+
+/**
+ * A stable for horses, pigs, etc
+ */
+public class PigStable extends Stable<Pig>
+{
+ @PostConstruct
+ public void init()
+ {
+ setPet(new Pig());
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/zoo/Stable.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/zoo/Stable.java
new file mode 100644
index 0000000..e19e498
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/zoo/Stable.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.injection.generics.zoo;
+
+import javax.enterprise.inject.Typed;
+
+/**
+ * A stable for horses, pigs, etc
+ */
+@Typed
+public class Stable<PET>
+{
+ private PET pet;
+
+ public PET getPet()
+ {
+ return pet;
+ }
+
+ public void setPet(PET pet)
+ {
+ this.pet = pet;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/zoo/StableProducer.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/zoo/StableProducer.java
new file mode 100644
index 0000000..18deb3a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/generics/zoo/StableProducer.java
@@ -0,0 +1,51 @@
+/*
+ * 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.webbeans.newtests.injection.generics.zoo;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.InjectionPoint;
+import java.lang.reflect.ParameterizedType;
+
+/**
+ * A stable for horses, pigs, etc
+ */
+public class StableProducer
+{
+ @Produces
+ @Dependent
+ public <PET> Stable<PET> createStable(InjectionPoint injectionPoint)
+ {
+ Class petClass = (Class) ((ParameterizedType) injectionPoint.getType()).getActualTypeArguments()[0];
+
+ Stable stable = null;
+ if (Horse.class.equals(petClass))
+ {
+ stable = (Stable<PET>) new HorseStable();
+ stable.setPet(new Horse());
+ }
+ if (Pig.class.equals(petClass))
+ {
+ stable = new PigStable();
+ stable.setPet(new Pig());
+ }
+
+ return stable;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/AbstractInjectionPointOwner.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/AbstractInjectionPointOwner.java
new file mode 100644
index 0000000..efbb054
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/AbstractInjectionPointOwner.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2012 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.webbeans.newtests.injection.injectionpoint.beans;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+
+public abstract class AbstractInjectionPointOwner
+{
+ protected InjectionPoint injectionPoint;
+
+ public String getName()
+ {
+ return injectionPoint.getMember().getName();
+ }
+
+ public InjectionPoint getInjectionPoint()
+ {
+ return injectionPoint;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/ConstructorInjectionPointOwner.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/ConstructorInjectionPointOwner.java
new file mode 100644
index 0000000..1ce2fff
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/ConstructorInjectionPointOwner.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2012 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.webbeans.newtests.injection.injectionpoint.beans;
+
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Inject;
+import java.io.Serializable;
+
+public class ConstructorInjectionPointOwner extends AbstractInjectionPointOwner
+{
+
+ @Inject
+ public ConstructorInjectionPointOwner(InjectionPoint ip)
+ {
+ injectionPoint = ip;
+ }
+
+ public ConstructorInjectionPointOwner()
+ {
+
+ }
+
+ @SessionScoped
+ public static class SomeInnerClassWithInstructorInjectionPoint implements Serializable
+ {
+
+ public SomeInnerClassWithInstructorInjectionPoint()
+ {
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/DataTransformer.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/DataTransformer.java
new file mode 100644
index 0000000..640f881
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/DataTransformer.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2012 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.webbeans.newtests.injection.injectionpoint.beans;
+
+import java.util.Iterator;
+import java.util.List;
+
+public class DataTransformer {
+
+ public String concatStrings(List<String> stringList) {
+
+ StringBuilder stringBuilder = new StringBuilder();
+ if (stringList != null && !stringList.isEmpty()) {
+ String string;
+ for (Iterator iterator = stringList.iterator(); iterator.hasNext(); stringBuilder.append(string)) {
+ string = (String) iterator.next();
+ }
+
+ }
+ return stringBuilder.toString();
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/FieldInjectionPointOwner.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/FieldInjectionPointOwner.java
new file mode 100644
index 0000000..558134e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/FieldInjectionPointOwner.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2012 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.webbeans.newtests.injection.injectionpoint.beans;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Inject;
+
+public class FieldInjectionPointOwner extends AbstractInjectionPointOwner {
+
+ @Inject
+ private InjectionPoint ip;
+
+ @PostConstruct
+ public void setInjectionPoint() {
+ injectionPoint = ip;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/InjectionPointBeansOwner.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/InjectionPointBeansOwner.java
new file mode 100644
index 0000000..732ae7d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/InjectionPointBeansOwner.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2012 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.webbeans.newtests.injection.injectionpoint.beans;
+
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+public class InjectionPointBeansOwner {
+
+ @Inject
+ private ConstructorInjectionPointOwner constructorInjection;
+
+ @Inject
+ private FieldInjectionPointOwner fieldInjection;
+
+ @Inject
+ private MethodInjectionPointOwner methodInjection;
+
+ @Inject
+ private ProducerMethodInjectionPointOwner producerMethodInjection;
+
+ @Inject
+ private Instance<ConstructorInjectionPointOwner> constructorInjectionInstance;
+
+ @Inject
+ private Instance<FieldInjectionPointOwner> fieldInjectionInstance;
+
+ @Inject
+ private Instance<MethodInjectionPointOwner> methodInjectionInstance;
+
+ @Inject
+ private Instance<ProducerMethodInjectionPointOwner> producerMethodInjectionInstance;
+
+ @Inject
+ private Event<StringBuilder> observerInjection;
+
+ @Inject
+ private Event<StringBuffer> parameterizedObserverInjection;
+
+ public String getConstructorInjectionName() {
+ return constructorInjection.getName();
+ }
+
+ public String getFieldInjectionName() {
+ return fieldInjection.getName();
+ }
+
+ public String getMethodInjectionName() {
+ return methodInjection.getName();
+ }
+
+ public String getProducerMethodInjectionName() {
+ return producerMethodInjection.getName();
+ }
+
+ public String getConstructorInjectionInstanceName() {
+ return constructorInjectionInstance.get().getName();
+ }
+
+ public String getFieldInjectionInstanceName() {
+ return fieldInjectionInstance.get().getName();
+ }
+
+ public String getMethodInjectionInstanceName() {
+ return methodInjectionInstance.get().getName();
+ }
+
+ public String getProducerMethodInjectionInstanceName() {
+ return producerMethodInjectionInstance.get().getName();
+ }
+
+ public String getObserverInjectionName() {
+ StringBuilder name = new StringBuilder();
+ observerInjection.fire(name);
+ return name.toString();
+ }
+
+ public String getParameterizedObserverInjectionName() {
+ StringBuffer name = new StringBuffer();
+ parameterizedObserverInjection.fire(name);
+ return name.toString();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/InjectionPointMetaDataOwner.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/InjectionPointMetaDataOwner.java
new file mode 100644
index 0000000..e214209
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/InjectionPointMetaDataOwner.java
@@ -0,0 +1,48 @@
+/*
+ * 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.webbeans.newtests.injection.injectionpoint.beans;
+
+import java.util.logging.Logger;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Named;
+
+import org.apache.webbeans.newtests.injection.injectionpoint.common.LoggerQualifier;
+
+@RequestScoped
+@Named("org.apache.webbeans.newtests.injection.injectionpoint.beans.InjectionPointMetaDataOwner")
+public class InjectionPointMetaDataOwner
+{
+ private InjectionPoint injectionPoint = null;
+
+ @Produces @LoggerQualifier
+ public Logger getLogger(InjectionPoint injectionPoint)
+ {
+ this.injectionPoint = injectionPoint;
+ return Logger.getLogger(injectionPoint.getBean().getBeanClass().getName());
+ }
+
+
+ public InjectionPoint getInjectionPoint()
+ {
+ return this.injectionPoint;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/InjectionPointObserver.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/InjectionPointObserver.java
new file mode 100644
index 0000000..2baf942
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/InjectionPointObserver.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2012 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.webbeans.newtests.injection.injectionpoint.beans;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+public class InjectionPointObserver extends AbstractInjectionPointOwner {
+
+ public void observeInjectionPoint(@Observes StringBuilder builder, InjectionPoint ip) {
+ injectionPoint = ip;
+ builder.append(getName());
+ }
+
+ public void observeParameterizedInjectionPoint(@Observes StringBuffer buffer, ProducerMethodInjectionPointOwner injectionPointOwner) {
+ injectionPoint = injectionPointOwner.injectionPoint;
+ buffer.append(getName());
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/InjectionPointOwnerInstance.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/InjectionPointOwnerInstance.java
new file mode 100644
index 0000000..cb2522e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/InjectionPointOwnerInstance.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.injection.injectionpoint.beans;
+
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+public class InjectionPointOwnerInstance
+{
+ @Inject
+ private Instance<MethodInjectionPointOwner> ipOwnerInstance;
+
+
+ public Instance<MethodInjectionPointOwner> getIpOwnerInstance()
+ {
+ return ipOwnerInstance;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/InjectionPointOwnerProducer.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/InjectionPointOwnerProducer.java
new file mode 100644
index 0000000..39028f0
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/InjectionPointOwnerProducer.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2012 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.webbeans.newtests.injection.injectionpoint.beans;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+@ApplicationScoped
+public class InjectionPointOwnerProducer {
+
+ @Produces
+ public ProducerMethodInjectionPointOwner produceInjectionPointOwner(InjectionPoint injectionPoint) {
+ return new ProducerMethodInjectionPointOwner(injectionPoint);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/LoggerInjectedBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/LoggerInjectedBean.java
new file mode 100644
index 0000000..a19b9ea
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/LoggerInjectedBean.java
@@ -0,0 +1,39 @@
+/*
+ * 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.webbeans.newtests.injection.injectionpoint.beans;
+
+import java.util.logging.Logger;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.webbeans.newtests.injection.injectionpoint.common.LoggerQualifier;
+
+@RequestScoped
+@Named("org.apache.webbeans.newtests.injection.injectionpoint.beans.LoggerInjectedBean")
+public class LoggerInjectedBean
+{
+ private @Inject @LoggerQualifier Logger logger;
+
+ public Logger getLogger()
+ {
+ return this.logger;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/MethodInjectionPointOwner.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/MethodInjectionPointOwner.java
new file mode 100644
index 0000000..50e1768
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/MethodInjectionPointOwner.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2012 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.webbeans.newtests.injection.injectionpoint.beans;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Inject;
+
+@Dependent
+public class MethodInjectionPointOwner extends AbstractInjectionPointOwner {
+
+ @Inject
+ public void setInjectionPoint(InjectionPoint ip) {
+ injectionPoint = ip;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/MyContainer.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/MyContainer.java
new file mode 100644
index 0000000..2f37821
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/MyContainer.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.newtests.injection.injectionpoint.beans;
+
+import javax.inject.Inject;
+
+public class MyContainer {
+
+ @Inject
+ @PropertyHolder
+ private String nestedProperty;
+
+ public String getNestedProperty() {
+ return nestedProperty;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/ProducerInjectionPointInstanceOwner.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/ProducerInjectionPointInstanceOwner.java
new file mode 100644
index 0000000..90fef35
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/ProducerInjectionPointInstanceOwner.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.injection.injectionpoint.beans;
+
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+public class ProducerInjectionPointInstanceOwner
+{
+ @Inject
+ private Instance<ProducerMethodInjectionPointOwner> ipOwnerInstance;
+
+
+ public Instance<ProducerMethodInjectionPointOwner> getIpOwnerInstance()
+ {
+ return ipOwnerInstance;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/ProducerMethodInjectionPointOwner.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/ProducerMethodInjectionPointOwner.java
new file mode 100644
index 0000000..401c3e4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/ProducerMethodInjectionPointOwner.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2012 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.webbeans.newtests.injection.injectionpoint.beans;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+
+public class ProducerMethodInjectionPointOwner extends AbstractInjectionPointOwner {
+
+ public ProducerMethodInjectionPointOwner(InjectionPoint ip) {
+ injectionPoint = ip;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/PropertyEncryptor.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/PropertyEncryptor.java
new file mode 100644
index 0000000..e7de6e5
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/PropertyEncryptor.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2012 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.webbeans.newtests.injection.injectionpoint.beans;
+
+public class PropertyEncryptor {
+
+ public String decryptProperty(String decryptPropertyValue) {
+ return decryptPropertyValue;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/PropertyHolder.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/PropertyHolder.java
new file mode 100644
index 0000000..1a2a418
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/PropertyHolder.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.injection.injectionpoint.beans;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import javax.enterprise.util.Nonbinding;
+import javax.inject.Qualifier;
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
+public @interface PropertyHolder {
+
+ @Nonbinding public String value() default "";
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/PropertyHolderFactory.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/PropertyHolderFactory.java
new file mode 100644
index 0000000..b3667e3
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/PropertyHolderFactory.java
@@ -0,0 +1,173 @@
+/*
+ * 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.webbeans.newtests.injection.injectionpoint.beans;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Inject;
+import org.apache.webbeans.config.PropertyLoader;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+
+/**
+ * Factory class for PropertyHolder Annotation.
+ * Defines @Produces methods for PropertyHolder.
+ */
+public class PropertyHolderFactory {
+
+ private static final Logger logger = WebBeansLoggerFacade.getLogger(PropertyHolderFactory.class);
+
+ //Properties
+ private static final String PROPERTY_FILE =
+ "org/apache/webbeans/newtests/injection/injectionpoint/tests/PlaceHolder.properties";
+ private volatile static Properties placeHolderProperties;
+
+ //Inject classes PropertyHolderFactory depends upon.
+ @Inject
+ private DataTransformer dataTransformer;
+
+ @Inject
+ private PropertyEncryptor propertyEncryptor;
+
+ /**
+ * Defines retrieval of Properties from placeHolder.properties file in class
+ * path.
+ *
+ * @return Properties
+ */
+ public synchronized static Properties getProperties() {
+
+ if (placeHolderProperties == null) {
+ placeHolderProperties = PropertyLoader.getProperties(PROPERTY_FILE);
+ logger.info("loaded "+placeHolderProperties);
+ }
+ return placeHolderProperties;
+ }
+
+ /**
+ * Defines PropertyHolder value fetch, Producer method.
+ *
+ * @param injectionPoint
+ * @return String
+ */
+ @Produces
+ @PropertyHolder
+ public String getPlaceHolderValue(InjectionPoint injectionPoint) {
+
+ logger.log(Level.INFO, "getPlaceHolderValue {0}", injectionPoint);
+
+ //Get value attribute of the PlaceHolder Annotation
+ String keyName = injectionPoint.getAnnotated().getAnnotation(PropertyHolder.class).value();
+
+ //If PlaceHolder value annotation is not specified, Use field name as Key to Properties.
+ if (isBlank(keyName)) {
+ keyName = injectionPoint.getMember().getName();
+ }
+
+ //Consturct list for appending
+ List<String> stringList = new ArrayList<String>();
+ stringList.add(injectionPoint.getMember().getDeclaringClass().getName());
+ stringList.add(".");
+ stringList.add(keyName);
+
+ //Constuct KeyName string.
+ keyName = dataTransformer.concatStrings(stringList);
+ logger.info("Fetching value for key: " + keyName);
+
+ //Check System Property, if its not available check in Properties file.
+ String keyValue = System.getProperty(keyName);
+ if (isBlank(keyValue)) {
+ Properties properties = PropertyHolderFactory.getProperties();
+ keyValue = properties.getProperty(keyName);
+ }
+
+ //Check for Encrypted property value
+ keyValue = this.decryptProperty(keyValue);
+
+ logger.info("Produced property : Key->{" + keyName + "}, Value->{" + keyValue + "}");
+
+
+ return keyValue;
+ }//End Method.
+
+ /**
+ * Checks if given property value is encrypted. If encrypted, returns the
+ * decrypted value.
+ *
+ * @param propertyValue
+ * @return String
+ */
+ private String decryptProperty(String propertyValue) {
+ logger.info("Checking if decrypting of value is needed for " + propertyValue);
+
+ if (!isEmpty(propertyValue)
+ && propertyValue.matches("ENC(\\S+)")) {
+
+ String decryptPropertyValue = substringBetween(propertyValue, "ENC(", ")");
+ propertyValue = propertyEncryptor.decryptProperty(decryptPropertyValue);
+ }
+
+ return propertyValue;
+ }
+
+ public static boolean isBlank(String str) {
+ int strLen;
+ if (str == null || (strLen = str.length()) == 0) {
+ return true;
+ }
+ for (int i = 0; i < strLen; i++) {
+ if ((Character.isWhitespace(str.charAt(i)) == false)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static boolean isEmpty(String str) {
+ return str == null || str.length() == 0;
+ }
+
+ /**
+ * Sets DataTransformer instance.
+ *
+ * @param dataTransformer
+ */
+ public void setDataTransformer(DataTransformer dataTransformer) {
+ this.dataTransformer = dataTransformer;
+ }
+ public static final int INDEX_NOT_FOUND = -1;
+
+ public static String substringBetween(String str, String open, String close) {
+ if (str == null || open == null || close == null) {
+ return null;
+ }
+ int start = str.indexOf(open);
+ if (start != INDEX_NOT_FOUND) {
+ int end = str.indexOf(close, start + open.length());
+ if (end != INDEX_NOT_FOUND) {
+ return str.substring(start + open.length(), end);
+ }
+ }
+ return null;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/PropertyInjector.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/PropertyInjector.java
new file mode 100644
index 0000000..e2a86ad
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/PropertyInjector.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2012 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.webbeans.newtests.injection.injectionpoint.beans;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@Named("org.apache.webbeans.newtests.injection.injectionpoint.beans.PropertyInjector")
+public class PropertyInjector {
+
+ @Inject
+ private DataTransformer dataTransformer;
+
+ @Inject
+ @PropertyHolder
+ private String anotherVarName;
+
+ @Inject
+ @PropertyHolder
+ private String ldapHost;
+
+ @Inject
+ private MyContainer nested;
+
+ public String getAnotherVarName() {
+ return anotherVarName;
+ }
+
+ public DataTransformer getDataTransformer() {
+ return dataTransformer;
+ }
+
+
+ public String getLdapHost() {
+ return ldapHost;
+ }
+
+
+ public MyContainer getNested() {
+ return nested;
+ }
+}
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/common/LoggerQualifier.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/common/LoggerQualifier.java
new file mode 100644
index 0000000..c66c8e9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/common/LoggerQualifier.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.newtests.injection.injectionpoint.common;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface LoggerQualifier {
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/DependentProducerMethodInjectionPointTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/DependentProducerMethodInjectionPointTest.java
new file mode 100644
index 0000000..465a585
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/DependentProducerMethodInjectionPointTest.java
@@ -0,0 +1,92 @@
+/*
+ * 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.webbeans.newtests.injection.injectionpoint.tests;
+
+import java.io.*;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.injection.injectionpoint.beans.InjectionPointMetaDataOwner;
+import org.apache.webbeans.newtests.injection.injectionpoint.beans.LoggerInjectedBean;
+import org.junit.Test;
+
+public class DependentProducerMethodInjectionPointTest extends AbstractUnitTest
+{
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testDependentProducerMethodInjectionPoint() throws Exception
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(InjectionPointMetaDataOwner.class);
+ beanClasses.add(LoggerInjectedBean.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ Bean<LoggerInjectedBean> bean = (Bean<LoggerInjectedBean>)getBeanManager().getBeans(LoggerInjectedBean.class.getName()).iterator().next();
+
+ CreationalContext<LoggerInjectedBean> cc = getBeanManager().createCreationalContext(bean);
+ LoggerInjectedBean model = (LoggerInjectedBean) getBeanManager().getReference(bean, LoggerInjectedBean.class, cc);
+
+ Assert.assertNotNull(model.getLogger());
+
+ Bean<InjectionPointMetaDataOwner> bean2 = (Bean<InjectionPointMetaDataOwner>)getBeanManager().getBeans(InjectionPointMetaDataOwner.class.getName()).iterator().next();
+
+ CreationalContext<InjectionPointMetaDataOwner> cc2 = getBeanManager().createCreationalContext(bean2);
+ InjectionPointMetaDataOwner model2 = (InjectionPointMetaDataOwner) getBeanManager().getReference(bean2, InjectionPointMetaDataOwner.class, cc2);
+
+ InjectionPoint point = model2.getInjectionPoint();
+ Assert.assertEquals(bean, point.getBean());
+ Assert.assertTrue(point.getMember() instanceof Field);
+
+ point = (InjectionPoint) deserialize(serialize(point));
+
+ Assert.assertTrue(point.getBean().equals(bean));
+ Assert.assertTrue(point.getMember() instanceof Field);
+
+ shutDownContainer();
+
+ }
+
+ private byte[] serialize(Object o) throws IOException
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(o);
+ return baos.toByteArray();
+ }
+
+ private Object deserialize(byte[] serial) throws IOException, ClassNotFoundException
+ {
+ ByteArrayInputStream bais = new ByteArrayInputStream(serial);
+ ObjectInputStream ois = new ObjectInputStream(bais);
+ return ois.readObject();
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/DependentProducerMethodMultipleInjectionPointTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/DependentProducerMethodMultipleInjectionPointTest.java
new file mode 100644
index 0000000..c08fe1e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/DependentProducerMethodMultipleInjectionPointTest.java
@@ -0,0 +1,65 @@
+/*
+ * 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.webbeans.newtests.injection.injectionpoint.tests;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import junit.framework.Assert;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.injection.injectionpoint.beans.*;
+import org.junit.Test;
+
+public class DependentProducerMethodMultipleInjectionPointTest extends AbstractUnitTest {
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testInjectionPointValidity() throws Exception {
+
+ Collection<String> beanXmls = new ArrayList<String>();
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(DataTransformer.class);
+ beanClasses.add(PropertyEncryptor.class);
+ beanClasses.add(MyContainer.class);
+ beanClasses.add(PropertyHolder.class);
+ beanClasses.add(PropertyHolderFactory.class);
+ beanClasses.add(PropertyInjector.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ Bean<PropertyInjector> bean = (Bean<PropertyInjector>) getBeanManager().getBeans(PropertyInjector.class.getName()).iterator().next();
+ CreationalContext<PropertyInjector> cc = getBeanManager().createCreationalContext(bean);
+ PropertyInjector propertyInjector = (PropertyInjector) getBeanManager().getReference(bean, PropertyInjector.class, cc);
+
+ Assert.assertNotNull(propertyInjector.getDataTransformer());
+
+ Assert.assertNotNull(propertyInjector.getAnotherVarName());
+ Assert.assertTrue(propertyInjector.getAnotherVarName().equals("Injection is working...Finally"));
+
+ Assert.assertNotNull(propertyInjector.getLdapHost());
+ Assert.assertTrue(propertyInjector.getLdapHost().equals("Rohit Kelapure LDAP Host"));
+
+ Assert.assertNotNull(propertyInjector.getNested().getNestedProperty());
+ Assert.assertTrue(propertyInjector.getNested().getNestedProperty().trim().equals("Rohit Kelapure Nested Property"));
+
+ shutDownContainer();
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/InjectionPointInjectionTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/InjectionPointInjectionTest.java
new file mode 100644
index 0000000..89a5b8a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/InjectionPointInjectionTest.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2012 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.webbeans.newtests.injection.injectionpoint.tests;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.apache.webbeans.annotation.DefaultLiteral;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.injection.injectionpoint.beans.AbstractInjectionPointOwner;
+import org.apache.webbeans.newtests.injection.injectionpoint.beans.ConstructorInjectionPointOwner;
+import org.apache.webbeans.newtests.injection.injectionpoint.beans.FieldInjectionPointOwner;
+import org.apache.webbeans.newtests.injection.injectionpoint.beans.InjectionPointBeansOwner;
+import org.apache.webbeans.newtests.injection.injectionpoint.beans.InjectionPointObserver;
+import org.apache.webbeans.newtests.injection.injectionpoint.beans.InjectionPointOwnerInstance;
+import org.apache.webbeans.newtests.injection.injectionpoint.beans.InjectionPointOwnerProducer;
+import org.apache.webbeans.newtests.injection.injectionpoint.beans.MethodInjectionPointOwner;
+import org.apache.webbeans.newtests.injection.injectionpoint.beans.ProducerInjectionPointInstanceOwner;
+import org.apache.webbeans.newtests.injection.injectionpoint.beans.ProducerMethodInjectionPointOwner;
+import org.junit.Test;
+
+public class InjectionPointInjectionTest extends AbstractUnitTest {
+
+ @Test
+ public void testInjectionPointInjection()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(ConstructorInjectionPointOwner.class);
+ beanClasses.add(FieldInjectionPointOwner.class);
+ beanClasses.add(MethodInjectionPointOwner.class);
+ beanClasses.add(InjectionPointObserver.class);
+ beanClasses.add(InjectionPointBeansOwner.class);
+ beanClasses.add(InjectionPointOwnerProducer.class);
+ beanClasses.add(ProducerMethodInjectionPointOwner.class);
+ beanClasses.add(ConstructorInjectionPointOwner.SomeInnerClassWithInstructorInjectionPoint.class);
+ startContainer(beanClasses, null);
+
+ Bean<InjectionPointBeansOwner> bean = (Bean<InjectionPointBeansOwner>) getBeanManager().getBeans(InjectionPointBeansOwner.class).iterator().next();
+ CreationalContext<InjectionPointBeansOwner> cc = getBeanManager().createCreationalContext(bean);
+ InjectionPointBeansOwner owner = (InjectionPointBeansOwner) getBeanManager().getReference(bean, InjectionPointBeansOwner.class, cc);
+
+ ConstructorInjectionPointOwner.SomeInnerClassWithInstructorInjectionPoint innerClass
+ = getInstance(ConstructorInjectionPointOwner.SomeInnerClassWithInstructorInjectionPoint.class);
+ assertThat(innerClass, is(notNullValue()));
+
+ assertThat(owner.getConstructorInjectionName(), is("constructorInjection"));
+ assertThat(owner.getFieldInjectionName(), is("fieldInjection"));
+ assertThat(owner.getMethodInjectionName(), is("methodInjection"));
+ assertThat(owner.getProducerMethodInjectionName(), is("producerMethodInjection"));
+ assertThat(owner.getConstructorInjectionInstanceName(), is("constructorInjectionInstance"));
+ assertThat(owner.getFieldInjectionInstanceName(), is("fieldInjectionInstance"));
+ assertThat(owner.getMethodInjectionInstanceName(), is("methodInjectionInstance"));
+ assertThat(owner.getProducerMethodInjectionInstanceName(), is("producerMethodInjectionInstance"));
+ assertThat(owner.getObserverInjectionName(), is("observerInjection"));
+ assertThat(owner.getParameterizedObserverInjectionName(), is("observeParameterizedInjectionPoint"));
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testPackagePrivateInjectionPoint()
+ {
+ startContainer(PackageMethodInjectionPointOwner.class, PackageInjectionPointOwner.class);
+
+ PackageInjectionPointOwner pipo = getInstance(PackageInjectionPointOwner.class);
+ assertThat(pipo, is(notNullValue()));
+ assertThat(pipo.getName(), is("pimp"));
+ }
+
+ @Test
+ public void testDynamicResolvingInjectionPoint()
+ {
+ startContainer(InjectionPointOwnerProducer.class, ProducerMethodInjectionPointOwner.class, AbstractInjectionPointOwner.class);
+
+ ProducerMethodInjectionPointOwner producedInstance = getInstance(ProducerMethodInjectionPointOwner.class);
+ assertThat(producedInstance, notNullValue());
+ InjectionPoint ip = producedInstance.getInjectionPoint();
+ assertThat(ip, nullValue());
+ }
+
+
+ @Test
+ public void testDynamicResolvingInstanceInjectionPoint()
+ {
+ startContainer(InjectionPointOwnerInstance.class, InjectionPointOwnerProducer.class,
+ ProducerMethodInjectionPointOwner.class, AbstractInjectionPointOwner.class,
+ MethodInjectionPointOwner.class, ProducerInjectionPointInstanceOwner.class);
+
+ InjectionPointOwnerInstance producedInstanceOwner = getInstance(InjectionPointOwnerInstance.class);
+ assertThat(producedInstanceOwner, notNullValue());
+
+ MethodInjectionPointOwner ipOwner = producedInstanceOwner.getIpOwnerInstance().select(new DefaultLiteral()).get();
+ assertThat(ipOwner, notNullValue());
+
+ InjectionPoint ip = ipOwner.getInjectionPoint();
+ assertNotNull(ip);
+ assertNotNull(ip.getAnnotated());
+ assertThat(ip.getAnnotated(), instanceOf(AnnotatedField.class));
+
+
+ ProducerInjectionPointInstanceOwner pipo = getInstance(ProducerInjectionPointInstanceOwner.class);
+ assertNotNull(pipo);
+ Instance<ProducerMethodInjectionPointOwner> ipOwnerInstance = pipo.getIpOwnerInstance();
+ assertNotNull(ipOwnerInstance);
+ ProducerMethodInjectionPointOwner pmp = ipOwnerInstance.select(DefaultLiteral.INSTANCE).get();
+ assertNotNull(pmp);
+ assertNotNull(pmp.getInjectionPoint());
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/PackageInjectionPointOwner.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/PackageInjectionPointOwner.java
new file mode 100644
index 0000000..0a90076
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/PackageInjectionPointOwner.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.injection.injectionpoint.tests;
+
+import javax.inject.Inject;
+
+/**
+ * Package private injection point owner
+ */
+class PackageInjectionPointOwner
+{
+ @Inject
+ private PackageMethodInjectionPointOwner pimp;
+
+ public String getName()
+ {
+ return pimp.getName();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/PackageMethodInjectionPointOwner.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/PackageMethodInjectionPointOwner.java
new file mode 100644
index 0000000..be19e6a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/PackageMethodInjectionPointOwner.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2012 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.webbeans.newtests.injection.injectionpoint.tests;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Inject;
+
+import org.apache.webbeans.newtests.injection.injectionpoint.beans.AbstractInjectionPointOwner;
+
+/**
+ * Attention, this class is only package private!
+ */
+class PackageMethodInjectionPointOwner extends AbstractInjectionPointOwner {
+
+ @Inject
+ public void setInjectionPoint(InjectionPoint ip) {
+ injectionPoint = ip;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/named/AbstractNamedBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/named/AbstractNamedBean.java
new file mode 100644
index 0000000..26c6790
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/named/AbstractNamedBean.java
@@ -0,0 +1,27 @@
+/*
+ * 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.webbeans.newtests.injection.named;
+
+public class AbstractNamedBean implements NamedInterface {
+
+ @Override
+ public String getName() {
+ return getClass().getSimpleName();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/named/DefaultNamedBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/named/DefaultNamedBean.java
new file mode 100644
index 0000000..d487552
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/named/DefaultNamedBean.java
@@ -0,0 +1,26 @@
+/*
+ * 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.webbeans.newtests.injection.named;
+
+import javax.inject.Named;
+
+@Named
+public class DefaultNamedBean extends AbstractNamedBean {
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/named/NamedBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/named/NamedBean.java
new file mode 100644
index 0000000..7a3eb6e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/named/NamedBean.java
@@ -0,0 +1,26 @@
+/*
+ * 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.webbeans.newtests.injection.named;
+
+import javax.inject.Named;
+
+@Named("named")
+public class NamedBean extends AbstractNamedBean {
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/named/NamedInjectionPoints.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/named/NamedInjectionPoints.java
new file mode 100644
index 0000000..e8cd396
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/named/NamedInjectionPoints.java
@@ -0,0 +1,55 @@
+/*
+ * 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.webbeans.newtests.injection.named;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+public class NamedInjectionPoints {
+
+ @Inject
+ @Named("named")
+ private NamedInterface namedBeanWithNamedInjectionPoint;
+ @Inject
+ @Named
+ private NamedInterface named;
+
+ @Inject
+ @Named("defaultNamedBean")
+ private NamedInterface defaultNamedBeanWithNamedInjectionPoint;
+ @Inject
+ @Named
+ private NamedInterface defaultNamedBean;
+
+ public NamedInterface getNamedBeanWithNamedInjectionPoint() {
+ return namedBeanWithNamedInjectionPoint;
+ }
+
+ public NamedInterface getNamed() {
+ return named;
+ }
+
+ public NamedInterface getDefaultNamedBeanWithNamedInjectionPoint() {
+ return defaultNamedBeanWithNamedInjectionPoint;
+ }
+
+ public NamedInterface getDefaultNamedBean() {
+ return defaultNamedBean;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/named/NamedInterface.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/named/NamedInterface.java
new file mode 100644
index 0000000..03037b9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/named/NamedInterface.java
@@ -0,0 +1,25 @@
+/*
+ * 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.webbeans.newtests.injection.named;
+
+
+public interface NamedInterface {
+
+ String getName();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/named/NamedTests.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/named/NamedTests.java
new file mode 100644
index 0000000..e31eb92
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/named/NamedTests.java
@@ -0,0 +1,59 @@
+/*
+ * 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.webbeans.newtests.injection.named;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class NamedTests extends AbstractUnitTest {
+
+ @Test
+ public void testNamedInjection()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+
+ beanClasses.add(NamedInterface.class);
+ beanClasses.add(NamedBean.class);
+ beanClasses.add(DefaultNamedBean.class);
+ beanClasses.add(NamedInjectionPoints.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ Bean<?> injectionPointsBean = getBeanManager().getBeans(NamedInjectionPoints.class).iterator().next();
+ CreationalContext<?> context = getBeanManager().createCreationalContext(injectionPointsBean);
+ NamedInjectionPoints consumer = (NamedInjectionPoints) getBeanManager().getReference(injectionPointsBean, NamedInjectionPoints.class, context);
+
+ Assert.assertEquals("NamedBean", consumer.getNamedBeanWithNamedInjectionPoint().getName());
+ Assert.assertEquals("NamedBean", consumer.getNamed().getName());
+ Assert.assertEquals("DefaultNamedBean", consumer.getDefaultNamedBeanWithNamedInjectionPoint().getName());
+ Assert.assertEquals("DefaultNamedBean", consumer.getDefaultNamedBean().getName());
+
+ shutDownContainer();
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/noncontextual/ContextualBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/noncontextual/ContextualBean.java
new file mode 100644
index 0000000..7b1ceb4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/noncontextual/ContextualBean.java
@@ -0,0 +1,26 @@
+/*
+ * 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.webbeans.newtests.injection.noncontextual;
+
+import javax.enterprise.context.ApplicationScoped;
+
+@ApplicationScoped
+public class ContextualBean
+{
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/noncontextual/InjectNonContextualTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/noncontextual/InjectNonContextualTest.java
new file mode 100644
index 0000000..43b5ed9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/noncontextual/InjectNonContextualTest.java
@@ -0,0 +1,66 @@
+/*
+ * 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.webbeans.newtests.injection.noncontextual;
+
+import junit.framework.Assert;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Test;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionTarget;
+import java.util.ArrayList;
+import java.util.Collection;
+
+public class InjectNonContextualTest extends AbstractUnitTest
+{
+ @SuppressWarnings("unchecked")
+ public <T> void inject(T instance)
+ {
+ BeanManager mgr = WebBeansContext.getInstance().getBeanManagerImpl();
+ AnnotatedType<T> annotatedType = mgr.createAnnotatedType((Class<T>) instance.getClass());
+ InjectionTarget<T> injectionTarget = mgr.createInjectionTarget(annotatedType);
+ CreationalContext<T> context = mgr.createCreationalContext(null);
+ injectionTarget.inject(instance, context);
+ }
+
+
+ @Test
+ public void testInjectingNonContextualBean()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(ContextualBean.class);
+ startContainer(beanClasses, beanXmls);
+ try
+ {
+ final NonContextualBean bean = new NonContextualBean();
+ inject(bean);
+ Assert.assertNotNull(bean.getContextual());
+ }
+ finally
+ {
+ shutDownContainer();
+ }
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/noncontextual/NonContextualBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/noncontextual/NonContextualBean.java
new file mode 100644
index 0000000..499f0cb
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/noncontextual/NonContextualBean.java
@@ -0,0 +1,44 @@
+/*
+ * 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.webbeans.newtests.injection.noncontextual;
+
+import javax.inject.Inject;
+
+public class NonContextualBean
+{
+//**********************************************************************************************************************
+// Fields
+//**********************************************************************************************************************
+
+ @Inject private ContextualBean contextual;
+
+//**********************************************************************************************************************
+// Getter/Setter Methods
+//**********************************************************************************************************************
+
+ public ContextualBean getContextual()
+ {
+ return contextual;
+ }
+
+ public void setContextual(ContextualBean contextual)
+ {
+ this.contextual = contextual;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/serialization/DependentPassivationCriteriaTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/serialization/DependentPassivationCriteriaTest.java
new file mode 100644
index 0000000..6d56d0e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/serialization/DependentPassivationCriteriaTest.java
@@ -0,0 +1,91 @@
+/*
+ * 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.webbeans.newtests.injection.serialization;
+
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.injection.serialization.beans.NonSerializableDependentBean;
+import org.apache.webbeans.newtests.injection.serialization.beans.ProducerWithNonSerializableResultBean;
+import org.apache.webbeans.newtests.injection.serialization.beans.SerializableDependentInjectionTarget;
+import org.apache.webbeans.newtests.injection.serialization.beans.SerializableInjectionTargetFailA;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import junit.framework.Assert;
+
+/**
+ * <p>This test performs a few tests to ensure correct handling of injecting
+ * @Dependent scoped beans into beans of passivating scopes with
+ * regard of Serialization handling.</p>
+ * <p>In general a non-Serializable @Dependent scoped bean must not get
+ * injected into a passivating scoped bean. This is true for plain beans,
+ * producer fields and also for producer methods</p>
+ * <p>Injection <b>is</b> allowed if the injection point is transient or if
+ * the injection target bean either provides a writeObject(ObjectOutputStream)
+ * or a Externalizable#writeExternal(ObjectOutput) method.</p>
+ */
+public class DependentPassivationCriteriaTest extends AbstractUnitTest
+{
+ /**
+ * This tests if the container correctly detects a deployment exception
+ * according to spec 6.6.4:
+ * "
+ */
+ @Test(expected = WebBeansConfigurationException.class)
+ public void testInvalidNonSerializableDependentInjection()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(NonSerializableDependentBean.class);
+ beanClasses.add(SerializableInjectionTargetFailA.class);
+
+ try
+ {
+ startContainer(beanClasses, beanXmls);
+ }
+ finally {
+ shutDownContainer();
+ }
+ }
+
+ /**
+ * This test must not fail with a deployment exception nor with an IllegalProductException,
+ * since only dependent beans are involved.
+ */
+ @Test
+ public void testInjectNonSerializableDependentIntoSerializableDependent()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(ProducerWithNonSerializableResultBean.class);
+ beanClasses.add(SerializableDependentInjectionTarget.class);
+
+ try
+ {
+ startContainer(beanClasses, beanXmls);
+ SerializableDependentInjectionTarget serializableDependentInjectionTarget = getInstance(SerializableDependentInjectionTarget.class);
+ Assert.assertNotNull(serializableDependentInjectionTarget.getInjectedBean());
+ }
+ finally {
+ shutDownContainer();
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/serialization/NonSerializableParametersTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/serialization/NonSerializableParametersTest.java
new file mode 100644
index 0000000..7b4042f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/serialization/NonSerializableParametersTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.webbeans.newtests.injection.serialization;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.injection.serialization.beans.NonSerializableDependentBean;
+import org.apache.webbeans.newtests.injection.serialization.beans.ProducerWithNonSerializableParameterBean;
+import org.apache.webbeans.newtests.injection.serialization.beans.SerializableBean;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * <p>
+ * Test non serializable parameters in producer methods and @Inject methods.
+ * </p>
+ */
+public class NonSerializableParametersTest extends AbstractUnitTest
+{
+ /**
+ * This tests if the container correctly allows non serializable parameters
+ * for producer methods according to CDI-1.1 spec 6.6.4.
+ */
+ @Test
+ public void testInvalidNonSerializableDependentInjection()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(ProducerWithNonSerializableParameterBean.class);
+ beanClasses.add(SerializableBean.class);
+ beanClasses.add(NonSerializableDependentBean.class);
+
+ try
+ {
+ startContainer(beanClasses, beanXmls);
+ SerializableBean sb = getInstance(SerializableBean.class);
+ Assert.assertNotNull(sb);
+ }
+ finally {
+ shutDownContainer();
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/serialization/beans/NonSerializableDependentBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/serialization/beans/NonSerializableDependentBean.java
new file mode 100644
index 0000000..4730ee4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/serialization/beans/NonSerializableDependentBean.java
@@ -0,0 +1,26 @@
+/*
+ * 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.webbeans.newtests.injection.serialization.beans;
+
+/**
+ * A non-serializable @Dependent scoped bean.
+ */
+public class NonSerializableDependentBean
+{
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/serialization/beans/ProducerWithNonSerializableParameterBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/serialization/beans/ProducerWithNonSerializableParameterBean.java
new file mode 100644
index 0000000..21d8bd5
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/serialization/beans/ProducerWithNonSerializableParameterBean.java
@@ -0,0 +1,41 @@
+/*
+ * 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.webbeans.newtests.injection.serialization.beans;
+
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.Produces;
+
+/**
+ * Producer method with non serializable producer method parameters.
+ * See specification issues CDI-140, CDI-141 and CDI-153.
+ * @since CDI-1.1
+ */
+public class ProducerWithNonSerializableParameterBean
+{
+
+ /**
+ * Non serializable parameters did crush in CDI-1.0 but are fine in CDI-1.1.
+ */
+ @Produces
+ @SessionScoped
+ public SerializableBean newSerializableBean(NonSerializableDependentBean someParameter)
+ {
+ return new SerializableBean();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/serialization/beans/ProducerWithNonSerializableResultBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/serialization/beans/ProducerWithNonSerializableResultBean.java
new file mode 100644
index 0000000..8d8b1ff
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/serialization/beans/ProducerWithNonSerializableResultBean.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.injection.serialization.beans;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+
+/**
+ * Producer method with non serializable producer method result.
+ * See specification issues CDI-140, CDI-141 and CDI-153.
+ */
+@ApplicationScoped
+public class ProducerWithNonSerializableResultBean
+{
+
+ /**
+ * Non serializable parameters did crush in CDI-1.0 but are fine in CDI-1.1.
+ */
+ @Produces
+ public NonSerializableDependentBean newNonSerializableBean()
+ {
+ return new NonSerializableDependentBean();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/serialization/beans/SerializableBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/serialization/beans/SerializableBean.java
new file mode 100644
index 0000000..e1f77d3
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/serialization/beans/SerializableBean.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.newtests.injection.serialization.beans;
+
+import java.io.Serializable;
+
+import javax.enterprise.inject.Typed;
+
+/**
+ * Simple serializable bean.
+ */
+@Typed()
+public class SerializableBean implements Serializable {
+
+ /**
+ * Serial version UID.
+ */
+ private static final long serialVersionUID = 1L;
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/serialization/beans/SerializableDependentInjectionTarget.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/serialization/beans/SerializableDependentInjectionTarget.java
new file mode 100644
index 0000000..5198925
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/serialization/beans/SerializableDependentInjectionTarget.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.injection.serialization.beans;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.Dependent;
+import javax.inject.Inject;
+
+@Dependent
+public class SerializableDependentInjectionTarget implements Serializable
+{
+ private @Inject NonSerializableDependentBean injectedBean;
+
+ public NonSerializableDependentBean getInjectedBean() {
+ return injectedBean;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/serialization/beans/SerializableInjectionTargetFailA.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/serialization/beans/SerializableInjectionTargetFailA.java
new file mode 100644
index 0000000..19cf4e3
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/serialization/beans/SerializableInjectionTargetFailA.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.injection.serialization.beans;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+import java.io.Serializable;
+
+/**
+ *
+ */
+@SessionScoped
+public class SerializableInjectionTargetFailA implements Serializable
+{
+ // this must fail because a plain inject of a non-serializable
+ // bean into a passivating bean is not allowed.
+ private @Inject NonSerializableDependentBean injectedBean;
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/Pencil.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/Pencil.java
new file mode 100644
index 0000000..30e33f5
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/Pencil.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.newtests.injection.typeliteral;
+
+class Pencil<T>
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java
new file mode 100644
index 0000000..845a06b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java
@@ -0,0 +1,54 @@
+/*
+ * 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.webbeans.newtests.injection.typeliteral;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.util.TypeLiteral;
+
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Test;
+
+public class TypeLiteralTest extends AbstractUnitTest
+{
+ @SuppressWarnings("serial")
+ @Test
+ public void testDependentProducerMethodInjectionPoint()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(Pencil.class);
+ beanClasses.add(XXPencil.class);
+ beanClasses.add(YYPencil.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ Set<Bean<?>> bean = getBeanManager().getBeans(new TypeLiteral<Pencil<Ypencil>>(){}.getType(), new Annotation[0]);
+ System.out.println(bean.size());
+
+ shutDownContainer();
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/XXPencil.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/XXPencil.java
new file mode 100644
index 0000000..3b61270
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/XXPencil.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.newtests.injection.typeliteral;
+
+public class XXPencil extends Pencil<Xpencil>
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/Xpencil.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/Xpencil.java
new file mode 100644
index 0000000..1fea2bb
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/Xpencil.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.newtests.injection.typeliteral;
+
+public interface Xpencil
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/YYPencil.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/YYPencil.java
new file mode 100644
index 0000000..ae9f2e0
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/YYPencil.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.newtests.injection.typeliteral;
+
+public class YYPencil extends Pencil<Ypencil>
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/Ypencil.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/Ypencil.java
new file mode 100644
index 0000000..11a7e23
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/Ypencil.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.newtests.injection.typeliteral;
+
+public interface Ypencil extends Xpencil
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/unused/UnusedBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/unused/UnusedBean.java
new file mode 100644
index 0000000..e51d03b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/unused/UnusedBean.java
@@ -0,0 +1,41 @@
+/*
+ * 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.webbeans.newtests.injection.unused;
+
+import javax.enterprise.inject.Typed;
+
+/**
+ * This bean will acually never been touched.
+ */
+@Typed
+public class UnusedBean
+{
+
+ private int i;
+
+ public int getI()
+ {
+ return i;
+ }
+
+ public void setI(int i)
+ {
+ this.i = i;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/unused/UnusedBeanDeclarer.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/unused/UnusedBeanDeclarer.java
new file mode 100644
index 0000000..b27b677
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/unused/UnusedBeanDeclarer.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.newtests.injection.unused;
+
+import javax.inject.Inject;
+
+/**
+ * This class declares the UnusedBean as injectionpoint
+ * but never uses it. Thus it should never get resolved and
+ * only the proxy should exist!
+ */
+public class UnusedBeanDeclarer
+{
+ private @Inject UnusedBean unusedBean;
+
+ public int doSomething()
+ {
+ return 42;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/unused/UnusedBeanProducer.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/unused/UnusedBeanProducer.java
new file mode 100644
index 0000000..2fa30b7
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/unused/UnusedBeanProducer.java
@@ -0,0 +1,45 @@
+/*
+ * 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.webbeans.newtests.injection.unused;
+
+import org.junit.Assert;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+
+/**
+ * producer of our unused bean
+ */
+public class UnusedBeanProducer
+{
+ public static boolean failed = false;
+
+ @Produces @RequestScoped
+ public UnusedBean createUnusedBean()
+ {
+ return new UnusedBean();
+ }
+
+ public void dispose(@Disposes UnusedBean unusedBean)
+ {
+ failed = true;
+ Assert.fail("we should not dispose not-created beans ;)");
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/unused/UnusedBeanTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/unused/UnusedBeanTest.java
new file mode 100644
index 0000000..d931663
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/unused/UnusedBeanTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.webbeans.newtests.injection.unused;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Test;
+import org.junit.Assert;
+
+import javax.enterprise.context.RequestScoped;
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * <p>This test validates OWBs behaviour with unused beans.</p>
+ */
+public class UnusedBeanTest extends AbstractUnitTest
+{
+ @Test
+ public void testUnusedBean()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(UnusedBean.class);
+ beanClasses.add(UnusedBeanProducer.class);
+ beanClasses.add(UnusedBeanDeclarer.class);
+
+ try
+ {
+ startContainer(beanClasses, beanXmls);
+
+ UnusedBeanDeclarer unusedBeanDeclarer = getInstance(UnusedBeanDeclarer.class);
+ Assert.assertNotNull(unusedBeanDeclarer);
+
+ unusedBeanDeclarer.doSomething();
+
+ // end the RequestScope to trigger disposal
+ getWebBeansContext().getContextsService().endContext(RequestScoped.class, null);
+ Assert.assertFalse(UnusedBeanProducer.failed);
+
+ }
+ finally {
+ shutDownContainer();
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/instance/InstanceIteratorTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/instance/InstanceIteratorTest.java
new file mode 100644
index 0000000..b17f7f1
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/instance/InstanceIteratorTest.java
@@ -0,0 +1,159 @@
+/*
+ * 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.webbeans.newtests.instance;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Test;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+import javax.inject.Qualifier;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import junit.framework.Assert;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+
+public class InstanceIteratorTest extends AbstractUnitTest
+{
+ @Test
+ public void testInstanceIteratorWithBeanSelector() {
+ startContainer(
+ Qualifier1.class,
+ Qualifier2.class,
+ ShardContract.class,
+ Bean1.class,
+ Bean2.class,
+ BeanSelector.class,
+ InstanceHolder.class);
+
+ InstanceHolder instanceHolder = getInstance(InstanceHolder.class);
+ assertNotNull(instanceHolder);
+
+ Instance<ShardContract> instance = instanceHolder.getInstance();
+
+ int count = 0;
+
+ for (ShardContract ignored : instance)
+ {
+ count++;
+ }
+ assertEquals(3, count); //contextual instances: Bean1, Bean2, 2nd instance of Bean1 exposed by the producer
+ }
+
+ @Test
+ public void testInstanceIteratorWithoutImpl()
+ {
+ startContainer(InstanceIteratorHolder.class);
+
+ InstanceIteratorHolder instanceIteratorHolder = getInstance(InstanceIteratorHolder.class);
+ assertNotNull(instanceIteratorHolder);
+
+ Assert.assertFalse(instanceIteratorHolder.iterateOverContracts());
+ }
+
+ @Test
+ public void testInstanceIteratorWithImpl()
+ {
+ startContainer(InstanceIteratorHolder.class, Bean1.class);
+
+ InstanceIteratorHolder instanceIteratorHolder = getInstance(InstanceIteratorHolder.class);
+ assertNotNull(instanceIteratorHolder);
+
+ Assert.assertTrue(instanceIteratorHolder.iterateOverContracts());
+ }
+
+ public static class InstanceHolder
+ {
+ @Inject
+ @Any
+ private Instance<ShardContract> instance;
+
+
+ public Instance<ShardContract> getInstance()
+ {
+ return instance;
+ }
+ }
+
+ @RequestScoped
+ public static class InstanceIteratorHolder
+ {
+ @Inject
+ @Any
+ private Instance<ShardContract> instances;
+
+ public boolean iterateOverContracts()
+ {
+ boolean foundSomething = false;
+ for (ShardContract contract: instances)
+ {
+ foundSomething = true;
+ }
+
+ return foundSomething;
+ }
+ }
+
+ @Target({TYPE, METHOD, PARAMETER})
+ @Retention(RUNTIME)
+ @Qualifier
+ public @interface Qualifier1
+ {
+ }
+
+ @Target({TYPE, METHOD, PARAMETER})
+ @Retention(RUNTIME)
+ @Qualifier
+ public @interface Qualifier2
+ {
+ }
+
+ public interface ShardContract
+ {
+ }
+
+ @ApplicationScoped
+ @Qualifier1
+ public static class Bean1 implements ShardContract
+ {
+ }
+
+ @ApplicationScoped
+ @Qualifier2
+ public static class Bean2 implements ShardContract
+ {
+ }
+
+ public static class BeanSelector
+ {
+ @Produces
+ protected ShardContract selectBean(@Qualifier1 ShardContract bean)
+ {
+ return bean; //usually there are different beans -> one gets selected, however, it isn't needed for the test
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/instance/InstanceWithTypedTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/instance/InstanceWithTypedTest.java
new file mode 100644
index 0000000..0a284cf
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/instance/InstanceWithTypedTest.java
@@ -0,0 +1,114 @@
+/*
+ * 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.webbeans.newtests.instance;
+
+import org.apache.webbeans.annotation.DefaultLiteral;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Test;
+
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.Typed;
+import javax.inject.Inject;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import static junit.framework.Assert.assertNotNull;
+
+public class InstanceWithTypedTest extends AbstractUnitTest
+{
+ @Test
+ public void testTypedIsRespected()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(TypedBean.class);
+ beanClasses.add(InstanceHolder.class);
+ beanClasses.add(RealRunnable.class);
+
+ startContainer(beanClasses, null);
+
+ InstanceHolder instance = getInstance(InstanceHolder.class);
+
+ assertNotNull(instance);
+ assertNotNull(instance.getBean());
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testDynamicInstanceResolving() {
+ startContainer(RealRunnable.class, TypedBean.class, InstanceHolder.class);
+
+ InstanceHolder ih = getInstance(InstanceHolder.class);
+ assertNotNull(ih);
+ assertNotNull(ih.getBean());
+
+ // now try to trigger the resolving programmatically
+ Instance<Runnable> instance = ih.getInstance();
+ Runnable r1 = instance.select(DefaultLiteral.INSTANCE).get();
+ assertNotNull(r1);
+
+ Instance<Runnable> instance2 = ih.getDefaultRunnableInstance();
+ Runnable r2 = instance2.select(DefaultLiteral.INSTANCE).get();
+ assertNotNull(r2);
+ }
+
+ public static class InstanceHolder
+ {
+ @Inject
+ @Any
+ private Instance<Runnable> bean;
+
+ @Inject
+ private Instance<Runnable> defaultRunnableInstance;
+
+ public Runnable getBean()
+ {
+ return bean.get();
+ }
+
+ public Instance<Runnable> getInstance()
+ {
+ return bean;
+ }
+
+ public Instance<Runnable> getDefaultRunnableInstance()
+ {
+ return defaultRunnableInstance;
+ }
+ }
+
+ public static class RealRunnable implements Runnable
+ {
+ @Override
+ public void run()
+ {
+ // no-op
+ }
+ }
+
+ @Typed({ TypedBean.class })
+ public static class TypedBean<X> implements Runnable
+ {
+ @Override
+ public void run() {
+ // no-op
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/annotation/DependentInterceptorBindingType.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/annotation/DependentInterceptorBindingType.java
new file mode 100644
index 0000000..1765687
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/annotation/DependentInterceptorBindingType.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.interceptors.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.interceptor.InterceptorBinding;
+
+@InterceptorBinding
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.TYPE, ElementType.METHOD })
+public @interface DependentInterceptorBindingType
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/annotation/LoggingStereoType.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/annotation/LoggingStereoType.java
new file mode 100644
index 0000000..3895e30
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/annotation/LoggingStereoType.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.newtests.interceptors.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.Stereotype;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
+
+@Stereotype
+@Transactional
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface LoggingStereoType
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/annotation/SecureStereoType.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/annotation/SecureStereoType.java
new file mode 100644
index 0000000..6839c52
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/annotation/SecureStereoType.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.newtests.interceptors.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.Stereotype;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Secure;
+
+@Stereotype
+@Secure
+@LoggingStereoType
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface SecureStereoType
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/beans/ApplicationScopedBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/beans/ApplicationScopedBean.java
new file mode 100644
index 0000000..3f4caf0
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/beans/ApplicationScopedBean.java
@@ -0,0 +1,48 @@
+/*
+* 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.webbeans.newtests.interceptors.beans;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
+
+import org.junit.Assert;
+
+@ApplicationScoped
+public class ApplicationScopedBean {
+
+ private int j;
+
+ private @Inject DependentScopedBean dependentScopedBean;
+
+ @Transactional
+ public int getJ() {
+ Assert.assertNotNull(dependentScopedBean);
+ return j;
+ }
+
+ public void setJ(int j) {
+ this.j = j;
+ }
+
+ public DependentScopedBean getDependentScopedBean()
+ {
+ return dependentScopedBean;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/beans/DependentScopedBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/beans/DependentScopedBean.java
new file mode 100644
index 0000000..5a9b1ae
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/beans/DependentScopedBean.java
@@ -0,0 +1,64 @@
+/*
+ * 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.webbeans.newtests.interceptors.beans;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Named;
+
+import org.apache.webbeans.newtests.interceptors.annotation.DependentInterceptorBindingType;
+
+@Named("org.apache.webbeans.newtests.interceptors.beans.DependentScopedBean")
+public class DependentScopedBean
+{
+ public static boolean SAY_HELLO = false;
+
+ public static boolean POST_CONSTRUCT = false;
+
+ public static boolean PRE_DESTROY = false;
+
+ public DependentScopedBean()
+ {
+
+ }
+
+ @DependentInterceptorBindingType
+ public void sayHello()
+ {
+ SAY_HELLO = true;
+ }
+
+ @DependentInterceptorBindingType
+ public void throwException()
+ {
+ throw new RuntimeException("goodbye");
+ }
+
+ @PostConstruct
+ public void postConstruct()
+ {
+ POST_CONSTRUCT = true;
+ }
+
+ @PreDestroy
+ public void preDestroy()
+ {
+ PRE_DESTROY = true;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/beans/RequestScopedBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/beans/RequestScopedBean.java
new file mode 100644
index 0000000..85d3c5d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/beans/RequestScopedBean.java
@@ -0,0 +1,66 @@
+/*
+* 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.webbeans.newtests.interceptors.beans;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@RequestScoped
+@Named
+public class RequestScopedBean
+{
+
+ private int i=0;
+ private @Inject ApplicationScopedBean myService;
+
+ @PostConstruct
+ public void init()
+ {
+ myService.getJ();
+ }
+
+ /** we need this trick, since the injected beans itself are only proxies... */
+ public RequestScopedBean getInstance()
+ {
+ return this;
+ }
+
+ public int getI()
+ {
+ return i;
+ }
+
+ public void setI(int i)
+ {
+ this.i = i;
+ }
+
+ public ApplicationScopedBean getMyService()
+ {
+ return myService;
+ }
+
+ public void setMyService(ApplicationScopedBean myService)
+ {
+ this.myService = myService;
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/broken/BrokenAlternative.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/broken/BrokenAlternative.java
new file mode 100644
index 0000000..94ddfb7
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/broken/BrokenAlternative.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.newtests.interceptors.broken;
+
+import javax.enterprise.inject.Alternative;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
+
+@Interceptor
+@Transactional
+@Alternative
+public class BrokenAlternative
+{
+ public Object invoke(InvocationContext ctx) throws Exception
+ {
+ return null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/broken/BrokenBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/broken/BrokenBean.java
new file mode 100644
index 0000000..fd4cf56
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/broken/BrokenBean.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.newtests.interceptors.broken;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
+
+@Transactional
+public class BrokenBean implements IBroken
+{
+
+ @Override
+ public void broke()
+ {
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/broken/BrokenName.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/broken/BrokenName.java
new file mode 100644
index 0000000..c48d201
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/broken/BrokenName.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.newtests.interceptors.broken;
+
+import javax.inject.Named;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
+
+@Interceptor
+@Transactional
+@Named
+public class BrokenName
+{
+ public Object invoke(InvocationContext ctx) throws Exception
+ {
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/broken/BrokenScope.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/broken/BrokenScope.java
new file mode 100644
index 0000000..7f89e20
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/broken/BrokenScope.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.newtests.interceptors.broken;
+
+import javax.enterprise.context.RequestScoped;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
+
+
+@Interceptor
+@Transactional
+@RequestScoped
+public class BrokenScope
+{
+ public Object invoke(InvocationContext ctx) throws Exception
+ {
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/broken/BrokenTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/broken/BrokenTest.java
new file mode 100644
index 0000000..2adc45a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/broken/BrokenTest.java
@@ -0,0 +1,50 @@
+/*
+ * 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.webbeans.newtests.interceptors.broken;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Test;
+
+public class BrokenTest extends AbstractUnitTest
+{
+
+ public static final String PACKAGE_NAME = BrokenTest.class.getPackage().getName();
+
+ @Test
+ public void testWarnings()
+ {
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(BrokenBean.class);
+ classes.add(BrokenScope.class);
+ classes.add(BrokenAlternative.class);
+ classes.add(BrokenName.class);
+
+ Collection<String> xmls = new ArrayList<String>();
+ xmls.add(getXmlPath(PACKAGE_NAME, "BrokenTest"));
+
+ startContainer(classes,xmls);
+
+ shutDownContainer();
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/broken/IBroken.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/broken/IBroken.java
new file mode 100644
index 0000000..ccb4366
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/broken/IBroken.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.newtests.interceptors.broken;
+
+public interface IBroken
+{
+ public void broke();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/common/RuntimeExceptionBindingTypeBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/common/RuntimeExceptionBindingTypeBean.java
new file mode 100644
index 0000000..cca1da6
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/common/RuntimeExceptionBindingTypeBean.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.interceptors.business.common;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.RuntimeExceptions;
+
+import javax.enterprise.context.RequestScoped;
+
+
+@RequestScoped
+public class RuntimeExceptionBindingTypeBean
+{
+
+ @RuntimeExceptions
+ public int business() throws Exception
+ {
+ return 42;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/common/TransactionalBaseBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/common/TransactionalBaseBean.java
new file mode 100644
index 0000000..dfb2447
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/common/TransactionalBaseBean.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.interceptors.business.common;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Secure;
+
+import javax.enterprise.context.RequestScoped;
+
+/**
+ * This class will get inherited.
+ */
+@RequestScoped
+public class TransactionalBaseBean
+{
+
+ /**
+ * calling this method from outside should still trigger the Secure interceptor
+ */
+ @Secure
+ public String doBase()
+ {
+ return "42";
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/common/TransactionalChildBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/common/TransactionalChildBean.java
new file mode 100644
index 0000000..961e316
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/common/TransactionalChildBean.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.interceptors.business.common;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Secure;
+
+import javax.enterprise.context.RequestScoped;
+
+/**
+ * This class extends a bean with intercepted methods.
+ */
+@RequestScoped
+public class TransactionalChildBean extends TransactionalBaseBean
+{
+
+ /**
+ * calling this method from outside should also trigger the Secure interceptor
+ */
+ @Secure
+ public String doHalf()
+ {
+ return "21";
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/common/WithInheritedBindingTypeBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/common/WithInheritedBindingTypeBean.java
new file mode 100644
index 0000000..08407b7
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/common/WithInheritedBindingTypeBean.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.newtests.interceptors.business.common;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Named;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Secure;
+
+@Named("org.apache.webbeans.newtests.interceptors.business.common.WithInheritedBindingTypeBean")
+@RequestScoped
+@Secure
+public class WithInheritedBindingTypeBean
+{
+
+ public void business()
+ {
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/common/WithInheritedStereoTypeInterceptorBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/common/WithInheritedStereoTypeInterceptorBean.java
new file mode 100644
index 0000000..7bd48bd
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/common/WithInheritedStereoTypeInterceptorBean.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.interceptors.business.common;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Named;
+
+import org.apache.webbeans.newtests.interceptors.annotation.SecureStereoType;
+
+@SecureStereoType
+@RequestScoped
+@Named("org.apache.webbeans.newtests.interceptors.business.common.WithInheritedStereoTypeInterceptorBean")
+public class WithInheritedStereoTypeInterceptorBean
+{
+ public void businessMethod()
+ {
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/common/WithStereoTypeInterceptorBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/common/WithStereoTypeInterceptorBean.java
new file mode 100644
index 0000000..2fc21f2
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/common/WithStereoTypeInterceptorBean.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.newtests.interceptors.business.common;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Named;
+
+import org.apache.webbeans.newtests.interceptors.annotation.LoggingStereoType;
+
+@LoggingStereoType
+@RequestScoped
+@Named("org.apache.webbeans.newtests.interceptors.business.common.WithStereoTypeInterceptorBean")
+public class WithStereoTypeInterceptorBean
+{
+ public void sayHello()
+ {
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/tests/DependingInterceptorTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/tests/DependingInterceptorTest.java
new file mode 100644
index 0000000..d4df3da
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/tests/DependingInterceptorTest.java
@@ -0,0 +1,147 @@
+/*
+ * 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.webbeans.newtests.interceptors.business.tests;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.interceptors.beans.ApplicationScopedBean;
+import org.apache.webbeans.newtests.interceptors.beans.DependentScopedBean;
+import org.apache.webbeans.newtests.interceptors.beans.RequestScopedBean;
+import org.apache.webbeans.newtests.interceptors.common.TransactionInterceptor;
+import org.junit.Test;
+
+@SuppressWarnings("unchecked")
+public class DependingInterceptorTest extends AbstractUnitTest
+{
+ private static final String PACKAGE_NAME = DependingInterceptorTest.class.getPackage().getName();
+
+ @Test
+ public void testDependingBeanInterceptor()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "DependingInterceptorTest"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(TransactionInterceptor.class);
+ beanClasses.add(ApplicationScopedBean.class);
+ beanClasses.add(RequestScopedBean.class);
+ beanClasses.add(DependentScopedBean.class);
+
+ TransactionInterceptor.count = 0;
+
+ startContainer(beanClasses, beanXmls);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans(RequestScopedBean.class);
+ Assert.assertNotNull(beans);
+ Bean<RequestScopedBean> bean = (Bean<RequestScopedBean>)beans.iterator().next();
+
+ CreationalContext<RequestScopedBean> ctx = getBeanManager().createCreationalContext(bean);
+
+ Object reference1 = getBeanManager().getReference(bean, RequestScopedBean.class, ctx);
+ Assert.assertNotNull(reference1);
+
+ Assert.assertTrue(reference1 instanceof RequestScopedBean);
+
+ RequestScopedBean beanInstance1 = (RequestScopedBean)reference1;
+
+ TransactionInterceptor.count = 0;
+
+ beanInstance1.getMyService().getJ();
+
+ RequestScopedBean realInstance1 = beanInstance1.getInstance();
+
+ Assert.assertTrue(TransactionInterceptor.ECHO);
+ Assert.assertEquals(2, TransactionInterceptor.count);
+
+ TransactionInterceptor.ECHO = false;
+
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ webBeansContext.getContextFactory().destroyRequestContext(null);
+ webBeansContext.getContextFactory().initRequestContext(null);
+
+ CreationalContext<RequestScopedBean> ctx2 = getBeanManager().createCreationalContext(bean);
+ Object reference2 = getBeanManager().getReference(bean, RequestScopedBean.class, ctx2);
+ Assert.assertNotNull(reference2);
+
+ Assert.assertTrue(reference2 instanceof RequestScopedBean);
+
+ RequestScopedBean beanInstance2 = (RequestScopedBean)reference2;
+ beanInstance2.getMyService().getJ();
+ RequestScopedBean realInstance2 = beanInstance2.getInstance();
+
+ Assert.assertTrue(TransactionInterceptor.ECHO);
+
+ Assert.assertEquals(4, TransactionInterceptor.count);
+
+ Assert.assertNotSame(realInstance1, realInstance2);
+ Assert.assertEquals(realInstance1.getMyService().getJ(), realInstance2.getMyService().getJ());
+
+ shutDownContainer();
+
+ }
+
+ @Test
+ public void testInterceptorCreation() throws Exception
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "DependingInterceptorTest"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(TransactionInterceptor.class);
+ beanClasses.add(ApplicationScopedBean.class);
+ beanClasses.add(DependentScopedBean.class);
+
+ TransactionInterceptor.count = 0;
+ TransactionInterceptor.interceptorCount = 0;
+
+ startContainer(beanClasses, beanXmls);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans(ApplicationScopedBean.class);
+ Assert.assertNotNull(beans);
+ Bean<ApplicationScopedBean> bean = (Bean<ApplicationScopedBean>)beans.iterator().next();
+
+ CreationalContext<ApplicationScopedBean> ctx = getBeanManager().createCreationalContext(bean);
+
+ Object reference1 = getBeanManager().getReference(bean, ApplicationScopedBean.class, ctx);
+ Assert.assertNotNull(reference1);
+
+ ApplicationScopedBean app = (ApplicationScopedBean) reference1;
+
+ app.getJ();
+ Assert.assertEquals(1, TransactionInterceptor.interceptorCount);
+ Assert.assertEquals(1, TransactionInterceptor.count);
+
+ app.getJ();
+ Assert.assertEquals(1, TransactionInterceptor.interceptorCount);
+ Assert.assertEquals(2, TransactionInterceptor.count);
+
+ app.getJ();
+ Assert.assertEquals(1, TransactionInterceptor.interceptorCount);
+ Assert.assertEquals(3, TransactionInterceptor.count);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/tests/ExceptionInterceptorTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/tests/ExceptionInterceptorTest.java
new file mode 100644
index 0000000..c77d910
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/tests/ExceptionInterceptorTest.java
@@ -0,0 +1,57 @@
+/*
+ * 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.webbeans.newtests.interceptors.business.tests;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.interceptors.business.common.RuntimeExceptionBindingTypeBean;
+import org.apache.webbeans.newtests.interceptors.common.RuntimeExceptionsInterceptor;
+import org.junit.Test;
+import org.junit.Assert;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+@SuppressWarnings("unchecked")
+public class ExceptionInterceptorTest extends AbstractUnitTest
+{
+ private static final String PACKAGE_NAME = ExceptionInterceptorTest.class.getPackage().getName();
+
+ @Test
+ public void testAroundInvokeWithoutThrowsException() throws Exception
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "RuntimeExceptionsInterceptorTest"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(RuntimeExceptionsInterceptor.class);
+ beanClasses.add(RuntimeExceptionBindingTypeBean.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ RuntimeExceptionBindingTypeBean instance = getInstance(RuntimeExceptionBindingTypeBean.class);
+
+ Assert.assertNotNull(instance);
+
+ int result = instance.business();
+ Assert.assertEquals(42, result);
+
+ shutDownContainer();
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/tests/InheritedBeanInterceptorTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/tests/InheritedBeanInterceptorTest.java
new file mode 100644
index 0000000..f9e9771
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/tests/InheritedBeanInterceptorTest.java
@@ -0,0 +1,70 @@
+/*
+ * 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.webbeans.newtests.interceptors.business.tests;
+
+import junit.framework.Assert;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.interceptors.business.common.TransactionalBaseBean;
+import org.apache.webbeans.newtests.interceptors.business.common.TransactionalChildBean;
+import org.apache.webbeans.newtests.interceptors.common.TransactionInterceptor;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+@SuppressWarnings("unchecked")
+public class InheritedBeanInterceptorTest extends AbstractUnitTest
+{
+ private static final String PACKAGE_NAME = InheritedBeanInterceptorTest.class.getPackage().getName();
+
+ @Test
+ public void testStereoTypeBasedInterceptor()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "InheritedBeanInterceptorTest"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(TransactionInterceptor.class);
+ beanClasses.add(TransactionalBaseBean.class);
+ beanClasses.add(TransactionalChildBean.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ TransactionInterceptor.ECHO = false;
+ TransactionInterceptor.count = 0;
+
+ TransactionalChildBean child = getInstance(TransactionalChildBean.class);
+ Assert.assertNotNull(child);
+ Assert.assertEquals(0, TransactionInterceptor.count);
+
+ Assert.assertEquals("21", child.doHalf());
+ Assert.assertTrue(TransactionInterceptor.ECHO);
+ Assert.assertEquals(1, TransactionInterceptor.count);
+
+ TransactionInterceptor.ECHO = false;
+ TransactionInterceptor.count = 0;
+
+ Assert.assertEquals("42", child.doBase());
+ Assert.assertTrue(TransactionInterceptor.ECHO);
+ Assert.assertEquals(1, TransactionInterceptor.count);
+
+ shutDownContainer();
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/tests/InterceptorPerformanceTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/tests/InterceptorPerformanceTest.java
new file mode 100644
index 0000000..cc3b523
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/tests/InterceptorPerformanceTest.java
@@ -0,0 +1,160 @@
+/*
+ * 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.webbeans.newtests.interceptors.business.tests;
+
+import junit.framework.Assert;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.interceptors.beans.ApplicationScopedBean;
+import org.apache.webbeans.newtests.interceptors.beans.DependentScopedBean;
+import org.apache.webbeans.newtests.interceptors.beans.RequestScopedBean;
+import org.apache.webbeans.newtests.interceptors.common.TransactionInterceptor;
+import org.junit.Test;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * This test checks the performance of simple interceptor invocations.
+ * It is usually enabled with only a few iteration cycles.
+ */
+@SuppressWarnings("unchecked")
+public class InterceptorPerformanceTest extends AbstractUnitTest
+{
+ private static final String PACKAGE_NAME = DependingInterceptorTest.class.getPackage().getName();
+
+ private static final int ITERATIONS = 1000;
+ private static final int NUM_THREADS = 50;
+
+ private static Logger logger = WebBeansLoggerFacade.getLogger(InterceptorPerformanceTest.class);
+
+
+ @Test
+ public void testInterceptorPerformance() throws Exception
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "DependingInterceptorTest"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(TransactionInterceptor.class);
+ beanClasses.add(ApplicationScopedBean.class);
+ beanClasses.add(RequestScopedBean.class);
+ beanClasses.add(DependentScopedBean.class);
+
+ TransactionInterceptor.count = 0;
+
+ startContainer(beanClasses, beanXmls);
+
+ long start = System.nanoTime();
+
+ // START THREADS
+ CalculationRunner[] threads = new CalculationRunner[NUM_THREADS];
+ for (int i= 0 ; i < NUM_THREADS; i++)
+ {
+ threads[i] = new CalculationRunner("t" + i);
+ threads[i].start();
+ }
+
+ for (int i= 0 ; i < NUM_THREADS; i++)
+ {
+ threads[i].join();
+ Assert.assertFalse(threads[i].isFailed());
+ }
+
+
+ long end = System.nanoTime();
+
+ logger.log(Level.INFO, "Executing {0} iterations took {1} ns", WebBeansLoggerFacade.args(ITERATIONS, end - start));
+
+ shutDownContainer();
+
+ if ((end - start) / 1e6 > ITERATIONS*10)
+ {
+ // if it takes longer than 1ms for each iteration, then this is really a performance blocker!
+ Assert.fail("Performance test took more than 20 times longer than it should");
+ }
+
+ }
+
+ public class CalculationRunner extends Thread
+ {
+ private String threadName;
+
+ private boolean failed = false;
+
+ public CalculationRunner(String name)
+ {
+ super(name);
+ threadName = name;
+ }
+
+ public boolean isFailed() {
+ return failed;
+ }
+
+ @Override
+ public void run()
+ {
+ try
+ {
+ for (int req = 0; req < 5; req++)
+ {
+ WebBeansContext.currentInstance().getContextFactory().initRequestContext(null);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans(RequestScopedBean.class);
+ Assert.assertNotNull(beans);
+ Bean<RequestScopedBean> bean = (Bean<RequestScopedBean>)beans.iterator().next();
+
+ CreationalContext<RequestScopedBean> ctx = getBeanManager().createCreationalContext(bean);
+
+ Object reference1 = getBeanManager().getReference(bean, RequestScopedBean.class, ctx);
+ Assert.assertNotNull(reference1);
+
+ Assert.assertTrue(reference1 instanceof RequestScopedBean);
+
+ RequestScopedBean beanInstance1 = (RequestScopedBean)reference1;
+
+ TransactionInterceptor.count = 0;
+
+ long start = System.nanoTime();
+
+ for (int i= 1; i < ITERATIONS; i++)
+ {
+ beanInstance1.getI();
+ beanInstance1.getMyService().getJ();
+ }
+
+ WebBeansContext.currentInstance().getContextFactory().destroyRequestContext(null);
+ }
+ }
+ catch (Exception e)
+ {
+ logger.log(Level.SEVERE, "Concurrency problem in InterceptorPerformanceTest detected in thread " + threadName, e);
+ failed = true;
+ }
+ }
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/tests/MultiRequestProxyTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/tests/MultiRequestProxyTest.java
new file mode 100644
index 0000000..c3c6fd9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/tests/MultiRequestProxyTest.java
@@ -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.webbeans.newtests.interceptors.business.tests;
+
+import javax.enterprise.context.RequestScoped;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import junit.framework.Assert;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.interceptors.beans.ApplicationScopedBean;
+import org.apache.webbeans.newtests.interceptors.beans.DependentScopedBean;
+import org.apache.webbeans.newtests.interceptors.beans.RequestScopedBean;
+import org.apache.webbeans.newtests.interceptors.common.TransactionInterceptor;
+import org.junit.Test;
+
+@SuppressWarnings("unchecked")
+public class MultiRequestProxyTest extends AbstractUnitTest
+{
+ private static final String PACKAGE_NAME = MultiRequestProxyTest.class.getPackage().getName();
+
+ @Test
+ public void testMultiRequestProxying()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "DependingInterceptorTest"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(TransactionInterceptor.class);
+ beanClasses.add(ApplicationScopedBean.class);
+ beanClasses.add(RequestScopedBean.class);
+ beanClasses.add(DependentScopedBean.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ for (int i = 1; i < 100; i++)
+ {
+ RequestScopedBean rb1 = getInstance("requestScopedBean");
+ Assert.assertNotNull(rb1);
+ Assert.assertNotNull(rb1.getInstance());
+
+ getLifecycle().getContextService().endContext(RequestScoped.class, null);
+
+ // and now the 2nd request
+ getLifecycle().getContextService().startContext(RequestScoped.class, null);
+ }
+
+ shutDownContainer();
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/tests/NewProxyTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/tests/NewProxyTest.java
new file mode 100644
index 0000000..e877eda
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/tests/NewProxyTest.java
@@ -0,0 +1,94 @@
+/*
+ * 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.webbeans.newtests.interceptors.business.tests;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InterceptionType;
+import javax.enterprise.inject.spi.Interceptor;
+import javax.enterprise.util.AnnotationLiteral;
+
+import org.apache.webbeans.intercept.DefaultInterceptorHandler;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.interceptors.business.common.RuntimeExceptionBindingTypeBean;
+import org.apache.webbeans.newtests.interceptors.common.RuntimeExceptionsInterceptor;
+import org.apache.webbeans.proxy.InterceptorDecoratorProxyFactory;
+import org.apache.webbeans.proxy.InterceptorHandler;
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.RuntimeExceptions;
+import org.junit.Assert;
+import org.junit.Test;
+
+@SuppressWarnings("unchecked")
+public class NewProxyTest extends AbstractUnitTest
+{
+ private static final String PACKAGE_NAME = NewProxyTest.class.getPackage().getName();
+
+ @Test
+ public void testAroundInvokeWithoutThrowsException() throws Exception
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "RuntimeExceptionsInterceptorTest"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(RuntimeExceptionsInterceptor.class);
+ beanClasses.add(RuntimeExceptionBindingTypeBean.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ BeanManager beanManager = getBeanManager();
+ Interceptor interceptorBean = beanManager.resolveInterceptors(InterceptionType.AROUND_INVOKE, new AnnotationLiteral<RuntimeExceptions>() {}).iterator().next();
+ Bean bean = beanManager.resolve(beanManager.getBeans(RuntimeExceptionBindingTypeBean.class));
+ CreationalContext creationalContext = beanManager.createCreationalContext(bean);
+
+ // we cannot use the container to create the proxy as it already proxies the internal instance
+ RuntimeExceptionBindingTypeBean target = new RuntimeExceptionBindingTypeBean();
+
+ RuntimeExceptionsInterceptor interceptor = (RuntimeExceptionsInterceptor) interceptorBean.create(creationalContext);
+
+ Method[] interceptedMethods = {RuntimeExceptionBindingTypeBean.class.getMethod("business")};
+ Map<Method, List<Interceptor<?>>> interceptors = new HashMap<Method, List<Interceptor<?>>>();
+ interceptors.put(interceptedMethods[0], Arrays.<Interceptor<?>> asList(interceptorBean));
+ Map instances = new HashMap();
+ instances.put(interceptorBean, interceptor);
+ InterceptorHandler interceptorHandler
+ = new DefaultInterceptorHandler<RuntimeExceptionBindingTypeBean>(target, target, interceptors, instances, null);
+
+ InterceptorDecoratorProxyFactory factory = new InterceptorDecoratorProxyFactory(getWebBeansContext());
+ Class<RuntimeExceptionBindingTypeBean> proxyClass
+ = factory.createProxyClass(bean, Thread.currentThread().getContextClassLoader(), RuntimeExceptionBindingTypeBean.class, interceptedMethods, null);
+
+ RuntimeExceptionBindingTypeBean instance = factory.createProxyInstance(proxyClass, target, interceptorHandler);
+ int result = instance.business();
+ Assert.assertEquals(42, result);
+
+ Assert.assertEquals(1, interceptor.invoked);
+
+ shutDownContainer();
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/tests/WithInheritedBindingTypeTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/tests/WithInheritedBindingTypeTest.java
new file mode 100644
index 0000000..4602e50
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/tests/WithInheritedBindingTypeTest.java
@@ -0,0 +1,89 @@
+/*
+ * 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.webbeans.newtests.interceptors.business.tests;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.interceptors.business.common.WithInheritedBindingTypeBean;
+import org.apache.webbeans.newtests.interceptors.common.SecureInterceptor;
+import org.apache.webbeans.newtests.interceptors.common.TransactionInterceptor;
+import org.junit.Test;
+
+@SuppressWarnings("unchecked")
+public class WithInheritedBindingTypeTest extends AbstractUnitTest
+{
+ private static final String PACKAGE_NAME = WithInheritedBindingTypeTest.class.getPackage().getName();
+
+ @Test
+ public void testStereoTypeBasedInterceptor()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "WithInheritedBindingTypeTest"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(TransactionInterceptor.class);
+ beanClasses.add(SecureInterceptor.class);
+ beanClasses.add(WithInheritedBindingTypeBean.class);
+
+ TransactionInterceptor.count = 0;
+
+ startContainer(beanClasses, beanXmls);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans("org.apache.webbeans.newtests.interceptors.business.common.WithInheritedBindingTypeBean");
+ Assert.assertNotNull(beans);
+ Bean<WithInheritedBindingTypeBean> bean = (Bean<WithInheritedBindingTypeBean>)beans.iterator().next();
+
+ CreationalContext<WithInheritedBindingTypeBean> ctx = getBeanManager().createCreationalContext(bean);
+
+ Object reference = getBeanManager().getReference(bean, WithInheritedBindingTypeBean.class, ctx);
+ Assert.assertNotNull(reference);
+
+ Assert.assertTrue(reference instanceof WithInheritedBindingTypeBean);
+
+ WithInheritedBindingTypeBean beanInstance = (WithInheritedBindingTypeBean)reference;
+
+ beanInstance.business();
+
+
+ Assert.assertTrue(TransactionInterceptor.ECHO);
+ Assert.assertTrue(SecureInterceptor.ECHO);
+
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ webBeansContext.getContextFactory().destroyRequestContext(null);
+ webBeansContext.getContextFactory().initRequestContext(null);
+
+ reference = getBeanManager().getReference(bean, WithInheritedBindingTypeBean.class, ctx);
+ beanInstance = (WithInheritedBindingTypeBean)reference;
+ beanInstance.business();
+
+ Assert.assertEquals(2, TransactionInterceptor.count);
+
+ shutDownContainer();
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/tests/WithInheritedStereoTypeInterceptorTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/tests/WithInheritedStereoTypeInterceptorTest.java
new file mode 100644
index 0000000..292e3f9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/tests/WithInheritedStereoTypeInterceptorTest.java
@@ -0,0 +1,81 @@
+/*
+ * 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.webbeans.newtests.interceptors.business.tests;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.interceptors.business.common.WithInheritedStereoTypeInterceptorBean;
+import org.apache.webbeans.newtests.interceptors.common.SecureInterceptor;
+import org.apache.webbeans.newtests.interceptors.common.TransactionInterceptor;
+import org.junit.Test;
+
+public class WithInheritedStereoTypeInterceptorTest extends AbstractUnitTest
+{
+ private static final String PACKAGE_NAME = WithStereoTypeInterceptorTest.class.getPackage().getName();
+
+ public WithInheritedStereoTypeInterceptorTest()
+ {
+
+ }
+
+ @Test
+ @SuppressWarnings("unchecked")
+ public void testInheritedStereoTypeWihtInterceptorBinding()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "WithInheritedStereoTypeInterceptorTest"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(TransactionInterceptor.class);
+ beanClasses.add(SecureInterceptor.class);
+ beanClasses.add(WithInheritedStereoTypeInterceptorBean.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans("org.apache.webbeans.newtests.interceptors.business.common.WithInheritedStereoTypeInterceptorBean");
+ Assert.assertNotNull(beans);
+ Bean<WithInheritedStereoTypeInterceptorBean> bean = (Bean<WithInheritedStereoTypeInterceptorBean>)beans.iterator().next();
+
+ CreationalContext<WithInheritedStereoTypeInterceptorBean> ctx = getBeanManager().createCreationalContext(bean);
+
+ Object reference = getBeanManager().getReference(bean, WithInheritedStereoTypeInterceptorBean.class, ctx);
+ Assert.assertNotNull(reference);
+
+ Assert.assertTrue(reference instanceof WithInheritedStereoTypeInterceptorBean);
+
+ WithInheritedStereoTypeInterceptorBean beanInstance = (WithInheritedStereoTypeInterceptorBean)reference;
+
+ beanInstance.businessMethod();
+
+ Assert.assertTrue(TransactionInterceptor.ECHO);
+ Assert.assertTrue(SecureInterceptor.ECHO);
+
+ shutDownContainer();
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/tests/WithStereoTypeInterceptorTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/tests/WithStereoTypeInterceptorTest.java
new file mode 100644
index 0000000..3f57204
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/business/tests/WithStereoTypeInterceptorTest.java
@@ -0,0 +1,72 @@
+/*
+ * 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.webbeans.newtests.interceptors.business.tests;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.interceptors.business.common.WithStereoTypeInterceptorBean;
+import org.apache.webbeans.newtests.interceptors.common.TransactionInterceptor;
+import org.junit.Test;
+
+@SuppressWarnings("unchecked")
+public class WithStereoTypeInterceptorTest extends AbstractUnitTest
+{
+ private static final String PACKAGE_NAME = WithStereoTypeInterceptorTest.class.getPackage().getName();
+
+ @Test
+ public void testStereoTypeBasedInterceptor()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "WithStereoTypeInterceptorTest"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(TransactionInterceptor.class);
+ beanClasses.add(WithStereoTypeInterceptorBean.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans("org.apache.webbeans.newtests.interceptors.business.common.WithStereoTypeInterceptorBean");
+ Assert.assertNotNull(beans);
+ Bean<WithStereoTypeInterceptorBean> bean = (Bean<WithStereoTypeInterceptorBean>)beans.iterator().next();
+
+ CreationalContext<WithStereoTypeInterceptorBean> ctx = getBeanManager().createCreationalContext(bean);
+
+ Object reference = getBeanManager().getReference(bean, WithStereoTypeInterceptorBean.class, ctx);
+ Assert.assertNotNull(reference);
+
+ Assert.assertTrue(reference instanceof WithStereoTypeInterceptorBean);
+
+ WithStereoTypeInterceptorBean beanInstance = (WithStereoTypeInterceptorBean)reference;
+
+ beanInstance.sayHello();
+
+ Assert.assertTrue(TransactionInterceptor.ECHO);
+
+ shutDownContainer();
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/common/DependentInterceptor.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/common/DependentInterceptor.java
new file mode 100644
index 0000000..63af812
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/common/DependentInterceptor.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.interceptors.common;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+import org.apache.webbeans.newtests.interceptors.annotation.DependentInterceptorBindingType;
+
+@Interceptor @DependentInterceptorBindingType
+public class DependentInterceptor
+{
+ public static boolean DEP_OK = false;
+
+ public static int refCount = 0;
+
+ public static Class<?> exceptionTarget = null;
+
+ public DependentInterceptor()
+ {
+ refCount++;
+ }
+
+ @AroundInvoke
+ public Object aroundInvoke(InvocationContext ctx) throws Exception
+ {
+ DEP_OK = true;
+ try {
+ return ctx.proceed();
+ }
+ catch (Exception e) {
+ exceptionTarget = ctx.getTarget().getClass();
+ throw e;
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/common/RuntimeExceptionsInterceptor.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/common/RuntimeExceptionsInterceptor.java
new file mode 100644
index 0000000..bb01510
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/common/RuntimeExceptionsInterceptor.java
@@ -0,0 +1,50 @@
+/*
+ * 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.webbeans.newtests.interceptors.common;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.RuntimeExceptions;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+/**
+ * This test interceptor catches all Exceptions and
+ * returns RuntimeExceptions instead.
+ */
+@Interceptor
+@RuntimeExceptions
+public class RuntimeExceptionsInterceptor
+{
+ public int invoked = 0;
+
+ @AroundInvoke
+ public Object invoke(InvocationContext context)
+ {
+ try
+ {
+ invoked++;
+ return context.proceed();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/common/SecureInterceptor.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/common/SecureInterceptor.java
new file mode 100644
index 0000000..febfc88
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/common/SecureInterceptor.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.interceptors.common;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Secure;
+
+@Interceptor
+@Secure
+public class SecureInterceptor
+{
+ public static boolean ECHO = false;
+
+ @AroundInvoke
+ public Object invoke(InvocationContext context) throws Exception
+ {
+ ECHO = true;
+
+ return context.proceed();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/common/TransactionInterceptor.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/common/TransactionInterceptor.java
new file mode 100644
index 0000000..e9ab94c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/common/TransactionInterceptor.java
@@ -0,0 +1,50 @@
+/*
+ * 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.webbeans.newtests.interceptors.common;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
+
+@Interceptor
+@Transactional
+public class TransactionInterceptor
+{
+ public static boolean ECHO = false;
+
+ public static int count = 0;
+
+ /** this counts how many interceptor instances got created */
+ public static int interceptorCount = 0;
+
+ public TransactionInterceptor()
+ {
+ interceptorCount++;
+ }
+
+ @AroundInvoke
+ public Object invoke(InvocationContext context) throws Exception
+ {
+ ECHO = true;
+ count++;
+ return context.proceed();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/constructor/AroundConstructTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/constructor/AroundConstructTest.java
new file mode 100644
index 0000000..13c5feb
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/constructor/AroundConstructTest.java
@@ -0,0 +1,100 @@
+/*
+ * 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.webbeans.newtests.interceptors.constructor;
+
+import org.apache.webbeans.intercept.annotation.AroundConstruct;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import javax.inject.Inject;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InterceptorBinding;
+import javax.interceptor.InvocationContext;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+
+import static org.junit.Assert.assertEquals;
+
+public class AroundConstructTest extends AbstractUnitTest
+{
+ @Inject
+ private IAmBuiltWithMyConstructor bean;
+
+ @Test @Ignore("needs CDI 1.1")
+ public void checkBeanWasBuiltWithItsConstructorAndIntercepted()
+ {
+ addInterceptor(IllGetYourConstructorInvocation.class);
+
+ final Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(IAmBuiltWithMyConstructor.class);
+ beanClasses.add(Foo.class);
+
+ startContainer(beanClasses, Collections.<String>emptyList(), true);
+ assertEquals(1, IllGetYourConstructorInvocation.count);
+ shutDownContainer();
+
+ }
+
+ @ConstructorInterceptorBinding
+ public static class IAmBuiltWithMyConstructor
+ {
+ private final Foo foo;
+
+ @Inject
+ public IAmBuiltWithMyConstructor(final Foo foo)
+ {
+ if (foo == null) {
+ throw new NullPointerException();
+ }
+
+ this.foo = foo;
+ }
+ }
+
+ public static class Foo
+ {
+ }
+
+ @ConstructorInterceptorBinding
+ @Interceptor
+ public static class IllGetYourConstructorInvocation
+ {
+ public static int count = 0;
+
+ @AroundConstruct
+ public Object around(final InvocationContext ic) throws Exception
+ {
+ count++;
+ return ic.proceed();
+ }
+ }
+
+ @InterceptorBinding
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target( { ElementType.TYPE, ElementType.METHOD })
+ public @interface ConstructorInterceptorBinding
+ {
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/constructor/InterceptionOfBeanWithConstructorInjectionTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/constructor/InterceptionOfBeanWithConstructorInjectionTest.java
new file mode 100644
index 0000000..6d85e8e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/constructor/InterceptionOfBeanWithConstructorInjectionTest.java
@@ -0,0 +1,103 @@
+/*
+ * 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.webbeans.newtests.interceptors.constructor;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Test;
+
+import javax.inject.Inject;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InterceptorBinding;
+import javax.interceptor.InvocationContext;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+public class InterceptionOfBeanWithConstructorInjectionTest extends AbstractUnitTest
+{
+ @Inject
+ private BuildMeWithMyConstructor bean;
+
+ @Test
+ public void checkBeanWasBuiltWithItsConstructorAndIntercepted()
+ {
+ addInterceptor(ConstructorIsNotAnIssueForMe.class);
+
+ final Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(BuildMeWithMyConstructor.class);
+ beanClasses.add(Injected.class);
+
+ startContainer(beanClasses, Collections.<String>emptyList(), true);
+ assertNotNull(bean);
+ assertNotNull(bean.getInjected());
+ assertEquals(1, ConstructorIsNotAnIssueForMe.count);
+ shutDownContainer();
+
+ }
+
+ @ConstructorInterceptorBindingType
+ public static class BuildMeWithMyConstructor
+ {
+ private final Injected injected;
+
+ @Inject
+ public BuildMeWithMyConstructor(final Injected injected)
+ {
+ this.injected = injected;
+ }
+
+ public Injected getInjected()
+ {
+ return injected;
+ }
+ }
+
+ public static class Injected
+ {
+ }
+
+ @ConstructorInterceptorBindingType @Interceptor
+ public static class ConstructorIsNotAnIssueForMe
+ {
+ public static int count = 0;
+
+ @AroundInvoke
+ public Object around(final InvocationContext ic) throws Throwable
+ {
+ count++;
+ return ic.proceed();
+ }
+ }
+
+ @InterceptorBinding
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target( { ElementType.TYPE, ElementType.METHOD })
+ public @interface ConstructorInterceptorBindingType
+ {
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentInterceptorTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentInterceptorTest.java
new file mode 100644
index 0000000..e015797
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentInterceptorTest.java
@@ -0,0 +1,100 @@
+/*
+ * 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.webbeans.newtests.interceptors.dependent;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.interceptors.beans.DependentScopedBean;
+import org.apache.webbeans.newtests.interceptors.common.DependentInterceptor;
+import org.junit.Test;
+
+public class DependentInterceptorTest extends AbstractUnitTest
+{
+ private static final String PACKAGE_NAME = DependentInterceptorTest.class.getPackage().getName();
+
+ public DependentInterceptorTest()
+ {
+
+ }
+
+ @Test
+ @SuppressWarnings("unchecked")
+ public void testLifecycle()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "DependentInterceptorTest"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(DependentInterceptor.class);
+ beanClasses.add(DependentScopedBean.class);
+
+ DependentScopedBean.PRE_DESTROY = false;
+ DependentScopedBean.POST_CONSTRUCT = false;
+
+ startContainer(beanClasses, beanXmls);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans("org.apache.webbeans.newtests.interceptors.beans.DependentScopedBean");
+ Assert.assertNotNull(beans);
+ Bean<DependentScopedBean> bean = (Bean<DependentScopedBean>)beans.iterator().next();
+
+ CreationalContext<DependentScopedBean> ctx = getBeanManager().createCreationalContext(bean);
+
+ DependentInterceptor.refCount = 0;
+
+ Object reference = getBeanManager().getReference(bean, DependentScopedBean.class, ctx);
+ Assert.assertNotNull(reference);
+
+ Assert.assertTrue(reference instanceof DependentScopedBean);
+
+ Assert.assertTrue(DependentScopedBean.POST_CONSTRUCT);
+
+ Assert.assertTrue(!DependentScopedBean.PRE_DESTROY);
+
+ DependentScopedBean dbean = (DependentScopedBean)reference;
+ dbean.sayHello();
+
+ Assert.assertTrue(DependentInterceptor.refCount == 1);
+
+ Assert.assertTrue(DependentScopedBean.SAY_HELLO);
+
+ try {
+ dbean.throwException();
+ }
+ catch (Exception e) {
+ Assert.assertTrue(DependentInterceptor.exceptionTarget.equals(DependentScopedBean.class));
+ }
+
+
+ bean.destroy(dbean, ctx);
+
+ shutDownContainer();
+
+ Assert.assertTrue(DependentScopedBean.PRE_DESTROY);
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleBean.java
new file mode 100644
index 0000000..b599464
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleBean.java
@@ -0,0 +1,41 @@
+/*
+ * 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.webbeans.newtests.interceptors.dependent;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Named;
+
+@Named("org.apache.webbeans.newtests.interceptors.dependent.DependentLifecycleBean")
+public class DependentLifecycleBean extends DependentSuperBean
+{
+ public static int value = 0;
+
+ @PostConstruct
+ public void postConstruct()
+ {
+ value++;
+ }
+
+ @PreDestroy
+ public void preDestroy()
+ {
+ value --;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleTest.java
new file mode 100644
index 0000000..cfb5195
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleTest.java
@@ -0,0 +1,69 @@
+/*
+ * 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.webbeans.newtests.interceptors.dependent;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Test;
+
+public class DependentLifecycleTest extends AbstractUnitTest
+{
+
+ @Test
+ @SuppressWarnings("unchecked")
+ public void testLifecycle()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(DependentLifecycleBean.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans("org.apache.webbeans.newtests.interceptors.dependent.DependentLifecycleBean");
+ Assert.assertNotNull(beans);
+ Bean<DependentLifecycleBean> bean = (Bean<DependentLifecycleBean>)beans.iterator().next();
+
+ CreationalContext<DependentLifecycleBean> ctx = getBeanManager().createCreationalContext(bean);
+
+ DependentLifecycleBean reference = (DependentLifecycleBean) getBeanManager().getReference(bean, DependentLifecycleBean.class, ctx);
+ Assert.assertNotNull(reference);
+
+ Assert.assertEquals(1, DependentLifecycleBean.value);
+ Assert.assertTrue(DependentSuperBean.SC);
+ Assert.assertTrue(MyExtraSuper.SC);
+
+ bean.destroy(reference, ctx);
+
+ shutDownContainer();
+
+ Assert.assertEquals(0, DependentLifecycleBean.value);
+ Assert.assertFalse(DependentSuperBean.SC);
+ Assert.assertFalse(MyExtraSuper.SC);
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentSuperBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentSuperBean.java
new file mode 100644
index 0000000..4a56d3b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentSuperBean.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.interceptors.dependent;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+
+public class DependentSuperBean extends MyExtraSuper
+{
+ public static boolean SC = false;
+
+ @PostConstruct
+ public void myPostConstruct()
+ {
+ SC = true;
+ }
+
+ @PreDestroy
+ public void myPreDestroy()
+ {
+ SC = false;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/MyExtraSuper.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/MyExtraSuper.java
new file mode 100644
index 0000000..abc21c7
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/MyExtraSuper.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.interceptors.dependent;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+
+public class MyExtraSuper
+{
+ public static boolean SC = false;
+
+ @PostConstruct
+ public void myEctraPostConstruct()
+ {
+ SC = true;
+ }
+
+ @PreDestroy
+ public void myEctraPreDestroy()
+ {
+ SC = false;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/ejb/EjbInterceptor.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/ejb/EjbInterceptor.java
new file mode 100644
index 0000000..fc21986
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/ejb/EjbInterceptor.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.newtests.interceptors.ejb;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+
+public class EjbInterceptor
+{
+ public static boolean CALLED = false;
+
+ @AroundInvoke
+ public Object caller(InvocationContext context) throws Exception
+ {
+ CALLED = true;
+ return context.proceed();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/ejb/EjbInterceptorExtension.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/ejb/EjbInterceptorExtension.java
new file mode 100644
index 0000000..26dcedc
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/ejb/EjbInterceptorExtension.java
@@ -0,0 +1,59 @@
+/*
+ * 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.webbeans.newtests.interceptors.ejb;
+
+import org.apache.webbeans.newtests.interceptors.lifecycle.LifecycleBinding;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.interceptor.Interceptors;
+
+
+public class EjbInterceptorExtension implements Extension
+{
+ /**
+ * we add the InterceptorBinding via Extension to test OWB-593
+ * @param event
+ */
+ public void registerInterceptorBinding(@Observes BeforeBeanDiscovery event)
+ {
+ event.addInterceptorBinding(LifecycleBinding.class);
+ }
+
+ public static class InterceptorsLit extends AnnotationLiteral<Interceptors> implements Interceptors
+ {
+ @Override
+ public Class[] value()
+ {
+ return new Class[]{EjbInterceptor.class};
+ }
+ }
+
+ public void observeNotInterceptedBean(@Observes ProcessAnnotatedType<ManagedBeanWithoutInterceptor> process)
+ {
+ AnnotationLiteral<Interceptors> intAnnot = new InterceptorsLit();
+
+ process.getAnnotatedType().getAnnotations().add(intAnnot);
+ process.setAnnotatedType(process.getAnnotatedType());
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/ejb/EjbInterceptorTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/ejb/EjbInterceptorTest.java
new file mode 100644
index 0000000..cba23c5
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/ejb/EjbInterceptorTest.java
@@ -0,0 +1,106 @@
+/*
+ * 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.webbeans.newtests.interceptors.ejb;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.interceptors.beans.ApplicationScopedBean;
+import org.apache.webbeans.newtests.interceptors.beans.DependentScopedBean;
+import org.apache.webbeans.newtests.interceptors.beans.RequestScopedBean;
+import org.junit.Test;
+
+public class EjbInterceptorTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testEjbInterceptor()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(RequestScopedBean.class);
+ beanClasses.add(ManagedBeanWithEjbInterceptor.class);
+ beanClasses.add(ApplicationScopedBean.class);
+ beanClasses.add(DependentScopedBean.class);
+ beanClasses.add(EjbInterceptor.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ ManagedBeanWithEjbInterceptor reference = getInstance(ManagedBeanWithEjbInterceptor.class);
+ Assert.assertNotNull(reference);
+
+ EjbInterceptor.CALLED = false;
+ reference.sayHello();
+ Assert.assertTrue(EjbInterceptor.CALLED);
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testEjbMethodInterceptor()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(RequestScopedBean.class);
+ beanClasses.add(ManagedBeanWithMethodEjbInterceptor.class);
+ beanClasses.add(ApplicationScopedBean.class);
+ beanClasses.add(DependentScopedBean.class);
+ beanClasses.add(EjbInterceptor.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ ManagedBeanWithMethodEjbInterceptor reference = getInstance(ManagedBeanWithMethodEjbInterceptor.class);
+ Assert.assertNotNull(reference);
+
+ EjbInterceptor.CALLED = false;
+ reference.sayHello();
+ Assert.assertTrue(EjbInterceptor.CALLED);
+
+ EjbInterceptor.CALLED = false;
+ reference.uninterceptedAction();
+ Assert.assertFalse(EjbInterceptor.CALLED);
+
+ shutDownContainer();
+ }
+
+
+ @Test
+ public void testDynamicEjbInterceptor()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(ManagedBeanWithoutInterceptor.class);
+ beanClasses.add(EjbInterceptor.class);
+ addExtension(new EjbInterceptorExtension());
+
+ startContainer(beanClasses, beanXmls);
+
+ ManagedBeanWithoutInterceptor reference = getInstance(ManagedBeanWithoutInterceptor.class);
+ Assert.assertNotNull(reference);
+
+ EjbInterceptor.CALLED = false;
+ reference.sayHello();
+ Assert.assertTrue(EjbInterceptor.CALLED);
+
+ shutDownContainer();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/ejb/ManagedBeanWithEjbInterceptor.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/ejb/ManagedBeanWithEjbInterceptor.java
new file mode 100644
index 0000000..babf8b3
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/ejb/ManagedBeanWithEjbInterceptor.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.newtests.interceptors.ejb;
+
+import javax.enterprise.context.RequestScoped;
+import javax.interceptor.Interceptors;
+
+@Interceptors(value={EjbInterceptor.class})
+@RequestScoped
+public class ManagedBeanWithEjbInterceptor
+{
+ public void sayHello()
+ {
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/ejb/ManagedBeanWithMethodEjbInterceptor.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/ejb/ManagedBeanWithMethodEjbInterceptor.java
new file mode 100644
index 0000000..37a411b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/ejb/ManagedBeanWithMethodEjbInterceptor.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.newtests.interceptors.ejb;
+
+import javax.enterprise.context.RequestScoped;
+import javax.interceptor.Interceptors;
+
+@RequestScoped
+public class ManagedBeanWithMethodEjbInterceptor
+{
+ @Interceptors(value={EjbInterceptor.class})
+ public int sayHello()
+ {
+ return 42;
+ }
+
+ public int uninterceptedAction()
+ {
+ return 21;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/ejb/ManagedBeanWithoutInterceptor.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/ejb/ManagedBeanWithoutInterceptor.java
new file mode 100644
index 0000000..c7eba38
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/ejb/ManagedBeanWithoutInterceptor.java
@@ -0,0 +1,30 @@
+/*
+ * 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.webbeans.newtests.interceptors.ejb;
+
+import javax.enterprise.context.RequestScoped;
+
+@RequestScoped
+public class ManagedBeanWithoutInterceptor
+{
+ public void sayHello()
+ {
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/InterceptorDecoratorProxyFactoryTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/InterceptorDecoratorProxyFactoryTest.java
new file mode 100644
index 0000000..780453c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/InterceptorDecoratorProxyFactoryTest.java
@@ -0,0 +1,263 @@
+/*
+ * 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.webbeans.newtests.interceptors.factory;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.interceptors.factory.beans.ClassInterceptedClass;
+import org.apache.webbeans.newtests.interceptors.factory.beans.TonsOfMethodsInterceptedClass;
+import org.apache.webbeans.proxy.InterceptorDecoratorProxyFactory;
+
+import org.apache.webbeans.proxy.InterceptorHandler;
+import org.apache.webbeans.proxy.OwbInterceptorProxy;
+import org.apache.webbeans.test.component.intercept.webbeans.TransactionalInterceptor;
+import org.apache.webbeans.util.ClassUtil;
+import org.apache.webbeans.util.CustomBaseType;
+import org.apache.webbeans.util.CustomType;
+import org.apache.webbeans.util.ExtendedSpecificClass;
+import org.apache.webbeans.util.GenericInterface;
+import org.apache.webbeans.util.SpecificClass;
+import org.junit.Assert;
+import org.junit.Test;
+
+
+/**
+ * Test the {@link org.apache.webbeans.proxy.InterceptorDecoratorProxyFactory}
+ */
+public class InterceptorDecoratorProxyFactoryTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testSimpleProxyCreation() throws Exception
+ {
+ InterceptorDecoratorProxyFactory pf = new InterceptorDecoratorProxyFactory(new WebBeansContext());
+
+ // we take a fresh URLClassLoader to not blur the test classpath with synthetic classes.
+ ClassLoader classLoader = new URLClassLoader(new URL[0]);
+
+ List<Method> methods = ClassUtil.getNonPrivateMethods(ClassInterceptedClass.class, true);
+
+ Method[] interceptedMethods = methods.toArray(new Method[methods.size()]);
+ Method[] nonInterceptedMethods = null;
+
+ Bean dummyBean = new DummyBean();
+
+ Class<ClassInterceptedClass> proxyClass = pf.createProxyClass(dummyBean, classLoader, ClassInterceptedClass.class, interceptedMethods, nonInterceptedMethods);
+ Assert.assertNotNull(proxyClass);
+
+ ClassInterceptedClass internalInstance = new ClassInterceptedClass();
+ internalInstance.init();
+
+ TestInterceptorHandler testInvocationHandler = new TestInterceptorHandler(internalInstance);
+
+ ClassInterceptedClass proxy = pf.createProxyInstance(proxyClass, internalInstance, testInvocationHandler);
+ Assert.assertNotNull(proxy);
+
+ Assert.assertTrue(proxy instanceof OwbInterceptorProxy);
+
+ proxy.setMeaningOfLife(42);
+
+ Assert.assertEquals(42, proxy.getMeaningOfLife());
+ Assert.assertEquals(internalInstance.getFloat(), proxy.getFloat(), 0f);
+ Assert.assertEquals('c', proxy.getChar());
+ Assert.assertEquals(internalInstance, proxy.getSelf());
+
+ Assert.assertEquals(5, testInvocationHandler.invokedMethodNames.size());
+ }
+
+ @Test
+ public void testGenericProxyGeneration()
+ {
+ InterceptorDecoratorProxyFactory pf = new InterceptorDecoratorProxyFactory(new WebBeansContext());
+
+ // we take a fresh URLClassLoader to not blur the test classpath with synthetic classes.
+ ClassLoader classLoader = new URLClassLoader(new URL[0]);
+
+ List<Method> methods = ClassUtil.getNonPrivateMethods(ExtendedSpecificClass.class, true);
+ for (Iterator<Method> i = methods.iterator(); i.hasNext();)
+ {
+ if (i.next().isBridge())
+ {
+ i.remove();
+ }
+ }
+
+ Method[] interceptedMethods = methods.toArray(new Method[methods.size()]);
+ Method[] nonInterceptedMethods = null;
+
+ Bean dummyBean = new DummyBean();
+
+ Class<ExtendedSpecificClass> proxyClass = pf.createProxyClass(dummyBean, classLoader, ExtendedSpecificClass.class, interceptedMethods, nonInterceptedMethods);
+ Assert.assertNotNull(proxyClass);
+
+ ExtendedSpecificClass internalInstance = new ExtendedSpecificClass();
+ internalInstance.init();
+
+ TestInterceptorHandler testInvocationHandler = new TestInterceptorHandler(internalInstance);
+
+ ExtendedSpecificClass extendedSpecificProxyInstance = pf.createProxyInstance(proxyClass, internalInstance, testInvocationHandler);
+ SpecificClass<CustomType> specificProxyInstance = extendedSpecificProxyInstance;
+ GenericInterface<CustomBaseType> interfaceProxyInstance = extendedSpecificProxyInstance;
+ Assert.assertNotNull(extendedSpecificProxyInstance.newInstance());
+ Assert.assertNotNull(specificProxyInstance.newInstance());
+ Assert.assertNotNull(interfaceProxyInstance.newInstance());
+
+ Assert.assertTrue(extendedSpecificProxyInstance instanceof OwbInterceptorProxy);
+ Assert.assertNotNull(internalInstance.newInstance());
+ }
+
+ /**
+ * We originally did have a bug in our proxy code which
+ * blew up if we did have > 127 methods in an intercepted class.
+ */
+ @Test
+ public void testManyMethodsInterceptor() throws Exception
+ {
+ addInterceptor(TransactionalInterceptor.class);
+ startContainer(TonsOfMethodsInterceptedClass.class);
+
+ TonsOfMethodsInterceptedClass instance = getInstance(TonsOfMethodsInterceptedClass.class);
+
+ for (int i = 0; i < 130; i++)
+ {
+ String methodName = "method" + i;
+ Method m = instance.getClass().getDeclaredMethod(methodName);
+ m.invoke(instance);
+ }
+ }
+
+ public static class DummyBean implements Bean {
+ @Override
+ public Object create(CreationalContext context)
+ {
+ return null;
+ }
+
+ @Override
+ public Set<Type> getTypes()
+ {
+ return null;
+ }
+
+ @Override
+ public Set<Annotation> getQualifiers()
+ {
+ return null;
+ }
+
+ @Override
+ public Class<? extends Annotation> getScope()
+ {
+ return null;
+ }
+
+ @Override
+ public String getName()
+ {
+ return null;
+ }
+
+ @Override
+ public boolean isNullable()
+ {
+ return false;
+ }
+
+ @Override
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ return null;
+ }
+
+ @Override
+ public Class<?> getBeanClass()
+ {
+ return null;
+ }
+
+ @Override
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return null;
+ }
+
+ @Override
+ public boolean isAlternative()
+ {
+ return false;
+ }
+
+ @Override
+ public void destroy(Object instance, CreationalContext context)
+ {
+ }
+ }
+
+ public static class TestInterceptorHandler implements InterceptorHandler
+ {
+ public List<String> invokedMethodNames = new ArrayList<String>();
+
+ private Object instance;
+
+ public TestInterceptorHandler(Object instance)
+ {
+ this.instance = instance;
+ }
+
+ @Override
+ public Object invoke(Method method, Object[] args)
+ {
+ Assert.assertFalse(method.isBridge());
+ if (!method.getName().equals("toString"))
+ {
+ invokedMethodNames.add(method.getName());
+ }
+
+ System.out.println("TestInvocationHandler got properly invoked for method " + method.getName());
+
+ try
+ {
+ return method.invoke(instance, args);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new WebBeansException(e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new WebBeansException(e);
+ }
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/NormalScopeProxyFactoryTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/NormalScopeProxyFactoryTest.java
new file mode 100644
index 0000000..24cea4e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/NormalScopeProxyFactoryTest.java
@@ -0,0 +1,268 @@
+/*
+ * 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.webbeans.newtests.interceptors.factory;
+
+import org.apache.webbeans.component.OwbBean;
+import org.apache.webbeans.component.WebBeansType;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.interceptors.factory.beans.ClassInterceptedClass;
+import org.apache.webbeans.newtests.interceptors.factory.beans.SomeBaseClass;
+import org.apache.webbeans.proxy.NormalScopeProxyFactory;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.Producer;
+import javax.inject.Provider;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Set;
+
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * Test for the {@link NormalScopeProxyFactory}
+ */
+public class NormalScopeProxyFactoryTest extends AbstractUnitTest
+{
+ @Test
+ public void noBeanClassProxy()
+ {
+ final WebBeansContext webBeansContext = new WebBeansContext();
+ final NormalScopeProxyFactory pf = new NormalScopeProxyFactory(webBeansContext);
+ final Object proxy = pf.createNormalScopeProxy(new OwbBean<Provider>() {
+ @Override
+ public Set<Type> getTypes() {
+ return null;
+ }
+
+ @Override
+ public Set<Annotation> getQualifiers() {
+ return null;
+ }
+
+ @Override
+ public Class<? extends Annotation> getScope() {
+ return ApplicationScoped.class;
+ }
+
+ @Override
+ public String getName() {
+ return null;
+ }
+
+ @Override
+ public boolean isNullable() {
+ return false;
+ }
+
+ @Override
+ public Set<InjectionPoint> getInjectionPoints() {
+ return null;
+ }
+
+ @Override
+ public Class<?> getBeanClass() {
+ return null; // this is what we test
+ }
+
+ @Override
+ public Set<Class<? extends Annotation>> getStereotypes() {
+ return null;
+ }
+
+ @Override
+ public boolean isAlternative() {
+ return false;
+ }
+
+ @Override
+ public Provider create(final CreationalContext<Provider> context) {
+ return null;
+ }
+
+ @Override
+ public void destroy(final Provider instance, final CreationalContext<Provider> context) {
+
+ }
+
+ @Override
+ public Producer<Provider> getProducer() {
+ return null;
+ }
+
+ @Override
+ public WebBeansType getWebBeansType() {
+ return null;
+ }
+
+ @Override
+ public Class<Provider> getReturnType() {
+ return Provider.class;
+ }
+
+ @Override
+ public void setSpecializedBean(boolean specialized) {
+
+ }
+
+ @Override
+ public boolean isSpecializedBean() {
+ return false;
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return false;
+ }
+
+ @Override
+ public String getId() {
+ return null;
+ }
+
+ @Override
+ public boolean isPassivationCapable() {
+ return false;
+ }
+
+ @Override
+ public boolean isDependent() {
+ return false;
+ }
+
+ @Override
+ public WebBeansContext getWebBeansContext() {
+ return null;
+ }
+ });
+ assertNotNull(proxy);
+ }
+
+ @Test
+ public void textSimpleProxyCreation() throws Exception
+ {
+ NormalScopeProxyFactory pf = new NormalScopeProxyFactory(new WebBeansContext());
+
+ // we take a fresh URLClassLoader to not blur the test classpath with synthetic classes.
+ ClassLoader classLoader = new URLClassLoader(new URL[0]);
+
+ Class<ClassInterceptedClass> proxyClass = pf.createProxyClass(classLoader, ClassInterceptedClass.class);
+ Assert.assertNotNull(proxyClass);
+
+ ClassInterceptedClass internalInstance = new ClassInterceptedClass();
+ internalInstance.init();
+
+ TestContextualInstanceProvider provider = new TestContextualInstanceProvider(internalInstance);
+
+ ClassInterceptedClass proxy = pf.createProxyInstance(proxyClass, provider);
+
+ Assert.assertEquals(42, proxy.getMeaningOfLife());
+ Assert.assertTrue(provider.gotInvoked());
+
+ Assert.assertEquals(internalInstance.getFloat(), proxy.getFloat(), 0f);
+ Assert.assertTrue(provider.gotInvoked());
+
+ Assert.assertEquals('c', proxy.getChar());
+ Assert.assertTrue(provider.gotInvoked());
+
+ Assert.assertEquals(internalInstance, proxy.getSelf());
+ Assert.assertTrue(provider.gotInvoked());
+
+ try
+ {
+ proxy.doThaBlowup();
+ Assert.fail("NumberFormatException expected!");
+ }
+ catch (NumberFormatException nfe)
+ {
+ Assert.assertEquals("should fit", nfe.getMessage());
+ }
+
+ }
+
+
+ /**
+ * Test if protected and package scope methods are proxied as well.
+ * @throws Exception
+ */
+ @Test
+ public void testProtectedMethod() throws Exception
+ {
+ startContainer(ProtectedUsageBean.class);
+
+ ProtectedUsageBean protectedUsage = getInstance(ProtectedUsageBean.class);
+ Assert.assertNotNull(protectedUsage);
+
+ Assert.assertEquals(42, protectedUsage.getPackageMeaningOfLife());
+ Assert.assertEquals(42, protectedUsage.getProtectedMeaningOfLife());
+ Assert.assertEquals(Integer.valueOf(42), protectedUsage.getProtectedIntegerMeaningOfLife());
+ }
+
+ public static class TestContextualInstanceProvider<T> implements Provider<T>
+ {
+ private T instance;
+ private boolean gotInvoked = false;
+
+ public TestContextualInstanceProvider(T instance)
+ {
+ this.instance = instance;
+ }
+
+ public boolean gotInvoked()
+ {
+ boolean invoked = gotInvoked;
+ gotInvoked = false;
+
+ return invoked;
+ }
+
+ @Override
+ public T get()
+ {
+ System.out.println("TestContextualInstanceProvider#get() got invoked!");
+ gotInvoked = true;
+
+ return instance;
+ }
+ }
+
+ @Test
+ public void testContainerBoot() throws Exception
+ {
+ startContainer(ClassInterceptedClass.class, SomeBaseClass.class, SubPackageInterceptedClass.class);
+ ClassInterceptedClass instance = getInstance(ClassInterceptedClass.class);
+ Assert.assertNotNull(instance);
+ instance.getFloat();
+
+ SubPackageInterceptedClass subPackageInstance = getInstance(SubPackageInterceptedClass.class);
+ Assert.assertNotNull(subPackageInstance);
+ instance.getFloat();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/ProtectedUsageBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/ProtectedUsageBean.java
new file mode 100644
index 0000000..0e92990
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/ProtectedUsageBean.java
@@ -0,0 +1,55 @@
+/*
+ * 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.webbeans.newtests.interceptors.factory;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.RequestScoped;
+
+@RequestScoped
+public class ProtectedUsageBean
+{
+ private int meaningOfLife;
+
+ @PostConstruct
+ private void init()
+ {
+ meaningOfLife = 42;
+ }
+
+ protected int getProtectedMeaningOfLife()
+ {
+ return meaningOfLife;
+ }
+
+ protected Integer getProtectedIntegerMeaningOfLife()
+ {
+ return Integer.valueOf(meaningOfLife);
+ }
+
+ int getPackageMeaningOfLife()
+ {
+ return meaningOfLife;
+ }
+
+ int packagePrivateMethod()
+ {
+ return 84;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/SubPackageInterceptedClass.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/SubPackageInterceptedClass.java
new file mode 100644
index 0000000..855f721
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/SubPackageInterceptedClass.java
@@ -0,0 +1,107 @@
+/*
+ * 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.webbeans.newtests.interceptors.factory;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.enterprise.context.RequestScoped;
+
+import org.apache.webbeans.newtests.interceptors.factory.beans.SomeBaseClass;
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
+
+/**
+ * A simple class which is class-level intercepted
+ * but is in a different package than it's parent class.
+ * This is mainly for testing proxying of package-private methods.
+ */
+@Transactional
+@RequestScoped
+public class SubPackageInterceptedClass extends SomeBaseClass
+{
+
+ private int meaningOfLife;
+ private float f;
+ private char c;
+
+ public SubPackageInterceptedClass()
+ {
+ }
+
+ @PostConstruct
+ public void postConstruct()
+ {
+ System.out.println("postConstruct invoked");
+ }
+
+ @PreDestroy
+ private void preDestroy()
+ {
+ System.out.println("preDestroy invoked");
+ }
+
+ public void init()
+ {
+ f = 2.4f;
+ c = 'c';
+ meaningOfLife = 42;
+ }
+
+ public int getMeaningOfLife() throws NumberFormatException
+ {
+ System.out.println("answeringowb-arquillian-parent the question about life, the universe and everything!");
+ System.out.println("and being in " + this.getClass());
+ return meaningOfLife;
+ }
+
+ public void setMeaningOfLife(int meaningOfLife)
+ {
+ this.meaningOfLife = meaningOfLife;
+ }
+
+ public float getFloat()
+ {
+ return f;
+ }
+
+ public SubPackageInterceptedClass getSelf()
+ {
+ return this;
+ }
+
+ public char getChar()
+ {
+ return c;
+ }
+
+ public String doThaBlowup() throws NumberFormatException
+ {
+ throw new NumberFormatException("should fit");
+ }
+
+ protected int protectedMethod()
+ {
+ return 21;
+ }
+
+ int packagePrivateMethod()
+ {
+ return 84;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/SubclassProxyFactoryTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/SubclassProxyFactoryTest.java
new file mode 100644
index 0000000..9e989d1
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/SubclassProxyFactoryTest.java
@@ -0,0 +1,51 @@
+/*
+ * 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.webbeans.newtests.interceptors.factory;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.decorators.common.Cow;
+import org.apache.webbeans.newtests.interceptors.factory.beans.MyAbstractTestDecorator;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class SubclassProxyFactoryTest extends AbstractUnitTest
+{
+ @Test
+ public void testSubclassProxy() throws Exception
+ {
+ startContainer();
+
+ Class<? extends MyAbstractTestDecorator> subClass
+ = getWebBeansContext().getSubclassProxyFactory().createSubClass(this.getClass().getClassLoader(), MyAbstractTestDecorator.class);
+ Assert.assertNotNull(subClass);
+
+ MyAbstractTestDecorator instance = subClass.newInstance();
+ Assert.assertNotNull(instance);
+
+ Cow cow = new Cow();
+ instance.setDelegate(cow);
+
+ Assert.assertEquals(49, instance.getAge());
+
+ shutDownContainer();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/beans/ClassInterceptedClass.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/beans/ClassInterceptedClass.java
new file mode 100644
index 0000000..19ceaaf
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/beans/ClassInterceptedClass.java
@@ -0,0 +1,113 @@
+/*
+ * 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.webbeans.newtests.interceptors.factory.beans;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.enterprise.context.RequestScoped;
+
+import org.apache.webbeans.newtests.proxy.beans.DummyBean;
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
+
+/**
+ * A simple class which is class-level intercepted
+ */
+@Transactional
+@RequestScoped
+public class ClassInterceptedClass extends SomeBaseClass
+{
+ private boolean defaultCtInvoked = false;
+
+ private int meaningOfLife;
+ private float f;
+ private char c;
+
+ public ClassInterceptedClass()
+ {
+ defaultCtInvoked = true;
+ }
+
+ @PostConstruct
+ public void postConstruct()
+ {
+ System.out.println("postConstruct invoked");
+ }
+
+ @PreDestroy
+ private void preDestroy()
+ {
+ System.out.println("preDestroy invoked");
+ }
+
+ public void init()
+ {
+ f = 2.4f;
+ c = 'c';
+ meaningOfLife = 42;
+ }
+
+ public int getMeaningOfLife() throws NumberFormatException
+ {
+ System.out.println("answeringowb-arquillian-parent the question about life, the universe and everything!");
+ System.out.println("and being in " + this.getClass());
+ return meaningOfLife;
+ }
+
+ public void setMeaningOfLife(int meaningOfLife)
+ {
+ this.meaningOfLife = meaningOfLife;
+ }
+
+ public float getFloat()
+ {
+ return f;
+ }
+
+ public ClassInterceptedClass getSelf()
+ {
+ return this;
+ }
+
+ public char getChar()
+ {
+ return c;
+ }
+
+ public String doThaBlowup() throws NumberFormatException
+ {
+ throw new NumberFormatException("should fit");
+ }
+
+ protected int protectedMethod()
+ {
+ return 21;
+ }
+
+ int packagePrivateMethod()
+ {
+ return 84;
+ }
+
+
+ public DummyBean.SomeInnerClass getValueHolder() throws DummyBean.SomeInnerException
+ {
+ return new DummyBean.SomeInnerClass("hello");
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/beans/ClassMultiInterceptedClass.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/beans/ClassMultiInterceptedClass.java
new file mode 100644
index 0000000..bf35cac
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/beans/ClassMultiInterceptedClass.java
@@ -0,0 +1,94 @@
+/*
+ * 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.webbeans.newtests.interceptors.factory.beans;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.enterprise.context.RequestScoped;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Action;
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Secure;
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
+
+/**
+ * A simple class which has multiple interceptors
+ */
+@Transactional
+@Action
+@Secure
+@RequestScoped
+public class ClassMultiInterceptedClass
+{
+ private boolean defaultCtInvoked = false;
+
+ private int meaningOfLife;
+ private float f;
+ private char c;
+
+ public ClassMultiInterceptedClass()
+ {
+ defaultCtInvoked = true;
+ }
+
+ @PostConstruct
+ public void postConstruct()
+ {
+ System.out.println("postConstruct invoked");
+ }
+
+ @PreDestroy
+ private void preDestroy()
+ {
+ System.out.println("preDestroy invoked");
+ }
+
+ public void init()
+ {
+ f = 2.4f;
+ c = 'c';
+ }
+
+ public int getMeaningOfLife()
+ {
+ //X System.out.println("answering the question about life, the universe and everything!");
+ //X System.out.println("and being in " + this.getClass());
+ return meaningOfLife;
+ }
+
+ public void setMeaningOfLife(int meaningOfLife)
+ {
+ this.meaningOfLife = meaningOfLife;
+ }
+
+ public float getFloat()
+ {
+ return f;
+ }
+
+ public ClassMultiInterceptedClass getSelf()
+ {
+ return this;
+ }
+
+ public char getChar()
+ {
+ return c;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/beans/DecoratedClass.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/beans/DecoratedClass.java
new file mode 100644
index 0000000..f647303
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/beans/DecoratedClass.java
@@ -0,0 +1,45 @@
+/*
+ * 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.webbeans.newtests.interceptors.factory.beans;
+
+
+import javax.enterprise.context.RequestScoped;
+import org.apache.webbeans.test.annotation.binding.Binding1;
+import org.apache.webbeans.test.component.service.IService;
+
+/**
+ * A simple class which has a Decorator of type
+ * {@link org.apache.webbeans.test.component.decorator.clean.ServiceDecorator}
+ */
+@RequestScoped
+@Binding1
+public class DecoratedClass implements IService
+{
+
+ @Override
+ public String service()
+ {
+ return "theOriginalValue";
+ }
+
+ public int nonDecoratedMethod()
+ {
+ return 42;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/beans/MethodInterceptedClass.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/beans/MethodInterceptedClass.java
new file mode 100644
index 0000000..68742b5
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/beans/MethodInterceptedClass.java
@@ -0,0 +1,58 @@
+/*
+ * 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.webbeans.newtests.interceptors.factory.beans;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Secure;
+
+/**
+ * A simple class which is not intercepted but has some
+ * methods which are.
+ */
+public class MethodInterceptedClass
+{
+ private boolean defaultCtInvoked = false;
+
+ private int meaningOfLife;
+
+ public MethodInterceptedClass()
+ {
+ defaultCtInvoked = true;
+ }
+
+ @Transactional
+ public int getMeaningOfLife()
+ {
+ System.out.println("answering the question about life, the universe and everything!");
+ System.out.println("and being in " + this.getClass());
+ return meaningOfLife;
+ }
+
+ @Transactional
+ @Secure
+ public void setMeaningOfLife(int meaningOfLife)
+ {
+ this.meaningOfLife = meaningOfLife;
+ }
+
+ public int nonTransactionalGetter()
+ {
+ return meaningOfLife + 2;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/beans/MyAbstractTestDecorator.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/beans/MyAbstractTestDecorator.java
new file mode 100644
index 0000000..0717f8b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/beans/MyAbstractTestDecorator.java
@@ -0,0 +1,48 @@
+/*
+ * 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.webbeans.newtests.interceptors.factory.beans;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+import org.apache.webbeans.newtests.decorators.common.Breeded;
+
+/**
+ * Abstract Decorator for subclassing proxy test
+ */
+@Decorator
+public abstract class MyAbstractTestDecorator implements Breeded
+{
+ @Inject
+ @Delegate
+ private Breeded delegate;
+
+
+ @Override
+ public int getAge()
+ {
+ return delegate.getAge() + 42;
+ }
+
+ public void setDelegate(Breeded delegate)
+ {
+ this.delegate = delegate;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/beans/SomeBaseClass.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/beans/SomeBaseClass.java
new file mode 100644
index 0000000..b2c93a0
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/beans/SomeBaseClass.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.interceptors.factory.beans;
+
+import javax.enterprise.context.RequestScoped;
+
+/**
+ * Test class for our proxy bytecode generator logic.
+ */
+@RequestScoped
+public class SomeBaseClass
+{
+
+ protected String withAProtectedMethod()
+ {
+ return "protectMe";
+ }
+
+ int packagePrivateMethod()
+ {
+ return 42;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/beans/StereotypeInterceptedClass.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/beans/StereotypeInterceptedClass.java
new file mode 100644
index 0000000..923a6a0
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/beans/StereotypeInterceptedClass.java
@@ -0,0 +1,54 @@
+/*
+ * 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.webbeans.newtests.interceptors.factory.beans;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Secure;
+
+/**
+ * A simple class which is class-level intercepted by a Stereotype.
+ */
+public class StereotypeInterceptedClass
+{
+
+ private int meaningOfLife;
+
+
+ public void init()
+ {
+ meaningOfLife = 42;
+ }
+
+ @Secure
+ public int getMeaningOfLife() throws NumberFormatException
+ {
+ return meaningOfLife;
+ }
+
+ public void setMeaningOfLife(int meaningOfLife)
+ {
+ this.meaningOfLife = meaningOfLife;
+ }
+
+ public StereotypeInterceptedClass getSelf()
+ {
+ return this;
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/beans/TonsOfMethodsInterceptedClass.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/beans/TonsOfMethodsInterceptedClass.java
new file mode 100644
index 0000000..ff503ee
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/factory/beans/TonsOfMethodsInterceptedClass.java
@@ -0,0 +1,559 @@
+/*
+ * 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.webbeans.newtests.interceptors.factory.beans;
+
+import javax.enterprise.context.Dependent;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
+
+/**
+ * A test bean which has > 128 methods.
+ * This did originally cause a bug in our generated interceptor bytecode
+ * as we used BIPUSH which is only 8bit signed as index.
+ */
+@Transactional
+@Dependent
+public class TonsOfMethodsInterceptedClass
+{
+ public void method0()
+ {
+ }
+
+ public void method1()
+ {
+ }
+
+ public void method2()
+ {
+ }
+
+ public void method3()
+ {
+ }
+
+ public void method4()
+ {
+ }
+
+ public void method5()
+ {
+ }
+
+ public void method6()
+ {
+ }
+
+ public void method7()
+ {
+ }
+
+ public void method8()
+ {
+ }
+
+ public void method9()
+ {
+ }
+
+ public void method10()
+ {
+ }
+
+ public void method11()
+ {
+ }
+
+ public void method12()
+ {
+ }
+
+ public void method13()
+ {
+ }
+
+ public void method14()
+ {
+ }
+
+ public void method15()
+ {
+ }
+
+ public void method16()
+ {
+ }
+
+ public void method17()
+ {
+ }
+
+ public void method18()
+ {
+ }
+
+ public void method19()
+ {
+ }
+
+ public void method20()
+ {
+ }
+
+ public void method21()
+ {
+ }
+
+ public void method22()
+ {
+ }
+
+ public void method23()
+ {
+ }
+
+ public void method24()
+ {
+ }
+
+ public void method25()
+ {
+ }
+
+ public void method26()
+ {
+ }
+
+ public void method27()
+ {
+ }
+
+ public void method28()
+ {
+ }
+
+ public void method29()
+ {
+ }
+
+ public void method30()
+ {
+ }
+
+ public void method31()
+ {
+ }
+
+ public void method32()
+ {
+ }
+
+ public void method33()
+ {
+ }
+
+ public void method34()
+ {
+ }
+
+ public void method35()
+ {
+ }
+
+ public void method36()
+ {
+ }
+
+ public void method37()
+ {
+ }
+
+ public void method38()
+ {
+ }
+
+ public void method39()
+ {
+ }
+
+
+ public void method40()
+ {
+ }
+
+ public void method41()
+ {
+ }
+
+ public void method42()
+ {
+ }
+
+ public void method43()
+ {
+ }
+
+ public void method44()
+ {
+ }
+
+ public void method45()
+ {
+ }
+
+ public void method46()
+ {
+ }
+
+ public void method47()
+ {
+ }
+
+ public void method48()
+ {
+ }
+
+ public void method49()
+ {
+ }
+
+
+ public void method50()
+ {
+ }
+
+ public void method51()
+ {
+ }
+
+ public void method52()
+ {
+ }
+
+ public void method53()
+ {
+ }
+
+ public void method54()
+ {
+ }
+
+ public void method55()
+ {
+ }
+
+ public void method56()
+ {
+ }
+
+ public void method57()
+ {
+ }
+
+ public void method58()
+ {
+ }
+
+ public void method59()
+ {
+ }
+
+
+ public void method60()
+ {
+ }
+
+ public void method61()
+ {
+ }
+
+ public void method62()
+ {
+ }
+
+ public void method63()
+ {
+ }
+
+ public void method64()
+ {
+ }
+
+ public void method65()
+ {
+ }
+
+ public void method66()
+ {
+ }
+
+ public void method67()
+ {
+ }
+
+ public void method68()
+ {
+ }
+
+ public void method69()
+ {
+ }
+
+
+ public void method70()
+ {
+ }
+
+ public void method71()
+ {
+ }
+
+ public void method72()
+ {
+ }
+
+ public void method73()
+ {
+ }
+
+ public void method74()
+ {
+ }
+
+ public void method75()
+ {
+ }
+
+ public void method76()
+ {
+ }
+
+ public void method77()
+ {
+ }
+
+ public void method78()
+ {
+ }
+
+ public void method79()
+ {
+ }
+
+ public void method80()
+ {
+ }
+
+ public void method81()
+ {
+ }
+
+ public void method82()
+ {
+ }
+
+ public void method83()
+ {
+ }
+
+ public void method84()
+ {
+ }
+
+ public void method85()
+ {
+ }
+
+ public void method86()
+ {
+ }
+
+ public void method87()
+ {
+ }
+
+ public void method88()
+ {
+ }
+
+ public void method89()
+ {
+ }
+
+ public void method90()
+ {
+ }
+
+ public void method91()
+ {
+ }
+
+ public void method92()
+ {
+ }
+
+ public void method93()
+ {
+ }
+
+ public void method94()
+ {
+ }
+
+ public void method95()
+ {
+ }
+
+ public void method96()
+ {
+ }
+
+ public void method97()
+ {
+ }
+
+ public void method98()
+ {
+ }
+
+ public void method99()
+ {
+ }
+
+ public void method100()
+ {
+ }
+
+ public void method101()
+ {
+ }
+
+ public void method102()
+ {
+ }
+
+ public void method103()
+ {
+ }
+
+ public void method104()
+ {
+ }
+
+ public void method105()
+ {
+ }
+
+ public void method106()
+ {
+ }
+
+ public void method107()
+ {
+ }
+
+ public void method108()
+ {
+ }
+
+ public void method109()
+ {
+ }
+
+ public void method110()
+ {
+ }
+
+ public void method111()
+ {
+ }
+
+ public void method112()
+ {
+ }
+
+ public void method113()
+ {
+ }
+
+ public void method114()
+ {
+ }
+
+ public void method115()
+ {
+ }
+
+ public void method116()
+ {
+ }
+
+ public void method117()
+ {
+ }
+
+ public void method118()
+ {
+ }
+
+ public void method119()
+ {
+ }
+
+ public void method120()
+ {
+ }
+
+ public void method121()
+ {
+ }
+
+ public void method122()
+ {
+ }
+
+ public void method123()
+ {
+ }
+
+ public void method124()
+ {
+ }
+
+ public void method125()
+ {
+ }
+
+ public void method126()
+ {
+ }
+
+ public void method127()
+ {
+ }
+
+ public void method128()
+ {
+ }
+
+ public void method129()
+ {
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/BindingIncludedByIndirect.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/BindingIncludedByIndirect.java
new file mode 100644
index 0000000..5a423f0
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/BindingIncludedByIndirect.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.interceptors.inheritance;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.interceptor.InterceptorBinding;
+
+@InterceptorBinding
+@Target( { ElementType.TYPE, ElementType.METHOD })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface BindingIncludedByIndirect
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/BindingIndirectInterceptor.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/BindingIndirectInterceptor.java
new file mode 100644
index 0000000..e9d33c2
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/BindingIndirectInterceptor.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.newtests.interceptors.inheritance;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.interceptor.InterceptorBinding;
+
+@InterceptorBinding
+@Inherited
+@BindingIncludedByIndirect
+@BindingInheritedIncludedByIndirect
+@Target( { ElementType.TYPE, ElementType.METHOD })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface BindingIndirectInterceptor
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/BindingInheritedIncludedByIndirect.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/BindingInheritedIncludedByIndirect.java
new file mode 100644
index 0000000..ef02cb6
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/BindingInheritedIncludedByIndirect.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.newtests.interceptors.inheritance;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.interceptor.InterceptorBinding;
+
+@InterceptorBinding
+@Inherited
+@Target( { ElementType.TYPE, ElementType.METHOD })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface BindingInheritedIncludedByIndirect
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/BindingInheritedInterceptor.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/BindingInheritedInterceptor.java
new file mode 100644
index 0000000..4ef23ea
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/BindingInheritedInterceptor.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.newtests.interceptors.inheritance;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.interceptor.InterceptorBinding;
+
+@InterceptorBinding
+@Inherited
+@Target( { ElementType.TYPE, ElementType.METHOD })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface BindingInheritedInterceptor
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/BindingMethodInterceptor.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/BindingMethodInterceptor.java
new file mode 100644
index 0000000..624910e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/BindingMethodInterceptor.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.interceptors.inheritance;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.interceptor.InterceptorBinding;
+
+@InterceptorBinding
+@Target( { ElementType.TYPE, ElementType.METHOD })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface BindingMethodInterceptor
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/BindingSimpleInterceptor.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/BindingSimpleInterceptor.java
new file mode 100644
index 0000000..b2ba057
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/BindingSimpleInterceptor.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.interceptors.inheritance;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.interceptor.InterceptorBinding;
+
+@InterceptorBinding
+@Target( { ElementType.TYPE, ElementType.METHOD })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface BindingSimpleInterceptor
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/Deck.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/Deck.java
new file mode 100644
index 0000000..bfd4161
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/Deck.java
@@ -0,0 +1,73 @@
+/*
+ * 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.webbeans.newtests.interceptors.inheritance;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Named;
+
+@RequestScoped
+@Named
+@BindingIndirectInterceptor
+@BindingInheritedInterceptor
+@BindingSimpleInterceptor
+public class Deck implements DeckType
+{
+ protected ArrayList<String> intercepted_by = new ArrayList<String>();
+ private int shuffled = 0, intercepted = 0;
+
+ @Override
+ public String getName()
+ {
+ return this.getClass().getSimpleName();
+ }
+
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append(getName() + ":" + shuffled + ":" + intercepted + ":" + intercepted_by.toString());
+ return sb.toString();
+ }
+
+ /**
+ * The method to be intercepted
+ */
+ @Override
+ @BindingMethodInterceptor
+ public void shuffle()
+ {
+ shuffled++;
+ }
+
+ @Override
+ public void setIntercepted(String name)
+ {
+ intercepted++;
+ intercepted_by.add(name);
+ }
+
+ @Override
+ public List<String> getInterceptors()
+ {
+ return intercepted_by;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/DeckChild.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/DeckChild.java
new file mode 100644
index 0000000..5202514
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/DeckChild.java
@@ -0,0 +1,29 @@
+/*
+ * 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.webbeans.newtests.interceptors.inheritance;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Named;
+
+@RequestScoped
+@Named
+public class DeckChild extends Deck
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/DeckStereotyped.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/DeckStereotyped.java
new file mode 100644
index 0000000..1c411d2
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/DeckStereotyped.java
@@ -0,0 +1,71 @@
+/*
+ * 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.webbeans.newtests.interceptors.inheritance;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Named;
+
+@RequestScoped
+@Named
+@StereotypeParent
+public class DeckStereotyped implements DeckType
+{
+ protected ArrayList<String> intercepted_by = new ArrayList<String>();
+ private int shuffled = 0, intercepted = 0;
+
+ @Override
+ public String getName()
+ {
+ return this.getClass().getSimpleName();
+ }
+
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append(getName() + ":" + shuffled + ":" + intercepted + ":" + intercepted_by.toString());
+ return sb.toString();
+ }
+
+ /**
+ * The method to be intercepted
+ */
+ @Override
+ @BindingMethodInterceptor
+ public void shuffle()
+ {
+ shuffled++;
+ }
+
+ @Override
+ public void setIntercepted(String name)
+ {
+ intercepted++;
+ intercepted_by.add(name);
+ }
+
+ @Override
+ public List<String> getInterceptors()
+ {
+ return intercepted_by;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/DeckStereotypedChild.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/DeckStereotypedChild.java
new file mode 100644
index 0000000..72ed41a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/DeckStereotypedChild.java
@@ -0,0 +1,29 @@
+/*
+ * 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.webbeans.newtests.interceptors.inheritance;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Named;
+
+@RequestScoped
+@Named
+public class DeckStereotypedChild extends DeckStereotyped
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/DeckStereotypedGrandchild.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/DeckStereotypedGrandchild.java
new file mode 100644
index 0000000..2150830
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/DeckStereotypedGrandchild.java
@@ -0,0 +1,29 @@
+/*
+ * 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.webbeans.newtests.interceptors.inheritance;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Named;
+
+@RequestScoped
+@Named
+public class DeckStereotypedGrandchild extends DeckStereotyped
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/DeckStereotypedNotInherited.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/DeckStereotypedNotInherited.java
new file mode 100644
index 0000000..6a9f781
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/DeckStereotypedNotInherited.java
@@ -0,0 +1,71 @@
+/*
+ * 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.webbeans.newtests.interceptors.inheritance;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Named;
+
+@RequestScoped
+@Named
+@StereotypeParentNotInherited
+public class DeckStereotypedNotInherited implements DeckType
+{
+ protected ArrayList<String> intercepted_by = new ArrayList<String>();
+ private int shuffled = 0, intercepted = 0;
+
+ @Override
+ public String getName()
+ {
+ return this.getClass().getSimpleName();
+ }
+
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append(getName() + ":" + shuffled + ":" + intercepted + ":" + intercepted_by.toString());
+ return sb.toString();
+ }
+
+ /**
+ * The method to be intercepted
+ */
+ @Override
+ @BindingMethodInterceptor
+ public void shuffle()
+ {
+ shuffled++;
+ }
+
+ @Override
+ public void setIntercepted(String name)
+ {
+ intercepted++;
+ intercepted_by.add(name);
+ }
+
+ @Override
+ public List<String> getInterceptors()
+ {
+ return intercepted_by;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/DeckStereotypedNotInheritedChild.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/DeckStereotypedNotInheritedChild.java
new file mode 100644
index 0000000..e1a0c37
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/DeckStereotypedNotInheritedChild.java
@@ -0,0 +1,29 @@
+/*
+ * 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.webbeans.newtests.interceptors.inheritance;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Named;
+
+@RequestScoped
+@Named
+public class DeckStereotypedNotInheritedChild extends DeckStereotypedNotInherited
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/DeckType.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/DeckType.java
new file mode 100644
index 0000000..82de032
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/DeckType.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.newtests.interceptors.inheritance;
+
+import java.util.List;
+
+public interface DeckType
+{
+ public String getName();
+
+ public void shuffle();
+
+ public void setIntercepted(String name);
+
+ public List<String> getInterceptors();
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/InheritedInterceptorTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/InheritedInterceptorTest.java
new file mode 100644
index 0000000..ea9d1c6
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/InheritedInterceptorTest.java
@@ -0,0 +1,152 @@
+/*
+ * 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.webbeans.newtests.interceptors.inheritance;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class InheritedInterceptorTest extends AbstractUnitTest
+{
+ private static final String PACKAGE_NAME = InheritedInterceptorTest.class.getPackage().getName();
+ String beansXMLOrdering = "[InterceptorSimple, InterceptorInherited, InterceptorMethod, InterceptorIncludedByIndirect, InterceptorInheritedIncludedByIndirect]";
+ String childBeansXMLOrdering = "[InterceptorInherited, InterceptorMethod, InterceptorIncludedByIndirect, InterceptorInheritedIncludedByIndirect]";
+ String methodOnlyXMLOrdering = "[InterceptorMethod]";
+
+ Set<Bean<?>> beans = null;
+
+ @Before
+ public void setUp() {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "InheritedInterceptorTest"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+
+ beanClasses.add(Deck.class);
+ beanClasses.add(DeckChild.class);
+
+ beanClasses.add(DeckStereotyped.class);
+ beanClasses.add(DeckStereotypedChild.class);
+
+ beanClasses.add(DeckStereotypedNotInherited.class);
+ beanClasses.add(DeckStereotypedNotInheritedChild.class);
+ beanClasses.add(DeckStereotypedGrandchild.class);
+
+ beanClasses.add(InterceptorSimple.class);
+ beanClasses.add(InterceptorInherited.class);
+ beanClasses.add(InterceptorIncludedByIndirect.class);
+ beanClasses.add(InterceptorInheritedIncludedByIndirect.class);
+ beanClasses.add(InterceptorMethod.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ this.beans = getBeanManager().getBeans(DeckType.class);
+ Assert.assertNotNull("BeanManager.getBeans() returned null", beans);
+ }
+
+ @After
+ public void tearDown() {
+ shutDownContainer();
+ }
+
+ @Test
+ public void testNormalScopeNoNewInstance()
+ {
+ do_testNormalScopeNoNewInstance();
+ }
+
+ @Test
+ public void testLoopNormalScopeNoNewInstance()
+ {
+ for (int i = 0; i<100; i++)
+ {
+ do_testNormalScopeNoNewInstance();
+ }
+ }
+
+ public void do_testNormalScopeNoNewInstance()
+ {
+ for (Bean<?> bean : beans)
+ {
+ CreationalContext<?> cc = getBeanManager().createCreationalContext(null);
+
+ DeckType d1 = (DeckType) getBeanManager().getReference(bean, DeckType.class, cc);
+ d1.shuffle();
+ // Can't reproduce in TC with this call
+ // cc.release();
+ }
+ }
+
+ @Test
+ public void testStereotype()
+ {
+
+ for (Bean<?> bean : beans)
+ {
+ DeckType d = (DeckType) getBeanManager().getReference(bean, DeckType.class, getBeanManager().createCreationalContext(bean));
+ d.shuffle(); // intercepted method
+
+ List<String> interceptors = d.getInterceptors();
+ System.out.println(d.toString());
+
+ if (d.getName().equals("DeckStereotyped") || d.getName().equals("DeckStereotypedChild") || d.getName().equals("DeckStereotypedGrandchild") || d.getName().equals("DeckStereotypedNotInherited"))
+ {
+ Assert.assertEquals(d.getName(), beansXMLOrdering, interceptors.toString());
+ }
+ else if (d.getName().equals("DeckStereotypedNotInheritedChild"))
+ {
+ Assert.assertEquals(d.getName(), methodOnlyXMLOrdering, interceptors.toString());
+ }
+ }
+ }
+
+ @Test
+ public void testInterceptorInheritance()
+ {
+ for (Bean<?> bean : beans)
+ {
+ DeckType d = (DeckType) getBeanManager().getReference(bean, DeckType.class, getBeanManager().createCreationalContext(bean));
+ d.shuffle(); // intercepted method
+
+ List<String> interceptors = d.getInterceptors();
+ System.out.println(d.toString());
+
+ if (d.getName().equals("Deck"))
+ {
+ Assert.assertEquals(d.getName(), beansXMLOrdering, interceptors.toString());
+ }
+ else if (d.getName().equals("DeckChild"))
+ {
+ Assert.assertEquals(d.getName(), childBeansXMLOrdering, interceptors.toString());
+ }
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/InterceptorIncludedByIndirect.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/InterceptorIncludedByIndirect.java
new file mode 100644
index 0000000..9d32c6c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/InterceptorIncludedByIndirect.java
@@ -0,0 +1,50 @@
+/*
+ * 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.webbeans.newtests.interceptors.inheritance;
+
+import javax.enterprise.context.Dependent;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+@Dependent
+@Interceptor
+@BindingIncludedByIndirect
+public class InterceptorIncludedByIndirect
+{
+ private String nonProxyName;
+
+ public InterceptorIncludedByIndirect()
+ {
+ super();
+ nonProxyName = "InterceptorIncludedByIndirect";
+ }
+
+ @AroundInvoke
+ public Object myint(InvocationContext ic) throws Exception
+ {
+ if (ic.getMethod().getName().equals("shuffle"))
+ {
+ DeckType d = (DeckType) ic.getTarget();
+ d.setIntercepted(nonProxyName);
+ }
+ return ic.proceed();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/InterceptorInherited.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/InterceptorInherited.java
new file mode 100644
index 0000000..d369745
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/InterceptorInherited.java
@@ -0,0 +1,50 @@
+/*
+ * 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.webbeans.newtests.interceptors.inheritance;
+
+import javax.enterprise.context.Dependent;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+@Dependent
+@Interceptor
+@BindingInheritedInterceptor
+public class InterceptorInherited
+{
+ private String nonProxyName;
+
+ public InterceptorInherited()
+ {
+ super();
+ nonProxyName = "InterceptorInherited";
+ }
+
+ @AroundInvoke
+ public Object myint(InvocationContext ic) throws Exception
+ {
+ if (ic.getMethod().getName().equals("shuffle"))
+ {
+ DeckType d = (DeckType) ic.getTarget();
+ d.setIntercepted(nonProxyName);
+ }
+ return ic.proceed();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/InterceptorInheritedIncludedByIndirect.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/InterceptorInheritedIncludedByIndirect.java
new file mode 100644
index 0000000..e69669c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/InterceptorInheritedIncludedByIndirect.java
@@ -0,0 +1,50 @@
+/*
+ * 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.webbeans.newtests.interceptors.inheritance;
+
+import javax.enterprise.context.Dependent;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+@Dependent
+@Interceptor
+@BindingInheritedIncludedByIndirect
+public class InterceptorInheritedIncludedByIndirect
+{
+ private String nonProxyName;
+
+ public InterceptorInheritedIncludedByIndirect()
+ {
+ super();
+ nonProxyName = "InterceptorInheritedIncludedByIndirect";
+ }
+
+ @AroundInvoke
+ public Object myint(InvocationContext ic) throws Exception
+ {
+ if (ic.getMethod().getName().equals("shuffle"))
+ {
+ DeckType d = (DeckType) ic.getTarget();
+ d.setIntercepted(nonProxyName);
+ }
+ return ic.proceed();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/InterceptorMethod.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/InterceptorMethod.java
new file mode 100644
index 0000000..0811ceb
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/InterceptorMethod.java
@@ -0,0 +1,50 @@
+/*
+ * 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.webbeans.newtests.interceptors.inheritance;
+
+import javax.enterprise.context.Dependent;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+@Dependent
+@Interceptor
+@BindingMethodInterceptor
+public class InterceptorMethod
+{
+ private String nonProxyName;
+
+ public InterceptorMethod()
+ {
+ super();
+ nonProxyName = "InterceptorMethod";
+ }
+
+ @AroundInvoke
+ public Object myint(InvocationContext ic) throws Exception
+ {
+ if (ic.getMethod().getName().equals("shuffle"))
+ {
+ DeckType d = (DeckType) ic.getTarget();
+ d.setIntercepted(nonProxyName);
+ }
+ return ic.proceed();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/InterceptorSimple.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/InterceptorSimple.java
new file mode 100644
index 0000000..26ff211
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/InterceptorSimple.java
@@ -0,0 +1,50 @@
+/*
+ * 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.webbeans.newtests.interceptors.inheritance;
+
+import javax.enterprise.context.Dependent;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+@Dependent
+@Interceptor
+@BindingSimpleInterceptor
+public class InterceptorSimple
+{
+ private String nonProxyName;
+
+ public InterceptorSimple()
+ {
+ super();
+ nonProxyName = "InterceptorSimple";
+ }
+
+ @AroundInvoke
+ public Object myint(InvocationContext ic) throws Exception
+ {
+ if (ic.getMethod().getName().equals("shuffle"))
+ {
+ DeckType d = (DeckType) ic.getTarget();
+ d.setIntercepted(nonProxyName);
+ }
+ return ic.proceed();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/StereotypeChild.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/StereotypeChild.java
new file mode 100644
index 0000000..ba9da63
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/StereotypeChild.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.newtests.interceptors.inheritance;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.Stereotype;
+
+@Stereotype
+@BindingIncludedByIndirect
+@BindingInheritedIncludedByIndirect
+@Inherited
+@Target( { ElementType.TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface StereotypeChild
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/StereotypeParent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/StereotypeParent.java
new file mode 100644
index 0000000..1cd0fb8
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/StereotypeParent.java
@@ -0,0 +1,39 @@
+/*
+ * 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.webbeans.newtests.interceptors.inheritance;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.Stereotype;
+
+@Stereotype
+@BindingSimpleInterceptor
+@BindingInheritedInterceptor
+@Inherited
+@StereotypeChild
+@Target( { ElementType.TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface StereotypeParent
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/StereotypeParentNotInherited.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/StereotypeParentNotInherited.java
new file mode 100644
index 0000000..3dda924
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/inheritance/StereotypeParentNotInherited.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.newtests.interceptors.inheritance;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.Stereotype;
+
+@Stereotype
+@BindingSimpleInterceptor
+@StereotypeChild
+@BindingInheritedInterceptor
+@Target( { ElementType.TYPE, ElementType.METHOD })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface StereotypeParentNotInherited
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/InterceptorExtension.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/InterceptorExtension.java
new file mode 100644
index 0000000..7873f65
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/InterceptorExtension.java
@@ -0,0 +1,249 @@
+/*
+ * 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.webbeans.newtests.interceptors.lifecycle;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.*;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.interceptor.Interceptor;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.util.ExceptionUtil;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public class InterceptorExtension implements Extension
+{
+ /**
+ * we add the InterceptorBinding via Extension to test OWB-593
+ * @param event
+ */
+ public void registerInterceptorBinding(@Observes BeforeBeanDiscovery event)
+ {
+ event.addInterceptorBinding(LifecycleBinding.class);
+ }
+
+ public void observeNotAnnotatedBean(@Observes ProcessAnnotatedType<NotAnnotatedBean> process)
+ {
+ process.getAnnotatedType().getAnnotations().add(new AnnotationLiteral<LifecycleBinding>(){});
+ process.setAnnotatedType(process.getAnnotatedType());
+ }
+
+ public void observeLifecycleInterceptorPat(@Observes ProcessAnnotatedType<LifecycleInterceptorPat> process)
+ {
+ process.getAnnotatedType().getAnnotations().add(new AnnotationLiteral<LifecycleBinding>(){});
+ process.getAnnotatedType().getAnnotations().add(new AnnotationLiteral<Interceptor>(){});
+ process.setAnnotatedType(process.getAnnotatedType());
+ }
+
+ // manually add the correct LifecycleInterceptorBbd
+ public void observeLiveCycleInterceptorBbd(@Observes BeforeBeanDiscovery bbd)
+ {
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ AnnotatedTypeImpl<LifecycleInterceptorBbd> annotatedType =
+ new AnnotatedTypeImpl<LifecycleInterceptorBbd>(LifecycleInterceptorBbd.class );
+
+ Set<Annotation> anns = new HashSet<Annotation>();
+ anns.add(new AnnotationLiteral<LifecycleBinding>(){});
+ anns.add(new AnnotationLiteral<Interceptor>(){});
+ annotatedType.setAnnotations(anns);
+
+ bbd.addAnnotatedType(annotatedType);
+ }
+
+ public static class AnnotatedTypeImpl<X> implements AnnotatedType<X>
+ {
+ private Class<X> javaClass;
+ private Set<AnnotatedConstructor<X>> annotatedConstructors = new HashSet<AnnotatedConstructor<X>>();
+ private Set<AnnotatedMethod<? super X>> annotatedMethods = Collections.EMPTY_SET;
+ private Set<AnnotatedField<? super X>> annotatedFields = Collections.EMPTY_SET;
+ private Set<Type> typeClosures = Collections.EMPTY_SET;
+ private Set<Annotation> annotations = Collections.EMPTY_SET;
+
+
+ public AnnotatedTypeImpl(Class<X> javaClass)
+ {
+ this.javaClass = javaClass;
+ this.annotatedConstructors.add(new AnnotatedConstructorImpl<X>(this));
+ }
+
+ @Override
+ public Set<AnnotatedConstructor<X>> getConstructors()
+ {
+ return annotatedConstructors;
+ }
+
+ @Override
+ public Class<X> getJavaClass()
+ {
+ return javaClass;
+ }
+
+ @Override
+ public Set<AnnotatedMethod<? super X>> getMethods()
+ {
+ return annotatedMethods;
+ }
+
+ @Override
+ public Set<AnnotatedField<? super X>> getFields()
+ {
+ return annotatedFields;
+ }
+
+ @Override
+ public Type getBaseType()
+ {
+ return javaClass;
+ }
+
+ @Override
+ public Set<Type> getTypeClosure()
+ {
+ return typeClosures;
+ }
+
+ @Override
+ public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+ {
+ for (Annotation a: annotations)
+ {
+ if (a.annotationType().equals(annotationType))
+ {
+ return (T) a;
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ public Set<Annotation> getAnnotations()
+ {
+ return annotations;
+ }
+
+ @Override
+ public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+ {
+ return getAnnotation(annotationType) != null;
+ }
+
+ public void setAnnotatedConstructors(Set<AnnotatedConstructor<X>> annotatedConstructors)
+ {
+ this.annotatedConstructors = annotatedConstructors;
+ }
+
+ public void setAnnotatedFields(Set<AnnotatedField<? super X>> annotatedFields)
+ {
+ this.annotatedFields = annotatedFields;
+ }
+
+ public void setAnnotatedMethods(Set<AnnotatedMethod<? super X>> annotatedMethods)
+ {
+ this.annotatedMethods = annotatedMethods;
+ }
+
+ public void setAnnotations(Set<Annotation> annotations)
+ {
+ this.annotations = annotations;
+ }
+
+ public void setJavaClass(Class<X> javaClass)
+ {
+ this.javaClass = javaClass;
+ }
+
+ public void setTypeClosures(Set<Type> typeClosures)
+ {
+ this.typeClosures = typeClosures;
+ }
+ }
+
+ public static class AnnotatedConstructorImpl<X> implements AnnotatedConstructor<X> {
+
+ private AnnotatedType<X> declaringType;
+ private Constructor<X> javaMember;
+ private List<AnnotatedParameter<X>> parameters = Collections.EMPTY_LIST;
+ private Set<Annotation> annotations = Collections.EMPTY_SET;
+
+ public AnnotatedConstructorImpl(AnnotatedType<X> declaringType)
+ {
+ try {
+ this.declaringType = declaringType;
+ this.javaMember = declaringType.getJavaClass().getConstructor();
+ } catch (SecurityException e) {
+ ExceptionUtil.throwAsRuntimeException(e);
+ } catch (NoSuchMethodException e) {
+ ExceptionUtil.throwAsRuntimeException(e);
+ }
+ }
+
+ @Override
+ public List<AnnotatedParameter<X>> getParameters() {
+ return parameters;
+ }
+
+ @Override
+ public boolean isStatic() {
+ return false;
+ }
+
+ @Override
+ public AnnotatedType<X> getDeclaringType() {
+ return declaringType;
+ }
+
+ @Override
+ public Type getBaseType() {
+ return javaMember.getDeclaringClass();
+ }
+
+ @Override
+ public Set<Type> getTypeClosure() {
+ return declaringType.getTypeClosure();
+ }
+
+ @Override
+ public <T extends Annotation> T getAnnotation(Class<T> annotationType) {
+ return null;
+ }
+
+ @Override
+ public Set<Annotation> getAnnotations() {
+ return annotations;
+ }
+
+ @Override
+ public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {
+ return false;
+ }
+
+ @Override
+ public Constructor<X> getJavaMember() {
+ return javaMember;
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleBean.java
new file mode 100644
index 0000000..eb675f0
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleBean.java
@@ -0,0 +1,42 @@
+/*
+ * 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.webbeans.newtests.interceptors.lifecycle;
+
+import javax.enterprise.inject.New;
+import javax.inject.Inject;
+
+@LifecycleBinding
+public class LifecycleBean
+{
+ public static String CONSTRUCTOR_INJECTED = null;
+
+ public LifecycleBean()
+ {
+
+ }
+
+ @Inject
+ public LifecycleBean(@New String string)
+ {
+ CONSTRUCTOR_INJECTED = string;
+ }
+
+
+ public void touch(){}
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleBinding.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleBinding.java
new file mode 100644
index 0000000..b95b552
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleBinding.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.newtests.interceptors.lifecycle;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+// we add the @InterceptorBinding via Extension to test for OWB-593
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.TYPE})
+public @interface LifecycleBinding
+{
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleInterceptor.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleInterceptor.java
new file mode 100644
index 0000000..d7f4e38
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleInterceptor.java
@@ -0,0 +1,49 @@
+/*
+ * 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.webbeans.newtests.interceptors.lifecycle;
+
+import java.io.Serializable;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+@LifecycleBinding
+@Interceptor
+public class LifecycleInterceptor implements Serializable
+{
+ public static boolean POST_CONSTRUCT = false;
+
+ public static boolean PRE_DESTROY = false;
+
+ @PostConstruct
+ public void postConstruct(InvocationContext context)
+ {
+ POST_CONSTRUCT = true;
+ NotAnnotatedBean.PC = true;
+ }
+
+ @PreDestroy
+ public void preDestroy(InvocationContext context)
+ {
+ PRE_DESTROY = true;
+ NotAnnotatedBean.PC = true;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleInterceptorBbd.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleInterceptorBbd.java
new file mode 100644
index 0000000..96057f2
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleInterceptorBbd.java
@@ -0,0 +1,51 @@
+/*
+ * 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.webbeans.newtests.interceptors.lifecycle;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+import java.io.Serializable;
+
+/**
+ * this class has no @LifecycleBinding. It will get added later via
+ * an Extension on {@link javax.enterprise.inject.spi.BeforeBeanDiscovery}.
+ */
+@Interceptor
+public class LifecycleInterceptorBbd implements Serializable
+{
+ public static boolean POST_CONSTRUCT = false;
+
+ public static boolean PRE_DESTROY = false;
+
+ @PostConstruct
+ public void postConstruct(InvocationContext context)
+ {
+ POST_CONSTRUCT = true;
+ NotAnnotatedBean.PC = true;
+ }
+
+ @PreDestroy
+ public void preDestroy(InvocationContext context)
+ {
+ PRE_DESTROY = true;
+ NotAnnotatedBean.PC = true;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleInterceptorPat.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleInterceptorPat.java
new file mode 100644
index 0000000..7eda4c9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleInterceptorPat.java
@@ -0,0 +1,50 @@
+/*
+ * 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.webbeans.newtests.interceptors.lifecycle;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.interceptor.InvocationContext;
+import java.io.Serializable;
+
+/**
+ * this class has no @LifecycleBinding nor @Interceptor.
+ * Those will get added later via
+ * an Extension on {@link javax.enterprise.inject.spi.ProcessAnnotatedType}.
+ */
+public class LifecycleInterceptorPat implements Serializable
+{
+ public static boolean POST_CONSTRUCT = false;
+
+ public static boolean PRE_DESTROY = false;
+
+ @PostConstruct
+ public void postConstruct(InvocationContext context)
+ {
+ POST_CONSTRUCT = true;
+ NotAnnotatedBean.PC = true;
+ }
+
+ @PreDestroy
+ public void preDestroy(InvocationContext context)
+ {
+ PRE_DESTROY = true;
+ NotAnnotatedBean.PC = true;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleTest.java
new file mode 100644
index 0000000..bcb308f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleTest.java
@@ -0,0 +1,159 @@
+/*
+ * 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.webbeans.newtests.interceptors.lifecycle;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Test;
+
+public class LifecycleTest extends AbstractUnitTest
+{
+ private static final String PACKAGE_NAME = LifecycleTest.class.getPackage().getName();
+
+ public LifecycleTest()
+ {
+
+ }
+
+ @Test
+ @SuppressWarnings("unchecked")
+ public void testLifecycle()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "LifecycleTest"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(LifecycleInterceptor.class);
+ beanClasses.add(LifecycleBean.class);
+
+ addExtension(new InterceptorExtension());
+
+ startContainer(beanClasses, beanXmls);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans(LifecycleBean.class);
+ Assert.assertNotNull(beans);
+ Bean<LifecycleBean> lifecycleBean = (Bean<LifecycleBean>)beans.iterator().next();
+
+ CreationalContext<LifecycleBean> creationalContext = getBeanManager().createCreationalContext(lifecycleBean);
+
+ Object reference = getBeanManager().getReference(lifecycleBean, LifecycleBean.class, creationalContext);
+ Assert.assertNotNull(reference);
+
+ Assert.assertTrue(reference instanceof LifecycleBean);
+
+ Assert.assertTrue(LifecycleInterceptor.POST_CONSTRUCT);
+
+ Assert.assertNotNull(LifecycleBean.CONSTRUCTOR_INJECTED);
+
+ Assert.assertTrue(!LifecycleInterceptor.PRE_DESTROY);
+
+ lifecycleBean.destroy((LifecycleBean)reference, creationalContext);
+
+ shutDownContainer();
+
+ Assert.assertTrue(LifecycleInterceptor.PRE_DESTROY);
+
+ }
+
+ @Test
+ public void testNotannotated()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "LifecycleTest"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(NotAnnotatedBean.class);
+ beanClasses.add(LifecycleInterceptor.class);
+
+
+ addExtension(new InterceptorExtension());
+
+ startContainer(beanClasses, beanXmls);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans(NotAnnotatedBean.class.getName());
+ Assert.assertNotNull(beans);
+ Bean<NotAnnotatedBean> notAnnotatedBean = (Bean<NotAnnotatedBean>)beans.iterator().next();
+
+ CreationalContext<NotAnnotatedBean> ctx = getBeanManager().createCreationalContext(notAnnotatedBean);
+
+ Object reference = getBeanManager().getReference(notAnnotatedBean, NotAnnotatedBean.class, ctx);
+ Assert.assertNotNull(reference);
+
+ NotAnnotatedBean nab = (NotAnnotatedBean)reference;
+ nab.sayHello();
+ Assert.assertTrue(NotAnnotatedBean.PC);
+
+ shutDownContainer();
+ }
+
+ /**
+ * Test an interceptor with no annotations but instead dynamically
+ * add the InterceptorBinding and stuff via AnnotatedType.
+ * Bbd stands for BeforeBeanDiscovery
+ */
+ @Test
+ public void testDynamicInterceptorBeforeBeanDiscovery()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "LifecycleTestBbd"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(NotAnnotatedBean.class);
+ beanClasses.add(LifecycleInterceptor.class);
+
+
+ addExtension(new InterceptorExtension());
+
+ startContainer(beanClasses, beanXmls);
+
+ shutDownContainer();
+ }
+
+ /**
+ * Test an interceptor with no annotations but instead dynamically
+ * add the InterceptorBinding and stuff via AnnotatedType.
+ * Bbd stands for BeforeBeanDiscovery
+ */
+ @Test
+ public void testDynamicInterceptorProcessAnnotatedType()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "LifecycleTestPat"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(NotAnnotatedBean.class);
+ beanClasses.add(LifecycleInterceptor.class);
+
+
+ addExtension(new InterceptorExtension());
+
+ startContainer(beanClasses, beanXmls);
+
+ shutDownContainer();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/NotAnnotatedBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/NotAnnotatedBean.java
new file mode 100644
index 0000000..45c86cd
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/NotAnnotatedBean.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.newtests.interceptors.lifecycle;
+
+import javax.inject.Named;
+
+@Named("org.apache.webbeans.newtests.interceptors.lifecycle.NotAnnotatedBean")
+public class NotAnnotatedBean
+{
+ public static boolean PC = false;
+
+ public void sayHello()
+ {
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/LifecycleInheritanceTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/LifecycleInheritanceTest.java
new file mode 100644
index 0000000..4a7ca51
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/LifecycleInheritanceTest.java
@@ -0,0 +1,73 @@
+/*
+ * 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.webbeans.newtests.interceptors.lifecycle.inheritance;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Before;
+import org.junit.Test;
+
+public class LifecycleInheritanceTest extends AbstractUnitTest
+{
+ @Before
+ public void before()
+ {
+ SubClassBean.POST_CONSTRUCT = false;
+ SubClassBean.PRE_DESTOY = false;
+
+ SuperClassBean.POST_CONSTRUCT = false;
+ SuperClassBean.PRE_DESTOY = false;
+ }
+
+
+ @Test
+ public void testLifecycle()
+ {
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(SubClassBean.class);
+ classes.add(SuperClassBean.class);
+
+ startContainer(classes);
+
+ BeanManager manager = getBeanManager();
+ Bean<?> subClassBean = manager.getBeans(SubClassBean.class, new Annotation[0]).iterator().next();
+
+ Object subClassInstance = manager.getReference(subClassBean, SubClassBean.class, manager.createCreationalContext(subClassBean));
+
+ Assert.assertTrue(subClassInstance instanceof SubClassBean);
+ SubClassBean beanInstance = (SubClassBean)subClassInstance;
+ beanInstance.business();
+
+ Assert.assertTrue(SubClassBean.POST_CONSTRUCT);
+ Assert.assertTrue(SuperClassBean.POST_CONSTRUCT);
+
+ shutDownContainer();
+
+ Assert.assertTrue(SubClassBean.PRE_DESTOY);
+ Assert.assertTrue(SuperClassBean.PRE_DESTOY);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/LifecycleInheritedOverridenTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/LifecycleInheritedOverridenTest.java
new file mode 100644
index 0000000..df49c65
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/LifecycleInheritedOverridenTest.java
@@ -0,0 +1,86 @@
+/*
+ * 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.webbeans.newtests.interceptors.lifecycle.inheritance;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Before;
+import org.junit.Test;
+
+public class LifecycleInheritedOverridenTest extends AbstractUnitTest
+{
+ @Before
+ public void before()
+ {
+ SubClassBean.POST_CONSTRUCT = false;
+ SubClassBean.PRE_DESTOY = false;
+
+ SuperClassBean.POST_CONSTRUCT = false;
+ SuperClassBean.PRE_DESTOY = false;
+ }
+
+ @Test
+ public void testInheritedOverridenMethods()
+ {
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(SubClassBean.class);
+ classes.add(SubClassInheritedBean.class);
+
+ startContainer(classes);
+
+ BeanManager manager = getBeanManager();
+ Bean<?> subClassBean = manager.getBeans(SubClassInheritedBean.class, new Annotation[0]).iterator().next();
+
+ Object subClassInstance = manager.getReference(subClassBean, SubClassInheritedBean.class, manager.createCreationalContext(subClassBean));
+
+ Assert.assertTrue(subClassInstance instanceof SubClassInheritedBean);
+ SubClassInheritedBean beanInstance = (SubClassInheritedBean)subClassInstance;
+ beanInstance.business();
+
+ Assert.assertFalse(SubClassInheritedBean.POST_CONSTRUCT);
+ Assert.assertFalse(SubClassInheritedBean.POST_CONSTRUCT);
+
+ Assert.assertTrue(SubClassBean.POST_CONSTRUCT);
+ Assert.assertTrue(SubClassBean.POST_CONSTRUCT);
+
+ Assert.assertFalse(SuperClassBean.POST_CONSTRUCT);
+ Assert.assertFalse(SuperClassBean.POST_CONSTRUCT);
+
+ shutDownContainer();
+
+ Assert.assertFalse(SubClassInheritedBean.PRE_DESTOY);
+ Assert.assertFalse(SubClassInheritedBean.PRE_DESTOY);
+
+ Assert.assertTrue(SubClassBean.PRE_DESTOY);
+ Assert.assertTrue(SubClassBean.PRE_DESTOY);
+
+ Assert.assertFalse(SuperClassBean.PRE_DESTOY);
+ Assert.assertFalse(SuperClassBean.PRE_DESTOY);
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/SubClassBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/SubClassBean.java
new file mode 100644
index 0000000..6f0c71b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/SubClassBean.java
@@ -0,0 +1,52 @@
+/*
+ * 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.webbeans.newtests.interceptors.lifecycle.inheritance;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.enterprise.context.RequestScoped;
+
+@RequestScoped
+public class SubClassBean extends SuperClassBean
+{
+ public static boolean POST_CONSTRUCT = false;
+ public static boolean PRE_DESTOY = false;
+
+ public SubClassBean()
+ {
+
+ }
+
+ public void business()
+ {
+
+ }
+
+ @PostConstruct
+ public void postConstruct1()
+ {
+ POST_CONSTRUCT = true;
+ }
+
+ @PreDestroy
+ public void preDestroy1()
+ {
+ PRE_DESTOY = true;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/SubClassInheritedBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/SubClassInheritedBean.java
new file mode 100644
index 0000000..18cd1b6
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/SubClassInheritedBean.java
@@ -0,0 +1,52 @@
+/*
+ * 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.webbeans.newtests.interceptors.lifecycle.inheritance;
+
+import javax.enterprise.context.RequestScoped;
+
+@RequestScoped
+public class SubClassInheritedBean extends SubClassBean
+{
+ public static boolean POST_CONSTRUCT = false;
+ public static boolean PRE_DESTOY = false;
+
+ public SubClassInheritedBean()
+ {
+
+ }
+
+ @Override
+ public void business()
+ {
+
+ }
+
+ @Override
+ public void postConstruct()
+ {
+ POST_CONSTRUCT = true;
+ }
+
+ @Override
+ public void preDestroy()
+ {
+ PRE_DESTOY = true;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/SuperClassBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/SuperClassBean.java
new file mode 100644
index 0000000..4597862
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/SuperClassBean.java
@@ -0,0 +1,45 @@
+/*
+ * 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.webbeans.newtests.interceptors.lifecycle.inheritance;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+
+public class SuperClassBean
+{
+ public static boolean POST_CONSTRUCT = false;
+ public static boolean PRE_DESTOY = false;
+
+ public SuperClassBean()
+ {
+
+ }
+
+ @PostConstruct
+ public void postConstruct()
+ {
+ POST_CONSTRUCT = true;
+ }
+
+ @PreDestroy
+ public void preDestroy()
+ {
+ PRE_DESTOY = true;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/CdiInterceptorBeanBuilderTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/CdiInterceptorBeanBuilderTest.java
new file mode 100644
index 0000000..2cbbced
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/CdiInterceptorBeanBuilderTest.java
@@ -0,0 +1,142 @@
+/*
+ * 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.webbeans.newtests.interceptors.resolution;
+
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InterceptionType;
+import javax.enterprise.inject.spi.Interceptor;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.webbeans.component.BeanAttributesImpl;
+import org.apache.webbeans.component.InterceptorBean;
+import org.apache.webbeans.component.creation.BeanAttributesBuilder;
+import org.apache.webbeans.component.creation.CdiInterceptorBeanBuilder;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.interceptors.factory.beans.ClassInterceptedClass;
+import org.apache.webbeans.newtests.interceptors.resolution.beans.UtilitySampleBean;
+import org.apache.webbeans.newtests.interceptors.resolution.interceptors.TestIntercepted1;
+import org.apache.webbeans.newtests.interceptors.resolution.interceptors.TestInterceptor1;
+import org.apache.webbeans.newtests.interceptors.resolution.interceptors.TestInterceptorParent;
+import org.apache.webbeans.test.component.intercept.webbeans.SecureAndTransactionalInterceptor;
+import org.apache.webbeans.test.component.intercept.webbeans.TransactionalInterceptor;
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Tests for the various InterceptorBeanBuilder implementations.
+ */
+public class CdiInterceptorBeanBuilderTest extends AbstractUnitTest
+{
+ @Test
+ public void testClassLevelSingleInterceptor() throws Exception
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(this.getClass().getPackage().getName(), InterceptorResolutionServiceTest.class.getSimpleName()));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(ClassInterceptedClass.class);
+ beanClasses.add(Transactional.class);
+ beanClasses.add(TransactionalInterceptor.class);
+ beanClasses.add(TestIntercepted1.class);
+ beanClasses.add(TestInterceptor1.class);
+ beanClasses.add(TestInterceptorParent.class);
+ beanClasses.add(UtilitySampleBean.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ {
+ // take an Interceptor class which is not listed in beans.xml and verify that is is not enabled
+ AnnotatedType<SecureAndTransactionalInterceptor> annotatedType = getBeanManager().createAnnotatedType(SecureAndTransactionalInterceptor.class);
+ BeanAttributesImpl<SecureAndTransactionalInterceptor> beanAttributes = BeanAttributesBuilder.forContext(getWebBeansContext()).newBeanAttibutes(annotatedType).build();
+
+ CdiInterceptorBeanBuilder<SecureAndTransactionalInterceptor> ibb
+ = new CdiInterceptorBeanBuilder<SecureAndTransactionalInterceptor>(getWebBeansContext(), annotatedType, beanAttributes);
+ Assert.assertFalse(ibb.isInterceptorEnabled());
+ }
+
+ {
+ AnnotatedType<TransactionalInterceptor> annotatedType = getBeanManager().createAnnotatedType(TransactionalInterceptor.class);
+ BeanAttributesImpl<TransactionalInterceptor> beanAttributes = BeanAttributesBuilder.forContext(getWebBeansContext()).newBeanAttibutes(annotatedType).build();
+
+ CdiInterceptorBeanBuilder<TransactionalInterceptor> ibb
+ = new CdiInterceptorBeanBuilder<TransactionalInterceptor>(getWebBeansContext(), annotatedType, beanAttributes);
+ ibb.defineCdiInterceptorRules();
+ Interceptor<TransactionalInterceptor> bean = ibb.getBean();
+ Assert.assertNotNull(bean);
+
+ Assert.assertNotNull(bean.getInterceptorBindings());
+ Assert.assertEquals(1, bean.getInterceptorBindings().size());
+
+ Assert.assertTrue(bean.intercepts(InterceptionType.AROUND_INVOKE));
+ Assert.assertFalse(bean.intercepts(InterceptionType.AROUND_TIMEOUT));
+ Assert.assertFalse(bean.intercepts(InterceptionType.POST_CONSTRUCT));
+
+ }
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testClassLevelParentInterceptor() throws Exception
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(this.getClass().getPackage().getName(), InterceptorResolutionServiceTest.class.getSimpleName()));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(TestIntercepted1.class);
+ beanClasses.add(TestInterceptor1.class);
+ beanClasses.add(TestInterceptorParent.class);
+ beanClasses.add(UtilitySampleBean.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ AnnotatedType<TestInterceptor1> annotatedType = getBeanManager().createAnnotatedType(TestInterceptor1.class);
+ BeanAttributesImpl<TestInterceptor1> beanAttributes = BeanAttributesBuilder.forContext(getWebBeansContext()).newBeanAttibutes(annotatedType).build();
+
+ CdiInterceptorBeanBuilder<TestInterceptor1> ibb
+ = new CdiInterceptorBeanBuilder<TestInterceptor1>(getWebBeansContext(), annotatedType, beanAttributes);
+ ibb.defineCdiInterceptorRules();
+ InterceptorBean<TestInterceptor1> bean = ibb.getBean();
+ Assert.assertNotNull(bean);
+
+ Assert.assertTrue(bean.intercepts(InterceptionType.AROUND_INVOKE));
+ Assert.assertTrue(bean.intercepts(InterceptionType.AROUND_TIMEOUT));
+ Assert.assertTrue(bean.intercepts(InterceptionType.PRE_DESTROY));
+ Assert.assertTrue(bean.intercepts(InterceptionType.POST_CONSTRUCT));
+
+ Assert.assertFalse(bean.intercepts(InterceptionType.PRE_PASSIVATE));
+ Assert.assertFalse(bean.intercepts(InterceptionType.POST_ACTIVATE));
+ Assert.assertEquals(1, bean.getInterceptorBindings().size());
+
+ Assert.assertEquals(1, bean.getInterceptorMethods(InterceptionType.AROUND_INVOKE).length);
+ Assert.assertEquals(1, bean.getInterceptorMethods(InterceptionType.AROUND_TIMEOUT).length);
+ Assert.assertEquals(2, bean.getInterceptorMethods(InterceptionType.POST_CONSTRUCT).length);
+ Assert.assertEquals(2, bean.getInterceptorMethods(InterceptionType.PRE_DESTROY).length);
+
+ CreationalContext<TestInterceptor1> cc = getBeanManager().createCreationalContext(bean);
+ TestInterceptor1 interceptorInstance = bean.create(cc);
+ Assert.assertNotNull(interceptorInstance);
+
+ shutDownContainer();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/EjbInterceptorBeanBuilderTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/EjbInterceptorBeanBuilderTest.java
new file mode 100644
index 0000000..e568497
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/EjbInterceptorBeanBuilderTest.java
@@ -0,0 +1,96 @@
+/*
+ * 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.webbeans.newtests.interceptors.resolution;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InterceptionType;
+import javax.enterprise.inject.spi.Interceptor;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.webbeans.component.BeanAttributesImpl;
+import org.apache.webbeans.component.InterceptorBean;
+import org.apache.webbeans.component.creation.BeanAttributesBuilder;
+import org.apache.webbeans.component.creation.EjbInterceptorBeanBuilder;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+
+import org.apache.webbeans.newtests.interceptors.ejb.EjbInterceptor;
+import org.apache.webbeans.newtests.interceptors.ejb.ManagedBeanWithEjbInterceptor;
+import org.apache.webbeans.newtests.interceptors.resolution.beans.UtilitySampleBean;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Test for building EJB-style interceptor beans
+ */
+public class EjbInterceptorBeanBuilderTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testEjbInterceptorBeanCreation()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(UtilitySampleBean.class);
+ beanClasses.add(EjbInterceptor.class);
+ beanClasses.add(ManagedBeanWithEjbInterceptor.class);
+
+ startContainer(beanClasses, null);
+
+ AnnotatedType<EjbInterceptor> annotatedType = getBeanManager().createAnnotatedType(EjbInterceptor.class);
+
+ BeanAttributesImpl<EjbInterceptor> beanAttributes = BeanAttributesBuilder.forContext(getWebBeansContext()).newBeanAttibutes(annotatedType).build();
+ EjbInterceptorBeanBuilder<EjbInterceptor> ibb
+ = new EjbInterceptorBeanBuilder<EjbInterceptor>(getWebBeansContext(), annotatedType, beanAttributes);
+ ibb.defineEjbInterceptorRules();
+ InterceptorBean<EjbInterceptor> bean = ibb.getBean();
+ Assert.assertNotNull(bean);
+
+ CreationalContext<EjbInterceptor> cc = getBeanManager().createCreationalContext(bean);
+
+ EjbInterceptor ebi = bean.create(cc);
+ Assert.assertNotNull(ebi);
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testInterceptorsManagerEjbBeanCreation()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(UtilitySampleBean.class);
+ beanClasses.add(EjbInterceptor.class);
+ beanClasses.add(ManagedBeanWithEjbInterceptor.class);
+
+ startContainer(beanClasses, null);
+
+ Interceptor<EjbInterceptor> interceptor = getWebBeansContext().getInterceptorsManager().getEjbInterceptorForClass(EjbInterceptor.class);
+ Assert.assertNotNull(interceptor);
+ Assert.assertTrue(interceptor.intercepts(InterceptionType.AROUND_INVOKE));
+
+ Interceptor<EjbInterceptor> interceptor2 = getWebBeansContext().getInterceptorsManager().getEjbInterceptorForClass(EjbInterceptor.class);
+ Assert.assertNotNull(interceptor2);
+ Assert.assertTrue(interceptor2.intercepts(InterceptionType.AROUND_INVOKE));
+
+ Assert.assertTrue(interceptor == interceptor2); // should return previous instance
+
+ shutDownContainer();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptBridgeMethodTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptBridgeMethodTest.java
new file mode 100644
index 0000000..6bd0da6
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptBridgeMethodTest.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.interceptors.resolution;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.enterprise.inject.spi.Bean;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.interceptors.resolution.beans.Foo;
+import org.apache.webbeans.newtests.interceptors.resolution.beans.FooImpl;
+import org.apache.webbeans.newtests.interceptors.resolution.beans.UtilitySampleBean;
+import org.apache.webbeans.newtests.interceptors.resolution.interceptors.TestIntercepted1;
+import org.apache.webbeans.newtests.interceptors.resolution.interceptors.TestInterceptor1;
+import org.apache.webbeans.newtests.interceptors.resolution.interceptors.TestInterceptorParent;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class InterceptBridgeMethodTest extends AbstractUnitTest
+{
+
+ @Test
+ public final void testMethodLevelInterceptorOnBridgeMethod()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(this.getClass().getPackage().getName(), InterceptorResolutionServiceTest.class.getSimpleName()));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(TestIntercepted1.class);
+ beanClasses.add(TestInterceptor1.class);
+ beanClasses.add(TestInterceptorParent.class);
+ beanClasses.add(UtilitySampleBean.class);
+
+ beanClasses.add(Foo.class);
+ beanClasses.add(FooImpl.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ final Bean<FooImpl> bean = getBean(FooImpl.class);
+ FooImpl instance = FooImpl.class.cast(getBeanManager().getReference(bean, FooImpl.class, null));
+ Assert.assertNotNull(instance);
+
+ instance.doSomething("test1");
+
+ // Ensure the method call was intercepted, and value was set
+ Assert.assertEquals(TestInterceptor1.invocationCount, 1);
+ Assert.assertEquals(instance.getValue(), "test1");
+
+ // Cast FooImpl to Foo, testing if the call becoming doSomething(Object)
+ // breaks the interception
+ Foo castInstance = (Foo) instance;
+ castInstance.doSomething("test2");
+
+ // Ensure the method call on to doSomethign(Object) was intercepted, and
+ // value was set
+ Assert.assertEquals(TestInterceptor1.invocationCount, 2);
+ Assert.assertEquals(instance.getValue(), "test2");
+
+ shutDownContainer();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptorProxyChainTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptorProxyChainTest.java
new file mode 100644
index 0000000..d0692b8
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptorProxyChainTest.java
@@ -0,0 +1,212 @@
+/*
+ * 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.webbeans.newtests.interceptors.resolution;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Interceptor;
+import javax.inject.Provider;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.webbeans.intercept.DefaultInterceptorHandler;
+import org.apache.webbeans.intercept.InterceptorResolutionService;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.interceptors.factory.beans.ClassMultiInterceptedClass;
+import org.apache.webbeans.proxy.InterceptorDecoratorProxyFactory;
+import org.apache.webbeans.proxy.InterceptorHandler;
+import org.apache.webbeans.proxy.NormalScopeProxyFactory;
+import org.apache.webbeans.proxy.ProxyGenerationException;
+import org.apache.webbeans.test.component.intercept.webbeans.ActionInterceptor;
+import org.apache.webbeans.test.component.intercept.webbeans.SecureInterceptor;
+import org.apache.webbeans.test.component.intercept.webbeans.TransactionalInterceptor;
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Action;
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Secure;
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Test the interceptor Resolution and creating a proxy from it.
+ */
+public class InterceptorProxyChainTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testInterceptorProxyChain() throws Exception
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(this.getClass().getPackage().getName(), InterceptorResolutionServiceTest.class.getSimpleName()));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(ClassMultiInterceptedClass.class);
+ beanClasses.add(Transactional.class);
+ beanClasses.add(Secure.class);
+ beanClasses.add(Action.class);
+ beanClasses.add(ActionInterceptor.class);
+ beanClasses.add(SecureInterceptor.class);
+ beanClasses.add(TransactionalInterceptor.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ InterceptorResolutionService ir = new InterceptorResolutionService(getWebBeansContext());
+ AnnotatedType<ClassMultiInterceptedClass> annotatedType = getBeanManager().createAnnotatedType(ClassMultiInterceptedClass.class);
+ Bean<ClassMultiInterceptedClass> bean = (Bean<ClassMultiInterceptedClass>) getBeanManager().resolve(getBeanManager().getBeans(ClassMultiInterceptedClass.class));
+
+ InterceptorResolutionService.BeanInterceptorInfo interceptorInfo = ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(), annotatedType);
+ Assert.assertNotNull(interceptorInfo);
+
+
+ // not via BeanManager but native. We will proxy it ourselfs
+ ClassMultiInterceptedClass internalInstance = new ClassMultiInterceptedClass();
+ CreationalContext<ClassMultiInterceptedClass> cc = getBeanManager().createCreationalContext(bean);
+
+ // step 1.
+ // calculate the interceptor-method info
+ Map<Method, List<Interceptor<?>>> methodInterceptors = new HashMap<Method, List<Interceptor<?>>>();
+ List<Method> nonBusinessMethods = new ArrayList<Method>();
+ for (Map.Entry<Method, InterceptorResolutionService.BusinessMethodInterceptorInfo> miEntry : interceptorInfo.getBusinessMethodsInfo().entrySet())
+ {
+ Method interceptedMethod = miEntry.getKey();
+ InterceptorResolutionService.BusinessMethodInterceptorInfo mii = miEntry.getValue();
+ List<Interceptor<?>> activeInterceptors = new ArrayList<Interceptor<?>>();
+
+ if (mii.getEjbInterceptors() != null)
+ {
+ for (Interceptor<?> i : mii.getEjbInterceptors())
+ {
+ activeInterceptors.add(i);
+ }
+ }
+ if (mii.getCdiInterceptors() != null)
+ {
+ for (Interceptor<?> i : mii.getCdiInterceptors())
+ {
+ activeInterceptors.add(i);
+ }
+ }
+ if (activeInterceptors.size() > 0)
+ {
+ methodInterceptors.put(interceptedMethod, activeInterceptors);
+ }
+ }
+
+ // step 2.
+ // creating the Proxy Class itself
+ InterceptorDecoratorProxyFactory pf = new InterceptorDecoratorProxyFactory(getWebBeansContext());
+
+ // we take a fresh URLClassLoader to not blur the test classpath with synthetic classes.
+ ClassLoader classLoader = this.getClass().getClassLoader(); // new URLClassLoader(new URL[0]);
+
+ Method[] businessMethods = methodInterceptors.keySet().toArray(new Method[methodInterceptors.size()]);
+ Method[] nonInterceptedMethods = interceptorInfo.getNonInterceptedMethods().toArray(new Method[interceptorInfo.getNonInterceptedMethods().size()]);
+
+ Class<? extends ClassMultiInterceptedClass> proxyClass = pf.createProxyClass(bean, classLoader, ClassMultiInterceptedClass.class, businessMethods, nonInterceptedMethods);
+ Assert.assertNotNull(proxyClass);
+
+
+ // step 3.
+ // creating the InterceptorHandler for each intercepted instance later at runtime
+ Map<Interceptor<?>,Object> interceptorInstances = new HashMap<Interceptor<?>, Object>();
+ for (Interceptor interceptorBean : interceptorInfo.getCdiInterceptors())
+ {
+ Object interceptorInstance = interceptorBean.create(cc);
+ interceptorInstances.put(interceptorBean, interceptorInstance);
+ }
+ InterceptorHandler interceptorHandler
+ = new DefaultInterceptorHandler<ClassMultiInterceptedClass>(internalInstance, internalInstance, methodInterceptors, interceptorInstances, null);
+
+ ClassMultiInterceptedClass proxyInstance = pf.createProxyInstance(proxyClass, internalInstance, interceptorHandler);
+ Assert.assertNotNull(proxyInstance);
+
+ Assert.assertEquals(internalInstance, proxyInstance.getSelf());
+
+ proxyInstance.setMeaningOfLife(42);
+ Assert.assertEquals(42, proxyInstance.getMeaningOfLife());
+
+ // for testing with the old proxies
+ //X proxyInstance = getInstance(ClassMultiInterceptedClass.class);
+
+ //X this is for creating the NormalScoping Proxy which is now separate
+ proxyInstance = createNormalScopingProxy(classLoader, ClassMultiInterceptedClass.class, proxyInstance);
+
+ //X performBenchmarkOn(proxyInstance);
+
+ shutDownContainer();
+ }
+
+ private <T> T createNormalScopingProxy(ClassLoader classLoader, Class<T> clazz, T instance) throws ProxyGenerationException
+ {
+ NormalScopeProxyFactory pf = new NormalScopeProxyFactory(getWebBeansContext());
+
+ Class<T> proxyClass = pf.createProxyClass(classLoader, clazz);
+ Assert.assertNotNull(proxyClass);
+
+ return pf.createProxyInstance(proxyClass, new TestRequestScopedInstanceProvider(instance));
+ }
+
+ private void performBenchmarkOn(ClassMultiInterceptedClass proxyInstance)
+ {
+
+ // warmup
+ action(proxyInstance, 1000);
+
+ System.out.println("Starting the real bench");
+ long start = System.nanoTime();
+ action(proxyInstance, 10000000);
+ long end = System.nanoTime();
+ System.out.println("took: " + (end - start)/1000);
+ }
+
+ private void action(ClassMultiInterceptedClass proxyInstance, int counter)
+ {
+ for (int i=0; i < counter; i++) {
+ proxyInstance.getChar();
+ proxyInstance.getFloat();
+ proxyInstance.setMeaningOfLife(42);
+ proxyInstance.getMeaningOfLife();
+ proxyInstance.getSelf();
+ }
+ }
+
+ /**
+ * Test Provider for emulating a RequestScopedProxy
+ * @param <T>
+ */
+ public static class TestRequestScopedInstanceProvider<T> implements Provider<T>
+ {
+ private ThreadLocal<T> instance = new ThreadLocal<T>();
+
+ public TestRequestScopedInstanceProvider(T instance)
+ {
+ this.instance.set(instance);
+ }
+
+ @Override
+ public T get()
+ {
+ return instance.get();
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptorResolutionServiceTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptorResolutionServiceTest.java
new file mode 100644
index 0000000..b3033da
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptorResolutionServiceTest.java
@@ -0,0 +1,322 @@
+/*
+ * 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.webbeans.newtests.interceptors.resolution;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InterceptionType;
+import javax.enterprise.util.AnnotationLiteral;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.webbeans.intercept.InterceptorResolutionService;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.decorators.common.Cow;
+import org.apache.webbeans.newtests.interceptors.factory.beans.ClassInterceptedClass;
+import org.apache.webbeans.newtests.interceptors.factory.beans.ClassMultiInterceptedClass;
+import org.apache.webbeans.newtests.interceptors.factory.beans.DecoratedClass;
+import org.apache.webbeans.newtests.interceptors.factory.beans.MethodInterceptedClass;
+import org.apache.webbeans.newtests.interceptors.factory.beans.MyAbstractTestDecorator;
+import org.apache.webbeans.newtests.interceptors.factory.beans.StereotypeInterceptedClass;
+import org.apache.webbeans.test.annotation.binding.Binding1;
+import org.apache.webbeans.test.component.decorator.clean.ServiceDecorator;
+import org.apache.webbeans.test.component.intercept.webbeans.ActionInterceptor;
+import org.apache.webbeans.test.component.intercept.webbeans.SecureInterceptor;
+import org.apache.webbeans.test.component.intercept.webbeans.TransactionalInterceptor;
+import org.apache.webbeans.test.component.intercept.InterceptedComponent;
+import org.apache.webbeans.test.component.intercept.Interceptor1;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Action;
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Secure;
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import static org.apache.webbeans.intercept.InterceptorResolutionService.BeanInterceptorInfo;
+import static org.apache.webbeans.intercept.InterceptorResolutionService.BusinessMethodInterceptorInfo;
+import static org.apache.webbeans.intercept.InterceptorResolutionService.LifecycleMethodInfo;
+
+
+/**
+ * Test interceptor resolution.
+ */
+public class InterceptorResolutionServiceTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testClassLevelSingleInterceptor() throws Exception
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(this.getClass().getPackage().getName(), this.getClass().getSimpleName()));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(ClassInterceptedClass.class);
+ beanClasses.add(Transactional.class);
+ beanClasses.add(TransactionalInterceptor.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ InterceptorResolutionService ir = new InterceptorResolutionService(getWebBeansContext());
+ AnnotatedType<ClassInterceptedClass> annotatedType = getBeanManager().createAnnotatedType(ClassInterceptedClass.class);
+ Bean<ClassInterceptedClass> bean =
+ (Bean<ClassInterceptedClass>) getBeanManager().resolve((Set) getBeanManager().getBeans(ClassInterceptedClass.class));
+
+ BeanInterceptorInfo interceptorInfo = ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(), annotatedType);
+ Assert.assertNotNull(interceptorInfo);
+
+ Assert.assertNotNull(interceptorInfo.getCdiInterceptors());
+ Assert.assertEquals(1, interceptorInfo.getCdiInterceptors().size());
+
+ Assert.assertEquals(0, interceptorInfo.getDecorators().size());
+
+ Map<Method, BusinessMethodInterceptorInfo> methodInterceptorInfos = interceptorInfo.getBusinessMethodsInfo();
+ Assert.assertNotNull(methodInterceptorInfos);
+ Assert.assertEquals(12, methodInterceptorInfos.size());
+
+ for (BusinessMethodInterceptorInfo mi : methodInterceptorInfos.values())
+ {
+ Assert.assertEquals(1, mi.getCdiInterceptors().length);
+ }
+
+ Assert.assertEquals(2, interceptorInfo.getLifecycleMethodInterceptorInfos().size());
+ LifecycleMethodInfo lmiPostConstruct = interceptorInfo.getLifecycleMethodInterceptorInfos().get(InterceptionType.POST_CONSTRUCT);
+ Assert.assertNotNull(lmiPostConstruct);
+ Assert.assertNull(lmiPostConstruct.getMethodInterceptorInfo().getCdiInterceptors());
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testStereotypeInterceptorBinding() throws Exception
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(getClass().getPackage().getName(), getClass().getSimpleName()));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(StereotypeInterceptedClass.class);
+ beanClasses.add(Transactional.class);
+ beanClasses.add(TransactionalInterceptor.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ InterceptorResolutionService ir = new InterceptorResolutionService(getWebBeansContext());
+ AnnotatedType<StereotypeInterceptedClass> annotatedType = getBeanManager().createAnnotatedType(StereotypeInterceptedClass.class);
+ Bean<StereotypeInterceptedClass> bean =
+ (Bean<StereotypeInterceptedClass>) getBeanManager().resolve((Set) getBeanManager().getBeans(StereotypeInterceptedClass.class));
+
+ BeanInterceptorInfo interceptorInfo = ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(), annotatedType);
+ Assert.assertNotNull(interceptorInfo);
+
+ Assert.assertNotNull(interceptorInfo.getCdiInterceptors());
+ Assert.assertEquals(1, interceptorInfo.getCdiInterceptors().size());
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testClassLevelMultipleInterceptor() throws Exception
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(this.getClass().getPackage().getName(), this.getClass().getSimpleName()));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(ClassMultiInterceptedClass.class);
+ beanClasses.add(Transactional.class);
+ beanClasses.add(Secure.class);
+ beanClasses.add(Action.class);
+ beanClasses.add(ActionInterceptor.class);
+ beanClasses.add(SecureInterceptor.class);
+ beanClasses.add(TransactionalInterceptor.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ InterceptorResolutionService ir = new InterceptorResolutionService(getWebBeansContext());
+ AnnotatedType<ClassMultiInterceptedClass> annotatedType = getBeanManager().createAnnotatedType(ClassMultiInterceptedClass.class);
+ Bean<ClassMultiInterceptedClass> bean =
+ (Bean<ClassMultiInterceptedClass>) getBeanManager().resolve((Set) getBeanManager().getBeans(ClassMultiInterceptedClass.class));
+
+ BeanInterceptorInfo interceptorInfo = ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(), annotatedType);
+ Assert.assertNotNull(interceptorInfo);
+
+ Assert.assertNotNull(interceptorInfo.getCdiInterceptors());
+ Assert.assertEquals(3, interceptorInfo.getCdiInterceptors().size());
+
+ Assert.assertEquals(0, interceptorInfo.getDecorators().size());
+
+ Map<Method, BusinessMethodInterceptorInfo> methodInterceptorInfos = interceptorInfo.getBusinessMethodsInfo();
+ Assert.assertNotNull(methodInterceptorInfos);
+ Assert.assertEquals(7, methodInterceptorInfos.size());
+
+ for (BusinessMethodInterceptorInfo mi : methodInterceptorInfos.values())
+ {
+ Assert.assertEquals(3, mi.getCdiInterceptors().length);
+ }
+
+ Assert.assertEquals(2, interceptorInfo.getLifecycleMethodInterceptorInfos().size());
+ LifecycleMethodInfo lmiPostConstruct = interceptorInfo.getLifecycleMethodInterceptorInfos().get(InterceptionType.POST_CONSTRUCT);
+ Assert.assertNotNull(lmiPostConstruct);
+ Assert.assertNotNull(lmiPostConstruct.getMethodInterceptorInfo().getCdiInterceptors());
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testMethodLevelInterceptor() throws Exception
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(this.getClass().getPackage().getName(), this.getClass().getSimpleName()));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(MethodInterceptedClass.class);
+ beanClasses.add(Transactional.class);
+ beanClasses.add(Secure.class);
+ beanClasses.add(SecureInterceptor.class);
+ beanClasses.add(TransactionalInterceptor.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ InterceptorResolutionService ir = new InterceptorResolutionService(getWebBeansContext());
+ AnnotatedType<MethodInterceptedClass> annotatedType = getBeanManager().createAnnotatedType(MethodInterceptedClass.class);
+ Bean<MethodInterceptedClass> bean =
+ (Bean<MethodInterceptedClass>) getBeanManager().resolve((Set) getBeanManager().getBeans(MethodInterceptedClass.class));
+
+ BeanInterceptorInfo interceptorInfo = ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(), annotatedType);
+ Assert.assertNotNull(interceptorInfo);
+
+ Assert.assertNotNull(interceptorInfo.getCdiInterceptors());
+ Assert.assertEquals(2, interceptorInfo.getCdiInterceptors().size());
+
+ Assert.assertEquals(0, interceptorInfo.getDecorators().size());
+
+ Map<Method, BusinessMethodInterceptorInfo> methodInterceptorInfos = interceptorInfo.getBusinessMethodsInfo();
+ Assert.assertNotNull(methodInterceptorInfos);
+ Assert.assertEquals(2, methodInterceptorInfos.size());
+
+ for (Map.Entry<Method, BusinessMethodInterceptorInfo> mi : methodInterceptorInfos.entrySet())
+ {
+ if (mi.getKey().getName().equals("getMeaningOfLife"))
+ {
+ Assert.assertEquals(1, mi.getValue().getCdiInterceptors().length);
+ }
+ else if (mi.getKey().getName().equals("setMeaningOfLife"))
+ {
+ Assert.assertEquals(2, mi.getValue().getCdiInterceptors().length);
+ }
+ }
+
+ Assert.assertEquals(1, interceptorInfo.getNonInterceptedMethods().size());
+
+ shutDownContainer();
+ }
+
+
+ @Test
+ public void testDecoratorResolution() throws Exception
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(this.getClass().getPackage().getName(), this.getClass().getSimpleName()));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(DecoratedClass.class);
+ beanClasses.add(ServiceDecorator.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ InterceptorResolutionService ir = new InterceptorResolutionService(getWebBeansContext());
+ AnnotatedType<DecoratedClass> annotatedType = getBeanManager().createAnnotatedType(DecoratedClass.class);
+ Bean<DecoratedClass> bean =
+ (Bean<DecoratedClass>) getBeanManager().resolve((Set) getBeanManager().getBeans(DecoratedClass.class, new AnnotationLiteral<Binding1>() {}));
+
+ BeanInterceptorInfo interceptorInfo = ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(), annotatedType);
+ Assert.assertNotNull(interceptorInfo);
+
+ Assert.assertNotNull(interceptorInfo.getBusinessMethodsInfo());
+ Assert.assertEquals(1, interceptorInfo.getBusinessMethodsInfo().size());
+
+ Assert.assertNotNull(interceptorInfo.getDecorators());
+ Assert.assertEquals(1, interceptorInfo.getDecorators().size());
+
+ shutDownContainer();
+ }
+
+
+ @Test
+ public void testAbstractDecoratorResolution() throws Exception
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(this.getClass().getPackage().getName(), this.getClass().getSimpleName()));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(Cow.class);
+ beanClasses.add(MyAbstractTestDecorator.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ InterceptorResolutionService ir = new InterceptorResolutionService(getWebBeansContext());
+ AnnotatedType<Cow> annotatedType = getBeanManager().createAnnotatedType(Cow.class);
+ Bean<Cow> bean = (Bean<Cow>) getBeanManager().resolve((Set) getBeanManager().getBeans(Cow.class));
+ Assert.assertNotNull(bean);
+
+ BeanInterceptorInfo interceptorInfo = ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(), annotatedType);
+ Assert.assertNotNull(interceptorInfo);
+
+ Assert.assertNotNull(interceptorInfo.getBusinessMethodsInfo());
+ Assert.assertEquals(1, interceptorInfo.getBusinessMethodsInfo().size());
+
+ Assert.assertNotNull(interceptorInfo.getDecorators());
+ Assert.assertEquals(1, interceptorInfo.getDecorators().size());
+
+ shutDownContainer();
+ }
+ @Test
+ public void testEjbStyleInterceptorResolution() throws Exception
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(this.getClass().getPackage().getName(), this.getClass().getSimpleName()));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(InterceptedComponent.class);
+ beanClasses.add(Interceptor1.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ InterceptorResolutionService ir = new InterceptorResolutionService(getWebBeansContext());
+ AnnotatedType<InterceptedComponent> annotatedType = getBeanManager().createAnnotatedType(InterceptedComponent.class);
+ Bean<InterceptedComponent> bean
+ = (Bean<InterceptedComponent>) getBeanManager().resolve((Set) getBeanManager().getBeans(InterceptedComponent.class));
+
+ BeanInterceptorInfo interceptorInfo = ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(), annotatedType);
+ Assert.assertNotNull(interceptorInfo);
+ Assert.assertNotNull(interceptorInfo.getBusinessMethodsInfo());
+ Assert.assertEquals(2, interceptorInfo.getBusinessMethodsInfo().size());
+
+ for (Map.Entry<Method, BusinessMethodInterceptorInfo> mi : interceptorInfo.getBusinessMethodsInfo().entrySet())
+ {
+ Assert.assertNotNull(mi.getValue().getEjbInterceptors());
+ Assert.assertEquals(1, mi.getValue().getEjbInterceptors().length);
+ }
+
+ shutDownContainer();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/SelfInterceptorBeanBuilderTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/SelfInterceptorBeanBuilderTest.java
new file mode 100644
index 0000000..1a8fe12
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/SelfInterceptorBeanBuilderTest.java
@@ -0,0 +1,94 @@
+/*
+ * 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.webbeans.newtests.interceptors.resolution;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.webbeans.component.BeanAttributesImpl;
+import org.apache.webbeans.component.InterceptorBean;
+import org.apache.webbeans.component.creation.BeanAttributesBuilder;
+import org.apache.webbeans.component.creation.SelfInterceptorBeanBuilder;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.interceptors.resolution.interceptors.SelfInterceptedClass;
+import org.apache.webbeans.newtests.interceptors.resolution.interceptors.SelfInterceptionSubclass;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Test for building EJB-style interceptor beans
+ */
+public class SelfInterceptorBeanBuilderTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testEjbInterceptorBeanCreation()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(SelfInterceptedClass.class);
+
+ startContainer(beanClasses, null);
+
+ AnnotatedType<SelfInterceptedClass> annotatedType = getBeanManager().createAnnotatedType(SelfInterceptedClass.class);
+
+ BeanAttributesImpl<SelfInterceptedClass> beanAttributes = BeanAttributesBuilder.forContext(getWebBeansContext()).newBeanAttibutes(annotatedType).build();
+
+ SelfInterceptorBeanBuilder<SelfInterceptedClass> ibb
+ = new SelfInterceptorBeanBuilder<SelfInterceptedClass>(getWebBeansContext(), annotatedType, beanAttributes);
+ ibb.defineSelfInterceptorRules();
+ InterceptorBean<SelfInterceptedClass> bean = ibb.getBean();
+ Assert.assertNotNull(bean);
+
+ SelfInterceptedClass interceptedInstance = getInstance(SelfInterceptedClass.class);
+
+ SelfInterceptedClass.interceptionCount = 0;
+ interceptedInstance.someBusinessMethod();
+ Assert.assertEquals(42, interceptedInstance.getMeaningOfLife());
+ Assert.assertEquals(2, SelfInterceptedClass.interceptionCount);
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testDisablingByOverriding()
+ {
+ startContainer(SelfInterceptedClass.class, SelfInterceptionSubclass.class);
+
+ AnnotatedType<SelfInterceptedClass> annotatedType = getBeanManager().createAnnotatedType(SelfInterceptedClass.class);
+
+ BeanAttributesImpl<SelfInterceptedClass> beanAttributes = BeanAttributesBuilder.forContext(getWebBeansContext()).newBeanAttibutes(annotatedType).build();
+
+ SelfInterceptorBeanBuilder<SelfInterceptedClass> ibb
+ = new SelfInterceptorBeanBuilder<SelfInterceptedClass>(getWebBeansContext(), annotatedType, beanAttributes);
+ ibb.defineSelfInterceptorRules();
+ InterceptorBean<SelfInterceptedClass> bean = ibb.getBean();
+ Assert.assertNotNull(bean);
+
+ SelfInterceptionSubclass interceptedInstance = getInstance(SelfInterceptionSubclass.class);
+
+ SelfInterceptedClass.interceptionCount = 0;
+ interceptedInstance.someBusinessMethod();
+ Assert.assertEquals(42, interceptedInstance.getMeaningOfLife());
+ Assert.assertEquals(0, SelfInterceptedClass.interceptionCount);
+
+ shutDownContainer();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/beans/Foo.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/beans/Foo.java
new file mode 100644
index 0000000..e4dbc9e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/beans/Foo.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.interceptors.resolution.beans;
+
+public interface Foo<T> {
+ public void doSomething(T something);
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/beans/FooImpl.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/beans/FooImpl.java
new file mode 100644
index 0000000..22eb611
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/beans/FooImpl.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.newtests.interceptors.resolution.beans;
+
+import org.apache.webbeans.newtests.interceptors.resolution.interceptors.TestIntercepted1;
+
+public class FooImpl implements Foo<String>
+{
+
+ String value;
+ @Override
+ @TestIntercepted1
+ public void doSomething(String something)
+ {
+ value = something;
+ }
+
+ public String getValue(){
+ return value;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/beans/UtilitySampleBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/beans/UtilitySampleBean.java
new file mode 100644
index 0000000..d8506e3
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/beans/UtilitySampleBean.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.interceptors.resolution.beans;
+
+import javax.enterprise.context.RequestScoped;
+
+/**
+ * Some trivial sample bean which can get injected into various places
+ */
+@RequestScoped
+public class UtilitySampleBean
+{
+ private int i;
+
+ public int getI()
+ {
+ return i;
+ }
+
+ public void setI(int i)
+ {
+ this.i = i;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/interceptors/SelfInterceptedClass.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/interceptors/SelfInterceptedClass.java
new file mode 100644
index 0000000..83bb48c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/interceptors/SelfInterceptedClass.java
@@ -0,0 +1,52 @@
+/*
+ * 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.webbeans.newtests.interceptors.resolution.interceptors;
+
+import javax.enterprise.context.RequestScoped;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+/**
+ * Sample bean which has an AroundInvoke interceptor on itself.
+ */
+@RequestScoped
+public class SelfInterceptedClass
+{
+ public static int interceptionCount = 0;
+
+ private int meaningOfLife = 0;
+
+ public void someBusinessMethod()
+ {
+ meaningOfLife = 42;
+ }
+
+ public int getMeaningOfLife()
+ {
+ return meaningOfLife;
+ }
+
+ @AroundInvoke
+ protected Object interceptMe(InvocationContext ic) throws Exception
+ {
+ interceptionCount++;
+ return ic.proceed();
+ }
+}
+
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/interceptors/SelfInterceptionSubclass.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/interceptors/SelfInterceptionSubclass.java
new file mode 100644
index 0000000..2b53b3e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/interceptors/SelfInterceptionSubclass.java
@@ -0,0 +1,42 @@
+/*
+ * 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.webbeans.newtests.interceptors.resolution.interceptors;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Typed;
+import javax.interceptor.InvocationContext;
+
+/**
+ *
+ */
+@RequestScoped
+@Typed(SelfInterceptionSubclass.class)
+public class SelfInterceptionSubclass extends SelfInterceptedClass
+{
+ /**
+ * This method overrides and thus disables the AroundInvoke method from the superclass.
+ * See Interceptors spec.
+ */
+ @Override
+ protected Object interceptMe(InvocationContext ic) throws Exception
+ {
+ // do nothing.
+ return null;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/interceptors/TestIntercepted1.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/interceptors/TestIntercepted1.java
new file mode 100644
index 0000000..e7ce952
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/interceptors/TestIntercepted1.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.newtests.interceptors.resolution.interceptors;
+
+import javax.interceptor.InterceptorBinding;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@InterceptorBinding
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.TYPE, ElementType.METHOD })
+public @interface TestIntercepted1
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/interceptors/TestInterceptor1.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/interceptors/TestInterceptor1.java
new file mode 100644
index 0000000..e575adb
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/interceptors/TestInterceptor1.java
@@ -0,0 +1,114 @@
+/*
+ * 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.webbeans.newtests.interceptors.resolution.interceptors;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.AroundTimeout;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+import org.apache.webbeans.newtests.interceptors.resolution.beans.UtilitySampleBean;
+import org.apache.webbeans.util.ExceptionUtil;
+
+
+@Interceptor
+@TestIntercepted1
+public class TestInterceptor1 extends TestInterceptorParent
+{
+ public static int invocationCount = 0;
+ public static int exceptionCount = 0;
+ public static int postConstructCount = 0;
+
+ @Inject
+ public TestInterceptor1(UtilitySampleBean ctUtility)
+ {
+ super();
+ ctUtility.setI(42);
+ }
+
+
+
+ @AroundInvoke
+ public Object caller(InvocationContext context) throws Exception
+ {
+ try
+ {
+ invocationCount++;
+ return context.proceed();
+
+ } catch(Exception e)
+ {
+ exceptionCount++;
+ throw e;
+ }
+ }
+
+ /**
+ * another name -> no invocation -> 2 interceptors
+ */
+ @PostConstruct
+ public void anotherPostConstruct(InvocationContext context)
+ {
+ postConstructCount++;
+ try
+ {
+ context.proceed();
+ }
+ catch (Exception e)
+ {
+ ExceptionUtil.throwAsRuntimeException(e);
+ }
+
+ }
+
+ /**
+ * 2 private methods -> 2 interceptors
+ */
+ @PreDestroy
+ private void preDestroy(InvocationContext context)
+ {
+ preDestroyCount++;
+ try
+ {
+ context.proceed();
+ }
+ catch (Exception e)
+ {
+ ExceptionUtil.throwAsRuntimeException(e);
+ }
+
+ }
+
+ /**
+ * overridden method -> only 1 interceptor
+ * @param context
+ */
+ @Override
+ @AroundTimeout
+ public Object aroundTimeout(InvocationContext context) throws Exception
+ {
+ aroundTimeoutCount++;
+ return context.proceed();
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/interceptors/TestInterceptorParent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/interceptors/TestInterceptorParent.java
new file mode 100644
index 0000000..34e88b2
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/interceptors/TestInterceptorParent.java
@@ -0,0 +1,80 @@
+/*
+ * 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.webbeans.newtests.interceptors.resolution.interceptors;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+import javax.interceptor.AroundTimeout;
+import javax.interceptor.InvocationContext;
+
+import org.apache.webbeans.newtests.interceptors.resolution.beans.UtilitySampleBean;
+import org.apache.webbeans.util.ExceptionUtil;
+
+
+public class TestInterceptorParent
+{
+ public static int postConstructCount = 0;
+ public static int preDestroyCount = 0;
+ public static int aroundTimeoutCount = 0;
+
+ @Inject
+ private UtilitySampleBean fieldUtility;
+
+ public UtilitySampleBean getFieldUtility()
+ {
+ return fieldUtility;
+ }
+
+ @PostConstruct
+ public void postConstruct(InvocationContext context)
+ {
+ postConstructCount++;
+ try
+ {
+ context.proceed();
+ }
+ catch (Exception e)
+ {
+ ExceptionUtil.throwAsRuntimeException(e);
+ }
+ }
+
+ @PreDestroy
+ private void preDestroy(InvocationContext context)
+ {
+ preDestroyCount++;
+ try
+ {
+ context.proceed();
+ }
+ catch (Exception e)
+ {
+ ExceptionUtil.throwAsRuntimeException(e);
+ }
+ }
+
+ @AroundTimeout
+ public Object aroundTimeout(InvocationContext context) throws Exception
+ {
+ aroundTimeoutCount++;
+ return context.proceed();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/ProxyFactoryTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/ProxyFactoryTest.java
new file mode 100644
index 0000000..ac1a6b1
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/ProxyFactoryTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.webbeans.newtests.managed;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.managed.multipleinterfaces.MyEntityServiceImpl;
+import org.junit.Test;
+
+public class ProxyFactoryTest extends AbstractUnitTest {
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testProxyFactoryWithMultipleInterfaces() {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(MyEntityServiceImpl.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans(MyEntityServiceImpl.class);
+ Assert.assertNotNull(beans);
+
+ Bean<MyEntityServiceImpl> bean = (Bean<MyEntityServiceImpl>) beans.iterator().next();
+ Assert.assertNotNull(bean);
+
+ CreationalContext<MyEntityServiceImpl> ctx = getBeanManager().createCreationalContext(bean);
+
+ Object reference = getBeanManager().getReference(bean, MyEntityServiceImpl.class, ctx);
+ Assert.assertNotNull(reference);
+
+ shutDownContainer();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/generic/GenericInjectionTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/generic/GenericInjectionTest.java
new file mode 100644
index 0000000..665149e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/generic/GenericInjectionTest.java
@@ -0,0 +1,87 @@
+/*
+ * 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.webbeans.newtests.managed.generic;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Test;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
+import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import static org.junit.Assert.assertNotNull;
+
+public class GenericInjectionTest extends AbstractUnitTest
+{
+ @Test
+ public void testGenericInjection()
+ {
+ final Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(StringIntAddress.class);
+ beanClasses.add(AddressStringInt.class);
+ beanClasses.add(IntStringAddress.class);
+ beanClasses.add(Helper.class);
+
+ startContainer(beanClasses);
+
+ // will fail if generics are not handled properly
+ final Bean<Helper> bean = getBean(Helper.class);
+ final Helper helper = Helper.class.cast(getBeanManager().getReference(bean, Helper.class, null));
+ helper.checkAll();
+
+ shutDownContainer();
+ }
+
+ public static interface InterfaceWithMultipleGenerics<A, B, C>
+ {
+ }
+
+ public static class StringIntAddress implements InterfaceWithMultipleGenerics<String, Integer, InetAddress>
+ {
+ }
+
+ public static class AddressStringInt implements InterfaceWithMultipleGenerics<Integer, InetAddress, String>
+ {
+ }
+
+ public static class IntStringAddress implements InterfaceWithMultipleGenerics<Integer, String, InetAddress>
+ {
+ }
+
+ public static class Helper
+ {
+ @Inject
+ private InterfaceWithMultipleGenerics<String, Integer, InetAddress> sia;
+
+ @Inject
+ private InterfaceWithMultipleGenerics<Integer, InetAddress, String> ias;
+
+ @Inject
+ private InterfaceWithMultipleGenerics<Integer, String, InetAddress> isa;
+
+ public void checkAll()
+ {
+ assertNotNull(sia);
+ assertNotNull(ias);
+ assertNotNull(isa);
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/instance/InjectedInstanceComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/instance/InjectedInstanceComponentTest.java
new file mode 100644
index 0000000..a47324d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/instance/InjectedInstanceComponentTest.java
@@ -0,0 +1,148 @@
+/*
+ * 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.webbeans.newtests.managed.instance;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.util.TypeLiteral;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.managed.instance.beans.DependentBean;
+import org.apache.webbeans.newtests.managed.instance.beans.DependentBeanProducer;
+import org.apache.webbeans.newtests.managed.instance.beans.InstanceForDependentBean;
+import org.apache.webbeans.newtests.managed.instance.beans.InstanceInjectedComponent;
+import org.apache.webbeans.test.component.CheckWithCheckPayment;
+import org.apache.webbeans.test.component.CheckWithMoneyPayment;
+import org.apache.webbeans.test.component.IPayment;
+import org.apache.webbeans.test.component.PaymentProcessorComponent;
+import org.junit.Test;
+
+
+public class InjectedInstanceComponentTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testInstanceInjectedComponent()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(PaymentProcessorComponent.class);
+ beanClasses.add(InstanceInjectedComponent.class);
+ beanClasses.add(CheckWithCheckPayment.class);
+ beanClasses.add(CheckWithMoneyPayment.class);
+ beanClasses.add(IPayment.class);
+
+ startContainer(beanClasses, null);
+
+ InstanceInjectedComponent instance = getInstance(InstanceInjectedComponent.class);
+
+ org.junit.Assert.assertNotNull(instance);
+ org.junit.Assert.assertNotNull(instance.getInstance());
+ org.junit.Assert.assertNotNull(instance.getPaymentComponent());
+
+ Instance<PaymentProcessorComponent> ins = instance.getInstance();
+
+ boolean ambigious = ins.isAmbiguous();
+
+ Assert.assertFalse(ambigious);
+
+ boolean unsatisfied = ins.isUnsatisfied();
+
+ Assert.assertFalse(unsatisfied);
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testInstanceProducedWithInjectionPoint()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+
+ beanClasses.add(InstanceForDependentBean.class);
+ beanClasses.add(DependentBean.class);
+ beanClasses.add(DependentBeanProducer.class);
+ startContainer(beanClasses, null);
+
+ InstanceForDependentBean holder = getInstance(InstanceForDependentBean.class);
+ Assert.assertNotNull(holder);
+
+ Assert.assertEquals(42, holder.getMeaningOfLife());
+ Assert.assertEquals(0, holder.getSecondaryMeaning());
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testInstanceDestroyal()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+
+ beanClasses.add(InstanceForDependentBean.class);
+ beanClasses.add(DependentBean.class);
+ startContainer(beanClasses, null);
+
+ InstanceForDependentBean holder = getInstance(InstanceForDependentBean.class);
+ Assert.assertNotNull(holder);
+
+ Assert.assertEquals(42, holder.getMeaningOfLife());
+
+ DependentBean.properlyDestroyed = false;
+
+ shutDownContainer();
+
+ Assert.assertTrue(DependentBean.properlyDestroyed);
+ }
+
+ @Test
+ public void testManualInstanceResolving()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+
+ beanClasses.add(PaymentProcessorComponent.class);
+ beanClasses.add(CheckWithCheckPayment.class);
+ beanClasses.add(CheckWithMoneyPayment.class);
+ beanClasses.add(IPayment.class);
+
+ startContainer(beanClasses, null);
+
+ Set<Bean<?>> beans =
+ getBeanManager().getBeans(new TypeLiteral<Instance<PaymentProcessorComponent>>() {}.getType());
+ Bean<Instance<PaymentProcessorComponent>> bean =
+ (Bean<Instance<PaymentProcessorComponent>>) getBeanManager().resolve(beans);
+ CreationalContext<Instance<PaymentProcessorComponent>> creationalContext =
+ getBeanManager().createCreationalContext(bean);
+ Instance<PaymentProcessorComponent> provider = bean.create(creationalContext);
+ Assert.assertNotNull(provider);
+
+ // please note that the provider will NOT create a PaymentProcessorComponent
+ // because the Bean doesn't know this information! This is compatible with Weld
+ // which also doesn't handle this case. This is due to the fact that the spec
+ // defines that there is only one InstanceBean.
+
+ shutDownContainer();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/instance/beans/DependentBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/instance/beans/DependentBean.java
new file mode 100644
index 0000000..8292bda
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/instance/beans/DependentBean.java
@@ -0,0 +1,45 @@
+/*
+ * 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.webbeans.newtests.managed.instance.beans;
+
+import javax.annotation.PreDestroy;
+import javax.enterprise.context.Dependent;
+
+/**
+ * Test for properly destroying dependent contextual instances
+ */
+@Dependent
+public class DependentBean
+{
+
+ public static boolean properlyDestroyed = false;
+
+ int meaningOfLife = 42;
+
+ public int getMeaningOfLife()
+ {
+ return meaningOfLife;
+ }
+
+ @PreDestroy
+ protected void destroy()
+ {
+ properlyDestroyed = true;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/instance/beans/DependentBeanProducer.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/instance/beans/DependentBeanProducer.java
new file mode 100644
index 0000000..6fe894f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/instance/beans/DependentBeanProducer.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.managed.instance.beans;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+public class DependentBeanProducer {
+
+ @Produces
+ @Dependent
+ @MeaningOfLife
+ public DependentBean produce(InjectionPoint ip, DependentBean bean) {
+ bean.meaningOfLife = ip.getAnnotated().getAnnotation(MeaningOfLife.class).value();
+ return bean;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/instance/beans/InstanceForDependentBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/instance/beans/InstanceForDependentBean.java
new file mode 100644
index 0000000..f7d7b2c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/instance/beans/InstanceForDependentBean.java
@@ -0,0 +1,48 @@
+/*
+ * 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.webbeans.newtests.managed.instance.beans;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+/**
+ * Test for properly destroying dependent contextual instances
+ */
+@RequestScoped
+public class InstanceForDependentBean
+{
+
+ @Inject
+ private Instance<DependentBean> instance;
+
+ @Inject
+ @MeaningOfLife(0)
+ private Instance<DependentBean> secondaryInstance;
+
+ public int getMeaningOfLife()
+ {
+ return instance.get().getMeaningOfLife();
+ }
+
+ public int getSecondaryMeaning()
+ {
+ return secondaryInstance.get().getMeaningOfLife();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/instance/beans/InstanceInjectedComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/instance/beans/InstanceInjectedComponent.java
new file mode 100644
index 0000000..402f5e0
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/instance/beans/InstanceInjectedComponent.java
@@ -0,0 +1,49 @@
+/*
+ * 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.webbeans.newtests.managed.instance.beans;
+
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+import org.apache.webbeans.test.component.PaymentProcessorComponent;
+
+@RequestScoped
+public class InstanceInjectedComponent
+{
+ @Inject @Default Instance<PaymentProcessorComponent> instance;
+
+ public InstanceInjectedComponent()
+ {
+
+ }
+
+ public Instance<PaymentProcessorComponent> getInstance()
+ {
+ return instance;
+ }
+
+ public PaymentProcessorComponent getPaymentComponent()
+ {
+ return instance.get();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/instance/beans/MeaningOfLife.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/instance/beans/MeaningOfLife.java
new file mode 100755
index 0000000..d2e9058
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/instance/beans/MeaningOfLife.java
@@ -0,0 +1,41 @@
+/*
+ * 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.webbeans.newtests.managed.instance.beans;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.util.Nonbinding;
+import javax.inject.Qualifier;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@Qualifier
+public @interface MeaningOfLife
+{
+ @Nonbinding int value() default 42;
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/AbstractCrudService.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/AbstractCrudService.java
new file mode 100644
index 0000000..94b2574
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/AbstractCrudService.java
@@ -0,0 +1,48 @@
+/*
+ * 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.webbeans.newtests.managed.multipleinterfaces;
+
+public abstract class AbstractCrudService<T> implements GenericCrudService<T> {
+
+ @Override
+ public T create(T entity) {
+ // em.create(type)
+ return null;
+ }
+
+ @Override
+ public void delete(T entity) {
+ // em.delete...
+
+ }
+
+ @Override
+ public T getById(Object id) {
+ // em.find...
+ return null;
+ }
+
+ @Override
+ public T update(T entity) {
+ // em.merge...
+ return null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/GenericCrudService.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/GenericCrudService.java
new file mode 100644
index 0000000..df7c855
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/GenericCrudService.java
@@ -0,0 +1,28 @@
+/*
+ * 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.webbeans.newtests.managed.multipleinterfaces;
+
+public interface GenericCrudService<T> {
+
+ public T create(T type);
+ public T update(T entity);
+ public T getById(Object id);
+ public void delete(T entity);
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntity.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntity.java
new file mode 100644
index 0000000..db6c295
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntity.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.webbeans.newtests.managed.multipleinterfaces;
+
+// @Entity ...
+public class MyEntity {
+
+ private int id;
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntityService.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntityService.java
new file mode 100644
index 0000000..4561019
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntityService.java
@@ -0,0 +1,25 @@
+/*
+ * 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.webbeans.newtests.managed.multipleinterfaces;
+
+public interface MyEntityService extends GenericCrudService<MyEntity> {
+
+ public void specialMyEntityFunction(MyEntity e);
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntityServiceImpl.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntityServiceImpl.java
new file mode 100644
index 0000000..4477093
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntityServiceImpl.java
@@ -0,0 +1,31 @@
+/*
+ * 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.webbeans.newtests.managed.multipleinterfaces;
+
+import javax.enterprise.context.ApplicationScoped;
+
+@ApplicationScoped
+public class MyEntityServiceImpl extends AbstractCrudService<MyEntity> implements MyEntityService {
+
+ @Override
+ public void specialMyEntityFunction(MyEntity e) {
+ // do something very special ;)
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/package.html b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/package.html
new file mode 100644
index 0000000..dc9d717
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/package.html
@@ -0,0 +1,28 @@
+<!--
+ ~ 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.
+ -->
+<html>
+<body>
+<h2>Test classes for demonstrating OWB-210</h2>
+<p>This package contains a realworld scenario of a CRUD Service Framework.</p>
+<p>We left away the entity etc, but show the important structure. The original
+problem was that <code>GenericCrudSerive</code> is contained twice in the
+class definition chain which caused the JavassistProxyFactory to fail while
+creating the proxy.</p>
+</body>
+</html>
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/newcomp/NewComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/newcomp/NewComponent.java
new file mode 100644
index 0000000..93d9986
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/newcomp/NewComponent.java
@@ -0,0 +1,43 @@
+/*
+ * 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.webbeans.newtests.managed.newcomp;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.New;
+import javax.inject.Inject;
+
+import org.apache.webbeans.test.component.dependent.DependentOwnerComponent;
+
+@Dependent
+public class NewComponent
+{
+ private @Inject @New DependentOwnerComponent owner;
+
+ private @Inject @New(DependentOwnerComponent.class) DependentOwnerComponent grandParent;
+
+ public DependentOwnerComponent owner()
+ {
+ return owner;
+ }
+
+ public DependentOwnerComponent getGrandParent()
+ {
+ return grandParent;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/newcomp/NewComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/newcomp/NewComponentTest.java
new file mode 100644
index 0000000..ebf6835
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/newcomp/NewComponentTest.java
@@ -0,0 +1,74 @@
+/*
+ * 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.webbeans.newtests.managed.newcomp;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.test.component.CheckWithCheckPayment;
+import org.apache.webbeans.test.component.IPayment;
+import org.apache.webbeans.test.component.dependent.DependentComponent;
+import org.apache.webbeans.test.component.dependent.DependentOwnerComponent;
+import org.junit.Test;
+import org.junit.Assert;
+
+
+public class NewComponentTest extends AbstractUnitTest
+{
+ @Test
+ public void testDependent()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(DependentComponent.class);
+ beanClasses.add(DependentOwnerComponent.class);
+ beanClasses.add(NewComponent.class);
+
+ startContainer(beanClasses, null);
+
+ NewComponent newComponent = getInstance(NewComponent.class);
+ Assert.assertNotNull(newComponent);
+
+ Assert.assertNotNull(newComponent.owner());
+ Assert.assertNotNull(newComponent.getGrandParent());
+ Assert.assertNotSame(newComponent.owner(), newComponent.getGrandParent());
+
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testDepedent2()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(CheckWithCheckPayment.class);
+ beanClasses.add(IPayment.class);
+ beanClasses.add(ProducerNewComponent.class);
+ beanClasses.add(NewComponent.class);
+
+ startContainer(beanClasses, null);
+
+ IPayment payment = getInstance(IPayment.class);
+ Assert.assertNotNull(payment);
+ Assert.assertTrue(payment instanceof CheckWithCheckPayment);
+
+ shutDownContainer();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/newcomp/ProducerNewComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/newcomp/ProducerNewComponent.java
new file mode 100644
index 0000000..e9f1b9d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/newcomp/ProducerNewComponent.java
@@ -0,0 +1,49 @@
+/*
+ * 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.webbeans.newtests.managed.newcomp;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.New;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+import org.apache.webbeans.test.component.CheckWithCheckPayment;
+import org.apache.webbeans.test.component.IPayment;
+
+@RequestScoped
+@Named
+public class ProducerNewComponent
+{
+ private IPayment component;
+
+ @Produces
+ @Dependent
+ @Named("paymentProducer")
+ public IPayment create(@New CheckWithCheckPayment comp)
+ {
+ this.component = comp;
+ return comp;
+ }
+
+ public IPayment getComponent()
+ {
+ return this.component;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/specialized/SpecializeDeactivationTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/specialized/SpecializeDeactivationTest.java
new file mode 100644
index 0000000..6e25e4d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/specialized/SpecializeDeactivationTest.java
@@ -0,0 +1,167 @@
+/*
+ * 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.webbeans.newtests.managed.specialized;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.Specializes;
+import javax.inject.Inject;
+import java.util.Arrays;
+import java.util.Collections;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class SpecializeDeactivationTest extends AbstractUnitTest
+{
+ @Inject
+ private Init init;
+
+ @Before
+ public void reset() {
+ Impl1.called = false;
+ Impl2.called = false;
+ SpeImpl1.called = false;
+ }
+
+ @Test
+ public void normal()
+ {
+ startContainer(Arrays.<Class<?>>asList(Init.class, API.class, Impl1.class, Impl2.class),
+ Collections.<String>emptyList(), true);
+
+ assertEquals(2, init.init());
+ assertTrue(Impl1.called);
+ assertTrue(Impl2.called);
+ }
+
+ @Test
+ public void specialize()
+ {
+ startContainer(Arrays.<Class<?>>asList(Init.class, API.class, Impl1.class, Impl2.class, SpeImpl1.class),
+ Collections.<String>emptyList(), true);
+
+ assertEquals(2, init.init());
+ assertTrue(SpeImpl1.called);
+ assertTrue(Impl2.called);
+ }
+
+ @Test
+ public void specializeProducers()
+ {
+ startContainer(Arrays.<Class<?>>asList(Init.class, API.class, Prod1.class, Prod2.class, Spe1.class),
+ Collections.<String>emptyList(), true);
+
+ assertEquals(2, init.init());
+ assertTrue(SpeImpl1.called);
+ assertTrue(Impl2.called);
+ }
+
+ public static interface API
+ {
+ void init();
+ }
+
+ public static class Prod1
+ {
+ @Produces
+ public API api1()
+ {
+ return new Impl1();
+ }
+ }
+
+ public static class Spe1 extends Prod1
+ {
+ @Produces
+ @Override
+ @Specializes
+ public API api1()
+ {
+ return new SpeImpl1();
+ }
+ }
+
+ public static class Prod2
+ {
+ @Produces
+ public API api1()
+ {
+ return new Impl2();
+ }
+ }
+
+ public static class Impl1 implements API
+ {
+ public static boolean called = false;
+
+ @Override
+ public void init()
+ {
+ called = true;
+ }
+ }
+
+ @Specializes
+ public static class SpeImpl1 extends Impl1
+ {
+ public static boolean called = false;
+
+ @Override
+ public void init()
+ {
+ called = true;
+ }
+ }
+
+ public static class Impl2 implements API
+ {
+ public static boolean called = false;
+
+ @Override
+ public void init()
+ {
+ called = true;
+ }
+ }
+
+ public static class Init
+ {
+ @Inject
+ @Any
+ private Instance<API> impls;
+
+ public int init()
+ {
+ int i = 0;
+ for (final API api : impls)
+ {
+ api.init();
+ i++;
+ }
+ return i;
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/performance/StartupPerformanceTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/performance/StartupPerformanceTest.java
new file mode 100644
index 0000000..f0036c4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/performance/StartupPerformanceTest.java
@@ -0,0 +1,124 @@
+/*
+ * 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.webbeans.newtests.performance;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.concepts.alternatives.common.AlternativeBean;
+import org.apache.webbeans.newtests.concepts.alternatives.common.Pencil;
+import org.apache.webbeans.newtests.concepts.alternatives.common.PencilProducerBean;
+import org.apache.webbeans.newtests.concepts.alternatives.common.SimpleBean;
+import org.apache.webbeans.newtests.concepts.alternatives.common.SimpleInjectionTarget;
+import org.apache.webbeans.newtests.contexts.session.common.PersonalDataBean;
+import org.apache.webbeans.newtests.injection.circular.beans.CircularApplicationScopedBean;
+import org.apache.webbeans.newtests.injection.circular.beans.CircularDependentScopedBean;
+import org.apache.webbeans.newtests.managed.instance.beans.DependentBean;
+import org.apache.webbeans.newtests.managed.instance.beans.DependentBeanProducer;
+import org.apache.webbeans.newtests.managed.instance.beans.InstanceForDependentBean;
+import org.apache.webbeans.newtests.managed.instance.beans.InstanceInjectedComponent;
+import org.apache.webbeans.newtests.profields.beans.classproducer.MyProductBean;
+import org.apache.webbeans.newtests.profields.beans.classproducer.MyProductProducer;
+import org.apache.webbeans.newtests.profields.beans.classproducer.ProductInjectedBean;
+import org.apache.webbeans.newtests.profields.beans.stringproducer.GetterStringFieldInjector;
+import org.apache.webbeans.newtests.profields.beans.stringproducer.GetterStringProducerBean;
+import org.apache.webbeans.newtests.profields.beans.stringproducer.InformationConsumerBean;
+import org.apache.webbeans.newtests.profields.beans.stringproducer.MultipleListProducer;
+import org.apache.webbeans.newtests.profields.beans.stringproducer.StringProducerBean;
+import org.apache.webbeans.newtests.promethods.beans.PersonProducerBean;
+import org.apache.webbeans.newtests.promethods.common.Person;
+import org.apache.webbeans.newtests.specalization.AdvancedPenProducer;
+import org.apache.webbeans.newtests.specalization.DefaultPenProducer;
+import org.apache.webbeans.newtests.specalization.Pen;
+import org.apache.webbeans.newtests.specalization.PremiumPenProducer;
+import org.apache.webbeans.test.component.CheckWithCheckPayment;
+import org.apache.webbeans.test.component.CheckWithMoneyPayment;
+import org.apache.webbeans.test.component.IPayment;
+import org.apache.webbeans.test.component.PaymentProcessorComponent;
+import org.junit.Test;
+
+/**
+ * Small unit test to help testing the startup performance.
+ * We just stuff lots of classes into it and check how it performs.
+ */
+public class StartupPerformanceTest extends AbstractUnitTest
+{
+ private static final int NUMBER_ITERATIONS = 2;
+
+
+ @Test
+ public void testPerformance()
+ {
+ for (int i=0; i < NUMBER_ITERATIONS; i++)
+ {
+ startupWithClasses();
+ }
+ }
+
+ private void startupWithClasses()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(PaymentProcessorComponent.class);
+ beanClasses.add(InstanceInjectedComponent.class);
+ beanClasses.add(CheckWithCheckPayment.class);
+ beanClasses.add(CheckWithMoneyPayment.class);
+ beanClasses.add(IPayment.class);
+ beanClasses.add(ProductInjectedBean.class);
+ beanClasses.add(MyProductProducer.class);
+ beanClasses.add(MyProductBean.class);
+ beanClasses.add(Person.class);
+ beanClasses.add(PersonProducerBean.class);
+ beanClasses.add(Pen.class);
+ beanClasses.add(DefaultPenProducer.class);
+ beanClasses.add(AdvancedPenProducer.class);
+ beanClasses.add(PremiumPenProducer.class);
+ beanClasses.add(PersonalDataBean.class);
+ beanClasses.add(CircularDependentScopedBean.class);
+ beanClasses.add(CircularApplicationScopedBean.class);
+ beanClasses.add(AlternativeBean.class);
+ beanClasses.add(Pencil.class);
+ beanClasses.add(PencilProducerBean.class);
+ beanClasses.add(SimpleBean.class);
+ beanClasses.add(SimpleInjectionTarget.class);
+ beanClasses.add(DependentBean.class);
+ beanClasses.add(DependentBeanProducer.class);
+ beanClasses.add(InstanceForDependentBean.class);
+
+
+ beanClasses.add(MyProductBean.class);
+ beanClasses.add(MyProductProducer.class);
+ beanClasses.add(ProductInjectedBean.class);
+
+ beanClasses.add(StringProducerBean.class);
+ beanClasses.add(GetterStringFieldInjector.class);
+ beanClasses.add(GetterStringProducerBean.class);
+ beanClasses.add(InformationConsumerBean.class);
+ beanClasses.add(MultipleListProducer.class);
+ beanClasses.add(GetterStringProducerBean.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ // do nothing ...
+
+ shutDownContainer();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/BeanManagerTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/BeanManagerTest.java
new file mode 100644
index 0000000..1f459c6
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/BeanManagerTest.java
@@ -0,0 +1,59 @@
+/*
+ * 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.webbeans.newtests.portable;
+
+import junit.framework.Assert;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Test;
+
+import javax.enterprise.inject.spi.BeanManager;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * Various tests for the BeanManager
+ */
+public class BeanManagerTest extends AbstractUnitTest
+{
+ public BeanManagerTest()
+ {
+ }
+
+
+ /**
+ * This test adds a scope and tests if the lifecycle works
+ */
+ @Test
+ public void testResolve()
+ {
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+ startContainer(classes);
+
+ BeanManager bm = getInstance(BeanManager.class);
+ Assert.assertNotNull(bm);
+
+ // this must not throw a NPE
+ Assert.assertNull(bm.resolve(null));
+
+ Assert.assertNull(bm.resolve(Collections.EMPTY_SET));
+
+ shutDownContainer();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/BeforeBeanDiscoveryTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/BeforeBeanDiscoveryTest.java
new file mode 100644
index 0000000..e29884c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/BeforeBeanDiscoveryTest.java
@@ -0,0 +1,82 @@
+package org.apache.webbeans.newtests.portable;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.util.AnnotationLiteral;
+
+import junit.framework.Assert;
+
+/*
+ * 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.
+ */
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.portable.addannotated.extension.AddAdditionalAnnotatedTypeExtension;
+import org.apache.webbeans.newtests.portable.events.extensions.AddBeanExtension.MyBean;
+import org.junit.Test;
+
+public class BeforeBeanDiscoveryTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testAddAdditionalAnnotatedType()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+
+ addExtension(new AddAdditionalAnnotatedTypeExtension());
+
+ startContainer(beanClasses, beanXmls);
+
+ Bean<?> bean = getBeanManager().getBeans(MyBean.class, new AnnotationLiteral<Default>()
+ {
+ }).iterator().next();
+
+ // Bean should not be null, as we added it as an additional annotated
+ // type during before bean discovery in the extension
+ Assert.assertNotNull(bean);
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testAddAdditionalAnnotatedTypeWithPresentClass()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(MyBean.class);
+
+ addExtension(new AddAdditionalAnnotatedTypeExtension());
+
+ startContainer(beanClasses, beanXmls);
+
+ Bean<?> bean = getBeanManager().getBeans(MyBean.class, new AnnotationLiteral<Default>()
+ {
+ }).iterator().next();
+
+ // Bean should not be null, as we added it as an additional annotated
+ // type during before bean discovery in the extension
+ Assert.assertNotNull(bean);
+
+ shutDownContainer();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/ExtensionTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/ExtensionTest.java
new file mode 100644
index 0000000..3f130cc
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/ExtensionTest.java
@@ -0,0 +1,192 @@
+/*
+ * 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.webbeans.newtests.portable;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.PassivationCapable;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.annotation.DefaultLiteral;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.inject.DefinitionException;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.contexts.SerializationTest;
+import org.apache.webbeans.newtests.portable.alternative.Egg;
+import org.apache.webbeans.newtests.portable.alternative.HalfEgg;
+import org.apache.webbeans.newtests.portable.alternative.WoodEgg;
+import org.apache.webbeans.newtests.portable.events.extensions.AlternativeExtension;
+import org.apache.webbeans.newtests.portable.scopeextension.BeanWithExtensionInjected;
+import org.apache.webbeans.newtests.portable.scopeextension.ExternalTestScopeExtension;
+import org.apache.webbeans.newtests.portable.scopeextension.ExternalTestScoped;
+import org.apache.webbeans.newtests.portable.scopeextension.ExternalTestScopedBean;
+import org.apache.webbeans.newtests.portable.scopeextension.ExternalUnserializableTestScopedBean;
+import org.apache.webbeans.newtests.portable.scopeextension.broken.CdiBeanWithLifecycleObserver;
+import org.apache.webbeans.portable.events.discovery.BeforeShutdownImpl;
+import org.junit.Test;
+
+/**
+ * This test checks if an extension gets loaded correctly and
+ * if all specified events get fired.
+ */
+public class ExtensionTest extends AbstractUnitTest
+{
+ public ExtensionTest()
+ {
+ }
+
+
+ /**
+ * This test adds a scope and tests if the lifecycle works
+ */
+ @Test
+ public void testScopeExtension()
+ {
+ addExtension(new ExternalTestScopeExtension());
+ startContainer(ExternalTestScopedBean.class);
+
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ webBeansContext.getContextFactory().initApplicationContext(null);
+
+ @SuppressWarnings("unchecked")
+ Bean<ExternalTestScopedBean> bean = (Bean<ExternalTestScopedBean>) getBeanManager().getBeans(ExternalTestScopedBean.class,
+ new DefaultLiteral()).iterator().next();
+
+ ExternalTestScopedBean instance = (ExternalTestScopedBean) getBeanManager().getReference(bean, ExternalTestScopedBean.class,
+ getBeanManager().createCreationalContext(bean));
+
+ Assert.assertNotNull(instance);
+
+ Assert.assertTrue(getBeanManager().isPassivatingScope(ExternalTestScoped.class));
+
+ //Fire shut down
+ getBeanManager().fireEvent(new BeforeShutdownImpl());
+
+ webBeansContext.getContextFactory().destroyApplicationContext(null);
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testLifecycleObservingInStandardCdiBeans() throws Exception
+ {
+ CdiBeanWithLifecycleObserver.beforeBeanDiscoveryCalled = false;
+ CdiBeanWithLifecycleObserver.afterBeanDiscoveryCalled = false;
+
+ startContainer(CdiBeanWithLifecycleObserver.class);
+
+ CdiBeanWithLifecycleObserver instance = getInstance(CdiBeanWithLifecycleObserver.class);
+ Assert.assertNotNull(instance);
+
+ Assert.assertFalse(CdiBeanWithLifecycleObserver.beforeBeanDiscoveryCalled);
+ Assert.assertFalse(CdiBeanWithLifecycleObserver.afterBeanDiscoveryCalled);
+ }
+
+ /**
+ * Classes in a passivatable scope must be Serializable
+ */
+ @Test
+ public void testUnserializableBean()
+ {
+ try
+ {
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(ExternalUnserializableTestScopedBean.class);
+ addExtension(new ExternalTestScopeExtension());
+ startContainer(classes);
+
+ // we must not get here since an Exception is expected!
+ Assert.fail();
+ }
+ catch (DefinitionException dex)
+ {
+ // this is expected!
+ }
+ }
+
+ /**
+ * This will test if an @Alternative can get added dynamically.
+ * Please note that we cannot do much more than checking if the
+ * dynamically enabled @Alternative is now disabled.
+ * That's because with CDI-1.0 it's not possible to also add
+ * the Alternative to beans.xml nor programmatically.
+ * This feature only gets added in CDI-1.1 with
+ * ProcessModule#getAlternatives() which can be modified.
+ *
+ * TODO: extend test for CDI-1.1
+ */
+ @Test
+ public void testAlternativeExtenson()
+ {
+ addExtension(new AlternativeExtension());
+ startContainer(Egg.class, HalfEgg.class);
+
+ Egg egg = getInstance(Egg.class);
+ Assert.assertTrue(egg instanceof Egg);
+ Assert.assertFalse(egg instanceof HalfEgg);
+ Set<Bean<?>> beans = getBeanManager().getBeans(HalfEgg.class);
+ Assert.assertTrue(beans == null || beans.size() == 0);
+
+ shutDownContainer();
+ }
+
+ /**
+ * Test the dynamic removal of an @Alternative annotation
+ * via ProcessAnnotatedType.
+ */
+ @Test
+ public void testRemoveAlternativeExtension()
+ {
+ addExtension(new AlternativeExtension());
+ startContainer(Egg.class, WoodEgg.class);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans(Egg.class);
+ Assert.assertTrue(beans != null && beans.size() == 2);
+
+ }
+
+ @Test
+ public void testInjectedExtensionSerialisation() throws Exception
+ {
+ addExtension(new ExternalTestScopeExtension());
+ startContainer(BeanWithExtensionInjected.class);
+
+ BeanWithExtensionInjected instance = getInstance(BeanWithExtensionInjected.class);
+ Assert.assertNotNull(instance);
+ Assert.assertNotNull(instance.getExtension());
+
+ Bean<ExternalTestScopeExtension> extensionBean = getBean(ExternalTestScopeExtension.class);
+ Assert.assertNotNull(extensionBean);
+ Assert.assertTrue(extensionBean instanceof PassivationCapable);
+ Assert.assertNotNull(((PassivationCapable) extensionBean).getId());
+
+ byte[] ba = SerializationTest.serializeObject(instance);
+ Assert.assertNotNull(ba);
+ BeanWithExtensionInjected serializedInstance
+ = (BeanWithExtensionInjected) SerializationTest.deSerializeObject(ba);
+ Assert.assertNotNull(serializedInstance);
+ Assert.assertNotNull(serializedInstance.getExtension());
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/addannotated/extension/AddAdditionalAnnotatedTypeExtension.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/addannotated/extension/AddAdditionalAnnotatedTypeExtension.java
new file mode 100644
index 0000000..7f6adb5
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/addannotated/extension/AddAdditionalAnnotatedTypeExtension.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.newtests.portable.addannotated.extension;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
+
+import org.apache.webbeans.newtests.portable.events.extensions.AddBeanExtension.MyBean;
+
+public class AddAdditionalAnnotatedTypeExtension implements Extension
+{
+
+ public void beforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd, BeanManager bm)
+ {
+ bbd.addAnnotatedType(bm.createAnnotatedType(MyBean.class));
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/alternative/Egg.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/alternative/Egg.java
new file mode 100644
index 0000000..95ad933
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/alternative/Egg.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.newtests.portable.alternative;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Named;
+
+@Named
+@ApplicationScoped
+public class Egg
+{
+ public int getSize()
+ {
+ return 42;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/alternative/HalfEgg.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/alternative/HalfEgg.java
new file mode 100644
index 0000000..940b627
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/alternative/HalfEgg.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.newtests.portable.alternative;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Named;
+
+/**
+ * This class is NOT annotated as Alternative, but it will get set as such
+ * via the AlternativeExtension
+ */
+@Named
+@ApplicationScoped
+public class HalfEgg extends Egg
+{
+ @Override
+ public int getSize()
+ {
+ return 21;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/alternative/WoodEgg.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/alternative/WoodEgg.java
new file mode 100644
index 0000000..1ce3934
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/alternative/WoodEgg.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.newtests.portable.alternative;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Alternative;
+
+/**
+ * An alternative which is not specified in beans.xml.
+ * The Alternative annotation will be dynamically removed via an Extension.
+ */
+@ApplicationScoped
+@Alternative
+public class WoodEgg extends Egg
+{
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/ExtensionErrorsTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/ExtensionErrorsTest.java
new file mode 100644
index 0000000..866ff5b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/ExtensionErrorsTest.java
@@ -0,0 +1,74 @@
+/*
+ * 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.webbeans.newtests.portable.events;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.portable.events.beans.Apple;
+import org.apache.webbeans.newtests.portable.events.extensions.errors.AfterBeanDiscoveryErrorExtension;
+import org.apache.webbeans.newtests.portable.events.extensions.errors.AfterBeansValidationErrorExtension;
+import org.junit.Test;
+
+public class ExtensionErrorsTest extends AbstractUnitTest
+{
+
+ @Test(expected=WebBeansConfigurationException.class)
+ public void testAfterBeanDiscoveryError()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(Apple.class);
+
+ try
+ {
+ addExtension(new AfterBeanDiscoveryErrorExtension());
+ startContainer(beanClasses, beanXmls);
+ }
+ finally
+ {
+ shutDownContainer();
+ }
+
+ }
+
+ @Test(expected=WebBeansConfigurationException.class)
+ public void testAfterBeanDeploymentValidationError()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(Apple.class);
+
+ try
+ {
+ addExtension(new AfterBeansValidationErrorExtension());
+ startContainer(beanClasses, beanXmls);
+ }
+ finally
+ {
+ shutDownContainer();
+ }
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/PortableAddBeanTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/PortableAddBeanTest.java
new file mode 100644
index 0000000..839a2b1
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/PortableAddBeanTest.java
@@ -0,0 +1,50 @@
+/*
+ * 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.webbeans.newtests.portable.events;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.portable.events.extensions.AddBeanExtension;
+import org.junit.Test;
+
+public class PortableAddBeanTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testAddBeanExtension()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+
+ addExtension(new AddBeanExtension());
+ addExtension(new AddBeanExtension.MyBeanExtension());
+
+ startContainer(beanClasses, beanXmls);
+
+ Assert.assertNotNull(AddBeanExtension.MyBeanExtension.myBean);
+
+ shutDownContainer();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/PortableAddObserverMethodTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/PortableAddObserverMethodTest.java
new file mode 100644
index 0000000..46ddd9b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/PortableAddObserverMethodTest.java
@@ -0,0 +1,50 @@
+/*
+ * 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.webbeans.newtests.portable.events;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.portable.events.extensions.AddObserverMethodExtension;
+import org.junit.Test;
+
+public class PortableAddObserverMethodTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testAddBeanExtension()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+
+ addExtension(new AddObserverMethodExtension());
+ addExtension(new AddObserverMethodExtension.MyBeanExtension());
+
+ startContainer(beanClasses, beanXmls);
+
+ Assert.assertNotNull(AddObserverMethodExtension.MyBeanExtension.observerMethod);
+
+ shutDownContainer();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/PortableEventTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/PortableEventTest.java
new file mode 100644
index 0000000..1bbf7b4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/PortableEventTest.java
@@ -0,0 +1,158 @@
+/*
+ * 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.webbeans.newtests.portable.events;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.portable.events.beans.Apple;
+import org.apache.webbeans.newtests.portable.events.extensions.AppleExtension;
+import org.apache.webbeans.newtests.portable.events.extensions.NotAppleExtnsion;
+import org.apache.webbeans.newtests.portable.events.extensions.RawTypeExtension;
+import org.apache.webbeans.newtests.portable.events.extensions.TypeVariableExtension;
+import org.apache.webbeans.newtests.portable.events.extensions.WildcardExtension;
+import org.apache.webbeans.newtests.portable.events.extensions.WrongTypeVariableExtension;
+import org.apache.webbeans.newtests.portable.events.extensions.WrongWildcardExtension;
+import org.junit.Test;
+
+public class PortableEventTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testAppleExtension()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(Apple.class);
+
+ addExtension(new AppleExtension());
+ startContainer(beanClasses, beanXmls);
+
+ Assert.assertEquals("apple", AppleExtension.NAME);
+
+ shutDownContainer();
+ }
+
+ @Test
+
+ public void testNotAppleExtension()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(Apple.class);
+
+ addExtension(new NotAppleExtnsion());
+ startContainer(beanClasses, beanXmls);
+
+ Assert.assertFalse(NotAppleExtnsion.CALLED);
+
+ shutDownContainer();
+ }
+
+ @Test
+
+ public void testRawTypeExtension()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(Apple.class);
+
+ addExtension(new RawTypeExtension());
+ startContainer(beanClasses, beanXmls);
+
+ Assert.assertTrue(RawTypeExtension.CALLED);
+
+ shutDownContainer();
+ }
+
+ @Test
+
+ public void testTypeVariableExtension()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(Apple.class);
+
+ addExtension(new TypeVariableExtension());
+ startContainer(beanClasses, beanXmls);
+
+ Assert.assertTrue(TypeVariableExtension.CALLED);
+
+ shutDownContainer();
+ }
+
+ @Test
+
+ public void testwildcardExtension()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(Apple.class);
+
+ addExtension(new WildcardExtension());
+ startContainer(beanClasses, beanXmls);
+
+ Assert.assertTrue(WildcardExtension.CALLED);
+
+ shutDownContainer();
+ }
+
+ @Test
+
+ public void testWrongTypeVariableExtension()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(Apple.class);
+
+ addExtension(new WrongTypeVariableExtension());
+ startContainer(beanClasses, beanXmls);
+
+ Assert.assertFalse(WrongTypeVariableExtension.CALLED);
+
+ shutDownContainer();
+ }
+
+ @Test
+
+ public void testWrongWildcardTypeExtension()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(Apple.class);
+
+ addExtension(new WrongWildcardExtension());
+ startContainer(beanClasses, beanXmls);
+
+ Assert.assertFalse(WrongWildcardExtension.CALLED);
+
+ shutDownContainer();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/beans/Apple.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/beans/Apple.java
new file mode 100644
index 0000000..02d9400
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/beans/Apple.java
@@ -0,0 +1,27 @@
+/*
+ * 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.webbeans.newtests.portable.events.beans;
+
+import javax.inject.Named;
+
+@Named
+public class Apple
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/AddBeanExtension.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/AddBeanExtension.java
new file mode 100644
index 0000000..691bb72
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/AddBeanExtension.java
@@ -0,0 +1,125 @@
+/*
+ * 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.webbeans.newtests.portable.events.extensions;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.ProcessBean;
+
+import org.apache.webbeans.annotation.DependentScopeLiteral;
+
+public class AddBeanExtension implements Extension
+{
+ public static class MyBean
+ {
+
+ }
+
+ public static class MyBeanExtension implements Extension
+ {
+ public static Bean<MyBean> myBean;
+
+ public void observer(@Observes ProcessBean<MyBean> event)
+ {
+ myBean = event.getBean();
+
+ }
+ }
+
+ public void observer(@Observes AfterBeanDiscovery event)
+ {
+ event.addBean(new Bean<MyBean>(){
+
+ @Override
+ public Class<?> getBeanClass()
+ {
+ return MyBean.class;
+ }
+
+ @Override
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ return null;
+ }
+
+ @Override
+ public String getName()
+ {
+ return null;
+ }
+
+ @Override
+ public Set<Annotation> getQualifiers()
+ {
+ return null;
+ }
+
+ @Override
+ public Class<? extends Annotation> getScope()
+ {
+ return new DependentScopeLiteral().annotationType();
+ }
+
+ @Override
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return null;
+ }
+
+ @Override
+ public Set<Type> getTypes()
+ {
+ return null;
+ }
+
+ @Override
+ public boolean isAlternative()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isNullable()
+ {
+ return false;
+ }
+
+ @Override
+ public MyBean create(CreationalContext<MyBean> context)
+ {
+ return new MyBean();
+ }
+
+ @Override
+ public void destroy(MyBean instance, CreationalContext<MyBean> context)
+ {
+ }
+
+ });
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/AddObserverMethodExtension.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/AddObserverMethodExtension.java
new file mode 100644
index 0000000..0019738
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/AddObserverMethodExtension.java
@@ -0,0 +1,95 @@
+/*
+ * 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.webbeans.newtests.portable.events.extensions;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.Set;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.event.Reception;
+import javax.enterprise.event.TransactionPhase;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ObserverMethod;
+import javax.enterprise.inject.spi.ProcessObserverMethod;
+
+public class AddObserverMethodExtension implements Extension
+{
+ public static class MyEvent
+ {
+
+ }
+
+ public static class MyBeanExtension implements Extension
+ {
+ public static ObserverMethod<MyEvent> observerMethod;
+
+ public void observer(@Observes ProcessObserverMethod<MyEvent, AddObserverMethodExtension> event)
+ {
+ observerMethod = event.getObserverMethod();
+
+ }
+ }
+
+ public void observer(@Observes AfterBeanDiscovery event)
+ {
+ event.addObserverMethod(new ObserverMethod<MyEvent>(){
+
+ @Override
+ public Class<?> getBeanClass()
+ {
+ return AddObserverMethodExtension.class;
+ }
+
+ @Override
+ public Set<Annotation> getObservedQualifiers()
+ {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public Type getObservedType()
+ {
+ return MyEvent.class;
+ }
+
+ @Override
+ public Reception getReception()
+ {
+ return Reception.ALWAYS;
+ }
+
+ @Override
+ public TransactionPhase getTransactionPhase()
+ {
+ return null;
+ }
+
+ @Override
+ public void notify(MyEvent event)
+ {
+
+ }
+
+ });
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/AlternativeExtension.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/AlternativeExtension.java
new file mode 100644
index 0000000..bee16c6
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/AlternativeExtension.java
@@ -0,0 +1,61 @@
+/*
+ * 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.webbeans.newtests.portable.events.extensions;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+import javax.enterprise.util.AnnotationLiteral;
+
+import org.apache.webbeans.newtests.portable.alternative.HalfEgg;
+import org.apache.webbeans.newtests.portable.alternative.WoodEgg;
+
+import java.lang.annotation.Annotation;
+import java.util.HashSet;
+import java.util.Set;
+
+
+public class AlternativeExtension implements Extension
+{
+ public void observeProcessAnnotatedTypeHalfEgg(@Observes ProcessAnnotatedType<HalfEgg> pat)
+ {
+ // this just works with OWB and assumes a mutable annotation Set.
+ pat.getAnnotatedType().getAnnotations().add(new AnnotationLiteral<Alternative>() {});
+ pat.setAnnotatedType(pat.getAnnotatedType());
+ }
+
+ public void observeProcessAnnotatedTypeWoodEgg(@Observes ProcessAnnotatedType<WoodEgg> pat)
+ {
+ // this just works with OWB and assumes a mutable annotation Set.
+ Set<Annotation> newAnnotations = new HashSet<Annotation>();
+ for (Annotation ann : pat.getAnnotatedType().getAnnotations())
+ {
+ if (!Alternative.class.isAssignableFrom(ann.annotationType()))
+ {
+ newAnnotations.add(ann);
+ }
+ }
+
+ pat.getAnnotatedType().getAnnotations().clear();
+ pat.getAnnotatedType().getAnnotations().addAll(newAnnotations);
+
+ pat.setAnnotatedType(pat.getAnnotatedType());
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/AppleExtension.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/AppleExtension.java
new file mode 100644
index 0000000..8537b7b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/AppleExtension.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.newtests.portable.events.extensions;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessBean;
+
+import org.apache.webbeans.newtests.portable.events.beans.Apple;
+
+
+public class AppleExtension implements Extension
+{
+ public static String NAME = "";
+
+ public void observeProcessBean(@Observes ProcessBean<Apple> event)
+ {
+ Bean<Apple> bean = event.getBean();
+ NAME = bean.getName();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/NotAppleExtnsion.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/NotAppleExtnsion.java
new file mode 100644
index 0000000..56fa1ec
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/NotAppleExtnsion.java
@@ -0,0 +1,41 @@
+/*
+ * 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.webbeans.newtests.portable.events.extensions;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+import javax.enterprise.inject.spi.ProcessBean;
+
+import org.apache.webbeans.newtests.concepts.alternatives.common.Pencil;
+
+public class NotAppleExtnsion implements Extension
+{
+ public static boolean CALLED = false;
+
+ public void observeProcessAnnotatedType(@Observes ProcessAnnotatedType<? super Pencil> event)
+ {
+ CALLED = true;
+ }
+
+ public void observeProcessBean(@Observes ProcessBean<Pencil> event)
+ {
+ CALLED = true;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/RawTypeExtension.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/RawTypeExtension.java
new file mode 100644
index 0000000..9bd58d9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/RawTypeExtension.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.newtests.portable.events.extensions;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessBean;
+
+public class RawTypeExtension implements Extension
+{
+ public static boolean CALLED = false;
+
+ public void observeProcessBean(@Observes ProcessBean event)
+ {
+ CALLED = true;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/TypeVariableExtension.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/TypeVariableExtension.java
new file mode 100644
index 0000000..a0bc6fe
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/TypeVariableExtension.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.newtests.portable.events.extensions;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessBean;
+
+public class TypeVariableExtension implements Extension
+{
+ public static boolean CALLED = false;
+
+ public <T> void observeProcessBean(@Observes ProcessBean<T> event)
+ {
+ CALLED = true;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/WildcardExtension.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/WildcardExtension.java
new file mode 100644
index 0000000..bfffe56
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/WildcardExtension.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.newtests.portable.events.extensions;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessBean;
+
+public class WildcardExtension implements Extension
+{
+ public static boolean CALLED = false;
+
+ public void observeProcessBean(@Observes ProcessBean<?> event)
+ {
+ CALLED = true;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/WrongTypeVariableExtension.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/WrongTypeVariableExtension.java
new file mode 100644
index 0000000..e4241f7
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/WrongTypeVariableExtension.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.portable.events.extensions;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessBean;
+
+import org.apache.webbeans.newtests.concepts.alternatives.common.Pencil;
+
+public class WrongTypeVariableExtension implements Extension
+{
+ public static boolean CALLED = false;
+
+ public <T extends Pencil> void observeProcessBean(@Observes ProcessBean<T> event)
+ {
+ CALLED = true;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/WrongWildcardExtension.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/WrongWildcardExtension.java
new file mode 100644
index 0000000..b3d9021
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/WrongWildcardExtension.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.portable.events.extensions;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessBean;
+
+import org.apache.webbeans.newtests.concepts.alternatives.common.Pencil;
+
+public class WrongWildcardExtension implements Extension
+{
+ public static boolean CALLED = false;
+
+ public void observeProcessBean(@Observes ProcessBean<? extends Pencil> event)
+ {
+ CALLED = true;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/errors/AfterBeanDiscoveryErrorExtension.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/errors/AfterBeanDiscoveryErrorExtension.java
new file mode 100644
index 0000000..03a8329
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/errors/AfterBeanDiscoveryErrorExtension.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.newtests.portable.events.extensions.errors;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
+
+public class AfterBeanDiscoveryErrorExtension implements Extension
+{
+ public void observer(@Observes AfterBeanDiscovery event)
+ {
+ event.addDefinitionError(new Throwable("test Errros"));
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/errors/AfterBeansValidationErrorExtension.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/errors/AfterBeansValidationErrorExtension.java
new file mode 100644
index 0000000..b3be51f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/events/extensions/errors/AfterBeansValidationErrorExtension.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.newtests.portable.events.extensions.errors;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterDeploymentValidation;
+import javax.enterprise.inject.spi.Extension;
+
+public class AfterBeansValidationErrorExtension implements Extension
+{
+ public void observer(@Observes AfterDeploymentValidation event)
+ {
+ event.addDeploymentProblem(new Throwable("test deployment Errros"));
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/InjectionTargetTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/InjectionTargetTest.java
new file mode 100644
index 0000000..82064be
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/InjectionTargetTest.java
@@ -0,0 +1,70 @@
+/*
+ * 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.webbeans.newtests.portable.injectiontarget;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.InjectionTarget;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Test;
+
+public class InjectionTargetTest extends AbstractUnitTest
+{
+ public static class MyContextual<T> implements Contextual<T>
+ {
+
+ @Override
+ public T create(CreationalContext<T> context)
+ {
+ return null;
+ }
+
+ @Override
+ public void destroy(T instance, CreationalContext<T> context)
+ {
+
+ }
+
+ }
+
+ @Test
+ public void testInjectionTarget()
+ {
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(PersonModel.class);
+ startContainer(classes);
+
+ InjectionTarget<PersonModel> model = getBeanManager().createInjectionTarget(getBeanManager().createAnnotatedType(PersonModel.class));
+ PersonModel person = model.produce(getBeanManager().createCreationalContext(new InjectionTargetTest.MyContextual<PersonModel>()));
+ Assert.assertNotNull(person);
+
+ // check that createInjectionTarget did not deploy a second observer method
+ getBeanManager().fireEvent("test");
+ Assert.assertEquals(1, PersonModel.getEventCount());
+ shutDownContainer();
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/PersonModel.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/PersonModel.java
new file mode 100644
index 0000000..a226786
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/PersonModel.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.newtests.portable.injectiontarget;
+
+import javax.enterprise.event.Observes;
+
+public class PersonModel
+{
+ private static int eventCount;
+
+ public static int getEventCount()
+ {
+ return eventCount;
+ }
+
+ public void observe(@Observes String event)
+ {
+ eventCount++;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/customtarget/CustomTarget.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/customtarget/CustomTarget.java
new file mode 100644
index 0000000..f2cb1b7
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/customtarget/CustomTarget.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.newtests.portable.injectiontarget.customtarget;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+
+public class CustomTarget
+{
+ private @Inject BeanManager beanManager;
+
+ public CustomTarget(String noConstr)
+ {
+
+ }
+
+ public BeanManager getBeanManager()
+ {
+ return beanManager;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/customtarget/CustomTargetNoConstructorTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/customtarget/CustomTargetNoConstructorTest.java
new file mode 100644
index 0000000..b6a90b9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/customtarget/CustomTargetNoConstructorTest.java
@@ -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.webbeans.newtests.portable.injectiontarget.customtarget;
+
+import java.util.Collections;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InjectionTarget;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class CustomTargetNoConstructorTest extends AbstractUnitTest
+{
+ @Test
+ public void testInjectionTargetWithNoConstructor()
+ {
+ Exception ex = null;
+ try
+ {
+ startContainer(Collections.<Class<?>> emptyList());
+ final BeanManagerImpl manager = WebBeansContext.getInstance().getBeanManagerImpl();
+ AnnotatedType<CustomTarget> annotatedType = manager.createAnnotatedType(CustomTarget.class);
+ InjectionTarget<CustomTarget> injectionTarget = manager.createInjectionTarget(annotatedType);
+ CreationalContext<CustomTarget> context = manager.createCreationalContext(null);
+ try
+ {
+ injectionTarget.produce(context);
+ }
+ catch (Exception e)
+ {
+ ex = e;
+ }
+ }
+ finally
+ {
+ shutDownContainer();
+ }
+
+ Assert.assertNotNull(ex);
+ }
+
+ @Test
+ public void testInjecDependenciesTargetWithNoConstructor()
+ {
+ Exception ex = null;
+ final BeanManagerImpl manager;
+ CreationalContext<CustomTarget> context =null;
+ CustomTarget instance = null;
+ try
+ {
+ startContainer(Collections.<Class<?>> emptyList());
+ manager = WebBeansContext.getInstance().getBeanManagerImpl();
+ context = manager.createCreationalContext(null);
+ AnnotatedType<CustomTarget> annotatedType = manager.createAnnotatedType(CustomTarget.class);
+ InjectionTarget<CustomTarget> injectionTarget = manager.createInjectionTarget(annotatedType);
+ try
+ {
+ instance = new CustomTarget("Hiho");
+ injectionTarget.inject(instance, context);
+
+ Assert.assertNotNull(instance.getBeanManager());
+ }
+ catch (Exception e)
+ {
+ ex = e;
+ }
+ }
+ finally
+ {
+ context.release();
+ shutDownContainer();
+ }
+
+ Assert.assertNull(ex);
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/supportInjections/Chair.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/supportInjections/Chair.java
new file mode 100644
index 0000000..8d86749
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/supportInjections/Chair.java
@@ -0,0 +1,30 @@
+/*
+ * 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.webbeans.newtests.portable.injectiontarget.supportInjections;
+
+import javax.enterprise.context.RequestScoped;
+
+import org.apache.webbeans.test.annotation.binding.Binding1;
+
+@Binding1
+@RequestScoped
+public class Chair
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/supportInjections/SupportInjectionBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/supportInjections/SupportInjectionBean.java
new file mode 100644
index 0000000..f26fb26
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/supportInjections/SupportInjectionBean.java
@@ -0,0 +1,106 @@
+/*
+ * 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.webbeans.newtests.portable.injectiontarget.supportInjections;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.enterprise.inject.New;
+import javax.inject.Inject;
+
+import org.apache.webbeans.newtests.promethods.common.Person;
+import org.apache.webbeans.test.annotation.binding.Binding1;
+import org.apache.webbeans.test.annotation.binding.Binding2;
+
+public class SupportInjectionBean
+{
+ private @Inject @Binding1 Chair chair;
+
+ private @Inject @Binding2 Table table;
+
+ public static boolean POST_COSTRUCT = false;
+
+ public static boolean PRE_DESTROY = false;
+
+ private Person person;
+
+ @Inject
+ public SupportInjectionBean(@New Person person)
+ {
+ this.person = person;
+ }
+
+ public Person getPerson()
+ {
+ return this.person;
+ }
+
+
+ /**
+ * @return the chair
+ */
+ public Chair getChair()
+ {
+ return chair;
+ }
+
+
+
+ /**
+ * @param chair the chair to set
+ */
+ public void setChair(Chair chair)
+ {
+ this.chair = chair;
+ }
+
+
+
+ /**
+ * @return the table
+ */
+ public Table getTable()
+ {
+ return table;
+ }
+
+
+
+ /**
+ * @param table the table to set
+ */
+ public void setTable(Table table)
+ {
+ this.table = table;
+ }
+
+
+
+ @PostConstruct
+ public void postConstruct()
+ {
+ POST_COSTRUCT = true;
+ }
+
+ @PreDestroy
+ public void preDestroy()
+ {
+ PRE_DESTROY = true;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/supportInjections/SupportInjectionTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/supportInjections/SupportInjectionTest.java
new file mode 100644
index 0000000..24cb89b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/supportInjections/SupportInjectionTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.webbeans.newtests.portable.injectiontarget.supportInjections;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.InjectionTarget;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Test;
+
+public class SupportInjectionTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testInjectionTarget()
+ {
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(Chair.class);
+ classes.add(Table.class);
+ startContainer(classes);
+
+ InjectionTarget<SupportInjectionBean> model = getBeanManager().createInjectionTarget(getBeanManager().createAnnotatedType(SupportInjectionBean.class));
+ CreationalContext cc = getBeanManager().createCreationalContext(null);
+ SupportInjectionBean instance = model.produce(cc);
+
+ model.inject(instance, cc);
+
+ Assert.assertNotNull(instance.getChair());
+ Assert.assertNotNull(instance.getTable());
+ Assert.assertNotNull(instance.getPerson());
+
+ model.postConstruct(instance);
+ Assert.assertTrue(SupportInjectionBean.POST_COSTRUCT);
+
+ model.preDestroy(instance);
+ Assert.assertTrue(SupportInjectionBean.PRE_DESTROY);
+
+ shutDownContainer();
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/supportInjections/Table.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/supportInjections/Table.java
new file mode 100644
index 0000000..f8cb38c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/supportInjections/Table.java
@@ -0,0 +1,30 @@
+/*
+ * 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.webbeans.newtests.portable.injectiontarget.supportInjections;
+
+import javax.enterprise.context.RequestScoped;
+
+import org.apache.webbeans.test.annotation.binding.Binding2;
+
+@Binding2
+@RequestScoped
+public class Table
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/javaee/JavaEeInjectionTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/javaee/JavaEeInjectionTest.java
new file mode 100644
index 0000000..b1ae9e4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/javaee/JavaEeInjectionTest.java
@@ -0,0 +1,50 @@
+/*
+ * 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.webbeans.newtests.portable.javaee;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.inject.OWBInjector;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Test;
+
+public class JavaEeInjectionTest extends AbstractUnitTest
+{
+ @Test
+ public void testInjectionTarget() throws Exception
+ {
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(SampleBean.class);
+ startContainer(classes);
+
+ MockInstance instance = new MockInstance();
+ OWBInjector.inject(getBeanManager(), instance, null);
+
+ Assert.assertNotNull(instance.getBeanManager());
+ Assert.assertNotNull(instance.getSample());
+ Assert.assertNotNull(instance.getViaMethod());
+
+ shutDownContainer();
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/javaee/MockInstance.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/javaee/MockInstance.java
new file mode 100644
index 0000000..4d9a05f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/javaee/MockInstance.java
@@ -0,0 +1,69 @@
+/*
+ * 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.webbeans.newtests.portable.javaee;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+
+public class MockInstance
+{
+ private @Inject SampleBean sample;
+
+ private SampleBean viaMethod;
+
+ private @Inject BeanManager beanManager;
+
+ @Inject
+ public void init(SampleBean sample)
+ {
+ this.viaMethod = sample;
+ }
+
+ public SampleBean getSample()
+ {
+ return sample;
+ }
+
+ public void setSample(SampleBean sample)
+ {
+ this.sample = sample;
+ }
+
+ public SampleBean getViaMethod()
+ {
+ return viaMethod;
+ }
+
+ public void setViaMethod(SampleBean viaMethod)
+ {
+ this.viaMethod = viaMethod;
+ }
+
+ public BeanManager getBeanManager()
+ {
+ return beanManager;
+ }
+
+ public void setBeanManager(BeanManager beanManager)
+ {
+ this.beanManager = beanManager;
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/javaee/SampleBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/javaee/SampleBean.java
new file mode 100644
index 0000000..4cf3701
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/javaee/SampleBean.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.newtests.portable.javaee;
+
+public class SampleBean
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/scopeextension/BeanWithExtensionInjected.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/scopeextension/BeanWithExtensionInjected.java
new file mode 100644
index 0000000..af0e20a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/scopeextension/BeanWithExtensionInjected.java
@@ -0,0 +1,39 @@
+/*
+ * 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.webbeans.newtests.portable.scopeextension;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+import java.io.Serializable;
+
+/**
+ * This passivating bean has a CDI Extension injected.
+ * CDI Extensions are ApplicationScoped and thus should be
+ * serializable due to their proxy.
+ */
+@SessionScoped
+public class BeanWithExtensionInjected implements Serializable
+{
+ private @Inject ExternalTestScopeExtension extension;
+
+ public ExternalTestScopeExtension getExtension()
+ {
+ return extension;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/scopeextension/ExternalTestScopeContext.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/scopeextension/ExternalTestScopeContext.java
new file mode 100644
index 0000000..d0dc46a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/scopeextension/ExternalTestScopeContext.java
@@ -0,0 +1,79 @@
+/*
+ * 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.webbeans.newtests.portable.scopeextension;
+
+import java.lang.annotation.Annotation;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.BeforeShutdown;
+import javax.enterprise.event.Observes;
+
+public class ExternalTestScopeContext implements Context
+{
+ private static final Map<Contextual<?>, Object> instances = new HashMap<Contextual<?>, Object>();
+
+ private boolean active;
+
+ public ExternalTestScopeContext(boolean active)
+ {
+ this.active = active;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T get(Contextual<T> component)
+ {
+
+ return (T) instances.get(component);
+ }
+
+ @Override
+ public <T> T get(Contextual<T> component, CreationalContext<T> creationalContext)
+ {
+ @SuppressWarnings("unchecked")
+ T instance = (T) instances.get(component);
+ if (instance == null)
+ {
+ component.create(creationalContext);
+ }
+ return null;
+ }
+
+ @Override
+ public Class<? extends Annotation> getScope()
+ {
+ return ExternalTestScoped.class;
+ }
+
+ @Override
+ public boolean isActive()
+ {
+ return active;
+ }
+
+ public void endContext(@Observes BeforeShutdown beforeShutdown)
+ {
+ // a real world extension would destroy all contextual instances here
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/scopeextension/ExternalTestScopeExtension.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/scopeextension/ExternalTestScopeExtension.java
new file mode 100644
index 0000000..1f1653a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/scopeextension/ExternalTestScopeExtension.java
@@ -0,0 +1,50 @@
+/*
+ * 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.webbeans.newtests.portable.scopeextension;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
+
+import org.junit.Assert;
+
+
+public class ExternalTestScopeExtension implements Extension
+{
+ public ExternalTestScopeExtension()
+ {
+ System.out.println("ExternalTestScopeExtension got created");
+ }
+
+ public void addViewScoped(@Observes BeforeBeanDiscovery beforeBeanDiscovery, BeanManager beanManager)
+ {
+ // see OWB-622 it's expected that the BeanManager already exists even in BeforeBeanDiscovery.
+ Assert.assertNotNull(beanManager);
+
+ beforeBeanDiscovery.addScope(ExternalTestScoped.class, true, true);
+ }
+
+ public void registerViewContext(@Observes AfterBeanDiscovery afterBeanDiscovery)
+ {
+ afterBeanDiscovery.addContext(new ExternalTestScopeContext(true));
+ afterBeanDiscovery.addContext(new ExternalTestScopeContext(false));
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/scopeextension/ExternalTestScoped.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/scopeextension/ExternalTestScoped.java
new file mode 100644
index 0000000..5f8f49c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/scopeextension/ExternalTestScoped.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.newtests.portable.scopeextension;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Test scope which is not @NormalScoped and not JSR-330 @Scope,
+ * which means it will not get autodetected.
+ */
+@Documented
+@Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+@Inherited
+public @interface ExternalTestScoped {
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/scopeextension/ExternalTestScopedBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/scopeextension/ExternalTestScopedBean.java
new file mode 100644
index 0000000..35ca5e3
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/scopeextension/ExternalTestScopedBean.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.newtests.portable.scopeextension;
+
+import java.io.Serializable;
+
+@ExternalTestScoped
+public class ExternalTestScopedBean implements Serializable{
+
+ private static final long serialVersionUID = -917790714891819356L;
+
+ private int i = 0;
+
+ public int getI() {
+ return i;
+ }
+
+ public void setI(int i) {
+ this.i = i;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/scopeextension/ExternalUnserializableTestScopedBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/scopeextension/ExternalUnserializableTestScopedBean.java
new file mode 100644
index 0000000..2eb0057
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/scopeextension/ExternalUnserializableTestScopedBean.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.newtests.portable.scopeextension;
+
+@ExternalTestScoped
+public class ExternalUnserializableTestScopedBean {
+
+ public int i = 0;
+
+ public int getI() {
+ return i;
+ }
+
+ public void setI(int i) {
+ this.i = i;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/scopeextension/broken/CdiBeanWithLifecycleObserver.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/scopeextension/broken/CdiBeanWithLifecycleObserver.java
new file mode 100644
index 0000000..35e2dd9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/scopeextension/broken/CdiBeanWithLifecycleObserver.java
@@ -0,0 +1,66 @@
+/*
+ * 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.webbeans.newtests.portable.scopeextension.broken;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+
+/**
+ * This is in fact a broken CDI bean as it implements
+ * a CDI Container Lifecycle observer.
+ * We must ensure that this bean doesn't get called during bootstrap.
+ * The CDI spec says nothing about whether we must throw a DeploymentException
+ * or not, so we leave this out.
+ */
+@Dependent
+public class CdiBeanWithLifecycleObserver
+{
+ public static boolean beforeBeanDiscoveryCalled = false;
+ public static boolean afterBeanDiscoveryCalled = false;
+
+ private int meaningOfLife = 42;
+
+ public int getMeaningOfLife()
+ {
+ return meaningOfLife;
+ }
+
+ public void setMeaningOfLife(int meaningOfLife)
+ {
+ this.meaningOfLife = meaningOfLife;
+ }
+
+ /**
+ * This method must not be called by the container during bootstrap
+ */
+ public void beforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd)
+ {
+ beforeBeanDiscoveryCalled = true;
+ }
+
+ /**
+ * This method must not be called by the container during bootstrap
+ */
+ public void afterBeanDiscovery(@Observes AfterBeanDiscovery abd)
+ {
+ afterBeanDiscoveryCalled = true;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/AmbigousProducerTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/AmbigousProducerTest.java
new file mode 100644
index 0000000..6f5bd8c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/AmbigousProducerTest.java
@@ -0,0 +1,57 @@
+/*
+ * 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.webbeans.newtests.producer;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.enterprise.inject.AmbiguousResolutionException;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.exception.inject.DeploymentException;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Test;
+
+public class AmbigousProducerTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testAmbiguousProducer()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+
+ beanClasses.add(ProducerBean.class);
+ beanClasses.add(ProducerBean2.class);
+
+ try {
+ startContainer(beanClasses, beanXmls);
+ Assert.fail("Should have thrown AmbiguousResoultionException");
+ }
+ catch (WebBeansConfigurationException e)
+ {
+ Assert.assertEquals(DeploymentException.class, e.getCause().getClass());
+ Assert.assertEquals(AmbiguousResolutionException.class, e.getCause().getCause().getClass());
+ }
+ shutDownContainer();
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/ConsumerBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/ConsumerBean.java
new file mode 100644
index 0000000..5200c23
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/ConsumerBean.java
@@ -0,0 +1,73 @@
+/*
+ * 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.webbeans.newtests.producer;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+public class ConsumerBean {
+
+ @Inject
+ @Named("name1")
+ private String name1;
+
+ @Inject
+ @Named("name2")
+ private String name2;
+
+ @Inject
+ @Named("name3")
+ private boolean name3;
+
+ @Inject
+ @Named("name4")
+ private String name4;
+
+ @Inject
+ @Named("name5")
+ private String name5;
+
+ @Inject
+ @Named("name6")
+ private boolean name6;
+
+ public String getName1() {
+ return name1;
+ }
+
+ public String getName2() {
+ return name2;
+ }
+
+ public boolean isName3() {
+ return name3;
+ }
+
+ public String getName4() {
+ return name4;
+ }
+
+ public String getName5() {
+ return name5;
+ }
+
+ public boolean isName6() {
+ return name6;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/HiddenProducerMethodTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/HiddenProducerMethodTest.java
new file mode 100644
index 0000000..e61a57b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/HiddenProducerMethodTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.webbeans.newtests.producer;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+
+import org.apache.webbeans.newtests.producer.beans.PrivateProducedBean;
+import org.apache.webbeans.newtests.producer.beans.ProtectedProducedBean;
+import org.apache.webbeans.newtests.producer.beans.SampleProducerOwner;
+import org.apache.webbeans.newtests.producer.beans.SomeUserBean;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Test for protected and private producer methods
+ */
+public class HiddenProducerMethodTest extends AbstractUnitTest
+{
+ @Test
+ public void testHiddenProducerMethods()
+ {
+ startContainer(PrivateProducedBean.class, ProtectedProducedBean.class, SampleProducerOwner.class, SomeUserBean.class);
+
+ PrivateProducedBean privateProducedBean = getInstance(PrivateProducedBean.class);
+ Assert.assertNotNull(privateProducedBean);
+ Assert.assertEquals(42, privateProducedBean.getMeaningOfLife());
+
+ ProtectedProducedBean protectedProducedBean = getInstance(ProtectedProducedBean.class);
+ Assert.assertNotNull(protectedProducedBean);
+ Assert.assertEquals(42, privateProducedBean.getMeaningOfLife());
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/ListProducerTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/ListProducerTest.java
new file mode 100644
index 0000000..7c6104b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/ListProducerTest.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.producer;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.producer.beans.ListConsumerBean;
+import org.apache.webbeans.newtests.producer.beans.MultipleListProducerBean;
+import org.junit.Test;
+
+public class ListProducerTest extends AbstractUnitTest
+{
+ @Test
+ public void testListProducersWithDifferentParameterizedTypes()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+
+ beanClasses.add(ListConsumerBean.class);
+ beanClasses.add(MultipleListProducerBean.class);
+
+ try
+ {
+ startContainer(beanClasses, beanXmls);
+ }
+ catch (WebBeansConfigurationException e)
+ {
+ Assert.fail("Should not have thrown AmbiguousResoultionException");
+ }
+ shutDownContainer();
+ }
+}
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/NamedProducerTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/NamedProducerTest.java
new file mode 100755
index 0000000..46efb9a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/NamedProducerTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.webbeans.newtests.producer;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class NamedProducerTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testNamedProducer()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+
+ beanClasses.add(ProducerBean.class);
+ beanClasses.add(ConsumerBean.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ Bean<?> consumerBean = getBeanManager().getBeans(ConsumerBean.class).iterator().next();
+ CreationalContext<?> context = getBeanManager().createCreationalContext(consumerBean);
+ ConsumerBean consumer = (ConsumerBean) getBeanManager().getReference(consumerBean, ConsumerBean.class, context);
+
+ Assert.assertEquals("name1", consumer.getName1());
+ Assert.assertEquals("name2", consumer.getName2());
+ Assert.assertEquals(true, consumer.isName3());
+ Assert.assertEquals("name4", consumer.getName4());
+ Assert.assertEquals("name5", consumer.getName5());
+ Assert.assertEquals(true, consumer.isName6());
+
+ shutDownContainer();
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/ProducerBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/ProducerBean.java
new file mode 100644
index 0000000..87909b4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/ProducerBean.java
@@ -0,0 +1,61 @@
+/*
+ * 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.webbeans.newtests.producer;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+public class ProducerBean {
+
+ @Produces
+ @Named
+ public String name1() {
+ return "name1";
+ }
+
+ @Produces
+ @Named
+ public String getName2() {
+ return "name2";
+ }
+
+ @Produces
+ @Named
+ public boolean isName3() {
+ return true;
+ }
+
+ @Produces
+ @Named("name4")
+ public String producesName4() {
+ return "name4";
+ }
+
+ @Produces
+ @Named("name5")
+ public String getName5() {
+ return "name5";
+ }
+
+ @Produces
+ @Named("name6")
+ public boolean isName6() {
+ return true;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/ProducerBean2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/ProducerBean2.java
new file mode 100644
index 0000000..c27b37a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/ProducerBean2.java
@@ -0,0 +1,30 @@
+/*
+ * 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.webbeans.newtests.producer;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+public class ProducerBean2 {
+ @Produces
+ @Named
+ public String name1() {
+ return "name1 of ProducerBean2";
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/StringProducerTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/StringProducerTest.java
new file mode 100755
index 0000000..5e63cfc
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/StringProducerTest.java
@@ -0,0 +1,56 @@
+/*
+ * 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.webbeans.newtests.producer;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.Bean;
+
+public class StringProducerTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testNamedProducer()
+ {
+ startContainer(StringProducer.class);
+
+ final Bean<?> bean = getBeanManager().getBeans(String.class).iterator().next();
+ final CreationalContext<?> context = getBeanManager().createCreationalContext(bean);
+ final String produced = String.class.cast(getBeanManager().getReference(bean, String.class, context));
+
+ Assert.assertEquals("string", produced);
+
+ shutDownContainer();
+
+ }
+
+ public static class StringProducer
+ {
+ @Produces
+ public String produces()
+ {
+ return "string";
+ }
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/ListConsumerBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/ListConsumerBean.java
new file mode 100644
index 0000000..e57dcde
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/ListConsumerBean.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.newtests.producer.beans;
+
+import java.util.List;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@Named
+public class ListConsumerBean {
+
+ @Inject
+ public List<Integer> listInteger;
+
+}
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/MultipleListProducerBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/MultipleListProducerBean.java
new file mode 100644
index 0000000..8ea7ec8
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/MultipleListProducerBean.java
@@ -0,0 +1,43 @@
+/*
+ * 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.webbeans.newtests.producer.beans;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+public class MultipleListProducerBean
+{
+
+ @Produces
+ @Named("list1")
+ public ArrayList<String> getList1()
+ {
+ return null;
+ }
+
+ @Produces
+ @Named("list2")
+ public List<Integer> getList2()
+ {
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/PrivateProducedBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/PrivateProducedBean.java
new file mode 100644
index 0000000..8ac4199
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/PrivateProducedBean.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.newtests.producer.beans;
+
+import javax.enterprise.inject.Typed;
+
+/**
+ * A sample bean which gets produced by a producer method with modifier 'private'
+ */
+@Typed()
+public class PrivateProducedBean
+{
+ public int getMeaningOfLife()
+ {
+ return 42;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/ProtectedProducedBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/ProtectedProducedBean.java
new file mode 100644
index 0000000..68dcf2e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/ProtectedProducedBean.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.newtests.producer.beans;
+
+import javax.enterprise.inject.Typed;
+
+/**
+ * A sample bean which gets produced by a producer method with modifier 'protected'
+ */
+@Typed()
+public class ProtectedProducedBean
+{
+ public int getMeaningOfLife()
+ {
+ return 42;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/SampleProducerOwner.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/SampleProducerOwner.java
new file mode 100644
index 0000000..182c86d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/SampleProducerOwner.java
@@ -0,0 +1,54 @@
+/*
+ * 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.webbeans.newtests.producer.beans;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+
+import org.junit.Assert;
+
+/**
+ * The bean which contains a few producer methods which are protected and private.
+ * We use a NormalScope which means the container gets a proxy which it needs to
+ * unwrap on the fly.
+ */
+@RequestScoped
+public class SampleProducerOwner
+{
+ private @Inject SomeUserBean user;
+
+ @Produces
+ protected ProtectedProducedBean createProtected()
+ {
+ // this is only available if proper injection got performed
+ Assert.assertEquals("Hans", user.getName());
+
+ return new ProtectedProducedBean();
+ }
+
+ @Produces
+ private PrivateProducedBean createPrivate()
+ {
+ // this is only available if proper injection got performed
+ Assert.assertEquals("Hans", user.getName());
+
+ return new PrivateProducedBean();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/SomeUserBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/SomeUserBean.java
new file mode 100644
index 0000000..4f53435
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/SomeUserBean.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.newtests.producer.beans;
+
+import javax.enterprise.context.RequestScoped;
+
+/**
+ * Just a dummy user bean which gets injected in to the producermethod owner bean.
+ */
+@RequestScoped
+public class SomeUserBean
+{
+ public String getName()
+ {
+ return "Hans";
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/specializes/SpecializesProducer1Test.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/specializes/SpecializesProducer1Test.java
new file mode 100644
index 0000000..cf8fe44
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/specializes/SpecializesProducer1Test.java
@@ -0,0 +1,71 @@
+/*
+ * 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.webbeans.newtests.producer.specializes;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.util.AnnotationLiteral;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.test.annotation.binding.Binding1;
+import org.apache.webbeans.test.annotation.binding.Binding2;
+import org.apache.webbeans.test.component.producer.specializes.SpecializesProducer1;
+import org.apache.webbeans.test.component.producer.specializes.superclazz.SpecializesProducer1SuperClazz;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class SpecializesProducer1Test extends AbstractUnitTest
+{
+
+ @Test
+ public void testSpecializedProducer1()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+
+ beanClasses.add(SpecializesProducer1SuperClazz.class);
+ beanClasses.add(SpecializesProducer1.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ Annotation binding1 = new AnnotationLiteral<Binding1>()
+ {
+ };
+ Annotation binding2 = new AnnotationLiteral<Binding2>()
+ {
+ };
+
+ Set beans = getBeanManager().getBeans(int.class, new Annotation[] { binding1, binding2 });
+ System.out.print("Size of the bean set is " + beans.size());
+ Assert.assertTrue(beans.size() == 1);
+ Bean<Integer> bean = (Bean<Integer>)beans.iterator().next();
+ CreationalContext<Integer> cc = getBeanManager().createCreationalContext(bean);
+ Integer number = (Integer) getBeanManager().getReference(bean, int.class, cc);
+
+ Assert.assertEquals(10000, number.intValue());
+
+ shutDownContainer();
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java
new file mode 100644
index 0000000..8b98703
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java
@@ -0,0 +1,70 @@
+/*
+ * 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.webbeans.newtests.profields;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.annotation.DefaultLiteral;
+import org.apache.webbeans.annotation.NamedLiteral;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.profields.beans.stringproducer.GetterStringFieldInjector;
+import org.apache.webbeans.newtests.profields.beans.stringproducer.GetterStringProducerBean;
+import org.apache.webbeans.newtests.profields.beans.stringproducer.InformationConsumerBean;
+import org.apache.webbeans.newtests.profields.beans.stringproducer.StringProducerBean;
+import org.junit.Test;
+
+public class GetterStringInjectorTest extends AbstractUnitTest
+{
+ @Test
+ @SuppressWarnings("unchecked")
+ public void testGetterStringInjector()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(GetterStringProducerBean.class);
+ beanClasses.add(GetterStringFieldInjector.class);
+ beanClasses.add(StringProducerBean.class);
+ beanClasses.add(InformationConsumerBean.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ Bean<GetterStringFieldInjector> bean = (Bean<GetterStringFieldInjector>) getBeanManager().getBeans("org.apache.webbeans.newtests.profields.beans.GetterStringFieldInjector").iterator().next();
+ GetterStringFieldInjector injector = (GetterStringFieldInjector) getBeanManager().getReference(bean, GetterStringFieldInjector.class, getBeanManager().createCreationalContext(bean));
+
+ Assert.assertEquals("Sucess from getProducts",injector.getTestNamed3());
+
+ String icb = getInstance(String.class, new NamedLiteral("ProMethodNamed1"));
+ Assert.assertEquals(icb, "Sucess from ProMethodNamed1");
+
+ InformationConsumerBean cb = getInstance(InformationConsumerBean.class, new DefaultLiteral());
+ Assert.assertNotNull(cb);
+
+ Assert.assertEquals(cb.getProMethodString(), "Sucess from ProMethodNamed1");
+
+ shutDownContainer();
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/InnerClassInjectStringProducerTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/InnerClassInjectStringProducerTest.java
new file mode 100644
index 0000000..5d2f689
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/InnerClassInjectStringProducerTest.java
@@ -0,0 +1,62 @@
+/*
+ * 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.webbeans.newtests.profields;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.profields.beans.stringproducer.StringProducerBean;
+import org.apache.webbeans.newtests.profields.innerClass.InnerClassInjectStringProducer;
+import org.apache.webbeans.newtests.profields.innerClass.InnerClassInjectStringProducer.Xsimple;
+import org.junit.Test;
+
+public class InnerClassInjectStringProducerTest extends AbstractUnitTest
+{
+ public InnerClassInjectStringProducerTest()
+ {
+
+ }
+
+ @Test
+ @SuppressWarnings("unchecked")
+ public void testInnerClassProducerInjection()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(StringProducerBean.class);
+ beanClasses.add(InnerClassInjectStringProducer.class);
+ beanClasses.add(Xsimple.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ Bean<Xsimple> bean = (Bean<Xsimple>) getBeanManager().getBeans("Xsimple").iterator().next();
+ Xsimple simple = (Xsimple) getBeanManager().getReference(bean, Xsimple.class, getBeanManager().createCreationalContext(bean));
+
+ Assert.assertNotNull(simple.getInner());
+
+ shutDownContainer();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/ProducerFieldPassivationIdTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/ProducerFieldPassivationIdTest.java
new file mode 100644
index 0000000..ce27c88
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/ProducerFieldPassivationIdTest.java
@@ -0,0 +1,48 @@
+/*
+ * 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.webbeans.newtests.profields;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.profields.beans.stringproducer.MultipleListProducer;
+import org.junit.Test;
+
+public class ProducerFieldPassivationIdTest extends AbstractUnitTest
+{
+
+ /**
+ * Tests the the getID() method of PassivationCapable Producer Field beans are unique if
+ * generics are used in the field type.
+ */
+ @Test
+ public void testMultipleListsWithGenerics()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(MultipleListProducer.class);
+
+
+ //Will fail to deploy if we have conflicting IDs
+ startContainer(beanClasses);
+
+ shutDownContainer();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/ProductProducerTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/ProductProducerTest.java
new file mode 100644
index 0000000..cebf310
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/ProductProducerTest.java
@@ -0,0 +1,54 @@
+/*
+ * 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.webbeans.newtests.profields;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.annotation.DefaultLiteral;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.profields.beans.classproducer.MyProductBean;
+import org.apache.webbeans.newtests.profields.beans.classproducer.MyProductProducer;
+import org.apache.webbeans.newtests.profields.beans.classproducer.ProductInjectedBean;
+import org.junit.Test;
+
+public class ProductProducerTest extends AbstractUnitTest
+{
+ @Test
+ public void testProductProducer()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(ProductInjectedBean.class);
+ beanClasses.add(MyProductProducer.class);
+ beanClasses.add(MyProductBean.class);
+
+ startContainer(beanClasses);
+
+ ProductInjectedBean pib = getInstance(ProductInjectedBean.class, new DefaultLiteral());
+ Assert.assertNotNull(pib);
+
+ pib.getX();
+
+ shutDownContainer();
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/classproducer/MyProductBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/classproducer/MyProductBean.java
new file mode 100644
index 0000000..761c4f4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/classproducer/MyProductBean.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.newtests.profields.beans.classproducer;
+
+import javax.enterprise.inject.Typed;
+
+@Typed()
+public class MyProductBean {
+
+ private int i;
+
+ public int getI() {
+ return i;
+ }
+
+ public void setI(int i) {
+ this.i = i;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/classproducer/MyProductProducer.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/classproducer/MyProductProducer.java
new file mode 100644
index 0000000..643f327
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/classproducer/MyProductProducer.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.newtests.profields.beans.classproducer;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+@ApplicationScoped
+public class MyProductProducer {
+
+ @Produces
+ @ApplicationScoped
+ @Named("product")
+ @Default
+ public MyProductBean getProduct()
+ {
+ return new MyProductBean();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/classproducer/ProductInjectedBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/classproducer/ProductInjectedBean.java
new file mode 100644
index 0000000..5e12951
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/classproducer/ProductInjectedBean.java
@@ -0,0 +1,31 @@
+/*
+ * 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.webbeans.newtests.profields.beans.classproducer;
+
+import javax.inject.Inject;
+
+public class ProductInjectedBean {
+
+ private @Inject MyProductBean myProduct;
+
+ public int getX()
+ {
+ return myProduct.getI();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/stringproducer/GetterStringFieldInjector.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/stringproducer/GetterStringFieldInjector.java
new file mode 100644
index 0000000..1a29c34
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/stringproducer/GetterStringFieldInjector.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.profields.beans.stringproducer;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@Named("org.apache.webbeans.newtests.profields.beans.GetterStringFieldInjector")
+public class GetterStringFieldInjector
+{
+ public @Inject @Named("products") String N3;
+
+ public String getTestNamed3()
+ {
+ String y = N3;
+ return y;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/stringproducer/GetterStringProducerBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/stringproducer/GetterStringProducerBean.java
new file mode 100644
index 0000000..0de6e7e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/stringproducer/GetterStringProducerBean.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.newtests.profields.beans.stringproducer;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+public class GetterStringProducerBean
+{
+ @Produces
+ @Named("products")
+ public String getProducts()
+ {
+ return "Sucess from getProducts";
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/stringproducer/InformationConsumerBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/stringproducer/InformationConsumerBean.java
new file mode 100644
index 0000000..0e5c67a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/stringproducer/InformationConsumerBean.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.newtests.profields.beans.stringproducer;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+/**
+ * This simply tests if actually injecting the String values
+ * from our fancy producer methods really works.
+ */
+@ApplicationScoped
+public class InformationConsumerBean {
+
+ private @Inject @Named("ProMethodNamed1") String proMethodString;
+
+ public String getProMethodString()
+ {
+ return proMethodString;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/stringproducer/MultipleListProducer.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/stringproducer/MultipleListProducer.java
new file mode 100644
index 0000000..ccde268
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/stringproducer/MultipleListProducer.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.profields.beans.stringproducer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+public class MultipleListProducer
+{
+ @Produces @SessionScoped List<String> produceList1 = new ArrayList<String>();
+ @Produces @SessionScoped List<Integer> produceList2 = new ArrayList<Integer>();
+
+ @Produces @SessionScoped @Named(value="name1") List<Double> producerList3 = new ArrayList<Double>();
+ @Produces @SessionScoped @Named(value="name2") List<Double> producerList4 = new ArrayList<Double>();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/stringproducer/StringProducerBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/stringproducer/StringProducerBean.java
new file mode 100644
index 0000000..627d3e9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/stringproducer/StringProducerBean.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.newtests.profields.beans.stringproducer;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+public class StringProducerBean
+{
+ @Produces
+ @Named("ProMethodNamed1")
+ String methodN1()
+ {
+ return "Sucess from ProMethodNamed1";
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/innerClass/InnerClassInjectStringProducer.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/innerClass/InnerClassInjectStringProducer.java
new file mode 100644
index 0000000..165941b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/innerClass/InnerClassInjectStringProducer.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.newtests.profields.innerClass;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+public class InnerClassInjectStringProducer
+{
+ @Named("Xsimple")
+ public static class Xsimple
+ {
+ public @Inject @Named("ProMethodNamed1") String sInject;
+
+ public String getInner()
+ {
+ String s = sInject;
+ return s;
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/promethods/MethodProducer1Test.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/promethods/MethodProducer1Test.java
new file mode 100644
index 0000000..b481d54
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/promethods/MethodProducer1Test.java
@@ -0,0 +1,100 @@
+/*
+ * 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.webbeans.newtests.promethods;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionTarget;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.component.ManagedBean;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.promethods.beans.InjectorofMethod1Bean;
+import org.apache.webbeans.newtests.promethods.beans.MethodTypeProduces1;
+import org.apache.webbeans.newtests.promethods.beans.ProducerBean;
+import org.junit.Test;
+
+public class MethodProducer1Test extends AbstractUnitTest
+{
+ public MethodProducer1Test()
+ {
+
+ }
+
+ @Test
+ @SuppressWarnings("unchecked")
+ public void testPersonProducer()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(MethodTypeProduces1.class);
+ beanClasses.add(InjectorofMethod1Bean.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans("injectorofMethod1Bean");
+ Assert.assertNotNull(beans);
+ Bean<InjectorofMethod1Bean> bean = (Bean<InjectorofMethod1Bean>)beans.iterator().next();
+
+ Assert.assertTrue(bean instanceof ManagedBean);
+
+ CreationalContext<InjectorofMethod1Bean> ctx = getBeanManager().createCreationalContext(bean);
+
+ Object reference = getBeanManager().getReference(bean, InjectorofMethod1Bean.class, ctx);
+ Assert.assertNotNull(reference);
+
+ Assert.assertTrue(reference instanceof InjectorofMethod1Bean);
+
+
+ ArrayList<String> value = ((InjectorofMethod1Bean) reference).getPt3();
+ Assert.assertNotNull(value);
+
+
+ shutDownContainer();
+ }
+
+ @Test
+ @SuppressWarnings("unchecked")
+ /**
+ * Tests the code path of adding a bean containing producer methods through
+ * WebBeansAnnotatedTypeUtil.defineManagedBean
+ */
+ public void testProducerAddedByWebBeansAnnotatedTypeUtil()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+
+ startContainer(beanClasses, beanXmls);
+
+ AnnotatedType<ProducerBean> at = getBeanManager().createAnnotatedType(ProducerBean.class);
+ InjectionTarget<ProducerBean> it = getBeanManager().createInjectionTarget(at);
+
+ Assert.assertNotNull(it);
+
+ shutDownContainer();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/promethods/PersonProducerTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/promethods/PersonProducerTest.java
new file mode 100644
index 0000000..cc9826d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/promethods/PersonProducerTest.java
@@ -0,0 +1,143 @@
+/*
+ * 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.webbeans.newtests.promethods;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.IllegalProductException;
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.component.ProducerMethodBean;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.promethods.beans.SessionScopedPersonProducerBean;
+import org.apache.webbeans.newtests.promethods.beans.RequestScopedNullPersonProducerBean;
+import org.apache.webbeans.newtests.promethods.beans.PersonProducerBean;
+import org.apache.webbeans.newtests.promethods.common.Person;
+import org.junit.Test;
+
+public class PersonProducerTest extends AbstractUnitTest
+{
+ public PersonProducerTest()
+ {
+
+ }
+
+ @Test
+ @SuppressWarnings("unchecked")
+ public void testPersonProducer()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(Person.class);
+ beanClasses.add(PersonProducerBean.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans("personProducer");
+ Assert.assertNotNull(beans);
+ Bean<Person> bean = (Bean<Person>)beans.iterator().next();
+
+ Assert.assertTrue(bean instanceof ProducerMethodBean);
+
+ CreationalContext<Person> ctx = getBeanManager().createCreationalContext(bean);
+
+ Object reference = getBeanManager().getReference(bean, Person.class, ctx);
+ Assert.assertNotNull(reference);
+
+ Assert.assertTrue(reference instanceof Person);
+
+ shutDownContainer();
+ }
+
+ @Test
+ @SuppressWarnings("unchecked")
+ public void testNullPersonProducer()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(Person.class);
+ beanClasses.add(PersonProducerBean.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans("nullInjectedPersonProducer");
+ Assert.assertNotNull(beans);
+ Bean<Person> bean = (Bean<Person>)beans.iterator().next();
+
+ Assert.assertTrue(bean instanceof ProducerMethodBean);
+
+ CreationalContext<Person> ctx = getBeanManager().createCreationalContext(bean);
+
+ Object reference = getBeanManager().getReference(bean, Person.class, ctx);
+ Assert.assertNull(reference);
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testSessionScopedNullPersonProducer()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(Person.class);
+ beanClasses.add(SessionScopedPersonProducerBean.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ try
+ {
+ getInstance("person").toString();
+ Assert.fail("expected IllegalProductException");
+ }
+ catch (IllegalProductException e)
+ {
+ //expected
+ }
+ }
+
+ @Test
+ public void testRequestScopedNullPersonProducer()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(Person.class);
+ beanClasses.add(RequestScopedNullPersonProducerBean.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ try
+ {
+ getInstance("nullPerson").toString();
+ Assert.fail("expected IllegalProductException");
+ }
+ catch (IllegalProductException e)
+ {
+ //expected
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/promethods/beans/InjectorofMethod1Bean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/promethods/beans/InjectorofMethod1Bean.java
new file mode 100644
index 0000000..310d5c9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/promethods/beans/InjectorofMethod1Bean.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.promethods.beans;
+
+import java.util.ArrayList;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@Named
+public class InjectorofMethod1Bean
+{
+ public @Inject @Named("ProMethodParameterized3") ArrayList<String> pt3;
+
+ public ArrayList<String> getPt3()
+ {
+ return this.pt3;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/promethods/beans/MethodTypeProduces1.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/promethods/beans/MethodTypeProduces1.java
new file mode 100644
index 0000000..876ca0f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/promethods/beans/MethodTypeProduces1.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.promethods.beans;
+
+import java.util.ArrayList;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+public class MethodTypeProduces1<T extends String>
+{
+ @Produces @Dependent @Named("ProMethodParameterized3")
+ ArrayList<T> methodPT3()
+ {
+ return new ArrayList<T>();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/promethods/beans/PersonProducerBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/promethods/beans/PersonProducerBean.java
new file mode 100644
index 0000000..af102d9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/promethods/beans/PersonProducerBean.java
@@ -0,0 +1,46 @@
+/*
+ * 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.webbeans.newtests.promethods.beans;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+import org.apache.webbeans.newtests.promethods.common.Person;
+
+public class PersonProducerBean
+{
+
+ @Produces @Named("personProducer")
+ public Person producer()
+ {
+ return new Person();
+ }
+
+ @Produces @Dependent @Named("nullPersonProducer")
+ public Person nullProducer()
+ {
+ return null;
+ }
+
+ @Produces @Dependent @Named("nullInjectedPersonProducer")
+ public Person nullInjectedPersonProducer(@Named("nullPersonProducer") Person p){
+ return p;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/promethods/beans/ProducerBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/promethods/beans/ProducerBean.java
new file mode 100644
index 0000000..f582fff
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/promethods/beans/ProducerBean.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.promethods.beans;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+/**
+ * Bean with ProducerMethods to drive through the WebBeansAnnotatedTypeUtil codepath.
+ */
+
+@Named("producerBean")
+public class ProducerBean
+{
+
+ @Produces StringBuffer createSomeStringBuffer(String content){
+ return new StringBuffer(content);
+ }
+
+ @Produces String createMyString(){
+ return "Trying to create a loop";
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/promethods/beans/RequestScopedNullPersonProducerBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/promethods/beans/RequestScopedNullPersonProducerBean.java
new file mode 100644
index 0000000..c167d96
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/promethods/beans/RequestScopedNullPersonProducerBean.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.promethods.beans;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+import org.apache.webbeans.newtests.promethods.common.Person;
+
+public class RequestScopedNullPersonProducerBean
+{
+
+ @Produces @Named("nullPerson") @RequestScoped
+ public Person nullProducer()
+ {
+ return null;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/promethods/beans/SessionScopedPersonProducerBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/promethods/beans/SessionScopedPersonProducerBean.java
new file mode 100644
index 0000000..cf823fc
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/promethods/beans/SessionScopedPersonProducerBean.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.promethods.beans;
+
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+import org.apache.webbeans.newtests.promethods.common.Person;
+
+public class SessionScopedPersonProducerBean
+{
+
+ @Produces @Named("person") @SessionScoped
+ public Person producer()
+ {
+ return new Person();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/promethods/common/Person.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/promethods/common/Person.java
new file mode 100644
index 0000000..00a9346
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/promethods/common/Person.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.newtests.promethods.common;
+
+public class Person
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/DecoratorInterceptorProxySerializationTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/DecoratorInterceptorProxySerializationTest.java
new file mode 100644
index 0000000..0408fe2
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/DecoratorInterceptorProxySerializationTest.java
@@ -0,0 +1,174 @@
+/*
+ * 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.webbeans.newtests.proxy;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Test;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InterceptorBinding;
+import javax.interceptor.InvocationContext;
+import java.io.Serializable;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.util.ArrayList;
+
+import static org.apache.webbeans.newtests.util.Serializations.deserialize;
+import static org.apache.webbeans.newtests.util.Serializations.serialize;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class DecoratorInterceptorProxySerializationTest extends AbstractUnitTest
+{
+ @Inject
+ private Main client;
+
+ @Test
+ public void testProxyMappingConfig() throws Exception
+ {
+ addDecorator(MyDecorator.class);
+ addInterceptor(IBInterceptor.class);
+ startContainer(new ArrayList<Class<?>>() {{ add(Main.class); }}, null, true);
+
+ try
+ {
+ final Main deserializeInit = Main.class.cast(deserialize(serialize(client)));
+ assertFalse(deserializeInit.isCalled());
+ assertFalse(deserializeInit.isDecoratorCalled());
+ assertFalse(deserializeInit.isInterceptorCalled());
+
+ client.aMethod();
+
+ final Main deserializeState = Main.class.cast(deserialize(serialize(client)));
+ assertTrue(deserializeState.isCalled());
+ assertTrue(deserializeState.isDecoratorCalled());
+ assertTrue(deserializeState.isInterceptorCalled());
+ }
+ finally
+ {
+ shutDownContainer();
+ }
+ }
+
+ public static interface StupidClass
+ {
+ void aMethod();
+ boolean isCalled();
+ boolean isDecoratorCalled();
+ boolean isInterceptorCalled();
+ }
+
+ @InterceptorBinding
+ @Target({ElementType.METHOD, ElementType.TYPE})
+ @Retention(RetentionPolicy.RUNTIME)
+ public static @interface IB
+ {
+ }
+
+ @Interceptor
+ @IB
+ public static class IBInterceptor implements Serializable
+ {
+ private boolean called = false; // just here to represent a state in the serialization
+
+ @AroundInvoke
+ public Object intercept(final InvocationContext ctx) throws Exception
+ {
+ final String name = ctx.getMethod().getName();
+
+ if (name.equals("isInterceptorCalled"))
+ {
+ return called;
+ }
+ else if (!name.startsWith("is"))
+ {
+ called = true;
+ }
+
+ return ctx.proceed();
+ }
+ }
+
+ @Decorator
+ public static class MyDecorator implements Serializable, StupidClass
+ {
+ private boolean called = false; // just here to represent a state in the serialization
+
+ @Inject @Delegate
+ private StupidClass delegate;
+
+ @Override
+ public void aMethod() {
+ called = true;
+ delegate.aMethod();
+ }
+
+ @Override
+ public boolean isCalled() {
+ return delegate.isCalled();
+ }
+
+ @Override
+ public boolean isDecoratorCalled() {
+ return called;
+ }
+
+ @Override
+ public boolean isInterceptorCalled()
+ {
+ return false;
+ }
+ }
+
+ @IB
+ public static class Main implements StupidClass, Serializable
+ {
+ private boolean called = false; // just here to represent a state in the serialization
+
+ @Override
+ public void aMethod()
+ {
+ called = true;
+ }
+
+ @Override
+ public boolean isCalled()
+ {
+ return called;
+ }
+
+ @Override
+ public boolean isDecoratorCalled()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isInterceptorCalled()
+ {
+ return false;
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/DecoratorProxySerializationTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/DecoratorProxySerializationTest.java
new file mode 100644
index 0000000..3f33ee8
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/DecoratorProxySerializationTest.java
@@ -0,0 +1,118 @@
+/*
+ * 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.webbeans.newtests.proxy;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Test;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+import java.io.Serializable;
+import java.util.ArrayList;
+
+import static org.apache.webbeans.newtests.util.Serializations.deserialize;
+import static org.apache.webbeans.newtests.util.Serializations.serialize;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class DecoratorProxySerializationTest extends AbstractUnitTest
+{
+ @Inject
+ private Main client;
+
+ @Test
+ public void testProxyMappingConfig() throws Exception
+ {
+ addDecorator(MyDecorator.class);
+ startContainer(new ArrayList<Class<?>>() {{ add(Main.class); }}, null, true);
+
+ try
+ {
+ final Main deserializeInit = Main.class.cast(deserialize(serialize(client)));
+ assertFalse(deserializeInit.isCalled());
+ assertFalse(deserializeInit.isDecoratorCalled());
+
+ client.aMethod();
+
+ final Main deserializeState = Main.class.cast(deserialize(serialize(client)));
+ assertTrue(deserializeState.isCalled());
+ assertTrue(deserializeState.isDecoratorCalled());
+ }
+ finally
+ {
+ shutDownContainer();
+ }
+ }
+
+ public static interface StupidClass
+ {
+ void aMethod();
+ boolean isCalled();
+ boolean isDecoratorCalled();
+ }
+
+ @Decorator
+ public static class MyDecorator implements Serializable, StupidClass
+ {
+ private boolean called = false; // just here to represent a state in the serialization
+
+ @Inject @Delegate
+ private StupidClass delegate;
+
+ @Override
+ public void aMethod() {
+ called = true;
+ delegate.aMethod();
+ }
+
+ @Override
+ public boolean isCalled() {
+ return delegate.isCalled();
+ }
+
+ @Override
+ public boolean isDecoratorCalled() {
+ return called;
+ }
+ }
+
+ public static class Main implements StupidClass, Serializable
+ {
+ private boolean called = false; // just here to represent a state in the serialization
+
+ @Override
+ public void aMethod()
+ {
+ called = true;
+ }
+
+ @Override
+ public boolean isCalled()
+ {
+ return called;
+ }
+
+ @Override
+ public boolean isDecoratorCalled()
+ {
+ return false;
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/InnerClassProxyTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/InnerClassProxyTest.java
new file mode 100644
index 0000000..760eac5
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/InnerClassProxyTest.java
@@ -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.webbeans.newtests.proxy;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Test;
+
+import javax.inject.Inject;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InterceptorBinding;
+import javax.interceptor.InvocationContext;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.util.Arrays;
+import java.util.Collections;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+public class InnerClassProxyTest extends AbstractUnitTest {
+ @Inject
+ private Foo foo;
+
+ @Test
+ public void proxy() throws IllegalAccessException, InstantiationException {
+ addInterceptor(InInterceptor.class);
+ startContainer(Arrays.asList(Foo.class, Inner.class), Collections.<String>emptyList(), true);
+ assertNotNull(foo);
+ try {
+ assertEquals("ok", foo.bar(false));
+ } catch (final Exception e) {
+ fail();
+ }
+ try {
+ foo.bar(true);
+ fail();
+ } catch (final Exception e) {
+ // no-op: ok
+ }
+ shutDownContainer();
+ }
+
+ @In
+ public static class Foo {
+ public String bar(final boolean b) throws Inner {
+ if (b) {
+ throw new Inner("fail");
+ }
+ return "ok";
+ }
+ }
+
+ @Interceptor
+ @In
+ public static class InInterceptor
+ {
+ @AroundInvoke
+ public Object invoke(InvocationContext context) throws Exception
+ {
+ return context.proceed();
+ }
+ }
+
+ @InterceptorBinding
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target( { ElementType.TYPE, ElementType.METHOD })
+ public static @interface In {
+ }
+
+ public static class Inner extends RuntimeException {
+ public Inner() {
+ // no-op
+ }
+
+ public Inner(final String message) {
+ super(message);
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/InterceptorProxySerializationTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/InterceptorProxySerializationTest.java
new file mode 100644
index 0000000..b5432be
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/InterceptorProxySerializationTest.java
@@ -0,0 +1,177 @@
+/*
+ * 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.webbeans.newtests.proxy;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Test;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InterceptorBinding;
+import javax.interceptor.InvocationContext;
+import java.io.Serializable;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import static org.apache.webbeans.newtests.util.Serializations.deserialize;
+import static org.apache.webbeans.newtests.util.Serializations.serialize;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class InterceptorProxySerializationTest extends AbstractUnitTest
+{
+ @Inject
+ private Intercepted client;
+
+ @Inject
+ private AutoIntercepted auto;
+
+ @Test
+ public void testProxyMappingConfig() throws Exception
+ {
+ addInterceptor(IBInterceptor.class);
+ startContainer(Arrays.<Class<?>>asList(Intercepted.class, AutoIntercepted.class, InjectMeInInterceptor.class), null, true);
+
+ try
+ {
+ final Intercepted deserializeInit = Intercepted.class.cast(deserialize(serialize(client)));
+ assertFalse(deserializeInit.isCalled());
+ assertFalse(deserializeInit.isInterceptorCalled());
+
+ client.intercepted();
+
+ final Intercepted deserializeState = Intercepted.class.cast(deserialize(serialize(client)));
+ assertTrue(deserializeState.isCalled());
+ assertTrue(deserializeState.isInterceptorCalled());
+ }
+ finally
+ {
+ shutDownContainer();
+ }
+ }
+
+ @Test
+ public void testSerializableEvenIfAutoIntercepted() throws Exception
+ {
+ addInterceptor(IBInterceptor.class);
+ startContainer(Arrays.<Class<?>>asList(Intercepted.class, AutoIntercepted.class, InjectMeInInterceptor.class), null, true);
+
+ try
+ {
+ AutoIntercepted.called = false;
+ auto.touch();
+ assertTrue(AutoIntercepted.called);
+
+ final AutoIntercepted deserializeInit = AutoIntercepted.class.cast(deserialize(serialize(auto)));
+ AutoIntercepted.called = false;
+ deserializeInit.touch();
+ assertTrue(AutoIntercepted.called);
+
+ final AutoIntercepted deserializeState = AutoIntercepted.class.cast(deserialize(serialize(deserializeInit)));
+ AutoIntercepted.called = false;
+ deserializeState.touch();
+ assertTrue(AutoIntercepted.called);
+ }
+ finally
+ {
+ shutDownContainer();
+ }
+ }
+
+ @InterceptorBinding
+ @Target({ElementType.METHOD, ElementType.TYPE})
+ @Retention(RetentionPolicy.RUNTIME)
+ public static @interface IB
+ {
+ }
+
+ public static class InjectMeInInterceptor implements Serializable {
+ public void touch() {}
+ }
+
+ @Interceptor @IB
+ public static class IBInterceptor implements Serializable
+ {
+ private boolean called = false; // just here to represent a state in the serialization
+
+ @Inject
+ private InjectMeInInterceptor injected;
+
+ @AroundInvoke
+ public Object intercept(final InvocationContext ctx) throws Exception
+ {
+ injected.touch(); // will throw NPE if wrongly serialized
+
+ final String name = ctx.getMethod().getName();
+
+ if (name.equals("isInterceptorCalled"))
+ {
+ return called;
+ }
+ else if (!name.startsWith("is"))
+ {
+ called = true;
+ }
+
+ return ctx.proceed();
+ }
+ }
+
+ @IB
+ public static class Intercepted implements Serializable
+ {
+ private boolean called = false; // just here to represent a state in the serialization
+
+ public void intercepted()
+ {
+ called = true;
+ }
+
+ public boolean isCalled()
+ {
+ return called;
+ }
+
+ public boolean isInterceptorCalled()
+ {
+ return false;
+ }
+ }
+
+ @IB
+ public static class AutoIntercepted implements Serializable
+ {
+ public static boolean called = false;
+
+ @AroundInvoke
+ public Object auto(final InvocationContext ic) throws Exception {
+ called = true;
+ return ic.proceed();
+ }
+
+ public void touch() {}
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/ProxyMappingTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/ProxyMappingTest.java
new file mode 100644
index 0000000..f5f905a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/ProxyMappingTest.java
@@ -0,0 +1,71 @@
+/*
+ * 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.webbeans.newtests.proxy;
+
+
+import javax.inject.Provider;
+
+import org.apache.webbeans.intercept.ApplicationScopedBeanInterceptorHandler;
+import org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.proxy.beans.ApplicationBean;
+import org.apache.webbeans.newtests.proxy.beans.ConversationBean;
+import org.apache.webbeans.newtests.proxy.beans.DummyScopedExtension;
+import org.apache.webbeans.proxy.OwbNormalScopeProxy;
+import org.junit.Test;
+import org.junit.Assert;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * Test the mapping of scopes to proxy MethodHandler implementations.
+ */
+public class ProxyMappingTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testProxyMappingConfig()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+
+ addExtension(new DummyScopedExtension());
+ beanClasses.add(ConversationBean.class);
+ beanClasses.add(ApplicationBean.class);
+ startContainer(beanClasses, null);
+
+ ConversationBean conversationBean = getInstance(ConversationBean.class);
+ Assert.assertNotNull(conversationBean);
+ Assert.assertTrue(conversationBean instanceof OwbNormalScopeProxy);
+
+ Provider instanceProvider = getWebBeansContext().getNormalScopeProxyFactory().getInstanceProvider((OwbNormalScopeProxy) conversationBean);
+ Assert.assertNotNull(instanceProvider);
+ Assert.assertEquals(instanceProvider.getClass(), NormalScopedBeanInterceptorHandler.class);
+
+
+ ApplicationBean applicationBean = getInstance(ApplicationBean.class);
+ Assert.assertNotNull(applicationBean);
+ Assert.assertTrue(applicationBean instanceof OwbNormalScopeProxy);
+ instanceProvider = getWebBeansContext().getNormalScopeProxyFactory().getInstanceProvider((OwbNormalScopeProxy) applicationBean);
+ Assert.assertNotNull(instanceProvider);
+ Assert.assertEquals(instanceProvider.getClass(), ApplicationScopedBeanInterceptorHandler.class);
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/beans/ApplicationBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/beans/ApplicationBean.java
new file mode 100644
index 0000000..725531a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/beans/ApplicationBean.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.proxy.beans;
+
+
+import javax.enterprise.context.ApplicationScoped;
+
+/**
+ * To test the proxy for application scoped beans.
+ */
+@ApplicationScoped
+public class ApplicationBean
+{
+ public DummyBean.SomeInnerClass getValueHolder() throws DummyBean.SomeInnerException
+ {
+ return new DummyBean.SomeInnerClass("hola");
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/beans/ConversationBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/beans/ConversationBean.java
new file mode 100644
index 0000000..0b73fdf
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/beans/ConversationBean.java
@@ -0,0 +1,31 @@
+/*
+ * 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.webbeans.newtests.proxy.beans;
+
+
+import javax.enterprise.context.ConversationScoped;
+import java.io.Serializable;
+
+/**
+ * To test the proxy for conversation scoped beans.
+ */
+@ConversationScoped
+public class ConversationBean implements Serializable
+{
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/beans/DummyBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/beans/DummyBean.java
new file mode 100644
index 0000000..102aed1
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/beans/DummyBean.java
@@ -0,0 +1,57 @@
+/*
+ * 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.webbeans.newtests.proxy.beans;
+
+/**
+ * This class just exists as container for some inner classes.
+ */
+public class DummyBean {
+ public static class SomeInnerClass
+ {
+ private String val;
+
+ public SomeInnerClass(String val) {
+ this.val = val;
+ }
+
+ public String getVal()
+ {
+ return val;
+ }
+ }
+
+ public static class SomeInnerException extends Exception
+ {
+ public SomeInnerException() {
+ super();
+ }
+
+ public SomeInnerException(String message) {
+ super(message);
+ }
+
+ public SomeInnerException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public SomeInnerException(Throwable cause) {
+ super(cause);
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/beans/DummyScoped.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/beans/DummyScoped.java
new file mode 100644
index 0000000..5aa5beb
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/beans/DummyScoped.java
@@ -0,0 +1,42 @@
+/*
+ * 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.webbeans.newtests.proxy.beans;
+
+import javax.enterprise.context.NormalScope;
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Dummy Scope implementation for testing the proxy methodhandler mapping
+ */
+@Target( { TYPE, METHOD, FIELD })
+@Retention(RUNTIME)
+@Documented
+@NormalScope
+@Inherited
+public @interface DummyScoped
+{
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/beans/DummyScopedContext.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/beans/DummyScopedContext.java
new file mode 100644
index 0000000..b5ad462
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/beans/DummyScopedContext.java
@@ -0,0 +1,64 @@
+/*
+ * 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.webbeans.newtests.proxy.beans;
+
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+import java.lang.annotation.Annotation;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Context for the DummyScope
+ */
+public class DummyScopedContext implements Context
+{
+ private Map<Contextual<?>, Object> map = new HashMap<Contextual<?>, Object>();
+
+ @Override
+ public <T> T get(Contextual<T> component)
+ {
+ return (T) map.get(component);
+ }
+
+ @Override
+ public Class<? extends Annotation> getScope()
+ {
+ return DummyScoped.class;
+ }
+
+ @Override
+ public <T> T get(Contextual<T> component, CreationalContext<T> creationalContext)
+ {
+ Object obj = map.get(component);
+ if (obj == null)
+ {
+ obj = component.create(creationalContext);
+ map.put(component, obj);
+ }
+ return (T) obj;
+ }
+
+ @Override
+ public boolean isActive()
+ {
+ return true;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/beans/DummyScopedExtension.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/beans/DummyScopedExtension.java
new file mode 100644
index 0000000..209c701
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/beans/DummyScopedExtension.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.proxy.beans;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
+
+/**
+ * Register the DummyScopedContext
+ */
+public class DummyScopedExtension implements Extension
+{
+ public void registerDummyScopedContext(@Observes AfterBeanDiscovery afterBeanDiscovery)
+ {
+ afterBeanDiscovery.addContext(new DummyScopedContext());
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AdvancedPenProducer.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AdvancedPenProducer.java
new file mode 100644
index 0000000..6933455
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AdvancedPenProducer.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.newtests.specalization;
+
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.New;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.Specializes;
+
+@Alternative
+public class AdvancedPenProducer extends DefaultPenProducer {
+
+ @Override
+ @Produces
+ @Alternative
+ @Specializes
+ @QualifierSpecialized IPen makeMeAPen(@New Pen pen) {
+ pen.str = "An advanced ";
+ return pen;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducerTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducerTest.java
new file mode 100644
index 0000000..3c7d252
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducerTest.java
@@ -0,0 +1,71 @@
+/*
+ * 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.webbeans.newtests.specalization;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.util.AnnotationLiteral;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Test;
+
+public class AlternativeSpecializesProducerTest extends AbstractUnitTest
+{
+
+ private static final String PACKAGE_NAME = AlternativeSpecializesProducerTest.class.getPackage().getName();
+
+ @Test
+ @SuppressWarnings("unchecked")
+ public void testAlternativeSpecializeBean()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "AlternativeSpecializesProducer"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(Pen.class);
+ beanClasses.add(DefaultPenProducer.class);
+ beanClasses.add(AdvancedPenProducer.class);
+ beanClasses.add(PremiumPenProducer.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ Annotation[] anns = new Annotation[1];
+ anns[0] = new AnnotationLiteral<QualifierSpecialized>()
+ {
+ };
+
+
+ Set<Bean<?>> beans = getBeanManager().getBeans(IPen.class, anns);
+ Assert.assertTrue(beans.size() == 1);
+ Bean<IPen> bean = (Bean<IPen>)beans.iterator().next();
+ CreationalContext<IPen> cc = getBeanManager().createCreationalContext(bean);
+ IPen pen = (IPen) getBeanManager().getReference(bean, IPen.class, cc);
+ Assert.assertTrue(pen.getID().contains("premium"));
+
+ shutDownContainer();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/DefaultPenProducer.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/DefaultPenProducer.java
new file mode 100644
index 0000000..31a6532
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/DefaultPenProducer.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.newtests.specalization;
+
+import javax.enterprise.inject.New;
+import javax.enterprise.inject.Produces;
+
+public class DefaultPenProducer {
+
+ @Produces @QualifierSpecialized IPen makeMeAPen(@New Pen pen) {
+ pen.str = "An default ";
+ return pen;
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/IPen.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/IPen.java
new file mode 100644
index 0000000..a7db495
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/IPen.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.newtests.specalization;
+
+public interface IPen {
+
+ public String getID();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/Pen.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/Pen.java
new file mode 100644
index 0000000..e5dba90
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/Pen.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.newtests.specalization;
+
+import javax.inject.Inject;
+
+public class Pen implements IPen {
+
+ String str;
+
+ @Inject
+ public Pen() {
+ this.str = "";
+ }
+
+ @Override
+ public String getID() {
+ return str + " Pen";
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/PremiumPenProducer.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/PremiumPenProducer.java
new file mode 100644
index 0000000..23f1ff0
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/PremiumPenProducer.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.newtests.specalization;
+
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.New;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.Specializes;
+
+@Alternative
+public class PremiumPenProducer extends AdvancedPenProducer {
+
+ @Override
+ @Produces
+ @Alternative
+ @Specializes
+ @QualifierSpecialized IPen makeMeAPen(@New Pen pen) {
+ pen.str = "An premium ";
+ return pen;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/QualifierSpecialized.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/QualifierSpecialized.java
new file mode 100644
index 0000000..98a7f5f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/QualifierSpecialized.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.specalization;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.PARAMETER, ElementType.METHOD,ElementType.CONSTRUCTOR,ElementType.FIELD})
+
+public @interface QualifierSpecialized {
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/disabledspecialization/DisabledSpecializationTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/disabledspecialization/DisabledSpecializationTest.java
new file mode 100644
index 0000000..1e68b29
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/disabledspecialization/DisabledSpecializationTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.webbeans.newtests.specalization.disabledspecialization;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Test that @Specializes on disabled beans is no problem.
+ */
+public class DisabledSpecializationTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testSpecialization() throws Exception{
+ addExtension(new VetoMeExtension());
+ startContainer(LoginService.class, MockLoginService.class);
+
+ LoginService loginService = getInstance(LoginService.class);
+ Assert.assertNotNull(loginService);
+
+ Assert.assertFalse(loginService.login("dummy"));
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/disabledspecialization/LoginService.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/disabledspecialization/LoginService.java
new file mode 100644
index 0000000..f734765
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/disabledspecialization/LoginService.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.newtests.specalization.disabledspecialization;
+
+import javax.enterprise.context.Dependent;
+
+/**
+ * This dummy login service always denies the login attempt.
+ */
+@Dependent
+public class LoginService
+{
+ public boolean login(String userId)
+ {
+ return false;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/disabledspecialization/MockLoginService.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/disabledspecialization/MockLoginService.java
new file mode 100644
index 0000000..d64c17b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/disabledspecialization/MockLoginService.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.specalization.disabledspecialization;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.Specializes;
+
+/**
+ * And this version always logs in.
+ *
+ * The important point is that this version is always
+ * disabled via a veto Extension through ProcessAnnotatedType.
+ */
+@Dependent
+@Specializes
+@VetoMe
+public class MockLoginService extends LoginService
+{
+ @Override
+ public boolean login(String userId)
+ {
+ return true;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/disabledspecialization/VetoMe.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/disabledspecialization/VetoMe.java
new file mode 100644
index 0000000..d6847fc
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/disabledspecialization/VetoMe.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.newtests.specalization.disabledspecialization;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Veto all beans annotated with this marker.
+ */
+@Target( { ElementType.METHOD, ElementType.TYPE, ElementType.FIELD })
+@Retention(RetentionPolicy.RUNTIME)
+@Inherited
+@Documented
+public @interface VetoMe
+{
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/disabledspecialization/VetoMeExtension.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/disabledspecialization/VetoMeExtension.java
new file mode 100644
index 0000000..155474c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/disabledspecialization/VetoMeExtension.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.newtests.specalization.disabledspecialization;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+
+/**
+ * A CDI Extension which handles the {@link VetoMe} annotations.
+ */
+public class VetoMeExtension implements Extension
+{
+ public void vetoTheBeans(@Observes ProcessAnnotatedType pat)
+ {
+ if (pat.getAnnotatedType().isAnnotationPresent(VetoMe.class))
+ {
+ pat.veto();
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/multiple/BeanA.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/multiple/BeanA.java
new file mode 100644
index 0000000..77d3ab2
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/multiple/BeanA.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.newtests.specalization.multiple;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Named;
+
+@Named
+@RequestScoped
+public class BeanA
+{
+ public Class getBeanClass()
+ {
+ return BeanA.class;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/multiple/BeanB.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/multiple/BeanB.java
new file mode 100644
index 0000000..2b791a5
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/multiple/BeanB.java
@@ -0,0 +1,31 @@
+/*
+ * 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.webbeans.newtests.specalization.multiple;
+
+import javax.enterprise.inject.Specializes;
+
+@Specializes
+public class BeanB extends BeanA
+{
+ @Override
+ public Class getBeanClass()
+ {
+ return BeanB.class;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/multiple/BeanC.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/multiple/BeanC.java
new file mode 100644
index 0000000..b919f3f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/multiple/BeanC.java
@@ -0,0 +1,31 @@
+/*
+ * 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.webbeans.newtests.specalization.multiple;
+
+import javax.enterprise.inject.Specializes;
+
+@Specializes
+public class BeanC extends BeanB
+{
+ @Override
+ public Class getBeanClass()
+ {
+ return BeanC.class;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/multiple/BeanD.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/multiple/BeanD.java
new file mode 100644
index 0000000..df8aa76
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/multiple/BeanD.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.newtests.specalization.multiple;
+
+import javax.enterprise.inject.Specializes;
+import javax.inject.Named;
+
+@Named
+@Specializes
+public class BeanD extends BeanC
+{
+ @Override
+ public Class getBeanClass()
+ {
+ return BeanD.class;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/multiple/MultipleSpecializationTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/multiple/MultipleSpecializationTest.java
new file mode 100644
index 0000000..a7c86a1
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/multiple/MultipleSpecializationTest.java
@@ -0,0 +1,86 @@
+/*
+ * 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.webbeans.newtests.specalization.multiple;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import junit.framework.Assert;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.exception.inject.DefinitionException;
+import org.apache.webbeans.exception.inject.InconsistentSpecializationException;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Test;
+
+public class MultipleSpecializationTest extends AbstractUnitTest
+{
+ /**
+ * Tests that multiple specialization must be possible
+ */
+ @Test
+ public void testMultipleSpecialization()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(BeanA.class);
+ beanClasses.add(BeanB.class);
+ beanClasses.add(BeanC.class);
+
+ startContainer(beanClasses, null);
+
+ BeanA beanA = getInstance(BeanA.class);
+ Assert.assertEquals(BeanC.class, beanA.getBeanClass());
+
+ beanA = getInstance("beanA");
+ Assert.assertEquals(BeanC.class, beanA.getBeanClass());
+
+ BeanB beanB = getInstance(BeanB.class);
+ Assert.assertEquals(BeanC.class, beanB.getBeanClass());
+
+ shutDownContainer();
+ }
+
+ /**
+ * Tests that a specialization must not have a @Named annotation
+ */
+ @Test
+ public void testFailMultipleSpecializationWithNamed()
+ {
+ Exception occuredException = null;
+
+ try
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(BeanA.class);
+ beanClasses.add(BeanB.class);
+ beanClasses.add(BeanC.class);
+ beanClasses.add(BeanD.class);
+
+ startContainer(beanClasses, null);
+ }
+ catch (Exception e)
+ {
+ occuredException = e;
+ }
+
+ Assert.assertNotNull(occuredException);
+ Assert.assertEquals(WebBeansConfigurationException.class.getName(), occuredException.getClass().getName());
+ Assert.assertEquals(DefinitionException.class.getName(), occuredException.getCause().getClass().getName());
+
+ shutDownContainer();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/TestEvent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/TestEvent.java
new file mode 100644
index 0000000..29c0bc0
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/TestEvent.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.newtests.specalization.observer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class TestEvent
+{
+ private List<String> calledObserverNames = new ArrayList<String>();
+
+ public void addInvocation(String observerName)
+ {
+ this.calledObserverNames.add(observerName);
+ }
+
+ public List<String> getCalledObservers()
+ {
+ return calledObserverNames;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanA.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanA.java
new file mode 100644
index 0000000..e9fff5b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanA.java
@@ -0,0 +1,41 @@
+/*
+ * 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.webbeans.newtests.specalization.observer.prot;
+
+import org.apache.webbeans.newtests.specalization.observer.TestEvent;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import java.io.Serializable;
+
+@ApplicationScoped
+public class BeanA implements Serializable
+{
+ private static final long serialVersionUID = 9096367220631667211L;
+
+ protected void observeTestEvent(@Observes TestEvent testEvent)
+ {
+ testEvent.addInvocation(getBeanName());
+ }
+
+ public String getBeanName()
+ {
+ return getClass().getSimpleName();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanB.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanB.java
new file mode 100644
index 0000000..3c59ba8
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanB.java
@@ -0,0 +1,45 @@
+/*
+ * 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.webbeans.newtests.specalization.observer.prot;
+
+
+import org.apache.webbeans.newtests.specalization.observer.TestEvent;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Specializes;
+
+@Specializes
+@ApplicationScoped
+public class BeanB extends BeanA
+{
+ private static final long serialVersionUID = 821164664338581947L;
+
+ @Override
+ protected void observeTestEvent(@Observes TestEvent testEvent)
+ {
+ testEvent.addInvocation(getBeanName());
+ }
+
+ @Override
+ public String getBeanName()
+ {
+ return super.getBeanName() + ":[specialize]";
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanC.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanC.java
new file mode 100644
index 0000000..f730194
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanC.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.newtests.specalization.observer.prot;
+
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Specializes;
+
+@Specializes
+@Alternative
+@ApplicationScoped
+public class BeanC extends BeanA
+{
+ private static final long serialVersionUID = 821164664338581947L;
+
+ @Override
+ public String getBeanName()
+ {
+ return super.getBeanName() + ":[alternative]:[specialize]";
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanD.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanD.java
new file mode 100644
index 0000000..0d13e0a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanD.java
@@ -0,0 +1,47 @@
+/*
+ * 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.webbeans.newtests.specalization.observer.prot;
+
+
+import org.apache.webbeans.newtests.specalization.observer.TestEvent;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Specializes;
+
+@Specializes
+@Alternative
+@ApplicationScoped
+public class BeanD extends BeanA
+{
+ private static final long serialVersionUID = 821164664338581947L;
+
+ @Override
+ protected void observeTestEvent(@Observes TestEvent testEvent)
+ {
+ testEvent.addInvocation(getBeanName());
+ }
+
+ @Override
+ public String getBeanName()
+ {
+ return super.getBeanName() + ":[alternative]:[specialize]";
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanE.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanE.java
new file mode 100644
index 0000000..4c7071f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanE.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.newtests.specalization.observer.prot;
+
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Specializes;
+
+@Specializes
+@ApplicationScoped
+public class BeanE extends BeanA
+{
+ private static final long serialVersionUID = 821164664338581947L;
+
+ @Override
+ public String getBeanName()
+ {
+ return super.getBeanName() + ":[specialize]";
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/ProtectedObserverTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/ProtectedObserverTest.java
new file mode 100644
index 0000000..8ad0ddd
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/ProtectedObserverTest.java
@@ -0,0 +1,123 @@
+/*
+ * 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.webbeans.newtests.specalization.observer.prot;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Bean;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.specalization.observer.TestEvent;
+import org.junit.Assert;
+import org.junit.Test;
+
+
+public class ProtectedObserverTest extends AbstractUnitTest
+{
+ private static final String PACKAGE_NAME = TestEvent.class.getPackage().getName();
+
+ @Test
+ public void testObserverMethodsInParentOfAlternativeAndSpecializedBeans()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "AlternativeSpecializes"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(BeanA.class);
+ beanClasses.add(BeanC.class);
+ startContainer(beanClasses, beanXmls);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans(BeanA.class);
+ Assert.assertEquals(1, beans.size());
+
+ TestEvent testEvent = new TestEvent();
+ getBeanManager().fireEvent(testEvent);
+
+ Assert.assertEquals(1, testEvent.getCalledObservers().size());
+ Assert.assertTrue(testEvent.getCalledObservers().iterator().next().endsWith(":[specialize]"));
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testOverrideObserverMethodsInAlternativeAndSpecializedBeans()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "AlternativeSpecializes"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(BeanA.class);
+ beanClasses.add(BeanD.class);
+ startContainer(beanClasses, beanXmls);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans(BeanA.class);
+ Assert.assertEquals(1, beans.size());
+
+ TestEvent testEvent = new TestEvent();
+ getBeanManager().fireEvent(testEvent);
+
+ Assert.assertEquals(1, testEvent.getCalledObservers().size());
+ Assert.assertTrue(testEvent.getCalledObservers().iterator().next().endsWith(":[alternative]:[specialize]"));
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testObserverMethodsInParentOfSpecializedBeans()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(BeanA.class);
+ beanClasses.add(BeanE.class);
+ startContainer(beanClasses, null);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans(BeanA.class);
+ Assert.assertEquals(1, beans.size());
+
+ TestEvent testEvent = new TestEvent();
+ getBeanManager().fireEvent(testEvent);
+
+ Assert.assertEquals(BeanE.class, beans.toArray(new Bean<?>[0])[0].getBeanClass());
+ Assert.assertEquals(1, testEvent.getCalledObservers().size());
+ Assert.assertTrue(testEvent.getCalledObservers().iterator().next().endsWith(":[specialize]"));
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testOverrideObserverMethodsInSpecializedBeans()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(BeanA.class);
+ beanClasses.add(BeanB.class);
+ startContainer(beanClasses, null);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans(BeanA.class);
+ Assert.assertEquals(1, beans.size());
+
+ TestEvent testEvent = new TestEvent();
+ getBeanManager().fireEvent(testEvent);
+
+ Assert.assertEquals(1, testEvent.getCalledObservers().size());
+ Assert.assertTrue(testEvent.getCalledObservers().iterator().next().endsWith(":[specialize]"));
+
+ shutDownContainer();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanA.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanA.java
new file mode 100644
index 0000000..b9517cd
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanA.java
@@ -0,0 +1,41 @@
+/*
+ * 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.webbeans.newtests.specalization.observer.pub;
+
+import org.apache.webbeans.newtests.specalization.observer.TestEvent;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import java.io.Serializable;
+
+@ApplicationScoped
+public class BeanA implements Serializable
+{
+ private static final long serialVersionUID = 9096367220631667211L;
+
+ public void observeTestEvent(@Observes TestEvent testEvent)
+ {
+ testEvent.addInvocation(getBeanName());
+ }
+
+ public String getBeanName()
+ {
+ return getClass().getSimpleName();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanB.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanB.java
new file mode 100644
index 0000000..84d8f08
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanB.java
@@ -0,0 +1,45 @@
+/*
+ * 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.webbeans.newtests.specalization.observer.pub;
+
+
+import org.apache.webbeans.newtests.specalization.observer.TestEvent;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Specializes;
+
+@Specializes
+@ApplicationScoped
+public class BeanB extends BeanA
+{
+ private static final long serialVersionUID = 821164664338581947L;
+
+ @Override
+ public void observeTestEvent(@Observes TestEvent testEvent)
+ {
+ testEvent.addInvocation(getBeanName());
+ }
+
+ @Override
+ public String getBeanName()
+ {
+ return super.getBeanName() + ":[specialize]";
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanC.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanC.java
new file mode 100644
index 0000000..7710ded
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanC.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.newtests.specalization.observer.pub;
+
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Specializes;
+
+@Specializes
+@Alternative
+@ApplicationScoped
+public class BeanC extends BeanA
+{
+ private static final long serialVersionUID = 821164664338581947L;
+
+ @Override
+ public String getBeanName()
+ {
+ return super.getBeanName() + ":[alternative]:[specialize]";
+ }
+}
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanD.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanD.java
new file mode 100644
index 0000000..01b690e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanD.java
@@ -0,0 +1,47 @@
+/*
+ * 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.webbeans.newtests.specalization.observer.pub;
+
+
+import org.apache.webbeans.newtests.specalization.observer.TestEvent;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Specializes;
+
+@Specializes
+@Alternative
+@ApplicationScoped
+public class BeanD extends BeanA
+{
+ private static final long serialVersionUID = 821164664338581947L;
+
+ @Override
+ public void observeTestEvent(@Observes TestEvent testEvent)
+ {
+ testEvent.addInvocation(getBeanName());
+ }
+
+ @Override
+ public String getBeanName()
+ {
+ return super.getBeanName() + ":[alternative]:[specialize]";
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanE.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanE.java
new file mode 100644
index 0000000..35265ff
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanE.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.newtests.specalization.observer.pub;
+
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Specializes;
+
+@Specializes
+@ApplicationScoped
+public class BeanE extends BeanA
+{
+ private static final long serialVersionUID = 821164664338581947L;
+
+ @Override
+ public String getBeanName()
+ {
+ return super.getBeanName() + ":[specialize]";
+ }
+}
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/PublicObserverTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/PublicObserverTest.java
new file mode 100644
index 0000000..05f02f2
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/PublicObserverTest.java
@@ -0,0 +1,122 @@
+/*
+ * 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.webbeans.newtests.specalization.observer.pub;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.specalization.observer.TestEvent;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.enterprise.inject.spi.Bean;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+
+public class PublicObserverTest extends AbstractUnitTest
+{
+ private static final String PACKAGE_NAME = TestEvent.class.getPackage().getName();
+
+ @Test
+ public void testObserverMethodsInParentOfAlternativeAndSpecializedBeans()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "AlternativeSpecializes"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(BeanA.class);
+ beanClasses.add(BeanC.class);
+ startContainer(beanClasses, beanXmls);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans(BeanA.class);
+ Assert.assertEquals(1, beans.size());
+
+ TestEvent testEvent = new TestEvent();
+ getBeanManager().fireEvent(testEvent);
+
+ Assert.assertEquals(1, testEvent.getCalledObservers().size());
+ Assert.assertTrue(testEvent.getCalledObservers().iterator().next().endsWith(":[specialize]"));
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testOverrideObserverMethodsInAlternativeAndSpecializedBeans()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(PACKAGE_NAME, "AlternativeSpecializes"));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(BeanA.class);
+ beanClasses.add(BeanD.class);
+ startContainer(beanClasses, beanXmls);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans(BeanA.class);
+ Assert.assertEquals(1, beans.size());
+
+ TestEvent testEvent = new TestEvent();
+ getBeanManager().fireEvent(testEvent);
+
+ Assert.assertEquals(1, testEvent.getCalledObservers().size());
+ Assert.assertTrue(testEvent.getCalledObservers().iterator().next().endsWith(":[alternative]:[specialize]"));
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testObserverMethodsInParentOfSpecializedBeans()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(BeanA.class);
+ beanClasses.add(BeanE.class);
+ startContainer(beanClasses, null);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans(BeanA.class);
+ Assert.assertEquals(1, beans.size());
+
+ TestEvent testEvent = new TestEvent();
+ getBeanManager().fireEvent(testEvent);
+
+ Assert.assertEquals(BeanE.class, beans.toArray(new Bean<?>[0])[0].getBeanClass());
+ Assert.assertEquals(1, testEvent.getCalledObservers().size());
+ Assert.assertTrue(testEvent.getCalledObservers().iterator().next().endsWith(":[specialize]"));
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testOverrideObserverMethodsInSpecializedBeans()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(BeanA.class);
+ beanClasses.add(BeanB.class);
+ startContainer(beanClasses, null);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans(BeanA.class);
+ Assert.assertEquals(1, beans.size());
+
+ TestEvent testEvent = new TestEvent();
+ getBeanManager().fireEvent(testEvent);
+
+ Assert.assertEquals(1, testEvent.getCalledObservers().size());
+ Assert.assertTrue(testEvent.getCalledObservers().iterator().next().endsWith(":[specialize]"));
+
+ shutDownContainer();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/passivation/DefaultXyBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/passivation/DefaultXyBean.java
new file mode 100644
index 0000000..9191d4c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/passivation/DefaultXyBean.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.newtests.specalization.passivation;
+
+import javax.enterprise.context.SessionScoped;
+import java.io.Serializable;
+
+/**
+ * This bean will later get specialized.
+ * It's important for our test that this bean has a passivating scope
+ */
+@SessionScoped
+public class DefaultXyBean implements Serializable
+{
+ public int getFoo()
+ {
+ return 42;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/passivation/SpecializedXyBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/passivation/SpecializedXyBean.java
new file mode 100644
index 0000000..ece6442
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/passivation/SpecializedXyBean.java
@@ -0,0 +1,39 @@
+/*
+ * 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.webbeans.newtests.specalization.passivation;
+
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.Specializes;
+import java.io.Serializable;
+
+/**
+ * This bean specializes DefaultXyBean which is therefor disabled.
+ * It's important for our test that this bean has a passivating scope
+ */
+@SessionScoped
+@Specializes
+public class SpecializedXyBean extends DefaultXyBean implements Serializable
+{
+ @Override
+ public int getFoo()
+ {
+ return 42;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/passivation/SpecializesPassivationTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/passivation/SpecializesPassivationTest.java
new file mode 100644
index 0000000..371b0d4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/passivation/SpecializesPassivationTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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.webbeans.newtests.specalization.passivation;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.specalization.Pen;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+public class SpecializesPassivationTest extends AbstractUnitTest
+{
+
+ private static final String PACKAGE_NAME = SpecializesPassivationTest.class.getPackage().getName();
+
+ @Test
+ @SuppressWarnings("unchecked")
+ public void testSpecializePassivatingBean()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(Pen.class);
+ beanClasses.add(DefaultXyBean.class);
+ beanClasses.add(SpecializedXyBean.class);
+
+ startContainer(beanClasses, null);
+ shutDownContainer();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/util/AnnotationUtilTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/util/AnnotationUtilTest.java
new file mode 100644
index 0000000..01ce7ef
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/util/AnnotationUtilTest.java
@@ -0,0 +1,353 @@
+/*
+ * 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.webbeans.newtests.util;
+
+import org.apache.webbeans.config.DefaultAnnotation;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.enterprise.util.AnnotationLiteral;
+import javax.enterprise.util.Nonbinding;
+import javax.inject.Qualifier;
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Tests for AnnotationUtil.
+ */
+public class AnnotationUtilTest
+{
+ @Test
+ public void test_isQualifierEqual_DefaultAnnotation_emptyQualifier()
+ {
+ Annotation q1 = DefaultAnnotation.of(EmptyQualifier.class);
+ Annotation q2 = DefaultAnnotation.of(EmptyQualifier.class);
+
+ Assert.assertTrue(AnnotationUtil.isCdiAnnotationEqual(q1, q2));
+ }
+
+ @Test
+ public void test_isQualifierEqual_DefaultAnnotation_AnnotationLiteral_emptyQualifier()
+ {
+ Annotation q1 = DefaultAnnotation.of(EmptyQualifier.class);
+ EmptyQualifier q2 = new EmptyQualifierAnnotationLiteral();
+
+ Assert.assertTrue(AnnotationUtil.isCdiAnnotationEqual(q1, q2));
+ }
+
+ @Test
+ public void test_isQualifierEqual_DefaultAnnotation_nonEmptyQualifier()
+ {
+ Annotation q1 = DefaultAnnotation.of(TestQualifier.class);
+ Annotation q2 = DefaultAnnotation.of(TestQualifier.class);
+
+ Assert.assertTrue(AnnotationUtil.isCdiAnnotationEqual(q1, q2));
+ }
+
+ @Test
+ public void test_isQualifierEqual_DefaultAnnotation_AnnotationLiteral_nonEmptyQualifier()
+ {
+ Annotation q1 = DefaultAnnotation.of(TestQualifier.class);
+ TestQualifier q2 = new TestQualifierAnnotationLiteral();
+
+ Assert.assertTrue(AnnotationUtil.isCdiAnnotationEqual(q1, q2));
+ }
+
+ @Test
+ public void test_isQualifierEqual_AnnotationLiteral_nonEmptyQualifier()
+ {
+ TestQualifier q1 = new TestQualifierAnnotationLiteral();
+ TestQualifier q2 = new TestQualifierAnnotationLiteral();
+
+ Assert.assertTrue(AnnotationUtil.isCdiAnnotationEqual(q1, q2));
+ }
+
+ @Test
+ public void test_isQualifierEqual_AnnotationLiteral_Different_String()
+ {
+ TestQualifier q1 = new TestQualifierAnnotationLiteral();
+ TestQualifierAnnotationLiteral q2 = new TestQualifierAnnotationLiteral();
+
+ q2.setValue("different value");
+
+ Assert.assertFalse(AnnotationUtil.isCdiAnnotationEqual(q1, q2));
+ }
+
+ @Test
+ public void test_isQualifierEqual_AnnotationLiteral_Different_int()
+ {
+ TestQualifier q1 = new TestQualifierAnnotationLiteral();
+ TestQualifierAnnotationLiteral q2 = new TestQualifierAnnotationLiteral();
+
+ q2.setNumber(4711);
+
+ Assert.assertFalse(AnnotationUtil.isCdiAnnotationEqual(q1, q2));
+ }
+
+ @Test
+ public void test_isQualifierEqual_AnnotationLiteral_Different_array()
+ {
+ TestQualifier q1 = new TestQualifierAnnotationLiteral();
+ TestQualifierAnnotationLiteral q2 = new TestQualifierAnnotationLiteral();
+
+ q2.setFloatArray(new float[]{47F, 11F});
+
+ Assert.assertFalse(AnnotationUtil.isCdiAnnotationEqual(q1, q2));
+ }
+
+ @Test
+ public void test_isQualifierEqual_AnnotationLiteral_Different_Enum()
+ {
+ TestQualifier q1 = new TestQualifierAnnotationLiteral();
+ TestQualifierAnnotationLiteral q2 = new TestQualifierAnnotationLiteral();
+
+ q2.setEnumValue(RetentionPolicy.SOURCE);
+
+ Assert.assertFalse(AnnotationUtil.isCdiAnnotationEqual(q1, q2));
+ }
+
+ @Test
+ public void test_isQualifierEqual_AnnotationLiteral_Nonbinding_Different()
+ {
+ Annotation q1 = DefaultAnnotation.of(TestQualifierNonbinding.class);
+ TestQualifierNonbinding q2 = new TestQualifierNonbindingAnnotationLiteral();
+
+ Assert.assertTrue(AnnotationUtil.isCdiAnnotationEqual(q1, q2));
+ }
+
+ @Test
+ public void test_isQualifierEqual_AnnotationLiteral_MultipleNonbinding_Different()
+ {
+ Annotation q1 = DefaultAnnotation.of(TestQualifierMultipleNonbinding.class);
+ TestQualifierMultipleNonbindingAnnotationLiteral q2 = new TestQualifierMultipleNonbindingAnnotationLiteral();
+ q2.setValue("my value");
+
+ Assert.assertFalse(AnnotationUtil.isCdiAnnotationEqual(q1, q2));
+ }
+
+ @Test
+ public void test_isQualifierEqual_AnnotationLiteral_MultipleNonbinding_Equals()
+ {
+ Annotation q1 = DefaultAnnotation.of(TestQualifierMultipleNonbinding.class);
+ TestQualifierMultipleNonbindingAnnotationLiteral q2 = new TestQualifierMultipleNonbindingAnnotationLiteral();
+ q2.setValue("default-value");
+
+ Assert.assertTrue(AnnotationUtil.isCdiAnnotationEqual(q1, q2));
+ }
+
+ @Test
+ public void test_isQualifierEqual_AnnotationLiteralMutliple_MultipleNonbinding_Equals()
+ {
+ TestQualifierMultipleNonbindingAnnotationLiteral q1 = new TestQualifierMultipleNonbindingAnnotationLiteral();
+ q1.setValue("hello");
+
+ TestQualifierMultipleNonbindingAnnotationLiteral q2 = new TestQualifierMultipleNonbindingAnnotationLiteral();
+ q2.setValue("hello");
+
+ Assert.assertTrue(AnnotationUtil.isCdiAnnotationEqual(q1, q2));
+ }
+
+ @Test
+ public void test_isQualifierEqual_AnnotationLiteralMutliple_MultipleNonbinding_different()
+ {
+ TestQualifierMultipleNonbindingAnnotationLiteral q1 = new TestQualifierMultipleNonbindingAnnotationLiteral();
+ q1.setValue("hello_different");
+
+ TestQualifierMultipleNonbindingAnnotationLiteral q2 = new TestQualifierMultipleNonbindingAnnotationLiteral();
+ q2.setValue("hello");
+
+ Assert.assertFalse(AnnotationUtil.isCdiAnnotationEqual(q1, q2));
+ }
+}
+
+@Retention(RUNTIME)
+@Qualifier
+@interface EmptyQualifier
+{
+
+}
+
+class EmptyQualifierAnnotationLiteral
+ extends AnnotationLiteral<EmptyQualifier>
+ implements EmptyQualifier
+{
+}
+
+@Retention(RUNTIME)
+@Qualifier
+@interface TestQualifier
+{
+
+ String value() default "default-value";
+
+ int number() default -1;
+
+ float[] floatArray() default {1.0F, 1.2F};
+
+ RetentionPolicy enumValue() default RetentionPolicy.RUNTIME;
+
+}
+
+class TestQualifierAnnotationLiteral
+ extends AnnotationLiteral<TestQualifier>
+ implements TestQualifier
+{
+
+ // default values
+ private String value = "default-value";
+ private int number = -1;
+ private float[] floatArray = new float[]{1.0F, 1.2F};
+ private RetentionPolicy enumValue = RetentionPolicy.RUNTIME;
+
+ // annotation methods
+
+ @Override
+ public String value()
+ {
+ return value;
+ }
+
+ @Override
+ public int number()
+ {
+ return number;
+ }
+
+ @Override
+ public float[] floatArray()
+ {
+ return floatArray;
+ }
+
+ @Override
+ public RetentionPolicy enumValue()
+ {
+ return enumValue;
+ }
+
+ // setter
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+
+ public void setNumber(int number)
+ {
+ this.number = number;
+ }
+
+ public void setFloatArray(float[] floatArray)
+ {
+ this.floatArray = floatArray;
+ }
+
+ public void setEnumValue(RetentionPolicy enumValue)
+ {
+ this.enumValue = enumValue;
+ }
+
+}
+
+@Retention(RUNTIME)
+@Qualifier
+@interface TestQualifierNonbinding
+{
+
+ String value() default "default-value";
+
+ @MyCustomAnnotation // to show that there can be more than one annotation here
+ @Nonbinding
+ int number() default -1;
+
+}
+
+@Retention(RUNTIME)
+@Qualifier
+@interface TestQualifierMultipleNonbinding
+{
+
+ String value() default "default-value";
+
+ @Nonbinding
+ int number() default -1;
+
+ @Nonbinding
+ long card() default -1;
+
+}
+
+@Retention(RUNTIME)
+@interface MyCustomAnnotation
+{
+}
+
+class TestQualifierMultipleNonbindingAnnotationLiteral
+ extends AnnotationLiteral<TestQualifierMultipleNonbinding>
+ implements TestQualifierMultipleNonbinding
+
+{
+ String value;
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+
+ @Override
+ public String value()
+ {
+ return value;
+ }
+
+ @Override
+ public int number()
+ {
+ return 10;
+ }
+
+ @Override
+ public long card()
+ {
+ return 20;
+ }
+
+}
+
+class TestQualifierNonbindingAnnotationLiteral
+ extends AnnotationLiteral<TestQualifierNonbinding>
+ implements TestQualifierNonbinding
+{
+
+ @Override
+ public String value()
+ {
+ return "default-value";
+ }
+
+ @Override
+ public int number()
+ {
+ return 4711;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/util/Serializations.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/util/Serializations.java
new file mode 100644
index 0000000..e07142d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/util/Serializations.java
@@ -0,0 +1,45 @@
+/*
+ * 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.webbeans.newtests.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+public final class Serializations
+{
+ private Serializations() {
+ // no-op
+ }
+
+ public static byte[] serialize(final Object o) throws IOException
+ {
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ final ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(o);
+ return baos.toByteArray();
+ }
+
+ public static Object deserialize(final byte[] serial) throws IOException, ClassNotFoundException
+ {
+ return new ObjectInputStream(new ByteArrayInputStream(serial)).readObject();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/portable/AnnotatedTypeImplTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/portable/AnnotatedTypeImplTest.java
new file mode 100644
index 0000000..c6e00d0
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/portable/AnnotatedTypeImplTest.java
@@ -0,0 +1,2598 @@
+/*
+ * 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.webbeans.portable;
+
+import java.util.ArrayList;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class AnnotatedTypeImplTest
+ extends AbstractUnitTest
+{
+ final int NUM_THREADS = 500;
+
+ final CountDownLatch startingLine = new CountDownLatch(NUM_THREADS);
+
+ final CountDownLatch startingPistol = new CountDownLatch(1);
+
+ final CountDownLatch finishLine = new CountDownLatch(NUM_THREADS);
+
+ final AtomicInteger exceptions = new AtomicInteger();
+
+ @Before
+ public void setup()
+ {
+ startContainer(new ArrayList<Class<?>>());
+ }
+
+ @Test
+ public void testCreateInjectionTarget()
+ throws Exception
+ {
+
+ final BeanManager beanManager = getBeanManager();
+ final AnnotatedType<Colors> annotatedType = beanManager.createAnnotatedType(Colors.class);
+
+ for (int i = 0; i < NUM_THREADS; i++)
+ {
+ new Runner(startingLine, startingPistol, exceptions, finishLine, annotatedType)
+ {
+ @Override
+ public void doit()
+ {
+ beanManager.createInjectionTarget(annotatedType);
+ }
+ }.start();
+ }
+
+ assertTrue("Not all threads reported ready.", startingLine.await(30, TimeUnit.SECONDS));
+
+ startingPistol.countDown();
+
+ assertTrue("Not all threads finished.", finishLine.await(1, TimeUnit.MINUTES));
+
+ assertEquals(0, exceptions.get());
+ }
+
+ @Test
+ public void testGetFields()
+ throws Exception
+ {
+
+ final BeanManager beanManager = getBeanManager();
+ final AnnotatedType<Colors> annotatedType = beanManager.createAnnotatedType(Colors.class);
+
+ for (int i = 0; i < NUM_THREADS; i++)
+ {
+ new Runner(startingLine, startingPistol, exceptions, finishLine, annotatedType)
+ {
+ @Override
+ public void doit()
+ {
+ for (AnnotatedField<? super Colors> field : annotatedType.getFields())
+ {
+
+ }
+ }
+ }.start();
+ }
+
+ assertTrue("Not all threads reported ready.", startingLine.await(30, TimeUnit.SECONDS));
+
+ startingPistol.countDown();
+
+ assertTrue("Not all threads finished.", finishLine.await(30, TimeUnit.SECONDS));
+
+ assertEquals(0, exceptions.get());
+ }
+
+ @Test
+ public void testGetMethods()
+ throws Exception
+ {
+
+ final BeanManager beanManager = getBeanManager();
+ final AnnotatedType<Colors> annotatedType = beanManager.createAnnotatedType(Colors.class);
+
+ for (int i = 0; i < NUM_THREADS; i++)
+ {
+ new Runner(startingLine, startingPistol, exceptions, finishLine, annotatedType)
+ {
+ @Override
+ public void doit()
+ {
+ for (AnnotatedMethod<? super Colors> field : annotatedType.getMethods())
+ {
+ }
+ }
+ }.start();
+ }
+
+ assertTrue("Not all threads reported ready.", startingLine.await(30, TimeUnit.SECONDS));
+
+ startingPistol.countDown();
+
+ assertTrue("Not all threads finished.", finishLine.await(30, TimeUnit.SECONDS));
+
+ assertEquals(0, exceptions.get());
+ }
+
+ @Test
+ public void testGetConstructors()
+ throws Exception
+ {
+
+ final BeanManager beanManager = getBeanManager();
+ final AnnotatedType<Colors> annotatedType = beanManager.createAnnotatedType(Colors.class);
+
+ for (int i = 0; i < NUM_THREADS; i++)
+ {
+ new Runner(startingLine, startingPistol, exceptions, finishLine, annotatedType)
+ {
+ @Override
+ public void doit()
+ {
+ for (AnnotatedConstructor<Colors> constructor : annotatedType.getConstructors())
+ {
+
+ }
+ }
+ }.start();
+ }
+
+ assertTrue("Not all threads reported ready.", startingLine.await(30, TimeUnit.SECONDS));
+
+ startingPistol.countDown();
+
+ assertTrue("Not all threads finished.", finishLine.await(30, TimeUnit.SECONDS));
+
+ assertEquals(0, exceptions.get());
+ }
+
+ private static abstract class Runner
+ extends Thread
+ {
+
+ private final CountDownLatch startingLine;
+
+ private final CountDownLatch startingPistol;
+
+ private final AtomicInteger exceptions;
+
+ private final CountDownLatch finishLine;
+
+ private final AnnotatedType<Colors> annotatedType;
+
+ public Runner(CountDownLatch startingLine, CountDownLatch startingPistol, AtomicInteger exceptions,
+ CountDownLatch finishLine, AnnotatedType<Colors> annotatedType)
+ {
+ this.startingLine = startingLine;
+ this.startingPistol = startingPistol;
+ this.exceptions = exceptions;
+ this.finishLine = finishLine;
+ this.annotatedType = annotatedType;
+
+ setDaemon(true);
+ }
+
+ @Override
+ public void run()
+ {
+ startingLine.countDown();
+ try
+ {
+ startingPistol.await(10, TimeUnit.SECONDS);
+
+ doit();
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ exceptions.incrementAndGet();
+ }
+ finally
+ {
+ finishLine.countDown();
+ }
+ }
+
+ public abstract void doit();
+ }
+
+ public static class Colors
+ {
+ private String almond;
+
+ private String amber;
+
+ private String amethyst;
+
+ private String apple;
+
+ private String apricot;
+
+ private String aqua;
+
+ private String aquamarine;
+
+ private String ash;
+
+ private String azure;
+
+ private String banana;
+
+ private String beige;
+
+ private String black;
+
+ private String blue;
+
+ private String brick;
+
+ private String bronze;
+
+ private String brown;
+
+ private String burgundy;
+
+ private String carrot;
+
+ private String charcoal;
+
+ private String cherry;
+
+ private String chestnut;
+
+ private String chocolate;
+
+ private String chrome;
+
+ private String cinnamon;
+
+ private String citrine;
+
+ private String cobalt;
+
+ private String copper;
+
+ private String coral;
+
+ private String cornflower;
+
+ private String cotton;
+
+ private String cream;
+
+ private String crimson;
+
+ private String cyan;
+
+ private String ebony;
+
+ private String emerald;
+
+ private String forest;
+
+ private String fuchsia;
+
+ private String ginger;
+
+ private String gold;
+
+ private String goldenrod;
+
+ private String gray;
+
+ private String green;
+
+ private String grey;
+
+ private String indigo;
+
+ private String ivory;
+
+ private String jade;
+
+ private String jasmine;
+
+ private String khaki;
+
+ private String lava;
+
+ private String lavender;
+
+ private String lemon;
+
+ private String lilac;
+
+ private String lime;
+
+ private String macaroni;
+
+ private String magenta;
+
+ private String magnolia;
+
+ private String mahogany;
+
+ private String malachite;
+
+ private String mango;
+
+ private String maroon;
+
+ private String mauve;
+
+ private String mint;
+
+ private String moonstone;
+
+ private String navy;
+
+ private String ocean;
+
+ private String olive;
+
+ private String onyx;
+
+ private String orange;
+
+ private String orchid;
+
+ private String papaya;
+
+ private String peach;
+
+ private String pear;
+
+ private String pearl;
+
+ private String periwinkle;
+
+ private String pine;
+
+ private String pink;
+
+ private String pistachio;
+
+ private String platinum;
+
+ private String plum;
+
+ private String prune;
+
+ private String pumpkin;
+
+ private String purple;
+
+ private String quartz;
+
+ private String raspberry;
+
+ private String red;
+
+ private String rose;
+
+ private String rosewood;
+
+ private String ruby;
+
+ private String salmon;
+
+ private String sapphire;
+
+ private String scarlet;
+
+ private String sienna;
+
+ private String silver;
+
+ private String slate;
+
+ private String strawberry;
+
+ private String tan;
+
+ private String tangerine;
+
+ private String taupe;
+
+ private String teal;
+
+ private String titanium;
+
+ private String topaz;
+
+ private String turquoise;
+
+ private String umber;
+
+ private String vanilla;
+
+ private String violet;
+
+ private String watermelon;
+
+ private String white;
+
+ private String yellow;
+
+
+ public Colors(String arg)
+ {
+ }
+
+ public Colors(String arg, String arg0)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70, String arg71)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70, String arg71, String arg72)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70, String arg71, String arg72, String arg73)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70, String arg71, String arg72, String arg73, String arg74)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70, String arg71, String arg72, String arg73, String arg74, String arg75)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70, String arg71, String arg72, String arg73, String arg74, String arg75,
+ String arg76)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70, String arg71, String arg72, String arg73, String arg74, String arg75,
+ String arg76, String arg77)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70, String arg71, String arg72, String arg73, String arg74, String arg75,
+ String arg76, String arg77, String arg78)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70, String arg71, String arg72, String arg73, String arg74, String arg75,
+ String arg76, String arg77, String arg78, String arg79)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70, String arg71, String arg72, String arg73, String arg74, String arg75,
+ String arg76, String arg77, String arg78, String arg79, String arg80)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70, String arg71, String arg72, String arg73, String arg74, String arg75,
+ String arg76, String arg77, String arg78, String arg79, String arg80, String arg81)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70, String arg71, String arg72, String arg73, String arg74, String arg75,
+ String arg76, String arg77, String arg78, String arg79, String arg80, String arg81, String arg82)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70, String arg71, String arg72, String arg73, String arg74, String arg75,
+ String arg76, String arg77, String arg78, String arg79, String arg80, String arg81, String arg82,
+ String arg83)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70, String arg71, String arg72, String arg73, String arg74, String arg75,
+ String arg76, String arg77, String arg78, String arg79, String arg80, String arg81, String arg82,
+ String arg83, String arg84)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70, String arg71, String arg72, String arg73, String arg74, String arg75,
+ String arg76, String arg77, String arg78, String arg79, String arg80, String arg81, String arg82,
+ String arg83, String arg84, String arg85)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70, String arg71, String arg72, String arg73, String arg74, String arg75,
+ String arg76, String arg77, String arg78, String arg79, String arg80, String arg81, String arg82,
+ String arg83, String arg84, String arg85, String arg86)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70, String arg71, String arg72, String arg73, String arg74, String arg75,
+ String arg76, String arg77, String arg78, String arg79, String arg80, String arg81, String arg82,
+ String arg83, String arg84, String arg85, String arg86, String arg87)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70, String arg71, String arg72, String arg73, String arg74, String arg75,
+ String arg76, String arg77, String arg78, String arg79, String arg80, String arg81, String arg82,
+ String arg83, String arg84, String arg85, String arg86, String arg87, String arg88)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70, String arg71, String arg72, String arg73, String arg74, String arg75,
+ String arg76, String arg77, String arg78, String arg79, String arg80, String arg81, String arg82,
+ String arg83, String arg84, String arg85, String arg86, String arg87, String arg88, String arg89)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70, String arg71, String arg72, String arg73, String arg74, String arg75,
+ String arg76, String arg77, String arg78, String arg79, String arg80, String arg81, String arg82,
+ String arg83, String arg84, String arg85, String arg86, String arg87, String arg88, String arg89,
+ String arg90)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70, String arg71, String arg72, String arg73, String arg74, String arg75,
+ String arg76, String arg77, String arg78, String arg79, String arg80, String arg81, String arg82,
+ String arg83, String arg84, String arg85, String arg86, String arg87, String arg88, String arg89,
+ String arg90, String arg91)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70, String arg71, String arg72, String arg73, String arg74, String arg75,
+ String arg76, String arg77, String arg78, String arg79, String arg80, String arg81, String arg82,
+ String arg83, String arg84, String arg85, String arg86, String arg87, String arg88, String arg89,
+ String arg90, String arg91, String arg92)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70, String arg71, String arg72, String arg73, String arg74, String arg75,
+ String arg76, String arg77, String arg78, String arg79, String arg80, String arg81, String arg82,
+ String arg83, String arg84, String arg85, String arg86, String arg87, String arg88, String arg89,
+ String arg90, String arg91, String arg92, String arg93)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70, String arg71, String arg72, String arg73, String arg74, String arg75,
+ String arg76, String arg77, String arg78, String arg79, String arg80, String arg81, String arg82,
+ String arg83, String arg84, String arg85, String arg86, String arg87, String arg88, String arg89,
+ String arg90, String arg91, String arg92, String arg93, String arg94)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70, String arg71, String arg72, String arg73, String arg74, String arg75,
+ String arg76, String arg77, String arg78, String arg79, String arg80, String arg81, String arg82,
+ String arg83, String arg84, String arg85, String arg86, String arg87, String arg88, String arg89,
+ String arg90, String arg91, String arg92, String arg93, String arg94, String arg95)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70, String arg71, String arg72, String arg73, String arg74, String arg75,
+ String arg76, String arg77, String arg78, String arg79, String arg80, String arg81, String arg82,
+ String arg83, String arg84, String arg85, String arg86, String arg87, String arg88, String arg89,
+ String arg90, String arg91, String arg92, String arg93, String arg94, String arg95, String arg96)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70, String arg71, String arg72, String arg73, String arg74, String arg75,
+ String arg76, String arg77, String arg78, String arg79, String arg80, String arg81, String arg82,
+ String arg83, String arg84, String arg85, String arg86, String arg87, String arg88, String arg89,
+ String arg90, String arg91, String arg92, String arg93, String arg94, String arg95, String arg96,
+ String arg97)
+ {
+ }
+
+ public Colors(String arg, String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
+ String arg6, String arg7, String arg8, String arg9, String arg10, String arg11, String arg12,
+ String arg13, String arg14, String arg15, String arg16, String arg17, String arg18, String arg19,
+ String arg20, String arg21, String arg22, String arg23, String arg24, String arg25, String arg26,
+ String arg27, String arg28, String arg29, String arg30, String arg31, String arg32, String arg33,
+ String arg34, String arg35, String arg36, String arg37, String arg38, String arg39, String arg40,
+ String arg41, String arg42, String arg43, String arg44, String arg45, String arg46, String arg47,
+ String arg48, String arg49, String arg50, String arg51, String arg52, String arg53, String arg54,
+ String arg55, String arg56, String arg57, String arg58, String arg59, String arg60, String arg61,
+ String arg62, String arg63, String arg64, String arg65, String arg66, String arg67, String arg68,
+ String arg69, String arg70, String arg71, String arg72, String arg73, String arg74, String arg75,
+ String arg76, String arg77, String arg78, String arg79, String arg80, String arg81, String arg82,
+ String arg83, String arg84, String arg85, String arg86, String arg87, String arg88, String arg89,
+ String arg90, String arg91, String arg92, String arg93, String arg94, String arg95, String arg96,
+ String arg97, String arg98)
+ {
+ }
+
+ public String getAlmond()
+ {
+ return almond;
+ }
+
+ public void setAlmond(String almond)
+ {
+ this.almond = almond;
+ }
+
+ public String getAmber()
+ {
+ return amber;
+ }
+
+ public void setAmber(String amber)
+ {
+ this.amber = amber;
+ }
+
+ public String getAmethyst()
+ {
+ return amethyst;
+ }
+
+ public void setAmethyst(String amethyst)
+ {
+ this.amethyst = amethyst;
+ }
+
+ public String getApple()
+ {
+ return apple;
+ }
+
+ public void setApple(String apple)
+ {
+ this.apple = apple;
+ }
+
+ public String getApricot()
+ {
+ return apricot;
+ }
+
+ public void setApricot(String apricot)
+ {
+ this.apricot = apricot;
+ }
+
+ public String getAqua()
+ {
+ return aqua;
+ }
+
+ public void setAqua(String aqua)
+ {
+ this.aqua = aqua;
+ }
+
+ public String getAquamarine()
+ {
+ return aquamarine;
+ }
+
+ public void setAquamarine(String aquamarine)
+ {
+ this.aquamarine = aquamarine;
+ }
+
+ public String getAsh()
+ {
+ return ash;
+ }
+
+ public void setAsh(String ash)
+ {
+ this.ash = ash;
+ }
+
+ public String getAzure()
+ {
+ return azure;
+ }
+
+ public void setAzure(String azure)
+ {
+ this.azure = azure;
+ }
+
+ public String getBanana()
+ {
+ return banana;
+ }
+
+ public void setBanana(String banana)
+ {
+ this.banana = banana;
+ }
+
+ public String getBeige()
+ {
+ return beige;
+ }
+
+ public void setBeige(String beige)
+ {
+ this.beige = beige;
+ }
+
+ public String getBlack()
+ {
+ return black;
+ }
+
+ public void setBlack(String black)
+ {
+ this.black = black;
+ }
+
+ public String getBlue()
+ {
+ return blue;
+ }
+
+ public void setBlue(String blue)
+ {
+ this.blue = blue;
+ }
+
+ public String getBrick()
+ {
+ return brick;
+ }
+
+ public void setBrick(String brick)
+ {
+ this.brick = brick;
+ }
+
+ public String getBronze()
+ {
+ return bronze;
+ }
+
+ public void setBronze(String bronze)
+ {
+ this.bronze = bronze;
+ }
+
+ public String getBrown()
+ {
+ return brown;
+ }
+
+ public void setBrown(String brown)
+ {
+ this.brown = brown;
+ }
+
+ public String getBurgundy()
+ {
+ return burgundy;
+ }
+
+ public void setBurgundy(String burgundy)
+ {
+ this.burgundy = burgundy;
+ }
+
+ public String getCarrot()
+ {
+ return carrot;
+ }
+
+ public void setCarrot(String carrot)
+ {
+ this.carrot = carrot;
+ }
+
+ public String getCharcoal()
+ {
+ return charcoal;
+ }
+
+ public void setCharcoal(String charcoal)
+ {
+ this.charcoal = charcoal;
+ }
+
+ public String getCherry()
+ {
+ return cherry;
+ }
+
+ public void setCherry(String cherry)
+ {
+ this.cherry = cherry;
+ }
+
+ public String getChestnut()
+ {
+ return chestnut;
+ }
+
+ public void setChestnut(String chestnut)
+ {
+ this.chestnut = chestnut;
+ }
+
+ public String getChocolate()
+ {
+ return chocolate;
+ }
+
+ public void setChocolate(String chocolate)
+ {
+ this.chocolate = chocolate;
+ }
+
+ public String getChrome()
+ {
+ return chrome;
+ }
+
+ public void setChrome(String chrome)
+ {
+ this.chrome = chrome;
+ }
+
+ public String getCinnamon()
+ {
+ return cinnamon;
+ }
+
+ public void setCinnamon(String cinnamon)
+ {
+ this.cinnamon = cinnamon;
+ }
+
+ public String getCitrine()
+ {
+ return citrine;
+ }
+
+ public void setCitrine(String citrine)
+ {
+ this.citrine = citrine;
+ }
+
+ public String getCobalt()
+ {
+ return cobalt;
+ }
+
+ public void setCobalt(String cobalt)
+ {
+ this.cobalt = cobalt;
+ }
+
+ public String getCopper()
+ {
+ return copper;
+ }
+
+ public void setCopper(String copper)
+ {
+ this.copper = copper;
+ }
+
+ public String getCoral()
+ {
+ return coral;
+ }
+
+ public void setCoral(String coral)
+ {
+ this.coral = coral;
+ }
+
+ public String getCornflower()
+ {
+ return cornflower;
+ }
+
+ public void setCornflower(String cornflower)
+ {
+ this.cornflower = cornflower;
+ }
+
+ public String getCotton()
+ {
+ return cotton;
+ }
+
+ public void setCotton(String cotton)
+ {
+ this.cotton = cotton;
+ }
+
+ public String getCream()
+ {
+ return cream;
+ }
+
+ public void setCream(String cream)
+ {
+ this.cream = cream;
+ }
+
+ public String getCrimson()
+ {
+ return crimson;
+ }
+
+ public void setCrimson(String crimson)
+ {
+ this.crimson = crimson;
+ }
+
+ public String getCyan()
+ {
+ return cyan;
+ }
+
+ public void setCyan(String cyan)
+ {
+ this.cyan = cyan;
+ }
+
+ public String getEbony()
+ {
+ return ebony;
+ }
+
+ public void setEbony(String ebony)
+ {
+ this.ebony = ebony;
+ }
+
+ public String getEmerald()
+ {
+ return emerald;
+ }
+
+ public void setEmerald(String emerald)
+ {
+ this.emerald = emerald;
+ }
+
+ public String getForest()
+ {
+ return forest;
+ }
+
+ public void setForest(String forest)
+ {
+ this.forest = forest;
+ }
+
+ public String getFuchsia()
+ {
+ return fuchsia;
+ }
+
+ public void setFuchsia(String fuchsia)
+ {
+ this.fuchsia = fuchsia;
+ }
+
+ public String getGinger()
+ {
+ return ginger;
+ }
+
+ public void setGinger(String ginger)
+ {
+ this.ginger = ginger;
+ }
+
+ public String getGold()
+ {
+ return gold;
+ }
+
+ public void setGold(String gold)
+ {
+ this.gold = gold;
+ }
+
+ public String getGoldenrod()
+ {
+ return goldenrod;
+ }
+
+ public void setGoldenrod(String goldenrod)
+ {
+ this.goldenrod = goldenrod;
+ }
+
+ public String getGray()
+ {
+ return gray;
+ }
+
+ public void setGray(String gray)
+ {
+ this.gray = gray;
+ }
+
+ public String getGreen()
+ {
+ return green;
+ }
+
+ public void setGreen(String green)
+ {
+ this.green = green;
+ }
+
+ public String getGrey()
+ {
+ return grey;
+ }
+
+ public void setGrey(String grey)
+ {
+ this.grey = grey;
+ }
+
+ public String getIndigo()
+ {
+ return indigo;
+ }
+
+ public void setIndigo(String indigo)
+ {
+ this.indigo = indigo;
+ }
+
+ public String getIvory()
+ {
+ return ivory;
+ }
+
+ public void setIvory(String ivory)
+ {
+ this.ivory = ivory;
+ }
+
+ public String getJade()
+ {
+ return jade;
+ }
+
+ public void setJade(String jade)
+ {
+ this.jade = jade;
+ }
+
+ public String getJasmine()
+ {
+ return jasmine;
+ }
+
+ public void setJasmine(String jasmine)
+ {
+ this.jasmine = jasmine;
+ }
+
+ public String getKhaki()
+ {
+ return khaki;
+ }
+
+ public void setKhaki(String khaki)
+ {
+ this.khaki = khaki;
+ }
+
+ public String getLava()
+ {
+ return lava;
+ }
+
+ public void setLava(String lava)
+ {
+ this.lava = lava;
+ }
+
+ public String getLavender()
+ {
+ return lavender;
+ }
+
+ public void setLavender(String lavender)
+ {
+ this.lavender = lavender;
+ }
+
+ public String getLemon()
+ {
+ return lemon;
+ }
+
+ public void setLemon(String lemon)
+ {
+ this.lemon = lemon;
+ }
+
+ public String getLilac()
+ {
+ return lilac;
+ }
+
+ public void setLilac(String lilac)
+ {
+ this.lilac = lilac;
+ }
+
+ public String getLime()
+ {
+ return lime;
+ }
+
+ public void setLime(String lime)
+ {
+ this.lime = lime;
+ }
+
+ public String getMacaroni()
+ {
+ return macaroni;
+ }
+
+ public void setMacaroni(String macaroni)
+ {
+ this.macaroni = macaroni;
+ }
+
+ public String getMagenta()
+ {
+ return magenta;
+ }
+
+ public void setMagenta(String magenta)
+ {
+ this.magenta = magenta;
+ }
+
+ public String getMagnolia()
+ {
+ return magnolia;
+ }
+
+ public void setMagnolia(String magnolia)
+ {
+ this.magnolia = magnolia;
+ }
+
+ public String getMahogany()
+ {
+ return mahogany;
+ }
+
+ public void setMahogany(String mahogany)
+ {
+ this.mahogany = mahogany;
+ }
+
+ public String getMalachite()
+ {
+ return malachite;
+ }
+
+ public void setMalachite(String malachite)
+ {
+ this.malachite = malachite;
+ }
+
+ public String getMango()
+ {
+ return mango;
+ }
+
+ public void setMango(String mango)
+ {
+ this.mango = mango;
+ }
+
+ public String getMaroon()
+ {
+ return maroon;
+ }
+
+ public void setMaroon(String maroon)
+ {
+ this.maroon = maroon;
+ }
+
+ public String getMauve()
+ {
+ return mauve;
+ }
+
+ public void setMauve(String mauve)
+ {
+ this.mauve = mauve;
+ }
+
+ public String getMint()
+ {
+ return mint;
+ }
+
+ public void setMint(String mint)
+ {
+ this.mint = mint;
+ }
+
+ public String getMoonstone()
+ {
+ return moonstone;
+ }
+
+ public void setMoonstone(String moonstone)
+ {
+ this.moonstone = moonstone;
+ }
+
+ public String getNavy()
+ {
+ return navy;
+ }
+
+ public void setNavy(String navy)
+ {
+ this.navy = navy;
+ }
+
+ public String getOcean()
+ {
+ return ocean;
+ }
+
+ public void setOcean(String ocean)
+ {
+ this.ocean = ocean;
+ }
+
+ public String getOlive()
+ {
+ return olive;
+ }
+
+ public void setOlive(String olive)
+ {
+ this.olive = olive;
+ }
+
+ public String getOnyx()
+ {
+ return onyx;
+ }
+
+ public void setOnyx(String onyx)
+ {
+ this.onyx = onyx;
+ }
+
+ public String getOrange()
+ {
+ return orange;
+ }
+
+ public void setOrange(String orange)
+ {
+ this.orange = orange;
+ }
+
+ public String getOrchid()
+ {
+ return orchid;
+ }
+
+ public void setOrchid(String orchid)
+ {
+ this.orchid = orchid;
+ }
+
+ public String getPapaya()
+ {
+ return papaya;
+ }
+
+ public void setPapaya(String papaya)
+ {
+ this.papaya = papaya;
+ }
+
+ public String getPeach()
+ {
+ return peach;
+ }
+
+ public void setPeach(String peach)
+ {
+ this.peach = peach;
+ }
+
+ public String getPear()
+ {
+ return pear;
+ }
+
+ public void setPear(String pear)
+ {
+ this.pear = pear;
+ }
+
+ public String getPearl()
+ {
+ return pearl;
+ }
+
+ public void setPearl(String pearl)
+ {
+ this.pearl = pearl;
+ }
+
+ public String getPeriwinkle()
+ {
+ return periwinkle;
+ }
+
+ public void setPeriwinkle(String periwinkle)
+ {
+ this.periwinkle = periwinkle;
+ }
+
+ public String getPine()
+ {
+ return pine;
+ }
+
+ public void setPine(String pine)
+ {
+ this.pine = pine;
+ }
+
+ public String getPink()
+ {
+ return pink;
+ }
+
+ public void setPink(String pink)
+ {
+ this.pink = pink;
+ }
+
+ public String getPistachio()
+ {
+ return pistachio;
+ }
+
+ public void setPistachio(String pistachio)
+ {
+ this.pistachio = pistachio;
+ }
+
+ public String getPlatinum()
+ {
+ return platinum;
+ }
+
+ public void setPlatinum(String platinum)
+ {
+ this.platinum = platinum;
+ }
+
+ public String getPlum()
+ {
+ return plum;
+ }
+
+ public void setPlum(String plum)
+ {
+ this.plum = plum;
+ }
+
+ public String getPrune()
+ {
+ return prune;
+ }
+
+ public void setPrune(String prune)
+ {
+ this.prune = prune;
+ }
+
+ public String getPumpkin()
+ {
+ return pumpkin;
+ }
+
+ public void setPumpkin(String pumpkin)
+ {
+ this.pumpkin = pumpkin;
+ }
+
+ public String getPurple()
+ {
+ return purple;
+ }
+
+ public void setPurple(String purple)
+ {
+ this.purple = purple;
+ }
+
+ public String getQuartz()
+ {
+ return quartz;
+ }
+
+ public void setQuartz(String quartz)
+ {
+ this.quartz = quartz;
+ }
+
+ public String getRaspberry()
+ {
+ return raspberry;
+ }
+
+ public void setRaspberry(String raspberry)
+ {
+ this.raspberry = raspberry;
+ }
+
+ public String getRed()
+ {
+ return red;
+ }
+
+ public void setRed(String red)
+ {
+ this.red = red;
+ }
+
+ public String getRose()
+ {
+ return rose;
+ }
+
+ public void setRose(String rose)
+ {
+ this.rose = rose;
+ }
+
+ public String getRosewood()
+ {
+ return rosewood;
+ }
+
+ public void setRosewood(String rosewood)
+ {
+ this.rosewood = rosewood;
+ }
+
+ public String getRuby()
+ {
+ return ruby;
+ }
+
+ public void setRuby(String ruby)
+ {
+ this.ruby = ruby;
+ }
+
+ public String getSalmon()
+ {
+ return salmon;
+ }
+
+ public void setSalmon(String salmon)
+ {
+ this.salmon = salmon;
+ }
+
+ public String getSapphire()
+ {
+ return sapphire;
+ }
+
+ public void setSapphire(String sapphire)
+ {
+ this.sapphire = sapphire;
+ }
+
+ public String getScarlet()
+ {
+ return scarlet;
+ }
+
+ public void setScarlet(String scarlet)
+ {
+ this.scarlet = scarlet;
+ }
+
+ public String getSienna()
+ {
+ return sienna;
+ }
+
+ public void setSienna(String sienna)
+ {
+ this.sienna = sienna;
+ }
+
+ public String getSilver()
+ {
+ return silver;
+ }
+
+ public void setSilver(String silver)
+ {
+ this.silver = silver;
+ }
+
+ public String getSlate()
+ {
+ return slate;
+ }
+
+ public void setSlate(String slate)
+ {
+ this.slate = slate;
+ }
+
+ public String getStrawberry()
+ {
+ return strawberry;
+ }
+
+ public void setStrawberry(String strawberry)
+ {
+ this.strawberry = strawberry;
+ }
+
+ public String getTan()
+ {
+ return tan;
+ }
+
+ public void setTan(String tan)
+ {
+ this.tan = tan;
+ }
+
+ public String getTangerine()
+ {
+ return tangerine;
+ }
+
+ public void setTangerine(String tangerine)
+ {
+ this.tangerine = tangerine;
+ }
+
+ public String getTaupe()
+ {
+ return taupe;
+ }
+
+ public void setTaupe(String taupe)
+ {
+ this.taupe = taupe;
+ }
+
+ public String getTeal()
+ {
+ return teal;
+ }
+
+ public void setTeal(String teal)
+ {
+ this.teal = teal;
+ }
+
+ public String getTitanium()
+ {
+ return titanium;
+ }
+
+ public void setTitanium(String titanium)
+ {
+ this.titanium = titanium;
+ }
+
+ public String getTopaz()
+ {
+ return topaz;
+ }
+
+ public void setTopaz(String topaz)
+ {
+ this.topaz = topaz;
+ }
+
+ public String getTurquoise()
+ {
+ return turquoise;
+ }
+
+ public void setTurquoise(String turquoise)
+ {
+ this.turquoise = turquoise;
+ }
+
+ public String getUmber()
+ {
+ return umber;
+ }
+
+ public void setUmber(String umber)
+ {
+ this.umber = umber;
+ }
+
+ public String getVanilla()
+ {
+ return vanilla;
+ }
+
+ public void setVanilla(String vanilla)
+ {
+ this.vanilla = vanilla;
+ }
+
+ public String getViolet()
+ {
+ return violet;
+ }
+
+ public void setViolet(String violet)
+ {
+ this.violet = violet;
+ }
+
+ public String getWatermelon()
+ {
+ return watermelon;
+ }
+
+ public void setWatermelon(String watermelon)
+ {
+ this.watermelon = watermelon;
+ }
+
+ public String getWhite()
+ {
+ return white;
+ }
+
+ public void setWhite(String white)
+ {
+ this.white = white;
+ }
+
+ public String getYellow()
+ {
+ return yellow;
+ }
+
+ public void setYellow(String yellow)
+ {
+ this.yellow = yellow;
+ }
+ }
+}
+
+
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java
new file mode 100644
index 0000000..3ce9f55
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java
@@ -0,0 +1,552 @@
+/*
+ * 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.webbeans.test;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Modifier;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Logger;
+
+import javax.decorator.Decorator;
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.interceptor.Interceptor;
+
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.component.BeanAttributesImpl;
+import org.apache.webbeans.component.CdiInterceptorBean;
+import org.apache.webbeans.component.DecoratorBean;
+import org.apache.webbeans.component.InjectionTargetBean;
+import org.apache.webbeans.component.ManagedBean;
+import org.apache.webbeans.component.ProducerFieldBean;
+import org.apache.webbeans.component.ProducerMethodBean;
+import org.apache.webbeans.component.WebBeansType;
+import org.apache.webbeans.component.creation.BeanAttributesBuilder;
+import org.apache.webbeans.component.creation.CdiInterceptorBeanBuilder;
+import org.apache.webbeans.component.creation.DecoratorBeanBuilder;
+import org.apache.webbeans.component.creation.ManagedBeanBuilder;
+import org.apache.webbeans.component.creation.ObserverMethodsBuilder;
+import org.apache.webbeans.component.creation.ProducerFieldBeansBuilder;
+import org.apache.webbeans.component.creation.ProducerMethodBeansBuilder;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.context.DependentContext;
+import org.apache.webbeans.deployment.StereoTypeModel;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.portable.AbstractProducer;
+import org.apache.webbeans.portable.events.generics.GProcessAnnotatedType;
+import org.apache.webbeans.test.component.decorator.broken.DelegateAttributeIsnotInterface;
+import org.apache.webbeans.test.component.decorator.broken.DelegateAttributeMustImplementAllDecoratedTypes;
+import org.apache.webbeans.test.component.decorator.broken.MoreThanOneDelegateAttribute;
+import org.apache.webbeans.test.component.decorator.broken.PaymentDecorator;
+import org.apache.webbeans.test.component.decorator.clean.LargeTransactionDecorator;
+import org.apache.webbeans.test.component.decorator.clean.ServiceDecorator;
+import org.apache.webbeans.test.component.intercept.webbeans.ActionInterceptor;
+import org.apache.webbeans.test.component.intercept.webbeans.TransactionalInterceptor2;
+import org.apache.webbeans.test.containertests.ComponentResolutionByTypeTest;
+import org.apache.webbeans.test.mock.MockManager;
+import org.apache.webbeans.test.servlet.ITestContext;
+import org.apache.webbeans.test.servlet.TestListener;
+import org.apache.webbeans.test.sterotype.StereoWithNonScope;
+import org.apache.webbeans.test.sterotype.StereoWithRequestScope;
+import org.apache.webbeans.test.sterotype.StereoWithSessionScope;
+import org.apache.webbeans.test.sterotype.StereoWithSessionScope2;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.xml.WebBeansXMLConfigurator;
+
+/**
+ * Superclass of all the unit test classes. It defines some methods for
+ * subclasses and also do some initializtions for running the tests succesfully.
+ *
+ * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
+ * @since 1.0
+ * @deprecated
+ * Please do not use this class anymore while writing tests. Instead
+ * use {@link AbstractUnitTest} class. Also do not add new tests into
+ * the package org.apache.webbeans.test folder. Add your new tests into
+ * the org.apache.webbeans.newtests folder.
+ *
+ */
+public abstract class TestContext implements ITestContext
+{
+ private Logger logger = WebBeansLoggerFacade.getLogger(TestContext.class);
+
+ /**
+ * All unit test classes. It is defined for starting the tests from the
+ * ServletContextListener methods
+ */
+ private static Set<ITestContext> testContexts = new HashSet<ITestContext>();
+
+ /** Test class name */
+ private String clazzName;
+
+ /** MockManager is the mock implementation of the {@link BeanManager} */
+ private MockManager manager;
+
+ /** Use for XML tests */
+ protected WebBeansXMLConfigurator xmlConfigurator = null;
+
+ private WebBeansContext webBeansContext;
+
+ /**
+ * Creates new test class.
+ *
+ * @param clazzName class name of the test class
+ */
+ protected TestContext(String clazzName)
+ {
+ this.clazzName = clazzName;
+ TestContext.testContexts.add(this);
+ this.manager = new MockManager();
+ this.xmlConfigurator = new WebBeansXMLConfigurator();
+ this.webBeansContext = WebBeansContext.getInstance();
+ webBeansContext.getPluginLoader().startUp();
+ }
+
+
+ /**
+ * Initialize the tests. NOTE : Actually this has to be defined for each
+ * test classes. But for the time being, this super-class globally defines
+ * some deployment types, interceptor types, decorator types and
+ * stereotypes. If you would like to override default initialization,
+ * override these methods in your test classes.
+ */
+ @Override
+ public void init()
+ {
+ manager.clear();
+ WebBeansContext.getInstance().getPluginLoader().startUp();
+
+ initInterceptors();
+ initDecorators();
+ initStereoTypes();
+ initDependentContext();
+ }
+
+ protected void initDependentContext()
+ {
+ DependentContext dependentContext = (DependentContext) WebBeansContext.getInstance().getContextFactory().getStandardContext(Dependent.class);
+ dependentContext.setActive(true);
+ }
+
+ /**
+ * Initialize some predefined interceptors.
+ */
+ protected void initInterceptors()
+ {
+ initializeInterceptorType(TransactionalInterceptor2.class);
+ initializeInterceptorType(ActionInterceptor.class);
+
+ }
+
+ /**
+ * Initialize some predefined decorators.
+ */
+ protected void initDecorators()
+ {
+ initializeDecoratorType(DelegateAttributeIsnotInterface.class);
+ initializeDecoratorType(MoreThanOneDelegateAttribute.class);
+ initializeDecoratorType(PaymentDecorator.class);
+ initializeDecoratorType(DelegateAttributeMustImplementAllDecoratedTypes.class);
+ initializeDecoratorType(ServiceDecorator.class);
+ initializeDecoratorType(LargeTransactionDecorator.class);
+
+ }
+
+ /**
+ * Initialize some predefined stereotypes.
+ */
+ protected void initStereoTypes()
+ {
+ initDefaultStereoTypes();
+ initializeStereoType(StereoWithNonScope.class);
+ initializeStereoType(StereoWithRequestScope.class);
+ initializeStereoType(StereoWithSessionScope.class);
+ initializeStereoType(StereoWithSessionScope2.class);
+
+ }
+
+ /**
+ * Default stereo types
+ */
+ protected void initDefaultStereoTypes()
+ {
+ initializeStereoType(Interceptor.class);
+ initializeStereoType(Decorator.class);
+ }
+
+
+ /**
+ * This will be called whenever the test is failed. NOT : This method is
+ * used for running the tests from the ServletContextListener. It is
+ * not used for normal unit tests.
+ *
+ * @see TestListener
+ * @see ComponentResolutionByTypeTest
+ * @param methodName failed method name
+ */
+ public void fail(String methodName)
+ {
+ logger.severe("Test Class: " + clazzName + ",Method Name: " + methodName + " is FAILED");
+ }
+
+ /**
+ * Initialize all tests. NOT : This method is used for initializing the all
+ * tests classes from the ServletContextListener. It is not used for
+ * normal unit tests.
+ *
+ * @see TestListener
+ * @see ComponentResolutionByTypeTest
+ */
+ public static void initTests()
+ {
+ Iterator<ITestContext> it = testContexts.iterator();
+ while (it.hasNext())
+ {
+ it.next().init();
+ }
+
+ }
+
+ /**
+ * Start all tests. NOT : This method is used for starting the all tests
+ * classes from the ServletContextListener. It is not used for
+ * normal unit tests.
+ *
+ * @see TestListener
+ * @see ComponentResolutionByTypeTest
+ */
+ public static void startAllTests(Object object)
+ {
+ Iterator<ITestContext> it = testContexts.iterator();
+ while (it.hasNext())
+ {
+ it.next().startTests(object);
+ }
+
+ }
+
+ /**
+ * Ending all tests. NOT : This method is used for ending the all tests
+ * classes from the ServletContextListener. It is not used for
+ * normal unit tests.
+ *
+ * @see TestListener
+ * @see ComponentResolutionByTypeTest
+ */
+ public static void endAllTests(Object object)
+ {
+ Iterator<ITestContext> it = testContexts.iterator();
+ while (it.hasNext())
+ {
+ it.next().endTests(object);
+ }
+
+ }
+
+ /**
+ * Defines simple webbeans from the given class.
+ *
+ * @param clazz simple webbeans class
+ * @return simple webbean
+ */
+ protected <T> InjectionTargetBean<T> defineManagedBean(Class<T> clazz)
+ {
+ ManagedBean<T> bean;
+
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ bean = define(clazz, WebBeansType.MANAGED, webBeansContext.getAnnotatedElementFactory().newAnnotatedType(clazz));
+ if (bean != null)
+ {
+ if (bean.getProducer() instanceof AbstractProducer)
+ {
+ AbstractProducer<T> producer = (AbstractProducer<T>)bean.getProducer();
+ producer.defineInterceptorStack(bean, bean.getAnnotatedType(), webBeansContext);
+ }
+
+ getComponents().add((AbstractOwbBean<?>) bean);
+ manager.addBean(bean);
+
+ GProcessAnnotatedType type = new GProcessAnnotatedType(webBeansContext.getAnnotatedElementFactory().newAnnotatedType(clazz));
+ manager.fireEvent(type, new Annotation[0]);
+ }
+
+ return bean;
+ }
+
+ /**
+ * Defines simple webbeans interceptor.
+ *
+ * @param clazz interceptor class
+ * @return the new interceptor
+ */
+ @SuppressWarnings("unchecked")
+ protected <T> AbstractOwbBean<T> defineInterceptor(Class<T> clazz)
+ {
+ ManagedBean<T> component = null;
+
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ webBeansContext.getWebBeansUtil().checkManagedBeanCondition(clazz);
+
+ webBeansContext.getInterceptorsManager().addEnabledInterceptorClass(clazz);
+ AnnotatedType<T> annotatedType = webBeansContext.getAnnotatedElementFactory().newAnnotatedType(clazz);
+ BeanAttributesImpl<T> beanAttributes = BeanAttributesBuilder.forContext(getWebBeansContext()).newBeanAttibutes(annotatedType).build();
+ CdiInterceptorBeanBuilder<T> ibb = new CdiInterceptorBeanBuilder<T>(webBeansContext, annotatedType, beanAttributes);
+ ibb.defineCdiInterceptorRules();
+ CdiInterceptorBean<T> bean = ibb.getBean();
+ webBeansContext.getInterceptorsManager().addCdiInterceptor(bean);
+ return bean;
+ }
+
+ /**
+ * Defines the simple webbeans decorator.
+ *
+ * @param clazz decorator class
+ * @return the new decorator
+ */
+ protected <T> AbstractOwbBean<T> defineDecorator(Class<T> clazz)
+ {
+
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ if (webBeansContext.getDecoratorsManager().isDecoratorEnabled(clazz))
+ {
+ AnnotatedType<T> annotatedType = webBeansContext.getBeanManagerImpl().createAnnotatedType(clazz);
+ BeanAttributesImpl<T> beanAttributes = BeanAttributesBuilder.forContext(webBeansContext).newBeanAttibutes(annotatedType).build();
+ DecoratorBeanBuilder<T> dbb = new DecoratorBeanBuilder<T>(webBeansContext, annotatedType, beanAttributes);
+ dbb.defineDecoratorRules();
+
+ DecoratorBean<T> bean = dbb.getBean();
+ webBeansContext.getDecoratorsManager().addDecorator(bean);
+ return bean;
+ }
+
+ return null;
+ }
+
+ /**
+ * Clear all components in the {@link MockManager}
+ */
+ protected void clear()
+ {
+ this.manager.clear();
+ WebBeansContext.getInstance().getPluginLoader().startUp();
+ }
+
+ /**
+ * Gets all components in the {@link MockManager}
+ *
+ * @return all components
+ */
+ protected List<AbstractOwbBean<?>> getComponents()
+ {
+ return manager.getComponents();
+ }
+
+ /**
+ * Return the size of the webbeans in the {@link MockManager}
+ *
+ * @return the size of the components in the {@link MockManager}
+ */
+ protected int getDeployedComponents()
+ {
+ return manager.getDeployedCompnents();
+ }
+
+ /**
+ * Gets the webbeans instance.
+ *
+ * @param name name of the webbean
+ * @return the webbeans instance
+ */
+ protected Object getInstanceByName(String name)
+ {
+ Bean<?> bean = manager.resolve(manager.getBeans(name));
+ if (bean == null)
+ {
+ return null;
+ }
+
+ return manager.getReference(bean, Object.class, manager.createCreationalContext(bean));
+ }
+
+ /**
+ * Gets the context with given scope type.
+ *
+ * @param scopeType scope type
+ * @return the context with given scope type
+ */
+ protected Context getContext(Class<? extends Annotation> scopeType)
+ {
+ return manager.getContext(scopeType);
+ }
+
+ /**
+ * Gets the {@link MockManager} instance.
+ *
+ * @return manager instance
+ */
+ protected MockManager getManager()
+ {
+ return manager;
+ }
+
+ protected WebBeansContext getWebBeansContext()
+ {
+ return webBeansContext;
+ }
+
+ /**
+ * Return new MockHttpSession
+ *
+ * @return new mock session
+ */
+ protected Object getSession()
+ {
+ //X TODO huh? WTF...
+ return new Object();
+ }
+
+ /**
+ * Add new stereotype model.
+ *
+ * @param stereoClass stereotype class
+ */
+ protected void initializeStereoType(Class<? extends Annotation> stereoClass)
+ {
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ webBeansContext.getAnnotationManager().checkStereoTypeClass(stereoClass, stereoClass.getDeclaredAnnotations());
+ StereoTypeModel model = new StereoTypeModel(webBeansContext, stereoClass);
+ webBeansContext.getStereoTypeManager().addStereoTypeModel(model);
+ }
+
+ /**
+ * Add new interceptor class.
+ *
+ * @param interceptorClazz interceptor class
+ */
+ protected void initializeInterceptorType(Class<?> interceptorClazz)
+ {
+ WebBeansContext.getInstance().getInterceptorsManager().addEnabledInterceptorClass(interceptorClazz);
+
+ }
+
+ /**
+ * Add new deocrator class.
+ *
+ * @param decoratorClazz decorator class
+ */
+ protected void initializeDecoratorType(Class<?> decoratorClazz)
+ {
+ WebBeansContext.getInstance().getDecoratorsManager().addEnabledDecorator(decoratorClazz);
+
+ }
+
+ /**
+ * End tests for sub-class. NOTE : This method is used for ending the all
+ * test methods in sub-class from the ServletContextListener. It is
+ * not used for normal unit tests.
+ *
+ * @see TestListener
+ * @see ComponentResolutionByTypeTest
+ */
+ @Override
+ public void endTests(Object ctx)
+ {
+
+ }
+
+ /**
+ * Start tests for sub-class. NOTE : This method is used for starting the all
+ * test methods in sub-class from the ServletContextListener. It is
+ * not used for normal unit tests.
+ *
+ * @see TestListener
+ * @see ComponentResolutionByTypeTest
+ */
+ @Override
+ public void startTests(Object ctx)
+ {
+ }
+
+ /**
+ * Returns the newly created Simple WebBean Component.
+ *
+ * @param clazz Simple WebBean Component implementation class
+ * @return the newly created Simple WebBean Component
+ * @throws WebBeansConfigurationException if any configuration exception occurs
+ */
+ private <T> ManagedBean<T> define(Class<T> clazz, WebBeansType type, AnnotatedType<T> annotatedType) throws WebBeansConfigurationException
+ {
+ WebBeansContext webBeansContext = WebBeansContext.currentInstance();
+ BeanManagerImpl manager = webBeansContext.getBeanManagerImpl();
+
+ int modifier = clazz.getModifiers();
+
+ if (AnnotationUtil.hasClassAnnotation(clazz, Decorator.class) && AnnotationUtil.hasClassAnnotation(clazz, Interceptor.class))
+ {
+ throw new WebBeansConfigurationException("ManagedBean implementation class : " + clazz.getName()
+ + " may not annotated with both @Interceptor and @Decorator annotation");
+ }
+
+ if (!AnnotationUtil.hasClassAnnotation(clazz, Decorator.class) && !AnnotationUtil.hasClassAnnotation(clazz, Interceptor.class))
+ {
+ webBeansContext.getInterceptorUtil().checkSimpleWebBeansInterceptorConditions(clazz);
+ }
+
+ if (Modifier.isInterface(modifier))
+ {
+ throw new WebBeansConfigurationException("ManagedBean implementation class : " + clazz.getName() + " may not _defined as interface");
+ }
+
+ BeanAttributesImpl<T> beanAttributes = BeanAttributesBuilder.forContext(getWebBeansContext()).newBeanAttibutes(annotatedType).build();
+ ManagedBeanBuilder<T, ManagedBean<T>> managedBeanCreator = new ManagedBeanBuilder<T, ManagedBean<T>>(webBeansContext, annotatedType, beanAttributes);
+ ManagedBean<T> component = managedBeanCreator.getBean();
+
+ webBeansContext.getWebBeansUtil().setInjectionTargetBeanEnableFlag(component);
+
+ //Dropped from the speicification
+ //WebBeansUtil.checkSteroTypeRequirements(component, clazz.getDeclaredAnnotations(), "Simple WebBean Component implementation class : " + clazz.getName());
+
+ Set<ProducerMethodBean<?>> producerMethods = new ProducerMethodBeansBuilder(component.getWebBeansContext(), component.getAnnotatedType()).defineProducerMethods(component);
+ for (ProducerMethodBean<?> producerMethod : producerMethods)
+ {
+ // add them one after the other to enable serialization handling et al
+ manager.addBean(producerMethod);
+ }
+
+ Set<ProducerFieldBean<?>> producerFields = new ProducerFieldBeansBuilder(component.getWebBeansContext(), component.getAnnotatedType()).defineProducerFields(component);
+ for (ProducerFieldBean<?> producerField : producerFields)
+ {
+ // add them one after the other to enable serialization handling et al
+ manager.addBean(producerField);
+ }
+
+ new ObserverMethodsBuilder<T, InjectionTargetBean<T>>(webBeansContext, component.getAnnotatedType()).defineObserverMethods(component);
+
+ return component;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/AnnotationWithArrayOfBooleanMember.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/AnnotationWithArrayOfBooleanMember.java
new file mode 100644
index 0000000..5a748e6
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/AnnotationWithArrayOfBooleanMember.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.test.annotation.binding;
+
+import javax.inject.Qualifier;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Qualifier
+@Target( { ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface AnnotationWithArrayOfBooleanMember
+{
+ boolean[] value();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/AnnotationWithArrayOfIntMember.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/AnnotationWithArrayOfIntMember.java
new file mode 100644
index 0000000..100df78
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/AnnotationWithArrayOfIntMember.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.test.annotation.binding;
+
+import javax.inject.Qualifier;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Qualifier
+@Target( { ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface AnnotationWithArrayOfIntMember
+{
+ int[] value();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/AnnotationWithArrayOfStringMember.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/AnnotationWithArrayOfStringMember.java
new file mode 100644
index 0000000..a9f22d4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/AnnotationWithArrayOfStringMember.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.test.annotation.binding;
+
+import javax.inject.Qualifier;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Qualifier
+@Target( { ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface AnnotationWithArrayOfStringMember
+{
+ String[] value();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/AnnotationWithBindingMember.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/AnnotationWithBindingMember.java
new file mode 100644
index 0000000..a6bc262
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/AnnotationWithBindingMember.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.test.annotation.binding;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Target( { ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface AnnotationWithBindingMember {
+
+ String value() default "";
+
+ int number() default 0;
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/AnnotationWithNonBindingMember.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/AnnotationWithNonBindingMember.java
new file mode 100644
index 0000000..dc1da25
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/AnnotationWithNonBindingMember.java
@@ -0,0 +1,41 @@
+/*
+ * 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.webbeans.test.annotation.binding;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.enterprise.util.Nonbinding;
+import javax.inject.Qualifier;
+
+@Qualifier
+@Target( { ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface AnnotationWithNonBindingMember {
+
+ String value() default "";
+
+ @Nonbinding
+ String arg1();
+
+ @Nonbinding
+ String arg2();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Asynchronous.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Asynchronous.java
new file mode 100644
index 0000000..dd57d8d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Asynchronous.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.annotation.binding;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface Asynchronous {
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/BeanCacheKeyUnitTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/BeanCacheKeyUnitTest.java
new file mode 100644
index 0000000..d748e9e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/BeanCacheKeyUnitTest.java
@@ -0,0 +1,300 @@
+/*
+ * 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.webbeans.test.annotation.binding;
+
+import org.apache.webbeans.container.BeanCacheKey;
+import org.apache.webbeans.test.annotation.binding.AnnotationWithArrayOfBooleanMember;
+import org.apache.webbeans.test.annotation.binding.AnnotationWithArrayOfIntMember;
+import org.apache.webbeans.test.annotation.binding.AnnotationWithArrayOfStringMember;
+import org.apache.webbeans.test.annotation.binding.AnnotationWithBindingMember;
+import org.apache.webbeans.test.annotation.binding.AnnotationWithNonBindingMember;
+import org.apache.webbeans.test.component.BindingComponent;
+import org.apache.webbeans.test.component.NonBindingComponent;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.lang.annotation.Annotation;
+
+public class BeanCacheKeyUnitTest
+{
+
+ @AnnotationWithBindingMember(value = "B", number = 3)
+ public BindingComponent s1;
+ public static Annotation[] a1;
+
+ @AnnotationWithBindingMember(value = "B")
+ public BindingComponent s2;
+ public static Annotation[] a2;
+
+ @AnnotationWithNonBindingMember(value = "B", arg1 = "1", arg2 = "2")
+ public NonBindingComponent s3;
+ public static Annotation[] a3;
+
+ @AnnotationWithNonBindingMember(value = "B", arg1 = "11", arg2 = "21")
+ public NonBindingComponent s4;
+ public static Annotation[] a4;
+
+ @AnnotationWithNonBindingMember(value = "C", arg1 = "11", arg2 = "21")
+ public NonBindingComponent s5;
+ public static Annotation[] a5;
+
+ @AnnotationWithNonBindingMember(arg2 = "any", arg1 = "any", value = "C")
+ public NonBindingComponent s6;
+ public static Annotation[] a6;
+
+ @AnnotationWithArrayOfIntMember({1,2,3})
+ public NonBindingComponent s7;
+ public static Annotation[] a7;
+
+ @AnnotationWithArrayOfIntMember({1,2,4})
+ public NonBindingComponent s8;
+ public static Annotation[] a8;
+
+ @AnnotationWithArrayOfStringMember({"1","2","3"})
+ public NonBindingComponent s9;
+ public static Annotation[] a9;
+
+ @AnnotationWithArrayOfStringMember({"1","2","4"})
+ public NonBindingComponent sa;
+ public static Annotation[] aa;
+
+ @AnnotationWithArrayOfBooleanMember({true, true})
+ public NonBindingComponent sb;
+ public static Annotation[] ab;
+
+ @AnnotationWithArrayOfBooleanMember({true,false})
+ public NonBindingComponent sc;
+ public static Annotation[] ac;
+
+
+ public static Annotation[] a12;
+ public static Annotation[] a21;
+ public static Annotation[] a13;
+ public static Annotation[] a31;
+ public static Annotation[] a56;
+ public static Annotation[] a65;
+ public static Annotation[] a78;
+ public static Annotation[] a9a;
+ public static Annotation[] abc;
+
+ static {
+ try {
+ a1 = BeanCacheKeyUnitTest.class.getDeclaredField("s1").getAnnotations();
+ a2 = BeanCacheKeyUnitTest.class.getDeclaredField("s2").getAnnotations();
+ a3 = BeanCacheKeyUnitTest.class.getDeclaredField("s3").getAnnotations();
+ a4 = BeanCacheKeyUnitTest.class.getDeclaredField("s4").getAnnotations();
+ a5 = BeanCacheKeyUnitTest.class.getDeclaredField("s5").getAnnotations();
+ a6 = BeanCacheKeyUnitTest.class.getDeclaredField("s6").getAnnotations();
+ a7 = BeanCacheKeyUnitTest.class.getDeclaredField("s7").getAnnotations();
+ a8 = BeanCacheKeyUnitTest.class.getDeclaredField("s8").getAnnotations();
+ a9 = BeanCacheKeyUnitTest.class.getDeclaredField("s9").getAnnotations();
+ aa = BeanCacheKeyUnitTest.class.getDeclaredField("sa").getAnnotations();
+ ab = BeanCacheKeyUnitTest.class.getDeclaredField("sb").getAnnotations();
+ ac = BeanCacheKeyUnitTest.class.getDeclaredField("sc").getAnnotations();
+
+ a12 = new Annotation[]{a1[0], a2[0]};
+ a21 = new Annotation[]{a2[0], a1[0]};
+ a13 = new Annotation[]{a1[0], a3[0]};
+ a31 = new Annotation[]{a3[0], a1[0]};
+ a56 = new Annotation[]{a5[0], a6[0]};
+ a65 = new Annotation[]{a6[0], a5[0]};
+ a78 = new Annotation[]{a7[0], a8[0]};
+ a9a = new Annotation[]{a9[0], aa[0]};
+ abc = new Annotation[]{ab[0], ac[0]};
+
+ } catch (NoSuchFieldException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Test
+ public void testEmptyNull()
+ {
+ BeanCacheKey a = new BeanCacheKey(true, String.class, null);
+ BeanCacheKey b = new BeanCacheKey(true, String.class, null);
+ Assert.assertEquals(a, b);
+ Assert.assertEquals(a.hashCode(), b.hashCode());
+ }
+
+ @Test
+ public void testEmptyNullNull()
+ {
+ BeanCacheKey a = new BeanCacheKey(true, String.class, null, null);
+ BeanCacheKey b = new BeanCacheKey(true, String.class, null, null);
+ Assert.assertEquals(a, b);
+ Assert.assertEquals(a.hashCode(), b.hashCode());
+ }
+
+ @Test
+ public void testTypeUnequal()
+ {
+ BeanCacheKey a = new BeanCacheKey(true, String.class, null);
+ BeanCacheKey b = new BeanCacheKey(true, Integer.class, null);
+ Assert.assertFalse(a.equals(b));
+ Assert.assertFalse(a.hashCode() == b.hashCode());
+ }
+
+ @Test
+ public void testPath()
+ {
+ BeanCacheKey a = new BeanCacheKey(true, String.class, "A");
+ BeanCacheKey b = new BeanCacheKey(true, String.class, "A");
+ Assert.assertEquals(a, b);
+ Assert.assertEquals(a.hashCode(), b.hashCode());
+ }
+
+ @Test
+ public void testPathUnequal()
+ {
+ BeanCacheKey a = new BeanCacheKey(true, String.class, "A");
+ BeanCacheKey b = new BeanCacheKey(true, String.class, "B");
+ Assert.assertFalse(a.equals(b));
+ Assert.assertFalse(a.hashCode() == b.hashCode());
+ }
+
+ @Test
+ public void testNonEqualsWithBindingMemberParameter()
+ {
+ BeanCacheKey a = new BeanCacheKey(true, String.class, null, a1);
+ BeanCacheKey b = new BeanCacheKey(true, String.class, null, a2);
+ Assert.assertFalse(a.equals(b));
+ Assert.assertFalse(a.hashCode() == b.hashCode());
+ }
+
+ @Test
+ public void testEqualsWithBindingMember()
+ {
+ BeanCacheKey a = new BeanCacheKey(true, String.class, null, a1);
+ BeanCacheKey b = new BeanCacheKey(true, String.class, null, a1);
+ Assert.assertEquals(a, b);
+ Assert.assertEquals(a.hashCode(), b.hashCode());
+ }
+
+
+ @Test
+ public void testEqualsWithNonBindingMember()
+ {
+ BeanCacheKey a = new BeanCacheKey(true, String.class, null, a3);
+ BeanCacheKey b = new BeanCacheKey(true, String.class, null, a3);
+ Assert.assertEquals(a, b);
+ Assert.assertEquals(a.hashCode(), b.hashCode());
+ }
+
+ @Test
+ public void testEquals2Annotations()
+ {
+ BeanCacheKey a = new BeanCacheKey(true, String.class, null, a12);
+ BeanCacheKey b = new BeanCacheKey(true, String.class, null, a12);
+ Assert.assertEquals(a, b);
+ Assert.assertEquals(a.hashCode(), b.hashCode());
+ }
+
+ @Test
+ public void testEquals2AnnotationsUnorderedName()
+ {
+ BeanCacheKey a = new BeanCacheKey(true, String.class, null, a13);
+ BeanCacheKey b = new BeanCacheKey(true, String.class, null, a31);
+ Assert.assertEquals(a, b);
+ Assert.assertEquals(a.hashCode(), b.hashCode());
+ }
+
+ @Test
+ public void testEquals2AnnotationsUnorderedParam()
+ {
+ BeanCacheKey a = new BeanCacheKey(true, String.class, null, a12);
+ BeanCacheKey b = new BeanCacheKey(true, String.class, null, a21);
+ Assert.assertEquals(a, b);
+ Assert.assertEquals(a.hashCode(), b.hashCode());
+ }
+
+ @Test
+ public void testDiffMembers()
+ {
+ BeanCacheKey a = new BeanCacheKey(true, String.class, null, a4);
+ BeanCacheKey b = new BeanCacheKey(true, String.class, null, a5);
+ Assert.assertFalse(a.equals(b));
+ Assert.assertFalse(a.hashCode() == b.hashCode());
+ }
+
+ @Test
+ public void testOnyDiffMembersInNonBinding()
+ {
+ BeanCacheKey a = new BeanCacheKey(true, String.class, null, a5);
+ BeanCacheKey b = new BeanCacheKey(true, String.class, null, a6);
+ Assert.assertEquals(a, b);
+ Assert.assertEquals(a.hashCode(), b.hashCode());
+ }
+
+ @Test
+ public void testAnnotationOrdering()
+ {
+ BeanCacheKey a = new BeanCacheKey(true, String.class, null, a56);
+ BeanCacheKey b = new BeanCacheKey(true, String.class, null, a65);
+ Assert.assertEquals(a, b);
+ Assert.assertEquals(a.hashCode(), b.hashCode());
+ }
+
+ @Test
+ public void testMemberArraysInt()
+ {
+ BeanCacheKey a = new BeanCacheKey(true, String.class, null, a7);
+ BeanCacheKey b = new BeanCacheKey(true, String.class, null, a8);
+ Assert.assertFalse(a.equals(b));
+ Assert.assertFalse(a.hashCode() == b.hashCode());
+ }
+
+ @Test
+ public void testMemberArraysString()
+ {
+ BeanCacheKey a = new BeanCacheKey(true, String.class, null, a9);
+ BeanCacheKey b = new BeanCacheKey(true, String.class, null, aa);
+ Assert.assertFalse(a.equals(b));
+ Assert.assertFalse(a.hashCode() == b.hashCode());
+ }
+
+ @Test
+ public void testMemberArraysBoolean()
+ {
+ BeanCacheKey a = new BeanCacheKey(true, String.class, null, ab);
+ BeanCacheKey b = new BeanCacheKey(true, String.class, null, ac);
+ Assert.assertFalse(a.equals(b));
+ Assert.assertFalse(a.hashCode() == b.hashCode());
+ }
+
+ @Test
+ public void testDiffArrays()
+ {
+ BeanCacheKey a = new BeanCacheKey(true, String.class, null, a9a);
+ BeanCacheKey b = new BeanCacheKey(true, String.class, null, abc);
+ Assert.assertFalse(a.equals(b));
+ Assert.assertFalse(a.hashCode() == b.hashCode());
+ }
+
+
+ @Test
+ public void testDelegateUnequal()
+ {
+ BeanCacheKey a = new BeanCacheKey(true, String.class, "A");
+ BeanCacheKey b = new BeanCacheKey(false, String.class, "A");
+ Assert.assertFalse(a.equals(b));
+ Assert.assertFalse(a.hashCode() == b.hashCode());
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Binding1.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Binding1.java
new file mode 100644
index 0000000..fa8582a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Binding1.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.annotation.binding;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface Binding1 {
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Binding1Literal.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Binding1Literal.java
new file mode 100644
index 0000000..3d0bd63
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Binding1Literal.java
@@ -0,0 +1,26 @@
+/*
+ * 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.webbeans.test.annotation.binding;
+
+import javax.enterprise.util.AnnotationLiteral;
+
+public class Binding1Literal extends AnnotationLiteral<Binding1> implements Binding1
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Binding2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Binding2.java
new file mode 100644
index 0000000..932f520
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Binding2.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.annotation.binding;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface Binding2 {
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Cash.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Cash.java
new file mode 100644
index 0000000..aa517ee
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Cash.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.annotation.binding;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface Cash {
+ String type();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Check.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Check.java
new file mode 100644
index 0000000..67ee4ce
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Check.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.annotation.binding;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface Check {
+ String type();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/DummyAnnotationLiteral.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/DummyAnnotationLiteral.java
new file mode 100644
index 0000000..8c71b97
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/DummyAnnotationLiteral.java
@@ -0,0 +1,26 @@
+/*
+ * 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.webbeans.test.annotation.binding;
+
+import javax.enterprise.util.AnnotationLiteral;
+
+public class DummyAnnotationLiteral extends AnnotationLiteral<ParameterBinding1> implements ParameterBinding1
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/NonBindingAnnotationType.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/NonBindingAnnotationType.java
new file mode 100644
index 0000000..540b41b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/NonBindingAnnotationType.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.annotation.binding;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.Default;
+import javax.inject.Qualifier;
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface NonBindingAnnotationType {
+ Default currenr();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/NonBindingArrayType.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/NonBindingArrayType.java
new file mode 100644
index 0000000..308f663
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/NonBindingArrayType.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.annotation.binding;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface NonBindingArrayType {
+ int[] array() default {};
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/NotAny.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/NotAny.java
new file mode 100644
index 0000000..69103e0
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/NotAny.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.test.annotation.binding;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface NotAny {
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/NotAnyLiteral.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/NotAnyLiteral.java
new file mode 100644
index 0000000..cf7dd2e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/NotAnyLiteral.java
@@ -0,0 +1,26 @@
+/*
+ * 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.webbeans.test.annotation.binding;
+
+import javax.enterprise.util.AnnotationLiteral;
+
+public class NotAnyLiteral extends AnnotationLiteral<NotAny> implements NotAny
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/ParameterBinding1.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/ParameterBinding1.java
new file mode 100644
index 0000000..af038bf
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/ParameterBinding1.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.annotation.binding;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface ParameterBinding1 {
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/ParameterBinding2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/ParameterBinding2.java
new file mode 100644
index 0000000..40196bb
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/ParameterBinding2.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.annotation.binding;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface ParameterBinding2 {
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/ParameterBinding3.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/ParameterBinding3.java
new file mode 100644
index 0000000..b0e0421
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/ParameterBinding3.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.annotation.binding;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface ParameterBinding3 {
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/PayBy.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/PayBy.java
new file mode 100644
index 0000000..ff07aad
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/PayBy.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.annotation.binding;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface PayBy {
+ String value();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/ProducerBinding1.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/ProducerBinding1.java
new file mode 100644
index 0000000..917eff6
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/ProducerBinding1.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.annotation.binding;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface ProducerBinding1 {
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/ProducerBinding2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/ProducerBinding2.java
new file mode 100644
index 0000000..8c0e108
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/ProducerBinding2.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.annotation.binding;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface ProducerBinding2 {
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Role.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Role.java
new file mode 100644
index 0000000..f6f66a9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Role.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.annotation.binding;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface Role {
+ String value();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Service.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Service.java
new file mode 100644
index 0000000..ddebe88
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Service.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.annotation.binding;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface Service {
+ boolean transactional();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/SingletonBinding.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/SingletonBinding.java
new file mode 100644
index 0000000..6135ba3
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/SingletonBinding.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.annotation.binding;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface SingletonBinding {
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Synchronous.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Synchronous.java
new file mode 100644
index 0000000..3af9908
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Synchronous.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.annotation.binding;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface Synchronous {
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/TestingIfExists.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/TestingIfExists.java
new file mode 100644
index 0000000..4c0a681
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/TestingIfExists.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.test.annotation.binding;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface TestingIfExists {
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/TestingIfNonExists.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/TestingIfNonExists.java
new file mode 100644
index 0000000..0c7453c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/TestingIfNonExists.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.test.annotation.binding;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface TestingIfNonExists {
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/TestingNormal.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/TestingNormal.java
new file mode 100644
index 0000000..ffd180f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/TestingNormal.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.test.annotation.binding;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface TestingNormal {
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Users.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Users.java
new file mode 100644
index 0000000..c710c11
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/annotation/binding/Users.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.annotation.binding;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface Users {
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/BindingComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/BindingComponent.java
new file mode 100644
index 0000000..9f1c63b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/BindingComponent.java
@@ -0,0 +1,31 @@
+/*
+ * 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.webbeans.test.component;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+
+import org.apache.webbeans.test.annotation.binding.AnnotationWithBindingMember;
+
+@AnnotationWithBindingMember(value = "B", number = 3)
+@SessionScoped
+public class BindingComponent implements Serializable
+{
+}
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/CheckWithCheckPayment.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/CheckWithCheckPayment.java
new file mode 100644
index 0000000..25fae63
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/CheckWithCheckPayment.java
@@ -0,0 +1,48 @@
+/*
+ * 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.webbeans.test.component;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Named;
+
+import org.apache.webbeans.test.annotation.binding.Check;
+
+@RequestScoped
+@Check(type = "CHECK")
+@Named
+public class CheckWithCheckPayment implements IPayment
+{
+ private boolean value = false;
+
+ @Override
+ public String pay()
+ {
+ return "CHECK";
+ }
+
+ public boolean getValue()
+ {
+ return this.value;
+ }
+
+ public void setValue(boolean value)
+ {
+ this.value = value;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/CheckWithCheckPaymentDecoratorField.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/CheckWithCheckPaymentDecoratorField.java
new file mode 100644
index 0000000..29c0f3d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/CheckWithCheckPaymentDecoratorField.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.component;
+
+import javax.enterprise.context.RequestScoped;
+
+import org.apache.webbeans.test.annotation.binding.Check;
+
+@RequestScoped
+@Check(type = "CHECK")
+public class CheckWithCheckPaymentDecoratorField implements IPayment
+{
+
+ @Override
+ public String pay()
+ {
+ return "CHECK";
+ }
+
+ public final void decoratorMethod()
+ {
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/CheckWithMoneyPayment.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/CheckWithMoneyPayment.java
new file mode 100644
index 0000000..7cf8549
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/CheckWithMoneyPayment.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.component;
+
+import javax.enterprise.context.RequestScoped;
+
+import org.apache.webbeans.test.annotation.binding.Check;
+
+@RequestScoped
+@Check(type = "MONEY")
+public class CheckWithMoneyPayment implements IPayment
+{
+ @Override
+ public String pay()
+ {
+ return "MONEY";
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/ContainUserComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/ContainUserComponent.java
new file mode 100644
index 0000000..7044de6
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/ContainUserComponent.java
@@ -0,0 +1,45 @@
+/*
+ * 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.webbeans.test.component;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Default;
+import javax.inject.Inject;
+
+
+@RequestScoped
+public class ContainUserComponent
+{
+ @Inject @Default UserComponent user;
+
+ public String echo()
+ {
+ if (user != null)
+ {
+ System.out.println("Name : " + user.getName() + ", Surname : " + user.getSurname());
+ return user.getName() + " " + user.getSurname();
+ }
+
+ else
+ {
+ return null;
+ }
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/ContaintsCurrentComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/ContaintsCurrentComponent.java
new file mode 100644
index 0000000..baa3488
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/ContaintsCurrentComponent.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.test.component;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Default;
+import javax.inject.Inject;
+
+
+@RequestScoped
+public class ContaintsCurrentComponent
+{
+ @Inject @Default CurrentBindingComponent comp;
+
+ public CurrentBindingComponent getInstance()
+ {
+ return this.comp;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/CurrentBindingComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/CurrentBindingComponent.java
new file mode 100644
index 0000000..1f67e65
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/CurrentBindingComponent.java
@@ -0,0 +1,52 @@
+/*
+ * 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.webbeans.test.component;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.webbeans.test.annotation.binding.Binding1;
+import org.apache.webbeans.test.annotation.binding.Binding2;
+import org.apache.webbeans.test.component.service.ITyped2;
+
+@RequestScoped
+@Named("current")
+@SuppressWarnings("unchecked")
+public class CurrentBindingComponent
+{
+ private ITyped2<String, Object> typed2 = null;
+
+ public CurrentBindingComponent()
+ {
+
+ }
+
+ @Inject
+ public CurrentBindingComponent(@Binding1 @Binding2 ITyped2<String, Object> typed2)
+ {
+ this.typed2 = typed2;
+ }
+
+ public ITyped2 getTyped2()
+ {
+ return this.typed2;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/DisposalMethodComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/DisposalMethodComponent.java
new file mode 100644
index 0000000..d83aaa5
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/DisposalMethodComponent.java
@@ -0,0 +1,59 @@
+/*
+ * 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.webbeans.test.component;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+import org.apache.webbeans.test.annotation.binding.Binding1;
+import org.apache.webbeans.test.component.service.IService;
+
+@RequestScoped
+@Named
+public class DisposalMethodComponent
+{
+ private IService service = null;
+
+ @Produces
+ @ApplicationScoped
+ @Default
+ @Named
+ public IService getService(@Binding1 IService service)
+ {
+ this.service = service;
+
+ return service;
+ }
+
+ public IService service()
+ {
+ return this.service;
+ }
+
+ public void dispose(@Disposes @Default IService service)
+ {
+ service = null;
+ this.service = null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/IPayment.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/IPayment.java
new file mode 100644
index 0000000..d3118f3
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/IPayment.java
@@ -0,0 +1,25 @@
+/*
+ * 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.webbeans.test.component;
+
+public interface IPayment
+{
+ public String pay();
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/ITypeLiteralComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/ITypeLiteralComponent.java
new file mode 100644
index 0000000..bf6af46
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/ITypeLiteralComponent.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.test.component;
+
+public interface ITypeLiteralComponent<T>
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/InjectedTypeLiteralComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/InjectedTypeLiteralComponent.java
new file mode 100644
index 0000000..1e3a40e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/InjectedTypeLiteralComponent.java
@@ -0,0 +1,47 @@
+/*
+ * 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.webbeans.test.component;
+
+import java.util.List;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Default;
+import javax.inject.Inject;
+
+
+@RequestScoped
+public class InjectedTypeLiteralComponent
+{
+ private @Inject @Default ITypeLiteralComponent<List<String>> component;
+
+ public InjectedTypeLiteralComponent()
+ {
+ super();
+ }
+
+ /**
+ * @return the component
+ */
+ public ITypeLiteralComponent<List<String>> getComponent()
+ {
+ return component;
+ }
+
+ /**
+ * @param component the component to set
+ */
+ public void setComponent(ITypeLiteralComponent<List<String>> component)
+ {
+ this.component = component;
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/NonBindingComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/NonBindingComponent.java
new file mode 100644
index 0000000..3d359bc
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/NonBindingComponent.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.component;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+
+import org.apache.webbeans.test.annotation.binding.AnnotationWithBindingMember;
+import org.apache.webbeans.test.annotation.binding.AnnotationWithNonBindingMember;
+
+@AnnotationWithNonBindingMember(value = "B", arg1 = "arg1", arg2 = "arg2")
+@SessionScoped
+public class NonBindingComponent implements Serializable
+{
+ private @Inject @AnnotationWithBindingMember(number = 3, value = "B") BindingComponent comp;
+
+ public BindingComponent getComponent()
+ {
+ return comp;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/PaymentProcessorComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/PaymentProcessorComponent.java
new file mode 100644
index 0000000..b90c557
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/PaymentProcessorComponent.java
@@ -0,0 +1,57 @@
+/*
+ * 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.webbeans.test.component;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Default;
+import javax.inject.Inject;
+
+import org.apache.webbeans.test.annotation.binding.Check;
+
+@RequestScoped
+@Default
+public class PaymentProcessorComponent
+{
+ private IPayment paymentCheck;
+ private IPayment paymentMoney;
+
+ @Inject
+ public void setPaymentCheck(@Check(type = "CHECK") IPayment payment)
+ {
+ this.paymentCheck = payment;
+
+ }
+
+ @Inject
+ public void setPaymentMoney(@Check(type = "MONEY") IPayment payment)
+ {
+ this.paymentMoney = payment;
+ }
+
+ public IPayment getPaymentCheck()
+ {
+ return paymentCheck;
+ }
+
+ public IPayment getPaymentMoney()
+ {
+ return paymentMoney;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/PostConstructComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/PostConstructComponent.java
new file mode 100644
index 0000000..26ea066
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/PostConstructComponent.java
@@ -0,0 +1,71 @@
+/*
+ * 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.webbeans.test.component;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+
+import org.apache.webbeans.test.annotation.binding.Check;
+
+@RequestScoped
+public class PostConstructComponent
+{
+ private @Inject @Check(type = "CHECK") IPayment payment;
+
+ @SuppressWarnings("unused")
+ private IPayment p = null;
+
+ @PostConstruct
+ public void init()
+ {
+ this.p = payment;
+
+ }
+
+ public IPayment getP()
+ {
+ return payment;
+ }
+
+ /**
+ * @return the payment
+ */
+ public IPayment getPayment()
+ {
+ return payment;
+ }
+
+ /**
+ * @param payment the payment to set
+ */
+ public void setPayment(IPayment payment)
+ {
+ this.payment = payment;
+ }
+
+ /**
+ * @param p the p to set
+ */
+ public void setP(IPayment p)
+ {
+ this.p = p;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/PostConstructDoubleInterceptorComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/PostConstructDoubleInterceptorComponent.java
new file mode 100644
index 0000000..c3d82e3
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/PostConstructDoubleInterceptorComponent.java
@@ -0,0 +1,61 @@
+/*
+ * 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.webbeans.test.component;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.interceptor.Interceptors;
+
+import org.apache.webbeans.test.annotation.binding.Check;
+import org.apache.webbeans.test.component.intercept.Interceptor1;
+import org.apache.webbeans.test.component.intercept.Interceptor2;
+
+@RequestScoped
+@Interceptors(value = { Interceptor1.class, Interceptor2.class })
+public class PostConstructDoubleInterceptorComponent
+{
+ private @Inject @Check(type = "CHECK") IPayment payment;
+
+ private IPayment p = null;
+
+ static String setininterceptor2 = null;
+
+ @PostConstruct
+ public void init()
+ {
+ this.p = payment;
+ }
+
+ public IPayment getP()
+ {
+ return p;
+ }
+
+ public static String getValue()
+ {
+ return setininterceptor2;
+ }
+
+ public static void setValue(String s)
+ {
+ setininterceptor2 = s;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/PostConstructInterceptorComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/PostConstructInterceptorComponent.java
new file mode 100644
index 0000000..7cf28ce
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/PostConstructInterceptorComponent.java
@@ -0,0 +1,50 @@
+/*
+ * 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.webbeans.test.component;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.interceptor.Interceptors;
+
+import org.apache.webbeans.test.annotation.binding.Check;
+import org.apache.webbeans.test.component.intercept.PostConstructInterceptor;
+
+@RequestScoped
+@Interceptors(value = { PostConstructInterceptor.class })
+public class PostConstructInterceptorComponent
+{
+ private @Inject @Check(type = "CHECK") IPayment payment;
+
+ @SuppressWarnings("unused")
+ private IPayment p = null;
+
+ @PostConstruct
+ public void init()
+ {
+ this.p = payment;
+
+ }
+
+ public IPayment getP()
+ {
+ return payment;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/PreDestroyComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/PreDestroyComponent.java
new file mode 100644
index 0000000..8b6bb32
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/PreDestroyComponent.java
@@ -0,0 +1,67 @@
+/*
+ * 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.webbeans.test.component;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+
+import org.apache.webbeans.test.annotation.binding.Check;
+
+@RequestScoped
+public class PreDestroyComponent
+{
+ private @Inject @Check(type = "CHECK") IPayment payment;
+
+ private IPayment p = null;
+
+ private IPayment p2 = null;
+
+ private static boolean destroyed;
+
+ @PostConstruct
+ public void init()
+ {
+ this.p = payment;
+ destroyed = false;
+ }
+
+ @PreDestroy
+ public void destroy()
+ {
+ p2 = p;
+ destroyed = true;
+ }
+
+ public IPayment getP()
+ {
+ return payment;
+ }
+
+ public IPayment getP2()
+ {
+ return p2;
+ }
+
+ public static boolean isDestroyed()
+ {
+ return destroyed;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/Singleton.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/Singleton.java
new file mode 100644
index 0000000..a3df360
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/Singleton.java
@@ -0,0 +1,60 @@
+/*
+ * 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.webbeans.test.component;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.webbeans.test.annotation.binding.Binding1;
+import org.apache.webbeans.test.annotation.binding.SingletonBinding;
+import org.apache.webbeans.test.component.service.ITyped2;
+
+@SessionScoped
+@SingletonBinding
+@Named("singletonInstance")
+public class Singleton implements Serializable
+{
+ private ITyped2<String, Object> typed2 = null;
+
+ @Inject
+ public void inject(@Binding1 ITyped2<String, Object> typed2)
+ {
+ this.typed2 = typed2;
+ }
+
+ public String logDebug()
+ {
+ return "debug";
+ }
+
+ public String logInfoo()
+ {
+ return "info";
+ }
+
+ @SuppressWarnings("unchecked")
+ public ITyped2 getType()
+ {
+ return typed2;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/TypeLiteralComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/TypeLiteralComponent.java
new file mode 100644
index 0000000..7b0b812
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/TypeLiteralComponent.java
@@ -0,0 +1,43 @@
+/*
+ * 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.webbeans.test.component;
+
+import java.util.List;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+
+
+@RequestScoped
+public class TypeLiteralComponent implements ITypeLiteralComponent<List<String>>
+{
+ static String STR = "";
+
+ @Inject
+ public TypeLiteralComponent()
+ {
+ super();
+ STR = "GURKAN";
+ }
+
+ public static String getSTR()
+ {
+ return STR;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/UserComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/UserComponent.java
new file mode 100644
index 0000000..a7baba4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/UserComponent.java
@@ -0,0 +1,59 @@
+/*
+ * 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.webbeans.test.component;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Named;
+
+
+@SessionScoped
+@Named("userComponent")
+public class UserComponent implements Serializable
+{
+ private String name;
+ private String surname;
+
+ public UserComponent()
+ {
+
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getSurname()
+ {
+ return surname;
+ }
+
+ public void setSurname(String surname)
+ {
+ this.surname = surname;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/binding/AnyBindingComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/binding/AnyBindingComponent.java
new file mode 100644
index 0000000..660cd6d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/binding/AnyBindingComponent.java
@@ -0,0 +1,29 @@
+/*
+ * 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.webbeans.test.component.binding;
+
+import javax.enterprise.inject.Any;
+
+import org.apache.webbeans.test.annotation.binding.ParameterBinding1;
+
+@Any
+@ParameterBinding1
+public class AnyBindingComponent {
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/binding/BindingWithNonBindingAnnotationTypeComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/binding/BindingWithNonBindingAnnotationTypeComponent.java
new file mode 100644
index 0000000..ddbfbd8
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/binding/BindingWithNonBindingAnnotationTypeComponent.java
@@ -0,0 +1,31 @@
+/*
+ * 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.webbeans.test.component.binding;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Default;
+
+import org.apache.webbeans.test.annotation.binding.NonBindingAnnotationType;
+
+@RequestScoped
+@NonBindingAnnotationType(currenr = @Default)
+public class BindingWithNonBindingAnnotationTypeComponent
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/binding/BindingWithNonBindingArrayTypeComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/binding/BindingWithNonBindingArrayTypeComponent.java
new file mode 100644
index 0000000..d005900
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/binding/BindingWithNonBindingArrayTypeComponent.java
@@ -0,0 +1,29 @@
+/*
+ * 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.webbeans.test.component.binding;
+
+import javax.enterprise.context.RequestScoped;
+
+import org.apache.webbeans.test.annotation.binding.NonBindingArrayType;
+
+@RequestScoped
+@NonBindingArrayType
+public class BindingWithNonBindingArrayTypeComponent
+{
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/binding/DefaultAnyBinding.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/binding/DefaultAnyBinding.java
new file mode 100644
index 0000000..4ad18ff
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/binding/DefaultAnyBinding.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.component.binding;
+
+public class DefaultAnyBinding {
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/binding/NonAnyBindingComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/binding/NonAnyBindingComponent.java
new file mode 100644
index 0000000..2cac3b0
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/binding/NonAnyBindingComponent.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.test.component.binding;
+
+
+import org.apache.webbeans.test.annotation.binding.ParameterBinding1;
+import org.apache.webbeans.test.annotation.binding.ParameterBinding2;
+import org.apache.webbeans.test.annotation.binding.ParameterBinding3;
+
+
+@ParameterBinding1
+@ParameterBinding2
+@ParameterBinding3
+public class NonAnyBindingComponent {
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/broken/DelegateAttributeIsnotInterface.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/broken/DelegateAttributeIsnotInterface.java
new file mode 100644
index 0000000..8fba4bf
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/broken/DelegateAttributeIsnotInterface.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.test.component.decorator.broken;
+
+import javax.decorator.Delegate;
+import javax.decorator.Decorator;
+
+import org.apache.webbeans.test.component.BindingComponent;
+
+@Decorator
+public class DelegateAttributeIsnotInterface
+{
+ @Delegate
+ BindingComponent decorates;
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/broken/DelegateAttributeMustImplementAllDecoratedTypes.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/broken/DelegateAttributeMustImplementAllDecoratedTypes.java
new file mode 100644
index 0000000..1d48279
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/broken/DelegateAttributeMustImplementAllDecoratedTypes.java
@@ -0,0 +1,45 @@
+/*
+ * 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.webbeans.test.component.decorator.broken;
+
+import javax.decorator.Delegate;
+import javax.decorator.Decorator;
+
+import org.apache.webbeans.test.component.IPayment;
+import org.apache.webbeans.test.component.service.IService;
+
+@Decorator
+public class DelegateAttributeMustImplementAllDecoratedTypes implements IPayment, IService
+{
+ @Delegate
+ IPayment delegate;
+
+ @Override
+ public String pay()
+ {
+ return null;
+ }
+
+ @Override
+ public String service()
+ {
+ return null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/broken/MoreThanOneDelegateAttribute.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/broken/MoreThanOneDelegateAttribute.java
new file mode 100644
index 0000000..a4081fd
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/broken/MoreThanOneDelegateAttribute.java
@@ -0,0 +1,39 @@
+/*
+ * 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.webbeans.test.component.decorator.broken;
+
+import javax.decorator.Delegate;
+import javax.decorator.Decorator;
+
+import org.apache.webbeans.test.component.IPayment;
+
+@Decorator
+public class MoreThanOneDelegateAttribute implements IPayment
+{
+ @Delegate
+ IPayment payment;
+ @Delegate
+ IPayment payment2;
+
+ @Override
+ public String pay()
+ {
+ return null;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/broken/PaymentDecorator.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/broken/PaymentDecorator.java
new file mode 100644
index 0000000..f0f1aec
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/broken/PaymentDecorator.java
@@ -0,0 +1,47 @@
+/*
+ * 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.webbeans.test.component.decorator.broken;
+
+import javax.decorator.Delegate;
+import javax.decorator.Decorator;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Any;
+
+import org.apache.webbeans.test.annotation.binding.Check;
+import org.apache.webbeans.test.component.IPayment;
+
+@Decorator
+@RequestScoped
+public class PaymentDecorator implements IPayment
+{
+ @Delegate @Any @Check(type = "CHECK")
+ IPayment delegate;
+
+ @Override
+ public String pay()
+ {
+ return null;
+ }
+
+ public final void decoratorMethod()
+ {
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/Account.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/Account.java
new file mode 100644
index 0000000..ffab64e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/Account.java
@@ -0,0 +1,31 @@
+/*
+ * 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.webbeans.test.component.decorator.clean;
+
+import java.math.BigDecimal;
+
+public interface Account
+{
+ public BigDecimal getBalance();
+
+ public void withdraw(BigDecimal amount);
+
+ public void deposit(BigDecimal amount);
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/AccountComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/AccountComponent.java
new file mode 100644
index 0000000..40fefe4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/AccountComponent.java
@@ -0,0 +1,76 @@
+/*
+ * 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.webbeans.test.component.decorator.clean;
+
+import java.math.BigDecimal;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Default;
+
+
+@RequestScoped
+@Default
+public class AccountComponent implements Account
+{
+ private BigDecimal amount;
+ private BigDecimal balance;
+
+ @Override
+ public void deposit(BigDecimal amount)
+ {
+
+ }
+
+ @Override
+ public BigDecimal getBalance()
+ {
+ return this.balance;
+ }
+
+ @Override
+ public void withdraw(BigDecimal amount)
+ {
+
+ }
+
+ /**
+ * @return the amount
+ */
+ public BigDecimal getAmount()
+ {
+ return amount;
+ }
+
+ /**
+ * @param amount the amount to set
+ */
+ public void setAmount(BigDecimal amount)
+ {
+ this.amount = amount;
+ }
+
+ /**
+ * @param balance the balance to set
+ */
+ public void setBalance(BigDecimal balance)
+ {
+ this.balance = balance;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/LargeTransactionDecorator.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/LargeTransactionDecorator.java
new file mode 100644
index 0000000..e3f5671
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/LargeTransactionDecorator.java
@@ -0,0 +1,70 @@
+/*
+ * 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.webbeans.test.component.decorator.clean;
+
+import java.math.BigDecimal;
+
+import javax.decorator.Delegate;
+import javax.decorator.Decorator;
+import javax.inject.Inject;
+
+@Decorator
+public class LargeTransactionDecorator implements Account
+{
+ @Inject @Delegate Account account;
+
+ BigDecimal depositeAmount = null;
+ BigDecimal withDrawAmount = null;
+
+ @Override
+ public void deposit(BigDecimal amount)
+ {
+ this.depositeAmount = amount;
+
+ }
+
+ @Override
+ public void withdraw(BigDecimal amount)
+ {
+ this.withDrawAmount = amount;
+ }
+
+ /**
+ * @return the depositeAmount
+ */
+ public BigDecimal getDepositeAmount()
+ {
+ return depositeAmount;
+ }
+
+ /**
+ * @return the withDrawAmount
+ */
+ public BigDecimal getWithDrawAmount()
+ {
+ return withDrawAmount;
+ }
+
+ @Override
+ public BigDecimal getBalance()
+ {
+ return null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/ServiceDecorator.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/ServiceDecorator.java
new file mode 100644
index 0000000..618f9a5
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/ServiceDecorator.java
@@ -0,0 +1,49 @@
+/*
+ * 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.webbeans.test.component.decorator.clean;
+
+import javax.decorator.Delegate;
+import javax.decorator.Decorator;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.webbeans.test.annotation.binding.Binding1;
+import org.apache.webbeans.test.component.service.IService;
+
+@Decorator
+@Named
+public class ServiceDecorator implements IService
+{
+ @Inject @Delegate @Binding1 IService delegate;
+
+ private String delegateAttr = null;
+
+ @Override
+ public String service()
+ {
+ this.delegateAttr = delegate.service();
+
+ return "ServiceDecorator";
+ }
+
+ public String getDelegateAttr()
+ {
+ return delegateAttr;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/definition/BeanTypesDefinedBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/definition/BeanTypesDefinedBean.java
new file mode 100644
index 0000000..07a4765
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/definition/BeanTypesDefinedBean.java
@@ -0,0 +1,39 @@
+/*
+ * 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.webbeans.test.component.definition;
+
+import java.io.Serializable;
+
+import javax.enterprise.inject.Typed;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+import org.apache.webbeans.test.component.CheckWithCheckPayment;
+
+@Typed(value={BeanTypesDefinedBean.class})
+public class BeanTypesDefinedBean implements Serializable
+{
+ private @Produces @Named("paymentField") @Typed(value={CheckWithCheckPayment.class}) CheckWithCheckPayment payment;
+
+ @Produces @Named("paymentMethod") @Typed(value={CheckWithCheckPayment.class})
+ public CheckWithCheckPayment produce()
+ {
+ return null;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/dependent/DependentComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/dependent/DependentComponent.java
new file mode 100644
index 0000000..b32a15a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/dependent/DependentComponent.java
@@ -0,0 +1,27 @@
+/*
+ * 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.webbeans.test.component.dependent;
+
+import javax.enterprise.context.Dependent;
+
+@Dependent
+public class DependentComponent
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/dependent/DependentOwnerComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/dependent/DependentOwnerComponent.java
new file mode 100644
index 0000000..104331d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/dependent/DependentOwnerComponent.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.component.dependent;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Default;
+import javax.inject.Inject;
+
+@RequestScoped
+public class DependentOwnerComponent
+{
+ private @Inject @Default DependentComponent dependentComponent;
+
+ public DependentComponent getDependent()
+ {
+ return dependentComponent;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/dependent/MultipleDependentComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/dependent/MultipleDependentComponent.java
new file mode 100644
index 0000000..1cf9c63
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/dependent/MultipleDependentComponent.java
@@ -0,0 +1,47 @@
+/*
+ * 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.webbeans.test.component.dependent;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Default;
+import javax.inject.Inject;
+
+@RequestScoped
+public class MultipleDependentComponent
+{
+ @Inject @Default DependentComponent dependent1;
+
+ @Inject @Default DependentComponent dependent2;
+
+ public MultipleDependentComponent()
+ {
+
+ }
+
+ public DependentComponent get1()
+ {
+ return this.dependent1;
+ }
+
+ public DependentComponent get2()
+ {
+ return this.dependent2;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/dependent/circular/DependentA.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/dependent/circular/DependentA.java
new file mode 100644
index 0000000..661e5a8
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/dependent/circular/DependentA.java
@@ -0,0 +1,51 @@
+/*
+ * 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.webbeans.test.component.dependent.circular;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Default;
+import javax.inject.Inject;
+
+@RequestScoped
+public class DependentA
+{
+ private @Inject @Default DependentB dependentB;
+
+ public DependentA()
+ {
+
+ }
+
+ /**
+ * @return the dependentB
+ */
+ public DependentB getDependentB()
+ {
+ return dependentB;
+ }
+
+ /**
+ * @param dependentB the dependentB to set
+ */
+ public void setDependentB(DependentB dependentB)
+ {
+ this.dependentB = dependentB;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/dependent/circular/DependentB.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/dependent/circular/DependentB.java
new file mode 100644
index 0000000..4a81af7
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/dependent/circular/DependentB.java
@@ -0,0 +1,49 @@
+/*
+ * 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.webbeans.test.component.dependent.circular;
+
+import javax.enterprise.inject.Default;
+
+public class DependentB
+{
+ private @Default DependentA dependentA;
+
+ public DependentB()
+ {
+
+ }
+
+ /**
+ * @return the dependentA
+ */
+ protected DependentA getDependentA()
+ {
+ return dependentA;
+ }
+
+ /**
+ * @param dependentA the dependentA to set
+ */
+ protected void setDependentA(DependentA dependentA)
+ {
+ this.dependentA = dependentA;
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/disposal/Disposal1.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/disposal/Disposal1.java
new file mode 100644
index 0000000..bda0eb6
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/disposal/Disposal1.java
@@ -0,0 +1,65 @@
+/*
+ * 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.webbeans.test.component.disposal;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+import org.apache.webbeans.test.annotation.binding.Binding1;
+
+
+@SessionScoped
+public class Disposal1 implements Serializable
+{
+ static boolean disposeCall = false;
+
+ public Disposal1()
+ {
+
+ }
+
+ public static boolean getDISPOSCALL()
+ {
+ return disposeCall;
+ }
+
+ @Produces
+ @Binding1
+ @Named
+ @RequestScoped
+ public List<Integer> createBinding1()
+ {
+ List<Integer> lst = new ArrayList<Integer>();
+ lst.add(new Integer(42));
+ return lst;
+ }
+
+ public void dispose(@Disposes @Binding1 List<Integer> list)
+ {
+ disposeCall = true;
+ list.clear();
+ }
+}
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/broken/BrokenObserverComponent1.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/broken/BrokenObserverComponent1.java
new file mode 100644
index 0000000..009f519
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/broken/BrokenObserverComponent1.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.test.component.event.broken;
+
+import javax.enterprise.event.Observes;
+
+import org.apache.webbeans.test.event.broke.BrokenEvent;
+
+public class BrokenObserverComponent1
+{
+
+ public void observer(@Observes BrokenEvent<Integer> event)
+ {
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/broken/BrokenObserverComponent2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/broken/BrokenObserverComponent2.java
new file mode 100644
index 0000000..e170ce0
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/broken/BrokenObserverComponent2.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.test.component.event.broken;
+
+import javax.enterprise.event.Observes;
+
+import org.apache.webbeans.test.event.LoggedInEvent;
+
+public class BrokenObserverComponent2
+{
+
+ public void observer(@Observes LoggedInEvent event1, @Observes LoggedInEvent event2)
+ {
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/broken/BrokenObserverComponent3.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/broken/BrokenObserverComponent3.java
new file mode 100644
index 0000000..a715018
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/broken/BrokenObserverComponent3.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.component.event.broken;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Produces;
+
+import org.apache.webbeans.test.component.CurrentBindingComponent;
+import org.apache.webbeans.test.event.LoggedInEvent;
+
+public class BrokenObserverComponent3
+{
+
+ @Produces
+ public CurrentBindingComponent observer(@Observes LoggedInEvent event1)
+ {
+ return null;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/broken/BrokenObserverComponent4.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/broken/BrokenObserverComponent4.java
new file mode 100644
index 0000000..969c45a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/broken/BrokenObserverComponent4.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.component.event.broken;
+
+import javax.enterprise.event.Observes;
+import javax.inject.Inject;
+
+import org.apache.webbeans.test.component.CurrentBindingComponent;
+import org.apache.webbeans.test.event.LoggedInEvent;
+
+public class BrokenObserverComponent4
+{
+
+ @Inject
+ public CurrentBindingComponent observer(@Observes LoggedInEvent event1)
+ {
+ return null;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/broken/BrokenObserverComponent5.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/broken/BrokenObserverComponent5.java
new file mode 100644
index 0000000..95667a7
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/broken/BrokenObserverComponent5.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.component.event.broken;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Produces;
+
+import org.apache.webbeans.test.component.CurrentBindingComponent;
+import org.apache.webbeans.test.event.LoggedInEvent;
+
+public class BrokenObserverComponent5
+{
+
+ @Produces
+ public CurrentBindingComponent observer(@Observes LoggedInEvent event1)
+ {
+ return null;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/broken/BrokenObserverComponent6.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/broken/BrokenObserverComponent6.java
new file mode 100644
index 0000000..6e5d583
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/broken/BrokenObserverComponent6.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.component.event.broken;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Disposes;
+
+import org.apache.webbeans.test.component.CurrentBindingComponent;
+import org.apache.webbeans.test.event.LoggedInEvent;
+
+public class BrokenObserverComponent6
+{
+
+ public CurrentBindingComponent observer(@Observes LoggedInEvent event1, @Disposes CurrentBindingComponent com)
+ {
+ return null;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/ComponentWithObservable1.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/ComponentWithObservable1.java
new file mode 100644
index 0000000..cf31ea7
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/ComponentWithObservable1.java
@@ -0,0 +1,42 @@
+/*
+ * 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.webbeans.test.component.event.normal;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Default;
+import javax.inject.Inject;
+
+import org.apache.webbeans.test.event.LoggedInEvent;
+
+@RequestScoped
+@Default
+public class ComponentWithObservable1
+{
+ private @Inject @Any Event<LoggedInEvent> event;
+
+ public void afterLoggedIn()
+ {
+ LoggedInEvent loggedIn = new LoggedInEvent("Gurkan");
+
+ event.fire(loggedIn);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/ComponentWithObserves1.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/ComponentWithObserves1.java
new file mode 100644
index 0000000..7d5f22a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/ComponentWithObserves1.java
@@ -0,0 +1,58 @@
+/*
+ * 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.webbeans.test.component.event.normal;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Any;
+
+import org.apache.webbeans.test.annotation.binding.Check;
+import org.apache.webbeans.test.event.LoggedInEvent;
+
+@RequestScoped
+public class ComponentWithObserves1
+{
+ private String userName;
+
+ private String userNameWithMember;
+
+ public void afterLoggedIn(@Observes @Any LoggedInEvent event)
+ {
+ this.userName = event.getUserName();
+ }
+
+ private void afterLoggedInWithMember(@Observes @Check(type = "CHECK") LoggedInEvent event)
+ {
+ this.userNameWithMember = event.getUserName();
+ }
+
+ public String getUserName()
+ {
+ return this.userName;
+ }
+
+ /**
+ * @return the userNameWithMember
+ */
+ public String getUserNameWithMember()
+ {
+ return userNameWithMember;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/ComponentWithObserves2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/ComponentWithObserves2.java
new file mode 100644
index 0000000..b8a4e5d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/ComponentWithObserves2.java
@@ -0,0 +1,66 @@
+/*
+ * 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.webbeans.test.component.event.normal;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Observes;
+
+import org.apache.webbeans.test.annotation.binding.Role;
+import org.apache.webbeans.test.component.IPayment;
+import org.apache.webbeans.test.component.PaymentProcessorComponent;
+import org.apache.webbeans.test.event.LoggedInEvent;
+
+@RequestScoped
+public class ComponentWithObserves2
+{
+ private IPayment payment;
+
+ private String user;
+
+ /** This gets set via the TransactionalInterceptor */
+ public static boolean hasBeenIntercepted;
+
+ public void afterLogin(@Observes @Role(value = "USER") LoggedInEvent event, PaymentProcessorComponent payment)
+ {
+ hasBeenIntercepted = false;
+ this.payment = payment.getPaymentCheck();
+ this.user = event.getUserName();
+ }
+
+ /**
+ * Test if observer functions can be intercepted
+ */
+ @Transactional
+ public void afterAdminLogin(@Observes @Role(value = "ADMIN") LoggedInEvent event, PaymentProcessorComponent payment)
+ {
+ hasBeenIntercepted = true;
+ this.payment = payment.getPaymentCheck();
+ this.user = event.getUserName();
+ }
+
+ public String getUser()
+ {
+ return user;
+ }
+
+ public IPayment getPayment()
+ {
+ return this.payment;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/ComponentWithObserves3.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/ComponentWithObserves3.java
new file mode 100644
index 0000000..8c93eb6
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/ComponentWithObserves3.java
@@ -0,0 +1,48 @@
+/*
+ * 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.webbeans.test.component.event.normal;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.event.Observes;
+import javax.enterprise.event.Reception;
+import javax.inject.Inject;
+
+import org.apache.webbeans.test.annotation.binding.NotAny;
+import org.apache.webbeans.test.annotation.binding.TestingIfNonExists;
+import org.apache.webbeans.test.event.LoggedInEvent;
+
+@RequestScoped
+public class ComponentWithObserves3
+{
+ private String userName;
+ private @Inject @TestingIfNonExists Event<LoggedInEvent> myLIE;
+
+ public void afterLoggedIn(@Observes(notifyObserver=Reception.IF_EXISTS) @NotAny LoggedInEvent event)
+ {
+ this.userName = event.getUserName();
+ myLIE.fire(new LoggedInEvent("INE" + this.userName));
+ }
+
+ public String getUserName()
+ {
+ return this.userName;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/ComponentWithObserves4.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/ComponentWithObserves4.java
new file mode 100644
index 0000000..dcc2ff4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/ComponentWithObserves4.java
@@ -0,0 +1,47 @@
+/*
+ * 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.webbeans.test.component.event.normal;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.event.Observes;
+import javax.inject.Inject;
+
+import org.apache.webbeans.test.annotation.binding.NotAny;
+import org.apache.webbeans.test.annotation.binding.TestingNormal;
+import org.apache.webbeans.test.event.LoggedInEvent;
+
+@RequestScoped
+public class ComponentWithObserves4
+{
+ private String userName;
+ private @Inject @TestingNormal Event<LoggedInEvent> myLIE;
+
+ public void afterLoggedIn(@Observes @NotAny LoggedInEvent event)
+ {
+ this.userName = event.getUserName();
+ myLIE.fire(new LoggedInEvent(this.userName));
+ }
+
+ public String getUserName()
+ {
+ return this.userName;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/ComponentWithObserves5.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/ComponentWithObserves5.java
new file mode 100644
index 0000000..1387a5f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/ComponentWithObserves5.java
@@ -0,0 +1,48 @@
+/*
+ * 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.webbeans.test.component.event.normal;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.event.Observes;
+import javax.enterprise.event.Reception;
+import javax.inject.Inject;
+
+import org.apache.webbeans.test.annotation.binding.NotAny;
+import org.apache.webbeans.test.annotation.binding.TestingIfExists;
+import org.apache.webbeans.test.event.LoggedInEvent;
+
+@RequestScoped
+public class ComponentWithObserves5
+{
+ private String userName;
+ private @Inject @TestingIfExists Event<LoggedInEvent> myLIE;
+
+ public void afterLoggedIn(@Observes(notifyObserver=Reception.IF_EXISTS) @NotAny LoggedInEvent event)
+ {
+ this.userName = event.getUserName();
+ myLIE.fire(new LoggedInEvent("IE" + this.userName));
+ }
+
+ public String getUserName()
+ {
+ return this.userName;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/ComponentWithObserves6.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/ComponentWithObserves6.java
new file mode 100644
index 0000000..015c357
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/ComponentWithObserves6.java
@@ -0,0 +1,66 @@
+/*
+ * 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.webbeans.test.component.event.normal;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Observes;
+
+import org.apache.webbeans.test.annotation.binding.TestingIfExists;
+import org.apache.webbeans.test.annotation.binding.TestingIfNonExists;
+import org.apache.webbeans.test.annotation.binding.TestingNormal;
+import org.apache.webbeans.test.event.LoggedInEvent;
+
+@RequestScoped
+public class ComponentWithObserves6
+{
+ private String userName = null;
+ private String userIEName = null;
+ private String userNIEName = null;
+
+ public void afterLoggedIn(@Observes @TestingNormal LoggedInEvent event)
+ {
+ this.userName = event.getUserName();
+ }
+
+ public void afterLoggedIn2(@Observes @TestingIfExists LoggedInEvent event)
+ {
+ this.userIEName = event.getUserName();
+ }
+
+ public void afterLoggedIn3(@Observes @TestingIfNonExists LoggedInEvent event)
+ {
+ this.userNIEName = event.getUserName();
+ }
+
+ public String getUserName()
+ {
+ return this.userName;
+ }
+
+ public String getUserIEName()
+ {
+ return this.userIEName;
+ }
+
+ public String getUserNIEName()
+ {
+ return this.userNIEName;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/ComponentWithObserves7.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/ComponentWithObserves7.java
new file mode 100644
index 0000000..40b24ec
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/ComponentWithObserves7.java
@@ -0,0 +1,56 @@
+/*
+ * 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.webbeans.test.component.event.normal;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Any;
+
+import org.apache.webbeans.test.event.LoggedInEvent;
+
+@RequestScoped
+public class ComponentWithObserves7
+{
+ private String userName;
+
+ private String eventString;
+
+ public void afterLoggedIn(@Observes @Any LoggedInEvent event, Event<String> myEvent)
+ {
+ this.userName = event.getUserName();
+ myEvent.fire("Rohit_Kelapure");
+ }
+
+ public void watchEvent(@Observes String myEventString)
+ {
+ this.eventString = myEventString;
+ }
+
+ public String getUserName()
+ {
+ return this.userName;
+ }
+
+ public String getEventString()
+ {
+ return eventString;
+ }
+
+}
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/Transactional.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/Transactional.java
new file mode 100644
index 0000000..00ac583
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/Transactional.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.component.event.normal;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.interceptor.InterceptorBinding;
+
+@InterceptorBinding
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.TYPE, ElementType.METHOD })
+public @interface Transactional
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/TransactionalInterceptor.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/TransactionalInterceptor.java
new file mode 100644
index 0000000..556ab29
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/TransactionalInterceptor.java
@@ -0,0 +1,45 @@
+/*
+ * 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.webbeans.test.component.event.normal;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+@Interceptor
+@Transactional
+public class TransactionalInterceptor
+{
+
+ @AroundInvoke
+ public Object caller(InvocationContext context) throws Exception
+ {
+ try
+ {
+ ComponentWithObserves2.hasBeenIntercepted = true;
+ return context.proceed();
+
+ }catch(Exception e)
+ {
+ ComponentWithObserves2.hasBeenIntercepted = false;
+ }
+
+ return null;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/AroundInvokeWithFinalMethodComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/AroundInvokeWithFinalMethodComponent.java
new file mode 100644
index 0000000..b96ab64
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/AroundInvokeWithFinalMethodComponent.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.test.component.exception;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+
+public class AroundInvokeWithFinalMethodComponent
+{
+ @AroundInvoke
+ public final Object method2(InvocationContext ctx) throws Exception
+ {
+ return null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/AroundInvokeWithSameMethodNameComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/AroundInvokeWithSameMethodNameComponent.java
new file mode 100644
index 0000000..f29df2b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/AroundInvokeWithSameMethodNameComponent.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.test.component.exception;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+
+public class AroundInvokeWithSameMethodNameComponent
+{
+ public Object method1() throws Exception
+ {
+ return null;
+ }
+
+ @AroundInvoke
+ public Object method1(InvocationContext ctx) throws Exception
+ {
+ return null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/AroundInvokeWithStaticMethodComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/AroundInvokeWithStaticMethodComponent.java
new file mode 100644
index 0000000..03a75fa
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/AroundInvokeWithStaticMethodComponent.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.test.component.exception;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+
+public class AroundInvokeWithStaticMethodComponent
+{
+ @AroundInvoke
+ public static Object method2(InvocationContext ctx) throws Exception
+ {
+ return null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/AroundInvokeWithWrongReturnTypeComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/AroundInvokeWithWrongReturnTypeComponent.java
new file mode 100644
index 0000000..c11e605
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/AroundInvokeWithWrongReturnTypeComponent.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.test.component.exception;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+
+public class AroundInvokeWithWrongReturnTypeComponent
+{
+ @AroundInvoke
+ public int method2(InvocationContext ctx) throws Exception
+ {
+ return 0;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/AroundInvokeWithoutParameterComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/AroundInvokeWithoutParameterComponent.java
new file mode 100644
index 0000000..a585196
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/AroundInvokeWithoutParameterComponent.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.test.component.exception;
+
+import javax.interceptor.AroundInvoke;
+
+
+public class AroundInvokeWithoutParameterComponent
+{
+ @AroundInvoke
+ public Object method2() throws Exception
+ {
+ return null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/AroundInvokeWithoutReturnTypeComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/AroundInvokeWithoutReturnTypeComponent.java
new file mode 100644
index 0000000..d56c94a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/AroundInvokeWithoutReturnTypeComponent.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.test.component.exception;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+
+public class AroundInvokeWithoutReturnTypeComponent
+{
+ @AroundInvoke
+ public void method2(InvocationContext ctx) throws Exception
+ {
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/FinalComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/FinalComponent.java
new file mode 100644
index 0000000..0fef6ea
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/FinalComponent.java
@@ -0,0 +1,25 @@
+/*
+ * 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.webbeans.test.component.exception;
+
+
+public final class FinalComponent
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/HasFinalMethodComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/HasFinalMethodComponent.java
new file mode 100644
index 0000000..ecc852a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/HasFinalMethodComponent.java
@@ -0,0 +1,31 @@
+/*
+ * 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.webbeans.test.component.exception;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
+
+@Transactional
+public class HasFinalMethodComponent
+{
+
+ public final void thisisfinal()
+ {
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/InnerComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/InnerComponent.java
new file mode 100644
index 0000000..64e1d31
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/InnerComponent.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.test.component.exception;
+
+
+public class InnerComponent
+{
+ /**
+ * only static inner classes get picked up as CDI beans as per 3.1.1
+ */
+ public class InnerInnerComponent
+ {
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/MoreThanOneAroundInvokeComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/MoreThanOneAroundInvokeComponent.java
new file mode 100644
index 0000000..42e02bd
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/MoreThanOneAroundInvokeComponent.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.component.exception;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+
+public class MoreThanOneAroundInvokeComponent
+{
+ @AroundInvoke
+ public Object method1(InvocationContext ctx) throws Exception
+ {
+ return null;
+
+ }
+
+ @AroundInvoke
+ public Object method2(InvocationContext ctx) throws Exception
+ {
+ return null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/MoreThanOneConstructureComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/MoreThanOneConstructureComponent.java
new file mode 100644
index 0000000..c587957
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/MoreThanOneConstructureComponent.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.test.component.exception;
+
+import javax.inject.Inject;
+
+
+public class MoreThanOneConstructureComponent
+{
+ @Inject
+ public MoreThanOneConstructureComponent()
+ {
+
+ }
+
+ @Inject
+ public MoreThanOneConstructureComponent(String m)
+ {
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/MoreThanOneConstructureComponent2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/MoreThanOneConstructureComponent2.java
new file mode 100644
index 0000000..fc86a39
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/MoreThanOneConstructureComponent2.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.component.exception;
+
+import javax.inject.Inject;
+
+import org.apache.webbeans.test.annotation.binding.Binding1;
+import org.apache.webbeans.test.component.service.ServiceImpl1;
+
+public class MoreThanOneConstructureComponent2
+{
+ @Inject
+ public MoreThanOneConstructureComponent2()
+ {
+
+ }
+
+ @Inject
+ public MoreThanOneConstructureComponent2(@Binding1 ServiceImpl1 s)
+ {
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/MoreThanOnePostConstructComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/MoreThanOnePostConstructComponent.java
new file mode 100644
index 0000000..bdd2858
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/MoreThanOnePostConstructComponent.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.test.component.exception;
+
+import javax.annotation.PostConstruct;
+
+
+public class MoreThanOnePostConstructComponent
+{
+ @PostConstruct
+ public void p1()
+ {
+
+ }
+
+ @PostConstruct
+ public void p2()
+ {
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/MultipleDisposalMethodComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/MultipleDisposalMethodComponent.java
new file mode 100644
index 0000000..f893e2f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/MultipleDisposalMethodComponent.java
@@ -0,0 +1,60 @@
+/*
+ * 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.webbeans.test.component.exception;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+
+import org.apache.webbeans.test.annotation.binding.Binding1;
+import org.apache.webbeans.test.component.service.IService;
+
+public class MultipleDisposalMethodComponent
+{
+ private IService service = null;
+
+ @Produces
+ @ApplicationScoped
+ @Default
+ public IService getService(@Binding1 IService service)
+ {
+ this.service = service;
+
+ return service;
+ }
+
+ public IService service()
+ {
+ return this.service;
+ }
+
+ public void dispose(@Disposes @Default IService service)
+ {
+ service = null;
+ this.service = null;
+ }
+
+ public void dispose2(@Disposes @Default IService service)
+ {
+ service = null;
+ this.service = null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/NewComponentBindingComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/NewComponentBindingComponent.java
new file mode 100644
index 0000000..eac68f1
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/NewComponentBindingComponent.java
@@ -0,0 +1,30 @@
+/*
+ * 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.webbeans.test.component.exception;
+
+import javax.enterprise.inject.New;
+import javax.inject.Inject;
+
+import org.apache.webbeans.test.annotation.binding.Binding1;
+
+public class NewComponentBindingComponent
+{
+ @Inject @New @Binding1 String src;
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/NewComponentInterfaceComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/NewComponentInterfaceComponent.java
new file mode 100644
index 0000000..4ef412f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/NewComponentInterfaceComponent.java
@@ -0,0 +1,30 @@
+/*
+ * 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.webbeans.test.component.exception;
+
+import javax.enterprise.inject.New;
+import javax.inject.Inject;
+
+import org.apache.webbeans.test.component.service.IService;
+
+public class NewComponentInterfaceComponent
+{
+ @Inject @New IService src;
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/NewMethodComponentBindingComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/NewMethodComponentBindingComponent.java
new file mode 100644
index 0000000..e75b026
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/NewMethodComponentBindingComponent.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.test.component.exception;
+
+import javax.enterprise.inject.New;
+import javax.inject.Inject;
+
+import org.apache.webbeans.test.component.service.ITyped2;
+
+public class NewMethodComponentBindingComponent
+{
+ @New
+ String src;
+
+ @Inject
+ public void inject(@New ITyped2<String, String> s)
+ {
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/NoConstructureComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/NoConstructureComponent.java
new file mode 100644
index 0000000..7c1a507
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/NoConstructureComponent.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.component.exception;
+
+import org.apache.webbeans.test.component.service.ServiceImpl1;
+
+public class NoConstructureComponent
+{
+ public NoConstructureComponent()
+ {
+
+ }
+
+ public NoConstructureComponent(ServiceImpl1 s)
+ {
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/PostContructMethodHasCheckedExceptionComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/PostContructMethodHasCheckedExceptionComponent.java
new file mode 100644
index 0000000..bbbfaee
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/PostContructMethodHasCheckedExceptionComponent.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.test.component.exception;
+
+import javax.annotation.PostConstruct;
+
+
+public class PostContructMethodHasCheckedExceptionComponent
+{
+ @PostConstruct
+ public void p() throws Exception
+ {
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/PostContructMethodHasParameterComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/PostContructMethodHasParameterComponent.java
new file mode 100644
index 0000000..390eeaf
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/PostContructMethodHasParameterComponent.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.test.component.exception;
+
+import javax.annotation.PostConstruct;
+
+
+public class PostContructMethodHasParameterComponent
+{
+ @PostConstruct
+ public void p(int argument)
+ {
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/PostContructMethodHasReturnTypeComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/PostContructMethodHasReturnTypeComponent.java
new file mode 100644
index 0000000..30fcfd8
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/PostContructMethodHasReturnTypeComponent.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.test.component.exception;
+
+import javax.annotation.PostConstruct;
+
+
+public class PostContructMethodHasReturnTypeComponent
+{
+ @PostConstruct
+ public int p()
+ {
+ return 0;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/PostContructMethodHasStaticComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/PostContructMethodHasStaticComponent.java
new file mode 100644
index 0000000..60cfa36
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/PostContructMethodHasStaticComponent.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.test.component.exception;
+
+import javax.annotation.PostConstruct;
+
+
+public class PostContructMethodHasStaticComponent
+{
+ @PostConstruct
+ public static void p()
+ {
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/ProducerTypeExceptionComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/ProducerTypeExceptionComponent.java
new file mode 100644
index 0000000..8b7b707
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/ProducerTypeExceptionComponent.java
@@ -0,0 +1,31 @@
+/*
+ * 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.webbeans.test.component.exception;
+
+import javax.enterprise.inject.Produces;
+
+public class ProducerTypeExceptionComponent
+{
+ @Produces
+ public void produce()
+ {
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/ProducerTypeStaticComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/ProducerTypeStaticComponent.java
new file mode 100644
index 0000000..8fdfefe
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/ProducerTypeStaticComponent.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.test.component.exception;
+
+import javax.enterprise.inject.Produces;
+
+
+public class ProducerTypeStaticComponent
+{
+ @Produces
+ public static void produce()
+ {
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/initializer/BrokenInitializer1.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/initializer/BrokenInitializer1.java
new file mode 100644
index 0000000..d3d18cb
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/initializer/BrokenInitializer1.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.test.component.exception.initializer;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+
+public class BrokenInitializer1
+{
+
+ public BrokenInitializer1()
+ {
+
+ }
+
+ @Inject @Produces
+ public void init1()
+ {
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/initializer/BrokenInitializer2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/initializer/BrokenInitializer2.java
new file mode 100644
index 0000000..1543b2e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/initializer/BrokenInitializer2.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.test.component.exception.initializer;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+
+public class BrokenInitializer2
+{
+ public BrokenInitializer2()
+ {
+
+ }
+
+ @Inject @Produces
+ public void init2()
+ {
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/initializer/BrokenInitializer3.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/initializer/BrokenInitializer3.java
new file mode 100644
index 0000000..cec6188
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/initializer/BrokenInitializer3.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.test.component.exception.initializer;
+
+import javax.enterprise.inject.Disposes;
+import javax.inject.Inject;
+
+public class BrokenInitializer3
+{
+ public BrokenInitializer3()
+ {
+
+ }
+
+ @Inject
+ public void init3(@Disposes int x)
+ {
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/initializer/BrokenInitializer4.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/initializer/BrokenInitializer4.java
new file mode 100644
index 0000000..facc887
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/initializer/BrokenInitializer4.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.test.component.exception.initializer;
+
+import javax.enterprise.event.Observes;
+import javax.inject.Inject;
+
+public class BrokenInitializer4
+{
+
+ public BrokenInitializer4()
+ {
+
+ }
+
+ @Inject
+ public void init4(@Observes int i)
+ {
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/stero/ComponentDefaultScopeWithDifferentScopeSteros.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/stero/ComponentDefaultScopeWithDifferentScopeSteros.java
new file mode 100644
index 0000000..3dd00a8
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/stero/ComponentDefaultScopeWithDifferentScopeSteros.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.component.exception.stero;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+
+import org.apache.webbeans.test.sterotype.StereoWithRequestScope;
+import org.apache.webbeans.test.sterotype.StereoWithSessionScope;
+
+@SessionScoped
+@StereoWithSessionScope
+@StereoWithRequestScope
+public class ComponentDefaultScopeWithDifferentScopeSteros implements Serializable
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/stero/ComponentDefaultScopeWithNonScopeStero.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/stero/ComponentDefaultScopeWithNonScopeStero.java
new file mode 100644
index 0000000..a990eda
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/stero/ComponentDefaultScopeWithNonScopeStero.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.test.component.exception.stero;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+
+import org.apache.webbeans.test.sterotype.StereoWithNonScope;
+
+@StereoWithNonScope
+@SessionScoped
+public class ComponentDefaultScopeWithNonScopeStero implements Serializable
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/stero/ComponentNonDefaultScopeWithDifferentScopeSteros.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/stero/ComponentNonDefaultScopeWithDifferentScopeSteros.java
new file mode 100644
index 0000000..322f4e3
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/stero/ComponentNonDefaultScopeWithDifferentScopeSteros.java
@@ -0,0 +1,29 @@
+/*
+ * 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.webbeans.test.component.exception.stero;
+
+import org.apache.webbeans.test.sterotype.StereoWithRequestScope;
+import org.apache.webbeans.test.sterotype.StereoWithSessionScope;
+
+@StereoWithSessionScope
+@StereoWithRequestScope
+public class ComponentNonDefaultScopeWithDifferentScopeSteros
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/stero/ComponentWithDefaultScopeStero.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/stero/ComponentWithDefaultScopeStero.java
new file mode 100644
index 0000000..4417883
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/stero/ComponentWithDefaultScopeStero.java
@@ -0,0 +1,27 @@
+/*
+ * 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.webbeans.test.component.exception.stero;
+
+import org.apache.webbeans.test.sterotype.StereoWithRequestScope;
+
+@StereoWithRequestScope
+public class ComponentWithDefaultScopeStero
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/stero/ComponentWithDifferentScopeSteros.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/stero/ComponentWithDifferentScopeSteros.java
new file mode 100644
index 0000000..15baac3
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/stero/ComponentWithDifferentScopeSteros.java
@@ -0,0 +1,29 @@
+/*
+ * 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.webbeans.test.component.exception.stero;
+
+import org.apache.webbeans.test.sterotype.StereoWithRequestScope;
+import org.apache.webbeans.test.sterotype.StereoWithSessionScope;
+
+@StereoWithRequestScope
+@StereoWithSessionScope
+public class ComponentWithDifferentScopeSteros
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/stero/ComponentWithNonScopeStero.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/stero/ComponentWithNonScopeStero.java
new file mode 100644
index 0000000..fc2427c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/stero/ComponentWithNonScopeStero.java
@@ -0,0 +1,27 @@
+/*
+ * 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.webbeans.test.component.exception.stero;
+
+import org.apache.webbeans.test.sterotype.StereoWithNonScope;
+
+@StereoWithNonScope
+public class ComponentWithNonScopeStero
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/stero/ComponentWithSameScopeSteros.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/stero/ComponentWithSameScopeSteros.java
new file mode 100644
index 0000000..0ebd805
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/stero/ComponentWithSameScopeSteros.java
@@ -0,0 +1,31 @@
+/*
+ * 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.webbeans.test.component.exception.stero;
+
+import java.io.Serializable;
+
+import org.apache.webbeans.test.sterotype.StereoWithSessionScope;
+import org.apache.webbeans.test.sterotype.StereoWithSessionScope2;
+
+@StereoWithSessionScope
+@StereoWithSessionScope2
+public class ComponentWithSameScopeSteros implements Serializable
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/stero/ComponentWithoutScopeStero.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/stero/ComponentWithoutScopeStero.java
new file mode 100644
index 0000000..3b56995
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/exception/stero/ComponentWithoutScopeStero.java
@@ -0,0 +1,27 @@
+/*
+ * 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.webbeans.test.component.exception.stero;
+
+import org.apache.webbeans.test.sterotype.StereoWithNonScope;
+
+@StereoWithNonScope
+public class ComponentWithoutScopeStero
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/InheritFromMultipleParentComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/InheritFromMultipleParentComponent.java
new file mode 100644
index 0000000..a495e66
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/InheritFromMultipleParentComponent.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.test.component.inheritance;
+
+public class InheritFromMultipleParentComponent extends ParentComponentSubClass
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/InheritFromParentComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/InheritFromParentComponent.java
new file mode 100644
index 0000000..052247f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/InheritFromParentComponent.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.test.component.inheritance;
+
+public class InheritFromParentComponent extends ParentComponent
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/ParentComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/ParentComponent.java
new file mode 100644
index 0000000..97d2228
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/ParentComponent.java
@@ -0,0 +1,39 @@
+/*
+ * 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.webbeans.test.component.inheritance;
+
+import org.apache.webbeans.test.component.inheritance.types.InhBinding1;
+import org.apache.webbeans.test.component.inheritance.types.InhBinding2;
+import org.apache.webbeans.test.component.inheritance.types.InhIntBinding1;
+import org.apache.webbeans.test.component.inheritance.types.InhIntBinding2;
+import org.apache.webbeans.test.component.inheritance.types.InhScopeType1;
+import org.apache.webbeans.test.component.inheritance.types.InhStereo1;
+import org.apache.webbeans.test.component.inheritance.types.InhStereo2;
+
+@InhBinding1
+@InhBinding2
+@InhStereo1
+@InhStereo2
+@InhScopeType1
+@InhIntBinding1
+@InhIntBinding2
+public class ParentComponent
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/ParentComponentSubClass.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/ParentComponentSubClass.java
new file mode 100644
index 0000000..2cde01b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/ParentComponentSubClass.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.test.component.inheritance;
+
+public class ParentComponentSubClass extends ParentComponent
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhBinding1.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhBinding1.java
new file mode 100644
index 0000000..2f11ebe
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhBinding1.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.test.component.inheritance.types;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface InhBinding1
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhBinding2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhBinding2.java
new file mode 100644
index 0000000..a4151b5
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhBinding2.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.test.component.inheritance.types;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface InhBinding2
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhIntBinding1.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhIntBinding1.java
new file mode 100644
index 0000000..1627faa
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhIntBinding1.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.test.component.inheritance.types;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.interceptor.InterceptorBinding;
+
+@InterceptorBinding
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface InhIntBinding1
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhIntBinding2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhIntBinding2.java
new file mode 100644
index 0000000..c235c06
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhIntBinding2.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.test.component.inheritance.types;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.interceptor.InterceptorBinding;
+
+@InterceptorBinding
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface InhIntBinding2
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhScopeType1.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhScopeType1.java
new file mode 100644
index 0000000..f94da32
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhScopeType1.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.test.component.inheritance.types;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.enterprise.context.NormalScope;
+
+@NormalScope
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface InhScopeType1
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhScopeType2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhScopeType2.java
new file mode 100644
index 0000000..75b69e7
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhScopeType2.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.test.component.inheritance.types;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.enterprise.context.NormalScope;
+
+@NormalScope
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface InhScopeType2
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhStereo1.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhStereo1.java
new file mode 100644
index 0000000..595f20f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhStereo1.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.test.component.inheritance.types;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.Stereotype;
+
+@Stereotype
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface InhStereo1
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhStereo2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhStereo2.java
new file mode 100644
index 0000000..1f26f8c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhStereo2.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.test.component.inheritance.types;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.Stereotype;
+
+@Stereotype
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface InhStereo2
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/alternative/AlternativeComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/alternative/AlternativeComponent.java
new file mode 100644
index 0000000..f27a67a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/alternative/AlternativeComponent.java
@@ -0,0 +1,27 @@
+/*
+ * 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.webbeans.test.component.inject.alternative;
+
+import javax.enterprise.inject.Alternative;
+
+@Alternative
+public class AlternativeComponent implements IAlternative
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/alternative/AlternativeInjector.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/alternative/AlternativeInjector.java
new file mode 100644
index 0000000..963e468
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/alternative/AlternativeInjector.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.test.component.inject.alternative;
+
+import javax.enterprise.inject.Default;
+import javax.inject.Inject;
+
+public class AlternativeInjector
+{
+ private @Inject @Default IAlternative alternative;
+
+ public IAlternative getAlternative()
+ {
+ return this.alternative;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/alternative/IAlternative.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/alternative/IAlternative.java
new file mode 100644
index 0000000..edac270
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/alternative/IAlternative.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.test.component.inject.alternative;
+
+public interface IAlternative
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/alternative/NotAlternativeComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/alternative/NotAlternativeComponent.java
new file mode 100644
index 0000000..93958f6
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/alternative/NotAlternativeComponent.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.test.component.inject.alternative;
+
+public class NotAlternativeComponent implements IAlternative
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/broken/InstanceInjectedBrokenComponent1.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/broken/InstanceInjectedBrokenComponent1.java
new file mode 100644
index 0000000..c3cc520
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/broken/InstanceInjectedBrokenComponent1.java
@@ -0,0 +1,29 @@
+/*
+ * 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.webbeans.test.component.inject.broken;
+
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+
+public class InstanceInjectedBrokenComponent1
+{
+ @Inject @Any Instance payment;
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/broken/InstanceInjectedBrokenComponent2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/broken/InstanceInjectedBrokenComponent2.java
new file mode 100644
index 0000000..daa95ec
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/broken/InstanceInjectedBrokenComponent2.java
@@ -0,0 +1,30 @@
+/*
+ * 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.webbeans.test.component.inject.broken;
+
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+import org.apache.webbeans.test.component.ITypeLiteralComponent;
+
+public class InstanceInjectedBrokenComponent2
+{
+ @Inject @Any Instance<ITypeLiteralComponent<?>> instance;
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/broken/InstanceInjectedBrokenComponent3.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/broken/InstanceInjectedBrokenComponent3.java
new file mode 100644
index 0000000..f1d2ef8
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/broken/InstanceInjectedBrokenComponent3.java
@@ -0,0 +1,29 @@
+/*
+ * 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.webbeans.test.component.inject.broken;
+
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+
+public class InstanceInjectedBrokenComponent3
+{
+ @Inject @Any Instance instance;
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/broken/InstanceInjectedBrokenComponent4.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/broken/InstanceInjectedBrokenComponent4.java
new file mode 100644
index 0000000..ff62acf
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/broken/InstanceInjectedBrokenComponent4.java
@@ -0,0 +1,29 @@
+/*
+ * 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.webbeans.test.component.inject.broken;
+
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+@SuppressWarnings("unchecked")
+public class InstanceInjectedBrokenComponent4
+{
+ @Inject @Any Instance instance;
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/generic/GenericComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/generic/GenericComponent.java
new file mode 100644
index 0000000..2b7ddb5
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/generic/GenericComponent.java
@@ -0,0 +1,30 @@
+/*
+ * 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.webbeans.test.component.inject.generic;
+
+import org.apache.webbeans.test.component.inject.parametrized.Persistent;
+
+public class GenericComponent<T extends Persistent> extends SuperGenericComponent<T>
+{
+ public void paramFunction(T paramInstance)
+ {
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/generic/GenericComponentInjector.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/generic/GenericComponentInjector.java
new file mode 100644
index 0000000..b1ab381
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/generic/GenericComponentInjector.java
@@ -0,0 +1,79 @@
+/*
+ * 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.webbeans.test.component.inject.generic;
+
+import javax.enterprise.inject.Default;
+import javax.inject.Inject;
+
+import org.apache.webbeans.test.component.inject.parametrized.Persistent;
+import org.apache.webbeans.test.component.inject.parametrized.PersistentSuper;
+
+public class GenericComponentInjector<Y extends Persistent>
+{
+ private @Inject @Default GenericComponent<?> injection1;
+
+ private @Inject @Default GenericComponent<? extends PersistentSuper> injection2;
+
+ private @Inject @Default GenericComponent<Persistent> injection3;
+
+ private @Inject @Default GenericComponent<Y> injection4;
+
+ public GenericComponent<?> getInjection1()
+ {
+ return injection1;
+ }
+
+ public void setInjection1(GenericComponent<?> injection1)
+ {
+ this.injection1 = injection1;
+ }
+
+ public GenericComponent<? extends PersistentSuper> getInjection2()
+ {
+ return injection2;
+ }
+
+ public void setInjection2(GenericComponent<? extends PersistentSuper> injection2)
+ {
+ this.injection2 = injection2;
+ }
+
+ public GenericComponent<Persistent> getInjection3()
+ {
+ return injection3;
+ }
+
+ public void setInjection3(GenericComponent<Persistent> injection3)
+ {
+ this.injection3 = injection3;
+ }
+
+ public GenericComponent<Y> getInjection4()
+ {
+ return injection4;
+ }
+
+ public void setInjection4(GenericComponent<Y> injection4)
+ {
+ this.injection4 = injection4;
+ }
+
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/generic/SuperGenericComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/generic/SuperGenericComponent.java
new file mode 100644
index 0000000..77ea4cc
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/generic/SuperGenericComponent.java
@@ -0,0 +1,26 @@
+/*
+ * 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.webbeans.test.component.inject.generic;
+
+import org.apache.webbeans.test.component.inject.parametrized.Persistent;
+
+public class SuperGenericComponent<T extends Persistent>
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/named/NamedFieldWithNamedValue.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/named/NamedFieldWithNamedValue.java
new file mode 100644
index 0000000..dd3b8f4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/named/NamedFieldWithNamedValue.java
@@ -0,0 +1,30 @@
+/*
+ * 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.webbeans.test.component.inject.named;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.webbeans.test.component.IPayment;
+
+public class NamedFieldWithNamedValue
+{
+ private @Inject @Named("payment") IPayment paymentProcessor;
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/named/NamedFieldWithoutNamedValue.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/named/NamedFieldWithoutNamedValue.java
new file mode 100644
index 0000000..cd0c78c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/named/NamedFieldWithoutNamedValue.java
@@ -0,0 +1,30 @@
+/*
+ * 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.webbeans.test.component.inject.named;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.webbeans.test.component.IPayment;
+
+public class NamedFieldWithoutNamedValue
+{
+ private @Inject @Named IPayment paymentProcessor;
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/named/NamedOtherWithNamedValue.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/named/NamedOtherWithNamedValue.java
new file mode 100644
index 0000000..76d0749
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/named/NamedOtherWithNamedValue.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.test.component.inject.named;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.webbeans.test.component.IPayment;
+
+public class NamedOtherWithNamedValue
+{
+ @Inject
+ public NamedOtherWithNamedValue(@Named("value") IPayment payment)
+ {
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/named/NamedOtherWithoutNamedValue.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/named/NamedOtherWithoutNamedValue.java
new file mode 100644
index 0000000..731dcea
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/named/NamedOtherWithoutNamedValue.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.test.component.inject.named;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.webbeans.test.component.IPayment;
+
+public class NamedOtherWithoutNamedValue
+{
+ @Inject
+ public NamedOtherWithoutNamedValue(@Named IPayment payment)
+ {
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/parametrized/BoundedTypeVariableComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/parametrized/BoundedTypeVariableComponent.java
new file mode 100644
index 0000000..f216338
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/parametrized/BoundedTypeVariableComponent.java
@@ -0,0 +1,41 @@
+/*
+ * 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.webbeans.test.component.inject.parametrized;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+public class BoundedTypeVariableComponent<T extends Number,Y>
+{
+ public Collection<T> field1;
+
+ public Collection<? extends Number> field2;
+
+ public Collection<Y> field3;
+
+ public Collection<List<?>> field4;
+
+ public Collection field5;
+
+ public Map<Y, Y> field6;
+
+ public Collection<Object> field7;
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/parametrized/Dao.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/parametrized/Dao.java
new file mode 100644
index 0000000..aa7625f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/parametrized/Dao.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.test.component.inject.parametrized;
+
+public class Dao<T extends Persistent>
+{
+ public Dao<T> t;
+
+ public Dao<?> check22;
+
+ public Dao<? extends Persistent> check22WithBound;
+
+ public Dao raw;
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/parametrized/Persistent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/parametrized/Persistent.java
new file mode 100644
index 0000000..fc50836
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/parametrized/Persistent.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.test.component.inject.parametrized;
+
+public class Persistent extends PersistentSuper
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/parametrized/PersistentSuper.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/parametrized/PersistentSuper.java
new file mode 100644
index 0000000..169c0e5
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/parametrized/PersistentSuper.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.test.component.inject.parametrized;
+
+public class PersistentSuper
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/parametrized/User.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/parametrized/User.java
new file mode 100644
index 0000000..e4a1308
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/parametrized/User.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.test.component.inject.parametrized;
+
+public class User extends Persistent
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/parametrized/UserDao.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/parametrized/UserDao.java
new file mode 100644
index 0000000..57819a6
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/parametrized/UserDao.java
@@ -0,0 +1,29 @@
+/*
+ * 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.webbeans.test.component.inject.parametrized;
+
+public class UserDao extends Dao<User>
+{
+
+ public Dao<User> field1;
+ public Dao<?> field2;
+ public Dao<? extends Persistent> field3;
+ public Dao<? extends User> field4;
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/parametrized/WithTypeVariable.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/parametrized/WithTypeVariable.java
new file mode 100644
index 0000000..513af64
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inject/parametrized/WithTypeVariable.java
@@ -0,0 +1,26 @@
+/*
+ * 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.webbeans.test.component.inject.parametrized;
+
+public class WithTypeVariable<X extends Persistent>
+{
+ public Dao<X> check4;
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/InterceptedComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/InterceptedComponent.java
new file mode 100644
index 0000000..d67a5de
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/InterceptedComponent.java
@@ -0,0 +1,45 @@
+/*
+ * 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.webbeans.test.component.intercept;
+
+import javax.enterprise.context.RequestScoped;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptors;
+import javax.interceptor.InvocationContext;
+
+
+@RequestScoped
+@Interceptors(value = { Interceptor1.class })
+public class InterceptedComponent
+{
+
+ public Object hello(Integer ss)
+ {
+ return ss;
+ }
+
+ @AroundInvoke
+ public Object intercept(InvocationContext context) throws Exception
+ {
+ context.setParameters(new Object[] { new Integer(5) });
+
+ return context.proceed();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/Interceptor1.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/Interceptor1.java
new file mode 100644
index 0000000..696012a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/Interceptor1.java
@@ -0,0 +1,50 @@
+/*
+ * 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.webbeans.test.component.intercept;
+
+import javax.annotation.PostConstruct;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+public class Interceptor1
+{
+ @AroundInvoke
+ public Object intercept(InvocationContext context) throws Exception
+ {
+ System.out.println("Interceptor class : " + Interceptor1.class.getSimpleName());
+ context.getContextData().put("key", "value");
+
+ return context.proceed();
+ }
+
+ @PostConstruct
+ public void construct(InvocationContext ctx) throws RuntimeException
+ {
+ ctx.getContextData().put("key1", "value1");
+ try
+ {
+ ctx.proceed();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/Interceptor2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/Interceptor2.java
new file mode 100644
index 0000000..5e3941b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/Interceptor2.java
@@ -0,0 +1,56 @@
+/*
+ * 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.webbeans.test.component.intercept;
+
+import javax.annotation.PostConstruct;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+import org.apache.webbeans.test.component.PostConstructDoubleInterceptorComponent;
+
+public class Interceptor2
+{
+ @AroundInvoke
+ public Object intercept(InvocationContext context) throws Exception
+ {
+ System.out.println("Interceptor class : " + Interceptor2.class.getSimpleName());
+
+ context.getContextData().put("key2", "value2");
+
+ return context.proceed();
+ }
+
+ @PostConstruct
+ public void construct(InvocationContext ctx) throws RuntimeException
+ {
+ try
+ {
+ String value = ctx.getContextData().get("key1").toString();
+ PostConstructDoubleInterceptorComponent.setValue( value);
+
+ ctx.proceed();
+
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/InterceptorWithSuperClass.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/InterceptorWithSuperClass.java
new file mode 100644
index 0000000..86c2ee2
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/InterceptorWithSuperClass.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.test.component.intercept;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+public class InterceptorWithSuperClass extends Interceptor1
+{
+ @Override
+ @AroundInvoke
+ public Object intercept(InvocationContext context) throws Exception
+ {
+ System.out.println("Interceptor class : " + InterceptorWithSuperClass.class.getSimpleName());
+ context.getContextData().put("key0", "value0");
+
+ return context.proceed();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/InterceptorWithSuperClassInterceptedComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/InterceptorWithSuperClassInterceptedComponent.java
new file mode 100644
index 0000000..ee87ed2
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/InterceptorWithSuperClassInterceptedComponent.java
@@ -0,0 +1,65 @@
+/*
+ * 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.webbeans.test.component.intercept;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import javax.enterprise.context.RequestScoped;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptors;
+import javax.interceptor.InvocationContext;
+
+
+@RequestScoped
+@Interceptors(value = { InterceptorWithSuperClass.class })
+public class InterceptorWithSuperClassInterceptedComponent
+{
+ String[] s = null;
+
+ public Object intercepted()
+ {
+ return s;
+ }
+
+ @AroundInvoke
+ public Object intercept(InvocationContext context) throws Exception
+ {
+ System.out.println("In Interceptor Method");
+ java.util.List<String> s = new ArrayList<String>();
+ Map<String, Object> map = context.getContextData();
+ Set<Entry<String, Object>> set = map.entrySet();
+ Iterator<Entry<String, Object>> it = set.iterator();
+ while (it.hasNext())
+ {
+ Entry<String, Object> s2 = it.next();
+ s.add(s2.getKey());
+
+ }
+
+ this.s = new String[s.size()];
+ this.s = s.toArray(this.s);
+
+ return context.proceed();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/MethodInterceptedWithClassInterceptorsComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/MethodInterceptedWithClassInterceptorsComponent.java
new file mode 100644
index 0000000..f6e3d6f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/MethodInterceptedWithClassInterceptorsComponent.java
@@ -0,0 +1,44 @@
+/*
+ * 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.webbeans.test.component.intercept;
+
+import javax.enterprise.context.RequestScoped;
+import javax.interceptor.Interceptors;
+import javax.interceptor.InvocationContext;
+
+
+@RequestScoped
+@Interceptors(value = { Interceptor1.class })
+public class MethodInterceptedWithClassInterceptorsComponent
+{
+
+ public Object hello(Integer ss)
+ {
+ return ss;
+ }
+
+ @Interceptors(value = { Interceptor2.class })
+ public Object intercept(InvocationContext context) throws Exception
+ {
+ context.setParameters(new Object[] { new Integer(5) });
+
+ return null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/MethodInterceptedWithoutClassInterceptorsComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/MethodInterceptedWithoutClassInterceptorsComponent.java
new file mode 100644
index 0000000..767f51b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/MethodInterceptedWithoutClassInterceptorsComponent.java
@@ -0,0 +1,46 @@
+/*
+ * 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.webbeans.test.component.intercept;
+
+import javax.enterprise.context.RequestScoped;
+import javax.interceptor.ExcludeClassInterceptors;
+import javax.interceptor.Interceptors;
+import javax.interceptor.InvocationContext;
+
+
+@RequestScoped
+@Interceptors(value = { Interceptor1.class })
+public class MethodInterceptedWithoutClassInterceptorsComponent
+{
+
+ public Object hello(Integer ss)
+ {
+ return ss;
+ }
+
+ @Interceptors(value = { Interceptor2.class })
+ @ExcludeClassInterceptors
+ public Object intercept(InvocationContext context) throws Exception
+ {
+ context.setParameters(new Object[] { new Integer(5) });
+
+ return null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/MultipleInterceptedComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/MultipleInterceptedComponent.java
new file mode 100644
index 0000000..4631705
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/MultipleInterceptedComponent.java
@@ -0,0 +1,65 @@
+/*
+ * 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.webbeans.test.component.intercept;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import javax.enterprise.context.RequestScoped;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptors;
+import javax.interceptor.InvocationContext;
+
+
+@RequestScoped
+@Interceptors(value = { Interceptor1.class, Interceptor2.class })
+public class MultipleInterceptedComponent
+{
+ String[] s = null;
+
+ public Object intercepted()
+ {
+ return s;
+ }
+
+ @AroundInvoke
+ public Object intercept(InvocationContext context) throws Exception
+ {
+ System.out.println("In Interceptor Method");
+ java.util.List<String> s = new ArrayList<String>();
+ Map<String, Object> map = context.getContextData();
+ Set<Entry<String, Object>> set = map.entrySet();
+ Iterator<Entry<String, Object>> it = set.iterator();
+ while (it.hasNext())
+ {
+ Entry<String, Object> s2 = it.next();
+ s.add(s2.getKey());
+
+ }
+
+ this.s = new String[s.size()];
+ this.s = s.toArray(this.s);
+
+ return context.proceed();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/MultipleListOfInterceptedComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/MultipleListOfInterceptedComponent.java
new file mode 100644
index 0000000..a66b2c1
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/MultipleListOfInterceptedComponent.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.test.component.intercept;
+
+import javax.enterprise.context.RequestScoped;
+import javax.interceptor.Interceptors;
+
+
+@RequestScoped
+@Interceptors(value = { Interceptor1.class })
+public class MultipleListOfInterceptedComponent
+{
+
+ @Interceptors(value = { Interceptor2.class })
+ public Object intercepted()
+ {
+ return "ok";
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/MultipleListOfInterceptedWithExcludeClassComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/MultipleListOfInterceptedWithExcludeClassComponent.java
new file mode 100644
index 0000000..78335f5
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/MultipleListOfInterceptedWithExcludeClassComponent.java
@@ -0,0 +1,50 @@
+/*
+ * 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.webbeans.test.component.intercept;
+
+import javax.enterprise.context.RequestScoped;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.ExcludeClassInterceptors;
+import javax.interceptor.Interceptors;
+import javax.interceptor.InvocationContext;
+
+
+@RequestScoped
+@Interceptors(value = { Interceptor1.class })
+public class MultipleListOfInterceptedWithExcludeClassComponent
+{
+
+ String s = null;
+
+ @Interceptors(value = { Interceptor2.class })
+ @ExcludeClassInterceptors
+ public Object intercepted()
+ {
+ return s;
+ }
+
+ @AroundInvoke
+ public Object intercept(InvocationContext context) throws Exception
+ {
+ this.s = context.getContextData().get("key2").toString();
+
+ return context.proceed();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/MultpleInterceptor.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/MultpleInterceptor.java
new file mode 100644
index 0000000..83e9e17
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/MultpleInterceptor.java
@@ -0,0 +1,44 @@
+/*
+ * 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.webbeans.test.component.intercept;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+public class MultpleInterceptor
+{
+ @AroundInvoke
+ public Object intercept(InvocationContext context) throws Exception
+ {
+ System.out.println("In Interception");
+ context.proceed();
+
+ return null;
+ }
+
+ @AroundInvoke
+ public Object intercept2(InvocationContext context) throws Exception
+ {
+ System.out.println("In Interception");
+ context.proceed();
+
+ return null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/NoArgConstructorInterceptor.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/NoArgConstructorInterceptor.java
new file mode 100644
index 0000000..18c49da
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/NoArgConstructorInterceptor.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.test.component.intercept;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+public class NoArgConstructorInterceptor
+{
+ public NoArgConstructorInterceptor(int i)
+ {
+
+ }
+
+ @AroundInvoke
+ public Object hello(InvocationContext ctx) throws Exception
+ {
+ return null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/NoArgConstructorInterceptorComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/NoArgConstructorInterceptorComponent.java
new file mode 100644
index 0000000..a65576b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/NoArgConstructorInterceptorComponent.java
@@ -0,0 +1,28 @@
+/*
+ * 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.webbeans.test.component.intercept;
+
+import javax.interceptor.Interceptors;
+
+
+@Interceptors(value = { NoArgConstructorInterceptor.class })
+public class NoArgConstructorInterceptorComponent
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/PostConstructInterceptor.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/PostConstructInterceptor.java
new file mode 100644
index 0000000..c141f4c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/PostConstructInterceptor.java
@@ -0,0 +1,47 @@
+/*
+ * 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.webbeans.test.component.intercept;
+
+import javax.annotation.PostConstruct;
+import javax.interceptor.InvocationContext;
+
+public class PostConstructInterceptor
+{
+ public PostConstructInterceptor()
+ {
+
+ }
+
+ @PostConstruct
+ public void init(InvocationContext context) throws RuntimeException
+ {
+ try
+ {
+ System.out.println("In Interceptor class : " + getClass().getName());
+
+ context.proceed();
+
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/ActionInterceptor.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/ActionInterceptor.java
new file mode 100644
index 0000000..79a3032
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/ActionInterceptor.java
@@ -0,0 +1,43 @@
+/*
+ * 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.webbeans.test.component.intercept.webbeans;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Action;
+
+/**
+ * This is an interceptor for an InterceptorBinding annotation (Action)
+ * which has another InterceptorBinding (Transactional) as meta-annotation.
+ */
+@Action
+@Interceptor
+public class ActionInterceptor
+{
+
+ @AroundInvoke
+ public Object call(InvocationContext context) throws Exception
+ {
+ WInterceptorComponent.sWithMeta = 10;
+ WMetaInterceptorComponent.sWithMeta = 10;
+ return context.proceed();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/SecureAndTransactionalComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/SecureAndTransactionalComponent.java
new file mode 100644
index 0000000..5b7b3ba
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/SecureAndTransactionalComponent.java
@@ -0,0 +1,44 @@
+/*
+ * 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.webbeans.test.component.intercept.webbeans;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Secure2;
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
+
+@Transactional
+@SessionScoped
+public class SecureAndTransactionalComponent implements Serializable
+{
+ static boolean CALL = false;
+
+ @Secure2
+ public void pay()
+ {
+
+ }
+
+ public static boolean getCALL()
+ {
+ return CALL;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/SecureAndTransactionalInterceptor.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/SecureAndTransactionalInterceptor.java
new file mode 100644
index 0000000..3ee859e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/SecureAndTransactionalInterceptor.java
@@ -0,0 +1,50 @@
+/*
+ * 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.webbeans.test.component.intercept.webbeans;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Secure2;
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
+
+@Interceptor
+@Secure2
+@Transactional
+public class SecureAndTransactionalInterceptor
+{
+
+ @AroundInvoke
+ public Object caller(InvocationContext context) throws Exception
+ {
+ try
+ {
+ SecureAndTransactionalComponent.CALL = true;
+ return context.proceed();
+
+ }catch(Exception e)
+ {
+ SecureAndTransactionalComponent.CALL = false;
+ }
+
+ return null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/SecureComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/SecureComponent.java
new file mode 100644
index 0000000..8e5becb
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/SecureComponent.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.component.intercept.webbeans;
+
+import javax.enterprise.context.RequestScoped;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Secure;
+
+@RequestScoped
+@Secure
+public class SecureComponent
+{
+ public boolean checkout()
+ {
+ return true;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/SecureInterceptor.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/SecureInterceptor.java
new file mode 100644
index 0000000..1a9d625
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/SecureInterceptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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.webbeans.test.component.intercept.webbeans;
+
+import javax.annotation.PostConstruct;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Secure;
+import org.apache.webbeans.util.ExceptionUtil;
+
+@Secure
+@Interceptor
+public class SecureInterceptor
+{
+ public static boolean CALL = false;
+
+ @PostConstruct
+ public void atCreationTime(InvocationContext ic)
+ {
+ try
+ {
+ ic.proceed();
+ }
+ catch (Exception e)
+ {
+ throw ExceptionUtil.throwAsRuntimeException(e);
+ }
+ }
+
+ @AroundInvoke
+ public Object manageTransaction(InvocationContext ctx) throws Exception
+ {
+ try
+ {
+ CALL = true;
+ return ctx.proceed();
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/ShoppingCard.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/ShoppingCard.java
new file mode 100644
index 0000000..73e2bc6
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/ShoppingCard.java
@@ -0,0 +1,47 @@
+/*
+ * 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.webbeans.test.component.intercept.webbeans;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
+
+@SessionScoped
+public class ShoppingCard implements Serializable
+{
+ static boolean CALLED = false;
+
+ @Transactional
+ public void placeOrder()
+ {
+
+ }
+
+ public void placeOrder2()
+ {
+ CALLED = false;
+ }
+
+ public static boolean getCALLED()
+ {
+ return CALLED;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/TransactionalInterceptor.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/TransactionalInterceptor.java
new file mode 100644
index 0000000..e4380d9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/TransactionalInterceptor.java
@@ -0,0 +1,48 @@
+/*
+ * 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.webbeans.test.component.intercept.webbeans;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
+
+@Interceptor
+@Transactional
+public class TransactionalInterceptor
+{
+
+ @AroundInvoke
+ public Object caller(InvocationContext context) throws Exception
+ {
+ try
+ {
+ ShoppingCard.CALLED = true;
+ return context.proceed();
+
+ }
+ catch(Exception e)
+ {
+ ShoppingCard.CALLED = false;
+ }
+
+ return null;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/TransactionalInterceptor2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/TransactionalInterceptor2.java
new file mode 100644
index 0000000..bf4a7bf
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/TransactionalInterceptor2.java
@@ -0,0 +1,42 @@
+/*
+ * 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.webbeans.test.component.intercept.webbeans;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
+
+@Transactional
+@Interceptor
+public class TransactionalInterceptor2
+{
+
+ @AroundInvoke
+ public Object call(InvocationContext context) throws Exception
+ {
+ System.out.println("Call Transactional Around Invoke");
+
+ WInterceptorComponent.s = 5;
+ WMetaInterceptorComponent.s = 5;
+
+ return context.proceed();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/WInterceptorComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/WInterceptorComponent.java
new file mode 100644
index 0000000..9684e6d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/WInterceptorComponent.java
@@ -0,0 +1,52 @@
+/*
+ * 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.webbeans.test.component.intercept.webbeans;
+
+import javax.enterprise.context.RequestScoped;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
+
+@Transactional
+@RequestScoped
+public class WInterceptorComponent
+{
+ static int s = 0;
+
+ static int sWithMeta = 0;
+
+ public int hello()
+ {
+ return s;
+ }
+
+ public int hello2()
+ {
+ return sWithMeta;
+ }
+
+ public static int getS()
+ {
+ return s;
+ }
+
+ public static int getSWITHMETA()
+ {
+ return sWithMeta;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/WMetaInterceptorComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/WMetaInterceptorComponent.java
new file mode 100644
index 0000000..d796dc4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/WMetaInterceptorComponent.java
@@ -0,0 +1,52 @@
+/*
+ * 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.webbeans.test.component.intercept.webbeans;
+
+import javax.enterprise.context.RequestScoped;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Action;
+
+@Action
+@RequestScoped
+public class WMetaInterceptorComponent
+{
+ static int s = 0;
+
+ static int sWithMeta = 0;
+
+ public int hello()
+ {
+ return s;
+ }
+
+ public int hello2()
+ {
+ return sWithMeta;
+ }
+
+ public static int getS()
+ {
+ return s;
+ }
+
+ public static int getSWITHMETA()
+ {
+ return sWithMeta;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/bindings/Action.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/bindings/Action.java
new file mode 100644
index 0000000..a82a02b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/bindings/Action.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.component.intercept.webbeans.bindings;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.interceptor.InterceptorBinding;
+
+@InterceptorBinding
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.TYPE, ElementType.METHOD })
+@Transactional
+public @interface Action {
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/bindings/RuntimeExceptions.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/bindings/RuntimeExceptions.java
new file mode 100644
index 0000000..c3e6e67
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/bindings/RuntimeExceptions.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.test.component.intercept.webbeans.bindings;
+
+import javax.interceptor.InterceptorBinding;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This test interceptor catches all Exceptions and
+ * returns RuntimeExceptions instead.
+ */
+@InterceptorBinding
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.TYPE, ElementType.METHOD })
+public @interface RuntimeExceptions
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/bindings/Secure.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/bindings/Secure.java
new file mode 100644
index 0000000..424fc4f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/bindings/Secure.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.test.component.intercept.webbeans.bindings;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.enterprise.util.Nonbinding;
+import javax.interceptor.InterceptorBinding;
+
+@InterceptorBinding
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.TYPE, ElementType.METHOD })
+@Transactional
+public @interface Secure {
+
+ @Nonbinding
+ String[] rolesAllowed() default {};
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/bindings/Secure2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/bindings/Secure2.java
new file mode 100644
index 0000000..e9062ce
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/bindings/Secure2.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.test.component.intercept.webbeans.bindings;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.enterprise.util.Nonbinding;
+import javax.interceptor.InterceptorBinding;
+
+@InterceptorBinding
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.TYPE, ElementType.METHOD })
+public @interface Secure2 {
+
+ @Nonbinding
+ String[] rolesAllowed() default {};
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/bindings/Transactional.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/bindings/Transactional.java
new file mode 100644
index 0000000..8aef4de
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/bindings/Transactional.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.component.intercept.webbeans.bindings;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.interceptor.InterceptorBinding;
+
+@InterceptorBinding
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.TYPE, ElementType.METHOD })
+public @interface Transactional
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/library/Book.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/library/Book.java
new file mode 100644
index 0000000..75f1631
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/library/Book.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.test.component.library;
+
+public class Book
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/library/BookShop.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/library/BookShop.java
new file mode 100644
index 0000000..f3a78b1
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/library/BookShop.java
@@ -0,0 +1,49 @@
+/*
+ * 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.webbeans.test.component.library;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Observes;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+import org.apache.webbeans.test.event.LoggedInEvent;
+
+@RequestScoped
+public class BookShop extends Business implements Shop<Book>
+{
+
+ @Override
+ public String shop()
+ {
+ return "shop";
+ }
+
+ @AroundInvoke
+ public Object intercept(InvocationContext context) throws Exception
+ {
+ return context.proceed();
+ }
+
+ public void observeSomething(@Observes LoggedInEvent lie)
+ {
+ // this is purely for checking if the Extension mechanism works
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/library/Business.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/library/Business.java
new file mode 100644
index 0000000..91163c7
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/library/Business.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.test.component.library;
+
+public class Business
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/library/Shop.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/library/Shop.java
new file mode 100644
index 0000000..afcd304
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/library/Shop.java
@@ -0,0 +1,25 @@
+/*
+ * 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.webbeans.test.component.library;
+
+public interface Shop<T>
+{
+
+ public String shop();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/literals/InstanceTypeLiteralBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/literals/InstanceTypeLiteralBean.java
new file mode 100644
index 0000000..aaafc5a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/literals/InstanceTypeLiteralBean.java
@@ -0,0 +1,50 @@
+/*
+ * 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.webbeans.test.component.literals;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.inject.Instance;
+import javax.enterprise.util.TypeLiteral;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@Named("literalBean")
+public class InstanceTypeLiteralBean
+{
+ public static interface IOrder<T>{}
+
+ public static class StringOrder implements IOrder<String>{}
+
+ public static class IntegerOrder implements IOrder<Integer>{}
+
+ private @Inject Instance<IOrder<?>> instance;
+
+ public Instance<?> produce(int type)
+ {
+ if(type == 0)
+ {
+ return instance.select(new TypeLiteral<IntegerOrder>(){}, new Annotation[0]);
+ }
+ else
+ {
+ return instance.select(new TypeLiteral<StringOrder>(){}, new Annotation[0]);
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/pfield/ProducerFieldDefinitionComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/pfield/ProducerFieldDefinitionComponent.java
new file mode 100644
index 0000000..2f538bf
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/pfield/ProducerFieldDefinitionComponent.java
@@ -0,0 +1,49 @@
+/*
+ * 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.webbeans.test.component.pfield;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+
+import org.apache.webbeans.test.annotation.binding.Synchronous;
+import org.apache.webbeans.test.component.PaymentProcessorComponent;
+
+@RequestScoped
+public class ProducerFieldDefinitionComponent
+{
+ @Produces @RequestScoped @Synchronous PaymentProcessorComponent paymentProcessor;
+
+ public ProducerFieldDefinitionComponent()
+ {
+
+ }
+
+ @Inject
+ public ProducerFieldDefinitionComponent(@Default PaymentProcessorComponent paymentProcessor)
+ {
+ this.paymentProcessor = paymentProcessor;
+ }
+
+ public boolean isExist()
+ {
+ return paymentProcessor != null ? true : false;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/pfield/ProducerFieldDefinitionParameterized.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/pfield/ProducerFieldDefinitionParameterized.java
new file mode 100644
index 0000000..02cf633
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/pfield/ProducerFieldDefinitionParameterized.java
@@ -0,0 +1,30 @@
+/*
+ * 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.webbeans.test.component.pfield;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.inject.Produces;
+
+public class ProducerFieldDefinitionParameterized
+{
+ private @Produces
+ List<Double> producedList = new ArrayList<Double>();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/pfield/ProducerFieldInjectedComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/pfield/ProducerFieldInjectedComponent.java
new file mode 100644
index 0000000..bde985c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/pfield/ProducerFieldInjectedComponent.java
@@ -0,0 +1,42 @@
+/*
+ * 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.webbeans.test.component.pfield;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+
+import org.apache.webbeans.test.annotation.binding.Synchronous;
+import org.apache.webbeans.test.component.PaymentProcessorComponent;
+
+@RequestScoped
+public class ProducerFieldInjectedComponent
+{
+ private @Inject @Synchronous PaymentProcessorComponent paymentProcessor;
+
+ public ProducerFieldInjectedComponent()
+ {
+
+ }
+
+ public PaymentProcessorComponent getPaymentProcessorName()
+ {
+ return this.paymentProcessor;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/pfield/ProducerFieldInjectedWrongType.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/pfield/ProducerFieldInjectedWrongType.java
new file mode 100644
index 0000000..98d016d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/pfield/ProducerFieldInjectedWrongType.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.component.pfield;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+public class ProducerFieldInjectedWrongType
+{
+ @Inject
+ private List<String> myList;
+
+ public List<String> getMyList()
+ {
+ return myList;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/pfield/broken/TypeVariableProducerField.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/pfield/broken/TypeVariableProducerField.java
new file mode 100644
index 0000000..94b110a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/pfield/broken/TypeVariableProducerField.java
@@ -0,0 +1,26 @@
+/*
+ * 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.webbeans.test.component.pfield.broken;
+
+import javax.enterprise.inject.Produces;
+
+public class TypeVariableProducerField<T>
+{
+ private @Produces T xt;
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/portable/PortableType1.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/portable/PortableType1.java
new file mode 100644
index 0000000..cd60294
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/portable/PortableType1.java
@@ -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.webbeans.test.component.portable;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.interceptor.Interceptor;
+
+import org.apache.webbeans.test.annotation.binding.Binding1;
+import org.apache.webbeans.test.annotation.binding.Binding2;
+import org.apache.webbeans.test.component.CheckWithCheckPayment;
+import org.apache.webbeans.test.component.IPayment;
+import org.apache.webbeans.test.component.inject.parametrized.Dao;
+import org.apache.webbeans.test.component.library.Book;
+import org.apache.webbeans.test.event.LoggedInEvent;
+import org.apache.webbeans.test.xml.annot.BindingType1;
+import org.apache.webbeans.test.xml.annot.BindingType2;
+
+@Default
+@Binding1
+@Binding2
+@Interceptor
+@Named
+public class PortableType1
+{
+ private @Default IPayment payment;
+
+ private @Binding2 @Default Book book;
+
+ private @Produces @BindingType2 CheckWithCheckPayment check;
+
+ @Inject
+ public PortableType1()
+ {
+
+ }
+
+ @Produces
+ public Dao<?> getDao(@BindingType1 String hio)
+ {
+ return null;
+ }
+
+ public void notify(@Observes @Binding2 LoggedInEvent event)
+ {
+
+ }
+
+ public IPayment getPayment()
+ {
+ return payment;
+ }
+
+ public void setPayment(IPayment payment)
+ {
+ this.payment = payment;
+ }
+
+ public Book getBook()
+ {
+ return book;
+ }
+
+ public void setBook(Book book)
+ {
+ this.book = book;
+ }
+
+ public CheckWithCheckPayment getCheck()
+ {
+ return check;
+ }
+
+ public void setCheck(CheckWithCheckPayment check)
+ {
+ this.check = check;
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/portable/events/MyExtension.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/portable/events/MyExtension.java
new file mode 100644
index 0000000..774aec2
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/portable/events/MyExtension.java
@@ -0,0 +1,114 @@
+/*
+ * 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.webbeans.test.component.portable.events;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.AfterDeploymentValidation;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.BeforeShutdown;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+import javax.enterprise.inject.spi.ProcessBean;
+import javax.enterprise.inject.spi.ProcessInjectionTarget;
+import javax.enterprise.inject.spi.ProcessObserverMethod;
+import javax.enterprise.inject.spi.ProcessProducer;
+
+/**
+ * Test extension which only sets a few static members which will be validated in a test case.
+ */
+public class MyExtension implements Extension
+{
+ public static ProcessAnnotatedType<?> processAnnotatedTypeEvent;
+ public static BeforeBeanDiscovery lastBeforeBeanDiscovery;
+ public static AfterBeanDiscovery lastAfterBeanDiscovery;
+ public static BeforeShutdown beforeShutdownEvent;
+ public static AfterDeploymentValidation afterDeploymentValidation;
+ public static ProcessInjectionTarget<?> processInjectionTarget;
+ public static ProcessProducer<?,?> processProducer;
+ public static ProcessBean<?> processBean;
+ public static ProcessObserverMethod<?, ?> processObserverMethod;
+
+
+ /**
+ * Reset all static fields before the test starts
+ */
+ public static void reset() {
+ processAnnotatedTypeEvent = null;
+ lastBeforeBeanDiscovery = null;
+ lastAfterBeanDiscovery = null;
+ beforeShutdownEvent = null;
+ afterDeploymentValidation = null;
+ processInjectionTarget = null;
+ processProducer = null;
+ processBean = null;
+ processObserverMethod = null;
+ }
+
+ public MyExtension()
+ {
+ }
+
+ public void observeBeforeBeanDiscovery(@Observes BeforeBeanDiscovery beforeBean)
+ {
+ lastBeforeBeanDiscovery = beforeBean;
+ }
+
+ public void observeAfterBeanDiscovery(@Observes AfterBeanDiscovery afterBean, BeanManager beanManager)
+ {
+ lastAfterBeanDiscovery = afterBean;
+ }
+
+ public void observeAfterDeploymentValidation(@Observes AfterDeploymentValidation adv, BeanManager bm)
+ {
+ afterDeploymentValidation = adv;
+ }
+
+ public void observeShutdownEvent(@Observes BeforeShutdown bs, BeanManager bm)
+ {
+ beforeShutdownEvent = bs;
+ }
+
+ public void observeProcessAnnotatedTypeEvent(@Observes ProcessAnnotatedType<?> annotatedType)
+ {
+ processAnnotatedTypeEvent = annotatedType;
+ }
+
+ public <T> void observeProcessInjectionTarget(@Observes ProcessInjectionTarget<T> pit)
+ {
+ processInjectionTarget = pit;
+ }
+
+ public <T, X> void observeProcessProducer(@Observes ProcessProducer<T, X> pp)
+ {
+ processProducer = pp;
+ }
+
+ public <X> void observeProcessBean(@Observes ProcessBean<X> pb)
+ {
+ processBean = pb;
+ }
+
+ public <X, T> void processObserverMethod(@Observes ProcessObserverMethod<X, T> pom)
+ {
+ processObserverMethod = pom;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/ParametrizedModel1.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/ParametrizedModel1.java
new file mode 100644
index 0000000..1f11d0d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/ParametrizedModel1.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.test.component.producer;
+
+public class ParametrizedModel1
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/ParametrizedModel2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/ParametrizedModel2.java
new file mode 100644
index 0000000..e0034d0
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/ParametrizedModel2.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.test.component.producer;
+
+public class ParametrizedModel2
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/ParametrizedProducer.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/ParametrizedProducer.java
new file mode 100644
index 0000000..ca7dd94
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/ParametrizedProducer.java
@@ -0,0 +1,58 @@
+/*
+ * 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.webbeans.test.component.producer;
+
+import java.util.List;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Produces;
+
+
+@RequestScoped
+public class ParametrizedProducer
+{
+ static boolean callModel1 = false;
+
+ static boolean callModel2 = false;
+
+ @Produces
+ public List<ParametrizedModel1> getModel1()
+ {
+ callModel1 = true;
+ return null;
+ }
+
+ @Produces
+ public List<ParametrizedModel2> getModel2()
+ {
+ callModel2 = true;
+ return null;
+ }
+
+ public static boolean getCALLMODEL1()
+ {
+ return callModel1;
+ }
+
+ public static boolean getCALLMODEL2()
+ {
+ return callModel2;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/Producer1.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/Producer1.java
new file mode 100644
index 0000000..56340a9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/Producer1.java
@@ -0,0 +1,43 @@
+/*
+ * 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.webbeans.test.component.producer;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+import org.apache.webbeans.test.annotation.binding.Binding1;
+import org.apache.webbeans.test.annotation.binding.ProducerBinding1;
+import org.apache.webbeans.test.component.service.IService;
+
+@RequestScoped
+@Named("producer")
+public class Producer1
+{
+ @Produces
+ @ApplicationScoped
+ @ProducerBinding1
+ @Named
+ public IService getService(@Binding1 IService service)
+ {
+ return service;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/Producer2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/Producer2.java
new file mode 100644
index 0000000..7309f40
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/Producer2.java
@@ -0,0 +1,46 @@
+/*
+ * 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.webbeans.test.component.producer;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Produces;
+
+import org.apache.webbeans.test.annotation.binding.Binding1;
+import org.apache.webbeans.test.annotation.binding.Binding2;
+import org.apache.webbeans.test.component.service.IService;
+
+public class Producer2
+{
+ @Produces
+ @RequestScoped
+ @Binding1
+ public IService getService(@Binding1 IService service)
+ {
+ return service;
+ }
+
+ @Produces
+ @RequestScoped
+ @Binding2
+ public IService getService2(@Binding1 IService service)
+ {
+ return service;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/Producer3.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/Producer3.java
new file mode 100644
index 0000000..6f1aed9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/Producer3.java
@@ -0,0 +1,51 @@
+/*
+ * 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.webbeans.test.component.producer;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Produces;
+
+
+@RequestScoped
+public class Producer3
+{
+ @Produces
+ public int producer()
+ {
+ return 0;
+ }
+
+ @Produces
+ public int[] producer2()
+ {
+ return new int[0];
+ }
+
+ @Produces
+ public Integer producer3()
+ {
+ return new Integer(5);
+ }
+
+ @Produces
+ public Integer[] producer4()
+ {
+ return new Integer[0];
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/Producer4.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/Producer4.java
new file mode 100644
index 0000000..ab4f766
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/Producer4.java
@@ -0,0 +1,39 @@
+/*
+ * 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.webbeans.test.component.producer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.inject.Produces;
+
+import org.apache.webbeans.test.annotation.binding.Users;
+
+public class Producer4
+{
+ @Produces
+ @Users
+ public List<User> getUsers()
+ {
+ List<User> users = new ArrayList<User>();
+ users.add(new User("1", "1", "1"));
+ return users;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/Producer4ConsumerComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/Producer4ConsumerComponent.java
new file mode 100644
index 0000000..1ceb61d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/Producer4ConsumerComponent.java
@@ -0,0 +1,39 @@
+/*
+ * 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.webbeans.test.component.producer;
+
+import java.io.Serializable;
+import java.util.List;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+
+import org.apache.webbeans.test.annotation.binding.Users;
+
+@SessionScoped
+public class Producer4ConsumerComponent implements Serializable
+{
+ private @Inject @Users List<User> users;
+
+ public int count()
+ {
+ return users.size();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/ScopeAdaptorComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/ScopeAdaptorComponent.java
new file mode 100644
index 0000000..a231199
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/ScopeAdaptorComponent.java
@@ -0,0 +1,43 @@
+/*
+ * 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.webbeans.test.component.producer;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+import org.apache.webbeans.test.annotation.binding.Binding2;
+import org.apache.webbeans.test.annotation.binding.Check;
+import org.apache.webbeans.test.component.IPayment;
+
+@SessionScoped
+@Named
+public class ScopeAdaptorComponent implements Serializable
+{
+ @Produces
+ @SessionScoped
+ @Binding2
+ @Named
+ public IPayment scope(@Check(type = "CHECK") IPayment payment)
+ {
+ return payment;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/ScopeAdaptorInjectorComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/ScopeAdaptorInjectorComponent.java
new file mode 100644
index 0000000..8659fa6
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/ScopeAdaptorInjectorComponent.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.test.component.producer;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Named;
+
+import org.apache.webbeans.test.annotation.binding.Binding2;
+import org.apache.webbeans.test.component.IPayment;
+
+@SessionScoped
+@Named
+public class ScopeAdaptorInjectorComponent implements Serializable
+{
+ @Binding2
+ IPayment payment;
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/StaticProducer1.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/StaticProducer1.java
new file mode 100644
index 0000000..4115167
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/StaticProducer1.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.component.producer;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+@RequestScoped
+public class StaticProducer1
+{
+ public StaticProducer1()
+ {
+
+ }
+
+ @Produces
+ @Named
+ public static int getWeight()
+ {
+ return 79;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/User.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/User.java
new file mode 100644
index 0000000..4d4968e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/User.java
@@ -0,0 +1,28 @@
+/*
+ * 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.webbeans.test.component.producer;
+
+public class User
+{
+ public User(String x, String y, String z)
+ {
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/broken/BrokenProducerComponent1.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/broken/BrokenProducerComponent1.java
new file mode 100644
index 0000000..906ac4a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/broken/BrokenProducerComponent1.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.test.component.producer.broken;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+
+public class BrokenProducerComponent1
+{
+ public BrokenProducerComponent1()
+ {
+
+ }
+
+ @Produces
+ @Inject
+ public int broken1()
+ {
+ return 0;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/broken/BrokenProducerComponent2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/broken/BrokenProducerComponent2.java
new file mode 100644
index 0000000..6b41985
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/broken/BrokenProducerComponent2.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.test.component.producer.broken;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+
+public class BrokenProducerComponent2
+{
+ public BrokenProducerComponent2()
+ {
+
+ }
+
+ @Produces
+ @Inject
+ public int broken2()
+ {
+ return 0;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/broken/BrokenProducerComponent3.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/broken/BrokenProducerComponent3.java
new file mode 100644
index 0000000..592e214
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/broken/BrokenProducerComponent3.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.test.component.producer.broken;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+
+public class BrokenProducerComponent3
+{
+ public BrokenProducerComponent3()
+ {
+
+ }
+
+ @Produces
+ public int broken3(@Observes @Disposes int y)
+ {
+ return 0;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/broken/BrokenProducerComponent4.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/broken/BrokenProducerComponent4.java
new file mode 100644
index 0000000..cb74b4f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/broken/BrokenProducerComponent4.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.test.component.producer.broken;
+
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+
+
+public class BrokenProducerComponent4
+{
+ public BrokenProducerComponent4()
+ {
+
+ }
+
+ @Produces
+ public int broken4(@Disposes int x)
+ {
+ return 0;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/broken/BrokenProducerComponent5.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/broken/BrokenProducerComponent5.java
new file mode 100644
index 0000000..90e04e7
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/broken/BrokenProducerComponent5.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.test.component.producer.broken;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Produces;
+
+public class BrokenProducerComponent5
+{
+ public BrokenProducerComponent5()
+ {
+
+ }
+
+ @Produces
+ public int broken5(@Observes int y)
+ {
+ return 0;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/broken/BrokenProducerComponent6.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/broken/BrokenProducerComponent6.java
new file mode 100644
index 0000000..f05c063
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/broken/BrokenProducerComponent6.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.test.component.producer.broken;
+
+import java.util.List;
+
+import javax.enterprise.inject.Produces;
+
+public class BrokenProducerComponent6
+{
+ public BrokenProducerComponent6()
+ {
+
+ }
+
+ @Produces
+ public List<?> broken6()
+ {
+ return null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/primitive/PrimitiveConsumer.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/primitive/PrimitiveConsumer.java
new file mode 100644
index 0000000..233e716
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/primitive/PrimitiveConsumer.java
@@ -0,0 +1,45 @@
+/*
+ * 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.webbeans.test.component.producer.primitive;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.webbeans.test.annotation.binding.Binding1;
+import org.apache.webbeans.test.annotation.binding.Binding2;
+
+@RequestScoped
+@Named
+public class PrimitiveConsumer
+{
+ private @Inject @Binding1 @Binding2 Float primitiveProducer;
+
+ public PrimitiveConsumer()
+ {
+
+ }
+
+
+ public float getSalary()
+ {
+ return this.primitiveProducer;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/primitive/PrimitiveProducer.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/primitive/PrimitiveProducer.java
new file mode 100644
index 0000000..0a9c97b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/primitive/PrimitiveProducer.java
@@ -0,0 +1,42 @@
+/*
+ * 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.webbeans.test.component.producer.primitive;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.Produces;
+
+import org.apache.webbeans.test.annotation.binding.Binding1;
+import org.apache.webbeans.test.annotation.binding.Binding2;
+
+public class PrimitiveProducer
+{
+ public PrimitiveProducer()
+ {
+
+ }
+
+ @Produces
+ @Binding1
+ @Binding2
+ @Dependent
+ public Float getSalary()
+ {
+ return 56.7f;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/SpecializesProducer1.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/SpecializesProducer1.java
new file mode 100644
index 0000000..abc98ed
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/SpecializesProducer1.java
@@ -0,0 +1,43 @@
+/*
+ * 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.webbeans.test.component.producer.specializes;
+
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.Specializes;
+import javax.inject.Named;
+
+import org.apache.webbeans.test.component.producer.specializes.superclazz.SpecializesProducer1SuperClazz;
+
+public class SpecializesProducer1 extends SpecializesProducer1SuperClazz
+{
+
+ public SpecializesProducer1()
+ {
+
+ }
+
+ @Produces
+ @Override
+ @Specializes
+ @Named("specializedNumber")
+ public int createMaxNumber()
+ {
+ return 10000;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/superclazz/SpecializesProducer1SuperClazz.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/superclazz/SpecializesProducer1SuperClazz.java
new file mode 100644
index 0000000..4ca60eb
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/superclazz/SpecializesProducer1SuperClazz.java
@@ -0,0 +1,41 @@
+/*
+ * 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.webbeans.test.component.producer.specializes.superclazz;
+
+import javax.enterprise.inject.Produces;
+
+import org.apache.webbeans.test.annotation.binding.Binding1;
+import org.apache.webbeans.test.annotation.binding.Binding2;
+
+public class SpecializesProducer1SuperClazz
+{
+
+ public SpecializesProducer1SuperClazz()
+ {
+
+ }
+
+ @Produces
+ @Binding1
+ @Binding2
+ public int createMaxNumber()
+ {
+ return Integer.MAX_VALUE;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/IService.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/IService.java
new file mode 100644
index 0000000..3d24004
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/IService.java
@@ -0,0 +1,25 @@
+/*
+ * 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.webbeans.test.component.service;
+
+public interface IService
+{
+
+ public String service();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/ITyped.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/ITyped.java
new file mode 100644
index 0000000..2255a93
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/ITyped.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.test.component.service;
+
+public interface ITyped<T>
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/ITyped2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/ITyped2.java
new file mode 100644
index 0000000..fd06c17
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/ITyped2.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.test.component.service;
+
+public interface ITyped2<K, V>
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/InjectedComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/InjectedComponent.java
new file mode 100644
index 0000000..92b2654
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/InjectedComponent.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.test.component.service;
+
+import javax.enterprise.context.ApplicationScoped;
+
+import org.apache.webbeans.test.annotation.binding.Binding1;
+
+@ApplicationScoped
+public class InjectedComponent
+{
+ private @Binding1
+ IService service;
+
+ public void setService(@Binding1 IService service)
+ {
+ System.out.println("Field Service " + this.service);
+ System.out.println("Method Service " + service);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/Producer1ConsumerComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/Producer1ConsumerComponent.java
new file mode 100644
index 0000000..87f3244
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/Producer1ConsumerComponent.java
@@ -0,0 +1,38 @@
+/*
+ * 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.webbeans.test.component.service;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.webbeans.test.annotation.binding.ProducerBinding1;
+
+@RequestScoped
+@Named
+public class Producer1ConsumerComponent
+{
+ private @Inject @ProducerBinding1 IService service;
+
+ public IService getService()
+ {
+ return service;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/ServiceImpl1.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/ServiceImpl1.java
new file mode 100644
index 0000000..65846c9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/ServiceImpl1.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.test.component.service;
+
+import javax.enterprise.context.ApplicationScoped;
+
+import org.apache.webbeans.test.annotation.binding.Binding1;
+
+@Binding1
+@ApplicationScoped
+public class ServiceImpl1 implements IService
+{
+
+ @Override
+ public String service()
+ {
+ return "ServiceImpl1";
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/Typed2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/Typed2.java
new file mode 100644
index 0000000..47e6e79
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/Typed2.java
@@ -0,0 +1,52 @@
+/*
+ * 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.webbeans.test.component.service;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+
+import org.apache.webbeans.test.annotation.binding.Binding1;
+import org.apache.webbeans.test.annotation.binding.Binding2;
+
+@SessionScoped
+@Binding1
+@Binding2
+public class Typed2 implements ITyped2<String, Object>, Serializable
+{
+ private boolean value = false;
+
+ /**
+ * @return the value
+ */
+ public boolean isValue()
+ {
+ return value;
+ }
+
+ /**
+ * @param value the value to set
+ */
+ public void setValue(boolean value)
+ {
+ this.value = value;
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/TypedComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/TypedComponent.java
new file mode 100644
index 0000000..13108b8
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/TypedComponent.java
@@ -0,0 +1,25 @@
+/*
+ * 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.webbeans.test.component.service;
+
+
+public class TypedComponent implements ITyped<String>
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/TypedInjection.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/TypedInjection.java
new file mode 100644
index 0000000..4e2ce22
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/TypedInjection.java
@@ -0,0 +1,39 @@
+/*
+ * 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.webbeans.test.component.service;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+
+import org.apache.webbeans.test.annotation.binding.Binding1;
+import org.apache.webbeans.test.annotation.binding.Binding2;
+
+@SessionScoped
+public class TypedInjection implements Serializable
+{
+ @Inject @Binding1 @Binding2 ITyped2<String, Object> v = null;
+
+ public ITyped2<String, Object> getV()
+ {
+ return v;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/TypedInjectionWithoutArguments.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/TypedInjectionWithoutArguments.java
new file mode 100644
index 0000000..940b0bb
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/service/TypedInjectionWithoutArguments.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.component.service;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+
+import org.apache.webbeans.test.annotation.binding.Binding1;
+import org.apache.webbeans.test.annotation.binding.Binding2;
+
+@SessionScoped
+@SuppressWarnings("unchecked")
+public class TypedInjectionWithoutArguments implements Serializable
+{
+ @Inject @Binding1 @Binding2 ITyped2<String, Object> v = null;
+
+ public ITyped2<String, Object> getV()
+ {
+ return v;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/AsynhrounousSpecalizesService.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/AsynhrounousSpecalizesService.java
new file mode 100644
index 0000000..9d13d72
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/AsynhrounousSpecalizesService.java
@@ -0,0 +1,31 @@
+/*
+ * 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.webbeans.test.component.specializes;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Default;
+import javax.inject.Named;
+
+import org.apache.webbeans.test.annotation.binding.Asynchronous;
+
+@Default @Asynchronous @Named("asyncService") @RequestScoped
+public class AsynhrounousSpecalizesService implements ServiceForSpecializes
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/ServiceForSpecializes.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/ServiceForSpecializes.java
new file mode 100644
index 0000000..30a30b5
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/ServiceForSpecializes.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.test.component.specializes;
+
+public interface ServiceForSpecializes
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/SpecializesServiceInjectorComponent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/SpecializesServiceInjectorComponent.java
new file mode 100644
index 0000000..f50cbeb
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/SpecializesServiceInjectorComponent.java
@@ -0,0 +1,47 @@
+/*
+ * 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.webbeans.test.component.specializes;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Default;
+import javax.inject.Inject;
+
+import org.apache.webbeans.test.annotation.binding.Asynchronous;
+
+@RequestScoped
+public class SpecializesServiceInjectorComponent
+{
+ @Inject @Default @Asynchronous ServiceForSpecializes service;
+
+ public SpecializesServiceInjectorComponent()
+ {
+
+ }
+
+ /**
+ * @return the service
+ */
+ public ServiceForSpecializes getService()
+ {
+ return service;
+ }
+
+
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/logger/DefaultLogger.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/logger/DefaultLogger.java
new file mode 100644
index 0000000..5e89acd
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/logger/DefaultLogger.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.test.component.specializes.logger;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface DefaultLogger {
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/logger/ISomeLogger.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/logger/ISomeLogger.java
new file mode 100644
index 0000000..ab4fa1e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/logger/ISomeLogger.java
@@ -0,0 +1,25 @@
+/*
+ * 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.webbeans.test.component.specializes.logger;
+
+public interface ISomeLogger
+{
+ public void printError(String errorMessage);
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/logger/LoggerBinding.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/logger/LoggerBinding.java
new file mode 100644
index 0000000..c269523
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/logger/LoggerBinding.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.test.component.specializes.logger;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface LoggerBinding {
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/logger/MockNotSpecializedLogger.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/logger/MockNotSpecializedLogger.java
new file mode 100644
index 0000000..5f14873
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/logger/MockNotSpecializedLogger.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.component.specializes.logger;
+
+import javax.enterprise.inject.Alternative;
+
+@LoggerBinding
+@Alternative
+public class MockNotSpecializedLogger extends SystemLogger
+{
+ private String message;
+
+ @Override
+ public void printError(String errorMessage)
+ {
+ this.message = errorMessage;
+ }
+
+ @Override
+ public String getMessage()
+ {
+ return this.message;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/logger/MockSpecializedLogger.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/logger/MockSpecializedLogger.java
new file mode 100644
index 0000000..2dc0449
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/logger/MockSpecializedLogger.java
@@ -0,0 +1,42 @@
+/*
+ * 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.webbeans.test.component.specializes.logger;
+
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Specializes;
+
+@LoggerBinding
+@Alternative
+@Specializes
+public class MockSpecializedLogger extends SystemLogger
+{
+ private String message;
+
+ @Override
+ public void printError(String errorMessage)
+ {
+ this.message = errorMessage;
+ }
+
+ @Override
+ public String getMessage()
+ {
+ return this.message;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/logger/SpecializedInjector.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/logger/SpecializedInjector.java
new file mode 100644
index 0000000..1a89f71
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/logger/SpecializedInjector.java
@@ -0,0 +1,31 @@
+/*
+ * 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.webbeans.test.component.specializes.logger;
+
+import javax.inject.Inject;
+
+public class SpecializedInjector
+{
+ private @Inject @DefaultLogger ISomeLogger logger;
+
+ public ISomeLogger logger()
+ {
+ return logger;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/logger/SystemLogger.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/logger/SystemLogger.java
new file mode 100644
index 0000000..c981283
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/specializes/logger/SystemLogger.java
@@ -0,0 +1,37 @@
+/*
+ * 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.webbeans.test.component.specializes.logger;
+
+@LoggerBinding
+@DefaultLogger
+public class SystemLogger implements ISomeLogger
+{
+ private String message;
+
+ @Override
+ public void printError(String errorMessage)
+ {
+ this.message = errorMessage;
+ }
+
+ public String getMessage()
+ {
+ return this.message;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/containertests/ComponentResolutionByTypeTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/containertests/ComponentResolutionByTypeTest.java
new file mode 100644
index 0000000..f6dd818
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/containertests/ComponentResolutionByTypeTest.java
@@ -0,0 +1,100 @@
+/*
+ * 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.webbeans.test.containertests;
+
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.annotation.binding.AnnotationWithBindingMember;
+import org.apache.webbeans.test.annotation.binding.AnnotationWithNonBindingMember;
+import org.apache.webbeans.test.component.BindingComponent;
+import org.apache.webbeans.test.component.NonBindingComponent;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ComponentResolutionByTypeTest extends TestContext
+{
+ public @AnnotationWithBindingMember(value = "B", number = 3)
+ BindingComponent s1 = null;
+ public @AnnotationWithBindingMember(value = "B")
+ BindingComponent s2 = null;
+
+ public @AnnotationWithNonBindingMember(value = "B", arg1 = "arg1", arg2 = "arg2")
+ NonBindingComponent s3 = null;
+ public @AnnotationWithNonBindingMember(value = "B", arg1 = "arg11", arg2 = "arg21")
+ NonBindingComponent s4 = null;
+ public @AnnotationWithNonBindingMember(value = "C", arg1 = "arg11", arg2 = "arg21")
+ NonBindingComponent s5 = null;
+
+ private BeanManagerImpl cont;
+
+ private static final String CLAZZ_NAME = ComponentResolutionByTypeTest.class.getName();
+
+ public ComponentResolutionByTypeTest()
+ {
+ super(CLAZZ_NAME);
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ cont = WebBeansContext.getInstance().getBeanManagerImpl();
+ }
+
+
+ @Test
+ public void testBindingTypeOk() throws Throwable
+ {
+ cont.getBeans(BindingComponent.class, ComponentResolutionByTypeTest.class.getDeclaredField("s1").getAnnotations());
+ }
+
+ @Test
+ public void testBindingTypeNonOk() throws Throwable
+ {
+ cont.getBeans(BindingComponent.class, ComponentResolutionByTypeTest.class.getDeclaredField("s2").getAnnotations());
+ }
+
+ @Test
+ public void testNonBindingTypeOk1() throws Throwable
+ {
+ cont.getBeans(NonBindingComponent.class, ComponentResolutionByTypeTest.class.getDeclaredField("s3").getAnnotations());
+ }
+
+ @Test
+ public void testNonBindingTypeOk2() throws Throwable
+ {
+ Set<Bean<?>> beans = cont.getBeans(NonBindingComponent.class, ComponentResolutionByTypeTest.class.getDeclaredField("s4").getAnnotations());
+ Assert.assertNotNull(beans);
+ Assert.assertTrue(beans.isEmpty());
+ }
+
+ @Test
+ public void testNonBindingTypeNonOk() throws Throwable
+ {
+ cont.getBeans(NonBindingComponent.class, ComponentResolutionByTypeTest.class.getDeclaredField("s5").getAnnotations());
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/event/ITypeArgumentEventInterface.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/event/ITypeArgumentEventInterface.java
new file mode 100644
index 0000000..8407874
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/event/ITypeArgumentEventInterface.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.test.event;
+
+public interface ITypeArgumentEventInterface
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/event/LoggedInEvent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/event/LoggedInEvent.java
new file mode 100644
index 0000000..237c0ab
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/event/LoggedInEvent.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.event;
+
+public class LoggedInEvent
+{
+ private String userName;
+
+ public LoggedInEvent()
+ {
+
+ }
+
+ public LoggedInEvent(String userName)
+ {
+ this.userName = userName;
+ }
+
+ public String getUserName()
+ {
+ return this.userName;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/event/LoggedInObserver.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/event/LoggedInObserver.java
new file mode 100644
index 0000000..17ffab8
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/event/LoggedInObserver.java
@@ -0,0 +1,90 @@
+/*
+ * 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.webbeans.test.event;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.event.Reception;
+import javax.enterprise.event.TransactionPhase;
+import javax.enterprise.inject.spi.ObserverMethod;
+
+/**
+ * Test mock ObserverMethod which observes a LoggedInEvent
+ */
+public class LoggedInObserver implements ObserverMethod<LoggedInEvent>
+{
+ private String result = null;
+
+ private final Set<Annotation> qualifiers;
+
+ public LoggedInObserver(Set<Annotation> anns)
+ {
+ this.qualifiers = anns;
+ }
+
+ @Override
+ public void notify(LoggedInEvent event)
+ {
+ result = "ok";
+ }
+
+ /**
+ * @return the result
+ */
+ public String getResult()
+ {
+ return result;
+ }
+
+ /**
+ * @param result the result to set
+ */
+ public void setResult(String result)
+ {
+ this.result = result;
+ }
+
+ @Override
+ public Class<?> getBeanClass() {
+ return null;
+ }
+
+ @Override
+ public Set<Annotation> getObservedQualifiers() {
+ return qualifiers;
+ }
+
+ @Override
+ public Type getObservedType() {
+ return LoggedInEvent.class;
+ }
+
+ @Override
+ public Reception getReception() {
+ return Reception.ALWAYS;
+ }
+
+ @Override
+ public TransactionPhase getTransactionPhase() {
+ return TransactionPhase.IN_PROGRESS;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentBaseEvent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentBaseEvent.java
new file mode 100644
index 0000000..552f590
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentBaseEvent.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.test.event;
+
+public abstract class TypeArgumentBaseEvent implements ITypeArgumentEventInterface
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentEvent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentEvent.java
new file mode 100644
index 0000000..29c1671
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentEvent.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.test.event;
+
+public class TypeArgumentEvent extends TypeArgumentBaseEvent
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentInterfaceObserver.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentInterfaceObserver.java
new file mode 100644
index 0000000..6da71f0
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentInterfaceObserver.java
@@ -0,0 +1,79 @@
+/*
+ * 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.webbeans.test.event;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.event.Reception;
+import javax.enterprise.event.TransactionPhase;
+import javax.enterprise.inject.spi.ObserverMethod;
+
+/**
+ * Test mock ObserverMethod which observes instances of TypeArgumenEventInterface implementations.
+ */
+public class TypeArgumentInterfaceObserver implements ObserverMethod<ITypeArgumentEventInterface>
+{
+ private String result;
+
+ private final Set<Annotation> qualifiers;
+
+
+ public TypeArgumentInterfaceObserver(Set<Annotation> anns) {
+ this.qualifiers = anns;
+ }
+
+ @Override
+ public void notify(ITypeArgumentEventInterface event)
+ {
+ this.result = "ok";
+ }
+
+ public String getResult()
+ {
+ return this.result;
+ }
+
+ @Override
+ public Class<?> getBeanClass() {
+ return null;
+ }
+
+ @Override
+ public Set<Annotation> getObservedQualifiers() {
+ return qualifiers;
+ }
+
+ @Override
+ public Type getObservedType() {
+ return null;
+ }
+
+ @Override
+ public Reception getReception() {
+ return null;
+ }
+
+ @Override
+ public TransactionPhase getTransactionPhase() {
+ return null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentObserver.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentObserver.java
new file mode 100644
index 0000000..f0abd04
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentObserver.java
@@ -0,0 +1,79 @@
+/*
+ * 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.webbeans.test.event;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.event.Reception;
+import javax.enterprise.event.TransactionPhase;
+import javax.enterprise.inject.spi.ObserverMethod;
+
+/**
+ * Test mock ObserverMethod which observes a TypeArgumentBaseEvent
+ */
+public class TypeArgumentObserver implements ObserverMethod<TypeArgumentBaseEvent>
+{
+ private String result = null;
+
+ private final Set<Annotation> qualifiers;
+
+ public TypeArgumentObserver(Set<Annotation> anns)
+ {
+ this.qualifiers = anns;
+ }
+
+ @Override
+ public void notify(TypeArgumentBaseEvent event)
+ {
+ result = "ok";
+
+ }
+
+ public String getResult()
+ {
+ return result;
+ }
+
+ @Override
+ public Class<?> getBeanClass() {
+ return null;
+ }
+
+ @Override
+ public Set<Annotation> getObservedQualifiers() {
+ return qualifiers;
+ }
+
+ @Override
+ public Type getObservedType() {
+ return null;
+ }
+
+ @Override
+ public Reception getReception() {
+ return null;
+ }
+
+ @Override
+ public TransactionPhase getTransactionPhase() {
+ return null;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/event/broke/BrokenEvent.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/event/broke/BrokenEvent.java
new file mode 100644
index 0000000..9e4f73c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/event/broke/BrokenEvent.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.test.event.broke;
+
+public class BrokenEvent<T>
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/event/broke/BrokenObserver.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/event/broke/BrokenObserver.java
new file mode 100644
index 0000000..b22a292
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/event/broke/BrokenObserver.java
@@ -0,0 +1,65 @@
+/*
+ * 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.webbeans.test.event.broke;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.event.Reception;
+import javax.enterprise.event.TransactionPhase;
+import javax.enterprise.inject.spi.ObserverMethod;
+
+
+@SuppressWarnings("unchecked")
+public class BrokenObserver implements ObserverMethod<BrokenEvent>
+{
+
+ @Override
+ public void notify(BrokenEvent event)
+ {
+
+ }
+
+ @Override
+ public Class<?> getBeanClass() {
+ return null;
+ }
+
+ @Override
+ public Set<Annotation> getObservedQualifiers() {
+ return null;
+ }
+
+ @Override
+ public Type getObservedType() {
+ return null;
+ }
+
+ @Override
+ public Reception getReception() {
+ return null;
+ }
+
+ @Override
+ public TransactionPhase getTransactionPhase() {
+ return null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockManager.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockManager.java
new file mode 100644
index 0000000..34ad00b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockManager.java
@@ -0,0 +1,307 @@
+/*
+ * 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.webbeans.test.mock;
+
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.Decorator;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.enterprise.inject.spi.InterceptionType;
+import javax.enterprise.inject.spi.Interceptor;
+import javax.enterprise.inject.spi.ObserverMethod;
+import javax.enterprise.util.TypeLiteral;
+
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.component.BeanAttributesImpl;
+import org.apache.webbeans.component.creation.BeanAttributesBuilder;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.config.WebBeansFinder;
+import org.apache.webbeans.container.AbstractBeanManager;
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.util.WebBeansUtil;
+
+public class MockManager extends AbstractBeanManager implements BeanManager
+{
+ private BeanManagerImpl manager = null;
+
+ private List<AbstractOwbBean<?>> componentList = new ArrayList<AbstractOwbBean<?>>();
+
+ public MockManager()
+ {
+ WebBeansFinder.clearInstances(WebBeansUtil.getCurrentClassLoader());
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ this.manager = webBeansContext.getBeanManagerImpl();
+ manager.addBean(webBeansContext.getWebBeansUtil().getManagerBean());
+ }
+
+ @Override
+ public WebBeansContext getWebBeansContext()
+ {
+ return manager.getWebBeansContext();
+ }
+
+ public void clear()
+ {
+ componentList.clear();
+
+ WebBeansFinder.clearInstances(WebBeansUtil.getCurrentClassLoader());
+
+ this.manager = WebBeansContext.getInstance().getBeanManagerImpl();
+ }
+
+ public List<AbstractOwbBean<?>> getComponents()
+ {
+ return componentList;
+ }
+
+ public AbstractOwbBean<?> getComponent(int i)
+ {
+ return componentList.get(i);
+ }
+
+ public int getDeployedCompnents()
+ {
+ return manager.getBeans().size();
+ }
+
+ public BeanManager addBean(Bean<?> bean)
+ {
+ manager.addBean(bean);
+ return this;
+ }
+
+ public BeanManager addInternalBean(Bean<?> bean)
+ {
+ manager.addInternalBean(bean);
+ return this;
+ }
+
+ public BeanManager addContext(Context context)
+ {
+ return manager.addContext(context);
+ }
+
+ @Override
+ public void fireEvent(Object event, Annotation... bindings)
+ {
+ manager.fireEvent(event, bindings);
+
+ }
+
+ @Override
+ public Context getContext(Class<? extends Annotation> scopeType)
+ {
+ return manager.getContext(scopeType);
+ }
+
+ public <T> T getInstance(Bean<T> bean)
+ {
+ return (T) manager.getReference(bean,null, manager.createCreationalContext(bean));
+ }
+
+ public <T> T getInstanceByType(Type type, Annotation... bindingTypes)
+ {
+ Bean<?> bean = manager.resolve(manager.getBeans(type, bindingTypes));
+ if (bean == null)
+ {
+ return null;
+ }
+ return (T) manager.getReference(bean, type, manager.createCreationalContext(bean));
+ }
+
+ public <T> T getInstanceByType(TypeLiteral<T> type, Annotation... bindingTypes)
+ {
+ return getInstanceByType(type.getType(), bindingTypes);
+ }
+
+ public Set<Bean<?>> resolveByName(String name)
+ {
+ return manager.getBeans(name);
+ }
+
+ public Set<Bean<?>> resolveByType(Class<?> apiType, Annotation... bindingTypes)
+ {
+ return manager.getBeans(apiType, bindingTypes);
+ }
+
+ @Override
+ public List<Decorator<?>> resolveDecorators(Set<Type> types, Annotation... bindingTypes)
+ {
+ return manager.resolveDecorators(types, bindingTypes);
+ }
+
+ @Override
+ public List<Interceptor<?>> resolveInterceptors(InterceptionType type, Annotation... interceptorBindings)
+ {
+ return manager.resolveInterceptors(type, interceptorBindings);
+ }
+
+ public BeanManager parse(InputStream xmlStream)
+ {
+ manager.parse(xmlStream);
+ return manager;
+ }
+
+ @Override
+ public <T> AnnotatedType<T> createAnnotatedType(Class<T> type)
+ {
+ return this.manager.createAnnotatedType(type);
+ }
+
+ @Override
+ public <T> CreationalContext<T> createCreationalContext(Contextual<T> contextual)
+ {
+ return this.manager.createCreationalContext(contextual);
+ }
+
+ @Override
+ public <T> BeanAttributesImpl<T> createBeanAttributes(AnnotatedType<T> type)
+ {
+ return BeanAttributesBuilder.forContext(manager.getWebBeansContext()).newBeanAttibutes(type).build();
+ }
+
+ @Override
+ public Set<Bean<?>> getBeans(Type beanType, Annotation... bindings)
+ {
+ return this.manager.getBeans();
+ }
+
+ @Override
+ public Set<Bean<?>> getBeans(String name)
+ {
+ return this.manager.getBeans(name);
+ }
+
+ @Override
+ public ELResolver getELResolver()
+ {
+ return this.manager.getELResolver();
+ }
+
+ @Override
+ public Object getInjectableReference(InjectionPoint injectionPoint, CreationalContext<?> ctx)
+ {
+ return this.manager.getInjectableReference(injectionPoint, ctx);
+ }
+
+ @Override
+ public Set<Annotation> getInterceptorBindingDefinition(Class<? extends Annotation> binding)
+ {
+ return this.manager.getInterceptorBindingDefinition(binding);
+ }
+
+ @Override
+ public Bean<?> getPassivationCapableBean(String id)
+ {
+ return this.manager.getPassivationCapableBean(id);
+ }
+
+ @Override
+ public Object getReference(Bean<?> bean, Type beanType, CreationalContext<?> ctx)
+ {
+ return this.manager.getReference(bean, beanType, ctx);
+ }
+
+ @Override
+ public Set<Annotation> getStereotypeDefinition(Class<? extends Annotation> stereotype)
+ {
+ return this.manager.getStereotypeDefinition(stereotype);
+ }
+
+ @Override
+ public boolean isQualifier(Class<? extends Annotation> annotationType)
+ {
+ return this.manager.isQualifier(annotationType);
+ }
+
+ @Override
+ public boolean isInterceptorBinding(Class<? extends Annotation> annotationType)
+ {
+ return this.manager.isInterceptorBinding(annotationType);
+ }
+
+ @Override
+ public boolean isScope(Class<? extends Annotation> annotationType)
+ {
+ return this.manager.isScope(annotationType);
+ }
+
+ @Override
+ public boolean isNormalScope(Class<? extends Annotation> annotationType)
+ {
+ return this.manager.isNormalScope(annotationType);
+ }
+
+ @Override
+ public boolean isPassivatingScope(Class<? extends Annotation> annotationType)
+ {
+ return this.manager.isPassivatingScope(annotationType);
+ }
+
+ @Override
+ public boolean isStereotype(Class<? extends Annotation> annotationType)
+ {
+ return this.manager.isStereotype(annotationType);
+ }
+
+ @Override
+ public <X> Bean<? extends X> resolve(Set<Bean<? extends X>> beans)
+ {
+ return this.manager.resolve(beans);
+ }
+
+ @Override
+ public void validate(InjectionPoint injectionPoint)
+ {
+ this.manager.validate(injectionPoint);
+
+ }
+
+ @Override
+ public <T> InjectionTarget<T> createInjectionTarget(AnnotatedType<T> type)
+ {
+ return this.manager.createInjectionTarget(type);
+ }
+
+ @Override
+ public <T> Set<ObserverMethod<? super T>> resolveObserverMethods(T event, Annotation... bindings)
+ {
+ return this.manager.resolveObserverMethods(event, bindings);
+ }
+
+ @Override
+ public ExpressionFactory wrapExpressionFactory(ExpressionFactory expressionFactory)
+ {
+ return null;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/ITestContext.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/ITestContext.java
new file mode 100644
index 0000000..49a038d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/ITestContext.java
@@ -0,0 +1,44 @@
+/*
+ * 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.webbeans.test.servlet;
+
+/**
+ * Simple test interfaces.
+ *
+ * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
+ * @since 1.0
+ */
+public interface ITestContext
+{
+ /**
+ * Initialize the test context
+ */
+ public void init();
+
+ /**
+ * Start all tests in the context
+ */
+ public void startTests(Object ctx);
+
+ /**
+ * End tests in the context
+ */
+ public void endTests(Object ctx);
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/TestListener.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/TestListener.java
new file mode 100644
index 0000000..7c280e4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/TestListener.java
@@ -0,0 +1,74 @@
+/*
+ * 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.webbeans.test.servlet;
+
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.test.TestContext;
+import org.junit.Test;
+
+import java.util.logging.Logger;
+
+/**
+ * This test listener class is used for running the tests from the web page.
+ * <p>
+ * NOT : Actually this is not used, it is created and used as an experimental.
+ * </p>
+ *
+ * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
+ * @since 1.0
+ */
+public class TestListener
+{
+ Logger log = WebBeansLoggerFacade.getLogger(TestListener.class);
+
+ private void init()
+ {
+ log.info("Initializing the test contexts");
+ TestContext.initTests();
+ }
+
+ /**
+ * Ending all tests
+ */
+ public void contextDestroyed(Object arg0)
+ {
+ log.info("Ending all tests");
+
+ TestContext.endAllTests(arg0);
+ }
+
+ @Test
+ public void contextInitialized()
+ {
+
+ }
+
+ /**
+ * Initialize and start all tests from the web application.
+ */
+ public void contextInitialized(Object arg0)
+ {
+ init();
+
+ log.info("Starting all tests");
+
+ TestContext.startAllTests(arg0);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithNonScope.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithNonScope.java
new file mode 100644
index 0000000..463ef06
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithNonScope.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.test.sterotype;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.Stereotype;
+
+@Stereotype
+@Retention(RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.TYPE, ElementType.METHOD })
+public @interface StereoWithNonScope {
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithRequestScope.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithRequestScope.java
new file mode 100644
index 0000000..2176ddc
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithRequestScope.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.sterotype;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Stereotype;
+
+@Stereotype
+@RequestScoped
+@Retention(RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.TYPE, ElementType.METHOD })
+public @interface StereoWithRequestScope {
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithSessionScope.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithSessionScope.java
new file mode 100644
index 0000000..59b3883
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithSessionScope.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.sterotype;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.Stereotype;
+
+@Stereotype
+@SessionScoped
+@Retention(RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.TYPE, ElementType.METHOD })
+public @interface StereoWithSessionScope {
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithSessionScope2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithSessionScope2.java
new file mode 100644
index 0000000..12a48e5
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/sterotype/StereoWithSessionScope2.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.sterotype;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.Stereotype;
+
+@Stereotype
+@SessionScoped
+@Retention(RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.TYPE, ElementType.METHOD })
+public @interface StereoWithSessionScope2 {
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/annotation/AnnotatedClass.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/annotation/AnnotatedClass.java
new file mode 100644
index 0000000..2cc0a36
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/annotation/AnnotatedClass.java
@@ -0,0 +1,27 @@
+/*
+ * 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.webbeans.test.unittests.annotation;
+
+import org.apache.webbeans.test.annotation.binding.AnnotationWithBindingMember;
+
+@AnnotationWithBindingMember(value = "Gurkan", number = 5)
+public class AnnotatedClass
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/annotation/DefaultAnnotatedClass.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/annotation/DefaultAnnotatedClass.java
new file mode 100644
index 0000000..165555d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/annotation/DefaultAnnotatedClass.java
@@ -0,0 +1,27 @@
+/*
+ * 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.webbeans.test.unittests.annotation;
+
+import org.apache.webbeans.test.annotation.binding.AnnotationWithBindingMember;
+
+@AnnotationWithBindingMember
+public class DefaultAnnotatedClass
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/annotation/LiteralType.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/annotation/LiteralType.java
new file mode 100644
index 0000000..066aab0
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/annotation/LiteralType.java
@@ -0,0 +1,28 @@
+/*
+ * 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.webbeans.test.unittests.annotation;
+
+import javax.enterprise.util.AnnotationLiteral;
+
+import org.apache.webbeans.test.annotation.binding.AnnotationWithBindingMember;
+
+public abstract class LiteralType extends AnnotationLiteral<AnnotationWithBindingMember> implements AnnotationWithBindingMember
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/binding/AnyBindingTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/binding/AnyBindingTest.java
new file mode 100644
index 0000000..3672266
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/binding/AnyBindingTest.java
@@ -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.webbeans.test.unittests.binding;
+
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.binding.AnyBindingComponent;
+import org.apache.webbeans.test.component.binding.DefaultAnyBinding;
+import org.apache.webbeans.test.component.binding.NonAnyBindingComponent;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class AnyBindingTest extends TestContext{
+
+ public AnyBindingTest()
+ {
+ super(AnyBindingTest.class.getName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ }
+
+ @Test
+ public void testAny()
+ {
+ AbstractOwbBean<AnyBindingComponent> comp1 = defineManagedBean(AnyBindingComponent.class);
+ Set<Annotation> qualifiers = comp1.getQualifiers();
+
+ Assert.assertEquals(2, qualifiers.size());
+
+ AbstractOwbBean<NonAnyBindingComponent> comp2 = defineManagedBean(NonAnyBindingComponent.class);
+ qualifiers = comp2.getQualifiers();
+
+ Assert.assertEquals(4, qualifiers.size());
+
+
+ AbstractOwbBean<DefaultAnyBinding> comp3 = defineManagedBean(DefaultAnyBinding.class);
+ qualifiers = comp3.getQualifiers();
+
+ Assert.assertEquals(2, qualifiers.size());
+
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/binding/BrokenBindingComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/binding/BrokenBindingComponentTest.java
new file mode 100644
index 0000000..6515f41
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/binding/BrokenBindingComponentTest.java
@@ -0,0 +1,74 @@
+/*
+ * 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.webbeans.test.unittests.binding;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.binding.BindingWithNonBindingAnnotationTypeComponent;
+import org.apache.webbeans.test.component.binding.BindingWithNonBindingArrayTypeComponent;
+import org.junit.Before;
+import org.junit.Test;
+
+public class BrokenBindingComponentTest extends TestContext
+{
+
+ public BrokenBindingComponentTest()
+ {
+ super(BrokenBindingComponentTest.class.getName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ super.init();
+ }
+
+ @Test
+ public void testNonBindingArrayType()
+ {
+ try
+ {
+ defineManagedBean(BindingWithNonBindingArrayTypeComponent.class);
+ }
+ catch (Exception e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ }
+
+ @Test
+ public void testNonBindingAnnotationType()
+ {
+ try
+ {
+ defineManagedBean(BindingWithNonBindingAnnotationTypeComponent.class);
+ }
+ catch (Exception e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/clazz/AbstractSchool.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/clazz/AbstractSchool.java
new file mode 100644
index 0000000..5799843
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/clazz/AbstractSchool.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.test.unittests.clazz;
+
+public abstract class AbstractSchool<T> implements IBook2<Integer, String>
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/clazz/AbstractSchool2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/clazz/AbstractSchool2.java
new file mode 100644
index 0000000..2582cbb
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/clazz/AbstractSchool2.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.test.unittests.clazz;
+
+public abstract class AbstractSchool2<T, K>
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/clazz/ClazzTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/clazz/ClazzTest.java
new file mode 100644
index 0000000..b251eb3
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/clazz/ClazzTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.webbeans.test.unittests.clazz;
+
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.util.GenericsUtil;
+import org.junit.Test;
+
+public class ClazzTest
+{
+ @Test
+ public void testStudent()
+ {
+ Set<Type> set = GenericsUtil.getTypeClosure(Student.class, Student.class, Student.class);
+
+ Assert.assertEquals(5, set.size());
+
+ }
+
+ @Test
+ public void testStudent2()
+ {
+ Set<Type> set = GenericsUtil.getTypeClosure(Student2.class, Student2.class, Student2.class);
+
+ Assert.assertEquals(4, set.size());
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/clazz/IBook.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/clazz/IBook.java
new file mode 100644
index 0000000..668709b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/clazz/IBook.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.test.unittests.clazz;
+
+public interface IBook<T>
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/clazz/IBook2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/clazz/IBook2.java
new file mode 100644
index 0000000..f451dc6
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/clazz/IBook2.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.test.unittests.clazz;
+
+public interface IBook2<K, T>
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/clazz/Student.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/clazz/Student.java
new file mode 100644
index 0000000..0327bce
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/clazz/Student.java
@@ -0,0 +1,26 @@
+/*
+ * 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.webbeans.test.unittests.clazz;
+
+import java.util.List;
+
+public class Student extends AbstractSchool<Integer> implements IBook<List<Integer>>
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/clazz/Student2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/clazz/Student2.java
new file mode 100644
index 0000000..6277988
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/clazz/Student2.java
@@ -0,0 +1,27 @@
+/*
+ * 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.webbeans.test.unittests.clazz;
+
+import java.util.List;
+import java.util.Map;
+
+public class Student2 extends AbstractSchool2<List<String>, Map<String, String>> implements IBook2<Integer, String>
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/config/ClassTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/config/ClassTest.java
new file mode 100644
index 0000000..8bdab30
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/config/ClassTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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.webbeans.test.unittests.config;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Map;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.util.ClassUtil;
+import org.junit.Test;
+
+public class ClassTest extends TestContext
+{
+ public Map<String, ?> map = null;
+
+ public ClassTest()
+ {
+ super(ClassTest.class.getName());
+ }
+
+ @Test
+ public void testTypeVariableTest()
+ {
+ boolean result = ClassUtil.isDefinitionContainsTypeVariables(Map.class);
+
+ Assert.assertEquals(true, result);
+
+ }
+
+ @Test
+ public void testCheckParameterizedType() throws Exception
+ {
+
+ Field field = ClassTest.class.getField("map");
+
+ Type type = field.getGenericType();
+
+ if(type instanceof ParameterizedType)
+ {
+ boolean result = ClassUtil.checkParametrizedType((ParameterizedType)type);
+
+ Assert.assertFalse(result);
+ }
+
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/config/ScannerTestBean.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/config/ScannerTestBean.java
new file mode 100644
index 0000000..e92e351
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/config/ScannerTestBean.java
@@ -0,0 +1,43 @@
+/*
+ * 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.webbeans.test.unittests.config;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Named;
+
+/**
+ * Test WebBean for the {@link WebBeansScannerTest}
+ */
+@RequestScoped
+@Named
+public class ScannerTestBean
+{
+ private int myInt = 3;
+
+ public int getMyInt()
+ {
+ return myInt;
+ }
+
+ public void setMyInt(int myInt)
+ {
+ this.myInt = myInt;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/config/WebBeansScannerTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/config/WebBeansScannerTest.java
new file mode 100644
index 0000000..b4b6da9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/config/WebBeansScannerTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.webbeans.test.unittests.config;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.lifecycle.test.OpenWebBeansTestMetaDataDiscoveryService;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+
+import org.junit.Test;
+
+public class WebBeansScannerTest extends AbstractUnitTest
+{
+ public WebBeansScannerTest()
+ {
+
+ }
+
+ @Test
+ public void testWebBeansScanner() throws Exception
+ {
+ List<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(ScannerTestBean.class);
+
+ //Start test container
+ startContainer(classes);
+
+ OpenWebBeansTestMetaDataDiscoveryService scanner = (OpenWebBeansTestMetaDataDiscoveryService) getWebBeansContext().getScannerService();
+ scanner.deployClasses(classes);
+
+ scanner.scan();
+
+ Set<Class<?>> classMap = scanner.getBeanClasses();
+ Assert.assertNotNull(classMap);
+ Assert.assertFalse(classMap.isEmpty());
+
+ //Stop test container
+ shutDownContainer();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/decorator/Decorator1Test.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/decorator/Decorator1Test.java
new file mode 100644
index 0000000..33052fc
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/decorator/Decorator1Test.java
@@ -0,0 +1,121 @@
+/*
+ * 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.webbeans.test.unittests.decorator;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.math.BigDecimal;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Decorator;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.annotation.DefaultLiteral;
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.annotation.binding.Binding1Literal;
+import org.apache.webbeans.test.component.CheckWithCheckPayment;
+import org.apache.webbeans.test.component.decorator.clean.Account;
+import org.apache.webbeans.test.component.decorator.clean.AccountComponent;
+import org.apache.webbeans.test.component.decorator.clean.LargeTransactionDecorator;
+import org.apache.webbeans.test.component.decorator.clean.ServiceDecorator;
+import org.apache.webbeans.test.component.service.IService;
+import org.apache.webbeans.test.component.service.ServiceImpl1;
+import org.junit.Before;
+import org.junit.Test;
+
+public class Decorator1Test extends TestContext
+{
+
+ public Decorator1Test()
+ {
+ super(Decorator1Test.class.getName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ super.init();
+
+ }
+
+ @Test
+ public void test1()
+ {
+ clear();
+
+ initializeDecoratorType(ServiceDecorator.class);
+ initializeDecoratorType(LargeTransactionDecorator.class);
+
+ defineDecorator(ServiceDecorator.class);
+ defineManagedBean(CheckWithCheckPayment.class);
+ AbstractOwbBean<ServiceImpl1> component = defineManagedBean(ServiceImpl1.class);
+
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ webBeansContext.getContextFactory().initRequestContext(null);
+ webBeansContext.getContextFactory().initApplicationContext(null);
+
+ ServiceImpl1 serviceImpl = getManager().getInstance(component);
+ String s = serviceImpl.service();
+
+ Assert.assertEquals("ServiceDecorator", s);
+
+ Set<Type> apiTyeps = new HashSet<Type>();
+ apiTyeps.add(IService.class);
+
+ List<Decorator<?>> decs = getManager().resolveDecorators(apiTyeps, new Annotation[] { new Binding1Literal() });
+
+ ServiceDecorator dec = (ServiceDecorator) getManager().getInstance(decs.get(0));
+ Assert.assertEquals(null, dec.getDelegateAttr());
+
+ }
+
+ @Test
+ public void test2()
+ {
+ clear();
+ initializeDecoratorType(LargeTransactionDecorator.class);
+
+ defineDecorator(LargeTransactionDecorator.class);
+ AbstractOwbBean<AccountComponent> component = defineManagedBean(AccountComponent.class);
+
+ WebBeansContext.getInstance().getContextFactory().initRequestContext(null);
+
+ AccountComponent account = getManager().getInstance(component);
+
+ account.deposit(new BigDecimal(1500));
+ account.withdraw(new BigDecimal(3000));
+
+ Set<Type> apiTyeps = new HashSet<Type>();
+ apiTyeps.add(Account.class);
+
+ List<Decorator<?>> decs = getManager().resolveDecorators(apiTyeps, new Annotation[] { new DefaultLiteral() });
+
+ LargeTransactionDecorator dec = (LargeTransactionDecorator) getManager().getInstance(decs.get(0));
+ Assert.assertEquals(null, dec.getDepositeAmount());
+ Assert.assertEquals(null, dec.getWithDrawAmount());
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/decorator/DecoratorExceptionTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/decorator/DecoratorExceptionTest.java
new file mode 100644
index 0000000..5d7114b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/decorator/DecoratorExceptionTest.java
@@ -0,0 +1,182 @@
+/*
+ * 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.webbeans.test.unittests.decorator;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.HashSet;
+import java.util.Set;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.annotation.RequestedScopeLiteral;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.annotation.binding.DummyAnnotationLiteral;
+import org.apache.webbeans.test.component.CheckWithCheckPaymentDecoratorField;
+import org.apache.webbeans.test.component.IPayment;
+import org.apache.webbeans.test.component.decorator.broken.DelegateAttributeIsnotInterface;
+import org.apache.webbeans.test.component.decorator.broken.DelegateAttributeMustImplementAllDecoratedTypes;
+import org.apache.webbeans.test.component.decorator.broken.MoreThanOneDelegateAttribute;
+import org.apache.webbeans.test.component.decorator.broken.PaymentDecorator;
+import org.junit.Before;
+import org.junit.Test;
+
+public class DecoratorExceptionTest extends TestContext
+{
+ public DecoratorExceptionTest()
+ {
+ super(DecoratorExceptionTest.class.getName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ super.init();
+ }
+
+
+ @Test
+ public void testDelegateAttributeIsnotInterface()
+ {
+ try
+ {
+ defineDecorator(DelegateAttributeIsnotInterface.class);
+ }
+ catch (Exception e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ }
+
+ @Test
+ public void testMoreThanOneDelegateAttribute()
+ {
+ try
+ {
+ defineDecorator(MoreThanOneDelegateAttribute.class);
+ }
+ catch (Exception e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ }
+
+ @Test
+ public void testApplyToSimpleWebBeanFinalMethodsDecoratorImplements()
+ {
+ try
+ {
+ defineDecorator(PaymentDecorator.class);
+ defineManagedBean(CheckWithCheckPaymentDecoratorField.class);
+ }
+ catch (Exception e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ }
+
+ @Test
+ public void testDelegateAttributeMustImplementAllDecoratedTypes()
+ {
+ try
+ {
+ defineDecorator(DelegateAttributeMustImplementAllDecoratedTypes.class);
+ }
+ catch (Exception e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ }
+
+ @Test
+ public void testResolveDuplicateBindingParameterType()
+ {
+ try
+ {
+
+ Set<Type> api = new HashSet<Type>();
+ api.add(IPayment.class);
+
+ Annotation[] anns = new Annotation[2];
+ anns[0] = new DummyAnnotationLiteral();
+ anns[1] = new DummyAnnotationLiteral();
+
+ getManager().resolveDecorators(api, anns);
+ }
+ catch (Exception e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ }
+
+ @Test
+ public void testResolveNonBindingTypeAnnotation()
+ {
+ try
+ {
+
+ Set<Type> api = new HashSet<Type>();
+ api.add(IPayment.class);
+
+ Annotation[] anns = new Annotation[2];
+ anns[0] = new RequestedScopeLiteral();
+
+ getManager().resolveDecorators(api, anns);
+ }
+ catch (Exception e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ }
+
+ @Test
+ public void testResolveApiTypesEmpty()
+ {
+ try
+ {
+
+ Set<Type> api = new HashSet<Type>();
+
+ Annotation[] anns = new Annotation[2];
+ anns[0] = new DummyAnnotationLiteral();
+
+ getManager().resolveDecorators(api, anns);
+ }
+ catch (Exception e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/definition/BeanTypesTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/definition/BeanTypesTest.java
new file mode 100644
index 0000000..220ce7b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/definition/BeanTypesTest.java
@@ -0,0 +1,80 @@
+/*
+ * 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.webbeans.test.unittests.definition;
+
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.CheckWithCheckPayment;
+import org.apache.webbeans.test.component.definition.BeanTypesDefinedBean;
+import org.junit.Before;
+import org.junit.Test;
+
+public class BeanTypesTest extends TestContext
+{
+ public BeanTypesTest()
+ {
+ super(BeanTypesTest.class.getName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ super.init();
+ }
+
+ @Test
+ public void testBeanTypes()
+ {
+ clear();
+
+ Bean<BeanTypesDefinedBean> bean = defineManagedBean(BeanTypesDefinedBean.class);
+ Set<Type> apiTypes = bean.getTypes();
+
+ Assert.assertEquals(2, apiTypes.size());
+ Assert.assertTrue(apiTypes.contains(BeanTypesDefinedBean.class));
+
+ Set<Bean<?>> beans = getManager().getBeans("paymentField");
+ Assert.assertEquals(1, beans.size());
+
+ Bean<?> pbean = beans.iterator().next();
+ apiTypes = pbean.getTypes();
+
+ Assert.assertEquals(2, apiTypes.size());
+ Assert.assertTrue(apiTypes.contains(CheckWithCheckPayment.class));
+
+ beans = getManager().getBeans("paymentMethod");
+ Assert.assertEquals(1, beans.size());
+
+ pbean = beans.iterator().next();
+ apiTypes = pbean.getTypes();
+
+ Assert.assertEquals(2, apiTypes.size());
+ Assert.assertTrue(apiTypes.contains(CheckWithCheckPayment.class));
+
+
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/dependent/DependentComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/dependent/DependentComponentTest.java
new file mode 100644
index 0000000..a8f7651
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/dependent/DependentComponentTest.java
@@ -0,0 +1,90 @@
+/*
+ * 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.webbeans.test.unittests.dependent;
+
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.dependent.DependentComponent;
+import org.apache.webbeans.test.component.dependent.DependentOwnerComponent;
+import org.apache.webbeans.test.component.dependent.circular.DependentA;
+import org.apache.webbeans.test.component.dependent.circular.DependentB;
+import org.junit.Before;
+import org.junit.Test;
+
+public class DependentComponentTest extends TestContext
+{
+ public DependentComponentTest()
+ {
+ super(DependentComponentTest.class.getName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ super.init();
+ }
+
+ @Test
+ public void testDependent()
+ {
+ clear();
+ defineManagedBean(DependentComponent.class);
+ defineManagedBean(DependentOwnerComponent.class);
+
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ webBeansContext.getContextFactory().initRequestContext(null);
+
+ List<AbstractOwbBean<?>> comps = getComponents();
+
+ Assert.assertEquals(2, comps.size());
+
+ DependentOwnerComponent comp = (DependentOwnerComponent) getManager().getInstance(comps.get(1));
+
+ DependentComponent dc = comp.getDependent();
+
+ Assert.assertNotNull(dc);
+
+ webBeansContext.getContextFactory().destroyRequestContext(null);
+ }
+
+ @Test
+ public void testDependentCircular()
+ {
+ clear();
+
+ WebBeansContext.getInstance().getContextFactory().initRequestContext(null);
+
+ AbstractOwbBean<DependentA> componentA = defineManagedBean(DependentA.class);
+ AbstractOwbBean<DependentB> componentB = defineManagedBean(DependentB.class);
+
+ Assert.assertNotNull(componentB);
+
+ DependentA dependentA = getManager().getInstance(componentA);
+ Assert.assertNotNull(dependentA);
+ Assert.assertNotNull(dependentA.getDependentB());
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/dependent/MultipleDependentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/dependent/MultipleDependentTest.java
new file mode 100644
index 0000000..e9d4ca4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/dependent/MultipleDependentTest.java
@@ -0,0 +1,62 @@
+/*
+ * 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.webbeans.test.unittests.dependent;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.dependent.DependentComponent;
+import org.apache.webbeans.test.component.dependent.MultipleDependentComponent;
+import org.junit.Before;
+import org.junit.Test;
+
+public class MultipleDependentTest extends TestContext
+{
+ public MultipleDependentTest()
+ {
+ super(MultipleDependentTest.class.getName());
+ }
+
+
+ @Override
+ @Before
+ public void init()
+ {
+ initDependentContext();
+ }
+
+ @Test
+ public void testMultipleDependent()
+ {
+ clear();
+ WebBeansContext.getInstance().getContextFactory().initRequestContext(null);
+
+ defineManagedBean(DependentComponent.class);
+ defineManagedBean(MultipleDependentComponent.class);
+
+ MultipleDependentComponent bean = (MultipleDependentComponent)getManager().getInstance(getComponents().get(1));
+
+ Assert.assertNotNull(bean.get1());
+ Assert.assertNotNull(bean.get2());
+
+ Assert.assertNotSame(bean.get1(), bean.get2());
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/disposal/DisposalTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/disposal/DisposalTest.java
new file mode 100644
index 0000000..f53ac3f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/disposal/DisposalTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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.webbeans.test.unittests.disposal;
+
+import javax.enterprise.context.RequestScoped;
+import java.util.List;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.test.component.disposal.Disposal1;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class DisposalTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testDisposal1()
+ {
+ startContainer(Disposal1.class);
+
+ @SuppressWarnings("unchecked")
+ List<Integer> list = (List<Integer>) getInstance("createBinding1");
+ Assert.assertNotNull(list);
+ Assert.assertTrue(list.size() == 1);
+ getLifecycle().getContextService().endContext(RequestScoped.class, null);
+
+ Assert.assertTrue(Disposal1.getDISPOSCALL());
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/EventTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/EventTest.java
new file mode 100644
index 0000000..c01592d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/EventTest.java
@@ -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.webbeans.test.unittests.event;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.util.AnnotationLiteral;
+import javax.enterprise.util.TypeLiteral;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.annotation.binding.Binding1;
+import org.apache.webbeans.test.event.ITypeArgumentEventInterface;
+import org.apache.webbeans.test.event.LoggedInEvent;
+import org.apache.webbeans.test.event.LoggedInObserver;
+import org.apache.webbeans.test.event.TypeArgumentBaseEvent;
+import org.apache.webbeans.test.event.TypeArgumentEvent;
+import org.apache.webbeans.test.event.TypeArgumentInterfaceObserver;
+import org.apache.webbeans.test.event.TypeArgumentObserver;
+import org.apache.webbeans.util.ArrayUtil;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class EventTest extends TestContext
+{
+ public EventTest()
+ {
+ super(EventTest.class.getName());
+ }
+
+ @Test
+ public void testObserverWithClazz()
+ {
+ Annotation[] anns = new Annotation[1];
+ anns[0] = new AnnotationLiteral<Binding1>()
+ {
+ };
+
+ LoggedInObserver observer = new LoggedInObserver(ArrayUtil.asSet(anns));
+ WebBeansContext.getInstance().getBeanManagerImpl().getNotificationManager().addObserver(observer, LoggedInEvent.class);
+
+ getManager().fireEvent(new LoggedInEvent(), anns);
+
+ Assert.assertEquals("ok", observer.getResult());
+ }
+
+ @Test
+ public void testObserverWithClazzAndTypeArguments()
+ {
+ Annotation[] anns = new Annotation[1];
+ anns[0] = new AnnotationLiteral<Binding1>()
+ {
+ };
+
+ TypeArgumentObserver observer = new TypeArgumentObserver(ArrayUtil.asSet(anns));
+ TypeLiteral<TypeArgumentBaseEvent> tl = new TypeLiteral<TypeArgumentBaseEvent>()
+ {
+ };
+
+ WebBeansContext.getInstance().getBeanManagerImpl().getNotificationManager().addObserver(observer, tl);
+
+ getManager().fireEvent(new TypeArgumentEvent(), anns);
+
+ Assert.assertEquals("ok", observer.getResult());
+ }
+
+ @Test
+ public void testObserverWithInterface()
+ {
+ Annotation[] anns = new Annotation[1];
+ anns[0] = new AnnotationLiteral<Binding1>()
+ {
+ };
+
+ TypeArgumentInterfaceObserver observer = new TypeArgumentInterfaceObserver(ArrayUtil.asSet(anns));
+ WebBeansContext.getInstance().getBeanManagerImpl().getNotificationManager().addObserver(observer, ITypeArgumentEventInterface.class);
+
+ getManager().fireEvent(new TypeArgumentEvent(), anns);
+ Assert.assertEquals("ok", observer.getResult());
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/component/BrokenComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/component/BrokenComponentTest.java
new file mode 100644
index 0000000..2015c56
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/component/BrokenComponentTest.java
@@ -0,0 +1,161 @@
+/*
+ * 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.webbeans.test.unittests.event.component;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.event.broken.BrokenObserverComponent1;
+import org.apache.webbeans.test.component.event.broken.BrokenObserverComponent2;
+import org.apache.webbeans.test.component.event.broken.BrokenObserverComponent3;
+import org.apache.webbeans.test.component.event.broken.BrokenObserverComponent4;
+import org.apache.webbeans.test.component.event.broken.BrokenObserverComponent5;
+import org.apache.webbeans.test.component.event.broken.BrokenObserverComponent6;
+import org.junit.Before;
+import org.junit.Test;
+
+public class BrokenComponentTest extends TestContext
+{
+ public BrokenComponentTest()
+ {
+ super(BrokenComponentTest.class.getName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ super.init();
+ }
+
+ @Test
+ public void test1()
+ {
+ Exception exc = null;
+
+ try
+ {
+ defineManagedBean(BrokenObserverComponent1.class);
+
+ }
+ catch (Exception e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNull(exc);
+ }
+
+ @Test
+ public void test2()
+ {
+ Exception exc = null;
+
+ try
+ {
+ defineManagedBean(BrokenObserverComponent2.class);
+
+ }
+ catch (Exception e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+ }
+
+ @Test
+ public void test3()
+ {
+ Exception exc = null;
+
+ try
+ {
+ defineManagedBean(BrokenObserverComponent3.class);
+
+ }
+ catch (Exception e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+ }
+
+ @Test
+ public void test4()
+ {
+ Exception exc = null;
+
+ try
+ {
+ defineManagedBean(BrokenObserverComponent4.class);
+
+ }
+ catch (Exception e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+ }
+
+ @Test
+ public void test5()
+ {
+ Exception exc = null;
+
+ try
+ {
+ defineManagedBean(BrokenObserverComponent5.class);
+
+ }
+ catch (Exception e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+ }
+
+ @Test
+ public void test6()
+ {
+ Exception exc = null;
+
+ try
+ {
+ defineManagedBean(BrokenObserverComponent6.class);
+
+ }
+ catch (Exception e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/component/ObserversComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/component/ObserversComponentTest.java
new file mode 100644
index 0000000..29c2c22
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/component/ObserversComponentTest.java
@@ -0,0 +1,288 @@
+/*
+ * 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.webbeans.test.unittests.event.component;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.util.AnnotationLiteral;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.annotation.AnyLiteral;
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.annotation.binding.Check;
+import org.apache.webbeans.test.annotation.binding.NotAnyLiteral;
+import org.apache.webbeans.test.annotation.binding.Role;
+import org.apache.webbeans.test.component.CheckWithCheckPayment;
+import org.apache.webbeans.test.component.CheckWithMoneyPayment;
+import org.apache.webbeans.test.component.PaymentProcessorComponent;
+import org.apache.webbeans.test.component.event.normal.ComponentWithObservable1;
+import org.apache.webbeans.test.component.event.normal.ComponentWithObserves1;
+import org.apache.webbeans.test.component.event.normal.ComponentWithObserves2;
+import org.apache.webbeans.test.component.event.normal.ComponentWithObserves3;
+import org.apache.webbeans.test.component.event.normal.ComponentWithObserves4;
+import org.apache.webbeans.test.component.event.normal.ComponentWithObserves5;
+import org.apache.webbeans.test.component.event.normal.ComponentWithObserves6;
+import org.apache.webbeans.test.component.event.normal.ComponentWithObserves7;
+import org.apache.webbeans.test.component.event.normal.TransactionalInterceptor;
+import org.apache.webbeans.test.event.LoggedInEvent;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ObserversComponentTest extends TestContext
+{
+ public ObserversComponentTest()
+ {
+ super(ObserversComponentTest.class.getName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ super.init();
+ }
+
+ @Test
+ public void testObserves()
+ {
+ clear();
+
+ AbstractOwbBean<ComponentWithObserves1> component = defineManagedBean(ComponentWithObserves1.class);
+ WebBeansContext.getInstance().getContextFactory().initRequestContext(null);
+
+ LoggedInEvent event = new LoggedInEvent("Gurkan");
+
+ Annotation[] anns = new Annotation[1];
+ anns[0] = new AnyLiteral();
+
+ getManager().fireEvent(event, anns);
+
+ ComponentWithObserves1 instance = getManager().getInstance(component);
+
+ Assert.assertEquals("Gurkan", instance.getUserName());
+ }
+
+ @Test
+ public void testWithObservable()
+ {
+ clear();
+
+ getManager().addBean(WebBeansContext.getInstance().getWebBeansUtil().getEventBean());
+
+ AbstractOwbBean<ComponentWithObserves1> component = defineManagedBean(ComponentWithObserves1.class);
+ AbstractOwbBean<ComponentWithObservable1> componentObservable = defineManagedBean(ComponentWithObservable1.class);
+
+ WebBeansContext.getInstance().getContextFactory().initRequestContext(null);
+
+ ComponentWithObserves1 instance = getManager().getInstance(component);
+ ComponentWithObservable1 observable = getManager().getInstance(componentObservable);
+
+ observable.afterLoggedIn();
+
+ Assert.assertEquals("Gurkan", instance.getUserName());
+ }
+
+ @Test
+ public void testObservesIfExists()
+ {
+ clear();
+
+ getManager().addBean(WebBeansContext.getInstance().getWebBeansUtil().getEventBean());
+
+ AbstractOwbBean<ComponentWithObserves3> component3 = defineManagedBean(ComponentWithObserves3.class);
+ AbstractOwbBean<ComponentWithObserves4> component4 = defineManagedBean(ComponentWithObserves4.class);
+ AbstractOwbBean<ComponentWithObserves5> component5 = defineManagedBean(ComponentWithObserves5.class);
+ AbstractOwbBean<ComponentWithObserves6> component6 = defineManagedBean(ComponentWithObserves6.class);
+
+ WebBeansContext.getInstance().getContextFactory().initRequestContext(null);
+
+ /*
+ * DO NOT CALL getInstance FOR component3! IF_EXISTS NEEDS TO FAIL FOR THAT OBJECT.
+ */
+ ComponentWithObserves4 instance = getManager().getInstance(component4);
+ ComponentWithObserves5 instanceIE = getManager().getInstance(component5);
+ ComponentWithObserves6 outstance = getManager().getInstance(component6);
+ instanceIE.getUserName(); // This causes the observer to exist in the context, therefore IF_EXISTS is true.
+
+ LoggedInEvent event = new LoggedInEvent("Gurkan");
+
+ Annotation[] anns = new Annotation[1];
+ anns[0] = new NotAnyLiteral();
+
+ getManager().fireEvent(event, anns);
+
+ Assert.assertEquals("IEGurkan", outstance.getUserIEName());
+ Assert.assertEquals("Gurkan", outstance.getUserName());
+ Assert.assertNull(outstance.getUserNIEName());
+ }
+
+ @Test
+ public void testObservesWithBindingMember()
+ {
+ clear();
+
+ getManager().addBean(WebBeansContext.getInstance().getWebBeansUtil().getEventBean());
+
+ AbstractOwbBean<ComponentWithObserves1> component = defineManagedBean(ComponentWithObserves1.class);
+ WebBeansContext.getInstance().getContextFactory().initRequestContext(null);
+
+ LoggedInEvent event = new LoggedInEvent("Gurkan");
+
+ class CheckLiteral extends AnnotationLiteral<Check> implements Check
+ {
+
+ @Override
+ public String type()
+ {
+ return "CHECK";
+ }
+
+ }
+
+ Annotation[] anns = new Annotation[1];
+ anns[0] = new CheckLiteral();
+
+ getManager().fireEvent(event, anns);
+
+ ComponentWithObserves1 instance = getManager().getInstance(component);
+
+ Assert.assertNotNull(instance.getUserName());
+
+ Assert.assertEquals("Gurkan", instance.getUserNameWithMember());
+ }
+
+ @Test
+ public void testFireWithAtAnyQualifier()
+ {
+ clear();
+
+ getManager().addBean(WebBeansContext.getInstance().getWebBeansUtil().getEventBean());
+
+ AbstractOwbBean<ComponentWithObserves1> component = defineManagedBean(ComponentWithObserves1.class);
+ WebBeansContext.getInstance().getContextFactory().initRequestContext(null);
+
+ LoggedInEvent event = new LoggedInEvent("Mark");
+
+ Annotation[] anns = new Annotation[1];
+ anns[0] = new AnyLiteral();
+
+ getManager().fireEvent(event, anns);
+
+ ComponentWithObserves1 instance = getManager().getInstance(component);
+
+ Assert.assertEquals("Mark", instance.getUserName());
+ Assert.assertNull(instance.getUserNameWithMember());
+ }
+
+
+ @Test
+ public void testObservesWithBindingMember2()
+ {
+ clear();
+
+ defineInterceptor(TransactionalInterceptor.class);
+ defineManagedBean(CheckWithCheckPayment.class);
+ defineManagedBean(CheckWithMoneyPayment.class);
+ defineManagedBean(PaymentProcessorComponent.class);
+ AbstractOwbBean<ComponentWithObserves2> component = defineManagedBean(ComponentWithObserves2.class);
+ WebBeansContext.getInstance().getContextFactory().initRequestContext(null);
+
+ LoggedInEvent event = new LoggedInEvent("USER");
+
+ class RoleUser extends AnnotationLiteral<Role> implements Role
+ {
+
+ @Override
+ public String value()
+ {
+ return "USER";
+ }
+
+ }
+
+ class RoleAdmin extends AnnotationLiteral<Role> implements Role
+ {
+
+ @Override
+ public String value()
+ {
+ return "ADMIN";
+ }
+
+ }
+
+ ComponentWithObserves2.hasBeenIntercepted = false;
+
+ Annotation[] anns = new Annotation[1];
+ anns[0] = new RoleUser();
+
+ getManager().fireEvent(event, anns);
+ ComponentWithObserves2 instance = getManager().getInstance(component);
+
+ Assert.assertFalse(ComponentWithObserves2.hasBeenIntercepted);
+
+ Assert.assertNotNull(instance.getPayment());
+ Assert.assertEquals("USER", instance.getUser());
+
+ anns[0] = new RoleAdmin();
+ event = new LoggedInEvent("ADMIN");
+
+ getManager().fireEvent(event, anns);
+ instance = getManager().getInstance(component);
+
+ Assert.assertTrue(ComponentWithObserves2.hasBeenIntercepted);
+ Assert.assertNotNull(instance.getPayment());
+ Assert.assertEquals("ADMIN", instance.getUser());
+
+ // lessons learned: do it again sam! ;)
+ ComponentWithObserves2.hasBeenIntercepted = false;
+ getManager().fireEvent(event, anns);
+ instance = getManager().getInstance(component);
+
+ Assert.assertTrue(ComponentWithObserves2.hasBeenIntercepted);
+ Assert.assertNotNull(instance.getPayment());
+ Assert.assertEquals("ADMIN", instance.getUser());
+
+ }
+
+ @Test
+ public void testObservesWithEventInjection()
+ {
+ clear();
+
+ getManager().addBean(WebBeansContext.getInstance().getWebBeansUtil().getEventBean());
+
+ AbstractOwbBean<ComponentWithObserves7> component = defineManagedBean(ComponentWithObserves7.class);
+ AbstractOwbBean<ComponentWithObservable1> componentObservable = defineManagedBean(ComponentWithObservable1.class);
+
+ WebBeansContext.getInstance().getContextFactory().initRequestContext(null);
+
+ ComponentWithObserves7 instance = getManager().getInstance(component);
+ ComponentWithObservable1 observable = getManager().getInstance(componentObservable);
+
+ observable.afterLoggedIn();
+
+ Assert.assertEquals("Gurkan", instance.getUserName());
+ Assert.assertEquals("Rohit_Kelapure", instance.getEventString());
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/exception/EventExceptionTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/exception/EventExceptionTest.java
new file mode 100644
index 0000000..bacc0f8
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/exception/EventExceptionTest.java
@@ -0,0 +1,153 @@
+/*
+ * 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.webbeans.test.unittests.event.exception;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.context.NormalScope;
+import javax.enterprise.util.AnnotationLiteral;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.annotation.binding.Binding1;
+import org.apache.webbeans.test.event.LoggedInEvent;
+import org.apache.webbeans.test.event.LoggedInObserver;
+import org.apache.webbeans.test.event.broke.BrokenEvent;
+import org.apache.webbeans.util.ArrayUtil;
+import org.junit.Assert;
+import org.junit.Test;
+
+@SuppressWarnings("unchecked")
+public class EventExceptionTest extends TestContext
+{
+ public EventExceptionTest()
+ {
+ super(EventExceptionTest.class.getName());
+ }
+
+ @Test
+ public void testAddObserverGenericType()
+ {
+ Exception exc = null;
+
+ try
+ {
+ Annotation[] anns = new Annotation[1];
+ anns[0] = new AnnotationLiteral<Binding1>()
+ {
+ };
+
+
+ getManager().fireEvent(new BrokenEvent(), anns);
+
+ }
+ catch (Exception e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+ }
+
+ @Test
+ public void testFireEventGenericType()
+ {
+ Exception exc = null;
+
+ try
+ {
+ Annotation[] anns = new Annotation[1];
+ anns[0] = new AnnotationLiteral<Binding1>()
+ {
+ };
+
+ getManager().fireEvent(new BrokenEvent(), anns);
+ Assert.fail();
+
+ }
+ catch (Exception e)
+ {
+ // this is an expected exception!
+ }
+ }
+
+ @Test
+ public void testAddObserverDuplicateBinding()
+ {
+ Exception exc = null;
+
+ try
+ {
+ Annotation[] anns = new Annotation[2];
+ anns[0] = new AnnotationLiteral<Binding1>()
+ {
+ };
+ anns[1] = new AnnotationLiteral<Binding1>()
+ {
+ };
+
+ LoggedInObserver observer = new LoggedInObserver(ArrayUtil.asSet(anns));
+ WebBeansContext.getInstance().getBeanManagerImpl().getNotificationManager().addObserver(observer, LoggedInEvent.class);
+
+ getManager().fireEvent(new LoggedInEvent(), anns);
+
+ Assert.assertEquals("ok", observer.getResult());
+
+ }
+ catch (Exception e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+
+ }
+
+ @Test
+ public void testAddObserverIllegalArgument()
+ {
+ Exception exc = null;
+
+ try
+ {
+ Annotation[] anns = new Annotation[2];
+ anns[0] = new AnnotationLiteral<NormalScope>()
+ {
+ };
+
+ LoggedInObserver observer = new LoggedInObserver(ArrayUtil.asSet(anns));
+ WebBeansContext.getInstance().getBeanManagerImpl().getNotificationManager().addObserver(observer, LoggedInEvent.class);
+
+ getManager().fireEvent(new LoggedInEvent(), anns);
+
+ Assert.assertEquals("ok", observer.getResult());
+
+ }
+ catch (Exception e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+ }
+
+ Assert.assertNotNull(exc);
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ExceptionComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ExceptionComponentTest.java
new file mode 100644
index 0000000..ea3ed30
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ExceptionComponentTest.java
@@ -0,0 +1,353 @@
+/*
+ * 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.webbeans.test.unittests.exception;
+
+
+import javax.enterprise.inject.spi.Bean;
+
+import java.util.Set;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.test.component.exception.*;
+import org.apache.webbeans.test.component.intercept.NoArgConstructorInterceptorComponent;
+import org.junit.Test;
+
+public class ExceptionComponentTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testFinal()
+ {
+ startContainer(FinalComponent.class);
+ shutDownContainer();
+ }
+
+ @Test
+ public void testInner()
+ {
+ startContainer(InnerComponent.class);
+
+ // this should not have been picked up as managed bean according to CDI-1.0 paragraph 3.1.1
+ Set<Bean<?>> innerinnerComponentBeans = getBeanManager().getBeans(InnerComponent.InnerInnerComponent.class);
+ Assert.assertNotNull(innerinnerComponentBeans);
+ Assert.assertEquals(0, innerinnerComponentBeans.size());
+ shutDownContainer();
+ }
+
+ @Test
+ public void testHasFinalMethod()
+ {
+ try
+ {
+ startContainer(HasFinalMethodComponent.class);
+ }
+ catch (WebBeansConfigurationException e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ shutDownContainer();
+ }
+
+ @Test
+ public void constructorTest()
+ {
+ try
+ {
+ startContainer(MoreThanOneConstructureComponent.class);
+ Assert.fail("expecting an exception!");
+ shutDownContainer();
+ }
+ catch (WebBeansConfigurationException e)
+ {
+ // all ok
+ System.out.println("got expected exception: " + e.getMessage());
+ }
+
+ try
+ {
+ startContainer(MoreThanOneConstructureComponent2.class);
+ // all ok
+ }
+ catch (WebBeansConfigurationException e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ }
+ shutDownContainer();
+
+ startContainer(NoConstructureComponent.class);
+ shutDownContainer();
+ }
+
+ @Test
+ public void testStaticProducerMethod()
+ {
+ startContainer(ProducerTypeStaticComponent.class);
+ shutDownContainer();
+ }
+
+ @Test
+ public void testDisposeMethod()
+ {
+ try
+ {
+ startContainer(MultipleDisposalMethodComponent.class);
+ }
+ catch (WebBeansConfigurationException e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ shutDownContainer();
+ }
+
+ @Test
+ public void testNewInterface()
+ {
+ Assert.assertTrue(true); //No more exist
+ }
+
+ @Test
+ public void testNewBinding()
+ {
+ try
+ {
+ startContainer(NewComponentBindingComponent.class);
+ }
+ catch (WebBeansConfigurationException e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ shutDownContainer();
+ }
+
+ @Test
+ public void testNewMethod()
+ {
+ Assert.assertTrue(true); //No more test in spec
+ }
+
+ @Test
+ public void testMoreThanOnePostConstruct()
+ {
+ try
+ {
+ startContainer(MoreThanOnePostConstructComponent.class);
+ }
+ catch (WebBeansConfigurationException e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ shutDownContainer();
+ }
+
+ @Test
+ public void testPostConstructHasParameter()
+ {
+ try
+ {
+ startContainer(PostContructMethodHasParameterComponent.class);
+ }
+ catch (WebBeansConfigurationException e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ shutDownContainer();
+ }
+
+ @Test
+ public void testPostConstructHasReturnType()
+ {
+ try
+ {
+ startContainer(PostContructMethodHasReturnTypeComponent.class);
+ }
+ catch (WebBeansConfigurationException e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ shutDownContainer();
+ }
+
+ @Test
+ public void testPostConstructHasCheckedException()
+ {
+ try
+ {
+ startContainer(PostContructMethodHasCheckedExceptionComponent.class);
+ }
+ catch (WebBeansConfigurationException e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ shutDownContainer();
+ }
+
+ @Test
+ public void testPostConstructHasStatic()
+ {
+ try
+ {
+ startContainer(PostContructMethodHasStaticComponent.class);
+ }
+ catch (WebBeansConfigurationException e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ shutDownContainer();
+ }
+
+ @Test
+ public void testMoreThanOneAroundInvoke()
+ {
+ try
+ {
+ startContainer(MoreThanOneAroundInvokeComponent.class);
+ }
+ catch (WebBeansConfigurationException e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ shutDownContainer();
+ }
+
+ @Test
+ public void testAroundInvokeWithSameMethodName()
+ {
+ startContainer(AroundInvokeWithSameMethodNameComponent.class);
+ shutDownContainer();
+ }
+
+ @Test
+ public void testAroundInvokeWithoutParameter()
+ {
+ try
+ {
+
+ startContainer(AroundInvokeWithoutParameterComponent.class);
+ }
+ catch (WebBeansConfigurationException e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ shutDownContainer();
+ }
+
+ @Test
+ public void testAroundInvokeWithoutReturnType()
+ {
+ try
+ {
+ startContainer(AroundInvokeWithoutReturnTypeComponent.class);
+ }
+ catch (WebBeansConfigurationException e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ shutDownContainer();
+ }
+
+ @Test
+ public void testAroundInvokeWithWrongReturnType()
+ {
+ try
+ {
+ startContainer(AroundInvokeWithWrongReturnTypeComponent.class);
+ }
+ catch (WebBeansConfigurationException e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ shutDownContainer();
+ }
+
+ @Test
+ public void testAroundInvokeWithStatic()
+ {
+ try
+ {
+ startContainer(AroundInvokeWithStaticMethodComponent.class);
+ }
+ catch (WebBeansConfigurationException e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ shutDownContainer();
+ }
+
+ @Test
+ public void testAroundInvokeWithFinal()
+ {
+ try
+ {
+ startContainer(AroundInvokeWithFinalMethodComponent.class);
+ }
+ catch (WebBeansConfigurationException e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ shutDownContainer();
+ }
+
+ @Test
+ public void testNoArgConstructorInterceptor()
+ {
+ try
+ {
+ startContainer(NoArgConstructorInterceptorComponent.class);
+ }
+ catch (WebBeansConfigurationException e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ shutDownContainer();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ScopeTypeExceptionComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ScopeTypeExceptionComponentTest.java
new file mode 100644
index 0000000..de96625
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ScopeTypeExceptionComponentTest.java
@@ -0,0 +1,148 @@
+/*
+ * 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.webbeans.test.unittests.exception;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.exception.stero.ComponentDefaultScopeWithDifferentScopeSteros;
+import org.apache.webbeans.test.component.exception.stero.ComponentDefaultScopeWithNonScopeStero;
+import org.apache.webbeans.test.component.exception.stero.ComponentNonDefaultScopeWithDifferentScopeSteros;
+import org.apache.webbeans.test.component.exception.stero.ComponentWithDefaultScopeStero;
+import org.apache.webbeans.test.component.exception.stero.ComponentWithDifferentScopeSteros;
+import org.apache.webbeans.test.component.exception.stero.ComponentWithNonScopeStero;
+import org.apache.webbeans.test.component.exception.stero.ComponentWithSameScopeSteros;
+import org.apache.webbeans.test.component.exception.stero.ComponentWithoutScopeStero;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ScopeTypeExceptionComponentTest extends TestContext
+{
+
+ public ScopeTypeExceptionComponentTest()
+ {
+ super(ScopeTypeExceptionComponentTest.class.getName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ super.init();
+ }
+
+ @Test
+ public void testComponentWithNonScopeStero()
+ {
+ clear();
+ defineManagedBean(ComponentWithNonScopeStero.class);
+ Bean<?> bean = getComponents().get(0);
+
+ Assert.assertEquals(Dependent.class, bean.getScope());
+ }
+
+ @Test
+ public void testComponentDefaultScopeWithNonScopeStero()
+ {
+ clear();
+ defineManagedBean(ComponentDefaultScopeWithNonScopeStero.class);
+ Bean<?> bean = getComponents().get(0);
+
+ Assert.assertEquals(SessionScoped.class, bean.getScope());
+ }
+
+ @Test
+ public void testComponentWithDefaultScopeStero()
+ {
+ clear();
+ defineManagedBean(ComponentWithDefaultScopeStero.class);
+ Bean<?> bean = getComponents().get(0);
+
+ Assert.assertEquals(RequestScoped.class, bean.getScope());
+ }
+
+ @Test
+ public void testComponentWithDifferentScopeSteros()
+ {
+ clear();
+ try
+ {
+ defineManagedBean(ComponentWithDifferentScopeSteros.class);
+ }
+ catch (WebBeansConfigurationException e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ }
+
+ @Test
+ public void testComponentWithoutScopeStero()
+ {
+ clear();
+ defineManagedBean(ComponentWithoutScopeStero.class);
+ Bean<?> bean = getComponents().get(0);
+
+ Assert.assertEquals(Dependent.class, bean.getScope());
+ }
+
+ @Test
+ public void testComponentWithSameScopeSteros()
+ {
+ clear();
+ defineManagedBean(ComponentWithSameScopeSteros.class);
+ Bean<?> bean = getComponents().get(0);
+
+ Assert.assertEquals(SessionScoped.class, bean.getScope());
+ }
+
+ @Test
+ public void testComponentDefaultScopeWithDifferentScopeSteros()
+ {
+ clear();
+ defineManagedBean(ComponentDefaultScopeWithDifferentScopeSteros.class);
+ Bean<?> bean = getComponents().get(0);
+
+ Assert.assertEquals(SessionScoped.class, bean.getScope());
+ }
+
+ @Test
+ public void testComponentNonDefaultScopeWithDifferentScopeSteros()
+ {
+ clear();
+ try
+ {
+ defineManagedBean(ComponentNonDefaultScopeWithDifferentScopeSteros.class);
+ }
+ catch (WebBeansConfigurationException e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/initializer/BrokenInitializerTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/initializer/BrokenInitializerTest.java
new file mode 100644
index 0000000..49679c8
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/initializer/BrokenInitializerTest.java
@@ -0,0 +1,115 @@
+/*
+ * 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.webbeans.test.unittests.exception.initializer;
+
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.exception.initializer.BrokenInitializer1;
+import org.apache.webbeans.test.component.exception.initializer.BrokenInitializer2;
+import org.apache.webbeans.test.component.exception.initializer.BrokenInitializer3;
+import org.apache.webbeans.test.component.exception.initializer.BrokenInitializer4;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class BrokenInitializerTest extends TestContext
+{
+ public BrokenInitializerTest()
+ {
+ super(BrokenInitializerTest.class.getName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ }
+
+ @Test
+ public void broken1()
+ {
+ Exception e = null;
+
+ try
+ {
+ defineManagedBean(BrokenInitializer1.class);
+
+ }catch(Exception e1)
+ {
+ System.out.println(e1.getMessage());
+ e = e1;
+ }
+
+ Assert.assertNotNull(e);
+ }
+
+ @Test
+ public void broken2()
+ {
+ Exception e = null;
+
+ try
+ {
+ defineManagedBean(BrokenInitializer2.class);
+
+ }catch(Exception e1)
+ {
+ System.out.println(e1.getMessage());
+ e = e1;
+ }
+
+ Assert.assertNotNull(e);
+ }
+
+ @Test
+ public void broken3()
+ {
+ Exception e = null;
+
+ try
+ {
+ defineManagedBean(BrokenInitializer3.class);
+
+ }catch(Exception e1)
+ {
+ System.out.println(e1.getMessage());
+ e = e1;
+ }
+
+ Assert.assertNotNull(e);
+ }
+
+ @Test
+ public void broken4()
+ {
+ Exception e = null;
+
+ try
+ {
+ defineManagedBean(BrokenInitializer4.class);
+
+ }catch(Exception e1)
+ {
+ System.out.println(e1.getMessage());
+ e = e1;
+ }
+
+ Assert.assertNotNull(e);
+ }
+
+ }
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/CurrentInjectedComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/CurrentInjectedComponentTest.java
new file mode 100644
index 0000000..7b75979
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/CurrentInjectedComponentTest.java
@@ -0,0 +1,92 @@
+/*
+ * 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.webbeans.test.unittests.inject;
+
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.ContaintsCurrentComponent;
+import org.apache.webbeans.test.component.CurrentBindingComponent;
+import org.apache.webbeans.test.component.service.ITyped2;
+import org.apache.webbeans.test.component.service.Typed2;
+import org.junit.Before;
+import org.junit.Test;
+
+public class CurrentInjectedComponentTest extends TestContext
+{
+ public CurrentInjectedComponentTest()
+ {
+ super(CurrentInjectedComponentTest.class.getSimpleName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ super.init();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testTypedComponent() throws Throwable
+ {
+ clear();
+
+ defineManagedBean(Typed2.class);
+ defineManagedBean(CurrentBindingComponent.class);
+ defineManagedBean(ContaintsCurrentComponent.class);
+ List<AbstractOwbBean<?>> comps = getComponents();
+
+ Object session = getSession();
+ ContextFactory contextFactory = WebBeansContext.getInstance().getContextFactory();
+ contextFactory.initRequestContext(null);
+ contextFactory.initSessionContext(session);
+
+ Assert.assertEquals(3, comps.size());
+
+ getManager().getInstance(comps.get(0));
+ getManager().getInstance(comps.get(1));
+
+ Object object = getManager().getInstance(comps.get(2));
+
+ Assert.assertTrue(object instanceof ContaintsCurrentComponent);
+
+ ContaintsCurrentComponent i = (ContaintsCurrentComponent) object;
+
+ Assert.assertTrue(i.getInstance() instanceof CurrentBindingComponent);
+
+ Object obj2 = getManager().getInstance(comps.get(1));
+
+ Assert.assertSame(i.getInstance().getTyped2(), ((CurrentBindingComponent) obj2).getTyped2());
+
+ CurrentBindingComponent bc = (CurrentBindingComponent) obj2;
+ ITyped2 typed2 = bc.getTyped2();
+
+ Assert.assertNotNull(typed2);
+
+ contextFactory.destroyRequestContext(null);
+ contextFactory.destroySessionContext(session);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/DisposalInjectedComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/DisposalInjectedComponentTest.java
new file mode 100644
index 0000000..c49088c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/DisposalInjectedComponentTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.webbeans.test.unittests.inject;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.junit.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.test.component.DisposalMethodComponent;
+import org.apache.webbeans.test.component.service.IService;
+import org.apache.webbeans.test.component.service.ServiceImpl1;
+import org.junit.Test;
+
+public class DisposalInjectedComponentTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testTypedComponent() throws Throwable
+ {
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(DisposalMethodComponent.class);
+ classes.add(ServiceImpl1.class);
+
+ startContainer(classes, null);
+
+
+ IService producedService = getInstance("service");
+
+ Assert.assertNotNull(producedService);
+
+ IService service = getInstance(IService.class);
+
+ Assert.assertEquals("ServiceImpl1", service.service());
+
+ DisposalMethodComponent mc = getInstance(DisposalMethodComponent.class);
+
+ IService s = mc.service();
+
+ Assert.assertNotNull(s);
+
+
+ shutDownContainer();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/InjectedComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/InjectedComponentTest.java
new file mode 100644
index 0000000..33b16e4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/InjectedComponentTest.java
@@ -0,0 +1,72 @@
+/*
+ * 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.webbeans.test.unittests.inject;
+
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.service.InjectedComponent;
+import org.apache.webbeans.test.component.service.ServiceImpl1;
+import org.junit.Before;
+import org.junit.Test;
+
+public class InjectedComponentTest extends TestContext
+{
+
+ public InjectedComponentTest()
+ {
+ super(InjectedComponentTest.class.getSimpleName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ super.init();
+ }
+
+ @Test
+ public void testTypedComponent() throws Throwable
+ {
+ clear();
+
+ defineManagedBean(InjectedComponent.class);
+ defineManagedBean(ServiceImpl1.class);
+ List<AbstractOwbBean<?>> comps = getComponents();
+
+ ContextFactory contextFactory = WebBeansContext.getInstance().getContextFactory();
+ contextFactory.initRequestContext(null);
+ contextFactory.initApplicationContext(null);
+
+ Assert.assertEquals(2, comps.size());
+
+ Object object = getManager().getInstance(comps.get(0));
+
+ Assert.assertTrue(object instanceof InjectedComponent);
+
+ contextFactory.destroyApplicationContext(null);
+ contextFactory.destroyRequestContext(null);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/InjectedComponentWithMemberTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/InjectedComponentWithMemberTest.java
new file mode 100644
index 0000000..ef8bcf5
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/InjectedComponentWithMemberTest.java
@@ -0,0 +1,80 @@
+/*
+ * 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.webbeans.test.unittests.inject;
+
+import java.util.List;
+
+import javax.enterprise.inject.spi.BeanManager;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.BindingComponent;
+import org.apache.webbeans.test.component.NonBindingComponent;
+import org.junit.Before;
+import org.junit.Test;
+
+public class InjectedComponentWithMemberTest extends TestContext
+{
+ BeanManager container = null;
+
+ public InjectedComponentWithMemberTest()
+ {
+ super(InjectedComponentWithMemberTest.class.getSimpleName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ super.init();
+ this.container = WebBeansContext.getInstance().getBeanManagerImpl();
+ }
+
+ @Test
+ public void testTypedComponent() throws Throwable
+ {
+ clear();
+ defineManagedBean(BindingComponent.class);
+ defineManagedBean(NonBindingComponent.class);
+ List<AbstractOwbBean<?>> comps = getComponents();
+
+ Object session = getSession();
+ ContextFactory contextFactory = WebBeansContext.getInstance().getContextFactory();
+ contextFactory.initSessionContext(session);
+
+ Assert.assertEquals(2, comps.size());
+
+ getManager().getInstance(comps.get(0));
+ Object object = getManager().getInstance(comps.get(1));
+
+ Assert.assertTrue(object instanceof NonBindingComponent);
+
+ NonBindingComponent comp = (NonBindingComponent) object;
+ BindingComponent bc = comp.getComponent();
+
+ Assert.assertTrue(bc != null);
+
+ contextFactory.destroySessionContext(session);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/PaymentProcessorComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/PaymentProcessorComponentTest.java
new file mode 100644
index 0000000..533f5ec
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/PaymentProcessorComponentTest.java
@@ -0,0 +1,90 @@
+/*
+ * 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.webbeans.test.unittests.inject;
+
+import java.util.List;
+
+import javax.enterprise.inject.spi.BeanManager;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.CheckWithCheckPayment;
+import org.apache.webbeans.test.component.CheckWithMoneyPayment;
+import org.apache.webbeans.test.component.IPayment;
+import org.apache.webbeans.test.component.PaymentProcessorComponent;
+import org.junit.Before;
+import org.junit.Test;
+
+public class PaymentProcessorComponentTest extends TestContext
+{
+ BeanManager container = null;
+
+ public PaymentProcessorComponentTest()
+ {
+ super(PaymentProcessorComponentTest.class.getSimpleName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ super.init();
+ }
+
+ @Test
+ public void testTypedComponent() throws Throwable
+ {
+ clear();
+
+ defineManagedBean(CheckWithCheckPayment.class);
+ defineManagedBean(CheckWithMoneyPayment.class);
+ defineManagedBean(PaymentProcessorComponent.class);
+
+ List<AbstractOwbBean<?>> comps = getComponents();
+
+ WebBeansContext.getInstance().getContextFactory().initRequestContext(null);
+
+ Assert.assertEquals(3, comps.size());
+
+ getManager().getInstance(comps.get(0));
+ getManager().getInstance(comps.get(1));
+
+ Object object = getManager().getInstance(comps.get(2));
+ Assert.assertNotNull(object);
+ Assert.assertTrue(object instanceof PaymentProcessorComponent);
+
+ PaymentProcessorComponent uc = (PaymentProcessorComponent) object;
+ IPayment p = uc.getPaymentCheck();
+
+ Assert.assertTrue(p instanceof CheckWithCheckPayment);
+ Assert.assertEquals("CHECK", p.pay());
+
+ p = uc.getPaymentMoney();
+
+ Assert.assertTrue(p instanceof CheckWithMoneyPayment);
+
+ Assert.assertEquals("MONEY", p.pay());
+
+ WebBeansContext.getInstance().getContextFactory().destroyRequestContext(null);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/TypedComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/TypedComponentTest.java
new file mode 100644
index 0000000..3617a4e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/TypedComponentTest.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.unittests.inject;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.InjectionResolver;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.service.ITyped;
+import org.apache.webbeans.test.component.service.TypedComponent;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TypedComponentTest extends TestContext
+{
+ BeanManager container = null;
+ ITyped<String> s = null;
+
+ public TypedComponentTest()
+ {
+ super(TypedComponentTest.class.getSimpleName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ super.init();
+ }
+
+ @Test
+ public void testTypedComponent() throws Throwable
+ {
+ clear();
+ defineManagedBean(TypedComponent.class);
+
+ InjectionResolver injectionResolver = WebBeansContext.getInstance().getBeanManagerImpl().getInjectionResolver();
+
+ Set<Bean<?>> beans= injectionResolver.implResolveByType(false, TypedComponentTest.class.getDeclaredField("s").getGenericType(), new Default()
+ {
+
+ @Override
+ public Class<? extends Annotation> annotationType()
+ {
+
+ return Default.class;
+ }
+
+ });
+
+ Assert.assertTrue(beans.size() == 1 ? true : false);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/TypedInjectedComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/TypedInjectedComponentTest.java
new file mode 100644
index 0000000..2161505
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/TypedInjectedComponentTest.java
@@ -0,0 +1,125 @@
+/*
+ * 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.webbeans.test.unittests.inject;
+
+import java.util.List;
+
+import javax.enterprise.inject.spi.BeanManager;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.service.ITyped2;
+import org.apache.webbeans.test.component.service.Typed2;
+import org.apache.webbeans.test.component.service.TypedInjection;
+import org.apache.webbeans.test.component.service.TypedInjectionWithoutArguments;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TypedInjectedComponentTest extends TestContext
+{
+ BeanManager container = null;
+
+ public TypedInjectedComponentTest()
+ {
+ super(TypedInjectedComponentTest.class.getSimpleName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ super.init();
+ this.container = WebBeansContext.getInstance().getBeanManagerImpl();
+ }
+
+ @Test
+ public void testTypedComponent() throws Throwable
+ {
+ clear();
+
+ defineManagedBean(Typed2.class);
+ defineManagedBean(TypedInjection.class);
+ List<AbstractOwbBean<?>> comps = getComponents();
+
+ Object session = getSession();
+
+ ContextFactory contextFactory = WebBeansContext.getInstance().getContextFactory();
+ contextFactory.initSessionContext(session);
+
+ Assert.assertEquals(2, comps.size());
+
+ getManager().getInstance(comps.get(0));
+
+ Object object = getManager().getInstance(comps.get(1));
+
+ Assert.assertTrue(object instanceof TypedInjection);
+
+ TypedInjection i = (TypedInjection) object;
+ Typed2 typed2 = (Typed2)i.getV();
+ typed2.setValue(true);
+
+
+ Assert.assertTrue(i.getV() instanceof ITyped2);
+
+ Typed2 obj2 = (Typed2)getManager().getInstance(comps.get(0));
+
+ Assert.assertSame(typed2.isValue(), obj2.isValue());
+
+ contextFactory.destroySessionContext(session);
+ }
+
+ @Test
+ public void testTypedComponentWithoutArgument() throws Throwable
+ {
+ clear();
+
+ defineManagedBean(Typed2.class);
+ defineManagedBean(TypedInjectionWithoutArguments.class);
+ List<AbstractOwbBean<?>> comps = getComponents();
+
+ Object session = getSession();
+
+ ContextFactory contextFactory = WebBeansContext.getInstance().getContextFactory();
+ contextFactory.initSessionContext(session);
+
+ Assert.assertEquals(2, comps.size());
+
+ getManager().getInstance(comps.get(0));
+ Object object = getManager().getInstance(comps.get(1));
+
+ Assert.assertTrue(object instanceof TypedInjectionWithoutArguments);
+
+ TypedInjectionWithoutArguments i = (TypedInjectionWithoutArguments) object;
+ Typed2 typed2 = (Typed2)i.getV();
+ typed2.setValue(true);
+
+ Assert.assertTrue(i.getV() instanceof ITyped2);
+
+ Typed2 obj2 = (Typed2)getManager().getInstance(comps.get(0));
+
+ Assert.assertSame(typed2.isValue(), obj2.isValue());
+
+ contextFactory.destroySessionContext(session);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/UserComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/UserComponentTest.java
new file mode 100644
index 0000000..b8eb852
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/UserComponentTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.webbeans.test.unittests.inject;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.enterprise.inject.spi.BeanManager;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.test.component.ContainUserComponent;
+import org.apache.webbeans.test.component.UserComponent;
+import org.junit.Test;
+
+public class UserComponentTest extends AbstractUnitTest
+{
+ BeanManager container = null;
+
+
+ @Test
+ public void testTypedComponent() throws Throwable
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(UserComponent.class);
+ beanClasses.add(ContainUserComponent.class);
+
+ startContainer(beanClasses, null);
+
+ UserComponent userComponent = getInstance(UserComponent.class);
+ userComponent.setName("Gurkan");
+ userComponent.setSurname("Erdogdu");
+
+ Assert.assertNotNull(userComponent);
+
+ ContainUserComponent uc = getInstance(ContainUserComponent.class);
+
+ Assert.assertNotNull(uc.echo());
+ Assert.assertEquals(uc.echo(), userComponent.getName() + " " + userComponent.getSurname());
+
+ shutDownContainer();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/alternative/AlternativeTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/alternative/AlternativeTest.java
new file mode 100644
index 0000000..64958a0
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/alternative/AlternativeTest.java
@@ -0,0 +1,96 @@
+/*
+ * 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.webbeans.test.unittests.inject.alternative;
+
+import java.io.InputStream;
+
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.inject.alternative.AlternativeComponent;
+import org.apache.webbeans.test.component.inject.alternative.AlternativeInjector;
+import org.apache.webbeans.test.component.inject.alternative.IAlternative;
+import org.apache.webbeans.test.component.inject.alternative.NotAlternativeComponent;
+import org.apache.webbeans.xml.WebBeansXMLConfigurator;
+import org.junit.Before;
+import org.junit.Test;
+
+public class AlternativeTest extends TestContext
+{
+ public AlternativeTest()
+ {
+ super(AlternativeTest.class.getName());
+ }
+
+ @Before
+ public void setUp()
+ {
+ super.init();
+ }
+
+ @Test
+ public void testInjectAlternative()
+ {
+ InputStream stream = getClass().getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/alternative/alternatives.xml");
+ Assert.assertNotNull(stream);
+
+ WebBeansXMLConfigurator configurator = new WebBeansXMLConfigurator();
+ configurator.configureSpecSpecific(stream, "alternative.xml");
+
+ defineManagedBean(AlternativeComponent.class);
+ defineManagedBean(NotAlternativeComponent.class);
+
+ Bean<AlternativeInjector> injector = defineManagedBean(AlternativeInjector.class);
+ AlternativeInjector instance = (AlternativeInjector) getManager().getReference(injector, AlternativeInjector.class, getManager().createCreationalContext(injector));
+
+ Assert.assertNotNull(instance);
+
+ IAlternative alternative = instance.getAlternative();
+
+ Assert.assertTrue(alternative instanceof AlternativeComponent);
+
+ WebBeansContext.getInstance().getPluginLoader().shutDown();
+
+ }
+
+ @Test
+ public void testInjectNotAlternative()
+ {
+ WebBeansContext.getInstance().getAlternativesManager().clear();
+
+ defineManagedBean(AlternativeComponent.class);
+ defineManagedBean(NotAlternativeComponent.class);
+
+ Bean<AlternativeInjector> injector = defineManagedBean(AlternativeInjector.class);
+ AlternativeInjector instance = (AlternativeInjector) getManager().getReference(injector, AlternativeInjector.class, getManager().createCreationalContext(injector));
+
+ Assert.assertNotNull(instance);
+
+ IAlternative alternative = instance.getAlternative();
+
+ Assert.assertTrue(alternative instanceof NotAlternativeComponent);
+
+ WebBeansContext.getInstance().getPluginLoader().shutDown();
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/broken/InjectedInstanceBrokenComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/broken/InjectedInstanceBrokenComponentTest.java
new file mode 100644
index 0000000..36e397a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/broken/InjectedInstanceBrokenComponentTest.java
@@ -0,0 +1,118 @@
+/*
+ * 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.webbeans.test.unittests.inject.broken;
+
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.inject.broken.InstanceInjectedBrokenComponent1;
+import org.apache.webbeans.test.component.inject.broken.InstanceInjectedBrokenComponent2;
+import org.apache.webbeans.test.component.inject.broken.InstanceInjectedBrokenComponent3;
+import org.apache.webbeans.test.component.inject.broken.InstanceInjectedBrokenComponent4;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class InjectedInstanceBrokenComponentTest extends TestContext
+{
+ public InjectedInstanceBrokenComponentTest()
+ {
+ super(InjectedInstanceBrokenComponentTest.class.getName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ super.init();
+
+ }
+
+ @Test
+ public void testInjectedInstanceBrokenComponent1()
+ {
+ Exception e = null;
+
+ try
+ {
+ defineManagedBean(InstanceInjectedBrokenComponent1.class);
+
+ }catch(Exception e1)
+ {
+ e = e1;
+ System.out.println(e.getMessage());
+ }
+
+ Assert.assertNotNull(e);
+ }
+
+ @Test
+ public void testInjectedInstanceBrokenComponent2()
+ {
+ Exception e = null;
+
+ try
+ {
+ defineManagedBean(InstanceInjectedBrokenComponent2.class);
+
+ }catch(Exception e1)
+ {
+ e = e1;
+ System.out.println(e.getMessage());
+ }
+
+ Assert.assertNull(e);
+ }
+
+ @Test
+ public void testInjectedInstanceBrokenComponent3()
+ {
+ Exception e = null;
+
+ try
+ {
+ defineManagedBean(InstanceInjectedBrokenComponent3.class);
+
+ }catch(Exception e1)
+ {
+ e = e1;
+ System.out.println(e.getMessage());
+ }
+
+ Assert.assertNotNull(e);
+ }
+
+ @Test
+ public void testInjectedInstanceBrokenComponent4()
+ {
+ Exception e = null;
+
+ try
+ {
+ defineManagedBean(InstanceInjectedBrokenComponent4.class);
+
+ }
+ catch(Exception e1)
+ {
+ e = e1;
+ System.out.println(e.getMessage());
+ }
+
+ Assert.assertNotNull(e);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/named/NamedTests.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/named/NamedTests.java
new file mode 100644
index 0000000..5a9851b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/named/NamedTests.java
@@ -0,0 +1,162 @@
+/*
+ * 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.webbeans.test.unittests.inject.named;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Named;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.portable.AnnotatedElementFactory;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.IPayment;
+import org.apache.webbeans.test.component.inject.named.NamedFieldWithNamedValue;
+import org.apache.webbeans.test.component.inject.named.NamedFieldWithoutNamedValue;
+import org.apache.webbeans.test.component.inject.named.NamedOtherWithNamedValue;
+import org.apache.webbeans.test.component.inject.named.NamedOtherWithoutNamedValue;
+import org.apache.webbeans.util.WebBeansUtil;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class NamedTests extends TestContext
+{
+ public NamedTests()
+ {
+ super(NamedTests.class.getName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ super.init();
+ }
+
+
+ @Test
+ public void testFieldWithNamedValue() throws Exception
+ {
+ Bean<NamedFieldWithNamedValue> bean = defineManagedBean(NamedFieldWithNamedValue.class);
+ Field field = NamedFieldWithNamedValue.class.getDeclaredField("paymentProcessor");
+
+ AnnotatedElementFactory annotatedElementFactory = WebBeansContext.getInstance().getAnnotatedElementFactory();
+ AnnotatedType<NamedFieldWithNamedValue> annotatedType = (AnnotatedType<NamedFieldWithNamedValue>) annotatedElementFactory.getAnnotatedType(field.getDeclaringClass());
+ AnnotatedField<NamedFieldWithNamedValue> annotatedField = annotatedElementFactory.newAnnotatedField(field, annotatedType);
+ InjectionPoint point =
+ WebBeansContext.getInstance().getInjectionPointFactory().buildInjectionPoint(bean, annotatedField);
+
+ WebBeansUtil.checkInjectionPointNamedQualifier(point);
+
+ String value = qulifier(point);
+
+ Assert.assertEquals("payment", value);
+ }
+
+ @Test
+ public void testFieldWithoutNamedValue() throws Exception
+ {
+ Bean<NamedFieldWithoutNamedValue> bean = defineManagedBean(NamedFieldWithoutNamedValue.class);
+ Field field = NamedFieldWithoutNamedValue.class.getDeclaredField("paymentProcessor");
+
+ AnnotatedElementFactory annotatedElementFactory = WebBeansContext.getInstance().getAnnotatedElementFactory();
+ AnnotatedType<NamedFieldWithNamedValue> annotatedType = (AnnotatedType<NamedFieldWithNamedValue>) annotatedElementFactory.getAnnotatedType(field.getDeclaringClass());
+ AnnotatedField<NamedFieldWithNamedValue> annotatedField = annotatedElementFactory.newAnnotatedField(field, annotatedType);
+ InjectionPoint point =
+ WebBeansContext.getInstance().getInjectionPointFactory().buildInjectionPoint(bean, annotatedField);
+
+ WebBeansUtil.checkInjectionPointNamedQualifier(point);
+
+ String value = qulifier(point);
+
+ Assert.assertEquals("paymentProcessor", value);
+
+ }
+
+ @Test
+ public void testOtherWithNamedValue() throws Exception
+ {
+ Bean<NamedOtherWithNamedValue> bean = defineManagedBean(NamedOtherWithNamedValue.class);
+ Constructor<NamedOtherWithNamedValue> constructor = NamedOtherWithNamedValue.class.getDeclaredConstructor(new Class<?>[]{IPayment.class});
+
+ AnnotatedElementFactory annotatedElementFactory = WebBeansContext.getInstance().getAnnotatedElementFactory();
+ AnnotatedType<NamedOtherWithNamedValue> annotatedType = annotatedElementFactory.getAnnotatedType(constructor.getDeclaringClass());
+ AnnotatedConstructor<NamedOtherWithNamedValue> annotatedConstructor = annotatedElementFactory.newAnnotatedConstructor(constructor, annotatedType);
+ InjectionPoint point =
+ WebBeansContext.getInstance().getInjectionPointFactory().buildInjectionPoints(bean, annotatedConstructor).get(0);
+
+ WebBeansUtil.checkInjectionPointNamedQualifier(point);
+
+ String value = qulifier(point);
+
+ Assert.assertEquals("value", value);
+
+ }
+
+ @Test(expected=WebBeansConfigurationException.class)
+ public void testOtherWithoutNamedValue() throws Exception
+ {
+ Bean<NamedOtherWithoutNamedValue> bean = defineManagedBean(NamedOtherWithoutNamedValue.class);
+ Constructor<NamedOtherWithoutNamedValue> constructor = NamedOtherWithoutNamedValue.class.getDeclaredConstructor(new Class<?>[]{IPayment.class});
+
+ AnnotatedElementFactory annotatedElementFactory = WebBeansContext.getInstance().getAnnotatedElementFactory();
+ AnnotatedType<NamedOtherWithoutNamedValue> annotatedType = annotatedElementFactory.getAnnotatedType(constructor.getDeclaringClass());
+ AnnotatedConstructor<NamedOtherWithoutNamedValue> annotatedConstructor = annotatedElementFactory.newAnnotatedConstructor(constructor, annotatedType);
+ InjectionPoint point =
+ WebBeansContext.getInstance().getInjectionPointFactory().buildInjectionPoints(bean, annotatedConstructor).get(0);
+
+ String value = qulifier(point);
+
+ Assert.assertEquals("", value);
+
+ WebBeansUtil.checkInjectionPointNamedQualifier(point);
+
+ }
+
+
+ private String qulifier(InjectionPoint injectionPoint)
+ {
+ Set<Annotation> qualifierset = injectionPoint.getQualifiers();
+ Named namedQualifier = null;
+ for(Annotation qualifier : qualifierset)
+ {
+ if(qualifier.annotationType().equals(Named.class))
+ {
+ namedQualifier = (Named)qualifier;
+ break;
+ }
+ }
+
+ if(namedQualifier != null)
+ {
+ return namedQualifier.value();
+ }
+
+ return null;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/parametrized/BoundedTypeVariableTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/parametrized/BoundedTypeVariableTest.java
new file mode 100644
index 0000000..464f59e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/parametrized/BoundedTypeVariableTest.java
@@ -0,0 +1,94 @@
+/*
+ * 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.webbeans.test.unittests.inject.parametrized;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.inject.parametrized.BoundedTypeVariableComponent;
+import org.apache.webbeans.util.ClassUtil;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class BoundedTypeVariableTest extends TestContext
+{
+ public BoundedTypeVariableTest()
+ {
+ super(BoundedTypeVariableTest.class.getName());
+ }
+
+ @Test
+ public void testBoundedTypeVariableTest()
+ {
+ try
+ {
+ Field field1 = BoundedTypeVariableComponent.class.getField("field1");
+ Field field2 = BoundedTypeVariableComponent.class.getField("field2");
+ Field field3 = BoundedTypeVariableComponent.class.getField("field3");
+ Field field4 = BoundedTypeVariableComponent.class.getField("field4");
+ Field field5 = BoundedTypeVariableComponent.class.getField("field5");
+ Field field6 = BoundedTypeVariableComponent.class.getField("field6");
+ Field field7 = BoundedTypeVariableComponent.class.getField("field7");
+
+ ParameterizedType pt = (ParameterizedType)field1.getGenericType();
+ Type argument = pt.getActualTypeArguments()[0];
+
+ Assert.assertFalse(ClassUtil.isUnboundedTypeVariable(argument));
+
+ pt = (ParameterizedType)field2.getGenericType();
+ argument = pt.getActualTypeArguments()[0];
+
+ Assert.assertFalse(ClassUtil.isUnboundedTypeVariable(argument));
+
+ pt = (ParameterizedType)field3.getGenericType();
+ argument = pt.getActualTypeArguments()[0];
+
+ Assert.assertTrue(ClassUtil.isUnboundedTypeVariable(argument));
+
+ pt = (ParameterizedType)field4.getGenericType();
+ argument = pt.getActualTypeArguments()[0];
+
+ Assert.assertFalse(ClassUtil.isUnboundedTypeVariable(argument));
+
+ argument = field5.getGenericType();
+
+ Assert.assertFalse(ClassUtil.isUnboundedTypeVariable(argument));
+
+ Type[] arguments = ((ParameterizedType)field6.getGenericType()).getActualTypeArguments();
+
+ for(Type arg : arguments)
+ {
+ Assert.assertTrue(ClassUtil.isUnboundedTypeVariable(arg));
+ }
+
+ pt = (ParameterizedType)field7.getGenericType();
+ argument = pt.getActualTypeArguments()[0];
+
+ Assert.assertFalse(ClassUtil.isUnboundedTypeVariable(argument));
+
+
+ }catch(Exception e)
+ {
+ fail("BoundedWildCardTest");
+ }
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/parametrized/GenericClassTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/parametrized/GenericClassTest.java
new file mode 100644
index 0000000..cd00dce
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/parametrized/GenericClassTest.java
@@ -0,0 +1,126 @@
+/*
+ * 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.webbeans.test.unittests.inject.parametrized;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Type;
+
+import org.apache.webbeans.newtests.injection.generics.zoo.Horse;
+import org.apache.webbeans.newtests.injection.generics.zoo.HorseStable;
+import org.apache.webbeans.newtests.injection.generics.zoo.Pig;
+import org.apache.webbeans.newtests.injection.generics.zoo.PigStable;
+import org.apache.webbeans.newtests.injection.generics.zoo.Stable;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.inject.parametrized.Dao;
+import org.apache.webbeans.test.component.inject.parametrized.UserDao;
+import org.apache.webbeans.test.component.inject.parametrized.WithTypeVariable;
+import org.apache.webbeans.util.GenericsUtil;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class GenericClassTest extends TestContext
+{
+ public GenericClassTest()
+ {
+ super(GenericClassTest.class.getName());
+ }
+
+ @Test
+ public void testGenericClasses()
+ {
+ try
+ {
+ Field t = Dao.class.getField("t");
+ Field raw = Dao.class.getField("raw");
+ Field check22 = Dao.class.getField("check22");
+ Field check22Bound = Dao.class.getField("check22WithBound");
+ Field check4 = WithTypeVariable.class.getField("check4");
+
+ Assert.assertFalse(GenericsUtil.satisfiesDependency(false, raw.getGenericType(), t.getGenericType()));
+ Assert.assertTrue(GenericsUtil.satisfiesDependency(false, check4.getGenericType(), t.getGenericType()));
+ Assert.assertTrue(GenericsUtil.satisfiesDependency(false, check22.getGenericType(), t.getGenericType()));
+ Assert.assertTrue(GenericsUtil.satisfiesDependency(false, check22Bound.getGenericType(), t.getGenericType()));
+
+ }catch(Exception e)
+ {
+ e.printStackTrace();
+ fail("testGenericClasses");
+ }
+ }
+
+ @Test
+ public void testGenericClasses2()
+ {
+ try
+ {
+ Field f1 = UserDao.class.getField("field1");
+ Field f2 = UserDao.class.getField("field2");
+ Field f3 = UserDao.class.getField("field3");
+ Field f4 = UserDao.class.getField("field4");
+
+
+ Assert.assertTrue(GenericsUtil.satisfiesDependency(false, f3.getGenericType(), f1.getGenericType()));
+ Assert.assertTrue(GenericsUtil.satisfiesDependency(false, f4.getGenericType(), f1.getGenericType()));
+
+ }catch(Exception e)
+ {
+ e.printStackTrace();
+ fail("testGenericClasses");
+ }
+ }
+
+ @Test
+ public void testStable() throws Exception
+ {
+ Type parameterizedPigStableType = this.getClass().getDeclaredField("parameterizedPigStable").getGenericType();
+ Type parameterizedHorseStableType = this.getClass().getDeclaredField("parameterizedHorseStable").getGenericType();
+ Assert.assertNotNull(parameterizedPigStableType);
+ Assert.assertNotNull(parameterizedHorseStableType);
+
+ Type pigStableType = this.getClass().getDeclaredField("pigStable").getType().getGenericSuperclass();
+ Type horseStableType = this.getClass().getDeclaredField("horseStable").getType().getGenericSuperclass();
+
+ Assert.assertTrue(GenericsUtil.satisfiesDependency(false, horseStableType, parameterizedHorseStableType));
+ Assert.assertTrue(GenericsUtil.satisfiesDependency(false, parameterizedPigStableType, pigStableType));
+ }
+ // fields for {@link #testStable}
+ private Stable<Horse> parameterizedHorseStable;
+ private Stable<Pig> parameterizedPigStable;
+ private HorseStable horseStable;
+ private PigStable pigStable;
+
+
+ @Test
+ public void testGenericProducerType() throws Exception
+ {
+ Type parameterizedPigStableType = this.getClass().getDeclaredField("parameterizedPigStable").getGenericType();
+ Type parameterizedHorseStableType = this.getClass().getDeclaredField("parameterizedHorseStable").getGenericType();
+ Type stableProducerMethodType = this.getClass().getDeclaredMethod("stableProducer").getGenericReturnType();
+
+ Assert.assertTrue(GenericsUtil.satisfiesDependency(false, parameterizedPigStableType, stableProducerMethodType));
+ Assert.assertTrue(GenericsUtil.satisfiesDependency(false, parameterizedHorseStableType, stableProducerMethodType));
+
+ }
+ // method and field for {@link #testGenericProducerType}
+ private <T> Stable<T> stableProducer()
+ {
+ return null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/EJBInterceptComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/EJBInterceptComponentTest.java
new file mode 100644
index 0000000..37751e2
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/EJBInterceptComponentTest.java
@@ -0,0 +1,136 @@
+/*
+ * 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.webbeans.test.unittests.intercept;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.test.component.intercept.InterceptedComponent;
+import org.apache.webbeans.test.component.intercept.InterceptorWithSuperClassInterceptedComponent;
+import org.apache.webbeans.test.component.intercept.MultipleInterceptedComponent;
+import org.apache.webbeans.test.component.intercept.MultipleListOfInterceptedComponent;
+import org.apache.webbeans.test.component.intercept.MultipleListOfInterceptedWithExcludeClassComponent;
+import org.junit.Test;
+
+public class EJBInterceptComponentTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testInterceptedComponent()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(InterceptedComponent.class);
+ startContainer(beanClasses, null);
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testInterceptorCalls()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(InterceptedComponent.class);
+ startContainer(beanClasses, null);
+
+ InterceptedComponent comp = getInstance(InterceptedComponent.class);
+ Object s = comp.hello(null);
+
+ Assert.assertEquals(5, s);
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testMultipleInterceptedComponent()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(MultipleInterceptedComponent.class);
+ startContainer(beanClasses, null);
+
+ MultipleInterceptedComponent comp = getInstance(MultipleInterceptedComponent.class);
+ Object obj = comp.intercepted();
+
+ Assert.assertTrue(obj instanceof String[]);
+
+ String[] arr = (String[]) obj;
+
+ Assert.assertEquals(2, arr.length);
+ Assert.assertTrue("key".equals(arr[0]) && "key2".equals(arr[1]) || "key".equals(arr[1]) && "key2".equals(arr[0]));
+
+ shutDownContainer();;
+ }
+
+ @Test
+ public void testInterceptorWithSuperClassComponent()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(InterceptorWithSuperClassInterceptedComponent.class);
+ startContainer(beanClasses, null);
+
+ InterceptorWithSuperClassInterceptedComponent comp = getInstance(InterceptorWithSuperClassInterceptedComponent.class);
+ Object obj = comp.intercepted();
+
+ Assert.assertTrue(obj instanceof String[]);
+
+ String[] arr = (String[]) obj;
+
+ Assert.assertEquals(1, arr.length);
+ Assert.assertTrue("key0".equals(arr[0]));
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testMultipleListOfInterceptedComponent()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(MultipleListOfInterceptedComponent.class);
+ startContainer(beanClasses, null);
+
+ MultipleListOfInterceptedComponent comp = getInstance(MultipleListOfInterceptedComponent.class);
+ Object obj = comp.intercepted();
+
+ Assert.assertTrue(obj instanceof String);
+
+ Assert.assertEquals("ok", (String) obj);
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testMultipleListOfInterceptedWithExcludeClassComponent()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(MultipleListOfInterceptedWithExcludeClassComponent.class);
+ startContainer(beanClasses, null);
+
+ MultipleListOfInterceptedWithExcludeClassComponent comp = getInstance(MultipleListOfInterceptedWithExcludeClassComponent.class);
+ Object obj = comp.intercepted();
+
+ Assert.assertTrue(obj instanceof String);
+
+ Assert.assertEquals("value2", (String) obj);
+
+ shutDownContainer();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/EJBInterceptorExceptionComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/EJBInterceptorExceptionComponentTest.java
new file mode 100644
index 0000000..b742d7c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/EJBInterceptorExceptionComponentTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.webbeans.test.unittests.intercept;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.test.component.intercept.MultpleInterceptor;
+import org.junit.Test;
+
+public class EJBInterceptorExceptionComponentTest extends AbstractUnitTest
+{
+
+
+ @Test
+ public void testComponentTypeException()
+ {
+ try
+ {
+ startContainer(MultpleInterceptor.class);
+
+ }
+ catch (WebBeansConfigurationException e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ shutDownContainer();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/PostConstructComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/PostConstructComponentTest.java
new file mode 100644
index 0000000..b396116
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/PostConstructComponentTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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.webbeans.test.unittests.intercept;
+
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.test.component.CheckWithCheckPayment;
+import org.apache.webbeans.test.component.PostConstructComponent;
+import org.junit.Test;
+
+public class PostConstructComponentTest extends AbstractUnitTest
+{
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testTypedComponent() throws Throwable
+ {
+ startContainer(CheckWithCheckPayment.class, PostConstructComponent.class);
+
+ CheckWithCheckPayment object = getInstance("checkWithCheckPayment");
+ PostConstructComponent pcc = getInstance(PostConstructComponent.class);
+
+ CheckWithCheckPayment chk = (CheckWithCheckPayment) pcc.getP();
+
+ Assert.assertNotNull(pcc.getP());
+ Assert.assertSame(object.getValue(), chk.getValue());
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/PostConstructDoubleInterceptorComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/PostConstructDoubleInterceptorComponentTest.java
new file mode 100644
index 0000000..9e9302a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/PostConstructDoubleInterceptorComponentTest.java
@@ -0,0 +1,56 @@
+/*
+ * 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.webbeans.test.unittests.intercept;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.test.component.CheckWithCheckPayment;
+import org.apache.webbeans.test.component.PostConstructDoubleInterceptorComponent;
+import org.junit.Test;
+
+public class PostConstructDoubleInterceptorComponentTest extends AbstractUnitTest
+{
+
+
+ @Test
+ public void testTypedComponent() throws Exception
+ {
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(CheckWithCheckPayment.class);
+ beanClasses.add(PostConstructDoubleInterceptorComponent.class);
+
+ startContainer(beanClasses, null);
+
+ PostConstructDoubleInterceptorComponent pcc = getInstance(PostConstructDoubleInterceptorComponent.class);
+
+ Assert.assertNotNull(pcc.getP());
+
+
+ Assert.assertNotNull(PostConstructDoubleInterceptorComponent.getValue());
+ Assert.assertEquals("value1", PostConstructDoubleInterceptorComponent.getValue());
+
+ shutDownContainer();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/PostConstructInterceptorComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/PostConstructInterceptorComponentTest.java
new file mode 100644
index 0000000..93ee19d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/PostConstructInterceptorComponentTest.java
@@ -0,0 +1,51 @@
+/*
+ * 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.webbeans.test.unittests.intercept;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.test.component.CheckWithCheckPayment;
+import org.apache.webbeans.test.component.PostConstructInterceptorComponent;
+import org.junit.Test;
+
+public class PostConstructInterceptorComponentTest extends AbstractUnitTest
+{
+
+
+ @Test
+ public void testTypedComponent() throws Throwable
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(CheckWithCheckPayment.class);
+ beanClasses.add(PostConstructInterceptorComponent.class);
+
+ startContainer(beanClasses, null);
+
+ PostConstructInterceptorComponent pcc = getInstance(PostConstructInterceptorComponent.class);
+
+ Assert.assertNotNull(pcc.getP());
+
+ shutDownContainer();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/PreDestroyComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/PreDestroyComponentTest.java
new file mode 100644
index 0000000..3e918ff
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/PreDestroyComponentTest.java
@@ -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.webbeans.test.unittests.intercept;
+
+import javax.enterprise.context.RequestScoped;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import junit.framework.Assert;
+import org.apache.webbeans.annotation.AnyLiteral;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.test.component.CheckWithCheckPayment;
+import org.apache.webbeans.test.component.PreDestroyComponent;
+import org.junit.Test;
+
+public class PreDestroyComponentTest extends AbstractUnitTest
+{
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testTypedComponent() throws Throwable
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(CheckWithCheckPayment.class);
+ beanClasses.add(PreDestroyComponent.class);
+
+ startContainer(beanClasses, null);
+
+ CheckWithCheckPayment object = getInstance(CheckWithCheckPayment.class, new AnyLiteral());
+ PreDestroyComponent object2 = getInstance(PreDestroyComponent.class);
+
+ object2.getP();
+
+ Assert.assertTrue(object instanceof CheckWithCheckPayment);
+ Assert.assertTrue(object2 instanceof PreDestroyComponent);
+
+ PreDestroyComponent pcc = object2;
+ CheckWithCheckPayment payment = (CheckWithCheckPayment) pcc.getP();
+ payment.setValue(true);
+
+
+ Assert.assertNotNull(pcc.getP());
+ Assert.assertSame(object.getValue(), payment.getValue());
+
+ Assert.assertFalse(PreDestroyComponent.isDestroyed());
+
+ getLifecycle().getContextService().endContext(RequestScoped.class, null);
+
+ Assert.assertTrue(PreDestroyComponent.isDestroyed());
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/SecureAndTransactionalInterceptorTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/SecureAndTransactionalInterceptorTest.java
new file mode 100644
index 0000000..9cf35a9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/SecureAndTransactionalInterceptorTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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.webbeans.test.unittests.intercept.webbeans;
+
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.intercept.webbeans.SecureAndTransactionalComponent;
+import org.apache.webbeans.test.component.intercept.webbeans.SecureAndTransactionalInterceptor;
+import org.junit.Before;
+import org.junit.Test;
+
+public class SecureAndTransactionalInterceptorTest extends TestContext
+{
+ public SecureAndTransactionalInterceptorTest()
+ {
+ super(SecureAndTransactionalInterceptorTest.class.getName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ initDefaultStereoTypes();
+ initializeInterceptorType(SecureAndTransactionalInterceptor.class);
+ }
+
+ @Test
+ public void testSecureAndTransactionalInterceptor()
+ {
+ ContextFactory contextFactory = WebBeansContext.getInstance().getContextFactory();
+ contextFactory.initSessionContext(null);
+ defineInterceptor(SecureAndTransactionalInterceptor.class);
+
+ Bean<SecureAndTransactionalComponent> bean = defineManagedBean(SecureAndTransactionalComponent.class);
+ SecureAndTransactionalComponent payment = getManager().getInstance(bean);
+
+ Assert.assertFalse(SecureAndTransactionalComponent.getCALL());
+
+ payment.pay();
+
+ Assert.assertTrue(SecureAndTransactionalComponent.getCALL());
+
+
+ contextFactory.destroySessionContext(null);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/SecureInterceptorComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/SecureInterceptorComponentTest.java
new file mode 100644
index 0000000..d22643d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/SecureInterceptorComponentTest.java
@@ -0,0 +1,58 @@
+/*
+ * 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.webbeans.test.unittests.intercept.webbeans;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.test.component.intercept.webbeans.SecureComponent;
+import org.apache.webbeans.test.component.intercept.webbeans.SecureInterceptor;
+import org.junit.Test;
+
+public class SecureInterceptorComponentTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testSecureInterceptor()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ beanXmls.add(getXmlPath(this.getClass().getPackage().getName(), this.getClass().getSimpleName()));
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(SecureComponent.class);
+ beanClasses.add(SecureInterceptor.class);
+ startContainer(beanClasses, beanXmls);
+
+
+ SecureComponent secureComponent = getInstance(SecureComponent.class);
+
+ Assert.assertNotNull(secureComponent);
+
+ boolean value = secureComponent.checkout();
+
+ Assert.assertTrue(SecureInterceptor.CALL);
+ Assert.assertTrue(value);
+
+ shutDownContainer();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/ShoppingCardInterceptorTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/ShoppingCardInterceptorTest.java
new file mode 100644
index 0000000..8e60f0a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/ShoppingCardInterceptorTest.java
@@ -0,0 +1,74 @@
+/*
+ * 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.webbeans.test.unittests.intercept.webbeans;
+
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.intercept.webbeans.ShoppingCard;
+import org.apache.webbeans.test.component.intercept.webbeans.TransactionalInterceptor;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ShoppingCardInterceptorTest extends TestContext
+{
+ public ShoppingCardInterceptorTest()
+ {
+ super(ShoppingCardInterceptorTest.class.getName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ initDefaultStereoTypes();
+ initializeInterceptorType(TransactionalInterceptor.class);
+
+ super.init();
+
+ }
+
+ @Test
+ public void testTransactionalInterceptor()
+ {
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ webBeansContext.getContextFactory().initSessionContext(null);
+
+ // Interceptors must explicitly get enabled via XML. We fake this:
+ webBeansContext.getInterceptorsManager().addEnabledInterceptorClass(TransactionalInterceptor.class);
+
+ defineInterceptor(TransactionalInterceptor.class);
+
+ Bean<ShoppingCard> bean = defineManagedBean(ShoppingCard.class);
+ ShoppingCard card = getManager().getInstance(bean);
+
+ card.placeOrder();
+
+ Assert.assertTrue(ShoppingCard.getCALLED());
+
+ card.placeOrder2();
+
+ Assert.assertFalse(ShoppingCard.getCALLED());
+
+ webBeansContext.getContextFactory().destroySessionContext(null);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/WebBeansInterceptComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/WebBeansInterceptComponentTest.java
new file mode 100644
index 0000000..938b08b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/WebBeansInterceptComponentTest.java
@@ -0,0 +1,129 @@
+/*
+ * 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.webbeans.test.unittests.intercept.webbeans;
+
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.intercept.webbeans.ActionInterceptor;
+import org.apache.webbeans.test.component.intercept.webbeans.TransactionalInterceptor2;
+import org.apache.webbeans.test.component.intercept.webbeans.WInterceptorComponent;
+import org.apache.webbeans.test.component.intercept.webbeans.WMetaInterceptorComponent;
+import org.junit.Before;
+import org.junit.Test;
+
+public class WebBeansInterceptComponentTest extends TestContext
+{
+ boolean init = false;
+
+ public WebBeansInterceptComponentTest()
+ {
+ super(WebBeansInterceptComponentTest.class.getName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ super.init();
+ initializeInterceptorType(TransactionalInterceptor2.class);
+ initializeInterceptorType(ActionInterceptor.class);
+ }
+
+ @Test
+ public void testInterceptedComponent()
+ {
+ WebBeansConfigurationException exc = null;
+
+ try
+ {
+ defineInterceptor(TransactionalInterceptor2.class);
+ defineManagedBean(WInterceptorComponent.class);
+
+ }
+ catch (WebBeansConfigurationException e)
+ {
+ System.out.println(e.getMessage());
+ exc = e;
+
+ }
+
+ Assert.assertNull(exc);
+ }
+
+ @Test
+ public void testInterceptorCalls()
+ {
+ getComponents().clear();
+
+ defineInterceptor(TransactionalInterceptor2.class);
+ defineManagedBean(WInterceptorComponent.class);
+
+ ContextFactory contextFactory = WebBeansContext.getInstance().getContextFactory();
+ contextFactory.initRequestContext(null);
+ List<AbstractOwbBean<?>> comps = getComponents();
+
+ Object object = getManager().getInstance(comps.get(0));
+
+ Assert.assertTrue(object instanceof WInterceptorComponent);
+
+ WInterceptorComponent comp = (WInterceptorComponent) object;
+ int s = comp.hello();
+
+ Assert.assertEquals(5, s);
+
+ contextFactory.destroyRequestContext(null);
+ }
+
+ @Test
+ public void testMetaInterceptorCalls()
+ {
+ getComponents().clear();
+
+ defineInterceptor(TransactionalInterceptor2.class);
+ defineInterceptor(ActionInterceptor.class);
+ defineManagedBean(WMetaInterceptorComponent.class);
+
+ ContextFactory contextFactory = WebBeansContext.getInstance().getContextFactory();
+ contextFactory.initRequestContext(null);
+ List<AbstractOwbBean<?>> comps = getComponents();
+
+ Object object = getManager().getInstance(comps.get(0));
+
+ Assert.assertTrue(object instanceof WMetaInterceptorComponent);
+
+ WMetaInterceptorComponent comp = (WMetaInterceptorComponent) object;
+ int s = comp.hello();
+
+ Assert.assertEquals(5, s);
+
+ s = comp.hello2();
+
+ Assert.assertEquals(10, s);
+
+ contextFactory.destroyRequestContext(null);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/library/LibraryComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/library/LibraryComponentTest.java
new file mode 100644
index 0000000..49cb966
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/library/LibraryComponentTest.java
@@ -0,0 +1,74 @@
+/*
+ * 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.webbeans.test.unittests.library;
+
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.library.Book;
+import org.apache.webbeans.test.component.library.BookShop;
+import org.apache.webbeans.test.component.library.Shop;
+import org.junit.Before;
+import org.junit.Test;
+
+public class LibraryComponentTest extends TestContext
+{
+ public LibraryComponentTest()
+ {
+ super(LibraryComponentTest.class.getSimpleName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ super.init();
+ }
+
+ @Test
+ public void testTypedComponent() throws Throwable
+ {
+ clear();
+
+ defineManagedBean(BookShop.class);
+ List<AbstractOwbBean<?>> comps = getComponents();
+
+ ContextFactory contextFactory = WebBeansContext.getInstance().getContextFactory();
+ contextFactory.initRequestContext(null);
+
+ Assert.assertEquals(1, comps.size());
+
+ AbstractOwbBean<?> obj = comps.get(0);
+
+ Object instance = getManager().getInstance(obj);
+ Assert.assertTrue(instance instanceof Shop);
+
+ @SuppressWarnings("unchecked")
+ Shop<Book> shop = (Shop<Book>) instance;
+ shop.shop();
+
+ contextFactory.destroyRequestContext(null);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/pfield/ProducerFieldComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/pfield/ProducerFieldComponentTest.java
new file mode 100644
index 0000000..c2227f4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/pfield/ProducerFieldComponentTest.java
@@ -0,0 +1,122 @@
+/*
+ * 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.webbeans.test.unittests.pfield;
+
+import javax.enterprise.inject.spi.Bean;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.CheckWithCheckPayment;
+import org.apache.webbeans.test.component.CheckWithMoneyPayment;
+import org.apache.webbeans.test.component.PaymentProcessorComponent;
+import org.apache.webbeans.test.component.pfield.ProducerFieldDefinitionComponent;
+import org.apache.webbeans.test.component.pfield.ProducerFieldDefinitionParameterized;
+import org.apache.webbeans.test.component.pfield.ProducerFieldInjectedComponent;
+import org.apache.webbeans.test.component.pfield.ProducerFieldInjectedWrongType;
+import org.apache.webbeans.test.component.pfield.broken.TypeVariableProducerField;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ProducerFieldComponentTest extends TestContext
+{
+ public ProducerFieldComponentTest()
+ {
+ super(ProducerFieldComponentTest.class.getName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ }
+
+
+ @Test
+ public void testInjectedProducerField()
+ {
+ WebBeansContext.getInstance().getContextFactory().initRequestContext(null);
+
+ defineManagedBean(CheckWithCheckPayment.class);
+ defineManagedBean(CheckWithMoneyPayment.class);
+
+ Bean<PaymentProcessorComponent> pc = defineManagedBean(PaymentProcessorComponent.class);
+ Object obj = getManager().getInstance(pc);
+
+ Assert.assertTrue(obj instanceof PaymentProcessorComponent);
+
+ Bean<ProducerFieldDefinitionComponent> beanDefine = defineManagedBean(ProducerFieldDefinitionComponent.class);
+ Bean<ProducerFieldInjectedComponent> beanInjected = defineManagedBean(ProducerFieldInjectedComponent.class);
+
+ ProducerFieldDefinitionComponent defineComponentInstance = getManager().getInstance(beanDefine);
+
+ Assert.assertNotNull(defineComponentInstance);
+ Assert.assertTrue(defineComponentInstance.isExist());
+
+ ProducerFieldInjectedComponent injectedComponentInstance = getManager().getInstance(beanInjected);
+
+ Assert.assertNotNull(injectedComponentInstance);
+
+ Assert.assertNotNull(injectedComponentInstance.getPaymentProcessorName());
+ }
+
+ @Test
+ public void testInjectedProducerFieldIncorrectType()
+ {
+ WebBeansContext.getInstance().getContextFactory().initRequestContext(null);
+
+ defineManagedBean(ProducerFieldDefinitionParameterized.class);
+ Bean<ProducerFieldInjectedWrongType> beanInjected = defineManagedBean(ProducerFieldInjectedWrongType.class);
+
+ Exception expected = null;
+ ProducerFieldInjectedWrongType instance = null;
+ try
+ {
+ instance = getManager().getInstance(beanInjected);
+ }
+ catch (Exception caught)
+ {
+ System.out.println(caught.getMessage());
+ expected = caught;
+ }
+ Assert.assertNotNull(expected);
+ Assert.assertNull(instance);
+ Assert.assertTrue(expected instanceof javax.enterprise.inject.UnsatisfiedResolutionException);
+ }
+
+ @Test
+ public void testProducerFieldTypeVariable()
+ {
+ WebBeansContext.getInstance().getContextFactory().initRequestContext(null);
+
+ Exception expected = null;
+ try
+ {
+ defineManagedBean(TypeVariableProducerField.class);
+ }
+ catch(Exception caught){
+ caught.printStackTrace();
+ System.out.println(caught.getMessage());
+ expected = caught;
+ }
+ Assert.assertNotNull(expected);
+ Assert.assertTrue(expected instanceof org.apache.webbeans.exception.WebBeansConfigurationException);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/portable/PortableTests.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/portable/PortableTests.java
new file mode 100644
index 0000000..e8360c2
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/portable/PortableTests.java
@@ -0,0 +1,147 @@
+/*
+ * 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.webbeans.test.unittests.portable;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.interceptor.Interceptor;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.annotation.binding.Binding1;
+import org.apache.webbeans.test.annotation.binding.Binding2;
+import org.apache.webbeans.test.component.CheckWithCheckPayment;
+import org.apache.webbeans.test.component.IPayment;
+import org.apache.webbeans.test.component.inject.parametrized.Dao;
+import org.apache.webbeans.test.component.library.Book;
+import org.apache.webbeans.test.component.portable.PortableType1;
+import org.apache.webbeans.test.xml.annot.BindingType1;
+import org.apache.webbeans.test.xml.annot.BindingType2;
+import org.junit.Test;
+
+public class PortableTests extends TestContext
+{
+ public PortableTests()
+ {
+ super(PortableTests.class.getName());
+ }
+
+ @Test
+ public void testAnnotatedType()
+ {
+ AnnotatedType<PortableType1> type = WebBeansContext.getInstance().getAnnotatedElementFactory().newAnnotatedType(PortableType1.class);
+
+ Set<Annotation> annotations = type.getAnnotations();
+ Set<Class<? extends Annotation>> clazzesAnnots = new HashSet<Class<? extends Annotation>>();
+
+ for(Annotation ann : annotations)
+ {
+ clazzesAnnots.add(ann.annotationType());
+ }
+
+ Assert.assertTrue(clazzesAnnots.contains(Named.class));
+ Assert.assertTrue(clazzesAnnots.contains(Default.class));
+ Assert.assertTrue(clazzesAnnots.contains(Binding1.class));
+ Assert.assertTrue(clazzesAnnots.contains(Binding2.class));
+ Assert.assertTrue(clazzesAnnots.contains(Interceptor.class));
+
+
+
+ Set<AnnotatedConstructor<PortableType1>> cs = type.getConstructors();
+ Assert.assertEquals(1, cs.size());
+ AnnotatedConstructor<PortableType1> c = cs.iterator().next();
+
+ Assert.assertTrue(c.isAnnotationPresent(Inject.class));
+ Set<AnnotatedField<? super PortableType1>> fields = type.getFields();
+
+ Assert.assertEquals(3, fields.size());
+
+ for(AnnotatedField<? super PortableType1> field : fields)
+ {
+ if(field.getJavaMember().getName().equals("payment"))
+ {
+ Assert.assertTrue(field.isAnnotationPresent(Default.class));
+ Assert.assertEquals(IPayment.class, field.getBaseType());
+ }
+ else if(field.getJavaMember().getName().equals("book"))
+ {
+ Assert.assertTrue(field.isAnnotationPresent(Default.class));
+ Assert.assertTrue(field.isAnnotationPresent(Binding2.class));
+ Assert.assertEquals(Book.class, field.getBaseType());
+ }
+ else
+ {
+ Assert.assertTrue(field.isAnnotationPresent(Produces.class));
+ Assert.assertTrue(field.isAnnotationPresent(BindingType2.class));
+ Assert.assertEquals(CheckWithCheckPayment.class, field.getBaseType());
+ }
+ }
+
+ Set<AnnotatedMethod<? super PortableType1>> methods = type.getMethods();
+
+ Assert.assertEquals(8, methods.size());
+
+ for(AnnotatedMethod<? super PortableType1> method : methods)
+ {
+ if(method.getJavaMember().getName().equals("getDao"))
+ {
+ Assert.assertTrue(method.isAnnotationPresent(Produces.class));
+ Assert.assertEquals(Dao.class, ((ParameterizedType)method.getBaseType()).getRawType());
+
+ List<?> list = method.getParameters();
+ Assert.assertTrue(list.size() == 1);
+ AnnotatedParameter<?> param = (AnnotatedParameter<?>)list.iterator().next();
+ Assert.assertTrue(param.getAnnotations().size() == 1);
+ Assert.assertTrue(param.isAnnotationPresent(BindingType1.class));
+ }
+ else if(method.getJavaMember().getName().equals("notify"))
+ {
+ Assert.assertTrue(method.getAnnotations().isEmpty());
+ Assert.assertEquals(void.class, method.getBaseType());
+
+ List<?> list = method.getParameters();
+ Assert.assertTrue(list.size() == 1);
+ AnnotatedParameter<?> param = (AnnotatedParameter<?>)list.iterator().next();
+ Assert.assertTrue(param.getAnnotations().size() == 2);
+ Assert.assertTrue(param.isAnnotationPresent(Binding2.class));
+ Assert.assertTrue(param.isAnnotationPresent(Observes.class));
+
+ }
+ }
+
+
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/portable/events/ExtensionTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/portable/events/ExtensionTest.java
new file mode 100644
index 0000000..1009777
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/portable/events/ExtensionTest.java
@@ -0,0 +1,85 @@
+/*
+ * 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.webbeans.test.unittests.portable.events;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.annotation.DefaultLiteral;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.portable.events.discovery.BeforeShutdownImpl;
+import org.apache.webbeans.test.component.library.BookShop;
+import org.apache.webbeans.test.component.portable.events.MyExtension;
+import org.apache.webbeans.test.component.producer.primitive.PrimitiveProducer;
+import org.junit.Test;
+
+/**
+ * This test checks if an extension gets loaded correctly and
+ * if all specified events get fired.
+ */
+public class ExtensionTest extends AbstractUnitTest
+{
+ public ExtensionTest()
+ {
+ }
+
+ @Test
+ @SuppressWarnings("unchecked")
+ public void testExtensionServices()
+ {
+ MyExtension.reset();
+
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(BookShop.class);
+ classes.add(PrimitiveProducer.class);
+
+ addExtension(new MyExtension());
+
+ startContainer(classes);
+
+ getWebBeansContext().getContextFactory().initApplicationContext(null);
+
+ Bean<MyExtension> extension = (Bean<MyExtension>) getBeanManager().getBeans(MyExtension.class, new DefaultLiteral()).iterator().next();
+
+ MyExtension ext = (MyExtension) getBeanManager().getReference(extension, MyExtension.class, getBeanManager().createCreationalContext(extension));
+
+ System.out.println(ext.toString());
+
+ Assert.assertNotNull(MyExtension.processAnnotatedTypeEvent);
+ Assert.assertNotNull(MyExtension.processBean);
+ Assert.assertNotNull(MyExtension.processObserverMethod);
+ Assert.assertNotNull(MyExtension.lastAfterBeanDiscovery);
+ Assert.assertNotNull(MyExtension.lastBeforeBeanDiscovery);
+ Assert.assertNotNull(MyExtension.afterDeploymentValidation);
+ Assert.assertNotNull(MyExtension.processInjectionTarget);
+ Assert.assertNotNull(MyExtension.processProducer);
+
+ //Fire shut down
+ getBeanManager().fireEvent(new BeforeShutdownImpl(), new Annotation[0]);
+
+ getWebBeansContext().getContextFactory().destroyApplicationContext(null);
+
+ Assert.assertNotNull(MyExtension.beforeShutdownEvent);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/Producer1ConsumerComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/Producer1ConsumerComponentTest.java
new file mode 100644
index 0000000..fdd91f4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/Producer1ConsumerComponentTest.java
@@ -0,0 +1,94 @@
+/*
+ * 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.webbeans.test.unittests.producer;
+
+import java.util.List;
+
+import javax.enterprise.inject.spi.BeanManager;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.producer.Producer1;
+import org.apache.webbeans.test.component.service.IService;
+import org.apache.webbeans.test.component.service.Producer1ConsumerComponent;
+import org.apache.webbeans.test.component.service.ServiceImpl1;
+import org.junit.Before;
+import org.junit.Test;
+
+public class Producer1ConsumerComponentTest extends TestContext
+{
+ BeanManager container = null;
+
+ public Producer1ConsumerComponentTest()
+ {
+ super(Producer1ConsumerComponentTest.class.getSimpleName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ super.init();
+ this.container = WebBeansContext.getInstance().getBeanManagerImpl();
+ }
+
+ @Test
+ public void testTypedComponent() throws Throwable
+ {
+ clear();
+
+ defineManagedBean(ServiceImpl1.class);
+ defineManagedBean(Producer1.class);
+ defineManagedBean(Producer1ConsumerComponent.class);
+
+ List<AbstractOwbBean<?>> comps = getComponents();
+
+ ContextFactory contextFactory = WebBeansContext.getInstance().getContextFactory();
+ contextFactory.initRequestContext(null);
+ contextFactory.initApplicationContext(null);
+
+ Assert.assertEquals(4, getDeployedComponents());
+
+ Object obj = getManager().getInstance(comps.get(0));
+
+ Assert.assertNotNull(obj);
+
+ getInstanceByName("service");
+
+ getManager().getInstance(comps.get(1));
+
+ Object object = getManager().getInstance(comps.get(2));
+
+ Assert.assertTrue(object instanceof Producer1ConsumerComponent);
+
+ Producer1ConsumerComponent single = (Producer1ConsumerComponent) object;
+
+ IService service = single.getService();
+
+ Assert.assertNotNull(service);
+
+ contextFactory.destroyApplicationContext(null);
+ contextFactory.destroyRequestContext(null);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/ProducerComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/ProducerComponentTest.java
new file mode 100644
index 0000000..0bf2c66
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/ProducerComponentTest.java
@@ -0,0 +1,139 @@
+/*
+ * 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.webbeans.test.unittests.producer;
+
+import java.lang.annotation.Annotation;
+import java.util.List;
+
+import javax.enterprise.util.TypeLiteral;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.producer.ParametrizedModel1;
+import org.apache.webbeans.test.component.producer.ParametrizedModel2;
+import org.apache.webbeans.test.component.producer.ParametrizedProducer;
+import org.apache.webbeans.test.component.producer.Producer1;
+import org.apache.webbeans.test.component.producer.Producer2;
+import org.apache.webbeans.test.component.producer.Producer3;
+import org.apache.webbeans.test.component.producer.Producer4;
+import org.apache.webbeans.test.component.producer.Producer4ConsumerComponent;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ProducerComponentTest extends TestContext
+{
+
+ public ProducerComponentTest()
+ {
+ super(ProducerComponentTest.class.getSimpleName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ super.init();
+ }
+
+ /**
+ * From the container with servlet context
+ */
+ @Override
+ public void startTests(Object ctx)
+ {
+ testProducerDeployment1();
+ testProducerDeployment2();
+ }
+
+ @Test
+ public void testProducerDeployment1()
+ {
+ clear();
+ defineManagedBean(Producer1.class);
+ Assert.assertEquals(2, getDeployedComponents());
+
+ }
+
+ @Test
+ public void testProducerDeployment2()
+ {
+ clear();
+ defineManagedBean(Producer2.class);
+ Assert.assertEquals(3, getDeployedComponents());
+ }
+
+ @Test
+ public void testProducerDeployment3()
+ {
+ clear();
+ defineManagedBean(Producer3.class);
+
+ Assert.assertEquals(5, getDeployedComponents());
+ }
+
+ @Test
+ public void testParametrizedProducer()
+ {
+ clear();
+ defineManagedBean(ParametrizedProducer.class);
+
+ WebBeansContext.getInstance().getContextFactory().initRequestContext(null);
+ Assert.assertEquals(3, getDeployedComponents());
+
+ TypeLiteral<List<ParametrizedModel1>> model1 = new TypeLiteral<List<ParametrizedModel1>>()
+ {
+ };
+
+ List<ParametrizedModel1> instance = getManager().getInstanceByType(model1, new Annotation[0]);
+ Assert.assertNull(instance);
+ Assert.assertTrue(ParametrizedProducer.getCALLMODEL1());
+ Assert.assertTrue(!ParametrizedProducer.getCALLMODEL2());
+
+ TypeLiteral<List<ParametrizedModel2>> model2 = new TypeLiteral<List<ParametrizedModel2>>()
+ {
+ };
+ List<ParametrizedModel2> instance2 = getManager().getInstanceByType(model2, new Annotation[0]);
+
+ Assert.assertNull(instance2);
+ Assert.assertTrue(ParametrizedProducer.getCALLMODEL2());
+
+ }
+
+ @Test
+ public void testProducer4()
+ {
+ defineManagedBean(Producer4.class);
+ AbstractOwbBean<Producer4ConsumerComponent> component = defineManagedBean(Producer4ConsumerComponent.class);
+
+ WebBeansContext.getInstance().getContextFactory().initSessionContext(new Object());
+
+ Producer4ConsumerComponent instance = getManager().getInstance(component);
+
+ Assert.assertNotNull(instance);
+
+ int count = instance.count();
+
+ Assert.assertEquals(1, count);
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/StaticProducerTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/StaticProducerTest.java
new file mode 100644
index 0000000..6861f1b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/StaticProducerTest.java
@@ -0,0 +1,70 @@
+/*
+ * 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.webbeans.test.unittests.producer;
+
+import java.lang.annotation.Annotation;
+
+import org.apache.webbeans.component.ProducerMethodBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.producer.StaticProducer1;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class StaticProducerTest extends TestContext
+{
+
+ public StaticProducerTest()
+ {
+ super(StaticProducerTest.class.getName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ super.init();
+ }
+
+ @Test
+ public void testStaticProducer1()
+ {
+ clear();
+
+ WebBeansContext.getInstance().getContextFactory().initRequestContext(null);
+
+ defineManagedBean(StaticProducer1.class);
+
+ ProducerMethodBean<?> pc = (ProducerMethodBean<?>) getManager().resolveByName("weight").iterator().next();
+
+ Object obj = getManager().getInstance(pc);
+
+ Assert.assertTrue(obj instanceof Integer);
+ Assert.assertEquals(79, obj);
+
+ pc = (ProducerMethodBean<?>) getManager().resolveByType(int.class, new Annotation[] {}).iterator().next();
+
+ obj = getManager().getInstance(pc);
+
+ Assert.assertTrue(obj instanceof Integer);
+ Assert.assertEquals(79, obj);
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/broken/BrokenProducerTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/broken/BrokenProducerTest.java
new file mode 100644
index 0000000..a0f0352
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/broken/BrokenProducerTest.java
@@ -0,0 +1,142 @@
+/*
+ * 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.webbeans.test.unittests.producer.broken;
+
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.producer.broken.BrokenProducerComponent1;
+import org.apache.webbeans.test.component.producer.broken.BrokenProducerComponent2;
+import org.apache.webbeans.test.component.producer.broken.BrokenProducerComponent3;
+import org.apache.webbeans.test.component.producer.broken.BrokenProducerComponent4;
+import org.apache.webbeans.test.component.producer.broken.BrokenProducerComponent5;
+import org.apache.webbeans.test.component.producer.broken.BrokenProducerComponent6;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class BrokenProducerTest extends TestContext
+{
+
+ public BrokenProducerTest()
+ {
+ super(BrokenProducerTest.class.getName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ }
+
+ @Test
+ public void testBroken1()
+ {
+ try
+ {
+ clear();
+ defineManagedBean(BrokenProducerComponent1.class);
+ }
+ catch (Exception e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ }
+
+ @Test
+ public void testBroken2()
+ {
+ try
+ {
+ clear();
+ defineManagedBean(BrokenProducerComponent2.class);
+ }
+ catch (Exception e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ }
+
+ @Test
+ public void testBroken3()
+ {
+ try
+ {
+ clear();
+ defineManagedBean(BrokenProducerComponent3.class);
+ }
+ catch (Exception e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ }
+
+ @Test
+ public void testBroken4()
+ {
+ try
+ {
+ clear();
+ defineManagedBean(BrokenProducerComponent4.class);
+ }
+ catch (Exception e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ }
+
+ @Test
+ public void testBroken5()
+ {
+ try
+ {
+ clear();
+ defineManagedBean(BrokenProducerComponent5.class);
+ }
+ catch (Exception e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ }
+
+ @Test
+ public void testBroken6()
+ {
+ try
+ {
+ clear();
+ defineManagedBean(BrokenProducerComponent6.class);
+ }
+ catch (Exception e)
+ {
+ System.out.println("got expected exception: " + e.getMessage());
+ return; // all ok!
+ }
+ Assert.fail("expecting an exception!");
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/primitive/PrimitiveProducerTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/primitive/PrimitiveProducerTest.java
new file mode 100644
index 0000000..4612678
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/primitive/PrimitiveProducerTest.java
@@ -0,0 +1,58 @@
+/*
+ * 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.webbeans.test.unittests.producer.primitive;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.producer.primitive.PrimitiveConsumer;
+import org.apache.webbeans.test.component.producer.primitive.PrimitiveProducer;
+import org.junit.Before;
+import org.junit.Test;
+
+public class PrimitiveProducerTest extends TestContext
+{
+ public PrimitiveProducerTest()
+ {
+ super(PrimitiveProducerTest.class.getName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ }
+
+
+ @Test
+ public void testPrimitiveProducer()
+ {
+ WebBeansContext.getInstance().getContextFactory().initRequestContext(null);
+
+ defineManagedBean(PrimitiveProducer.class);
+ defineManagedBean(PrimitiveConsumer.class);
+
+ PrimitiveConsumer consumer = (PrimitiveConsumer) getInstanceByName("primitiveConsumer");
+
+ Assert.assertEquals(56.7f, consumer.getSalary());
+
+ }
+}
+
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/specializes/SpecializesProducer1Test.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/specializes/SpecializesProducer1Test.java
new file mode 100644
index 0000000..5e61a18
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/specializes/SpecializesProducer1Test.java
@@ -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.webbeans.test.unittests.producer.specializes;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.util.AnnotationLiteral;
+
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.annotation.binding.Binding1;
+import org.apache.webbeans.test.annotation.binding.Binding2;
+import org.apache.webbeans.test.component.producer.specializes.SpecializesProducer1;
+import org.apache.webbeans.test.component.producer.specializes.superclazz.SpecializesProducer1SuperClazz;
+import org.junit.Before;
+import org.junit.Test;
+
+public class SpecializesProducer1Test extends TestContext
+{
+
+ public SpecializesProducer1Test()
+ {
+ super(SpecializesProducer1Test.class.getName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ }
+
+ @Test
+ public void testSpecializedProducer1()
+ {
+ clear();
+
+ defineManagedBean(SpecializesProducer1SuperClazz.class);
+ defineManagedBean(SpecializesProducer1.class);
+
+ Annotation binding1 = new AnnotationLiteral<Binding1>()
+ {
+ };
+ Annotation binding2 = new AnnotationLiteral<Binding2>()
+ {
+ };
+
+ Object number = getManager().getInstanceByType(int.class, new Annotation[] { binding1, binding2 });
+ //This test is not valid since specialize configuration requires
+ //all producers at deployment step in container. See:
+ //org.apache.webbeans.newtests.producer.specializes.SpecializesProducer1Test
+ //Assert.assertEquals(10000, number);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/resolution/ManagerResolutionTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/resolution/ManagerResolutionTest.java
new file mode 100644
index 0000000..49c8b85
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/resolution/ManagerResolutionTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.webbeans.test.unittests.resolution;
+
+import javax.enterprise.inject.spi.BeanManager;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.component.BeanManagerBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.test.TestContext;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ManagerResolutionTest extends TestContext
+{
+ public ManagerResolutionTest()
+ {
+ super(ManagerResolutionTest.class.getName());
+ }
+
+ @Before
+ public void beforeTest()
+ {
+ super.init();
+ getManager().addInternalBean(WebBeansContext.getInstance().getWebBeansUtil().getManagerBean());
+ }
+
+ @Test
+ public void testManagerResolution()
+ {
+ BeanManagerBean component = WebBeansContext.getInstance().getWebBeansUtil().getManagerBean();
+ BeanManager manager = getManager().getInstance(component);
+
+ Assert.assertNotNull(manager);
+ }
+
+ @Test
+ public void test2()
+ {
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/scopes/ScopeAdapterTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/scopes/ScopeAdapterTest.java
new file mode 100644
index 0000000..f7a33e7
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/scopes/ScopeAdapterTest.java
@@ -0,0 +1,80 @@
+/*
+ * 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.webbeans.test.unittests.scopes;
+
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.CheckWithCheckPayment;
+import org.apache.webbeans.test.component.producer.ScopeAdaptorComponent;
+import org.apache.webbeans.test.component.producer.ScopeAdaptorInjectorComponent;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ScopeAdapterTest extends TestContext
+{
+ public ScopeAdapterTest()
+ {
+ super(ScopeAdapterTest.class.getName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ super.init();
+
+ }
+
+ @Test
+ public void testDependent()
+ {
+ clear();
+
+ defineManagedBean(CheckWithCheckPayment.class);
+ defineManagedBean(ScopeAdaptorComponent.class);
+ defineManagedBean(ScopeAdaptorInjectorComponent.class);
+
+ Object session = getSession();
+ ContextFactory contextFactory = WebBeansContext.getInstance().getContextFactory();
+ contextFactory.initRequestContext(null);
+ contextFactory.initSessionContext(session);
+ contextFactory.initApplicationContext(null);
+
+ List<AbstractOwbBean<?>> comps = getComponents();
+
+ Assert.assertEquals(4, getDeployedComponents());
+
+ getManager().getInstance(comps.get(0));
+ getManager().getInstance(comps.get(1));
+ getInstanceByName("scope");
+ getManager().getInstance(comps.get(2));
+
+ contextFactory.destroyApplicationContext(null);
+ contextFactory.destroySessionContext(session);
+ contextFactory.destroyRequestContext(null);
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/scopes/SingletonComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/scopes/SingletonComponentTest.java
new file mode 100644
index 0000000..7a96074
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/scopes/SingletonComponentTest.java
@@ -0,0 +1,88 @@
+/*
+ * 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.webbeans.test.unittests.scopes;
+
+import java.util.List;
+
+import javax.enterprise.inject.spi.BeanManager;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.Singleton;
+import org.apache.webbeans.test.component.service.ITyped2;
+import org.apache.webbeans.test.component.service.Typed2;
+import org.junit.Before;
+import org.junit.Test;
+
+public class SingletonComponentTest extends TestContext
+{
+ BeanManager container = null;
+
+ public SingletonComponentTest()
+ {
+ super(SingletonComponentTest.class.getSimpleName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ super.init();
+ this.container = WebBeansContext.getInstance().getBeanManagerImpl();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testTypedComponent() throws Throwable
+ {
+ clear();
+
+ defineManagedBean(Typed2.class);
+ defineManagedBean(Singleton.class);
+ List<AbstractOwbBean<?>> comps = getComponents();
+
+ Object session = getSession();
+
+ ContextFactory contextFactory = WebBeansContext.getInstance().getContextFactory();
+ contextFactory.initSessionContext(session);
+
+ Assert.assertEquals(2, comps.size());
+
+ getManager().getInstance(comps.get(0));
+ Object object = getManager().getInstance(comps.get(1));
+
+ Assert.assertTrue(object instanceof Singleton);
+
+ Singleton single = (Singleton) object;
+
+ Assert.assertEquals("debug", single.logDebug());
+ Assert.assertEquals("info", single.logInfoo());
+
+ ITyped2 t = single.getType();
+
+ Assert.assertNotNull(t);
+
+ contextFactory.destroySessionContext(session);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/specializes/SpecializationComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/specializes/SpecializationComponentTest.java
new file mode 100644
index 0000000..4d96df5
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/specializes/SpecializationComponentTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.webbeans.test.unittests.specializes;
+
+import javax.enterprise.inject.spi.Bean;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.specializes.AsynhrounousSpecalizesService;
+import org.apache.webbeans.test.component.specializes.SpecializesServiceInjectorComponent;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class SpecializationComponentTest extends TestContext
+{
+ public SpecializationComponentTest()
+ {
+ super(SpecializationComponentTest.class.getName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ }
+
+ @Test
+ public void testMockService()
+ {
+ clear();
+
+ WebBeansContext.getInstance().getContextFactory().initRequestContext(null);
+
+ Bean<AsynhrounousSpecalizesService> bean2 = defineManagedBean(AsynhrounousSpecalizesService.class);
+ Bean<SpecializesServiceInjectorComponent> bean3 = defineManagedBean(SpecializesServiceInjectorComponent.class);
+
+ AsynhrounousSpecalizesService instanceOther = getManager().getInstance(bean2);
+
+ Assert.assertNotNull(instanceOther);
+
+ SpecializesServiceInjectorComponent instance = getManager().getInstance(bean3);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/specializes/logger/LoggerSpecializationTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/specializes/logger/LoggerSpecializationTest.java
new file mode 100644
index 0000000..8533139
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/specializes/logger/LoggerSpecializationTest.java
@@ -0,0 +1,119 @@
+/*
+ * 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.webbeans.test.unittests.specializes.logger;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.specializes.logger.ISomeLogger;
+import org.apache.webbeans.test.component.specializes.logger.MockNotSpecializedLogger;
+import org.apache.webbeans.test.component.specializes.logger.MockSpecializedLogger;
+import org.apache.webbeans.test.component.specializes.logger.SpecializedInjector;
+import org.apache.webbeans.test.component.specializes.logger.SystemLogger;
+import org.apache.webbeans.xml.WebBeansXMLConfigurator;
+import org.junit.Test;
+
+public class LoggerSpecializationTest extends TestContext
+{
+ public LoggerSpecializationTest()
+ {
+ super(LoggerSpecializationTest.class.getName());
+ }
+
+ @Test
+ public void testNotSpecializedVersion()
+ {
+ clear();
+
+ WebBeansContext.getInstance().getPluginLoader().startUp();
+
+ InputStream stream = getClass().getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/specializes/alternatives.xml");
+ Assert.assertNotNull(stream);
+
+ WebBeansXMLConfigurator configurator = new WebBeansXMLConfigurator();
+ configurator.configureSpecSpecific(stream, "alternative.xml");
+
+ defineManagedBean(SystemLogger.class);
+ defineManagedBean(MockNotSpecializedLogger.class);
+
+ Bean<SpecializedInjector> bean = defineManagedBean(SpecializedInjector.class);
+ Object instance = getManager().getReference(bean, SpecializedInjector.class, getManager().createCreationalContext(bean));
+
+ Assert.assertTrue(instance instanceof SpecializedInjector);
+ SpecializedInjector injector = (SpecializedInjector)instance;
+
+ ISomeLogger logger = injector.logger();
+
+ Assert.assertTrue(logger instanceof SystemLogger);
+
+ logger.printError("Hello World");
+
+ SystemLogger sysLogger = (SystemLogger)logger;
+
+ Assert.assertEquals("Hello World", sysLogger.getMessage());
+
+ WebBeansContext.getInstance().getPluginLoader().shutDown();
+ WebBeansContext.getInstance().getAlternativesManager().clear();
+ }
+
+ @Test
+ public void testSpecializedVersion()
+ {
+ clear();
+
+ WebBeansContext.getInstance().getPluginLoader().startUp();
+
+ InputStream stream = getClass().getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/specializes/alternatives.xml");
+ Assert.assertNotNull(stream);
+
+ WebBeansXMLConfigurator configurator = new WebBeansXMLConfigurator();
+ configurator.configureSpecSpecific(stream, "alternatives.xml");
+
+ defineManagedBean(SystemLogger.class);
+ defineManagedBean(MockSpecializedLogger.class);
+
+ ArrayList<Class<?>> specialClassList = new ArrayList<Class<?>>();
+ specialClassList.add(MockSpecializedLogger.class);
+ WebBeansContext.getInstance().getWebBeansUtil().configureSpecializations(specialClassList);
+
+ Bean<SpecializedInjector> bean = defineManagedBean(SpecializedInjector.class);
+ Object instance = getManager().getReference(bean, SpecializedInjector.class, getManager().createCreationalContext(bean));
+
+ Assert.assertTrue(instance instanceof SpecializedInjector);
+ SpecializedInjector injector = (SpecializedInjector)instance;
+
+ ISomeLogger logger = injector.logger();
+
+ Assert.assertTrue(logger instanceof MockSpecializedLogger);
+
+ logger.printError("Hello World");
+
+ MockSpecializedLogger sysLogger = (MockSpecializedLogger)logger;
+
+ Assert.assertEquals("Hello World", sysLogger.getMessage());
+
+ WebBeansContext.getInstance().getPluginLoader().shutDown();
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/typedliteral/TypeLiteralTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/typedliteral/TypeLiteralTest.java
new file mode 100644
index 0000000..5832400
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/typedliteral/TypeLiteralTest.java
@@ -0,0 +1,96 @@
+/*
+ * 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.webbeans.test.unittests.typedliteral;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.util.TypeLiteral;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.literals.InstanceTypeLiteralBean;
+import org.apache.webbeans.test.component.literals.InstanceTypeLiteralBean.IntegerOrder;
+import org.apache.webbeans.test.component.literals.InstanceTypeLiteralBean.StringOrder;
+import org.junit.Before;
+import org.junit.Test;
+
+@SuppressWarnings("unchecked")
+public class TypeLiteralTest extends TestContext
+{
+ public TypeLiteralTest()
+ {
+ super(TypeLiteralTest.class.getName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ super.init();
+ }
+
+ public static class Literal1 extends TypeLiteral<Map<String, String>>
+ {
+
+ }
+
+ public TypeLiteral<List<Integer>> literal2 = new TypeLiteral<List<Integer>>(){};
+
+ @Test
+ public void testLiterals()
+ {
+ Literal1 literal1 = new Literal1();
+ literal1.getRawType().equals(Map.class);
+
+ literal2.getRawType().equals(List.class);
+ }
+
+ @Test
+ public void testTypeLiteralInInstance()
+ {
+ clear();
+
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ webBeansContext.getBeanManagerImpl().addInternalBean(webBeansContext.getWebBeansUtil().getInstanceBean());
+
+ defineManagedBean(StringOrder.class);
+ defineManagedBean(IntegerOrder.class);
+ Bean<InstanceTypeLiteralBean> bean = defineManagedBean(InstanceTypeLiteralBean.class);
+
+ Object object = getManager().getReference(bean, InstanceTypeLiteralBean.class,getManager().createCreationalContext(bean) );
+ Assert.assertTrue(object instanceof InstanceTypeLiteralBean);
+ InstanceTypeLiteralBean beaninstance = (InstanceTypeLiteralBean)object;
+ Object produce = beaninstance.produce(0);
+ Assert.assertTrue(produce instanceof Instance);
+
+ Instance<IntegerOrder> order = (Instance<IntegerOrder>)produce;
+ Assert.assertTrue(order.get() instanceof IntegerOrder);
+
+ produce = beaninstance.produce(1);
+ Assert.assertTrue(produce instanceof Instance);
+
+ Instance<StringOrder> order2 = (Instance<StringOrder>)produce;
+ Assert.assertTrue(order2.get() instanceof StringOrder);
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/typedliteral/TypedLiteralComponentTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/typedliteral/TypedLiteralComponentTest.java
new file mode 100644
index 0000000..ecfa773
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/typedliteral/TypedLiteralComponentTest.java
@@ -0,0 +1,109 @@
+/*
+ * 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.webbeans.test.unittests.typedliteral;
+
+import java.lang.annotation.Annotation;
+import java.util.List;
+
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.enterprise.util.TypeLiteral;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.component.ITypeLiteralComponent;
+import org.apache.webbeans.test.component.InjectedTypeLiteralComponent;
+import org.apache.webbeans.test.component.TypeLiteralComponent;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TypedLiteralComponentTest extends TestContext
+{
+ public TypedLiteralComponentTest()
+ {
+ super(TypedLiteralComponentTest.class.getSimpleName());
+ }
+
+ @Override
+ @Before
+ public void init()
+ {
+ super.init();
+ }
+
+ @Test
+ public void testTypedComponent() throws Throwable
+ {
+ clear();
+
+ defineManagedBean(TypeLiteralComponent.class);
+ defineManagedBean(InjectedTypeLiteralComponent.class);
+ List<AbstractOwbBean<?>> comps = getComponents();
+
+ ContextFactory contextFactory = WebBeansContext.getInstance().getContextFactory();
+ contextFactory.initRequestContext(null);
+
+ Assert.assertEquals(2, comps.size());
+
+ TypeLiteralComponent userComponent = (TypeLiteralComponent) getManager().getInstance(comps.get(0));
+ InjectedTypeLiteralComponent tc = (InjectedTypeLiteralComponent) getManager().getInstance(comps.get(1));
+
+ Assert.assertNotNull(tc.getComponent());
+ Assert.assertNotNull(userComponent);
+
+ Assert.assertTrue(tc.getComponent() instanceof TypeLiteralComponent);
+
+ contextFactory.destroyRequestContext(null);
+ }
+
+ @Test
+ public void testTypedLiteralComponent() throws Throwable
+ {
+ clear();
+
+ defineManagedBean(TypeLiteralComponent.class);
+ List<AbstractOwbBean<?>> comps = getComponents();
+
+ ContextFactory contextFactory = WebBeansContext.getInstance().getContextFactory();
+ contextFactory.initRequestContext(null);
+
+ Assert.assertEquals(1, comps.size());
+
+ TypeLiteral<ITypeLiteralComponent<List<String>>> tl = new TypeLiteral<ITypeLiteralComponent<List<String>>>()
+ {
+ };
+
+ Annotation[] anns = new Annotation[1];
+ anns[0] = new AnnotationLiteral<Default>()
+ {
+
+ };
+
+ Bean<?> s = WebBeansContext.getInstance().getBeanManagerImpl().getBeans(tl.getType(), anns).iterator().next();
+ Assert.assertNotNull(s);
+
+ contextFactory.destroyRequestContext(null);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/strict/AlternativesTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/strict/AlternativesTest.java
new file mode 100644
index 0000000..a30aa49
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/strict/AlternativesTest.java
@@ -0,0 +1,130 @@
+/*
+ * 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.webbeans.test.unittests.xml.strict;
+
+import java.io.InputStream;
+
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.inject.AlternativesManager;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.xml.strict.Alternative1;
+import org.apache.webbeans.test.xml.strict.Alternative2;
+import org.apache.webbeans.xml.WebBeansXMLConfigurator;
+import org.junit.Test;
+
+public class AlternativesTest extends TestContext
+{
+ public AlternativesTest()
+ {
+ super(AlternativesTest.class.getName());
+ }
+
+ @Test
+ public void testAlternativeCorrect()
+ {
+ Bean<Alternative1> alternative1 = defineManagedBean(Alternative1.class);
+ Bean<Alternative2> alternative2 = defineManagedBean(Alternative2.class);
+
+ InputStream stream = getClass().getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/strict/alternatives_correct.xml");
+ Assert.assertNotNull(stream);
+
+ WebBeansXMLConfigurator configurator = new WebBeansXMLConfigurator();
+ configurator.configureSpecSpecific(stream, "alternatives_correct.xml");
+
+ AlternativesManager manager = WebBeansContext.getInstance().getAlternativesManager();
+
+ Assert.assertTrue(manager.isBeanHasAlternative(alternative1));
+ Assert.assertTrue(manager.isBeanHasAlternative(alternative2));
+
+ manager.clear();
+
+ }
+
+ @Test(expected=WebBeansConfigurationException.class)
+ public void testDoubleAlternativeClass()
+ {
+ InputStream stream = getClass().getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/strict/alternatives_failed.xml");
+ Assert.assertNotNull(stream);
+
+ WebBeansXMLConfigurator configurator = new WebBeansXMLConfigurator();
+ configurator.configureSpecSpecific(stream, "alternatives_failed.xml");
+
+ }
+
+ @Test(expected=WebBeansConfigurationException.class)
+ public void testDoubleAlternativeStereotype()
+ {
+ InputStream stream = getClass().getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/strict/alternatives_failed2.xml");
+ Assert.assertNotNull(stream);
+
+ WebBeansXMLConfigurator configurator = new WebBeansXMLConfigurator();
+ configurator.configureSpecSpecific(stream, "alternatives_failed2.xml");
+
+ }
+
+ @Test(expected=WebBeansConfigurationException.class)
+ public void testNoClass()
+ {
+ InputStream stream = getClass().getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/strict/alternatives_failed3.xml");
+ Assert.assertNotNull(stream);
+
+ WebBeansXMLConfigurator configurator = new WebBeansXMLConfigurator();
+ configurator.configureSpecSpecific(stream, "alternatives_failed3.xml");
+
+ }
+
+ @Test(expected=WebBeansConfigurationException.class)
+ public void testNoStereotype()
+ {
+ InputStream stream = getClass().getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/strict/alternatives_failed4.xml");
+ Assert.assertNotNull(stream);
+
+ WebBeansXMLConfigurator configurator = new WebBeansXMLConfigurator();
+ configurator.configureSpecSpecific(stream, "alternatives_failed4.xml");
+
+ }
+
+ @Test(expected=WebBeansConfigurationException.class)
+ public void testNotAnnotationClass()
+ {
+ InputStream stream = getClass().getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/strict/alternatives_failed5.xml");
+ Assert.assertNotNull(stream);
+
+ WebBeansXMLConfigurator configurator = new WebBeansXMLConfigurator();
+ configurator.configureSpecSpecific(stream, "alternatives_failed5.xml");
+
+ }
+
+ @Test(expected=WebBeansConfigurationException.class)
+ public void testNotStereotype()
+ {
+ InputStream stream = getClass().getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/strict/alternatives_failed6.xml");
+ Assert.assertNotNull(stream);
+
+ WebBeansXMLConfigurator configurator = new WebBeansXMLConfigurator();
+ configurator.configureSpecSpecific(stream, "alternatives_failed6.xml");
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/strict/XMLSpecStrictTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/strict/XMLSpecStrictTest.java
new file mode 100644
index 0000000..0919f5a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/strict/XMLSpecStrictTest.java
@@ -0,0 +1,65 @@
+/*
+ * 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.webbeans.test.unittests.xml.strict;
+
+import java.io.InputStream;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.test.xml.strict.DummyDecorator;
+import org.apache.webbeans.test.xml.strict.DummyInterceptor;
+import org.apache.webbeans.xml.WebBeansXMLConfigurator;
+import org.junit.Test;
+
+public class XMLSpecStrictTest extends TestContext
+{
+ public XMLSpecStrictTest()
+ {
+ super(XMLSpecStrictTest.class.getName());
+ }
+
+ @Test
+ public void testXMLSpecStrictDecorators()
+ {
+ InputStream stream = getClass().getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/strict/decorators.xml");
+ Assert.assertNotNull(stream);
+
+ WebBeansXMLConfigurator configurator = new WebBeansXMLConfigurator();
+ configurator.configureSpecSpecific(stream, "decorators.xml");
+
+ boolean enable = WebBeansContext.getInstance().getDecoratorsManager().isDecoratorEnabled(DummyDecorator.class);
+ Assert.assertTrue(enable);
+ }
+
+ @Test
+ public void testXMLSpecStrictInterceptors()
+ {
+ InputStream stream = getClass().getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/strict/interceptors.xml");
+ Assert.assertNotNull(stream);
+
+ WebBeansXMLConfigurator configurator = new WebBeansXMLConfigurator();
+ configurator.configureSpecSpecific(stream, "interceptors.xml");
+
+ boolean enable = WebBeansContext.getInstance().getInterceptorsManager().isInterceptorClassEnabled(DummyInterceptor.class);
+ Assert.assertTrue(enable);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/annot/BindingType1.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/annot/BindingType1.java
new file mode 100644
index 0000000..2774fa4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/annot/BindingType1.java
@@ -0,0 +1,31 @@
+/*
+ * 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.webbeans.test.xml.annot;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface BindingType1 {
+ public String value() default "";
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/annot/BindingType2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/annot/BindingType2.java
new file mode 100644
index 0000000..95f9647
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/annot/BindingType2.java
@@ -0,0 +1,30 @@
+/*
+ * 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.webbeans.test.xml.annot;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
+public @interface BindingType2 {
+ public String value() default "";
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/strict/Alternative1.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/strict/Alternative1.java
new file mode 100644
index 0000000..8d8b9fd
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/strict/Alternative1.java
@@ -0,0 +1,27 @@
+/*
+ * 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.webbeans.test.xml.strict;
+
+import javax.enterprise.inject.Alternative;
+
+@Alternative
+public class Alternative1
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/strict/Alternative2.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/strict/Alternative2.java
new file mode 100644
index 0000000..9041909
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/strict/Alternative2.java
@@ -0,0 +1,25 @@
+/*
+ * 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.webbeans.test.xml.strict;
+
+@AlternativeStereotype
+public class Alternative2
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/strict/AlternativeStereotype.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/strict/AlternativeStereotype.java
new file mode 100644
index 0000000..56eaf81
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/strict/AlternativeStereotype.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.xml.strict;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Stereotype;
+
+@Stereotype
+@Alternative
+@Retention(RUNTIME)
+public @interface AlternativeStereotype
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/strict/DummyDecorator.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/strict/DummyDecorator.java
new file mode 100644
index 0000000..482a178
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/strict/DummyDecorator.java
@@ -0,0 +1,27 @@
+/*
+ * 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.webbeans.test.xml.strict;
+
+import javax.decorator.Decorator;
+
+@Decorator
+public class DummyDecorator
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/strict/DummyInterceptor.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/strict/DummyInterceptor.java
new file mode 100644
index 0000000..7c95c84
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/strict/DummyInterceptor.java
@@ -0,0 +1,29 @@
+/*
+ * 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.webbeans.test.xml.strict;
+
+import javax.interceptor.Interceptor;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Secure;
+
+@Secure @Interceptor
+public class DummyInterceptor
+{
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/ClassUtilTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/ClassUtilTest.java
new file mode 100644
index 0000000..bbdcf6e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/ClassUtilTest.java
@@ -0,0 +1,79 @@
+/*
+ * 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.webbeans.util;
+
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.webbeans.util.differentPackage.MyOtherPackageSubClass;
+import org.junit.Test;
+
+import junit.framework.Assert;
+
+public class ClassUtilTest {
+
+ @Test
+ public void testGetAllNonPrivateMethods()
+ {
+ List<Method> nonPrivateMethods = ClassUtil.getNonPrivateMethods(SpecificClass.class, false);
+ nonPrivateMethods.removeAll(Arrays.asList(Object.class.getDeclaredMethods()));
+
+ // getDeclaredMethods also contains the bridge method, so it's really only 1
+ Assert.assertEquals(1, nonPrivateMethods.size());
+ }
+
+ @Test
+ public void testGetAllNonPrivateMethods_packagePrivate()
+ {
+ List<Method> nonPrivateMethods = ClassUtil.getNonPrivateMethods(MyOtherPackageSubClass.class, false);
+
+ for (Method m : nonPrivateMethods)
+ {
+ if (MySuperClass.class.equals(m.getDeclaringClass()) &&
+ "packageMethod".equals(m.getName()))
+ {
+ Assert.fail("invisible package private method must not get listed");
+ }
+ }
+ }
+
+ @Test
+ public void testIsOverridden() throws Exception
+ {
+ Assert.assertTrue(isOverridden(MySubClass.class, "publicMethod"));
+ Assert.assertTrue(isOverridden(MySubClass.class, "protectedMethod"));
+
+ Assert.assertTrue(isOverridden(MySubClass.class, "packageMethod"));
+ Assert.assertFalse(isOverridden(MyOtherPackageSubClass.class, "packageMethod"));
+
+ Assert.assertFalse(isOverridden(MySubClass.class, "privateMethod"));
+ Assert.assertFalse(isOverridden(MyOtherPackageSubClass.class, "privateMethod"));
+ }
+
+ private boolean isOverridden(Class subClass, String methodName) throws Exception
+ {
+ Method superClassMethod = MySuperClass.class.getDeclaredMethod(methodName);
+ Method subClassMethod = subClass.getDeclaredMethod(methodName);
+
+ return ClassUtil.isOverridden(subClassMethod, superClassMethod);
+ }
+
+}
+
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/CustomBaseType.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/CustomBaseType.java
new file mode 100644
index 0000000..4646654
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/CustomBaseType.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.util;
+
+public abstract class CustomBaseType
+{
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/CustomType.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/CustomType.java
new file mode 100644
index 0000000..ce9ce88
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/CustomType.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.util;
+
+public class CustomType extends CustomBaseType
+{
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/ExtendedCustomType.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/ExtendedCustomType.java
new file mode 100644
index 0000000..4dbbd7d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/ExtendedCustomType.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.util;
+
+public class ExtendedCustomType extends CustomType
+{
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/ExtendedSpecificClass.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/ExtendedSpecificClass.java
new file mode 100644
index 0000000..e92f304
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/ExtendedSpecificClass.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.util;
+
+public class ExtendedSpecificClass extends SpecificClass {
+
+ private ExtendedCustomType customType;
+
+ public void init()
+ {
+ customType = new ExtendedCustomType();
+ }
+
+ @Override
+ public ExtendedCustomType newInstance()
+ {
+ return customType;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/GenericInterface.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/GenericInterface.java
new file mode 100644
index 0000000..813a31d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/GenericInterface.java
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.util;
+
+public interface GenericInterface<T extends CustomBaseType> {
+
+ T newInstance();
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/GenericsUtilTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/GenericsUtilTest.java
new file mode 100644
index 0000000..1f69094
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/GenericsUtilTest.java
@@ -0,0 +1,94 @@
+/*
+ * 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.webbeans.util;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+
+import org.junit.Test;
+
+public class GenericsUtilTest {
+
+ @Test
+ public void resolveType() throws NoSuchFieldException {
+ Field field = AbstractObject.class.getDeclaredField("field");
+ assertEquals(Object.class, GenericsUtil.resolveType(SimpleObject.class, field));
+ assertEquals(String.class, GenericsUtil.resolveType(StringObject.class, field));
+
+ Type t = GenericsUtil.resolveType(GenericObject.class, field);
+ assertTrue(t instanceof TypeVariable);
+ assertEquals("T", ((TypeVariable) t).getName());
+
+ //X TODO assertEquals(Number.class, GenericsUtil.resolveType(GenericNumberObject.class, field));
+
+ assertEquals(Integer.class, GenericsUtil.resolveType(IntegerObject.class, field));
+ assertEquals(Object[].class, GenericsUtil.resolveType(GenericArrayObject.class, field));
+ assertEquals(Long[].class, GenericsUtil.resolveType(LongArrayObject.class, field));
+ //X TODO assertEquals(SubInterface.class, GenericsUtil.resolveType(InterfaceObject.class, field));
+ }
+
+ public static abstract class AbstractObject<V> {
+
+ private V field;
+ }
+
+ private static class SimpleObject extends AbstractObject {
+
+ }
+
+ private static class StringObject extends AbstractObject<String> {
+
+ }
+
+ private static class GenericObject<T, V> extends AbstractObject<T> {
+
+ }
+
+ private static class GenericNumberObject<X, Y extends Number & Comparable<Integer>> extends AbstractObject<Y> {
+
+ }
+
+ private static class IntegerObject extends GenericNumberObject<String, Integer> {
+
+ }
+
+ private static class GenericArrayObject<V> extends GenericObject<V[], V> {
+
+ }
+
+ private static class LongArrayObject extends GenericArrayObject<Long> {
+
+ }
+
+ private static class InterfaceObject<V extends SubInterface & SuperInterface> extends AbstractObject<V> {
+
+ }
+
+ private interface SuperInterface {
+
+ }
+
+ private interface SubInterface extends SuperInterface {
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/MySubClass.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/MySubClass.java
new file mode 100644
index 0000000..4ab1d5f
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/MySubClass.java
@@ -0,0 +1,45 @@
+/*
+ * 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.webbeans.util;
+
+/**
+*
+*/
+public class MySubClass extends MySuperClass
+{
+ public void publicMethod()
+ {
+ // do nothing
+ }
+
+ protected void protectedMethod()
+ {
+ // do nothing
+ }
+
+ void packageMethod()
+ {
+ // do nothing
+ }
+
+ private void privateMethod()
+ {
+ // do nothing
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/MySuperClass.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/MySuperClass.java
new file mode 100644
index 0000000..fd49096
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/MySuperClass.java
@@ -0,0 +1,45 @@
+/*
+ * 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.webbeans.util;
+
+/**
+*
+*/
+public class MySuperClass
+{
+ public void publicMethod()
+ {
+ // do nothing
+ }
+
+ protected void protectedMethod()
+ {
+ // do nothing
+ }
+
+ void packageMethod()
+ {
+ // do nothing
+ }
+
+ private void privateMethod()
+ {
+ // do nothing
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/SpecificClass.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/SpecificClass.java
new file mode 100644
index 0000000..37af594
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/SpecificClass.java
@@ -0,0 +1,27 @@
+/*
+ * 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.webbeans.util;
+
+public class SpecificClass<T extends CustomType> implements GenericInterface<T> {
+
+ @Override
+ public T newInstance() {
+ return null;
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/WebBeansUtilTest.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/WebBeansUtilTest.java
new file mode 100644
index 0000000..7e53c45
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/WebBeansUtilTest.java
@@ -0,0 +1,57 @@
+/*
+ * 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.webbeans.util;
+
+import static org.junit.Assert.assertEquals;
+
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.IllegalProductException;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+
+
+public class WebBeansUtilTest
+{
+
+ @Test
+ public void testCheckNullInstance()
+ {
+ String errorMessage = "WebBeans producer method : %s" +
+ " return type in the component implementation class : %s" +
+ " scope type must be @Dependent to create null instance";
+
+ try
+ {
+ WebBeansUtil.checkNullInstance(null, SessionScoped.class, errorMessage, "aMethodName",
+ String.class);
+ } catch (IllegalProductException e)
+ {
+ String message = e.getMessage();
+ assertEquals("WebBeans producer method : aMethodName" +
+ " return type in the component implementation class : class java.lang.String" +
+ " scope type must be @Dependent to create null instance", message);
+ return;
+ }
+
+ Assert.fail();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/differentPackage/MyOtherPackageSubClass.java b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/differentPackage/MyOtherPackageSubClass.java
new file mode 100644
index 0000000..c143bdd
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/util/differentPackage/MyOtherPackageSubClass.java
@@ -0,0 +1,47 @@
+/*
+ * 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.webbeans.util.differentPackage;
+
+import org.apache.webbeans.util.MySuperClass;
+
+/**
+*
+*/
+public class MyOtherPackageSubClass extends MySuperClass
+{
+ public void publicMethod()
+ {
+ // do nothing
+ }
+
+ protected void protectedMethod()
+ {
+ // do nothing
+ }
+
+ void packageMethod()
+ {
+ // do nothing
+ }
+
+ private void privateMethod()
+ {
+ // do nothing
+ }
+}
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/META-INF/beans.xml b/owb_1.2.x/webbeans-impl/src/test/resources/META-INF/beans.xml
new file mode 100644
index 0000000..85b6e63
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/META-INF/beans.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+<beans/>
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/META-INF/ejb-jar.xml b/owb_1.2.x/webbeans-impl/src/test/resources/META-INF/ejb-jar.xml
new file mode 100644
index 0000000..527c1da
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/META-INF/ejb-jar.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+<!--
+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.
+-->
+
+<!DOCTYPE ejb-jar PUBLIC
+ '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN'
+ 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>
+
+<!--
+ This file is only needed to trigger the WebBeansScanner.
+ It does NOT contain a valid EJB configuration yet!
+ See the WebBeansScannerTest for further information.
+-->
+
+<ejb-jar>
+ <enterprise-beans>
+
+ <!-- A minimal session EJB deployment -->
+ <session>
+ <ejb-name>testEJB</ejb-name>
+ <home>webbeans.testHome</home>
+ <remote>webbeans.test</remote>
+ <ejb-class>webbeans.TestBean</ejb-class>
+ <!-- or Stateless -->
+ <session-type>Stateful</session-type>
+ <transaction-type>Container</transaction-type>
+ </session>
+
+ <!-- A minimal BMP entity EJB deployment -->
+ <entity>
+ <ejb-name>TestBMP</ejb-name>
+ <home>webbeans.TestBMPHome</home>
+ <remote>webbeans.TestBMP</remote>
+ <ejb-class>webbeans.TestBMPBean</ejb-class>
+ <persistence-type>Bean</persistence-type>
+ <prim-key-class>webbeans.TestBMPPK</prim-key-class>
+ <reentrant>False</reentrant>
+ </entity>
+
+ </enterprise-beans>
+</ejb-jar>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/META-INF/openwebbeans/openwebbeans.properties b/owb_1.2.x/webbeans-impl/src/test/resources/META-INF/openwebbeans/openwebbeans.properties
new file mode 100644
index 0000000..38ec5d1
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/META-INF/openwebbeans/openwebbeans.properties
@@ -0,0 +1,34 @@
+#Licensed to the Apache Software Foundation (ASF) under one
+#or more contributor license agreements. See the NOTICE file
+#distributed with this work for additional information
+#regarding copyright ownership. The ASF licenses this file
+#to you under the Apache License, Version 2.0 (the
+#"License"); you may not use this file except in compliance
+#with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+#Unless required by applicable law or agreed to in writing,
+#software distributed under the License is distributed on an
+#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#KIND, either express or implied. See the License for the
+#specific language governing permissions and limitations
+#under the License.
+#---------------------------------------------------------------
+# The configuration for OpenWebBeans internal tests
+#---------------------------------------------------------------
+
+#general configuration section
+configuration.ordinal=11
+
+# the service section:
+# The key is the Interface, the value the implementation of the service
+
+#use the web metadata as default
+org.apache.webbeans.spi.deployer.MetaDataDiscoveryService=org.apache.webbeans.test.util.OpenWebBeansTestMetaDataDiscoveryService
+
+
+# specific proxy mapping which should get tested
+
+org.apache.webbeans.proxy.mapping.javax.enterprise.context.RequestScoped=org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler
+org.apache.webbeans.proxy.mapping.javax.enterprise.context.ApplicationScoped=org.apache.webbeans.intercept.ApplicationScopedBeanInterceptorHandler
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/META-INF/persistence.xml b/owb_1.2.x/webbeans-impl/src/test/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..baccaaa
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/META-INF/persistence.xml
@@ -0,0 +1,49 @@
+<?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.
+-->
+
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
+ http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+ version="1.0">
+
+ <!-- simply all annotated persistent entities will be part of this unit-->
+ <persistence-unit name="openwebbeanstest">
+
+ <!-- <class>org.apache.openwebbeans.test.entity.UserEntity</class>-->
+
+ <exclude-unlisted-classes>true</exclude-unlisted-classes>
+
+ <properties>
+ <!-- internal logger, has no timestamp? -->
+ <property name="openjpa.Log" value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE" />
+ <property name="openjpa.Log" value="DefaultLevel=TRACE" />
+ <!-- redirect to log4j -->
+ <property name="openjpa.Log" value="log4j" />
+ <property name="openjpa.jdbc.DBDictionary" value="hsql" />
+ <property name="openjpa.ConnectionDriverName" value="org.hsqldb.jdbcDriver" />
+ <property name="openjpa.ConnectionURL" value="jdbc:hsqldb:mem:test" />
+ <property name="openjpa.ConnectionUserName" value="sa" />
+ <property name="openjpa.ConnectionPassword" value="" />
+ </properties>
+
+ </persistence-unit>
+</persistence>
+
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/concepts/alternatives/tests/AlternativeOnClassAndProducerMethod.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/concepts/alternatives/tests/AlternativeOnClassAndProducerMethod.xml
new file mode 100644
index 0000000..69485dc
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/concepts/alternatives/tests/AlternativeOnClassAndProducerMethod.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<beans>
+ <alternatives>
+ <class>org.apache.webbeans.newtests.concepts.alternatives.common.AlternativeOnClassAndProducerMethodBean</class>
+ </alternatives>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/concepts/alternatives/tests/AlternativeOnClassOnly.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/concepts/alternatives/tests/AlternativeOnClassOnly.xml
new file mode 100644
index 0000000..942b6e3
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/concepts/alternatives/tests/AlternativeOnClassOnly.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<beans>
+ <alternatives>
+ <class>org.apache.webbeans.newtests.concepts.alternatives.common.AlternativeOnClassOnlyBean</class>
+ </alternatives>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/concepts/alternatives/tests/AlternativeOnProducerFieldTest.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/concepts/alternatives/tests/AlternativeOnProducerFieldTest.xml
new file mode 100644
index 0000000..dd8e72c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/concepts/alternatives/tests/AlternativeOnProducerFieldTest.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<beans>
+ <alternatives>
+ <class>org.apache.webbeans.newtests.concepts.alternatives.common.PencilProducerBean</class>
+ </alternatives>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/concepts/alternatives/tests/AlternativeOnProducerMethodOnly.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/concepts/alternatives/tests/AlternativeOnProducerMethodOnly.xml
new file mode 100644
index 0000000..ca1389a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/concepts/alternatives/tests/AlternativeOnProducerMethodOnly.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<beans>
+ <alternatives>
+ <class>org.apache.webbeans.newtests.concepts.alternatives.common.AlternativeOnProducerMethodOnlyBean</class>
+ </alternatives>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/concepts/alternatives/tests/MultipleAlternativesInSameFile_broken.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/concepts/alternatives/tests/MultipleAlternativesInSameFile_broken.xml
new file mode 100644
index 0000000..7d84b5e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/concepts/alternatives/tests/MultipleAlternativesInSameFile_broken.xml
@@ -0,0 +1,25 @@
+<?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.
+-->
+<beans>
+ <alternatives>
+ <class>org.apache.webbeans.newtests.concepts.alternatives.common.PencilProducerBean</class>
+ <class>org.apache.webbeans.newtests.concepts.alternatives.common.PencilProducerBean</class>
+ </alternatives>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/concepts/alternatives/tests/simpleAlternative.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/concepts/alternatives/tests/simpleAlternative.xml
new file mode 100644
index 0000000..6e9d4ba
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/concepts/alternatives/tests/simpleAlternative.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<beans>
+ <alternatives>
+ <class>org.apache.webbeans.newtests.concepts.alternatives.common.AlternativeBean</class>
+ </alternatives>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/concepts/alternatives/tests/simpleAlternative_2.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/concepts/alternatives/tests/simpleAlternative_2.xml
new file mode 100644
index 0000000..6e9d4ba
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/concepts/alternatives/tests/simpleAlternative_2.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<beans>
+ <alternatives>
+ <class>org.apache.webbeans.newtests.concepts.alternatives.common.AlternativeBean</class>
+ </alternatives>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/config/propertyloadertest.properties b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/config/propertyloadertest.properties
new file mode 100644
index 0000000..2b1898c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/config/propertyloadertest.properties
@@ -0,0 +1,29 @@
+# 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.
+#---------------------------------------------------------------
+#
+# test properties for the PropertyLoaderTest
+#
+#---------------------------------------------------------------
+
+configuration.ordinal=15
+
+testConfig=testValue
+test15=15
+override_y=y
+override_all=15
+unique_1=15
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/config/propertyloadertest2.properties b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/config/propertyloadertest2.properties
new file mode 100644
index 0000000..a587a8b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/config/propertyloadertest2.properties
@@ -0,0 +1,29 @@
+# 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.
+#---------------------------------------------------------------
+#
+# test properties for the PropertyLoaderTest
+#
+#---------------------------------------------------------------
+
+configuration.ordinal=16
+
+testConfig=testValue16
+test16=16
+override_y=z
+override_all=16
+unique_2=16
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/config/propertyloadertest3.properties b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/config/propertyloadertest3.properties
new file mode 100644
index 0000000..9ac7e48
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/config/propertyloadertest3.properties
@@ -0,0 +1,26 @@
+# 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.
+#---------------------------------------------------------------
+#
+# test properties for the PropertyLoaderTest
+#
+#---------------------------------------------------------------
+
+configuration.ordinal=20
+
+override_all=20
+unique_3=20
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/simple/SimpleDecoratorTest.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/simple/SimpleDecoratorTest.xml
new file mode 100644
index 0000000..83f6ef0
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/simple/SimpleDecoratorTest.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<beans>
+ <decorators>
+ <class>org.apache.webbeans.newtests.decorators.simple.LogDecorator</class>
+ </decorators>
+</beans>
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/AbstractDecoratorTest.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/AbstractDecoratorTest.xml
new file mode 100644
index 0000000..9bae895
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/AbstractDecoratorTest.xml
@@ -0,0 +1,27 @@
+<?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.
+-->
+<beans>
+ <decorators>
+ <class>org.apache.webbeans.newtests.decorators.multiple.Decorator1</class>
+ <class>org.apache.webbeans.newtests.decorators.multiple.Decorator4</class>
+ <class>org.apache.webbeans.newtests.decorators.multiple.Decorator2</class>
+ <class>org.apache.webbeans.newtests.decorators.multiple.Decorator3</class>
+ </decorators>
+</beans>
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/BrokenDecoratorTest.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/BrokenDecoratorTest.xml
new file mode 100644
index 0000000..1a22d0e
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/BrokenDecoratorTest.xml
@@ -0,0 +1,30 @@
+<?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.
+-->
+<beans>
+ <decorators>
+ <class>org.apache.webbeans.newtests.decorators.broken.BrokenAlternative</class>
+ <class>org.apache.webbeans.newtests.decorators.broken.BrokenName</class>
+ <class>org.apache.webbeans.newtests.decorators.broken.BrokenScope</class>
+ </decorators>
+
+ <alternatives>
+ <class>org.apache.webbeans.newtests.decorators.broken.BrokenAlternative</class>
+ </alternatives>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/ConversationDecoratorTest.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/ConversationDecoratorTest.xml
new file mode 100644
index 0000000..406020d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/ConversationDecoratorTest.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<beans>
+ <decorators>
+ <class>org.apache.webbeans.newtests.decorators.common.ConversationDecorator</class>
+ </decorators>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/DecoratorAndInterceptorStack.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/DecoratorAndInterceptorStack.xml
new file mode 100644
index 0000000..86d2008
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/DecoratorAndInterceptorStack.xml
@@ -0,0 +1,28 @@
+<?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.
+-->
+<beans>
+ <interceptors>
+ <class>org.apache.webbeans.newtests.decorators.multiple.OutputInterceptor</class>
+ </interceptors>
+ <decorators>
+ <class>org.apache.webbeans.newtests.decorators.multiple.Decorator1</class>
+ <class>org.apache.webbeans.newtests.decorators.multiple.Decorator2</class>
+ </decorators>
+</beans>
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/DependentDecoratorDestroy.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/DependentDecoratorDestroy.xml
new file mode 100644
index 0000000..b3a99dd
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/DependentDecoratorDestroy.xml
@@ -0,0 +1,27 @@
+<?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.
+-->
+<beans>
+ <interceptors>
+ <class>org.apache.webbeans.test.component.event.normal.TransactionalInterceptor</class>
+ </interceptors>
+ <decorators>
+ <class>org.apache.webbeans.newtests.decorators.dependent.DependentDecorator</class>
+ </decorators>
+</beans>
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/GenericDecoratorTest.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/GenericDecoratorTest.xml
new file mode 100644
index 0000000..d5379db
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/GenericDecoratorTest.xml
@@ -0,0 +1,25 @@
+<?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.
+-->
+<beans>
+ <decorators>
+ <class>org.apache.webbeans.newtests.decorators.common.GarphlyDecorator</class>
+ <class>org.apache.webbeans.newtests.decorators.generic.SampleDecorator</class>
+ </decorators>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/MultipleCallDecoratorTest.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/MultipleCallDecoratorTest.xml
new file mode 100644
index 0000000..19704d4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/MultipleCallDecoratorTest.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<beans>
+ <decorators>
+ <class>org.apache.webbeans.newtests.decorators.multiple.MultipleCallDecorator</class>
+ </decorators>
+</beans>
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/MultipleDecoratorStack.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/MultipleDecoratorStack.xml
new file mode 100644
index 0000000..d13b9aa
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/MultipleDecoratorStack.xml
@@ -0,0 +1,25 @@
+<?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.
+-->
+<beans>
+ <decorators>
+ <class>org.apache.webbeans.newtests.decorators.multiple.Decorator1</class>
+ <class>org.apache.webbeans.newtests.decorators.multiple.Decorator2</class>
+ </decorators>
+</beans>
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/SameDecorator_broken.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/SameDecorator_broken.xml
new file mode 100644
index 0000000..754a4ce
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/SameDecorator_broken.xml
@@ -0,0 +1,26 @@
+<?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.
+-->
+<beans>
+ <decorators>
+ <!-- the same decorator defined twice in the same file must lead to a deployment exception -->
+ <class>org.apache.webbeans.newtests.decorators.multiple.Decorator1</class>
+ <class>org.apache.webbeans.newtests.decorators.multiple.Decorator1</class>
+ </decorators>
+</beans>
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/SimpleDecorator_1.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/SimpleDecorator_1.xml
new file mode 100644
index 0000000..417cd7b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/SimpleDecorator_1.xml
@@ -0,0 +1,25 @@
+<?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.
+-->
+<beans>
+ <decorators>
+ <!-- the same decorator defined twice in the same file must lead to a deployment exception -->
+ <class>org.apache.webbeans.newtests.decorators.multiple.Decorator1</class>
+ </decorators>
+</beans>
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/SimpleDecorator_2.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/SimpleDecorator_2.xml
new file mode 100644
index 0000000..417cd7b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/decorators/tests/SimpleDecorator_2.xml
@@ -0,0 +1,25 @@
+<?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.
+-->
+<beans>
+ <decorators>
+ <!-- the same decorator defined twice in the same file must lead to a deployment exception -->
+ <class>org.apache.webbeans.newtests.decorators.multiple.Decorator1</class>
+ </decorators>
+</beans>
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/injection/injectionpoint/tests/PlaceHolder.properties b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/injection/injectionpoint/tests/PlaceHolder.properties
new file mode 100644
index 0000000..1b7eb78
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/injection/injectionpoint/tests/PlaceHolder.properties
@@ -0,0 +1,17 @@
+# Copyright 2012 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.
+
+org.apache.webbeans.newtests.injection.injectionpoint.beans.PropertyInjector.anotherVarName = Injection is working...Finally
+org.apache.webbeans.newtests.injection.injectionpoint.beans.PropertyInjector.ldapHost = Rohit Kelapure LDAP Host
+org.apache.webbeans.newtests.injection.injectionpoint.beans.MyContainer.nestedProperty = Rohit Kelapure Nested Property
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/broken/BrokenTest.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/broken/BrokenTest.xml
new file mode 100644
index 0000000..0e04c63
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/broken/BrokenTest.xml
@@ -0,0 +1,30 @@
+<?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.
+-->
+<beans>
+ <interceptors>
+ <class>org.apache.webbeans.newtests.interceptors.broken.BrokenAlternative</class>
+ <class>org.apache.webbeans.newtests.interceptors.broken.BrokenName</class>
+ <class>org.apache.webbeans.newtests.interceptors.broken.BrokenScope</class>
+ </interceptors>
+
+ <alternatives>
+ <class>org.apache.webbeans.newtests.interceptors.broken.BrokenAlternative</class>
+ </alternatives>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/business/tests/DependingInterceptorTest.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/business/tests/DependingInterceptorTest.xml
new file mode 100644
index 0000000..af97934
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/business/tests/DependingInterceptorTest.xml
@@ -0,0 +1,26 @@
+<?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.
+-->
+<beans>
+ <interceptors>
+ <class>org.apache.webbeans.newtests.interceptors.common.TransactionInterceptor</class>
+ <class>org.apache.webbeans.newtests.interceptors.common.SecureInterceptor</class>
+
+ </interceptors>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/business/tests/InheritedBeanInterceptorTest.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/business/tests/InheritedBeanInterceptorTest.xml
new file mode 100644
index 0000000..47e30c5
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/business/tests/InheritedBeanInterceptorTest.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<beans>
+ <interceptors>
+ <class>org.apache.webbeans.newtests.interceptors.common.TransactionInterceptor</class>
+ </interceptors>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/business/tests/RuntimeExceptionsInterceptorTest.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/business/tests/RuntimeExceptionsInterceptorTest.xml
new file mode 100644
index 0000000..24356b4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/business/tests/RuntimeExceptionsInterceptorTest.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<beans>
+ <interceptors>
+ <class>org.apache.webbeans.newtests.interceptors.common.RuntimeExceptionsInterceptor</class>
+ </interceptors>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/business/tests/WithInheritedBindingTypeTest.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/business/tests/WithInheritedBindingTypeTest.xml
new file mode 100644
index 0000000..af97934
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/business/tests/WithInheritedBindingTypeTest.xml
@@ -0,0 +1,26 @@
+<?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.
+-->
+<beans>
+ <interceptors>
+ <class>org.apache.webbeans.newtests.interceptors.common.TransactionInterceptor</class>
+ <class>org.apache.webbeans.newtests.interceptors.common.SecureInterceptor</class>
+
+ </interceptors>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/business/tests/WithInheritedStereoTypeInterceptorTest.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/business/tests/WithInheritedStereoTypeInterceptorTest.xml
new file mode 100644
index 0000000..9b11843
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/business/tests/WithInheritedStereoTypeInterceptorTest.xml
@@ -0,0 +1,25 @@
+<?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.
+-->
+<beans>
+ <interceptors>
+ <class>org.apache.webbeans.newtests.interceptors.common.TransactionInterceptor</class>
+ <class>org.apache.webbeans.newtests.interceptors.common.SecureInterceptor</class>
+ </interceptors>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/business/tests/WithStereoTypeInterceptorTest.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/business/tests/WithStereoTypeInterceptorTest.xml
new file mode 100644
index 0000000..47e30c5
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/business/tests/WithStereoTypeInterceptorTest.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<beans>
+ <interceptors>
+ <class>org.apache.webbeans.newtests.interceptors.common.TransactionInterceptor</class>
+ </interceptors>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/dependent/DependentInterceptorTest.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/dependent/DependentInterceptorTest.xml
new file mode 100644
index 0000000..a7b166b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/dependent/DependentInterceptorTest.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<beans>
+ <interceptors>
+ <class>org.apache.webbeans.newtests.interceptors.common.DependentInterceptor</class>
+ </interceptors>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/inheritance/InheritedInterceptorTest.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/inheritance/InheritedInterceptorTest.xml
new file mode 100644
index 0000000..1187f00
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/inheritance/InheritedInterceptorTest.xml
@@ -0,0 +1,28 @@
+<?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.
+-->
+<beans>
+ <interceptors>
+ <class>org.apache.webbeans.newtests.interceptors.inheritance.InterceptorSimple</class>
+ <class>org.apache.webbeans.newtests.interceptors.inheritance.InterceptorInherited</class>
+ <class>org.apache.webbeans.newtests.interceptors.inheritance.InterceptorMethod</class>
+ <class>org.apache.webbeans.newtests.interceptors.inheritance.InterceptorIncludedByIndirect</class>
+ <class>org.apache.webbeans.newtests.interceptors.inheritance.InterceptorInheritedIncludedByIndirect</class>
+ </interceptors>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleTest.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleTest.xml
new file mode 100644
index 0000000..dbc28ce
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleTest.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<beans>
+ <interceptors>
+ <class>org.apache.webbeans.newtests.interceptors.lifecycle.LifecycleInterceptor</class>
+ </interceptors>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleTestBbd.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleTestBbd.xml
new file mode 100644
index 0000000..c864905
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleTestBbd.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<beans>
+ <interceptors>
+ <class>org.apache.webbeans.newtests.interceptors.lifecycle.LifecycleInterceptorBbd</class>
+ </interceptors>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleTestPat.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleTestPat.xml
new file mode 100644
index 0000000..de30e6a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleTestPat.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<beans>
+ <interceptors>
+ <class>org.apache.webbeans.newtests.interceptors.lifecycle.LifecycleInterceptorPat</class>
+ </interceptors>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/resolution/InterceptorResolutionServiceTest.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/resolution/InterceptorResolutionServiceTest.xml
new file mode 100644
index 0000000..81e4ae9
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/resolution/InterceptorResolutionServiceTest.xml
@@ -0,0 +1,31 @@
+<?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.
+-->
+<beans>
+ <interceptors>
+ <class>org.apache.webbeans.test.component.intercept.webbeans.TransactionalInterceptor</class>
+ <class>org.apache.webbeans.test.component.intercept.webbeans.ActionInterceptor</class>
+ <class>org.apache.webbeans.test.component.intercept.webbeans.SecureInterceptor</class>
+ <class>org.apache.webbeans.newtests.interceptors.resolution.interceptors.TestInterceptor1</class>
+ </interceptors>
+ <decorators>
+ <class>org.apache.webbeans.test.component.decorator.clean.ServiceDecorator</class>
+ <class>org.apache.webbeans.newtests.interceptors.factory.beans.MyAbstractTestDecorator</class>
+ </decorators>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducer.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducer.xml
new file mode 100644
index 0000000..ac973ca
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducer.xml
@@ -0,0 +1,25 @@
+<?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.
+-->
+<beans>
+ <alternatives>
+ <class>org.apache.webbeans.newtests.specalization.AdvancedPenProducer</class>
+ <class>org.apache.webbeans.newtests.specalization.PremiumPenProducer</class>
+ </alternatives>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/specalization/observer/AlternativeSpecializes.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/specalization/observer/AlternativeSpecializes.xml
new file mode 100644
index 0000000..5935ed5
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/specalization/observer/AlternativeSpecializes.xml
@@ -0,0 +1,27 @@
+<?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.
+-->
+<beans>
+ <alternatives>
+ <class>org.apache.webbeans.newtests.specalization.observer.prot.BeanC</class>
+ <class>org.apache.webbeans.newtests.specalization.observer.prot.BeanD</class>
+ <class>org.apache.webbeans.newtests.specalization.observer.pub.BeanC</class>
+ <class>org.apache.webbeans.newtests.specalization.observer.pub.BeanD</class>
+ </alternatives>
+</beans>
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/unittests/intercept/webbeans/SecureInterceptorComponentTest.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/unittests/intercept/webbeans/SecureInterceptorComponentTest.xml
new file mode 100644
index 0000000..a343046
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/unittests/intercept/webbeans/SecureInterceptorComponentTest.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<beans>
+ <interceptors>
+ <class>org.apache.webbeans.test.component.intercept.webbeans.SecureInterceptor</class>
+ </interceptors>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/alternative/alternatives.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/alternative/alternatives.xml
new file mode 100644
index 0000000..c1238f2
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/alternative/alternatives.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<beans>
+ <alternatives>
+ <class>org.apache.webbeans.test.component.inject.alternative.AlternativeComponent</class>
+ </alternatives>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/specializes/alternatives.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/specializes/alternatives.xml
new file mode 100644
index 0000000..ac17e8d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/specializes/alternatives.xml
@@ -0,0 +1,25 @@
+<?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.
+-->
+<beans>
+ <alternatives>
+ <class>org.apache.webbeans.test.component.specializes.logger.MockSpecializedLogger</class>
+ <class>org.apache.webbeans.test.component.specializes.logger.MockNotSpecializedLogger</class>
+ </alternatives>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/alternatives_correct.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/alternatives_correct.xml
new file mode 100644
index 0000000..d5eaf24
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/alternatives_correct.xml
@@ -0,0 +1,25 @@
+<?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.
+-->
+<beans>
+ <alternatives>
+ <class>org.apache.webbeans.test.xml.strict.Alternative1</class>
+ <stereotype>org.apache.webbeans.test.xml.strict.AlternativeStereotype</stereotype>
+ </alternatives>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/alternatives_failed.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/alternatives_failed.xml
new file mode 100644
index 0000000..287104b
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/alternatives_failed.xml
@@ -0,0 +1,25 @@
+<?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.
+-->
+<beans>
+ <alternatives>
+ <class>org.apache.webbeans.test.xml.strict.Alternative1</class>
+ <class>org.apache.webbeans.test.xml.strict.Alternative1</class>
+ </alternatives>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/alternatives_failed2.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/alternatives_failed2.xml
new file mode 100644
index 0000000..b8eda99
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/alternatives_failed2.xml
@@ -0,0 +1,25 @@
+<?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.
+-->
+<beans>
+ <alternatives>
+ <stereotype>org.apache.webbeans.test.xml.strict.AlternativeStereotype</stereotype>
+ <stereotype>org.apache.webbeans.test.xml.strict.AlternativeStereotype</stereotype>
+ </alternatives>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/alternatives_failed3.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/alternatives_failed3.xml
new file mode 100644
index 0000000..5d932f4
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/alternatives_failed3.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<beans>
+ <alternatives>
+ <class>not.found.class</class>
+ </alternatives>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/alternatives_failed4.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/alternatives_failed4.xml
new file mode 100644
index 0000000..8a392d1
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/alternatives_failed4.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<beans>
+ <alternatives>
+ <stereotype>not.found.stereotype</stereotype>
+ </alternatives>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/alternatives_failed5.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/alternatives_failed5.xml
new file mode 100644
index 0000000..90e5c7d
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/alternatives_failed5.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<beans>
+ <alternatives>
+ <stereotype>org.apache.webbeans.test.xml.strict.Alternative1</stereotype>
+ </alternatives>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/alternatives_failed6.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/alternatives_failed6.xml
new file mode 100644
index 0000000..667360a
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/alternatives_failed6.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<beans>
+ <alternatives>
+ <stereotype>org.apache.webbeans.test.annotation.binding.Asynchronous</stereotype>
+ </alternatives>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/decorators.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/decorators.xml
new file mode 100644
index 0000000..5a3658c
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/decorators.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<beans>
+ <decorators>
+ <class>org.apache.webbeans.test.xml.strict.DummyDecorator</class>
+ </decorators>
+</beans>
diff --git a/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/interceptors.xml b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/interceptors.xml
new file mode 100644
index 0000000..c672489
--- /dev/null
+++ b/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/interceptors.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<beans>
+ <interceptors>
+ <class>org.apache.webbeans.test.xml.strict.DummyInterceptor</class>
+ </interceptors>
+</beans>
diff --git a/owb_1.2.x/webbeans-jee5-ejb-resource/pom.xml b/owb_1.2.x/webbeans-jee5-ejb-resource/pom.xml
new file mode 100644
index 0000000..e5c8818
--- /dev/null
+++ b/owb_1.2.x/webbeans-jee5-ejb-resource/pom.xml
@@ -0,0 +1,74 @@
+<?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.
+-->
+
+<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>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>1.2.5</version>
+ </parent>
+
+ <artifactId>openwebbeans-jee5-ejb-resource</artifactId>
+
+ <name>EE Resource plugin</name>
+ <description>Apache OpenWebBeans EE 5 Resource Integration</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-resource</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-ejb_3.1_spec</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/owb_1.2.x/webbeans-jee5-ejb-resource/src/main/java/org/apache/webbeans/resource/spi/ee/EjbResolver.java b/owb_1.2.x/webbeans-jee5-ejb-resource/src/main/java/org/apache/webbeans/resource/spi/ee/EjbResolver.java
new file mode 100644
index 0000000..b0a55ab
--- /dev/null
+++ b/owb_1.2.x/webbeans-jee5-ejb-resource/src/main/java/org/apache/webbeans/resource/spi/ee/EjbResolver.java
@@ -0,0 +1,27 @@
+/*
+ * 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.webbeans.resource.spi.ee;
+
+import javax.ejb.EJB;
+import javax.naming.NamingException;
+
+public interface EjbResolver
+{
+ <T> T resolve(Class<T> resourceReference, EJB ejbAnnotation) throws NamingException;
+}
diff --git a/owb_1.2.x/webbeans-jee5-ejb-resource/src/main/java/org/apache/webbeans/resource/spi/ee/ExtendedStandaloneResourceInjectionService.java b/owb_1.2.x/webbeans-jee5-ejb-resource/src/main/java/org/apache/webbeans/resource/spi/ee/ExtendedStandaloneResourceInjectionService.java
new file mode 100644
index 0000000..b4a9caa
--- /dev/null
+++ b/owb_1.2.x/webbeans-jee5-ejb-resource/src/main/java/org/apache/webbeans/resource/spi/ee/ExtendedStandaloneResourceInjectionService.java
@@ -0,0 +1,135 @@
+/*
+ * 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.webbeans.resource.spi.ee;
+
+import org.apache.webbeans.annotation.DefaultLiteral;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.resource.spi.se.StandaloneResourceInjectionService;
+import org.apache.webbeans.spi.api.ResourceReference;
+
+import javax.ejb.EJB;
+import javax.enterprise.inject.spi.Bean;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Allows to use @EJB in JEE 5 app servers
+ */
+public class ExtendedStandaloneResourceInjectionService extends StandaloneResourceInjectionService
+{
+ private final static Logger logger = WebBeansLoggerFacade.getLogger(ExtendedStandaloneResourceInjectionService.class);
+
+ private List<EjbResolver> ejbResolvers = new ArrayList<EjbResolver>();
+
+ public ExtendedStandaloneResourceInjectionService(WebBeansContext webBeansContext)
+ {
+ super(webBeansContext);
+
+ List<EjbResolver> ejbResolverServiceLoader =
+ webBeansContext.getLoaderService().load(EjbResolver.class);
+
+ for (EjbResolver ejbResolver : ejbResolverServiceLoader)
+ {
+ this.ejbResolvers.add(ejbResolver);
+ }
+ }
+
+ @Override
+ public <X, T extends Annotation> X getResourceReference(ResourceReference<X, T> resourceReference)
+ {
+ if (resourceReference.supports(EJB.class))
+ {
+ EJB ejbAnnotation = resourceReference.getAnnotation(EJB.class);
+ for (EjbResolver ejbResolver : this.ejbResolvers)
+ {
+ try
+ {
+ X result = ejbResolver.resolve(resourceReference.getResourceType(), ejbAnnotation);
+ if(result != null)
+ {
+ return result;
+ }
+ }
+ catch (NamingException e)
+ {
+ if(logger.isLoggable(Level.FINE))
+ {
+ logger.log(Level.FINE, ejbResolver.getClass().getName()
+ + " couldn't find EJB for " + resourceReference.getResourceType().getName());
+ }
+ }
+ }
+
+ String mappedName = ejbAnnotation.mappedName();
+ String jndiName = convertToJndiName(resourceReference.getResourceType(), mappedName);
+ X result = lookupEjb(jndiName, resourceReference.getResourceType());
+
+ return result;
+ }
+
+ return super.getResourceReference(resourceReference);
+ }
+
+ private String convertToJndiName(Class resourceType, String mappedName)
+ {
+ if(mappedName.length() == 0)
+ {
+ mappedName = resourceType.getSimpleName();
+ }
+ return mappedName + "#" + resourceType.getName();
+ }
+
+ private <X> X lookupEjb(String jndiName, Class<X> resourceType)
+ {
+ try
+ {
+ Context context = new InitialContext();
+ X result = (X) context.lookup(jndiName);
+ return result;
+ }
+ catch (NamingException e)
+ {
+ //fallback for a servlet container
+ BeanManagerImpl beanManager = getWebBeansContext().getBeanManagerImpl();
+
+ Iterator<Bean<?>> beansIterator = beanManager.getBeans(resourceType, new DefaultLiteral()).iterator();
+
+ if (!beansIterator.hasNext())
+ {
+ logger.log(Level.SEVERE, "can't find ejb (via jndi) or cdi bean for type " + resourceType.getName(), e);
+ throw new RuntimeException("can't find ejb (via jndi) or cdi bean for type "
+ + resourceType.getName(), e);
+ }
+ Bean<?> simulatedStatelessEjbBean = beansIterator.next();
+
+ return (X)beanManager.getReference(simulatedStatelessEjbBean,
+ resourceType,
+ beanManager.createCreationalContext(simulatedStatelessEjbBean));
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-jee5-ejb-resource/src/main/resources/META-INF/openwebbeans/openwebbeans.properties b/owb_1.2.x/webbeans-jee5-ejb-resource/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
new file mode 100644
index 0000000..f320d75
--- /dev/null
+++ b/owb_1.2.x/webbeans-jee5-ejb-resource/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
@@ -0,0 +1,20 @@
+#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.
+
+configuration.ordinal=12
+
+org.apache.webbeans.spi.ResourceInjectionService=org.apache.webbeans.resource.spi.ee.ExtendedStandaloneResourceInjectionService
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-jee5-ejb-resource/src/site/site.xml b/owb_1.2.x/webbeans-jee5-ejb-resource/src/site/site.xml
new file mode 100644
index 0000000..5fb60df
--- /dev/null
+++ b/owb_1.2.x/webbeans-jee5-ejb-resource/src/site/site.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<project name="OpenWebBeans">
+ <bannerLeft>
+ <name>Apache OpenWebBeans</name>
+ <src>http://openwebbeans.apache.org/owb/images/logos/openwebbeans_hor.png</src>
+ <href>http://openwebbeans.apache.org</href>
+ </bannerLeft>
+
+ <bannerRight>
+ <name>Apache Banner</name>
+ <src>http://www.apache.org/images/asf-logo.gif</src>
+ <href>http://www.apache.org</href>
+ </bannerRight>
+
+ <publishDate format="dd MMM yyyy" />
+ <version position="left"/>
+
+ <body>
+ <breadcrumbs>
+ <item name="Apache" href="http://www.apache.org"/>
+ <item name="OpenWebBeans" href="http://openwebbeans.apache.org"/>
+ <item name="OWB-Resource" href="http://openwebbeans.apache.org/${project.version}/openwebbeans-jee5-ejb-resource"/>
+ </breadcrumbs>
+
+ <menu ref="reports"/>
+ </body>
+</project>
+
diff --git a/owb_1.2.x/webbeans-jms/pom.xml b/owb_1.2.x/webbeans-jms/pom.xml
new file mode 100644
index 0000000..7cc770b
--- /dev/null
+++ b/owb_1.2.x/webbeans-jms/pom.xml
@@ -0,0 +1,70 @@
+<?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.
+ -->
+
+<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>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>1.2.5</version>
+ </parent>
+ <artifactId>openwebbeans-jms</artifactId>
+ <name>JMS plugin</name>
+ <description>Apache OpenWebBeans JMS Integration</description>
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ <version>1.1.1</version>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/owb_1.2.x/webbeans-jms/src/main/java/org/apache/webbeans/jms/component/JmsBean.java b/owb_1.2.x/webbeans-jms/src/main/java/org/apache/webbeans/jms/component/JmsBean.java
new file mode 100644
index 0000000..07dc1a2
--- /dev/null
+++ b/owb_1.2.x/webbeans-jms/src/main/java/org/apache/webbeans/jms/component/JmsBean.java
@@ -0,0 +1,51 @@
+/*
+ * 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.webbeans.jms.component;
+
+import javax.enterprise.inject.spi.Producer;
+import javax.jms.Destination;
+
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.component.JmsBeanMarker;
+import org.apache.webbeans.component.WebBeansType;
+import org.apache.webbeans.component.spi.BeanAttributes;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.jms.JMSModel;
+
+public class JmsBean<T> extends AbstractOwbBean<T> implements JmsBeanMarker
+{
+ private JMSModel jmsModel = null;
+
+ JmsBean(WebBeansContext webBeansContext, JMSModel jmsModel, BeanAttributes<T> beanAttributes)
+ {
+ super(webBeansContext, WebBeansType.JMS, beanAttributes, Destination.class, false);
+ this.jmsModel = jmsModel;
+ }
+
+ public JMSModel getJmsModel()
+ {
+ return this.jmsModel;
+ }
+
+ @Override
+ public Producer<T> getProducer()
+ {
+ return null;
+ }
+}
diff --git a/owb_1.2.x/webbeans-jms/src/main/java/org/apache/webbeans/jms/component/JmsComponentFactory.java b/owb_1.2.x/webbeans-jms/src/main/java/org/apache/webbeans/jms/component/JmsComponentFactory.java
new file mode 100644
index 0000000..c4c3004
--- /dev/null
+++ b/owb_1.2.x/webbeans-jms/src/main/java/org/apache/webbeans/jms/component/JmsComponentFactory.java
@@ -0,0 +1,90 @@
+/*
+ * 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.webbeans.jms.component;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueReceiver;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.jms.Topic;
+import javax.jms.TopicConnection;
+import javax.jms.TopicPublisher;
+import javax.jms.TopicSession;
+import javax.jms.TopicSubscriber;
+
+import org.apache.webbeans.component.BeanAttributesImpl;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.jms.JMSModel;
+import org.apache.webbeans.jms.JMSModel.JMSType;
+import org.apache.webbeans.util.Asserts;
+
+public final class JmsComponentFactory
+{
+ private static JmsComponentFactory instance = new JmsComponentFactory();
+
+ private JmsComponentFactory()
+ {
+
+ }
+
+ public static JmsComponentFactory getJmsComponentFactory()
+ {
+ return instance;
+ }
+
+ public <T> JmsBean<T> getJmsComponent(WebBeansContext webBeansContext, JMSModel model)
+ {
+ Asserts.assertNotNull(model,"model parameter can not be null");
+
+ Set<Type> apiTypes = new HashSet<Type>();
+ Set<Annotation> qualifiers = new HashSet<Annotation>();
+
+ if(model.getJmsType().equals(JMSType.QUEUE))
+ {
+ apiTypes.add(Queue.class);
+ apiTypes.add(QueueConnection.class);
+ apiTypes.add(QueueSession.class);
+ apiTypes.add(QueueSender.class);
+ apiTypes.add(QueueReceiver.class);
+ }
+ else
+ {
+ apiTypes.add(Topic.class);
+ apiTypes.add(TopicConnection.class);
+ apiTypes.add(TopicSession.class);
+ apiTypes.add(TopicPublisher.class);
+ apiTypes.add(TopicSubscriber.class);
+ }
+
+ Annotation[] anns = model.getBindings();
+
+ for(Annotation a : anns)
+ {
+ qualifiers.add(a);
+ }
+
+ return new JmsBean<T>(webBeansContext, model, new BeanAttributesImpl<T>(apiTypes, qualifiers));
+ }
+}
diff --git a/owb_1.2.x/webbeans-jms/src/main/java/org/apache/webbeans/jms/plugin/OpenWebBeansJmsPlugin.java b/owb_1.2.x/webbeans-jms/src/main/java/org/apache/webbeans/jms/plugin/OpenWebBeansJmsPlugin.java
new file mode 100644
index 0000000..52ebfa6
--- /dev/null
+++ b/owb_1.2.x/webbeans-jms/src/main/java/org/apache/webbeans/jms/plugin/OpenWebBeansJmsPlugin.java
@@ -0,0 +1,70 @@
+/*
+ * 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.webbeans.jms.plugin;
+
+import javax.enterprise.inject.spi.Bean;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.jms.JMSModel;
+import org.apache.webbeans.jms.component.JmsComponentFactory;
+import org.apache.webbeans.jms.component.JmsBean;
+import org.apache.webbeans.jms.util.JmsProxyHandler;
+import org.apache.webbeans.jms.util.JmsUtil;
+import org.apache.webbeans.spi.plugins.AbstractOwbPlugin;
+
+/**
+ * JMS Plugin for JMS related components.
+ *
+ * @version $Rev$ $Date$
+ */
+public class OpenWebBeansJmsPlugin extends AbstractOwbPlugin implements org.apache.webbeans.plugins.OpenWebBeansJmsPlugin
+{
+ private WebBeansContext webBeansContext;
+
+ public OpenWebBeansJmsPlugin(WebBeansContext webBeansContext)
+ {
+ super();
+ this.webBeansContext = webBeansContext;
+ }
+
+ @Override
+ public Bean<?> getJmsBean(JMSModel model)
+ {
+ JmsBean<?> bean = JmsComponentFactory.getJmsComponentFactory().getJmsComponent(webBeansContext, model);
+
+ return bean;
+
+ }
+
+ @Override
+ public void shutDown() throws WebBeansConfigurationException
+ {
+ JmsProxyHandler.clearConnections();
+ }
+
+ @Override
+ public Object getJmsBeanProxy(Bean<?> bean, Class<?> iface)
+ {
+ Object proxy = JmsUtil.createNewJmsProxy((JmsBean<?>) bean, iface);
+
+ return proxy;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/Closable.java b/owb_1.2.x/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/Closable.java
new file mode 100644
index 0000000..1e54f4b
--- /dev/null
+++ b/owb_1.2.x/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/Closable.java
@@ -0,0 +1,25 @@
+/*
+ * 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.webbeans.jms.util;
+
+public interface Closable
+{
+ public void closeJMSObject();
+
+}
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsProxyHandler.java b/owb_1.2.x/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsProxyHandler.java
new file mode 100644
index 0000000..c5afc96
--- /dev/null
+++ b/owb_1.2.x/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsProxyHandler.java
@@ -0,0 +1,341 @@
+/*
+ * 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.webbeans.jms.util;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.Session;
+import javax.jms.TopicConnection;
+import javax.jms.TopicConnectionFactory;
+
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.jms.JMSModel;
+import org.apache.webbeans.jms.JMSModel.JMSType;
+import org.apache.webbeans.jms.component.JmsBean;
+import org.apache.webbeans.util.ClassUtil;
+
+
+public class JmsProxyHandler implements InvocationHandler
+{
+ private JmsBean<?> jmsComponent = null;
+
+ private static volatile ConnectionFactory connectionFactory = null;
+
+ private AtomicBoolean cfSet = new AtomicBoolean(false);
+
+ private static Map<JMSType, Connection> connections = new ConcurrentHashMap<JMSType, Connection>();
+
+ private static Map<String, Destination> dests = new ConcurrentHashMap<String, Destination>();
+
+ private Object jmsObject = null;
+
+ private Class<?> injectionClazz = null;
+
+ public JmsProxyHandler(JmsBean<?> jmsComponent, Class<?> injectionClazz)
+ {
+ this.jmsComponent = jmsComponent;
+ this.injectionClazz = injectionClazz;
+ }
+
+ public Object invoke(Object instance, Method method, Method proceed, Object[] arguments) throws Throwable
+ {
+ return invoke(instance, method, arguments);
+ }
+
+ @Override
+ public Object invoke(Object instance, Method method, Object[] arguments) throws Throwable
+ {
+ if(method.getName().equals("closeJMSObject"))
+ {
+ close();
+
+ return null;
+ }
+
+ if (!ClassUtil.isObjectMethod(method.getName()))
+ {
+ Object cf = null;
+
+ if (this.jmsObject == null)
+ {
+ Class<?> jmsClazz = this.injectionClazz;
+
+ if (cf == null && Connection.class.isAssignableFrom(jmsClazz))
+ {
+ cf = createOrReturnQueueOrTopicConnection();
+ }
+
+ if (cf == null && Destination.class.isAssignableFrom(jmsClazz))
+ {
+ cf = createOrReturnQueueOrTopic();
+
+ }
+
+ if (cf == null && Session.class.isAssignableFrom(jmsClazz))
+ {
+ cf = createSession();
+ }
+
+ if (cf == null && MessageProducer.class.isAssignableFrom(jmsClazz))
+ {
+ cf = createMessageProducers();
+ }
+
+ if (cf == null && MessageConsumer.class.isAssignableFrom(jmsClazz))
+ {
+ cf = createMessageConsumers();
+ }
+
+ if (method.getName().equals("close"))
+ {
+ throw new UnsupportedOperationException("close method is not supported for JMS resources");
+ }
+
+ if (cf == null)
+ {
+ throw new WebBeansException("JMS Resource type is not correct!. Does not create JMS resource object to handle request");
+ }
+
+ this.jmsObject = cf;
+ }
+ else
+ {
+ cf = this.jmsObject;
+ }
+
+ return method.invoke(cf, arguments);
+ }
+ else
+ {
+ return method.invoke(instance, arguments);
+ }
+ }
+
+ private Object createOrReturnConnectionFactory()
+ {
+ if (connectionFactory != null)
+ {
+ return connectionFactory;
+ }
+ else
+ {
+ if (cfSet.compareAndSet(false, true))
+ {
+ connectionFactory = JmsUtil.getConnectionFactory();
+
+ return connectionFactory;
+ }
+ }
+
+ return null;
+ }
+
+ private Session createSession()
+ {
+ Connection connection = null;
+ try
+ {
+
+ connection = createOrReturnQueueOrTopicConnection();
+
+ return connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ }
+ catch (JMSException e)
+ {
+ ensureConnectionClosing(connection);
+ throw new WebBeansException("Unable to create jms session", e);
+ }
+
+ }
+
+ private void ensureConnectionClosing(Connection connection)
+ {
+ if (connection != null)
+ {
+ try
+ {
+ connection.close();
+ }
+ catch (JMSException jmse)
+ {
+ // do nothing, we are already throwing up anyway...
+ }
+ }
+ }
+
+ private MessageProducer createMessageProducers()
+ {
+ Connection connection = null;
+ try
+ {
+ connection = createOrReturnQueueOrTopicConnection();
+
+ return connection.createSession(false, Session.AUTO_ACKNOWLEDGE).createProducer(createOrReturnQueueOrTopic());
+ }
+ catch (JMSException e)
+ {
+ ensureConnectionClosing(connection);
+ throw new WebBeansException("Unable to create jms message producer", e);
+ }
+
+ }
+
+ private MessageConsumer createMessageConsumers()
+ {
+ Connection connection = null;
+ try
+ {
+ connection = createOrReturnQueueOrTopicConnection();
+
+ return connection.createSession(false, Session.AUTO_ACKNOWLEDGE).createConsumer(createOrReturnQueueOrTopic());
+ }
+ catch (JMSException e)
+ {
+ ensureConnectionClosing(connection);
+ throw new WebBeansException("Unable to create jms message producer", e);
+ }
+
+ }
+
+ private Connection createOrReturnQueueOrTopicConnection()
+ {
+ JMSModel jmsModel = this.jmsComponent.getJmsModel();
+
+ try
+ {
+ if (jmsModel.getJmsType().equals(JMSType.QUEUE))
+ {
+ if (connections.containsKey(JMSType.QUEUE))
+ {
+ return connections.get(JMSType.QUEUE);
+ }
+ else
+ {
+ QueueConnectionFactory ccf = (QueueConnectionFactory) createOrReturnConnectionFactory();
+ QueueConnection qc = ccf.createQueueConnection();
+ connections.put(JMSType.QUEUE, qc);
+
+ return qc;
+ }
+ }
+ else if (jmsModel.getJmsType().equals(JMSType.TOPIC))
+ {
+ if (connections.containsKey(JMSType.TOPIC))
+ {
+ return connections.get(JMSType.TOPIC);
+ }
+ else
+ {
+ TopicConnectionFactory ccf = (TopicConnectionFactory) createOrReturnConnectionFactory();
+ TopicConnection qc = ccf.createTopicConnection();
+ connections.put(JMSType.TOPIC, qc);
+
+ return qc;
+ }
+
+ }
+
+ }
+ catch (JMSException e)
+ {
+ throw new WebBeansException("Unable to create jms connection", e);
+ }
+
+ return null;
+ }
+
+ private void close()
+ {
+ try
+ {
+ if(this.jmsObject != null)
+ {
+ Method method = this.jmsObject.getClass().getMethod("close", new Class[]{});
+
+ if(!method.isAccessible())
+ {
+ jmsComponent.getWebBeansContext().getSecurityService().doPrivilegedSetAccessible(method, true);
+ }
+
+ method.invoke(this.jmsObject, new Object[]{});
+ }
+
+ }
+ catch (Exception e)
+ {
+ throw new WebBeansException("Unable to close JMS resources");
+ }
+
+ }
+
+ private Destination createOrReturnQueueOrTopic()
+ {
+ JMSModel jmsModel = this.jmsComponent.getJmsModel();
+ String jndiName = jmsModel.isJndiNameDefined() ? jmsModel.getJndiName() : jmsModel.getMappedName();
+
+ if (dests.get(jndiName) != null)
+ {
+ return dests.get(jndiName);
+ }
+
+ Destination res = (Destination) JmsUtil.getInstanceFromJndi(this.jmsComponent.getJmsModel(), this.injectionClazz);
+
+ dests.put(jndiName, res);
+
+ return res;
+
+ }
+
+ public static void clearConnections()
+ {
+ try
+ {
+ connectionFactory = null;
+
+ for (Connection connection : connections.values())
+ {
+ connection.close();
+ }
+
+ connections = null;
+
+ dests.clear();
+ dests = null;
+
+ }
+ catch (Exception e)
+ {
+ throw new WebBeansException(e);
+ }
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsUtil.java b/owb_1.2.x/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsUtil.java
new file mode 100644
index 0000000..a35135a
--- /dev/null
+++ b/owb_1.2.x/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsUtil.java
@@ -0,0 +1,181 @@
+/*
+ * 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.webbeans.jms.util;
+
+import java.io.Serializable;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueReceiver;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.jms.Topic;
+import javax.jms.TopicConnection;
+import javax.jms.TopicConnectionFactory;
+import javax.jms.TopicPublisher;
+import javax.jms.TopicSession;
+import javax.jms.TopicSubscriber;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansCreationException;
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.jms.JMSModel;
+import org.apache.webbeans.jms.component.JmsBean;
+import org.apache.webbeans.spi.JNDIService;
+import org.apache.webbeans.util.Asserts;
+
+public final class JmsUtil
+{
+ private JmsUtil()
+ {
+
+ }
+
+ public static boolean isJmsResourceClass(Class<?> clazz)
+ {
+ Asserts.assertNotNull(clazz,"clazz parameter can not be null");
+
+ if(ConnectionFactory.class.isAssignableFrom(clazz) ||
+ Connection.class.isAssignableFrom(clazz) ||
+ Queue.class.isAssignableFrom(clazz) ||
+ Topic.class.isAssignableFrom(clazz) ||
+ MessageProducer.class.isAssignableFrom(clazz) ||
+ MessageConsumer.class.isAssignableFrom(clazz) ||
+ Session.class.isAssignableFrom(clazz))
+ {
+ return true;
+ }
+
+ return false;
+
+ }
+
+ public static boolean isJmsQueueTypeResource(Class<?> clazz)
+ {
+ if(QueueConnectionFactory.class.isAssignableFrom(clazz) ||
+ QueueConnection.class.isAssignableFrom(clazz) ||
+ QueueSender.class.isAssignableFrom(clazz) ||
+ QueueReceiver.class.isAssignableFrom(clazz) ||
+ QueueSession.class.isAssignableFrom(clazz))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ public static boolean isJmsQueueResource(Class<?> clazz)
+ {
+ if(Queue.class.isAssignableFrom(clazz))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ public static boolean isJmsTopicResource(Class<?> clazz)
+ {
+ if(Topic.class.isAssignableFrom(clazz))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+
+ public static boolean isJmsTopicTypeResource(Class<?> clazz)
+ {
+ if(TopicConnectionFactory.class.isAssignableFrom(clazz) ||
+ TopicConnection.class.isAssignableFrom(clazz) ||
+ TopicSubscriber.class.isAssignableFrom(clazz) ||
+ TopicPublisher.class.isAssignableFrom(clazz) ||
+ TopicSession.class.isAssignableFrom(clazz))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ private static JNDIService getJNDIService()
+ {
+ JNDIService jndiService = WebBeansContext.getInstance().getService(JNDIService.class);
+
+ if(jndiService == null)
+ {
+ throw new WebBeansCreationException("JNDI service is not available");
+ }
+
+ return jndiService;
+ }
+
+ public static ConnectionFactory getConnectionFactory()
+ {
+ String connectionFactoryJndiName = WebBeansContext.getInstance().getOpenWebBeansConfiguration().getProperty(JNDIService.JMS_CONNECTION_FACTORY_JNDI_KEY);
+
+ if(connectionFactoryJndiName == null || connectionFactoryJndiName.equals(""))
+ {
+ connectionFactoryJndiName = JNDIService.JMS_CONNECTION_FACTORY_JNDI_DEFAULT_VALUE;
+ }
+
+ return getJNDIService().lookup(connectionFactoryJndiName, ConnectionFactory.class);
+ }
+
+ public static <T> T getInstanceFromJndi(JMSModel jmsModel, Class<T> jmsClass)
+ {
+ String jndiName = jmsModel.isJndiNameDefined() ? jmsModel.getJndiName() : jmsModel.getMappedName();
+
+
+ T instance = getJNDIService().lookup(jndiName, jmsClass);
+
+ return instance;
+
+ }
+
+ /**
+ * Gets jms related object.
+ * @param jmsComponent jms bean
+ * @param intf injection point class
+ * @return proxy object
+ */
+ public static Object createNewJmsProxy(JmsBean<?> jmsComponent, Class<?> intf)
+ {
+ try
+ {
+ final Class<?>[] interfaces = {Closable.class, Serializable.class, intf};
+
+ //X TODO do we still need this?
+ throw new WebBeansException("Support got temporarily removed while moving from Javassist to ASM");
+
+ }
+ catch (Exception e)
+ {
+ throw new WebBeansException(e);
+ }
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-jms/src/main/resources/META-INF/openwebbeans/openwebbeans.properties b/owb_1.2.x/webbeans-jms/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
new file mode 100644
index 0000000..a9de6f4
--- /dev/null
+++ b/owb_1.2.x/webbeans-jms/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
@@ -0,0 +1,30 @@
+#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.
+#---------------------------------------------------------------
+# The default configuration for OpenWebBeans
+#
+# The default configuration is intended for a JDK and a simple ServletContainer
+# like jetty, resin or tomcat.
+#
+#---------------------------------------------------------------
+
+configuration.ordinal=16
+
+#################################### JMS ConnectionFactory JNDI Name ###########################
+# JMS ConnectionFactory instance global jndi name.
+org.apache.webbeans.spi.JNDIService.jmsConnectionFactoryJndi=ConnectionFactory
+################################################################################################
diff --git a/owb_1.2.x/webbeans-jms/src/main/resources/META-INF/services/org.apache.webbeans.spi.plugins.OpenWebBeansPlugin b/owb_1.2.x/webbeans-jms/src/main/resources/META-INF/services/org.apache.webbeans.spi.plugins.OpenWebBeansPlugin
new file mode 100644
index 0000000..7f76c89
--- /dev/null
+++ b/owb_1.2.x/webbeans-jms/src/main/resources/META-INF/services/org.apache.webbeans.spi.plugins.OpenWebBeansPlugin
@@ -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.
+
+# this file contains the service implementation for the
+# JMS integration into OpenWebBeans
+# this file contains information for java.util.ServiceLoader
+org.apache.webbeans.jms.plugin.OpenWebBeansJmsPlugin
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-jms/src/site/site.xml b/owb_1.2.x/webbeans-jms/src/site/site.xml
new file mode 100644
index 0000000..ecf618c
--- /dev/null
+++ b/owb_1.2.x/webbeans-jms/src/site/site.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<project name="OpenWebBeans">
+ <bannerLeft>
+ <name>Apache OpenWebBeans</name>
+ <src>http://openwebbeans.apache.org/owb/images/logos/openwebbeans_hor.png</src>
+ <href>http://openwebbeans.apache.org</href>
+ </bannerLeft>
+
+ <bannerRight>
+ <name>Apache Banner</name>
+ <src>http://www.apache.org/images/asf-logo.gif</src>
+ <href>http://www.apache.org</href>
+ </bannerRight>
+
+ <publishDate format="dd MMM yyyy" />
+ <version position="left"/>
+
+ <body>
+ <breadcrumbs>
+ <item name="Apache" href="http://www.apache.org"/>
+ <item name="OpenWebBeans" href="http://openwebbeans.apache.org"/>
+ <item name="OWB-JMS" href="http://openwebbeans.apache.org/${project.version}/openwebbeans-jms"/>
+ </breadcrumbs>
+
+ <menu ref="reports"/>
+ </body>
+</project>
+
diff --git a/owb_1.2.x/webbeans-jsf/pom.xml b/owb_1.2.x/webbeans-jsf/pom.xml
new file mode 100644
index 0000000..f128160
--- /dev/null
+++ b/owb_1.2.x/webbeans-jsf/pom.xml
@@ -0,0 +1,114 @@
+<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">
+<!--
+
+ 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.
+-->
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>1.2.5</version>
+ </parent>
+
+ <artifactId>openwebbeans-jsf</artifactId>
+ <name>JSF-2 plugin</name>
+ <description>Apache OpenWebBeans JSF integration</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-el_2.2_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_2.5_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>2.1.0</version>
+ <executions>
+ <execution>
+ <id>bundle-manifest</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>manifest</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <supportedProjectTypes>
+ <supportedProjectType>jar</supportedProjectType>
+ <supportedProjectType>bundle</supportedProjectType>
+ <supportedProjectType>war</supportedProjectType>
+ </supportedProjectTypes>
+ <instructions>
+ <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+ <Bundle-Version>${project.version}</Bundle-Version>
+ <Export-Package>!org.apache.webbeans.internal.*,org.apache.webbeans.*;version="${project.version}"</Export-Package>
+ <Private-Package>org.apache.webbeans.internal.*</Private-Package>
+ <Import-Package>
+ *
+ </Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+</project>
diff --git a/owb_1.2.x/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/ConversationAwareViewHandler.java b/owb_1.2.x/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/ConversationAwareViewHandler.java
new file mode 100644
index 0000000..9912db7
--- /dev/null
+++ b/owb_1.2.x/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/ConversationAwareViewHandler.java
@@ -0,0 +1,117 @@
+/*
+ * 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.webbeans.jsf;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.context.Conversation;
+import javax.faces.application.ViewHandler;
+import javax.faces.application.ViewHandlerWrapper;
+import javax.faces.context.FacesContext;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.conversation.ConversationManager;
+
+public class ConversationAwareViewHandler extends ViewHandlerWrapper
+{
+ private final ViewHandler delegate;
+
+ private Boolean owbApplication = null;
+
+ public ConversationAwareViewHandler(ViewHandler delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getActionURL(FacesContext context, String viewId)
+ {
+ if(!isOwbApplication())
+ {
+ return delegate.getActionURL(context, viewId);
+ }
+
+ String url = delegate.getActionURL(context, viewId);
+
+ ConversationManager conversationManager = WebBeansContext.getInstance().getConversationManager();
+ Conversation conversation = conversationManager.getConversationBeanReference();
+ if (conversation != null && !conversation.isTransient())
+ {
+ url = JSFUtil.getRedirectViewIdWithCid(url, conversation.getId());
+ }
+
+ return url;
+ }
+
+ private boolean isOwbApplication()
+ {
+ if (owbApplication == null)
+ {
+ owbApplication = Boolean.valueOf(WebBeansContext.getInstance().getBeanManagerImpl().isInUse());
+ }
+
+ return owbApplication.booleanValue();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getRedirectURL(FacesContext context, String viewId,
+ Map<String, List<String>> parameters, boolean includeViewParams)
+ {
+
+ if(!isOwbApplication())
+ {
+ return delegate.getRedirectURL(context, viewId, parameters, includeViewParams);
+ }
+
+ String url = delegate.getRedirectURL(context, viewId, parameters, includeViewParams);
+ int indexOfQuery = url.indexOf('?');
+ if (indexOfQuery > 0)
+ {
+ String queryString = url.substring(indexOfQuery);
+ // If the query string already has a cid parameter, return url directly.
+ if (queryString.contains("?cid=") || queryString.contains("&cid="))
+ {
+ return url;
+ }
+ }
+ ConversationManager conversationManager = WebBeansContext.getInstance().getConversationManager();
+ Conversation conversation = conversationManager.getConversationBeanReference();
+ if (conversation != null && !conversation.isTransient())
+ {
+ url = JSFUtil.getRedirectViewIdWithCid(url, conversation.getId());
+ }
+ return url;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ViewHandler getWrapped()
+ {
+ return delegate;
+ }
+}
diff --git a/owb_1.2.x/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/DefaultConversationService.java b/owb_1.2.x/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/DefaultConversationService.java
new file mode 100644
index 0000000..7d142cb
--- /dev/null
+++ b/owb_1.2.x/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/DefaultConversationService.java
@@ -0,0 +1,46 @@
+/*
+ * 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.webbeans.jsf;
+
+import javax.servlet.http.HttpSession;
+
+import org.apache.webbeans.spi.ConversationService;
+
+public class DefaultConversationService implements ConversationService
+{
+
+ @Override
+ public String getConversationId()
+ {
+ return JSFUtil.getConversationId();
+ }
+
+ @Override
+ public String getConversationSessionId()
+ {
+ HttpSession session = JSFUtil.getSession();
+ if(session != null)
+ {
+ return session.getId();
+ }
+
+ return null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/JSFUtil.java b/owb_1.2.x/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/JSFUtil.java
new file mode 100644
index 0000000..8c8f32d
--- /dev/null
+++ b/owb_1.2.x/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/JSFUtil.java
@@ -0,0 +1,145 @@
+/*
+ * 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.webbeans.jsf;
+
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpSession;
+
+import org.apache.webbeans.util.Asserts;
+
+
+public final class JSFUtil
+{
+ private JSFUtil()
+ {
+
+ }
+
+ public static FacesContext getCurrentFacesContext()
+ {
+ return FacesContext.getCurrentInstance();
+ }
+
+ public static ExternalContext getExternalContext()
+ {
+ FacesContext context = getCurrentFacesContext();
+
+ if(context != null)
+ {
+ return context.getExternalContext();
+ }
+
+ return null;
+ }
+
+ public static HttpSession getSession()
+ {
+ ExternalContext externalContext = getExternalContext();
+
+ if(externalContext != null)
+ {
+ return (HttpSession) externalContext.getSession(true);
+ }
+
+ return null;
+ }
+
+ public static String getRedirectViewIdWithCid(String redirectId, String cid)
+ {
+ Asserts.assertNotNull(redirectId, "redirectId parameter can not be null");
+
+ StringBuilder buffer = new StringBuilder(redirectId);
+ int index = buffer.lastIndexOf("/");
+
+ String remainder = buffer.substring(index+1, buffer.length());
+ int indexOfQuery = remainder.indexOf('?');
+
+ StringBuilder result = new StringBuilder();
+ if(indexOfQuery != -1)
+ {
+ result.append(buffer.substring(0,index+1));
+ result.append(remainder.substring(0,indexOfQuery+1));
+ result.append("cid");
+ result.append("=");
+ result.append(cid);
+ result.append("&");
+ result.append(remainder.substring(indexOfQuery+1, remainder.length()));
+ }
+ else
+ {
+ int pathIndex = remainder.indexOf("#");
+
+ if(pathIndex == -1)
+ {
+ result.append(buffer.substring(0,index+1));
+ result.append(remainder);
+ result.append("?");
+ result.append("cid");
+ result.append("=");
+ result.append(cid);
+ }
+ else
+ {
+ result.append(buffer.substring(0,index+1));
+ result.append(remainder.substring(0,pathIndex));
+ result.append("?");
+ result.append("cid");
+ result.append("=");
+ result.append(cid);
+ result.append(remainder.substring(pathIndex,remainder.length()));
+ }
+ }
+
+
+ return result.toString();
+
+ }
+
+ public static UIViewRoot getViewRoot()
+ {
+ FacesContext context = getCurrentFacesContext();
+
+ if(context != null)
+ {
+ return context.getViewRoot();
+ }
+
+ return null;
+ }
+
+
+ public static String getJSFRequestParameter(String parameterName)
+ {
+ ExternalContext ec = getExternalContext();
+ if(ec != null)
+ {
+ return ec.getRequestParameterMap().get(parameterName);
+ }
+
+ return null;
+ }
+
+ public static String getConversationId()
+ {
+ return getJSFRequestParameter("cid");
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/OwbApplication.java b/owb_1.2.x/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/OwbApplication.java
new file mode 100644
index 0000000..a5b5d2a
--- /dev/null
+++ b/owb_1.2.x/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/OwbApplication.java
@@ -0,0 +1,60 @@
+/*
+ * 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.webbeans.jsf;
+
+import javax.el.ExpressionFactory;
+import javax.faces.application.Application;
+import javax.faces.application.ApplicationWrapper;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+public class OwbApplication extends ApplicationWrapper
+{
+ private Application wrappedApplication;
+
+ private volatile ExpressionFactory expressionFactory;
+
+ public OwbApplication(Application wrappedApplication)
+ {
+ this.wrappedApplication = wrappedApplication;
+ }
+
+
+ /* (non-Javadoc)
+ * @see javax.faces.application.Application#getExpressionFactory()
+ */
+ @Override
+ public ExpressionFactory getExpressionFactory()
+ {
+ if(expressionFactory == null)
+ {
+ expressionFactory = wrappedApplication.getExpressionFactory();
+ expressionFactory = WebBeansContext.getInstance().getBeanManagerImpl().wrapExpressionFactory(expressionFactory);
+ }
+
+ return expressionFactory;
+ }
+
+
+ @Override
+ public Application getWrapped()
+ {
+ return wrappedApplication;
+ }
+}
diff --git a/owb_1.2.x/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/OwbApplicationFactory.java b/owb_1.2.x/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/OwbApplicationFactory.java
new file mode 100644
index 0000000..9590001
--- /dev/null
+++ b/owb_1.2.x/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/OwbApplicationFactory.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.jsf;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+import javax.faces.application.Application;
+import javax.faces.application.ApplicationFactory;
+
+public class OwbApplicationFactory extends ApplicationFactory
+{
+ private ApplicationFactory wrapped;
+
+ private volatile Application wrappedApplication;
+
+ private WebBeansContext webBeansContext;
+
+ public OwbApplicationFactory(ApplicationFactory applicationFactory)
+ {
+ wrapped = applicationFactory;
+ webBeansContext = WebBeansContext.currentInstance();
+ }
+
+ @Override
+ public Application getApplication()
+ {
+ if(!webBeansContext.getBeanManagerImpl().isInUse())
+ {
+ return wrapped.getApplication();
+ }
+
+ if(wrappedApplication == null)
+ {
+ wrappedApplication = new OwbApplication(wrapped.getApplication());
+ }
+
+ return wrappedApplication;
+ }
+
+ @Override
+ public void setApplication(Application application)
+ {
+ if(!webBeansContext.getBeanManagerImpl().isInUse())
+ {
+ wrappedApplication = new OwbApplication(application);
+ }
+
+ wrapped.setApplication(application);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.application.ApplicationFactory#getWrapped()
+ */
+ @Override
+ public ApplicationFactory getWrapped()
+ {
+ return wrapped;
+ }
+
+
+
+}
diff --git a/owb_1.2.x/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/WebBeansPhaseListener.java b/owb_1.2.x/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/WebBeansPhaseListener.java
new file mode 100644
index 0000000..106a95e
--- /dev/null
+++ b/owb_1.2.x/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/WebBeansPhaseListener.java
@@ -0,0 +1,162 @@
+/*
+ * 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.webbeans.jsf;
+
+import javax.enterprise.context.BusyConversationException;
+import javax.enterprise.context.Conversation;
+import javax.enterprise.context.NonexistentConversationException;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.context.ConversationContext;
+import org.apache.webbeans.conversation.ConversationImpl;
+import org.apache.webbeans.conversation.ConversationManager;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Conversation related phase listener.
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public class WebBeansPhaseListener implements PhaseListener
+{
+ private static final long serialVersionUID = 1L;
+
+ /**Logger instance*/
+ private final static Logger logger = WebBeansLoggerFacade.getLogger(WebBeansPhaseListener.class);
+
+ private Boolean owbApplication = null;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void afterPhase(PhaseEvent phaseEvent)
+ {
+ if (phaseEvent.getPhaseId().equals(PhaseId.RENDER_RESPONSE) ||
+ phaseEvent.getFacesContext().getResponseComplete())
+ {
+ if(!isOwbApplication())
+ {
+ return;
+ }
+
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ ConversationManager conversationManager = webBeansContext.getConversationManager();
+ Conversation conversation = conversationManager.getConversationBeanReference();
+
+ if (conversation.isTransient())
+ {
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.log(Level.FINE, "Destroying the conversation context with cid : [{0}]", conversation.getId());
+ }
+ ContextFactory contextFactory = webBeansContext.getContextFactory();
+ contextFactory.destroyConversationContext();
+ }
+ else
+ {
+ //Conversation must be used by one thread at a time
+ ConversationImpl owbConversation = (ConversationImpl)conversation;
+ owbConversation.updateTimeOut();
+ //Other threads can now access propogated conversation.
+ owbConversation.setInUsed(false);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void beforePhase(PhaseEvent phaseEvent)
+ {
+ if (phaseEvent.getPhaseId().equals(PhaseId.RESTORE_VIEW) && isOwbApplication())
+ {
+ //It looks for cid parameter in the JSF request.
+ //If request contains cid, then it must restore conversation
+ //Otherwise create NonexistentException
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ ConversationManager conversationManager = webBeansContext.getConversationManager();
+ Conversation conversation = conversationManager.getConversationBeanReference();
+ String cid = JSFUtil.getConversationId();
+ ContextFactory contextFactory = webBeansContext.getContextFactory();
+
+ if (conversation.isTransient())
+ {
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.log(Level.FINE, "Creating a new transitional conversation with cid : [{0}]", conversation.getId());
+ }
+ contextFactory.initConversationContext(null);
+
+ //Not restore, throw exception
+ if(cid != null && !cid.equals(""))
+ {
+ throw new NonexistentConversationException("Propogated conversation with cid=" + cid + " is not restored. It creates a new transient conversation.");
+ }
+ }
+ else
+ {
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.log(Level.FINE, "Restoring conversation with cid : [{0}]", conversation.getId());
+ }
+
+ //Conversation must be used by one thread at a time
+ ConversationImpl owbConversation = (ConversationImpl)conversation;
+ if(!owbConversation.getInUsed().compareAndSet(false, true))
+ {
+ contextFactory.initConversationContext(null);
+ //Throw Busy exception
+ throw new BusyConversationException("Propogated conversation with cid=" + cid + " is used by other request. It creates a new transient conversation");
+ }
+ else
+ {
+ ConversationContext conversationContext = conversationManager.getConversationContext(conversation);
+ contextFactory.initConversationContext(conversationContext);
+ }
+ }
+ }
+ }
+
+ @Override
+ public PhaseId getPhaseId()
+ {
+ return PhaseId.ANY_PHASE;
+ }
+
+ private boolean isOwbApplication()
+ {
+ if (owbApplication == null)
+ {
+ owbApplication = Boolean.valueOf(WebBeansContext.getInstance().getBeanManagerImpl().isInUse());
+ }
+
+ return owbApplication.booleanValue();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/plugin/OpenWebBeansJsfPlugin.java b/owb_1.2.x/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/plugin/OpenWebBeansJsfPlugin.java
new file mode 100644
index 0000000..d0f3c7d
--- /dev/null
+++ b/owb_1.2.x/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/plugin/OpenWebBeansJsfPlugin.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.jsf.plugin;
+
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.spi.plugins.AbstractOwbPlugin;
+
+public class OpenWebBeansJsfPlugin extends AbstractOwbPlugin
+{
+ /** {@inheritDoc} */
+ @Override
+ public void isManagedBean( Class<?> clazz ) throws WebBeansConfigurationException
+ {
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-jsf/src/main/resources/META-INF/faces-config.xml b/owb_1.2.x/webbeans-jsf/src/main/resources/META-INF/faces-config.xml
new file mode 100644
index 0000000..726df7a
--- /dev/null
+++ b/owb_1.2.x/webbeans-jsf/src/main/resources/META-INF/faces-config.xml
@@ -0,0 +1,39 @@
+<?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.
+-->
+<faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">
+
+ <name>org_apache_openwebbeans</name>
+
+ <factory>
+ <application-factory>org.apache.webbeans.jsf.OwbApplicationFactory</application-factory>
+ </factory>
+
+ <application>
+ <view-handler>org.apache.webbeans.jsf.ConversationAwareViewHandler</view-handler>
+ </application>
+
+ <lifecycle>
+ <phase-listener>org.apache.webbeans.jsf.WebBeansPhaseListener</phase-listener>
+ </lifecycle>
+
+</faces-config>
diff --git a/owb_1.2.x/webbeans-jsf/src/main/resources/META-INF/openwebbeans/openwebbeans.properties b/owb_1.2.x/webbeans-jsf/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
new file mode 100644
index 0000000..410a0ca
--- /dev/null
+++ b/owb_1.2.x/webbeans-jsf/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
@@ -0,0 +1,39 @@
+#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.
+#---------------------------------------------------------------
+# The default configuration for OpenWebBeans
+#
+# The default configuration is intended for a JDK and a simple ServletContainer
+# like jetty, resin or tomcat.
+#
+#---------------------------------------------------------------
+
+configuration.ordinal=12
+
+#################################### Conversation Context Removal Thread Delay##################
+#Converation contexts are removed when idle timeout > timeout. Default timeout is 30 mins.
+org.apache.webbeans.conversation.Conversation.periodicDelay=1800000
+################################################################################################
+
+################################### Default Conversation Service ###############################
+#Default implementation of org.apache.webbeans.corespi.ConversationService.
+org.apache.webbeans.spi.ConversationService=org.apache.webbeans.jsf.DefaultConversationService
+################################################################################################
+
+################################# Conversation Support #########################################
+org.apache.webbeans.application.supportsConversation=true
+################################################################################################
diff --git a/owb_1.2.x/webbeans-jsf/src/main/resources/META-INF/services/org.apache.webbeans.spi.plugins.OpenWebBeansPlugin b/owb_1.2.x/webbeans-jsf/src/main/resources/META-INF/services/org.apache.webbeans.spi.plugins.OpenWebBeansPlugin
new file mode 100644
index 0000000..f8a005f
--- /dev/null
+++ b/owb_1.2.x/webbeans-jsf/src/main/resources/META-INF/services/org.apache.webbeans.spi.plugins.OpenWebBeansPlugin
@@ -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.
+
+# this file contains the service implementation for the
+# JSF integration into OpenWebBeans
+# this file contains information for java.util.ServiceLoader
+org.apache.webbeans.jsf.plugin.OpenWebBeansJsfPlugin
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-jsf/src/site/site.xml b/owb_1.2.x/webbeans-jsf/src/site/site.xml
new file mode 100644
index 0000000..45258b4
--- /dev/null
+++ b/owb_1.2.x/webbeans-jsf/src/site/site.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<project name="OpenWebBeans">
+ <bannerLeft>
+ <name>Apache OpenWebBeans</name>
+ <src>http://openwebbeans.apache.org/owb/images/logos/openwebbeans_hor.png</src>
+ <href>http://openwebbeans.apache.org</href>
+ </bannerLeft>
+
+ <bannerRight>
+ <name>Apache Banner</name>
+ <src>http://www.apache.org/images/asf-logo.gif</src>
+ <href>http://www.apache.org</href>
+ </bannerRight>
+
+ <publishDate format="dd MMM yyyy" />
+ <version position="left"/>
+
+ <body>
+ <breadcrumbs>
+ <item name="Apache" href="http://www.apache.org"/>
+ <item name="OpenWebBeans" href="http://openwebbeans.apache.org"/>
+ <item name="OWB-JSF-2" href="http://openwebbeans.apache.org/${project.version}/openwebbeans-jsf"/>
+ </breadcrumbs>
+
+ <menu ref="reports"/>
+ </body>
+</project>
+
diff --git a/owb_1.2.x/webbeans-jsf/src/test/java/org/apache/webbeans/jsf/test/JSFUtilTest.java b/owb_1.2.x/webbeans-jsf/src/test/java/org/apache/webbeans/jsf/test/JSFUtilTest.java
new file mode 100644
index 0000000..20445cf
--- /dev/null
+++ b/owb_1.2.x/webbeans-jsf/src/test/java/org/apache/webbeans/jsf/test/JSFUtilTest.java
@@ -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.webbeans.jsf.test;
+
+import org.apache.webbeans.jsf.JSFUtil;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+import org.junit.Test;
+
+public class JSFUtilTest extends TestCase
+{
+ @Test
+ public void testCidUrlUpdate()
+ {
+ String withQuery = "/context/file.get?name=hipo";
+ String withQueryWithPath = "/context/file.get?name=hipo#same";
+ String withoutQuery = "/context/file.get";
+ String withoutQueryWithPath="/context/file.get#same";
+ String withContext = "/context";
+ String withContextWithPath = "/context#same";
+ String withQueryWithContext = "/context?hiho=hi";
+ String withQueryWithContextWithPath="/context?hiho=hi#same";
+
+ String cid = "1";
+
+ String path = JSFUtil.getRedirectViewIdWithCid(withQuery, cid);
+ Assert.assertEquals("/context/file.get?cid=1&name=hipo", path);
+
+ path = JSFUtil.getRedirectViewIdWithCid(withQueryWithPath, cid);
+ Assert.assertEquals("/context/file.get?cid=1&name=hipo#same", path);
+
+ path = JSFUtil.getRedirectViewIdWithCid(withoutQuery, cid);
+ Assert.assertEquals("/context/file.get?cid=1", path);
+
+ path = JSFUtil.getRedirectViewIdWithCid(withoutQueryWithPath, cid);
+ Assert.assertEquals("/context/file.get?cid=1#same", path);
+
+ path = JSFUtil.getRedirectViewIdWithCid(withContext, cid);
+ Assert.assertEquals("/context?cid=1", path);
+
+ path = JSFUtil.getRedirectViewIdWithCid(withContextWithPath, cid);
+ Assert.assertEquals("/context?cid=1#same", path);
+
+ path = JSFUtil.getRedirectViewIdWithCid(withQueryWithContext, cid);
+ Assert.assertEquals("/context?cid=1&hiho=hi", path);
+
+ path = JSFUtil.getRedirectViewIdWithCid(withQueryWithContextWithPath, cid);
+ Assert.assertEquals("/context?cid=1&hiho=hi#same", path);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-jsf12/pom.xml b/owb_1.2.x/webbeans-jsf12/pom.xml
new file mode 100644
index 0000000..980ce9c
--- /dev/null
+++ b/owb_1.2.x/webbeans-jsf12/pom.xml
@@ -0,0 +1,82 @@
+<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">
+<!--
+
+ 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.
+-->
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>1.2.5</version>
+ </parent>
+
+ <artifactId>openwebbeans-jsf12</artifactId>
+ <name>JSF 1.2 plugin</name>
+ <description>Apache OpenWebBeans JSF 1.2 integration</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-el10</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>1.2.8</version>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-el_1.0_spec</artifactId>
+ <version>1.0.2</version>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_2.5_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/owb_1.2.x/webbeans-jsf12/src/main/java/META-INF/MANIFEST.MF b/owb_1.2.x/webbeans-jsf12/src/main/java/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..254272e
--- /dev/null
+++ b/owb_1.2.x/webbeans-jsf12/src/main/java/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
diff --git a/owb_1.2.x/webbeans-jsf12/src/main/java/org/apache/webbeans/jsf12/ConversationAwareViewHandler.java b/owb_1.2.x/webbeans-jsf12/src/main/java/org/apache/webbeans/jsf12/ConversationAwareViewHandler.java
new file mode 100644
index 0000000..f726d1d
--- /dev/null
+++ b/owb_1.2.x/webbeans-jsf12/src/main/java/org/apache/webbeans/jsf12/ConversationAwareViewHandler.java
@@ -0,0 +1,81 @@
+/*
+ * 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.webbeans.jsf12;
+
+import javax.enterprise.context.Conversation;
+import javax.faces.application.ViewHandler;
+import javax.faces.application.ViewHandlerWrapper;
+import javax.faces.context.FacesContext;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.conversation.ConversationManager;
+
+public class ConversationAwareViewHandler extends ViewHandlerWrapper
+{
+ private final ViewHandler delegate;
+
+ private Boolean owbApplication = null;
+
+ public ConversationAwareViewHandler(ViewHandler delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getActionURL(FacesContext context, String viewId)
+ {
+ if(isOwbApplication())
+ {
+ return delegate.getActionURL(context, viewId);
+ }
+
+ String url = delegate.getActionURL(context, viewId);
+
+ ConversationManager conversationManager = WebBeansContext.getInstance().getConversationManager();
+ Conversation conversation = conversationManager.getConversationBeanReference();
+ if (conversation != null && !conversation.isTransient())
+ {
+ url = JSFUtil.getRedirectViewIdWithCid(url, conversation.getId());
+ }
+
+ return url;
+ }
+
+ private boolean isOwbApplication()
+ {
+ if (owbApplication == null)
+ {
+ owbApplication = Boolean.valueOf(WebBeansContext.getInstance().getBeanManagerImpl().isInUse());
+ }
+
+ return owbApplication.booleanValue();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ViewHandler getWrapped()
+ {
+ return delegate;
+ }
+}
diff --git a/owb_1.2.x/webbeans-jsf12/src/main/java/org/apache/webbeans/jsf12/DefaultConversationService.java b/owb_1.2.x/webbeans-jsf12/src/main/java/org/apache/webbeans/jsf12/DefaultConversationService.java
new file mode 100644
index 0000000..47e68ea
--- /dev/null
+++ b/owb_1.2.x/webbeans-jsf12/src/main/java/org/apache/webbeans/jsf12/DefaultConversationService.java
@@ -0,0 +1,46 @@
+/*
+ * 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.webbeans.jsf12;
+
+import javax.servlet.http.HttpSession;
+
+import org.apache.webbeans.spi.ConversationService;
+
+public class DefaultConversationService implements ConversationService
+{
+
+ @Override
+ public String getConversationId()
+ {
+ return JSFUtil.getConversationId();
+ }
+
+ @Override
+ public String getConversationSessionId()
+ {
+ HttpSession session = JSFUtil.getSession();
+ if(session != null)
+ {
+ return session.getId();
+ }
+
+ return null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-jsf12/src/main/java/org/apache/webbeans/jsf12/JSFUtil.java b/owb_1.2.x/webbeans-jsf12/src/main/java/org/apache/webbeans/jsf12/JSFUtil.java
new file mode 100644
index 0000000..63a2444
--- /dev/null
+++ b/owb_1.2.x/webbeans-jsf12/src/main/java/org/apache/webbeans/jsf12/JSFUtil.java
@@ -0,0 +1,134 @@
+/*
+ * 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.webbeans.jsf12;
+
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpSession;
+
+import org.apache.webbeans.util.Asserts;
+
+
+public final class JSFUtil
+{
+ private JSFUtil()
+ {
+
+ }
+
+ public static FacesContext getCurrentFacesContext()
+ {
+ return FacesContext.getCurrentInstance();
+ }
+
+ public static ExternalContext getExternalContext()
+ {
+ FacesContext context = getCurrentFacesContext();
+
+ if(context != null)
+ {
+ return context.getExternalContext();
+ }
+
+ return null;
+ }
+
+ public static HttpSession getSession()
+ {
+ ExternalContext externalContext = getExternalContext();
+
+ if(externalContext != null)
+ {
+ return (HttpSession) externalContext.getSession(true);
+ }
+
+ return null;
+ }
+
+ public static String getRedirectViewIdWithCid(String redirectId, String cid)
+ {
+ Asserts.assertNotNull(redirectId, "redirectId parameter can not be null");
+
+ StringBuffer buffer = new StringBuffer(redirectId);
+ int index = buffer.lastIndexOf("/");
+
+ String remainder = buffer.substring(index+1, buffer.length());
+ int indexOfQuery = remainder.indexOf('?');
+
+ StringBuffer result = new StringBuffer();
+ if(indexOfQuery != -1)
+ {
+ result.append(buffer.substring(0,index+1));
+ result.append(remainder.substring(0,indexOfQuery+1));
+ result.append("cid");
+ result.append("=");
+ result.append(cid);
+ result.append("&");
+ result.append(remainder.substring(indexOfQuery+1, remainder.length()));
+ }
+ else
+ {
+ int pathIndex = remainder.indexOf("#");
+
+ if(pathIndex == -1)
+ {
+ result.append(buffer.substring(0,index+1));
+ result.append(remainder);
+ result.append("?");
+ result.append("cid");
+ result.append("=");
+ result.append(cid);
+ }
+ else
+ {
+ result.append(buffer.substring(0,index+1));
+ result.append(remainder.substring(0,pathIndex));
+ result.append("?");
+ result.append("cid");
+ result.append("=");
+ result.append(cid);
+ result.append(remainder.substring(pathIndex,remainder.length()));
+ }
+ }
+
+
+ return result.toString();
+
+ }
+
+
+
+ public static String getJSFRequestParameter(String parameterName)
+ {
+ ExternalContext ec = getExternalContext();
+ if(ec != null)
+ {
+ return ec.getRequestParameterMap().get(parameterName);
+ }
+
+ return null;
+ }
+
+ public static String getConversationId()
+ {
+ String cid = getJSFRequestParameter("cid");
+ return cid;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-jsf12/src/main/java/org/apache/webbeans/jsf12/OwbApplication.java b/owb_1.2.x/webbeans-jsf12/src/main/java/org/apache/webbeans/jsf12/OwbApplication.java
new file mode 100644
index 0000000..9ccfa67
--- /dev/null
+++ b/owb_1.2.x/webbeans-jsf12/src/main/java/org/apache/webbeans/jsf12/OwbApplication.java
@@ -0,0 +1,363 @@
+/*
+ * 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.webbeans.jsf12;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import javax.el.ELContextListener;
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.application.Application;
+import javax.faces.application.NavigationHandler;
+import javax.faces.application.StateManager;
+import javax.faces.application.ViewHandler;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.el.MethodBinding;
+import javax.faces.el.PropertyResolver;
+import javax.faces.el.ReferenceSyntaxException;
+import javax.faces.el.ValueBinding;
+import javax.faces.el.VariableResolver;
+import javax.faces.event.ActionListener;
+import javax.faces.validator.Validator;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+@SuppressWarnings("unchecked")
+public class OwbApplication extends Application
+{
+ private Application wrappedApplication;
+
+ private volatile ExpressionFactory expressionFactory;
+
+ public OwbApplication(Application wrappedApplication)
+ {
+ this.wrappedApplication = wrappedApplication;
+ }
+
+ @Override
+ public void addComponent(String arg0, String arg1)
+ {
+ this.wrappedApplication.addComponent(arg0, arg1);
+ }
+
+
+ @Override
+ public void addConverter(String arg0, String arg1)
+ {
+ this.wrappedApplication.addConverter(arg0, arg1);
+ }
+
+ @Override
+ public void addValidator(String arg0, String arg1)
+ {
+ this.wrappedApplication.addValidator(arg0, arg1);
+ }
+
+ @Override
+ public UIComponent createComponent(String arg0) throws FacesException
+ {
+ return this.wrappedApplication.createComponent(arg0);
+ }
+
+ @Override
+ public UIComponent createComponent(ValueBinding arg0, FacesContext arg1, String arg2) throws FacesException
+ {
+ return this.wrappedApplication.createComponent(arg0, arg1, arg2);
+ }
+
+ @Override
+ public Converter createConverter(String arg0)
+ {
+ return this.wrappedApplication.createConverter(arg0);
+ }
+
+
+ @Override
+ public Validator createValidator(String arg0) throws FacesException
+ {
+
+ return this.wrappedApplication.createValidator(arg0);
+ }
+
+ @Override
+ public ValueBinding createValueBinding(String arg0) throws ReferenceSyntaxException
+ {
+ return this.wrappedApplication.createValueBinding(arg0);
+ }
+
+ @Override
+ public ActionListener getActionListener()
+ {
+ return this.wrappedApplication.getActionListener();
+ }
+
+ @Override
+ public Iterator<String> getComponentTypes()
+ {
+ return this.wrappedApplication.getComponentTypes();
+ }
+
+ @Override
+ public Iterator<String> getConverterIds()
+ {
+ return this.wrappedApplication.getConverterIds();
+ }
+
+
+ @Override
+ public Locale getDefaultLocale()
+ {
+ return this.wrappedApplication.getDefaultLocale();
+ }
+
+ @Override
+ public String getDefaultRenderKitId()
+ {
+ return this.wrappedApplication.getDefaultRenderKitId();
+ }
+
+ @Override
+ public String getMessageBundle()
+ {
+ return this.wrappedApplication.getMessageBundle();
+ }
+
+ @Override
+ public NavigationHandler getNavigationHandler()
+ {
+ return this.wrappedApplication.getNavigationHandler();
+ }
+
+ @Override
+ public PropertyResolver getPropertyResolver()
+ {
+ return this.wrappedApplication.getPropertyResolver();
+ }
+
+ @Override
+ public StateManager getStateManager()
+ {
+ return this.wrappedApplication.getStateManager();
+ }
+
+ @Override
+ public Iterator<Locale> getSupportedLocales()
+ {
+ return this.wrappedApplication.getSupportedLocales();
+ }
+
+ @Override
+ public Iterator<String> getValidatorIds()
+ {
+ return this.wrappedApplication.getValidatorIds();
+ }
+
+ @Override
+ public VariableResolver getVariableResolver()
+ {
+ return this.wrappedApplication.getVariableResolver();
+ }
+
+ @Override
+ public ViewHandler getViewHandler()
+ {
+ return this.wrappedApplication.getViewHandler();
+ }
+
+ @Override
+ public void setActionListener(ActionListener arg0)
+ {
+ this.wrappedApplication.setActionListener(arg0);
+ }
+
+ @Override
+ public void setDefaultLocale(Locale arg0)
+ {
+ this.wrappedApplication.setDefaultLocale(arg0);
+ }
+
+ @Override
+ public void setDefaultRenderKitId(String arg0)
+ {
+ this.wrappedApplication.setDefaultRenderKitId(arg0);
+ }
+
+ @Override
+ public void setMessageBundle(String arg0)
+ {
+ this.wrappedApplication.setMessageBundle(arg0);
+ }
+
+ @Override
+ public void setNavigationHandler(NavigationHandler arg0)
+ {
+ this.wrappedApplication.setNavigationHandler(arg0);
+ }
+
+ @Override
+ public void setPropertyResolver(PropertyResolver arg0)
+ {
+ this.wrappedApplication.setPropertyResolver(arg0);
+ }
+
+ @Override
+ public void setStateManager(StateManager arg0)
+ {
+ this.wrappedApplication.setStateManager(arg0);
+ }
+
+ @Override
+ public void setSupportedLocales(Collection<Locale> arg0)
+ {
+ this.wrappedApplication.setSupportedLocales(arg0);
+
+ }
+
+ @Override
+ public void setVariableResolver(VariableResolver arg0)
+ {
+ this.wrappedApplication.setVariableResolver(arg0);
+ }
+
+ @Override
+ public void setViewHandler(ViewHandler arg0)
+ {
+ this.wrappedApplication.setViewHandler(arg0);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.application.Application#getExpressionFactory()
+ */
+ @Override
+ public ExpressionFactory getExpressionFactory()
+ {
+ if(this.expressionFactory == null)
+ {
+ expressionFactory = wrappedApplication.getExpressionFactory();
+ expressionFactory = WebBeansContext.getInstance().getBeanManagerImpl().wrapExpressionFactory(expressionFactory);
+ }
+
+ return expressionFactory;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.application.Application#addELContextListener(javax.el.ELContextListener)
+ */
+ @Override
+ public void addELContextListener(ELContextListener listener)
+ {
+
+ wrappedApplication.addELContextListener(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.application.Application#addELResolver(javax.el.ELResolver)
+ */
+ @Override
+ public void addELResolver(ELResolver resolver)
+ {
+
+ wrappedApplication.addELResolver(resolver);
+ }
+
+
+ /* (non-Javadoc)
+ * @see javax.faces.application.Application#createComponent(javax.el.ValueExpression, javax.faces.context.FacesContext, java.lang.String)
+ */
+ @Override
+ public UIComponent createComponent(ValueExpression componentExpression, FacesContext context, String componentType) throws FacesException
+ {
+
+ return wrappedApplication.createComponent(componentExpression, context, componentType);
+ }
+
+
+ /* (non-Javadoc)
+ * @see javax.faces.application.Application#getELContextListeners()
+ */
+ @Override
+ public ELContextListener[] getELContextListeners()
+ {
+
+ return wrappedApplication.getELContextListeners();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.application.Application#getELResolver()
+ */
+ @Override
+ public ELResolver getELResolver()
+ {
+
+ return wrappedApplication.getELResolver();
+ }
+
+
+ /* (non-Javadoc)
+ * @see javax.faces.application.Application#getResourceBundle(javax.faces.context.FacesContext, java.lang.String)
+ */
+ @Override
+ public ResourceBundle getResourceBundle(FacesContext ctx, String name) throws FacesException, NullPointerException
+ {
+
+ return wrappedApplication.getResourceBundle(ctx, name);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.application.Application#removeELContextListener(javax.el.ELContextListener)
+ */
+ @Override
+ public void removeELContextListener(ELContextListener listener)
+ {
+
+ wrappedApplication.removeELContextListener(listener);
+ }
+
+ @Override
+ public void addConverter(Class arg0, String arg1)
+ {
+ wrappedApplication.addConverter(arg0, arg1);
+ }
+
+ @Override
+ public Converter createConverter(Class arg0)
+ {
+ return wrappedApplication.createConverter(arg0);
+ }
+
+ @Override
+ public MethodBinding createMethodBinding(String arg0, Class[] arg1) throws ReferenceSyntaxException
+ {
+ return wrappedApplication.createMethodBinding(arg0, arg1);
+ }
+
+ @Override
+ public Iterator<Class> getConverterTypes()
+ {
+ return wrappedApplication.getConverterTypes();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-jsf12/src/main/java/org/apache/webbeans/jsf12/OwbApplicationFactory.java b/owb_1.2.x/webbeans-jsf12/src/main/java/org/apache/webbeans/jsf12/OwbApplicationFactory.java
new file mode 100644
index 0000000..9e0a2b9
--- /dev/null
+++ b/owb_1.2.x/webbeans-jsf12/src/main/java/org/apache/webbeans/jsf12/OwbApplicationFactory.java
@@ -0,0 +1,59 @@
+/*
+ * 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.webbeans.jsf12;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+import javax.faces.application.Application;
+import javax.faces.application.ApplicationFactory;
+
+public class OwbApplicationFactory extends ApplicationFactory
+{
+ private ApplicationFactory wrapped;
+
+ private Application wrappedApplication;
+
+ public OwbApplicationFactory(ApplicationFactory applicationFactory)
+ {
+ this.wrapped = applicationFactory;
+ }
+
+ @Override
+ public Application getApplication()
+ {
+ if(WebBeansContext.getInstance().getBeanManagerImpl().isInUse())
+ {
+ return wrapped.getApplication();
+ }
+
+ if(wrappedApplication == null)
+ {
+ wrappedApplication = new OwbApplication(wrapped.getApplication());
+ }
+
+ return wrappedApplication;
+ }
+
+ @Override
+ public void setApplication(Application arg0)
+ {
+ this.wrapped.setApplication(arg0);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-jsf12/src/main/java/org/apache/webbeans/jsf12/WebBeansPhaseListener.java b/owb_1.2.x/webbeans-jsf12/src/main/java/org/apache/webbeans/jsf12/WebBeansPhaseListener.java
new file mode 100644
index 0000000..1de9c50
--- /dev/null
+++ b/owb_1.2.x/webbeans-jsf12/src/main/java/org/apache/webbeans/jsf12/WebBeansPhaseListener.java
@@ -0,0 +1,167 @@
+/*
+ * 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.webbeans.jsf12;
+
+import javax.enterprise.context.BusyConversationException;
+import javax.enterprise.context.Conversation;
+import javax.enterprise.context.NonexistentConversationException;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.context.ConversationContext;
+import org.apache.webbeans.conversation.ConversationImpl;
+import org.apache.webbeans.conversation.ConversationManager;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Conversation related phase listener.
+ *
+ * @version $Rev: 943786 $ $Date: 2010-05-13 07:06:16 +0300 (Thu, 13 May 2010) $
+ *
+ */
+public class WebBeansPhaseListener implements PhaseListener
+{
+ private static final long serialVersionUID = 1L;
+
+ /**Logger instance*/
+ private final static Logger logger = WebBeansLoggerFacade.getLogger(WebBeansPhaseListener.class);
+
+ private Boolean owbApplication = null;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void afterPhase(PhaseEvent phaseEvent)
+ {
+ if(!isOwbApplication())
+ {
+ return;
+ }
+
+ if (phaseEvent.getPhaseId().equals(PhaseId.RENDER_RESPONSE) ||
+ phaseEvent.getFacesContext().getResponseComplete())
+ {
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ ConversationManager conversationManager = webBeansContext.getConversationManager();
+ Conversation conversation = conversationManager.getConversationBeanReference();
+ ContextFactory contextFactory = webBeansContext.getContextFactory();
+
+ if (conversation.isTransient())
+ {
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.log(Level.FINE, "Destroying the conversation context with cid : [{0}]", conversation.getId());
+ }
+ contextFactory.destroyConversationContext();
+ }
+ else
+ {
+ //Conversation must be used by one thread at a time
+ ConversationImpl owbConversation = (ConversationImpl)conversation;
+ owbConversation.updateTimeOut();
+ //Other threads can now access propogated conversation.
+ owbConversation.setInUsed(false);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void beforePhase(PhaseEvent phaseEvent)
+ {
+ if(!isOwbApplication())
+ {
+ return;
+ }
+
+ if (phaseEvent.getPhaseId().equals(PhaseId.RESTORE_VIEW))
+ {
+ //It looks for cid parameter in the JSF request.
+ //If request contains cid, then it must restore conversation
+ //Otherwise create NonexistentException
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ ConversationManager conversationManager = webBeansContext.getConversationManager();
+ Conversation conversation = conversationManager.getConversationBeanReference();
+ String cid = JSFUtil.getConversationId();
+ ContextFactory contextFactory = webBeansContext.getContextFactory();
+
+ if (conversation.isTransient())
+ {
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.log(Level.FINE, "Creating a new transitional conversation with cid : [{0}]", conversation.getId());
+ }
+ contextFactory.initConversationContext(null);
+
+ //Not restore, throw exception
+ if(cid != null && !cid.equals(""))
+ {
+ throw new NonexistentConversationException("Propogated conversation with cid=" + cid + " is not restored. It creates a new transient conversation.");
+ }
+ }
+ else
+ {
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.log(Level.FINE, "Restoring conversation with cid : [{0}]", conversation.getId());
+ }
+
+ //Conversation must be used by one thread at a time
+ ConversationImpl owbConversation = (ConversationImpl)conversation;
+ if(!owbConversation.getInUsed().compareAndSet(false, true))
+ {
+ contextFactory.initConversationContext(null);
+ //Throw Busy exception
+ throw new BusyConversationException("Propogated conversation with cid=" + cid + " is used by other request. It creates a new transient conversation");
+ }
+ else
+ {
+ ConversationContext conversationContext = conversationManager.getConversationContext(conversation);
+ contextFactory.initConversationContext(conversationContext);
+ }
+ }
+ }
+ }
+
+ @Override
+ public PhaseId getPhaseId()
+ {
+ return PhaseId.ANY_PHASE;
+ }
+
+ private boolean isOwbApplication()
+ {
+ if (owbApplication == null)
+ {
+ owbApplication = Boolean.valueOf(WebBeansContext.getInstance().getBeanManagerImpl().isInUse());
+ }
+
+ return owbApplication.booleanValue();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-jsf12/src/main/java/org/apache/webbeans/jsf12/plugin/OpenWebBeansJsfPlugin.java b/owb_1.2.x/webbeans-jsf12/src/main/java/org/apache/webbeans/jsf12/plugin/OpenWebBeansJsfPlugin.java
new file mode 100644
index 0000000..d212507
--- /dev/null
+++ b/owb_1.2.x/webbeans-jsf12/src/main/java/org/apache/webbeans/jsf12/plugin/OpenWebBeansJsfPlugin.java
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.jsf12.plugin;
+
+
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.spi.plugins.AbstractOwbPlugin;
+
+public class OpenWebBeansJsfPlugin extends AbstractOwbPlugin
+{
+ /** {@inheritDoc} */
+ @Override
+ public void isManagedBean( Class<?> clazz ) throws WebBeansConfigurationException
+ {
+ }
+}
diff --git a/owb_1.2.x/webbeans-jsf12/src/main/resources/META-INF/faces-config.xml b/owb_1.2.x/webbeans-jsf12/src/main/resources/META-INF/faces-config.xml
new file mode 100644
index 0000000..a01a608
--- /dev/null
+++ b/owb_1.2.x/webbeans-jsf12/src/main/resources/META-INF/faces-config.xml
@@ -0,0 +1,33 @@
+<?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.
+ -->
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+
+ <factory>
+ <application-factory>org.apache.webbeans.jsf12.OwbApplicationFactory</application-factory>
+ </factory>
+
+ <application>
+ <view-handler>org.apache.webbeans.jsf12.ConversationAwareViewHandler</view-handler>
+ </application>
+
+ <lifecycle>
+ <phase-listener>org.apache.webbeans.jsf12.WebBeansPhaseListener</phase-listener>
+ </lifecycle>
+
+</faces-config>
diff --git a/owb_1.2.x/webbeans-jsf12/src/main/resources/META-INF/openwebbeans/openwebbeans.properties b/owb_1.2.x/webbeans-jsf12/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
new file mode 100644
index 0000000..9ed33f6
--- /dev/null
+++ b/owb_1.2.x/webbeans-jsf12/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
@@ -0,0 +1,40 @@
+#Licensed to the Apache Software Foundation (ASF) under one
+#or more contributor license agreements. See the NOTICE file
+#distributed with this work for additional information
+#regarding copyright ownership. The ASF licenses this file
+#to you under the Apache License, Version 2.0 (the
+#"License"); you may not use this file except in compliance
+#with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+#Unless required by applicable law or agreed to in writing,
+#software distributed under the License is distributed on an
+#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#KIND, either express or implied. See the License for the
+#specific language governing permissions and limitations
+#under the License.
+#---------------------------------------------------------------
+# The default configuration for OpenWebBeans
+#
+# The default configuration is intended for a JDK and a simple ServletContainer
+# like jetty, resin or tomcat.
+#
+#---------------------------------------------------------------
+
+configuration.ordinal= 12
+
+
+#################################### Conversation Context Removal Thread Delay##################
+#Converation contexts are removed when idle timeout > timeout. Default timeout is 30 mins.
+org.apache.webbeans.conversation.Conversation.periodicDelay=1800000
+################################################################################################
+
+################################### Default Conversation Service ###############################
+#Default implementation of org.apache.webbeans.corespi.ConversationService.
+org.apache.webbeans.spi.ConversationService=org.apache.webbeans.jsf12.DefaultConversationService
+################################################################################################
+
+################################# Conversation Support #########################################
+org.apache.webbeans.application.supportsConversation=true
+################################################################################################
diff --git a/owb_1.2.x/webbeans-jsf12/src/main/resources/META-INF/services/org.apache.webbeans.spi.plugins.OpenWebBeansPlugin b/owb_1.2.x/webbeans-jsf12/src/main/resources/META-INF/services/org.apache.webbeans.spi.plugins.OpenWebBeansPlugin
new file mode 100644
index 0000000..974571d
--- /dev/null
+++ b/owb_1.2.x/webbeans-jsf12/src/main/resources/META-INF/services/org.apache.webbeans.spi.plugins.OpenWebBeansPlugin
@@ -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.
+
+# this file contains the service implementation for the
+# JSF integration into OpenWebBeans
+# this file contains information for java.util.ServiceLoader
+org.apache.webbeans.jsf12.plugin.OpenWebBeansJsfPlugin
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-jsf12/src/site/site.xml b/owb_1.2.x/webbeans-jsf12/src/site/site.xml
new file mode 100644
index 0000000..4449638
--- /dev/null
+++ b/owb_1.2.x/webbeans-jsf12/src/site/site.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<project name="OpenWebBeans">
+ <bannerLeft>
+ <name>Apache OpenWebBeans</name>
+ <src>http://openwebbeans.apache.org/owb/images/logos/openwebbeans_hor.png</src>
+ <href>http://openwebbeans.apache.org</href>
+ </bannerLeft>
+
+ <bannerRight>
+ <name>Apache Banner</name>
+ <src>http://www.apache.org/images/asf-logo.gif</src>
+ <href>http://www.apache.org</href>
+ </bannerRight>
+
+ <publishDate format="dd MMM yyyy" />
+ <version position="left"/>
+
+ <body>
+ <breadcrumbs>
+ <item name="Apache" href="http://www.apache.org"/>
+ <item name="OpenWebBeans" href="http://openwebbeans.apache.org"/>
+ <item name="OWB-JSF-1.2" href="http://openwebbeans.apache.org/${project.version}/openwebbeans-jsf12"/>
+ </breadcrumbs>
+
+ <menu ref="reports"/>
+ </body>
+</project>
+
diff --git a/owb_1.2.x/webbeans-osgi/pom.xml b/owb_1.2.x/webbeans-osgi/pom.xml
new file mode 100644
index 0000000..e80b389
--- /dev/null
+++ b/owb_1.2.x/webbeans-osgi/pom.xml
@@ -0,0 +1,76 @@
+<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">
+<!--
+ 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.
+-->
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>1.2.5</version>
+ </parent>
+
+ <artifactId>openwebbeans-osgi</artifactId>
+ <name>OSGi plugin</name>
+ <description>Apache OpenWebBeans OSGi ClassLoader scanning support</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_2.5_spec</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.xbean</groupId>
+ <artifactId>xbean-finder</artifactId>
+ <version>${xbean.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/owb_1.2.x/webbeans-osgi/src/main/java/org/apache/webbeans/osgi/scanner/OsgiMetaDataScannerService.java b/owb_1.2.x/webbeans-osgi/src/main/java/org/apache/webbeans/osgi/scanner/OsgiMetaDataScannerService.java
new file mode 100644
index 0000000..ab1b2f4
--- /dev/null
+++ b/owb_1.2.x/webbeans-osgi/src/main/java/org/apache/webbeans/osgi/scanner/OsgiMetaDataScannerService.java
@@ -0,0 +1,298 @@
+/*
+ * 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.webbeans.osgi.scanner;
+
+import org.apache.webbeans.exception.WebBeansDeploymentException;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.spi.BDABeansXmlScanner;
+import org.apache.webbeans.spi.ScannerService;
+
+import org.apache.webbeans.util.UrlSet;
+import org.apache.xbean.finder.BundleAssignableClassFinder;
+import org.apache.xbean.osgi.bundle.util.BundleClassFinder;
+import org.apache.xbean.osgi.bundle.util.BundleResourceFinder;
+import org.apache.xbean.osgi.bundle.util.BundleUtils;
+import org.apache.xbean.osgi.bundle.util.ClassDiscoveryFilter;
+import org.apache.xbean.osgi.bundle.util.DiscoveryRange;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+import javax.servlet.ServletContext;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Logger;
+import java.util.zip.ZipEntry;
+
+/**
+ * In an OSGi environment, resources will not be delivered in
+ * jars or file URLs, but as 'bundle://'.
+ * This {@link org.apache.webbeans.spi.ScannerService} parses for all classes
+ * in such a bundle.
+ */
+public class OsgiMetaDataScannerService implements ScannerService
+{
+ private static final Logger logger = WebBeansLoggerFacade.getLogger(OsgiMetaDataScannerService.class);
+
+ protected ServletContext servletContext = null;
+ private static final String META_INF_BEANS_XML = "META-INF/beans.xml";
+ private static final String WEB_INF_BEANS_XML = "WEB-INF/beans.xml";
+
+ /** All classes which have to be scanned for Bean information */
+ private Set<Class<?>> beanClasses = new HashSet<Class<?>>();
+
+ /** the paths of all META-INF/beans.xml files */
+ private UrlSet beanXMLs = new UrlSet();
+
+ /**contains all the JARs we found with valid beans.xml in it */
+ private Set<String> beanArchiveJarNames = new HashSet<String>();
+ private Map<String, Set<String>> classAnnotations = new HashMap<String, Set<String>>();
+
+ @Override
+ public void init(Object object)
+ {
+ if (object instanceof ServletContext)
+ {
+ servletContext = (ServletContext) object;
+ }
+ }
+
+ @Override
+ public void release()
+ {
+ beanClasses = new HashSet<Class<?>>();
+ beanXMLs = new UrlSet();
+ beanArchiveJarNames = new HashSet<String>();
+ classAnnotations.clear();
+ }
+
+ @Override
+ public void scan() throws WebBeansDeploymentException
+ {
+ logger.info("Using OsgiMetaDataScannerService!");
+ Bundle mainBundle = BundleUtils.getContextBundle(true);
+
+
+ ServiceReference reference = mainBundle.getBundleContext().getServiceReference(PackageAdmin.class.getName());
+ try
+ {
+ PackageAdmin packageAdmin = (PackageAdmin) mainBundle.getBundleContext().getService(reference);
+
+ // search for all META-INF/beans.xml files
+ findBeansXml(mainBundle, packageAdmin);
+
+ // search for all classes
+ findBeanClasses(mainBundle, packageAdmin);
+ }
+ catch(Exception e)
+ {
+ throw new WebBeansDeploymentException("problem while scanning OSGi bundle", e);
+ }
+ finally
+ {
+ mainBundle.getBundleContext().ungetService(reference);
+ }
+
+ }
+
+ private void findBeanClasses(Bundle mainBundle, PackageAdmin packageAdmin)
+ {
+ BundleClassFinder bundleClassFinder =
+ new BundleAssignableClassFinder(packageAdmin, mainBundle,
+ new Class<?>[]{Object.class},
+ new ClassDiscoveryFilter()
+ {
+
+ @Override
+ public boolean directoryDiscoveryRequired(String directory)
+ {
+ return true;
+ }
+
+ @Override
+ public boolean jarFileDiscoveryRequired(String jarUrl)
+ {
+ boolean isValidBeanArchive = beanArchiveJarNames.contains(jarUrl);
+ return isValidBeanArchive;
+ }
+
+ @Override
+ public boolean packageDiscoveryRequired(String packageName)
+ {
+ return true;
+ }
+
+ @Override
+ public boolean rangeDiscoveryRequired(DiscoveryRange discoveryRange)
+ {
+ return discoveryRange.equals(DiscoveryRange.BUNDLE_CLASSPATH);
+ }
+ });
+
+ Set<String> acceptedClassNames = bundleClassFinder.find();
+ for (String clsName : acceptedClassNames)
+ {
+ try
+ {
+ Class<?> cls = mainBundle.loadClass(clsName);
+
+ classAnnotations.put(clsName, collectAnnotations(cls));
+
+ beanClasses.add(cls);
+ }
+ catch(Exception e)
+ {
+ logger.info("cannot load class from bundle: " + clsName);
+ }
+ }
+ }
+
+ private Set<String> collectAnnotations(Class<?> cls)
+ {
+ Set<String> annotations = new HashSet<String>();
+
+ addAnnotations(annotations, cls.getAnnotations());
+
+ Constructor[] constructors = cls.getDeclaredConstructors();
+ for (Constructor c : constructors)
+ {
+ addAnnotations(annotations, c.getAnnotations());
+ }
+
+ Field[] fields = cls.getDeclaredFields();
+ for (Field f : fields)
+ {
+ addAnnotations(annotations, f.getAnnotations());
+ }
+
+ Method[] methods = cls.getDeclaredMethods();
+ for (Method m : methods)
+ {
+ addAnnotations(annotations, m.getAnnotations());
+
+ Annotation[][] paramsAnns = m.getParameterAnnotations();
+ for (Annotation[] pAnns : paramsAnns)
+ {
+ addAnnotations(annotations, pAnns);
+ }
+ }
+
+ return annotations;
+ }
+
+ private void addAnnotations(Set<String> annStrings, Annotation[] annotations)
+ {
+ for (Annotation ann : annotations)
+ {
+ annStrings.add(ann.getClass().getSimpleName());
+ }
+ }
+
+ private void findBeansXml(Bundle mainBundle, PackageAdmin packageAdmin)
+ throws Exception
+ {
+ BundleResourceFinder brfXmlJar = new BundleResourceFinder(packageAdmin, mainBundle, "", META_INF_BEANS_XML);
+
+ BundleResourceFinder.ResourceFinderCallback rfCallback = new BundleResourceFinder.ResourceFinderCallback()
+ {
+
+ @Override
+ public boolean foundInDirectory(Bundle bundle, String basePath, URL url) throws Exception
+ {
+ logger.info("adding the following beans.xml URL: " + url);
+ beanXMLs.add(url);
+ return true;
+ }
+
+ @Override
+ public boolean foundInJar(Bundle bundle, String jarName, ZipEntry entry, InputStream in) throws Exception
+ {
+ URL jarURL = bundle.getEntry(jarName);
+
+ logger.info("adding the following beans.xml URL: " + jarURL.toExternalForm());
+
+ beanXMLs.add(jarURL);
+ beanArchiveJarNames.add(jarName);
+ return true;
+ }
+
+ };
+
+ brfXmlJar.find(rfCallback);
+
+ // TODO I found no other way to find WEB-INF/beanx.xml directly
+ Enumeration<URL> urls = mainBundle.findEntries("", "beans.xml", true);
+ boolean webBeansXmlFound = false;
+ while(urls != null && urls.hasMoreElements())
+ {
+ URL webBeansXml = urls.nextElement();
+ if (!webBeansXml.toExternalForm().endsWith("/" + WEB_INF_BEANS_XML))
+ {
+ continue;
+ }
+
+ if (webBeansXmlFound)
+ {
+ throw new WebBeansDeploymentException("found more than WEB-INF/beans.xml file!" + webBeansXml);
+ }
+
+ logger.info("adding the following WEB-INF/beans.xml URL: " + webBeansXml);
+ beanXMLs.add(webBeansXml);
+ webBeansXmlFound = true;
+ }
+ }
+
+ @Override
+ public Set<URL> getBeanXmls()
+ {
+ return beanXMLs;
+ }
+
+ @Override
+ public Set<Class<?>> getBeanClasses()
+ {
+ return beanClasses;
+ }
+
+ public Set<String> getAllAnnotations(String className)
+ {
+ return classAnnotations.get(className);
+ }
+
+ @Override
+ public BDABeansXmlScanner getBDABeansXmlScanner()
+ {
+ return null;
+ }
+
+ @Override
+ public boolean isBDABeansXmlScanningEnabled()
+ {
+ return false;
+ }
+}
diff --git a/owb_1.2.x/webbeans-osgi/src/site/site.xml b/owb_1.2.x/webbeans-osgi/src/site/site.xml
new file mode 100644
index 0000000..b423c7e
--- /dev/null
+++ b/owb_1.2.x/webbeans-osgi/src/site/site.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<project name="OpenWebBeans">
+ <bannerLeft>
+ <name>Apache OpenWebBeans</name>
+ <src>http://openwebbeans.apache.org/owb/images/logos/openwebbeans_hor.png</src>
+ <href>http://openwebbeans.apache.org</href>
+ </bannerLeft>
+
+ <bannerRight>
+ <name>Apache Banner</name>
+ <src>http://www.apache.org/images/asf-logo.gif</src>
+ <href>http://www.apache.org</href>
+ </bannerRight>
+
+ <publishDate format="dd MMM yyyy" />
+ <version position="left"/>
+
+ <body>
+ <breadcrumbs>
+ <item name="Apache" href="http://www.apache.org"/>
+ <item name="OpenWebBeans" href="http://openwebbeans.apache.org"/>
+ <item name="OWB-OSGi" href="http://openwebbeans.apache.org/${project.version}/openwebbeans-osgi"/>
+ </breadcrumbs>
+
+ <menu ref="reports"/>
+ </body>
+</project>
+
diff --git a/owb_1.2.x/webbeans-porting/pom.xml b/owb_1.2.x/webbeans-porting/pom.xml
new file mode 100644
index 0000000..54076de
--- /dev/null
+++ b/owb_1.2.x/webbeans-porting/pom.xml
@@ -0,0 +1,150 @@
+<?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.
+-->
+
+<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>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>1.2.5</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>openwebbeans-porting</artifactId>
+ <name>TCK Porting Pkg</name>
+ <packaging>jar</packaging>
+ <description>Apache OpenWebBeans TCK Porting Package</description>
+
+ <properties>
+ <webbeans.tck.version>1.0.4.CR1</webbeans.tck.version>
+ </properties>
+
+ <!--Used for jboss-test-harness-api not in central maven -->
+ <!-- TODO finally REMOVE if all transitive stuff from the TCK moved to maven.central -->
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-el22</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jpa_2.0_spec</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_2.5_spec</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jta_1.1_spec</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-annotation_1.1_spec</artifactId>
+ <version>${geronimo_annotation.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.1</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.jsr299.tck</groupId>
+ <artifactId>jsr299-tck-api</artifactId>
+ <version>${webbeans.tck.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-el_2.2_spec</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>jasper-el</artifactId>
+ <version>6.0.20</version>
+ </dependency>
+
+ </dependencies>
+
+
+</project>
diff --git a/owb_1.2.x/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/BeansImpl.java b/owb_1.2.x/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/BeansImpl.java
new file mode 100644
index 0000000..1f56ce9
--- /dev/null
+++ b/owb_1.2.x/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/BeansImpl.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.tck;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import org.jboss.jsr299.tck.spi.Beans;
+
+public class BeansImpl implements Beans
+{
+
+ @Override
+ public boolean isProxy( Object instance )
+ {
+ return instance.getClass().getName().contains("$Owb");
+ }
+
+ @Override
+ public byte[] serialize(Object o) throws IOException
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(o);
+ return baos.toByteArray();
+ }
+
+ @Override
+ public Object deserialize(byte[] bytes) throws IOException, ClassNotFoundException
+ {
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+ ObjectInputStream ois = new ObjectInputStream(bais);
+ return ois.readObject();
+ }
+ }
diff --git a/owb_1.2.x/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/ContainersImpl.java b/owb_1.2.x/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/ContainersImpl.java
new file mode 100644
index 0000000..a2341a9
--- /dev/null
+++ b/owb_1.2.x/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/ContainersImpl.java
@@ -0,0 +1,103 @@
+/*
+ * 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.webbeans.test.tck;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.commons.httpclient.Credentials;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.UsernamePasswordCredentials;
+import org.apache.commons.httpclient.auth.AuthScope;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.util.HttpURLConnection;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.jboss.testharness.api.DeploymentException;
+import org.jboss.testharness.spi.Containers;
+
+public class ContainersImpl extends TomcatConnector implements Containers
+{
+ private HttpClient client = null;
+
+ private DeploymentException excepton = null;
+
+ public ContainersImpl() throws IOException
+ {
+ super();
+ client = new HttpClient();
+ client = new HttpClient();
+ client.getParams().setAuthenticationPreemptive(true);
+ Credentials credentials = new UsernamePasswordCredentials("tests", "secret");
+ client.getState().setCredentials(new AuthScope(null, 8080, null), credentials);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.testharness.integration.tomcat.TomcatConnector#deploy(java.io.InputStream, java.lang.String)
+ */
+ @Override
+ public boolean deploy(InputStream stream, String name) throws IOException
+ {
+ boolean result = super.deploy(stream, name);
+ if(result)
+ {
+ GetMethod method = null;
+ try
+ {
+ method = new GetMethod("http://localhost:8080/manager/list");
+ int r = client.executeMethod(method);
+ if(r == HttpURLConnection.HTTP_OK)
+ {
+ String string = method.getResponseBodyAsString();
+ int start = string.indexOf(getContextName(name)+":running");
+
+ if(start == -1)
+ {
+ this.excepton = new DeploymentException("Deployment Failure",new WebBeansConfigurationException("Deployment Failure"));
+ return false;
+ }
+ }
+
+ }
+ finally
+ {
+ method.releaseConnection();
+ }
+ }
+
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.testharness.integration.tomcat.TomcatConnector#getDeploymentException()
+ */
+ @Override
+ public DeploymentException getDeploymentException()
+ {
+ if(this.excepton != null)
+ {
+ return this.excepton;
+ }
+
+ return super.getDeploymentException();
+ }
+
+
+
+
+}
diff --git a/owb_1.2.x/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/ContextsImpl.java b/owb_1.2.x/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/ContextsImpl.java
new file mode 100644
index 0000000..86a96d7
--- /dev/null
+++ b/owb_1.2.x/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/ContextsImpl.java
@@ -0,0 +1,77 @@
+/*
+ * 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.webbeans.test.tck;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.RequestScoped;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.AbstractContext;
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.context.RequestContext;
+import org.jboss.jsr299.tck.spi.Contexts;
+
+public class ContextsImpl implements Contexts<AbstractContext>
+{
+
+ @Override
+ public AbstractContext getRequestContext()
+ {
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ ContextFactory contextFactory = webBeansContext.getContextFactory();
+
+ RequestContext ctx = (RequestContext)contextFactory.getStandardContext(RequestScoped.class);
+
+ if(ctx == null)
+ {
+ contextFactory.initRequestContext(null);
+ }
+
+ return (AbstractContext) contextFactory.getStandardContext(RequestScoped.class);
+ }
+
+ @Override
+ public void setActive(AbstractContext context)
+ {
+ context.setActive(true);
+
+ }
+
+ @Override
+ public void setInactive(AbstractContext context)
+ {
+ context.setActive(false);
+ }
+
+ @Override
+ public AbstractContext getDependentContext()
+ {
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ ContextFactory contextFactory = webBeansContext.getContextFactory();
+
+ return (AbstractContext) contextFactory.getStandardContext(Dependent.class);
+ }
+
+ @Override
+ public void destroyContext(AbstractContext context)
+ {
+ context.destroy();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/ELImpl.java b/owb_1.2.x/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/ELImpl.java
new file mode 100644
index 0000000..cdfdbd6
--- /dev/null
+++ b/owb_1.2.x/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/ELImpl.java
@@ -0,0 +1,111 @@
+/*
+ * 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.webbeans.test.tck;
+
+
+import javax.el.ArrayELResolver;
+import javax.el.BeanELResolver;
+import javax.el.CompositeELResolver;
+import javax.el.ELContext;
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+import javax.el.FunctionMapper;
+import javax.el.ListELResolver;
+import javax.el.MapELResolver;
+import javax.el.ResourceBundleELResolver;
+import javax.el.VariableMapper;
+
+import org.apache.el.ExpressionFactoryImpl;
+import org.apache.el.lang.FunctionMapperImpl;
+import org.apache.el.lang.VariableMapperImpl;
+import org.apache.webbeans.el22.WrappedExpressionFactory;
+import org.jboss.jsr299.tck.spi.EL;
+
+public class ELImpl implements EL
+{
+ private static final ExpressionFactory EXPRESSION_FACTORY = new WrappedExpressionFactory(new ExpressionFactoryImpl());
+
+ public ELImpl()
+ {
+ }
+
+ public static ELResolver getELResolver()
+ {
+ CompositeELResolver composite = new CompositeELResolver();
+ composite.add(new BeanELResolver());
+ composite.add(new ArrayELResolver());
+ composite.add(new MapELResolver());
+ composite.add(new ListELResolver());
+ composite.add(new ResourceBundleELResolver());
+ composite.add(new OwbTckElResolver());
+
+ return composite;
+ }
+
+ public static class ELContextImpl extends ELContext
+ {
+
+ @Override
+ public ELResolver getELResolver()
+ {
+ return ELImpl.getELResolver();
+ }
+
+ @Override
+ public FunctionMapper getFunctionMapper()
+ {
+ return new FunctionMapperImpl();
+ }
+
+ @Override
+ public VariableMapper getVariableMapper()
+ {
+ return new VariableMapperImpl();
+ }
+
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T> T evaluateMethodExpression(String expression, Class<T> expectedType, Class<?>[] expectedParamTypes, Object[] expectedParams)
+ {
+ ELContext context = createELContext();
+ Object object = EXPRESSION_FACTORY.createMethodExpression(context, expression, expectedType, expectedParamTypes).invoke(context, expectedParams);
+
+ return (T)object;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T> T evaluateValueExpression(String expression, Class<T> expectedType)
+ {
+ ELContext context = createELContext();
+ Object object = EXPRESSION_FACTORY.createValueExpression(context, expression, expectedType).getValue(context);
+
+ return (T)object;
+ }
+
+ @Override
+ public ELContext createELContext()
+ {
+ ELContext context = new ELContextImpl();
+
+ return context;
+ }
+}
diff --git a/owb_1.2.x/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/ManagersImpl.java b/owb_1.2.x/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/ManagersImpl.java
new file mode 100644
index 0000000..3ff588c
--- /dev/null
+++ b/owb_1.2.x/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/ManagersImpl.java
@@ -0,0 +1,46 @@
+/*
+ * 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.webbeans.test.tck;
+
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.InjectableBeanManager;
+import org.jboss.jsr299.tck.spi.Managers;
+
+public class ManagersImpl implements Managers
+{
+ private static volatile InjectableBeanManager beanManager;
+
+ public static void cleanUp()
+ {
+ beanManager = null;
+ }
+
+ @Override
+ public BeanManager getManager()
+ {
+ if(beanManager == null)
+ {
+ beanManager = new InjectableBeanManager(WebBeansContext.getInstance().getBeanManagerImpl());
+ }
+
+ return beanManager;
+ }
+}
diff --git a/owb_1.2.x/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/OwbTckElResolver.java b/owb_1.2.x/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/OwbTckElResolver.java
new file mode 100644
index 0000000..59997d5
--- /dev/null
+++ b/owb_1.2.x/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/OwbTckElResolver.java
@@ -0,0 +1,97 @@
+/*
+ * 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.webbeans.test.tck;
+
+import java.util.Set;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.PropertyNotFoundException;
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.spi.Bean;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.el.ELContextStore;
+import org.apache.webbeans.el22.WebBeansELResolver;
+
+/**
+ * Exist for TCK standalone EL resolver.
+ * <p>
+ * In standalone case, there is no JSF
+ * related artifacts, therefore {@link WebBeansELResolver}
+ * does not work.
+ * </p>
+ */
+public class OwbTckElResolver extends WebBeansELResolver
+{
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @SuppressWarnings({"unchecked"})
+ public Object getValue(ELContext context, Object obj, Object property) throws NullPointerException, PropertyNotFoundException, ELException
+ {
+ //Bean instance
+ Object contextualInstance = null;
+ ELContextStore elContextStore = null;
+ if (obj == null)
+ {
+ //Name of the bean
+ String name = (String) property;
+ //Local store, create if not exist
+ elContextStore = ELContextStore.getInstance(true);
+
+ contextualInstance = elContextStore.findBeanByName(name);
+
+ if(contextualInstance != null)
+ {
+ context.setPropertyResolved(true);
+
+ return contextualInstance;
+ }
+
+ //Manager instance
+ BeanManagerImpl manager = WebBeansContext.getInstance().getBeanManagerImpl();
+
+ //Get beans
+ Set<Bean<?>> beans = manager.getBeans(name);
+
+ //Found?
+ if(beans != null && !beans.isEmpty())
+ {
+ //Managed bean
+ Bean<Object> bean = (Bean<Object>)beans.iterator().next();
+
+ if(bean.getScope().equals(Dependent.class))
+ {
+ contextualInstance = getDependentContextualInstance(manager, elContextStore, context, bean);
+ }
+ else
+ {
+ // now we check for NormalScoped beans
+ contextualInstance = getNormalScopedContextualInstance(manager, elContextStore, context, bean, name);
+ }
+ }
+ }
+
+ return contextualInstance;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/StandaloneContainersImpl.java b/owb_1.2.x/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/StandaloneContainersImpl.java
new file mode 100644
index 0000000..4116d94
--- /dev/null
+++ b/owb_1.2.x/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/StandaloneContainersImpl.java
@@ -0,0 +1,269 @@
+/*
+ * 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.webbeans.test.tck;
+
+import java.net.URL;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.ejb.Singleton;
+import javax.ejb.Stateful;
+import javax.ejb.Stateless;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import org.apache.openejb.assembler.classic.Assembler;
+import org.apache.openejb.assembler.classic.EjbJarInfo;
+import org.apache.openejb.assembler.classic.ProxyFactoryInfo;
+import org.apache.openejb.assembler.classic.SecurityServiceInfo;
+import org.apache.openejb.assembler.classic.SingletonSessionContainerInfo;
+import org.apache.openejb.assembler.classic.StatefulSessionContainerInfo;
+import org.apache.openejb.assembler.classic.StatelessSessionContainerInfo;
+import org.apache.openejb.assembler.classic.TransactionServiceInfo;
+import org.apache.openejb.config.ConfigurationFactory;
+import org.apache.openejb.config.EjbModule;
+import org.apache.openejb.core.ivm.naming.InitContextFactory;
+import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.jee.SingletonBean;
+import org.apache.openejb.jee.StatefulBean;
+import org.apache.openejb.jee.StatelessBean;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.lifecycle.StandaloneLifeCycle;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.test.tck.mock.TCKMetaDataDiscoveryImpl;
+import org.jboss.testharness.api.DeploymentException;
+import org.jboss.testharness.spi.StandaloneContainers;
+
+public class StandaloneContainersImpl implements StandaloneContainers
+{
+ /**Logger instance*/
+ protected final Logger logger = WebBeansLoggerFacade.getLogger(StandaloneContainersImpl.class);
+
+ protected StandaloneLifeCycle lifeCycle = null;
+
+ protected DeploymentException excpetion;
+
+ public void deployInternal(Iterable<Class<?>> classes) throws DeploymentException
+ {
+ // Scanner service
+ final TCKMetaDataDiscoveryImpl discovery = (TCKMetaDataDiscoveryImpl) WebBeansContext.getInstance().getScannerService();
+
+ // Lifecycle container
+ this.lifeCycle = new StandaloneLifeCycle()
+ {
+ @Override
+ protected void afterInitApplication(Properties event)
+ {
+ this.scannerService = discovery;
+ }
+ };
+
+ try
+ {
+ Iterator<Class<?>> it = classes.iterator();
+ while (it.hasNext())
+ {
+ discovery.addBeanClass(it.next());
+ }
+
+ this.lifeCycle.startApplication(null);
+
+ }
+ catch (Exception e)
+ {
+ logger.log(Level.SEVERE, "Standalone Container Impl.", e);
+ this.excpetion = new DeploymentException("Standalone Container Impl.", e);
+ throw this.excpetion;
+ }
+
+ }
+
+ public boolean deployInternal(Iterable<Class<?>> classes, Iterable<URL> beansXmls)
+ {
+ try
+ {
+ final TCKMetaDataDiscoveryImpl discovery = (TCKMetaDataDiscoveryImpl) WebBeansContext.getInstance().getScannerService();
+
+ // Lifecycle container
+ this.lifeCycle = new StandaloneLifeCycle()
+ {
+ @Override
+ protected void afterInitApplication(Properties event)
+ {
+ this.scannerService = discovery;
+ }
+ };
+
+ Iterator<Class<?>> it = classes.iterator();
+ while (it.hasNext())
+ {
+ discovery.addBeanClass(it.next());
+ }
+
+ Iterator<URL> itUrl = beansXmls.iterator();
+ while (itUrl.hasNext())
+ {
+ discovery.addBeanXml(itUrl.next());
+ }
+
+ this.lifeCycle.startApplication(null);
+ }
+ catch (Exception e)
+ {
+ logger.log(Level.SEVERE, "Standalone Container Impl.", e);
+ this.excpetion = new DeploymentException("Standalone Container Impl.", e);
+
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public void setup()
+ {
+
+ }
+
+ @Override
+ public void cleanup()
+ {
+
+ }
+
+ @Override
+ public void undeploy()
+ {
+ try
+ {
+ this.lifeCycle.stopApplication(null);
+ this.lifeCycle = null;
+ }
+ finally
+ {
+ ManagersImpl.cleanUp();
+ }
+ }
+
+ @Override
+ public DeploymentException getDeploymentException()
+ {
+ return this.excpetion;
+ }
+
+ @Override
+ public void deploy(Collection<Class<?>> classes) throws DeploymentException
+ {
+ setUp(classes);
+ deployInternal(classes);
+ }
+
+ @Override
+ public boolean deploy(Collection<Class<?>> classes, Collection<URL> xmls)
+ {
+ if (!setUp(classes))
+ {
+ return false;
+ }
+
+ return deployInternal(classes, xmls);
+ }
+
+ /**
+ * @param classes
+ * @return <code>true</code> if the setup succeed, <code>false</code> otherwise.
+ */
+ private boolean setUp(Collection<Class<?>> classes)
+ {
+
+ try
+ {
+ ConfigurationFactory config = new ConfigurationFactory();
+ Assembler assembler = new Assembler();
+
+ assembler.createProxyFactory(config.configureService(ProxyFactoryInfo.class));
+ assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
+ assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
+
+ assembler.createContainer(config.configureService(StatelessSessionContainerInfo.class));
+ assembler.createContainer(config.configureService(StatefulSessionContainerInfo.class));
+ assembler.createContainer(config.configureService(SingletonSessionContainerInfo.class));
+
+ EjbJarInfo ejbJar = config.configureApplication(buildTestApp(classes));
+
+ assembler.createApplication(ejbJar);
+
+ System.setProperty("openejb.validation.output.level", "VERBOSE");
+ Properties properties = new Properties(System.getProperties());
+ properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, InitContextFactory.class.getName());
+ new InitialContext(properties);
+ }
+ catch (Exception e)
+ {
+ logger.log(Level.SEVERE, "Standalone Container Impl.", e);
+ return false;
+ }
+
+ return true;
+ }
+
+ private EjbModule buildTestApp(Collection<Class<?>> classes)
+ {
+ EjbJar ejbJar = new EjbJar();
+ ejbJar.setId(this.getClass().getName());
+
+ for (Class<?> clazz : classes)
+ {
+ if (isSingleton(clazz))
+ {
+ ejbJar.addEnterpriseBean(new SingletonBean(clazz));
+ }
+ if (isStateless(clazz))
+ {
+ ejbJar.addEnterpriseBean(new StatelessBean(clazz));
+ }
+
+ if (isStatefull(clazz))
+ {
+ ejbJar.addEnterpriseBean(new StatefulBean(clazz));
+ }
+ }
+
+ return new EjbModule(ejbJar);
+
+ }
+
+ private boolean isSingleton(Class<?> clazz)
+ {
+ return clazz.isAnnotationPresent(Singleton.class) ? true : false;
+ }
+
+ private boolean isStateless(Class<?> clazz)
+ {
+ return clazz.isAnnotationPresent(Stateless.class) ? true : false;
+ }
+
+ private boolean isStatefull(Class<?> clazz)
+ {
+ return clazz.isAnnotationPresent(Stateful.class) ? true : false;
+ }
+}
diff --git a/owb_1.2.x/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/TomcatConnector.java b/owb_1.2.x/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/TomcatConnector.java
new file mode 100644
index 0000000..d8ccce7
--- /dev/null
+++ b/owb_1.2.x/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/TomcatConnector.java
@@ -0,0 +1,176 @@
+/*
+ * 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.webbeans.test.tck;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.commons.httpclient.Credentials;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.UsernamePasswordCredentials;
+import org.apache.commons.httpclient.auth.AuthScope;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
+import org.apache.commons.httpclient.methods.PutMethod;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.jboss.testharness.api.DeploymentException;
+import org.jboss.testharness.spi.Containers;
+import org.jboss.testharness.spi.helpers.AbstractContainerConnector;
+
+//NOTE : This code is copied from RI TCK. We have to extend
+//this class but its jar file contains jboss-test-harness.properties
+//that conflict with our provided jboss-test-harness.properties. therefore
+//we remove jar from dependency and copied this class and extends it with
+//our own version.
+public class TomcatConnector extends AbstractContainerConnector implements Containers
+{
+
+ private Logger logger = WebBeansLoggerFacade.getLogger(TomcatConnector.class);
+
+ private static final String SERVER_HOME_PROPERTY_NAME = "tomcat.home";
+
+ private String binDirectory;
+ private final File tmpdir;
+ private final HttpClient client;
+
+ private DeploymentException deploymentException;
+
+ public TomcatConnector() throws IOException
+ {
+ logger.log(Level.INFO, "You must add the the tests/secret user to Tomcat, for example, in $CATALINA_BASE/conf/tomcat-users.xml add " +
+ "<user name=\"tests\" password=\"secret\" roles=\"standard,manager\" />");
+ tmpdir = new File(System.getProperty("java.io.tmpdir"), "org.jboss.webbeans.tck.integration.jbossas");
+ tmpdir.mkdir();
+ tmpdir.deleteOnExit();
+ client = new HttpClient();
+ client.getParams().setAuthenticationPreemptive(true);
+ Credentials credentials = new UsernamePasswordCredentials("tests", "secret");
+ client.getState().setCredentials(new AuthScope(null, 8080, null), credentials);
+ }
+
+ @Override
+ protected String getServerHomePropertyName()
+ {
+ return SERVER_HOME_PROPERTY_NAME;
+ }
+
+ @Override
+ protected void shutdownServer() throws IOException
+ {
+ launch(getBinDirectory(), "shutdown", "");
+ }
+
+ @Override
+ protected void startServer() throws IOException
+ {
+ launch(getBinDirectory(), "startup", "");
+ }
+
+ protected String getBinDirectory()
+ {
+ if (binDirectory == null)
+ {
+ binDirectory = new File(getServerDirectory() + "/bin").getPath();
+ }
+ return binDirectory;
+ }
+
+ @Override
+ protected String getLogName()
+ {
+ return "tomcat.log";
+ }
+
+ @Override
+ public boolean deploy(InputStream stream, String name) throws IOException
+ {
+ String deployUrl = getManagerUrl("deploy", "path=/" + getContextName(name), "update=true");
+ PutMethod put = new PutMethod(deployUrl);
+ put.setRequestEntity(new InputStreamRequestEntity(stream));
+ try
+ {
+ int status = client.executeMethod(put);
+ if (status != HttpURLConnection.HTTP_OK)
+ {
+ deploymentException = getDeploymentExceptionTransformer().transform(new DeploymentException(new String(put.getResponseBody())));
+ return false;
+ }
+ return true;
+ }
+ finally
+ {
+ put.releaseConnection();
+ }
+ }
+
+ @Override
+ public DeploymentException getDeploymentException()
+ {
+ return deploymentException;
+ }
+
+ @Override
+ public void undeploy(String name) throws IOException
+ {
+ String deployUrl = getManagerUrl("undeploy", "path=/" + getContextName(name));
+ HttpMethod get = new GetMethod(deployUrl);
+ try
+ {
+ int status = client.executeMethod(get);
+ if (status != HttpURLConnection.HTTP_OK)
+ {
+ throw new IllegalStateException(new String(get.getResponseBody()));
+ }
+ }
+ finally
+ {
+ get.releaseConnection();
+ ManagersImpl.cleanUp();
+ }
+ }
+
+ protected String getManagerUrl(String command, String... parameters)
+ {
+ String url = getHttpUrl() + "manager/" + command ;
+ for (int i = 0; i < parameters.length; i ++)
+ {
+ String parameter = parameters[i];
+ if (i == 0)
+ {
+ url += "?" + parameter;
+ }
+ else
+ {
+ url += "&" + parameter;
+ }
+ }
+ return url;
+ }
+
+ protected String getContextName(String name)
+ {
+ return name.substring(0, name.length() - 4);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/mock/TCKMetaDataDiscoveryImpl.java b/owb_1.2.x/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/mock/TCKMetaDataDiscoveryImpl.java
new file mode 100644
index 0000000..229a5c6
--- /dev/null
+++ b/owb_1.2.x/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/mock/TCKMetaDataDiscoveryImpl.java
@@ -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.webbeans.test.tck.mock;
+
+import org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery;
+import org.apache.webbeans.corespi.scanner.xbean.CdiArchive;
+import org.apache.webbeans.util.Asserts;
+import org.apache.xbean.finder.AnnotationFinder;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+
+public class TCKMetaDataDiscoveryImpl extends AbstractMetaDataDiscovery
+{
+ private Collection<Class<?>> classes = new ArrayList<Class<?>>();
+
+ public TCKMetaDataDiscoveryImpl()
+ {
+ super();
+ }
+
+ @Override
+ protected void configure()
+ {
+ }
+
+ @Override
+ protected AnnotationFinder initFinder()
+ {
+ if (finder != null)
+ {
+ return finder;
+ }
+
+ archive = new CdiArchive(classes);
+ finder = new AnnotationFinder(archive);
+ return finder;
+ }
+
+ public void addBeanClass(Class<?> clazz)
+ {
+ classes.add(clazz);
+ }
+
+ public void addBeanXml(URL url)
+ {
+ Asserts.assertNotNull(url);
+ addWebBeansXmlLocation(url);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-porting/src/main/resources/META-INF/jboss-test-harness.properties b/owb_1.2.x/webbeans-porting/src/main/resources/META-INF/jboss-test-harness.properties
new file mode 100644
index 0000000..8644e7b
--- /dev/null
+++ b/owb_1.2.x/webbeans-porting/src/main/resources/META-INF/jboss-test-harness.properties
@@ -0,0 +1,27 @@
+#Licensed to the Apache Software Foundation (ASF) under one
+#or more contributor license agreements. See the NOTICE file
+#distributed with this work for additional information
+#regarding copyright ownership. The ASF licenses this file
+#to you under the Apache License, Version 2.0 (the
+#"License"); you may not use this file except in compliance
+#with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+#Unless required by applicable law or agreed to in writing,
+#software distributed under the License is distributed on an
+#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#KIND, either express or implied. See the License for the
+#specific language governing permissions and limitations
+#under the License.
+
+org.jboss.jsr299.tck.spi.Managers=org.apache.webbeans.test.tck.ManagersImpl
+org.jboss.jsr299.tck.spi.Beans=org.apache.webbeans.test.tck.BeansImpl
+org.jboss.jsr299.tck.spi.Contexts=org.apache.webbeans.test.tck.ContextsImpl
+org.jboss.jsr299.tck.spi.EL=org.apache.webbeans.test.tck.ELImpl
+org.jboss.testharness.spi.StandaloneContainers=org.apache.webbeans.test.tck.StandaloneContainersImpl
+
+#org.jboss.testharness.standalone=true
+#org.jboss.testharness.runIntegrationTests=false
+
+#org.jboss.testharness.api.TestLauncher=org.jboss.testharness.impl.runner.servlet.ServletTestLauncher
diff --git a/owb_1.2.x/webbeans-porting/src/site/site.xml b/owb_1.2.x/webbeans-porting/src/site/site.xml
new file mode 100644
index 0000000..aaa593b
--- /dev/null
+++ b/owb_1.2.x/webbeans-porting/src/site/site.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<project name="OpenWebBeans">
+ <bannerLeft>
+ <name>Apache OpenWebBeans</name>
+ <src>http://openwebbeans.apache.org/owb/images/logos/openwebbeans_hor.png</src>
+ <href>http://openwebbeans.apache.org</href>
+ </bannerLeft>
+
+ <bannerRight>
+ <name>Apache Banner</name>
+ <src>http://www.apache.org/images/asf-logo.gif</src>
+ <href>http://www.apache.org</href>
+ </bannerRight>
+
+ <publishDate format="dd MMM yyyy" />
+ <version position="left"/>
+
+ <body>
+ <menu ref="reports"/>
+ </body>
+</project>
+
diff --git a/owb_1.2.x/webbeans-resource/pom.xml b/owb_1.2.x/webbeans-resource/pom.xml
new file mode 100644
index 0000000..098b7aa
--- /dev/null
+++ b/owb_1.2.x/webbeans-resource/pom.xml
@@ -0,0 +1,67 @@
+<?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.
+-->
+
+<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>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>1.2.5</version>
+ </parent>
+ <artifactId>openwebbeans-resource</artifactId>
+ <name>EE Resource plugin</name>
+ <description>Apache OpenWebBeans EE Resource Integration</description>
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jpa_2.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+
+
+</project>
diff --git a/owb_1.2.x/webbeans-resource/src/main/java/org/apache/webbeans/resource/spi/se/StandaloneResourceInjectionService.java b/owb_1.2.x/webbeans-resource/src/main/java/org/apache/webbeans/resource/spi/se/StandaloneResourceInjectionService.java
new file mode 100644
index 0000000..8bda174
--- /dev/null
+++ b/owb_1.2.x/webbeans-resource/src/main/java/org/apache/webbeans/resource/spi/se/StandaloneResourceInjectionService.java
@@ -0,0 +1,246 @@
+/*
+ * 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.webbeans.resource.spi.se;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.text.MessageFormat;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.annotation.Resource;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.Bean;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceUnit;
+import javax.xml.ws.WebServiceRef;
+
+import org.apache.webbeans.component.ResourceBean;
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.spi.FailOverService;
+import org.apache.webbeans.spi.ResourceInjectionService;
+import org.apache.webbeans.spi.api.ResourceReference;
+import org.apache.webbeans.util.AnnotationUtil;
+
+public class StandaloneResourceInjectionService implements ResourceInjectionService
+{
+ /**
+ * When ResourceProxyHandler deserialized, this will instruct owb to create a new actual instance, if
+ * the actual resource is not serializable.
+ */
+ private static final String DUMMY_STRING = "owb.actual.resource.dummy";
+
+ private final StandaloneResourceProcessor processor = StandaloneResourceProcessor.getProcessor();
+
+ private static final Logger logger = WebBeansLoggerFacade.getLogger(StandaloneResourceInjectionService.class);
+
+ private final WebBeansContext webBeansContext;
+
+ /**
+ * Cache the information if a certain class contains any EE resource at all
+ */
+ private final Map<Class<?>, Boolean> classContainsEEResources = new ConcurrentHashMap<Class<?>, Boolean>();
+
+ public StandaloneResourceInjectionService(WebBeansContext webBeansContext)
+ {
+ this.webBeansContext = webBeansContext;
+ }
+
+ protected WebBeansContext getWebBeansContext()
+ {
+ return webBeansContext;
+ }
+
+ @Override
+ public <X, T extends Annotation> X getResourceReference(ResourceReference<X, T> resourceReference)
+ {
+ if(resourceReference.supports(Resource.class))
+ {
+ Resource resource = resourceReference.getAnnotation(Resource.class);
+ return processor.getResource(resource, resourceReference.getResourceType());
+ }
+
+ if(resourceReference.supports(WebServiceRef.class))
+ {
+ WebServiceRef resource = resourceReference.getAnnotation(WebServiceRef.class);
+ return processor.getWebServiceResource(resource, resourceReference.getResourceType());
+
+ }
+
+ if(resourceReference.supports(PersistenceContext.class))
+ {
+ PersistenceContext persistenceContext = resourceReference.getAnnotation(PersistenceContext.class);
+ return processor.getEntityManager(persistenceContext, resourceReference.getResourceType());
+ }
+
+ if(resourceReference.supports(PersistenceUnit.class))
+ {
+ PersistenceUnit persistenceUnit = resourceReference.getAnnotation(PersistenceUnit.class);
+ return processor.getEntityManagerFactory(persistenceUnit, resourceReference.getResourceType());
+ }
+
+ return null;
+ }
+
+ @Override
+ public void injectJavaEEResources(Object managedBeanInstance)
+ {
+ Class currentClass = managedBeanInstance.getClass();
+ Boolean containsEeResource = classContainsEEResources.get(currentClass);
+ if (containsEeResource != null && !containsEeResource)
+ {
+ // nothing to do it seems.
+ return;
+ }
+
+
+ while (currentClass != null && !Object.class.getName().equals(currentClass.getName()))
+ {
+ Field[] fields = webBeansContext.getSecurityService().doPrivilegedGetDeclaredFields(currentClass);
+
+ for(Field field : fields)
+ {
+ if(!field.isAnnotationPresent(Produces.class))
+ {
+ if(!Modifier.isStatic(field.getModifiers()))
+ {
+ Annotation ann = AnnotationUtil.hasOwbInjectableResource(field.getDeclaredAnnotations());
+ if(ann != null)
+ {
+ @SuppressWarnings("unchecked")
+ ResourceReference<Object, ?> resourceRef = new ResourceReference(field.getDeclaringClass(), field.getName(), field.getType(), ann);
+ try
+ {
+ Object resourceToInject = getResourceReference(resourceRef);
+ if (resourceToInject != null)
+ {
+ if(!field.isAccessible())
+ {
+ webBeansContext.getSecurityService().doPrivilegedSetAccessible(field, true);
+ }
+
+ field.set(managedBeanInstance, resourceToInject);
+ }
+
+ containsEeResource = Boolean.TRUE;
+ }
+ catch(Exception e)
+ {
+ logger.log(Level.SEVERE, WebBeansLoggerFacade.constructMessage(OWBLogConst.ERROR_0025, e, field));
+ throw new WebBeansException(MessageFormat.format(WebBeansLoggerFacade.getTokenString(OWBLogConst.ERROR_0025), field), e);
+ }
+ }
+ }
+ }
+ }
+
+ currentClass = currentClass.getSuperclass();
+ }
+
+ if (containsEeResource == null)
+ {
+ containsEeResource = Boolean.FALSE;
+ }
+
+ classContainsEEResources.put(managedBeanInstance.getClass(), containsEeResource);
+ }
+
+ @Override
+ public void clear()
+ {
+ processor.clear();
+ }
+
+ /**
+ * delegation of serialization behavior
+ */
+ @Override
+ public <T> void writeExternal(Bean<T> bean, T actualResource, ObjectOutput out) throws IOException
+ {
+ // try fail over service to serialize the resource object
+ FailOverService failoverService = webBeansContext.getService(FailOverService.class);
+ if (failoverService != null)
+ {
+ Object ret = failoverService.handleResource(bean, actualResource, null, out);
+ if (ret != FailOverService.NOT_HANDLED)
+ {
+ return;
+ }
+ }
+
+ // default behavior
+ if (actualResource instanceof Serializable)
+ {
+ // for remote ejb stub and other serializable resources
+ out.writeObject(actualResource);
+ }
+ else
+ {
+ // otherwise, write a dummy string.
+ out.writeObject(DUMMY_STRING);
+ }
+
+ }
+
+ /**
+ * delegation of serialization behavior
+ */
+ @Override
+ public <T> T readExternal(Bean<T> bean, ObjectInput in) throws IOException,
+ ClassNotFoundException
+ {
+ T actualResource = null;
+ // try fail over service to serialize the resource object
+ FailOverService failoverService = webBeansContext.getService(FailOverService.class);
+ if (failoverService != null)
+ {
+ actualResource = (T) failoverService.handleResource(bean, actualResource, in, null);
+ if (actualResource != FailOverService.NOT_HANDLED)
+ {
+ return actualResource;
+ }
+ }
+
+ // default behavior
+ actualResource = (T) in.readObject();
+ if (actualResource instanceof javax.rmi.CORBA.Stub)
+ {
+ // for remote ejb stub, reconnect after deserialization.
+ org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(new String[0], null);
+ ((javax.rmi.CORBA.Stub)actualResource).connect(orb);
+ }
+ else if (actualResource.equals(DUMMY_STRING))
+ {
+ actualResource = (T) ((ResourceBean)bean).getActualInstance();
+ }
+ return actualResource;
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-resource/src/main/java/org/apache/webbeans/resource/spi/se/StandaloneResourceProcessor.java b/owb_1.2.x/webbeans-resource/src/main/java/org/apache/webbeans/resource/spi/se/StandaloneResourceProcessor.java
new file mode 100644
index 0000000..78d2ce5
--- /dev/null
+++ b/owb_1.2.x/webbeans-resource/src/main/java/org/apache/webbeans/resource/spi/se/StandaloneResourceProcessor.java
@@ -0,0 +1,179 @@
+/*
+ * 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.webbeans.resource.spi.se;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.annotation.Resource;
+import javax.naming.InitialContext;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceUnit;
+import javax.xml.ws.WebServiceRef;
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+
+public class StandaloneResourceProcessor
+{
+ private static InitialContext context = null;
+
+ private static Logger logger = WebBeansLoggerFacade.getLogger(StandaloneResourceProcessor.class);
+
+ private static StandaloneResourceProcessor processor = new StandaloneResourceProcessor();
+
+ /**
+ * A cache for EntityManagerFactories.
+ */
+ private Map<String, EntityManagerFactory> factoryCache = new ConcurrentHashMap<String, EntityManagerFactory>();
+
+ static
+ {
+ try
+ {
+ context = new InitialContext();
+
+ }
+ catch(Exception e)
+ {
+ throw new ExceptionInInitializerError(e);
+ }
+ }
+
+ public static StandaloneResourceProcessor getProcessor()
+ {
+ return processor;
+ }
+
+ public <X> X getEntityManager(PersistenceContext persistenceContext, Class<X> clazz)
+ {
+ EntityManager obj = getPersistenceContext(persistenceContext.unitName());
+ if (obj == null)
+ {
+ logger.log(Level.WARNING, WebBeansLoggerFacade.constructMessage(OWBLogConst.WARN_0014, "@PersistenceContext", persistenceContext.unitName()));
+ }
+
+ return clazz.cast(obj);
+ }
+
+ public <X> X getEntityManagerFactory(PersistenceUnit persistenceUnit, Class<X> clazz)
+ {
+ EntityManagerFactory factory = getPersistenceUnit(persistenceUnit.unitName());
+ if (factory == null)
+ {
+ logger.log(Level.WARNING, WebBeansLoggerFacade.constructMessage(OWBLogConst.WARN_0014, "@PersistenceUnit", persistenceUnit.unitName()));
+ }
+
+ return clazz.cast(factory);
+ }
+
+ public <X> X getResource(Resource resource, Class<X> resourceType)
+ {
+ Object obj = null;
+ try
+ {
+ obj = context.lookup("java:/comp/env/"+ resource.name());
+ if (obj == null)
+ {
+ logger.log(Level.WARNING, WebBeansLoggerFacade.constructMessage(OWBLogConst.WARN_0014, "@Resource", resource.name()));
+ }
+
+ }
+ catch(Exception e)
+ {
+ logger.log(Level.SEVERE, WebBeansLoggerFacade.constructMessage(OWBLogConst.ERROR_0001, resource));
+ }
+
+ return resourceType.cast(obj);
+ }
+
+ public <X> X getWebServiceResource(WebServiceRef resource, Class<X> resourceType)
+ {
+ Object obj = null;
+ try
+ {
+ obj = context.lookup("java:/comp/env/"+ resource.name());
+ if (obj == null)
+ {
+ logger.log(Level.WARNING, WebBeansLoggerFacade.constructMessage(OWBLogConst.WARN_0014, "@WebServiceRef", resource.name()));
+ }
+
+ }
+ catch(Exception e)
+ {
+ logger.log(Level.SEVERE, WebBeansLoggerFacade.constructMessage(OWBLogConst.ERROR_0001, resource));
+ }
+
+ return resourceType.cast(obj);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ */
+ private EntityManagerFactory getPersistenceUnit(String unitName)
+ {
+ if(factoryCache.get(unitName) != null)
+ {
+ return factoryCache.get(unitName);
+ }
+
+ EntityManagerFactory emf = Persistence.createEntityManagerFactory(unitName);
+ factoryCache.put(unitName, emf);
+
+ return emf;
+ }
+
+ /**
+ * TODO: currently this returns an extended EntityManager, so we have to wrap it
+ * We have to create a Proxy for injecting entity managers. So, whenever method is called
+ * on the entity managers, look at current Transaction, if exist call joinTransaction();
+ */
+ private EntityManager getPersistenceContext(String unitName)
+ {
+ EntityManagerFactory emf = getPersistenceUnit(unitName);
+ EntityManager em = emf.createEntityManager();
+
+ return em;
+ }
+
+ public void clear()
+ {
+ Set<String> keys = this.factoryCache.keySet();
+ for(String key : keys)
+ {
+ EntityManagerFactory factory = this.factoryCache.get(key);
+ try
+ {
+ factory.close();
+
+ }
+ catch(Exception e)
+ {
+ logger.log(Level.WARNING, WebBeansLoggerFacade.constructMessage(OWBLogConst.WARN_0006, e, key));
+ }
+ }
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-resource/src/main/resources/META-INF/openwebbeans/openwebbeans.properties b/owb_1.2.x/webbeans-resource/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
new file mode 100644
index 0000000..4a2b4ef
--- /dev/null
+++ b/owb_1.2.x/webbeans-resource/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
@@ -0,0 +1,30 @@
+#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.
+#---------------------------------------------------------------
+# The configuration for OpenWebBeans Web container integration
+#---------------------------------------------------------------
+
+################################################################################################
+############################# Resource Plugin SPI CONFIGURATION SECTION ########################
+################################################################################################
+
+configuration.ordinal=10
+
+################################### Default Resource Injection Service #########################
+#Default implementation of org.apache.webbeans.corespi.ResourceInjectionService
+org.apache.webbeans.spi.ResourceInjectionService=org.apache.webbeans.resource.spi.se.StandaloneResourceInjectionService
+################################################################################################
diff --git a/owb_1.2.x/webbeans-resource/src/site/site.xml b/owb_1.2.x/webbeans-resource/src/site/site.xml
new file mode 100644
index 0000000..166aea8
--- /dev/null
+++ b/owb_1.2.x/webbeans-resource/src/site/site.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<project name="OpenWebBeans">
+ <bannerLeft>
+ <name>Apache OpenWebBeans</name>
+ <src>http://openwebbeans.apache.org/owb/images/logos/openwebbeans_hor.png</src>
+ <href>http://openwebbeans.apache.org</href>
+ </bannerLeft>
+
+ <bannerRight>
+ <name>Apache Banner</name>
+ <src>http://www.apache.org/images/asf-logo.gif</src>
+ <href>http://www.apache.org</href>
+ </bannerRight>
+
+ <publishDate format="dd MMM yyyy" />
+ <version position="left"/>
+
+ <body>
+ <breadcrumbs>
+ <item name="Apache" href="http://www.apache.org"/>
+ <item name="OpenWebBeans" href="http://openwebbeans.apache.org"/>
+ <item name="OWB-Resource" href="http://openwebbeans.apache.org/${project.version}/openwebbeans-resource"/>
+ </breadcrumbs>
+
+ <menu ref="reports"/>
+ </body>
+</project>
+
diff --git a/owb_1.2.x/webbeans-spi/pom.xml b/owb_1.2.x/webbeans-spi/pom.xml
new file mode 100644
index 0000000..32db986
--- /dev/null
+++ b/owb_1.2.x/webbeans-spi/pom.xml
@@ -0,0 +1,71 @@
+<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">
+<!--
+
+ 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.
+-->
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>1.2.5</version>
+ </parent>
+
+ <artifactId>openwebbeans-spi</artifactId>
+ <name>SPI definition</name>
+ <description>Apache OpenWebBeans Service Provider Interfaces</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-el_2.2_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_2.5_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jta_1.1_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-validation_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/BDABeansXmlScanner.java b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/BDABeansXmlScanner.java
new file mode 100644
index 0000000..8a99213
--- /dev/null
+++ b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/BDABeansXmlScanner.java
@@ -0,0 +1,116 @@
+/*
+ * 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.webbeans.spi;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+/**
+ * due to a file-url issue it isn't compatible with wls (see OWB-519)
+ */
+public interface BDABeansXmlScanner
+{
+
+ /**
+ * Stores the beans.xml an Interceptor class is defined in
+ *
+ * @return T - Interceptor class successfully stored; F - Interceptor class
+ * already exists and was not stored.
+ */
+ public boolean addInterceptor(Class<?> interceptorClass,
+ String beansXMLFilePath);
+
+ /**
+ *
+ * @param beansXMLFilePath
+ * @return a non-null set of Interceptors defined by the specified
+ * beansXMLFilePath
+ */
+ public Set<Class<?>> getInterceptors(String beansXMLFilePath);
+
+ /**
+ *
+ * @param beansXMLFilePath
+ * @return a non-null set of Decorators defined by the specified
+ * beansXMLFilePath
+ */
+ public Set<Class<?>> getDecorators(String beansXMLFilePath);
+
+ /**
+ * Stores the beans.xml a Decorator class is defined in
+ *
+ * @return T - Decorator class successfully stored; F - Decorator class
+ * already exists and was not stored.
+ */
+ public boolean addDecorator(Class<?> decoratorClass, String beansXMLFilePath);
+
+ /**
+ * Stores the beans.xml an Alternative class is defined in
+ *
+ * @return T - Alternative class successfully stored; F - Alternative class
+ * already exists and was not stored.
+ */
+ public boolean addAlternative(Class<?> alternativeClass,
+ String beansXMLFilePath);
+
+ /**
+ * Stores the beans.xml a Stereotype class is defined in
+ *
+ * @return T - Stereotype class successfully stored; F - Stereotype class
+ * already exists and was not stored.
+ */
+ public boolean addStereoType(Class<? extends Annotation> stereoTypeClass,
+ String beansXMLFilePath);
+
+ /**
+ *
+ * @param beansXMLFilePath
+ * @return a non-null set of Alternatives defined by the specified
+ * beansXMLFilePath
+ */
+ public Set<Class<?>> getAlternatives(String beansXMLFilePath);
+
+ /**
+ *
+ * @param beansXMLFilePath
+ * @return a non-null set of Stereotypes defined by the specified
+ * beansXMLFilePath
+ */
+ public Set<Class<? extends Annotation>> getStereotypes(
+ String beansXMLFilePath);
+
+ /**
+ *
+ * @param class1
+ * deployed class
+ * @return A String representing the file path to the beans.xml of the
+ * specified class's BDA
+ */
+ public String getBeansXml(Class<?> class1);
+
+ /**
+ *
+ * @param class1
+ * BDA class
+ * @param beansXmlFilePath
+ * - file path to beans.xml of BDA
+ */
+ public void setBeansXml(Class<?> class1, String beansXmlFilePath);
+
+}
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/ContainerLifecycle.java b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/ContainerLifecycle.java
new file mode 100644
index 0000000..c6b0c49
--- /dev/null
+++ b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/ContainerLifecycle.java
@@ -0,0 +1,103 @@
+/*
+ * 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.webbeans.spi;
+
+import java.util.Properties;
+
+import javax.enterprise.inject.spi.BeanManager;
+
+/**
+ * <h3>JSR-299 Container lifecycle.</h3>
+ * <p>
+ * Implement this interface to provide own container initialization logic.
+ * </p>
+ * <p>
+ * From the application point of view this interface can be used to start
+ * and stop OpenWebBeans.
+ * </p>
+ *
+ */
+public interface ContainerLifecycle
+{
+ /**
+ * Initialize lifecycle.
+ * <p>
+ * Implementors can configure their
+ * initialization specific actions here.
+ * </p>
+ * @param properties any properties
+ */
+ public void initApplication(Properties properties);
+
+ /**
+ * Starts container. It discovers all beans
+ * in the deployed application classpath.
+ * <p>
+ * For Java EE artifact deployment, it scans all classes
+ * and libraries in all deployment archives in the classpath.
+ * There are several types of deployment archives;
+ * <ul>
+ * <li>EAR archive</li>
+ * <li>EJB archive</li>
+ * <li>WAR archive</li>
+ * <li>RAR archive</li>
+ * <li>Application client archive. <b>OPTIONAL</b></li>
+ * </ul>
+ * </p>
+ *
+ * <p>
+ * Container uses {@link ScannerService} SPI for scanning archives
+ * and act accordingly. If there is an exception while starting,
+ * it must abort the deployment and provides information to the
+ * developer.
+ * </p>
+ *
+ * @param startupObject any startup object.
+ */
+ public void startApplication(Object startupObject);
+
+ /**
+ * <p>
+ * Stopping the Application means that the container destroys all bean instances
+ * it stores, cleans and removes all contexts and does other necessary
+ * cleanup actions.
+ * </p>
+ * <p>
+ * <b>Attention:</b> Accessing the BeanManager or any bean proxy after the shutdown
+ * will result in non-portable behaviour!
+ * </p>
+ * @param endObject any object provided by application implementor. This can be a ServletContext, etc
+ */
+ public void stopApplication(Object endObject);
+
+ /**
+ * Get the underlying {@link BeanManager} instance for the current application.
+ * There is 1-1 correspondence between a bean manager and a deployed (web-) application.
+ * @return deployment {@link BeanManager} instance
+ */
+ public BeanManager getBeanManager();
+
+ /**
+ * Gets container's context service implementation.
+ * This allows to manually start and end specific contexts.
+ *
+ * @return container contexts service
+ */
+ public ContextsService getContextService();
+}
diff --git a/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/ContextsService.java b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/ContextsService.java
new file mode 100644
index 0000000..676a679
--- /dev/null
+++ b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/ContextsService.java
@@ -0,0 +1,110 @@
+/*
+ * 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.webbeans.spi;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.context.ContextException;
+import javax.enterprise.context.spi.Context;
+
+/**
+ * Contexts services provides demarcation
+ * methods for each context that is defined
+ * in the specification. SPI providers implement
+ * related method that it supports.
+ *
+ * <p>
+ * For example, web container supports request, session
+ * conversation, application, singleton and dependent
+ * contexts.
+ * </p>
+ * @version $Rev$ $Date$
+ *
+ */
+public interface ContextsService
+{
+ /**
+ * Initialize container contexts service.
+ * @param initializeObject any initialize object
+ */
+ public void init(Object initializeObject);
+
+ /**
+ * Destroys container contexts service.
+ * @param destroyObject any destroy parameter
+ */
+ public void destroy(Object destroyObject);
+
+ /**
+ * Gets current context with given scope type with
+ * respect to the current thread of execution.
+ * <p>
+ * If there is not current context, it returns null.
+ * </p>
+ * @param scopeType context scope type
+ * @return current context with given scope type
+ */
+ public Context getCurrentContext(Class<? extends Annotation> scopeType);
+
+ /**
+ * If container supports the given scope type it returns
+ * true, otherwise it return false.
+ * @param scopeType scope type
+ * @return true if container supports given scope type false otherwise
+ */
+ public boolean supportsContext(Class<? extends Annotation> scopeType);
+
+ /**
+ * Starts the context with the given scope type. If
+ * given scope type is not supported, there is no action.
+ * @param scopeType scope type
+ * @param startParameter any parameter
+ * @throws ContextException if any exception thrown by starting context,
+ * it is wrapped inside {@link ContextException} and thrown.
+ */
+ public void startContext(Class<? extends Annotation> scopeType, Object startParameter) throws ContextException;
+
+ /**
+ * Ends the context with the given scope type. If
+ * given scope type is not supported, there is no action.
+ * Any exception thrown by the operation is catched and
+ * logged by the container.
+ * @param scopeType scope type
+ * @param endParameters any end parameter
+ */
+ public void endContext(Class<? extends Annotation> scopeType, Object endParameters);
+
+ /**
+ * Activate the context with the given scope type. If
+ * given scope type is not supported, there is no action.
+ * Any exception thrown by the operation is catched and
+ * logged by the container.
+ * @param scopeType scope type
+ */
+ public void activateContext(Class<? extends Annotation> scopeType);
+
+ /**
+ * Deactivates the context with the given scope type. If
+ * given scope type is not supported, there is no action.
+ * Any exception thrown by the operation is catched and
+ * logged by the container.
+ * @param scopeType scope type
+ */
+ public void deActivateContext(Class<? extends Annotation> scopeType);
+}
diff --git a/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/ConversationService.java b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/ConversationService.java
new file mode 100644
index 0000000..eba2c45
--- /dev/null
+++ b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/ConversationService.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.spi;
+
+/**
+ * Conversation related SPI.
+ * @version $Rev$ $Date$
+ */
+public interface ConversationService
+{
+ /**
+ * Gets the current conversation id or null
+ * if there is no conversation.
+ * @return the current conversation id
+ */
+ public String getConversationId();
+
+ /**
+ * Gets the session id of the current session.
+ * @return the session id of the current user session
+ */
+ public String getConversationSessionId();
+
+}
diff --git a/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/FailOverService.java b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/FailOverService.java
new file mode 100644
index 0000000..0de42e2
--- /dev/null
+++ b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/FailOverService.java
@@ -0,0 +1,148 @@
+/*
+ * 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.webbeans.spi;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.servlet.http.HttpSession;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.io.OutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+/**
+ * Container provided failover and passivation service.
+ */
+public interface FailOverService
+{
+ /**
+ * Used for tracking the origin of serialized bean instances.
+ *
+ * @return an UUID which is unique for each installation. This might change on restarts.
+ */
+ public String getJvmId();
+
+ /**
+ * @return Whether or not the system supports failover
+ */
+ public boolean isSupportFailOver();
+
+ /**
+ * @return Whether or not the system support passivation
+ */
+ public boolean isSupportPassivation();
+
+ /**
+ * Enable failover support.
+ *
+ * @param flag <code>true</code> to enable failover support
+ */
+ public void enableFailOverSupport(boolean flag);
+
+ /**
+ * Enable passivation support.
+ *
+ * @param flag <code>true</code> to enable passivation support
+ */
+ public void enablePassivationSupport(boolean flag);
+
+ /**
+ * Inform the service that a session is idle and that beans should be stored for fail over.
+ * Invoked when we finish a request.
+ *
+ * @param session The {@link HttpSession}.
+ */
+ public void sessionIsIdle(HttpSession session);
+
+ /**
+ * Inform the service that the session will be active.
+ * Invoked when a request is received.
+ *
+ * @param session The {@link HttpSession}.
+ */
+ public void sessionIsInUse(HttpSession session);
+
+ /**
+ * Informs the service that the session did activate and that beans should be restored.
+ *
+ * @param session The {@link HttpSession}.
+ */
+ public void sessionDidActivate(HttpSession session);
+
+ /**
+ * Invoked when the session will passivate and that beans should be stored for passivation.
+ *
+ * @param session The {@link HttpSession}.
+ */
+ public void sessionWillPassivate(HttpSession session);
+
+ /**
+ * Container provided object input stream.
+ *
+ * Note, the stream should support deserializing javassist objects.
+ *
+ * @deprecated we do not use javassist anymore since owb-1.2.0, thus no special handling is needed!
+ *
+ *
+ * @return custom object input stream.
+ */
+ public ObjectInputStream getObjectInputStream(InputStream in) throws IOException;
+
+ /**
+ * Container provided object output stream.
+ *
+ * Note, the stream should support serializing javassist objects.
+ *
+ * @deprecated as we do not use Javassist anymore this is not needed anymore!
+ *
+ * @return custom object output stream.
+ */
+ public ObjectOutputStream getObjectOutputStream(OutputStream out) throws IOException;
+
+ /**
+ * Container provided custom handler for serialize / deserialize a resource
+ * bean. Add clean up code in this method will allow OWB to override default
+ * resource bean passivation behavior.
+ *
+ * Note, in the method, a container may first invoke the application
+ * provided handler(@See SerializationHandler) if it is configured.
+ *
+ * @param bean The resource bean.
+ * @param resourceObject The resource bean instance
+ * @param in The input object stream
+ * @param out The output object stream
+ *
+ * @return {@link #NOT_HANDLED} if not handled by handler.
+ */
+ public Object handleResource(
+ Bean<?> bean,
+ Object resourceObject,
+ ObjectInput in,
+ ObjectOutput out
+ );
+
+ /**
+ * Returned, if container or application does not handle the resource object
+ * in the handleResource() method.
+ */
+ public final static Object NOT_HANDLED = new Object();
+
+}
diff --git a/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/JNDIService.java b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/JNDIService.java
new file mode 100644
index 0000000..282305c
--- /dev/null
+++ b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/JNDIService.java
@@ -0,0 +1,63 @@
+/*
+ * 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.webbeans.spi;
+
+/**
+ * SPI for setting and retrieving objects from the JNDI.
+ * Use this interface for all objects which should be stored and retreived
+ * from the JNDI at runtime.
+ *
+ * This may be implemented via a static map for
+ * environments where no JNDI is available.
+ */
+public interface JNDIService
+{
+ /**JMS Connection Factory JNDI Name*/
+ public static final String JMS_CONNECTION_FACTORY_JNDI_KEY
+ = "org.apache.webbeans.spi.JNDIService.jmsConnectionFactoryJndi";
+
+ /**Default value*/
+ public static final String JMS_CONNECTION_FACTORY_JNDI_DEFAULT_VALUE = "ConnectionFactory";
+
+ /**
+ * Bind the object with the given name to the JNDI environment
+ *
+ * @param name
+ * @param object
+ * @throws WebBeansException on any internal error
+ */
+ public abstract void bind(String name, Object object);
+
+ /**
+ * Unbind and free the object with the given name from the JNDI environment
+ * @param name
+ * @throws WebBeansException on any internal error
+ */
+ public abstract void unbind(String name);
+
+ /**
+ * Get the object bound to the given name from the JNDI context.
+ * @param name
+ * @param expectedClass
+ * @return the bound object or <code>null</code> if nothing bound.
+ * @throws WebBeansException on any internal error
+ */
+ public abstract <T> T lookup(String name, Class<? extends T> expectedClass);
+
+}
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/LoaderService.java b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/LoaderService.java
new file mode 100644
index 0000000..905dea0
--- /dev/null
+++ b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/LoaderService.java
@@ -0,0 +1,45 @@
+/*
+ * 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.webbeans.spi;
+
+import java.util.List;
+
+/**
+ * Decouples OpenWebBeans from the Service-Loader approach.
+ * It allows to provide custom loaders with custom mechanisms as well as support for Java 1.5
+ */
+public interface LoaderService
+{
+ /**
+ * Loads all active implementations for the given service-type
+ * @param serviceType base type of the services which should be loaded
+ * @param <T> current type
+ * @return all active implementations for the given service-type
+ */
+ <T> List<T> load(Class<T> serviceType);
+
+ /**
+ * Loads all active implementations for the given service-type
+ * @param serviceType base type of the services which should be loaded
+ * @param classLoader
+ * @param <T> current type
+ * @return all active implementations for the given service-type
+ */
+ <T> List<T> load(Class<T> serviceType, ClassLoader classLoader);
+}
diff --git a/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/ResourceInjectionService.java b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/ResourceInjectionService.java
new file mode 100644
index 0000000..05e033f
--- /dev/null
+++ b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/ResourceInjectionService.java
@@ -0,0 +1,95 @@
+/*
+ * 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.webbeans.spi;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.lang.annotation.Annotation;
+
+
+import javax.enterprise.inject.spi.Bean;
+import org.apache.webbeans.spi.api.ResourceReference;
+
+/**
+ * This service is responsible for injecting
+ * the Java EE injectable resources. Please
+ * see the Section 5 of the Java EE specification.
+ *
+ */
+public interface ResourceInjectionService
+{
+ /**
+ * Container where OWB is deployed must responsible
+ * for injecting Java EE resources defined by this managed bean.
+ * This includes, field and method injections. How to inject
+ * those resources are defined by Java EE specification.
+ * <p>
+ * This is only used for ManagedBean classes. It is not
+ * for injection Session Beans or any other Java EE components.
+ * Because those are already injected by the related container,
+ * for example EJB Container, Web Container etc.
+ * </p>
+ * @param managedBeanInstance managed bean instance
+ */
+ public void injectJavaEEResources(Object managedBeanInstance);
+
+ /**
+ * Gets resource for the given resource reference.
+ * <p>
+ * This method is used for getting individual resource references that
+ * are defined by the ManagedBean producer fields.
+ * For example;
+ * <p>
+ * <code>
+ * {@link @Produces} @MyPersistenceContext PersistenceContext EntityManager manager;
+ * </code>
+ * </p>
+ * <p>
+ * See section 3.5 of the JSR-299 specification.
+ * </p>
+ * </p>
+ * @param <T> resource type, @EJB, @Resource, @WebServiceRef,
+ * @PersistenceContext or @PersistenceUnit
+ * @param resourceReference
+ * @return resource for the given resource reference
+ */
+ public <X,T extends Annotation> X getResourceReference(ResourceReference<X,T> resourceReference);
+
+ /**
+ * Any clear functionality.
+ * <p>
+ * This is called by the container at shutdown. Services
+ * may clear its caches or any other useful functionality.
+ * </p>
+ */
+ public void clear();
+
+ /**
+ * delegation of serialization behavior
+ */
+ public <T> void writeExternal(Bean<T> bean, T actualResource, ObjectOutput out) throws IOException;
+
+ /**
+ * delegation of serialization behavior
+ */
+ public <T> T readExternal(Bean<T> bean, ObjectInput out) throws IOException,
+ ClassNotFoundException;
+
+}
diff --git a/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/ScannerService.java b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/ScannerService.java
new file mode 100644
index 0000000..4687c15
--- /dev/null
+++ b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/ScannerService.java
@@ -0,0 +1,93 @@
+/*
+ * 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.webbeans.spi;
+
+import java.net.URL;
+import java.util.Set;
+
+
+/**
+ * <p>This SPI is for abstracting the class scanning.</p>
+ *
+ * <p>In a production environment Many different modules need to perform
+ * class scanning (EJB, JSF, JPA, ...). This SPI allows us to only have one
+ * central class scanner for the whole application server
+ * which only performs the scanning once at startup of each WebApp.</p>
+ *
+ * <p>All URL path Strings in this interface contain the the protocol,
+ * e.g. 'file:/...' we get directly from {@link java.net.URL#toExternalForm()}</p>
+ *
+ */
+public interface ScannerService
+{
+ /**
+ * Any initializtion action that is
+ * required by the implementors.
+ * @param object initialization object
+ */
+ public void init(Object object);
+
+ /**
+ * Perform the actual class scanning.
+ */
+ public void scan();
+
+
+ /**
+ * This method will get called once the information found by the current
+ * scan is not needed anymore and the ScannerService might free up
+ * resources.
+ */
+ public void release();
+
+
+ /**
+ * Gets xml configuration files that are occured
+ * in the deployment archives.
+ * @return the URL of the beans.xml files.
+ */
+ public Set<URL> getBeanXmls();
+
+ /**
+ * Gets beans classes that are found in the
+ * deployment archives.
+ * @return bean classes
+ */
+ public Set<Class<?>> getBeanClasses();
+
+ /**
+ * Indicates if BDABeansXmlScanner is available. This method
+ * should only return true if a BDABeansXmlScanner is implemented
+ * and the OpenWebBeansConfiguration.USE_BDA_BEANSXML_SCANNER
+ * custom property is set to true.
+ * @return T - BDABeansXmlScanner is available and enabled;
+ * F - No BDABeansXmlScanner is available or it is disabled
+ */
+ public boolean isBDABeansXmlScanningEnabled();
+
+ /**
+ * Gets BDABeansXMLScanner used to determine the beans.xml
+ * modifiers (interceptors, decorators, and, alternatives) that
+ * are enabled per BDA. This is different from the default behavior
+ * that enables modifiers per application and not just in one BDA
+ * contained in an application.
+ * @return null or reference to BDABeansXMLScanner
+ */
+ public BDABeansXmlScanner getBDABeansXmlScanner();
+}
diff --git a/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/SecurityService.java b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/SecurityService.java
new file mode 100644
index 0000000..5ff5b50
--- /dev/null
+++ b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/SecurityService.java
@@ -0,0 +1,116 @@
+/*
+ * 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.webbeans.spi;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.security.Principal;
+import java.security.PrivilegedActionException;
+import java.util.Properties;
+
+/**
+ * <p>The SecurityService SPI provides support for all kinds
+ * of JavaEE related security mechanism.</p>
+ * <p>There are by default 2 basically different implementations
+ * provided by OpenWebBeans. One version performs all underlying
+ * class invocations via {@link java.security.AccessController#doPrivileged}
+ * which is intended for use in Java EE servers. The 2nd version directly
+ * invokes the underlying Class methods without any AccessControler and is
+ * intended for scenarios where no Java security mechanism needs to be used.
+ * Since OpenWebBeans (as any other DI framework) is heavily based on
+ * reflection, using the simple NoSecurityService leads to a way better
+ * application performance.
+ */
+public interface SecurityService
+{
+ /**
+ * Gets the current caller identity.
+ * @return current caller identity or <code>null</code> if none provided.
+ */
+ public Principal getCurrentPrincipal();
+
+ /**
+ * @see Class#getDeclaredConstructor(Class[])
+ */
+ public <T> Constructor<T> doPrivilegedGetDeclaredConstructor(Class<T> clazz, Class<?>... parameterTypes);
+
+ /**
+ * @see Class#getDeclaredConstructor(Class[])
+ */
+ public <T> Constructor<T> doPrivilegedGetConstructor(Class<T> clazz, Class<?>... parameterTypes);
+
+ /**
+ * @see Class#getDeclaredConstructors()
+ */
+ public <T> Constructor<?>[] doPrivilegedGetDeclaredConstructors(Class<T> clazz);
+
+ /**
+ * @see Class#getDeclaredMethod(String, Class[])
+ */
+ public <T> Method doPrivilegedGetDeclaredMethod(Class<T> clazz, String name, Class<?>... parameterTypes);
+
+ /**
+ * @see Class#getDeclaredMethods()
+ */
+ public <T> Method[] doPrivilegedGetDeclaredMethods(Class<T> clazz);
+
+ /**
+ * @see Class#getDeclaredField(String)
+ */
+ public <T> Field doPrivilegedGetDeclaredField(Class<T> clazz, String name);
+
+ /**
+ * @see Class#getDeclaredFields()
+ */
+ public <T> Field[] doPrivilegedGetDeclaredFields(Class<T> clazz);
+
+ /**
+ * @see AccessibleObject#setAccessible(boolean)
+ */
+ public void doPrivilegedSetAccessible(AccessibleObject obj, boolean flag);
+
+ /**
+ * @see AccessibleObject#isAccessible()
+ */
+ public boolean doPrivilegedIsAccessible(AccessibleObject obj);
+
+ /**
+ * @see Class#newInstance()
+ */
+ public <T> T doPrivilegedObjectCreate(Class<T> clazz)
+ throws PrivilegedActionException, IllegalAccessException, InstantiationException;
+
+ /**
+ * @see Class#
+ */
+ public void doPrivilegedSetSystemProperty(String propertyName, String value);
+
+ /**
+ * @see System#getProperty(String, String)
+ */
+ public String doPrivilegedGetSystemProperty(String propertyName, String defaultValue);
+
+ /**
+ * @see System#getProperties()
+ */
+ public Properties doPrivilegedGetSystemProperties();
+
+}
diff --git a/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/SingletonService.java b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/SingletonService.java
new file mode 100644
index 0000000..a652c81
--- /dev/null
+++ b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/SingletonService.java
@@ -0,0 +1,44 @@
+/*
+ * 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.webbeans.spi;
+
+/**
+ *
+ * Responsible for providing singleton instances
+ * for OWB runtime. Provider can implement
+ * their own logic to provide singleton instances.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface SingletonService<T>
+{
+ /**
+ * Get instance for given key and class name.
+ * @param key instance key
+ * @return instance
+ */
+ public T get(Object key);
+
+ /**
+ * Any clean activity.
+ * @param key instance key
+ */
+ public void clear(Object key);
+
+}
diff --git a/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/TransactionService.java b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/TransactionService.java
new file mode 100644
index 0000000..fa07e4e
--- /dev/null
+++ b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/TransactionService.java
@@ -0,0 +1,60 @@
+/*
+ * 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.webbeans.spi;
+
+import javax.enterprise.event.TransactionPhase;
+import javax.enterprise.inject.spi.ObserverMethod;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import javax.transaction.UserTransaction;
+
+/**
+ * Transaction related service.
+ * @version $Rev$ $Date$
+ */
+public interface TransactionService
+{
+ /**
+ * Get {@link TransactionManager} instance from container.
+ * @return the TransactionManager or <code>null</code> if none is registered.
+ */
+ public TransactionManager getTransactionManager();
+
+ /**
+ * Get the transaction context of the calling thread
+ * @return the Transaction or <code>null</code> if no TransactionManager is used.
+ */
+ public Transaction getTransaction();
+
+ /**
+ * Gets user transaction instance.
+ * @return user transaction object
+ */
+ public UserTransaction getUserTransaction();
+
+ /**
+ * Register transaction synch.
+ * @param phase transaction phase
+ * @param observer observer
+ * @param event event
+ */
+ public void registerTransactionSynchronization(TransactionPhase phase,
+ ObserverMethod<? super Object> observer,
+ Object event) throws Exception;
+}
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/ValidatorService.java b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/ValidatorService.java
new file mode 100644
index 0000000..12345fe
--- /dev/null
+++ b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/ValidatorService.java
@@ -0,0 +1,42 @@
+/*
+ * 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.webbeans.spi;
+
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+
+/**
+ * Validator SPI.
+ * @version $Rev$ $Date$
+ *
+ */
+public interface ValidatorService
+{
+ /**
+ * Gets default validator factory instance.
+ * @return validator factory
+ */
+ public ValidatorFactory getDefaultValidatorFactory();
+
+ /**
+ * Gets validator of default validator factory.
+ * @return validator
+ */
+ public Validator getDefaultValidator();
+}
diff --git a/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/adaptor/ELAdaptor.java b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/adaptor/ELAdaptor.java
new file mode 100644
index 0000000..84ac389
--- /dev/null
+++ b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/adaptor/ELAdaptor.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.spi.adaptor;
+
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+
+/**
+ * This SPI allows to separate ExpressionLanguage dependencies from OWB core.
+ * This is mainly needed to support different EL specification versions.
+ * We currently support EL-2.2 in openwebbeans-impl natively and also provide a
+ * pluggable implementation for EL-1.0 in our openwebbeans-el10 module.
+ */
+public interface ELAdaptor
+{
+ public ELResolver getOwbELResolver();
+
+ public ExpressionFactory getOwbWrappedExpressionFactory(ExpressionFactory expressionFactory);
+}
diff --git a/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/api/ResourceReference.java b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/api/ResourceReference.java
new file mode 100644
index 0000000..526a1db
--- /dev/null
+++ b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/api/ResourceReference.java
@@ -0,0 +1,141 @@
+/*
+ * 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.webbeans.spi.api;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+
+
+public class ResourceReference<X,T extends Annotation> implements Serializable
+{
+ private final T annotation;
+
+ private final Class<X> resourceType;
+
+ private final Class<?> ownerClass;
+
+ private final String name;
+
+ private String jndiName;
+
+ public ResourceReference(Class<?> ownerClass, String name, Class<X> resourceType, T annotation)
+ {
+ this.resourceType = resourceType;
+ this.annotation = annotation;
+ this.ownerClass = ownerClass;
+ this.name = name;
+ }
+
+ public boolean supports(Class<?> resourceAnnoation)
+ {
+ if(this.annotation.annotationType().equals(resourceAnnoation))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ public <Y extends Annotation> Y getAnnotation(Class<Y> resourceAnnoation)
+ {
+ if(this.annotation.annotationType().equals(resourceAnnoation))
+ {
+ return resourceAnnoation.cast(this.annotation);
+ }
+
+ return null;
+ }
+
+ public Class<X> getResourceType()
+ {
+ return this.resourceType;
+ }
+
+ /**
+ * @return the ownerClass
+ */
+ public Class<?> getOwnerClass()
+ {
+ return ownerClass;
+ }
+
+ public String getName()
+ {
+ return this.name;
+ }
+
+ public String getJndiName()
+ {
+ if(this.jndiName == null)
+ {
+ this.jndiName = getResourceName();
+ }
+
+ return normalize(this.jndiName);
+ }
+
+ private Method getNameMethod(Class cls)
+ {
+ try
+ {
+ return cls.getMethod("name", null);
+ }
+ catch (NoSuchMethodException e)
+ {
+ return null;
+ }
+ }
+
+ private String getResourceName()
+ {
+ String value = null;
+ Method nameMethod = getNameMethod(this.annotation.getClass());
+ if (nameMethod != null)
+ {
+ try
+ {
+ value = (String) nameMethod.invoke(this.annotation, null);
+ }
+ catch (Exception e)
+ {
+ // ignore
+ }
+ }
+
+ if(value == null || value.equals(""))
+ {
+ value = this.ownerClass.getName() + "/" + this.name;
+ }
+
+ return value;
+ }
+
+ private String normalize(String refName)
+ {
+ if (refName.startsWith("java:"))
+ {
+ return refName;
+ }
+
+ return "java:comp/env/" + refName;
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/AbstractOwbPlugin.java b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/AbstractOwbPlugin.java
new file mode 100644
index 0000000..b34352b
--- /dev/null
+++ b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/AbstractOwbPlugin.java
@@ -0,0 +1,82 @@
+/*
+ * 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.webbeans.spi.plugins;
+
+
+/**
+ * Abstract implementation of the {@link OpenWebBeansPlugin} interface
+ * contract.
+ *
+ * <p>
+ * This abstraction provides the empty implementation for the interface. If any
+ * subclass of this class wants to define customize method, it has to override related
+ * method definition.
+ * </p>
+ */
+public abstract class AbstractOwbPlugin implements OpenWebBeansPlugin
+{
+ protected AbstractOwbPlugin()
+ {
+
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void isManagedBean(Class<?> clazz)
+ {
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean supportsJavaEeComponentInjections(Class<?> targetClass)
+ {
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void shutDown()
+ {
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void startUp()
+ {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean supportService(Class<?> serviceClass)
+ {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public <T> T getSupportedService(Class<T> serviceClass)
+ {
+ return null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansEjbPlugin.java b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansEjbPlugin.java
new file mode 100644
index 0000000..2a082a1
--- /dev/null
+++ b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansEjbPlugin.java
@@ -0,0 +1,93 @@
+/*
+ * 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.webbeans.spi.plugins;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+import java.lang.reflect.Method;
+
+/**
+ * Session bean related plugin contract.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface OpenWebBeansEjbPlugin extends OpenWebBeansPlugin
+{
+ /**
+ * Returns true if class is an session bean class false otherwise
+ *
+ * @param clazz class definition
+ * @return true if class is an ejb class false otherwise
+ */
+ public boolean isSessionBean(Class<?> clazz);
+
+ /**
+ * return true is clazz is an impl class or business interface of an EJB
+ *
+ * @param clazz class definition
+ * @return true is clazz denotes an EJB
+ */
+ public boolean isNewSessionBean(Class<?> clazz);
+
+ /**
+ * Configures session bean and adds it into the container.
+ *
+ * @param clazz session bean class
+ * @param processAnnotateTypeEvent process annotated type event
+ */
+ public <T> Bean<T> defineSessionBean(Class<T> clazz, ProcessAnnotatedType<T> processAnnotateTypeEvent);
+
+ public <T> Bean<T> defineNewSessionBean(Class<T> clazz);
+
+ /**
+ * Returns true if given class is singleton session bean, false otherwise.
+ *
+ * @param clazz session bean class
+ * @return true if given class is singleton session bean, false otherwise
+ */
+ public boolean isSingletonBean(Class<?> clazz);
+
+ /**
+ * Returns true if given class is stateless session bean, false otherwise.
+ *
+ * @param clazz session bean class
+ * @return true if given class is singleton session bean, false otherwise
+ */
+ public boolean isStatelessBean(Class<?> clazz);
+
+ /**
+ * Returns true if given class is stateful session bean, false otherwise.
+ *
+ * @param clazz session bean class
+ * @return true if given class is singleton session bean, false otherwise
+ */
+ public boolean isStatefulBean(Class<?> clazz);
+
+ /**
+ * Returns session bean proxy.
+ *
+ * @param bean session bean
+ * @param iface interface
+ * @return session bean proxy
+ */
+ public Object getSessionBeanProxy(Bean<?> bean, Class<?> iface, CreationalContext<?> creationalContext);
+
+ Method resolveViewMethod(Bean<?> component, Method declaredMethod);
+}
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansJavaEEPlugin.java b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansJavaEEPlugin.java
new file mode 100644
index 0000000..99e3823
--- /dev/null
+++ b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansJavaEEPlugin.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.spi.plugins;
+
+/**
+ * In fully Java EE environments, it will be implemented
+ * by the application servers.
+ * <p>
+ * There is no default plugin implementation for any
+ * Java EE application server.
+ * </p>
+ * @version $Rev$ $Date$
+ *
+ */
+public interface OpenWebBeansJavaEEPlugin extends OpenWebBeansPlugin
+{
+ //Any future operations for java ee containers
+}
diff --git a/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansPlugin.java b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansPlugin.java
new file mode 100644
index 0000000..dff1004
--- /dev/null
+++ b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansPlugin.java
@@ -0,0 +1,87 @@
+/*
+ * 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.webbeans.spi.plugins;
+
+
+/**
+ * <p>Interface which all OpenWebBeans plugins have to implement to
+ * extend the webbeans-core with additional IOC functionality.</p>
+ *
+ * <p>There are 4 different types of functions for this interface:
+ * <ol>
+ * <li>
+ * plugin lifecycle like {@code #startUp()} and {@code #shutDown()}
+ * </li>
+ * <li>
+ * injection execution will be called every time a been get's
+ * injected like {@code #injectResource(Type, Annotation[])}
+ * </li>
+ * </ol>
+ * @see PluginLoader for documentation of the whole mechanism
+ */
+public interface OpenWebBeansPlugin
+{
+ /**
+ * initialise the plugin.
+ * This is called once after the very plugin has been loaded.
+ */
+ public void startUp();
+
+ /**
+ * At shutdown, the plugin must release all locked resources.
+ * This is called once before the very plugin gets destroyed.
+ * This is usually the case when the WebApplication gets stopped.
+ * @throws WebBeansConfigurationException
+ */
+ public void shutDown();
+
+
+ /**
+ * Make sure that the given class is ok for simple web bean conditions,
+ * otherwise throw a {@code WebBeansConfigurationException}
+ * @param clazz the class to check
+ * @throws WebBeansConfigurationException if the given clazz cannot be used as simple web bean.
+ */
+ public void isManagedBean(Class<?> clazz);
+
+ /**
+ * Returns true if plugin provides given service implementation
+ * false otherwise.
+ * @param serviceClass any service class
+ * @return true if plugin provides given service implementation
+ */
+ public boolean supportService(Class<?> serviceClass);
+
+ /**
+ * Returns true if given class supports injections,
+ * false otherwise.
+ * @param targetClass any target class
+ * @return true if given class supports injections
+ */
+ public boolean supportsJavaEeComponentInjections(Class<?> targetClass);
+
+
+ /**
+ * Gets service instance.
+ * @param <T> type
+ * @param serviceClass service class
+ * @return service
+ */
+ public <T> T getSupportedService(Class<T> serviceClass);
+}
diff --git a/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansWebPlugin.java b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansWebPlugin.java
new file mode 100644
index 0000000..baf6a4b
--- /dev/null
+++ b/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansWebPlugin.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.spi.plugins;
+
+/**
+ * OpenWebBeans plugin point for Web Containers.
+ * Currently there is no default implementation
+ * for this plugin. Each web container that wants
+ * to support OpenWebBeans, implements this plugin
+ * and register it via META-INF/services/org.apache.webbeans.plugins.OpenWebBeansWebPlugin
+ * @version $Rev$ $Date$
+ *
+ */
+public interface OpenWebBeansWebPlugin extends OpenWebBeansPlugin
+{
+ //Any future operations for web containers
+}
diff --git a/owb_1.2.x/webbeans-spi/src/site/apt/configuration.apt b/owb_1.2.x/webbeans-spi/src/site/apt/configuration.apt
new file mode 100644
index 0000000..1328422
--- /dev/null
+++ b/owb_1.2.x/webbeans-spi/src/site/apt/configuration.apt
@@ -0,0 +1,70 @@
+~~ 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.
+Apache OpenWebBeans Configuration
+
+ Since OpenWebBeans is built in a modular fashion, we need a way to activate
+ different implementations for a SPI Service by just dropping a JAR file
+ into the classpath. This is where the OpenWebBeans configuration mechanism
+ kicks in.
+
+* Basis configuration mechanism
+
+ When the OpenWebBeans container starts, it parses the whole classpath for
+ his configuration data which are contained in files with the name
+
+-----------------
+META-INF/openwebbeans/openwebbeans.properties
+-----------------
+
+ Each of this files have a single property with the name
+
+-----------------
+configuration.ordinal=10
+-----------------
+
+ The configured number of the configuration.ordinal represents the order
+ of which the properties gets stacked up. After reading all openwebbeans.properties
+ files, we sort them according to their configuration.ordinal in ascending manner.
+
+ If no configuration.ordinal is given, a default value of 100 is assumed.
+
+ As last step, all the property values will get merged into a single
+ Properties instance in the order of their configuration.ordinal. As
+ a result, properties from files with higher configuration.ordinal will
+ override properties with the same name from a configuration file with lower
+ configuration.ordinal.
+
+ The final value for a specific property will be used to determine the SPI implementation class.
+
+
+* Configure your own SPI implementations
+
+ If you, for example, like to provide your own ScannerService, then create a class
+ which implements the org.apache.webbeans.spi.ScannerService interface.
+
+ For using your own ScannerService instead of the default one, just add a
+
+-----------------
+META-INF/openwebbeans/openwebbeans.properties
+-----------------
+
+ file to your JAR and add the following line:
+
+-----------------
+# this is the sample configuration for using an own ScannerService
+
+# use a higher configuration.ordinal than the provided configuration files
+configuration.ordinal=101
+
+# Sample implementation of org.apache.webbeans.corespi.ScannerService.
+org.apache.webbeans.spi.ScannerService=com.mycompany.myproject.MySpecialScannerService
+-----------------
diff --git a/owb_1.2.x/webbeans-spi/src/site/apt/index.apt b/owb_1.2.x/webbeans-spi/src/site/apt/index.apt
new file mode 100644
index 0000000..fe43212
--- /dev/null
+++ b/owb_1.2.x/webbeans-spi/src/site/apt/index.apt
@@ -0,0 +1,28 @@
+~~ 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.
+Apache OpenWebBeans Service Provider Interfaces
+
+* Architectural Overview
+
+ Apache OpenWebBeans is built in a modular fashion, using Java interfaces with multiple available
+ implementations.
+
+ Most interfaces in the SPI module represent a specific Service.
+ The desired implementation to use can be set via our
+ {{{./configuration.html}Configuration Mechanism}}
+
+
+* Available SPIs
+
+ The list of availabe service provider interfaces and the documentation can
+ be found in our {{{./apidocs/index.html}JavaDoc}}.
+
diff --git a/owb_1.2.x/webbeans-spi/src/site/site.xml b/owb_1.2.x/webbeans-spi/src/site/site.xml
new file mode 100644
index 0000000..3e7c002
--- /dev/null
+++ b/owb_1.2.x/webbeans-spi/src/site/site.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<project name="OpenWebBeans">
+ <bannerLeft>
+ <name>Apache OpenWebBeans</name>
+ <src>http://openwebbeans.apache.org/owb/images/logos/openwebbeans_hor.png</src>
+ <href>http://openwebbeans.apache.org</href>
+ </bannerLeft>
+
+ <bannerRight>
+ <name>Apache Banner</name>
+ <src>http://www.apache.org/images/asf-logo.gif</src>
+ <href>http://www.apache.org</href>
+ </bannerRight>
+
+ <publishDate format="dd MMM yyyy" />
+ <version position="left"/>
+
+ <body>
+ <breadcrumbs>
+ <item name="Apache" href="http://www.apache.org"/>
+ <item name="OpenWebBeans" href="http://openwebbeans.apache.org"/>
+ <item name="OWB-SPI" href="http://openwebbeans.apache.org/${project.version}/openwebbeans-spi"/>
+ </breadcrumbs>
+
+ <menu name="Overview">
+ <item name="Introduction" href="index.html" />
+ <item name="Configuration" href="configuration.html" />
+ </menu>
+
+ <menu ref="reports"/>
+ </body>
+</project>
+
diff --git a/owb_1.2.x/webbeans-tck/pom.xml b/owb_1.2.x/webbeans-tck/pom.xml
new file mode 100644
index 0000000..b1486df
--- /dev/null
+++ b/owb_1.2.x/webbeans-tck/pom.xml
@@ -0,0 +1,359 @@
+<?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.
+-->
+<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>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>1.2.5</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>openwebbeans-tck</artifactId>
+ <name>JSR-299 TCK runner</name>
+ <packaging>jar</packaging>
+ <description>All TCK tests for the Apache OpenWebBeans Implementation</description>
+
+ <properties>
+ <!-- <webbeans.tck.version>1.0.1-Final</webbeans.tck.version> -->
+ <webbeans.tck.version>1.0.4.SP1</webbeans.tck.version>
+ </properties>
+
+ <!--Used for jboss-test-harness-api not in central maven -->
+ <!-- TODO finally REMOVE if all transitive stuff from the TCK moved to maven.central -->
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ </repository>
+ </repositories>
+
+ <dependencies>
+
+ <!-- Those dependencies are required for standalone TCK testing -->
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-porting</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-resource</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.jsr299.tck</groupId>
+ <artifactId>jsr299-tck-impl</artifactId>
+ <version>${webbeans.tck.version}</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>cdi-api</artifactId>
+ <groupId>javax.enterprise</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.xbean</groupId>
+ <artifactId>xbean-finder-shaded</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>5.8</version>
+ <scope>test</scope>
+ <classifier>jdk15</classifier>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-ejb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-ejb_3.1_spec</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>tck</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-tck</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+
+ <!-- Those dependencies are required for Web Profile TCK testing -->
+ <artifactItem>
+ <groupId>org.jboss.jsr299.tck</groupId>
+ <artifactId>jsr299-tck-impl</artifactId>
+ <version>${webbeans.tck.version}</version>
+ <type>xml</type>
+ <classifier>suite</classifier>
+ <overWrite>true</overWrite>
+ </artifactItem>
+
+ <!-- OWB Porting Package -->
+ <artifactItem>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-porting</artifactId>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
+ </artifactItem>
+
+ <!-- OWB Implementation Package -->
+ <artifactItem>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
+ </artifactItem>
+
+ <!-- OWB JSF 1.2 Plugin Package -->
+ <artifactItem>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-jsf12</artifactId>
+ <overWrite>true</overWrite>
+ <version>${project.version}</version>
+ <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
+ </artifactItem>
+
+ <!-- OWB EL 1.0 Plugin Package -->
+ <artifactItem>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-el10</artifactId>
+ <overWrite>true</overWrite>
+ <version>${project.version}</version>
+ <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
+ </artifactItem>
+
+ <!-- OWB Web Plugin Package -->
+ <artifactItem>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-web</artifactId>
+ <overWrite>true</overWrite>
+ <version>${project.version}</version>
+ <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
+ </artifactItem>
+
+ <!-- EJB API -->
+ <artifactItem>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-ejb_3.1_spec</artifactId>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
+ </artifactItem>
+
+
+ <!-- JSTL -->
+ <artifactItem>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ <overWrite>true</overWrite>
+ <version>1.2</version>
+ <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
+ </artifactItem>
+
+ <!-- OWB EE Common Package -->
+ <artifactItem>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-ee-common</artifactId>
+ <overWrite>true</overWrite>
+ <version>${project.version}</version>
+ <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
+ </artifactItem>
+
+
+ <!-- MyFaces API Package -->
+ <artifactItem>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <overWrite>true</overWrite>
+ <version>1.2.8</version>
+ <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
+ </artifactItem>
+
+ <!-- MyFaces Impl Package -->
+ <artifactItem>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <overWrite>true</overWrite>
+ <version>1.2.8</version>
+ <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
+ </artifactItem>
+
+ <!-- OWB EJB Plugin Package
+ <artifactItem>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-ejb</artifactId>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
+ </artifactItem>
+ -->
+
+ <!-- OWB Resource Plugin Package -->
+ <artifactItem>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-resource</artifactId>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
+ </artifactItem>
+
+ <!-- Dom4j -->
+ <artifactItem>
+ <groupId>dom4j</groupId>
+ <artifactId>dom4j</artifactId>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
+ </artifactItem>
+
+ <!-- commons-logging -->
+ <artifactItem>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <overWrite>true</overWrite>
+ <version>1.1.1</version>
+ <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
+ </artifactItem>
+
+ <!-- commons-digester -->
+ <artifactItem>
+ <groupId>commons-digester</groupId>
+ <artifactId>commons-digester</artifactId>
+ <overWrite>true</overWrite>
+ <version>1.6</version>
+ <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
+ </artifactItem>
+
+ <!-- commons-codec -->
+ <artifactItem>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <overWrite>true</overWrite>
+ <version>1.3</version>
+ <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
+ </artifactItem>
+
+ <!-- commons-validator -->
+ <artifactItem>
+ <groupId>commons-validator</groupId>
+ <artifactId>commons-validator</artifactId>
+ <overWrite>true</overWrite>
+ <version>1.3.1</version>
+ <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
+ </artifactItem>
+
+ <!-- commons-collections -->
+ <artifactItem>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <overWrite>true</overWrite>
+ <version>2.1</version>
+ <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
+ </artifactItem>
+
+ <!-- commons-beanutils -->
+ <artifactItem>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ <overWrite>true</overWrite>
+ <version>1.7.0</version>
+ <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
+ </artifactItem>
+
+ <!-- commons-discovery -->
+ <artifactItem>
+ <groupId>commons-discovery</groupId>
+ <artifactId>commons-discovery</artifactId>
+ <overWrite>true</overWrite>
+ <version>0.4</version>
+ <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
+ </artifactItem>
+
+ <!-- xml-apis -->
+ <artifactItem>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ <overWrite>true</overWrite>
+ <version>1.0.b2</version>
+ <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
+ </artifactItem>
+
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <suiteXmlFiles>
+ <suiteXmlFile>standalone-suite.xml</suiteXmlFile>
+ </suiteXmlFiles>
+
+ <systemProperties>
+ <property>
+ <name>org.jboss.testharness.libraryDirectory</name>
+ <value>target/dependency/lib</value>
+ </property>
+ <property>
+ <name>tomcat.home</name>
+ <value>/home/gurkanerdogdu/apache-tomcat-6.0.20</value>
+ </property>
+ </systemProperties>
+
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
diff --git a/owb_1.2.x/webbeans-tck/src/site/site.xml b/owb_1.2.x/webbeans-tck/src/site/site.xml
new file mode 100644
index 0000000..8cfa25d
--- /dev/null
+++ b/owb_1.2.x/webbeans-tck/src/site/site.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<project name="OpenWebBeans">
+ <bannerLeft>
+ <name>Apache OpenWebBeans</name>
+ <src>http://openwebbeans.apache.org/owb/images/logos/openwebbeans_hor.png</src>
+ <href>http://openwebbeans.apache.org</href>
+ </bannerLeft>
+
+ <bannerRight>
+ <name>Apache Banner</name>
+ <src>http://www.apache.org/images/asf-logo.gif</src>
+ <href>http://www.apache.org</href>
+ </bannerRight>
+
+ <publishDate format="dd MMM yyyy" />
+ <version position="left"/>
+
+ <body>
+ <breadcrumbs>
+ <item name="Apache" href="http://www.apache.org"/>
+ <item name="OpenWebBeans" href="http://openwebbeans.apache.org"/>
+ </breadcrumbs>
+
+ <menu name="Overview">
+ <item name="Introduction" href="index.html" />
+ </menu>
+
+ <menu name="OpenWebBeans">
+ <item name="JSR-299" href="jsr299.html" />
+ <item name="JSR-330" href="jsr330.html" />
+ <item name="Contributing" href="contributing.html" />
+ <item name="Documentation" href="documentation.html"/>
+ <item name="IRC" href="irc.html" />
+ <item name="FAQ" href="faq.html" />
+ <item name="Extensions" href="extensions/index.html" />
+ <item name="Download Apache OWB" href="http://www.apache.org/dyn/closer.cgi/openwebbeans/" />
+ </menu>
+
+ <menu ref="modules" />
+
+ <menu name="Examples">
+ <item name="guess" href="examples/guess.html" />
+ </menu>
+
+ <menu ref="reports"/>
+ </body>
+</project>
+
diff --git a/owb_1.2.x/webbeans-tck/src/test/resources/META-INF/jboss-test-harness.properties b/owb_1.2.x/webbeans-tck/src/test/resources/META-INF/jboss-test-harness.properties
new file mode 100644
index 0000000..fdbae2c
--- /dev/null
+++ b/owb_1.2.x/webbeans-tck/src/test/resources/META-INF/jboss-test-harness.properties
@@ -0,0 +1,33 @@
+#Licensed to the Apache Software Foundation (ASF) under one
+#or more contributor license agreements. See the NOTICE file
+#distributed with this work for additional information
+#regarding copyright ownership. The ASF licenses this file
+#to you under the Apache License, Version 2.0 (the
+#"License"); you may not use this file except in compliance
+#with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+#Unless required by applicable law or agreed to in writing,
+#software distributed under the License is distributed on an
+#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#KIND, either express or implied. See the License for the
+#specific language governing permissions and limitations
+#under the License.
+
+org.jboss.jsr299.tck.spi.Managers=org.apache.webbeans.test.tck.ManagersImpl
+org.jboss.jsr299.tck.spi.Beans=org.apache.webbeans.test.tck.BeansImpl
+org.jboss.jsr299.tck.spi.Contexts=org.apache.webbeans.test.tck.ContextsImpl
+org.jboss.testharness.spi.StandaloneContainers=org.apache.webbeans.test.tck.StandaloneContainersImpl
+org.jboss.testharness.spi.Containers=org.apache.webbeans.test.tck.ContainersImpl
+org.jboss.jsr299.tck.spi.EL=org.apache.webbeans.test.tck.ELImpl
+
+org.jboss.testharness.standalone=true
+#jboss-as.dir=/tmp
+#jboss.force.restart=false
+org.jboss.testharness.libraryDirectory=target/dependency/lib
+org.jboss.testharness.runIntegrationTests=false
+
+org.jboss.testharness.api.TestLauncher=org.jboss.testharness.impl.runner.servlet.ServletTestLauncher
+
+#tomcat.home=/opt/apache/tomcat
diff --git a/owb_1.2.x/webbeans-tck/src/test/resources/META-INF/openwebbeans/openwebbeans.properties b/owb_1.2.x/webbeans-tck/src/test/resources/META-INF/openwebbeans/openwebbeans.properties
new file mode 100644
index 0000000..0725813
--- /dev/null
+++ b/owb_1.2.x/webbeans-tck/src/test/resources/META-INF/openwebbeans/openwebbeans.properties
@@ -0,0 +1,42 @@
+#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.
+
+#---------------------------------------------------------------
+# The default configuration for OpenWebBeans
+#
+# The default configuration is intended for a JDK and a simple ServletContainer
+# like jetty, resin or tomcat.
+#
+#---------------------------------------------------------------
+
+#general configuration section
+
+
+# the service section:
+# The key is the Interface, the value the implementation of the service
+
+# use the static HashMap instead of storing objects in JNDI as default
+org.apache.webbeans.spi.JNDIService=org.apache.webbeans.corespi.se.DefaultJndiService
+
+#use the web metadata as default
+org.apache.webbeans.spi.ScannerService=org.apache.webbeans.test.tck.mock.TCKMetaDataDiscoveryImpl
+
+#Used for Standalone
+org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService=true
+
+#Used for WebProfile TCK
+#org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService=false
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-tck/standalone-suite.xml b/owb_1.2.x/webbeans-tck/standalone-suite.xml
new file mode 100644
index 0000000..96b241a
--- /dev/null
+++ b/owb_1.2.x/webbeans-tck/standalone-suite.xml
@@ -0,0 +1,185 @@
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
+<!--
+
+ 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.
+-->
+<suite name="JSR-299 TCK" verbose="2">
+ <test name="JSR-299 TCK">
+ <method-selectors>
+
+ <method-selector>
+ <selector-class
+ name="org.jboss.testharness.impl.testng.DisableIntegrationTestsMethodSelector" />
+ </method-selector>
+
+ <method-selector>
+ <selector-class
+ name="org.jboss.testharness.impl.testng.ExcludeIncontainerUnderInvestigationMethodSelector" />
+ </method-selector>
+ </method-selectors>
+
+ <groups>
+ <run>
+ <exclude name="ri-broken" />
+ <exclude name="jboss-as-broken" />
+ <exclude name="broken" />
+ <exclude name="integration"></exclude>
+ </run>
+ </groups>
+
+ <classes>
+
+ <!--
+ It's not necessary to perform EJB tests in standalone mode!
+ Those tests will be executed as part of the integration in OpenEJB.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.implementation.enterprise.definition.EnterpriseBeanDefinitionTest">
+ <methods>
+ <exclude name="testConstructorAnnotatedInjectCalled"></exclude>
+ </methods>
+ </class>
+ <!-- Not necessary test some EJBs in standalone mode!!! -->
+ <class name="org.jboss.jsr299.tck.tests.inheritance.specialization.simple.broken.extendejb.SpecializingBeanExtendsEnterpriseBeanTest">
+ <methods>
+ <exclude name=".*"></exclude>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.implementation.enterprise.broken.statelessWithApplicationScope.StatelessWithApplicationScopeTest">
+ <methods>
+ <exclude name=".*"></exclude>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.implementation.enterprise.broken.statelessWithRequestScope.StatelessWithRequestScopeTest">
+ <methods>
+ <exclude name=".*"></exclude>
+ </methods>
+ </class>
+ <!-- Not necessary test some EJBs in standalone mode!!! -->
+ <class name="org.jboss.jsr299.tck.tests.event.broken.observer.notBusinessMethod.EJBObserverMethodNotBusinessMethodTest">
+ <methods>
+ <exclude name=".*"></exclude>
+ </methods>
+ </class>
+ <!-- Not necessary test some EJBs in standalone mode!!! -->
+ <class name="org.jboss.jsr299.tck.tests.implementation.enterprise.newBean.NewEnterpriseBeanTest">
+ <methods>
+ <exclude name=".*"></exclude>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.inheritance.specialization.enterprise.broken.directlyExtendsSimpleBean.DirectlyExtendsSimpleBeanTest">
+ <methods>
+ <exclude name=".*"></exclude>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.implementation.producer.method.broken.enterprise.nonbusiness.ProducerMethodNotBusinessMethodTest">
+ <methods>
+ <exclude name="testProducerMethodOnSessionBeanMustBeBusinessMethod"></exclude>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.implementation.enterprise.broken.singletonWithRequestScope.SingletonWithRequestScopeTest">
+ <methods>
+ <exclude name="testSingletonWithRequestScopeFails"></exclude>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.implementation.enterprise.broken.singletonWithSessionScope.SingletonWithSessionScopeTest">
+ <methods>
+ <exclude name="testSingletonWithSessionScopeFails"></exclude>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.implementation.enterprise.broken.singletonWithConversationScope.SingletonWithConversationScopeTest">
+ <methods>
+ <exclude name="testSingletonWithConversationScopeFails"></exclude>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.context.passivating.PassivatingContextTest">
+ <!-- sadly this test also loads EJBs :( -->
+ <methods>
+ <exclude name=".*"></exclude>
+ </methods>
+ </class>
+
+
+
+ <!-- ERROR IN CDI-TCK-137 -->
+ <class name="org.jboss.jsr299.tck.tests.decorators.invocation.DecoratorInvocationTest">
+ <methods>
+ <exclude name="testChainedDecoratorInvocation"></exclude>
+ </methods>
+ </class>
+
+
+ <!-- ERROR IN CDITCK-138 -->
+ <class name="org.jboss.jsr299.tck.tests.lookup.injectionpoint.InjectionPointTest">
+ <methods>
+ <exclude name="testIsDelegate"></exclude>
+ </methods>
+ </class>
+
+ <!-- ERROR IN CDITCK-183 -->
+ <class name="org.jboss.jsr299.tck.tests.context.DestroyedInstanceReturnedByGetTest">
+ <methods>
+ <exclude name="testDestroyedInstanceMustNotBeReturnedByGet"></exclude>
+ </methods>
+ </class>
+
+ <!-- see CDI-140 -->
+ <class name="org.jboss.jsr299.tck.tests.context.passivating.broken.passivatingProducerMethodWithNonPassivatingParameter.PassivatingProducerMethodWithNonPassivatingParameterTest">
+ <methods>
+ <exclude name="testSimpleDependentWebBeanWithNonSerializableImplementationInjectedIntoProducerMethodParameterWithPassivatingScopeFails"></exclude>
+ </methods>
+ </class>
+
+ <!-- we need to force the order in which those methods get called as the TCK is broken otherwise -->
+ <class name="org.jboss.jsr299.tck.tests.event.observer.conditional.ConditionalObserverTest">
+ <methods>
+ <include name="testConditionalObserver"/>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.event.observer.conditional.ConditionalObserverTest">
+ <methods>
+ <include name="testObserverMethodInvokedOnReturnedInstanceFromContext"/>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.event.observer.conditional.ConditionalObserverTest">
+ <methods>
+ <include name="testNotifyEnumerationContainsNotifyValues"/>
+ </methods>
+ </class>
+
+ <class name="org.jboss.jsr299.tck.tests.implementation.disposal.method.definition.DisposalMethodDefinitionTest">
+ <methods>
+ <include name="testBindingTypesAppliedToDisposalMethodParameters"/>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.implementation.disposal.method.definition.DisposalMethodDefinitionTest">
+ <methods>
+ <include name="testDisposalMethodOnNonBean"/>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.implementation.disposal.method.definition.DisposalMethodDefinitionTest">
+ <methods>
+ <include name="testDisposalMethodParametersGetInjected"/>
+ </methods>
+ </class>
+
+ </classes>
+
+ <packages>
+ <package name="org.jboss.jsr299.tck.tests.*"></package>
+ <package name="org.jboss.jsr299.tck.interceptors.tests.*"/>
+ </packages>
+ </test>
+
+</suite>
diff --git a/owb_1.2.x/webbeans-tck/webprofile-suite.xml b/owb_1.2.x/webbeans-tck/webprofile-suite.xml
new file mode 100644
index 0000000..b90930c
--- /dev/null
+++ b/owb_1.2.x/webbeans-tck/webprofile-suite.xml
@@ -0,0 +1,89 @@
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
+ <!--
+
+ 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.
+ -->
+<suite name="JSR-299 TCK" verbose="2">
+ <test name="JSR-299 TCK">
+ <method-selectors>
+
+ <method-selector>
+ <selector-class
+ name="org.jboss.testharness.impl.testng.DisableIntegrationTestsMethodSelector" />
+ </method-selector>
+
+ <!-- Used for Web Profiles-->
+ <method-selector>
+ <selector-class name="org.jboss.jsr299.tck.impl.WebProfileMethodSelector" />
+ </method-selector>
+
+
+ <method-selector>
+ <selector-class
+ name="org.jboss.testharness.impl.testng.ExcludeIncontainerUnderInvestigationMethodSelector" />
+ </method-selector>
+ </method-selectors>
+ <groups>
+ <run>
+ <exclude name="ri-broken" />
+ <exclude name="jboss-as-broken" />
+ <exclude name="broken" />
+ <exclude name="integration"></exclude>
+ </run>
+ </groups>
+
+ <classes>
+ <!-- ERROR IN CDI-TCK-137 -->
+ <class
+ name="org.jboss.jsr299.tck.tests.decorators.invocation.DecoratorInvocationTest">
+ <methods>
+ <exclude name="testChainedDecoratorInvocation"></exclude>
+ </methods>
+ </class>
+
+
+ <!-- ERROR IN CDI-TCK-138 -->
+ <class
+ name="org.jboss.jsr299.tck.tests.lookup.injectionpoint.InjectionPointTest">
+ <methods>
+ <exclude name="testIsDelegate"></exclude>
+ </methods>
+ </class>
+
+
+ <!-- ERROR IN CDITCK-165 -->
+ <class name="org.jboss.jsr299.tck.tests.context.NormalContextTest">
+ <methods>
+ <exclude name="testSameNormalScopeBeanInjectedEverywhere"/>
+ </methods>
+ </class>
+
+
+ <!-- WS Integfration. Currently Tomcat has no Web service integration
+ In full Java EE, this works-->
+ <class name="org.jboss.jsr299.tck.tests.lookup.injection.non.contextual.ws.InjectionIntoWebServiceEndPointTest">
+ <methods>
+ <exclude name="testInjectionIntoWebServiceEndpoint"/>
+ </methods>
+ </class>
+
+ </classes>
+
+ <packages>
+ <package name="org.jboss.jsr299.tck.tests.*"></package>
+ </packages>
+ </test>
+
+</suite>
diff --git a/owb_1.2.x/webbeans-test/cditest-owb/pom.xml b/owb_1.2.x/webbeans-test/cditest-owb/pom.xml
new file mode 100644
index 0000000..5f12f99
--- /dev/null
+++ b/owb_1.2.x/webbeans-test/cditest-owb/pom.xml
@@ -0,0 +1,106 @@
+<?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.
+ -->
+
+<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>
+ <groupId>org.apache.openwebbeans.test</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.2.5</version>
+ </parent>
+
+ <artifactId>cditest-owb</artifactId>
+ <packaging>jar</packaging>
+
+ <name>OWB Testing plugin</name>
+ <description>
+ This module provides plugable CDI-Testing support for the Apache OpenWebBeans CDI container.
+ </description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans.test</groupId>
+ <artifactId>cditest</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_2.5_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-el_2.2_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+
+ <profiles>
+ <profile>
+ <id>web</id>
+ <!-- simulate a unit test when webbeans-web is in the Classpath -->
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-web</artifactId>
+ </dependency>
+ </dependencies>
+
+ </profile>
+ </profiles>
+</project>
diff --git a/owb_1.2.x/webbeans-test/cditest-owb/src/main/java/org/apache/webbeans/cditest/owb/CdiTestOpenWebBeansContainer.java b/owb_1.2.x/webbeans-test/cditest-owb/src/main/java/org/apache/webbeans/cditest/owb/CdiTestOpenWebBeansContainer.java
new file mode 100644
index 0000000..fd5ddc6
--- /dev/null
+++ b/owb_1.2.x/webbeans-test/cditest-owb/src/main/java/org/apache/webbeans/cditest/owb/CdiTestOpenWebBeansContainer.java
@@ -0,0 +1,218 @@
+/*
+ * 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.webbeans.cditest.owb;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.ResolutionException;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Singleton;
+import javax.servlet.ServletContextEvent;
+
+import org.apache.webbeans.cditest.CdiTestContainer;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.spi.ContainerLifecycle;
+import org.apache.webbeans.spi.ContextsService;
+
+/**
+ * OpenWebBeans specific implementation of {@link CdiTestContainer}.
+ */
+public class CdiTestOpenWebBeansContainer implements CdiTestContainer
+{
+ private static final Logger logger = WebBeansLoggerFacade.getLogger(CdiTestOpenWebBeansContainer.class);
+
+ private ContainerLifecycle lifecycle = null;
+ private MockServletContext servletContext = null;
+ private MockHttpSession session = null;
+
+ @Override
+ public void bootContainer() throws Exception
+ {
+ servletContext = new MockServletContext();
+ session = new MockHttpSession();
+ lifecycle = WebBeansContext.getInstance().getService(ContainerLifecycle.class);
+ lifecycle.startApplication(new ServletContextEvent(servletContext));
+ }
+
+ @Override
+ public void shutdownContainer() throws Exception
+ {
+ if (lifecycle != null)
+ {
+ lifecycle.stopApplication(new ServletContextEvent(servletContext));
+ }
+ }
+
+ @Override
+ public void startContexts() throws Exception
+ {
+ logger.log(Level.FINE, "starting all OWB Contexts");
+ WebBeansContext webBeansContext = WebBeansContext.currentInstance();
+ ContextsService contextsService = webBeansContext.getContextsService();
+
+ contextsService.startContext(Singleton.class, servletContext);
+ contextsService.startContext(ApplicationScoped.class, servletContext);
+ contextsService.startContext(SessionScoped.class, session);
+ contextsService.startContext(ConversationScoped.class, null);
+ contextsService.startContext(RequestScoped.class, null);
+ }
+
+ @Override
+ public void startApplicationScope() throws Exception
+ {
+ logger.log(Level.FINE, "starting the OWB ApplicationContext");
+ WebBeansContext webBeansContext = WebBeansContext.currentInstance();
+ ContextsService contextsService = webBeansContext.getContextsService();
+
+ contextsService.startContext(ApplicationScoped.class, servletContext);
+ }
+
+ @Override
+ public void startConversationScope() throws Exception
+ {
+ logger.log(Level.FINE, "starting the OWB ConversationContext");
+ WebBeansContext webBeansContext = WebBeansContext.currentInstance();
+ ContextsService contextsService = webBeansContext.getContextsService();
+
+ contextsService.startContext(ConversationScoped.class, null);
+ }
+
+ @Override
+ public void startCustomScope(Class<? extends Annotation> scopeClass) throws Exception
+ {
+ //X TODO
+ }
+
+ @Override
+ public void startRequestScope() throws Exception
+ {
+ logger.log(Level.FINE, "starting the OWB RequestContext");
+ WebBeansContext webBeansContext = WebBeansContext.currentInstance();
+ ContextsService contextsService = webBeansContext.getContextsService();
+
+ contextsService.startContext(RequestScoped.class, null);
+ }
+
+ @Override
+ public void startSessionScope() throws Exception
+ {
+ logger.log(Level.FINE, "starting the OWB SessionContext");
+ WebBeansContext webBeansContext = WebBeansContext.currentInstance();
+ ContextsService contextsService = webBeansContext.getContextsService();
+
+ contextsService.startContext(SessionScoped.class, session);
+ }
+
+ @Override
+ public void stopContexts() throws Exception
+ {
+ logger.log(Level.FINE, "stopping all OWB Contexts");
+ WebBeansContext webBeansContext = WebBeansContext.currentInstance();
+ ContextsService contextsService = webBeansContext.getContextsService();
+
+ stopSessionScope();
+ stopConversationScope();
+ stopRequestScope();
+ stopApplicationScope();
+ contextsService.endContext(Singleton.class, null);
+ }
+
+ @Override
+ public void stopApplicationScope() throws Exception
+ {
+ logger.log(Level.FINE, "stopping the OWB ApplicationContext");
+ WebBeansContext webBeansContext = WebBeansContext.currentInstance();
+ ContextsService contextsService = webBeansContext.getContextsService();
+ contextsService.endContext(ApplicationScoped.class, servletContext);
+ }
+
+ @Override
+ public void stopConversationScope() throws Exception
+ {
+ logger.log(Level.FINE, "stopping the OWB ConversationContext");
+ WebBeansContext webBeansContext = WebBeansContext.currentInstance();
+ ContextsService contextsService = webBeansContext.getContextsService();
+ contextsService.endContext(ConversationScoped.class, null);
+ }
+
+ @Override
+ public void stopCustomScope(Class<? extends Annotation> scopeClass) throws Exception
+ {
+ //X TODO
+ }
+
+ @Override
+ public void stopRequestScope() throws Exception
+ {
+ logger.log(Level.FINE, "stopping the OWB RequestContext");
+ WebBeansContext webBeansContext = WebBeansContext.currentInstance();
+ ContextsService contextsService = webBeansContext.getContextsService();
+ contextsService.endContext(RequestScoped.class, null);
+ }
+
+ @Override
+ public void stopSessionScope() throws Exception
+ {
+ logger.log(Level.FINE, "stopping the OWB SessionContext");
+ WebBeansContext webBeansContext = WebBeansContext.currentInstance();
+ ContextsService contextsService = webBeansContext.getContextsService();
+
+ contextsService.endContext(SessionScoped.class, session);
+ }
+
+ @Override
+ public BeanManager getBeanManager()
+ {
+ return lifecycle.getBeanManager();
+ }
+
+ @Override
+ public <T> T getInstance(Class<T> type, Annotation... qualifiers)
+ throws ResolutionException
+ {
+ Set<Bean<?>> beans = getBeanManager().getBeans(type, qualifiers);
+ Bean<?> bean = getBeanManager().resolve(beans);
+
+ @SuppressWarnings("unchecked")
+ T instance = (T) getBeanManager().getReference(bean, type, getBeanManager().createCreationalContext(bean));
+ return instance;
+ }
+
+ @Override
+ public Object getInstance(String name)
+ throws ResolutionException
+ {
+ Set<Bean<?>> beans = getBeanManager().getBeans(name);
+ Bean<?> bean = getBeanManager().resolve(beans);
+
+ @SuppressWarnings("unchecked")
+ Object instance = getBeanManager().getReference(bean, bean.getBeanClass(), getBeanManager().createCreationalContext(bean));
+ return instance;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-test/cditest-owb/src/main/java/org/apache/webbeans/cditest/owb/MockHttpSession.java b/owb_1.2.x/webbeans-test/cditest-owb/src/main/java/org/apache/webbeans/cditest/owb/MockHttpSession.java
new file mode 100644
index 0000000..1404489
--- /dev/null
+++ b/owb_1.2.x/webbeans-test/cditest-owb/src/main/java/org/apache/webbeans/cditest/owb/MockHttpSession.java
@@ -0,0 +1,129 @@
+/*
+ * 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.webbeans.cditest.owb;
+
+import java.util.Enumeration;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionContext;
+
+/**
+ * A simple mock HttpSession
+ */
+public class MockHttpSession implements HttpSession
+{
+
+ @Override
+ public long getCreationTime()
+ {
+ return 0;
+ }
+
+ @Override
+ public String getId()
+ {
+ return "sessId1";
+ }
+
+ @Override
+ public long getLastAccessedTime()
+ {
+ return 0;
+ }
+
+ @Override
+ public ServletContext getServletContext()
+ {
+ return null;
+ }
+
+ @Override
+ public void setMaxInactiveInterval(int interval)
+ {
+ }
+
+ @Override
+ public int getMaxInactiveInterval()
+ {
+ return 0;
+ }
+
+ @Override
+ public HttpSessionContext getSessionContext()
+ {
+ return null;
+ }
+
+ @Override
+ public Object getAttribute(String name)
+ {
+ return null;
+ }
+
+ @Override
+ public Object getValue(String name)
+ {
+ return null;
+ }
+
+ @Override
+ public Enumeration getAttributeNames()
+ {
+ return null;
+ }
+
+ @Override
+ public String[] getValueNames()
+ {
+ return new String[0];
+ }
+
+ @Override
+ public void setAttribute(String name, Object value)
+ {
+ }
+
+ @Override
+ public void putValue(String name, Object value)
+ {
+ }
+
+ @Override
+ public void removeAttribute(String name)
+ {
+ }
+
+ @Override
+ public void removeValue(String name)
+ {
+ }
+
+ @Override
+ public void invalidate()
+ {
+ }
+
+ @Override
+ public boolean isNew()
+ {
+ return false;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-test/cditest-owb/src/main/java/org/apache/webbeans/cditest/owb/MockServletContext.java b/owb_1.2.x/webbeans-test/cditest-owb/src/main/java/org/apache/webbeans/cditest/owb/MockServletContext.java
new file mode 100644
index 0000000..45f1a6e
--- /dev/null
+++ b/owb_1.2.x/webbeans-test/cditest-owb/src/main/java/org/apache/webbeans/cditest/owb/MockServletContext.java
@@ -0,0 +1,202 @@
+/*
+ * 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.webbeans.cditest.owb;
+
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+/**
+ * Mock ServletContext needed to startup the container.
+ *
+ */
+public class MockServletContext implements ServletContext
+{
+
+ @SuppressWarnings("unchecked")
+ private Hashtable attributes = new Hashtable();
+
+ @Override
+ public Object getAttribute(String name)
+ {
+ return attributes.get(name);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Enumeration getAttributeNames()
+ {
+ return attributes.keys();
+ }
+
+ @Override
+ public ServletContext getContext(String uripath)
+ {
+ return this;
+ }
+
+ @Override
+ public String getContextPath()
+ {
+ return "mockContextpath";
+ }
+
+ @Override
+ public String getInitParameter(String name)
+ {
+ return null;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Enumeration getInitParameterNames()
+ {
+ return new StringTokenizer(""); // 'standard' empty Enumeration
+ }
+
+ @Override
+ public int getMajorVersion()
+ {
+ return 2;
+ }
+
+ @Override
+ public String getMimeType(String file)
+ {
+ return null;
+ }
+
+ @Override
+ public int getMinorVersion()
+ {
+ return 0;
+ }
+
+ @Override
+ public RequestDispatcher getNamedDispatcher(String name)
+ {
+ return null;
+ }
+
+ @Override
+ public String getRealPath(String path)
+ {
+ return "mockRealPath";
+ }
+
+ @Override
+ public RequestDispatcher getRequestDispatcher(String path)
+ {
+ return null;
+ }
+
+ @Override
+ public URL getResource(String path) throws MalformedURLException
+ {
+ return null;
+ }
+
+ @Override
+ public InputStream getResourceAsStream(String path)
+ {
+ return null;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Set getResourcePaths(String path)
+ {
+ return null;
+ }
+
+ @Override
+ public String getServerInfo()
+ {
+ return "mockServer";
+ }
+
+ @Override
+ public Servlet getServlet(String name) throws ServletException
+ {
+ return null;
+ }
+
+ @Override
+ public String getServletContextName()
+ {
+ return null;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Enumeration getServletNames()
+ {
+ return null;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Enumeration getServlets()
+ {
+ return null;
+ }
+
+ @Override
+ public void log(String msg)
+ {
+ // TODO
+ }
+
+ @Override
+ public void log(Exception exception, String msg)
+ {
+ // TODO
+
+ }
+
+ @Override
+ public void log(String message, Throwable throwable)
+ {
+ // TODO
+
+ }
+
+ @Override
+ public void removeAttribute(String name)
+ {
+ attributes.remove(name);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void setAttribute(String name, Object object)
+ {
+ attributes.put(name, object);
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-test/cditest-owb/src/main/resources/META-INF/openwebbeans/openwebbeans.properties b/owb_1.2.x/webbeans-test/cditest-owb/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
new file mode 100644
index 0000000..8f221f4
--- /dev/null
+++ b/owb_1.2.x/webbeans-test/cditest-owb/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
@@ -0,0 +1,33 @@
+#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.
+
+# this is the test configuration, thus it has an ordinal between the plugins and the application
+configuration.ordinal=60
+
+# use non-JTA resource injection
+org.apache.webbeans.spi.ResourceInjectionService=org.apache.webbeans.resource.spi.se.StandaloneResourceInjectionService
+
+#Lifecycle to start container
+org.apache.webbeans.spi.ContainerLifecycle=org.apache.webbeans.lifecycle.StandaloneLifeCycle
+
+# we force the default implementation of org.apache.webbeans.corespi.ContextsService.
+# because picking up e.g. the WebContextsService would make unit tests stop working
+org.apache.webbeans.spi.ContextsService=org.apache.webbeans.corespi.se.DefaultContextsService
+
+# To avoid any contextual instance caching issues, we also reset the configured proxies
+org.apache.webbeans.proxy.mapping.javax.enterprise.context.RequestScoped=org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler
+org.apache.webbeans.proxy.mapping.javax.enterprise.context.ApplicationScoped=org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler
diff --git a/owb_1.2.x/webbeans-test/cditest-owb/src/main/resources/META-INF/services/org.apache.webbeans.cditest.CdiTestContainer b/owb_1.2.x/webbeans-test/cditest-owb/src/main/resources/META-INF/services/org.apache.webbeans.cditest.CdiTestContainer
new file mode 100644
index 0000000..f89cc48
--- /dev/null
+++ b/owb_1.2.x/webbeans-test/cditest-owb/src/main/resources/META-INF/services/org.apache.webbeans.cditest.CdiTestContainer
@@ -0,0 +1,24 @@
+# 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.
+
+
+#
+# This will register the OpenWebBeans specific CdiTestContainer
+# as a service and make it available for use in Unit Tests.
+
+org.apache.webbeans.cditest.owb.CdiTestOpenWebBeansContainer
+
diff --git a/owb_1.2.x/webbeans-test/cditest-owb/src/test/java/org/apache/webbeans/cditest/test/ApplicationScopedTestBean.java b/owb_1.2.x/webbeans-test/cditest-owb/src/test/java/org/apache/webbeans/cditest/test/ApplicationScopedTestBean.java
new file mode 100644
index 0000000..e3e0d39
--- /dev/null
+++ b/owb_1.2.x/webbeans-test/cditest-owb/src/test/java/org/apache/webbeans/cditest/test/ApplicationScopedTestBean.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.cditest.test;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.ApplicationScoped;
+
+@ApplicationScoped
+public class ApplicationScopedTestBean implements Serializable {
+ private int i = 0;
+
+ public int getI() {
+ return i;
+ }
+
+ public void setI(int i) {
+ this.i = i;
+ }
+}
diff --git a/owb_1.2.x/webbeans-test/cditest-owb/src/test/java/org/apache/webbeans/cditest/test/RequestScopedTestBean.java b/owb_1.2.x/webbeans-test/cditest-owb/src/test/java/org/apache/webbeans/cditest/test/RequestScopedTestBean.java
new file mode 100644
index 0000000..fe97aaf
--- /dev/null
+++ b/owb_1.2.x/webbeans-test/cditest-owb/src/test/java/org/apache/webbeans/cditest/test/RequestScopedTestBean.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.cditest.test;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.RequestScoped;
+
+@RequestScoped
+public class RequestScopedTestBean implements Serializable {
+ private int i = 0;
+
+ public int getI() {
+ return i;
+ }
+
+ public void setI(int i) {
+ this.i = i;
+ }
+}
diff --git a/owb_1.2.x/webbeans-test/cditest-owb/src/test/java/org/apache/webbeans/cditest/test/SessionScopedTestBean.java b/owb_1.2.x/webbeans-test/cditest-owb/src/test/java/org/apache/webbeans/cditest/test/SessionScopedTestBean.java
new file mode 100644
index 0000000..1b2a95f
--- /dev/null
+++ b/owb_1.2.x/webbeans-test/cditest-owb/src/test/java/org/apache/webbeans/cditest/test/SessionScopedTestBean.java
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.cditest.test;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+
+@SessionScoped
+public class SessionScopedTestBean implements Serializable {
+ private int i = 0;
+
+ public int getI() {
+ return i;
+ }
+
+ public void setI(int i) {
+ this.i = i;
+ }
+}
diff --git a/owb_1.2.x/webbeans-test/cditest-owb/src/test/java/org/apache/webbeans/cditest/test/TestOwbTestContainer.java b/owb_1.2.x/webbeans-test/cditest-owb/src/test/java/org/apache/webbeans/cditest/test/TestOwbTestContainer.java
new file mode 100644
index 0000000..0737483
--- /dev/null
+++ b/owb_1.2.x/webbeans-test/cditest-owb/src/test/java/org/apache/webbeans/cditest/test/TestOwbTestContainer.java
@@ -0,0 +1,96 @@
+/*
+ * 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.webbeans.cditest.test;
+
+import org.apache.webbeans.cditest.CdiTestContainer;
+import org.apache.webbeans.cditest.CdiTestContainerLoader;
+import org.junit.Test;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+public class TestOwbTestContainer extends TestCase {
+
+ private static final int DEFAULT_VAL = 42;
+
+ @Test
+ public void testInstanceRetrieval() throws Exception
+ {
+ CdiTestContainer cdi = CdiTestContainerLoader.getCdiContainer();
+ cdi.bootContainer();
+ cdi.startContexts();
+
+ assertAll(cdi, 0);
+
+ cdi.stopContexts();
+ cdi.startContexts();
+
+ assertAll(cdi, 0);
+
+ cdi.stopRequestScope();
+ cdi.stopSessionScope();
+ cdi.stopApplicationScope();
+ cdi.startRequestScope();
+ cdi.startSessionScope();
+ cdi.startApplicationScope();
+
+ assertAll(cdi, 0);
+
+ cdi.stopRequestScope();
+ cdi.startRequestScope();
+
+ assertReq(cdi, 0);
+ assertSess(cdi, DEFAULT_VAL);
+ assertApp(cdi, DEFAULT_VAL);
+
+ cdi.shutdownContainer();
+ }
+
+ private void assertAll(CdiTestContainer cdi, int value) {
+ assertReq(cdi, value);
+ assertSess(cdi, value);
+ assertApp(cdi, value);
+ }
+
+ private void assertReq(CdiTestContainer cdi, int value)
+ {
+ RequestScopedTestBean testReq = cdi.getInstance(RequestScopedTestBean.class);
+ Assert.assertNotNull(testReq);
+ Assert.assertEquals(value, testReq.getI());
+ testReq.setI(DEFAULT_VAL);
+
+ }
+
+ private void assertSess(CdiTestContainer cdi, int value)
+ {
+ SessionScopedTestBean testSess = cdi.getInstance(SessionScopedTestBean.class);
+ Assert.assertNotNull(testSess);
+ Assert.assertEquals(value, testSess.getI());
+ testSess.setI(DEFAULT_VAL);
+
+ }
+
+ private void assertApp(CdiTestContainer cdi, int value)
+ {
+ ApplicationScopedTestBean testApp = cdi.getInstance(ApplicationScopedTestBean.class);
+ Assert.assertNotNull(testApp);
+ Assert.assertEquals(value, testApp.getI());
+ testApp.setI(DEFAULT_VAL);
+ }
+}
diff --git a/owb_1.2.x/webbeans-test/cditest-owb/src/test/resources/META-INF/beans.xml b/owb_1.2.x/webbeans-test/cditest-owb/src/test/resources/META-INF/beans.xml
new file mode 100644
index 0000000..85b6e63
--- /dev/null
+++ b/owb_1.2.x/webbeans-test/cditest-owb/src/test/resources/META-INF/beans.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+<beans/>
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-test/cditest/pom.xml b/owb_1.2.x/webbeans-test/cditest/pom.xml
new file mode 100644
index 0000000..c9383ba
--- /dev/null
+++ b/owb_1.2.x/webbeans-test/cditest/pom.xml
@@ -0,0 +1,57 @@
+<?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.
+ -->
+
+<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>
+ <groupId>org.apache.openwebbeans.test</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.2.5</version>
+ </parent>
+ <artifactId>cditest</artifactId>
+ <packaging>jar</packaging>
+
+ <name>CDI Testing API</name>
+ <description>
+ This project provides a way to genericly run CDI containers
+ from inside of unit tests like junit or testng.
+ </description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/owb_1.2.x/webbeans-test/cditest/src/main/java/org/apache/webbeans/cditest/CdiTestContainer.java b/owb_1.2.x/webbeans-test/cditest/src/main/java/org/apache/webbeans/cditest/CdiTestContainer.java
new file mode 100644
index 0000000..68298c4
--- /dev/null
+++ b/owb_1.2.x/webbeans-test/cditest/src/main/java/org/apache/webbeans/cditest/CdiTestContainer.java
@@ -0,0 +1,97 @@
+/*
+ * 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.webbeans.cditest;
+
+
+import java.lang.annotation.Annotation;
+import javax.enterprise.inject.ResolutionException;
+import javax.enterprise.inject.spi.BeanManager;
+
+
+/**
+ * A CdiTestContainer provides access to an underlying JSR-299 (CDI)
+ * Container. It allows starting and stopping the container as to start
+ * and stop single contexts.
+ *
+ */
+public interface CdiTestContainer
+{
+ /**
+ * Booting the CdiTestContainer will scan the whole classpath
+ * for Beans and extensions available.
+ */
+ public void bootContainer() throws Exception;
+
+ /**
+ * This will shutdown the underlying CDI container.
+ */
+ public void shutdownContainer() throws Exception;
+
+ /**
+ * This will start all Contexts
+ */
+ public void startContexts() throws Exception;
+
+ /**
+ * Stop all Contexts and destroy all beans properly
+ */
+ public void stopContexts() throws Exception;
+
+
+ public void startApplicationScope() throws Exception;
+ public void stopApplicationScope() throws Exception;
+
+ public void startSessionScope() throws Exception;
+ public void stopSessionScope() throws Exception;
+
+ public void startRequestScope() throws Exception;
+ public void stopRequestScope() throws Exception;
+
+ public void startConversationScope() throws Exception;
+ public void stopConversationScope() throws Exception;
+
+ public void startCustomScope(Class<? extends Annotation> scopeClass) throws Exception;
+ public void stopCustomScope(Class<? extends Annotation> scopeClass) throws Exception;
+
+ /**
+ * @return the {@link BeanManager} or <code>null</code> it not available
+ */
+ public BeanManager getBeanManager();
+
+ /**
+ * Provide a contextual reference via it's type and optional qualifier annotations.
+ * If no qualifier is given, @Default is assumed.
+ * @param <T> the Type of the contextual reference
+ * @param type the Type of the contextual reference
+ * @param qualifiers optional qualifiers to restrict the search
+ * @return a contextual reference of the given bean if it is not ambiguous.
+ * @throws ResolutionException if not exactly 1 {@code Bean<T>} got found
+ */
+ public <T> T getInstance(Class<T> type, Annotation... qualifiers) throws ResolutionException;
+
+ /**
+ * Provide a contextual reference via it's type and ExpressionLanguage name.
+ * @param <T> the Type of the contextual reference
+ * @param elName the EL name to search for.
+ * @return a contextual reference of the given bean via it's name.
+ * @throws ResolutionException if not exactly 1 {@code Bean<T>} got found
+ */
+ public Object getInstance(String elNname) throws ResolutionException;
+
+}
diff --git a/owb_1.2.x/webbeans-test/cditest/src/main/java/org/apache/webbeans/cditest/CdiTestContainerLoader.java b/owb_1.2.x/webbeans-test/cditest/src/main/java/org/apache/webbeans/cditest/CdiTestContainerLoader.java
new file mode 100644
index 0000000..8ca9ba0
--- /dev/null
+++ b/owb_1.2.x/webbeans-test/cditest/src/main/java/org/apache/webbeans/cditest/CdiTestContainerLoader.java
@@ -0,0 +1,60 @@
+/*
+ * 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.webbeans.cditest;
+
+import java.util.Iterator;
+import java.util.ServiceLoader;
+
+/**
+ * <p>This class provides access to the CdiTestContainer.</p>
+ * <p>It uses the {@code java.util.ServiceLoader} mechanism to
+ * automatically pickup the container providers from the classpath.</p>
+ *
+ */
+public class CdiTestContainerLoader
+{
+ private CdiTestContainerLoader()
+ {
+ // utility class doesn't have a public ct
+ }
+
+ public static CdiTestContainer getCdiContainer()
+ {
+ CdiTestContainer testContainer = null;
+
+ //doesn't support the implementation loader (there is no dependency to owb-impl
+ ServiceLoader<CdiTestContainer> cdiContainerLoader = ServiceLoader.load(CdiTestContainer.class);
+ Iterator<CdiTestContainer> cdiIt = cdiContainerLoader.iterator();
+ if (cdiIt.hasNext())
+ {
+ testContainer = cdiIt.next();
+ }
+ else
+ {
+ throw new RuntimeException("Could not find a CdiTestContainer available in the classpath!");
+ }
+
+ if (cdiIt.hasNext())
+ {
+ throw new RuntimeException("Too many CdiTestContainers found in the classpath!");
+ }
+
+ return testContainer;
+ }
+}
diff --git a/owb_1.2.x/webbeans-test/pom.xml b/owb_1.2.x/webbeans-test/pom.xml
new file mode 100644
index 0000000..d9048ef
--- /dev/null
+++ b/owb_1.2.x/webbeans-test/pom.xml
@@ -0,0 +1,39 @@
+<?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.
+-->
+<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>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>1.2.5</version>
+ </parent>
+ <groupId>org.apache.openwebbeans.test</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>CDI Test Framework</name>
+ <description>
+ This module contains testing support for CDI containers and
+ also provides an implementation for OpenWebBeans.
+ </description>
+ <modules>
+ <module>cditest</module>
+ <module>cditest-owb</module>
+ </modules>
+</project>
diff --git a/owb_1.2.x/webbeans-test/src/site/site.xml b/owb_1.2.x/webbeans-test/src/site/site.xml
new file mode 100644
index 0000000..d126925
--- /dev/null
+++ b/owb_1.2.x/webbeans-test/src/site/site.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<project name="OpenWebBeans">
+ <bannerLeft>
+ <name>Apache OpenWebBeans</name>
+ <src>http://openwebbeans.apache.org/owb/images/logos/openwebbeans_hor.png</src>
+ <href>http://openwebbeans.apache.org</href>
+ </bannerLeft>
+
+ <bannerRight>
+ <name>Apache Banner</name>
+ <src>http://www.apache.org/images/asf-logo.gif</src>
+ <href>http://www.apache.org</href>
+ </bannerRight>
+
+ <publishDate format="dd MMM yyyy" />
+ <version position="left"/>
+
+ <body>
+ <breadcrumbs>
+ <item name="Apache" href="http://apache.org"/>
+ <item name="OpenWebBeans" href="http://openwebbeans.apache.org"/>
+ <item name="CDI-Test" href="http://openwebbeans.apache.org/${project.version}/openwebbeans-test"/>
+ </breadcrumbs>
+
+ <menu ref="modules" />
+
+ <menu ref="reports"/>
+ </body>
+</project>
+
diff --git a/owb_1.2.x/webbeans-tomcat6/pom.xml b/owb_1.2.x/webbeans-tomcat6/pom.xml
new file mode 100644
index 0000000..d6bb560
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat6/pom.xml
@@ -0,0 +1,105 @@
+<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">
+<!--
+
+ 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.
+-->
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>1.2.5</version>
+ </parent>
+
+ <artifactId>openwebbeans-tomcat6</artifactId>
+ <name>Tomcat 6 plugin</name>
+ <description>ApacheOpenWebBeans Tomcat 6 Web Profile</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>catalina</artifactId>
+ <version>6.0.35</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-web</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>run-its</id>
+ <build>
+ <plugins>
+ <!-- invoke the integration tests under src/it -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <configuration>
+ <debug>true</debug>
+ <projectsDirectory>src/it</projectsDirectory>
+ <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+ <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
+ <settingsFile>src/it/settings.xml</settingsFile>
+ <pomIncludes>
+ <pomInclude>*/pom.xml</pomInclude>
+ </pomIncludes>
+ <goals>
+ <goal>install</goal>
+ </goals>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>install</goal>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/owb_1.2.x/webbeans-tomcat6/src/it/servletinjection/pom.xml b/owb_1.2.x/webbeans-tomcat6/src/it/servletinjection/pom.xml
new file mode 100644
index 0000000..67f3781
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat6/src/it/servletinjection/pom.xml
@@ -0,0 +1,190 @@
+<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">
+ <!--
+
+ 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.
+ -->
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>@project.version@</version>
+ </parent>
+
+ <groupId>org.apache.openwebbeans.it</groupId>
+ <artifactId>openwebbeans-tomcat6-it-servletinjection</artifactId>
+ <version>@project.version@</version>
+ <packaging>war</packaging>
+ <name>Tomcat 6 plugin IT</name>
+
+ <properties>
+ <tomcat.port.it>9086</tomcat.port.it>
+ <tomcat6.version>6.0.35</tomcat6.version>
+ <jstl.version>1.2</jstl.version>
+ <projectStage>Development</projectStage>
+ </properties>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>4.2.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_3.0_spec</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>owbtomcat6it</finalName>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <!-- needed for the tomcat6 integration tests -->
+ <groupId>org.apache.tomcat.maven</groupId>
+ <artifactId>tomcat6-maven-plugin</artifactId>
+ <version>2.0</version>
+ </plugin>
+
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>2.11</version>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>integration-test</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>verify</id>
+ <goals>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.tomcat.maven</groupId>
+ <artifactId>tomcat6-maven-plugin</artifactId>
+ <version>2.0</version>
+ <configuration>
+ <path>/${project.build.finalName}</path>
+ <addContextWarDependencies>true</addContextWarDependencies>
+ <port>${tomcat.port.it}</port>
+ <fork>true</fork> <!-- needed for testing ITs -->
+ <systemProperties>
+ <org.apache.myfaces.PROJECT_STAGE>${projectStage}</org.apache.myfaces.PROJECT_STAGE>
+ <faces.PROJECT_STAGE>${projectStage}</faces.PROJECT_STAGE>
+ </systemProperties>
+ </configuration>
+ <executions>
+ <execution>
+ <id>start-tomcat</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>stop-tomcat</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>shutdown</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ <version>@project.version@</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-web</artifactId>
+ <version>@project.version@</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-tomcat6</artifactId>
+ <version>@project.version@</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+
+
+</project>
diff --git a/owb_1.2.x/webbeans-tomcat6/src/it/servletinjection/src/main/java/org/apache/webbeans/web/tomcat6/test/TestBean.java b/owb_1.2.x/webbeans-tomcat6/src/it/servletinjection/src/main/java/org/apache/webbeans/web/tomcat6/test/TestBean.java
new file mode 100644
index 0000000..075c113
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat6/src/it/servletinjection/src/main/java/org/apache/webbeans/web/tomcat6/test/TestBean.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.web.tomcat6.test;
+
+import javax.enterprise.context.ApplicationScoped;
+
+/**
+ * Test bean which gets used in the TestServlet.
+ */
+@ApplicationScoped
+public class TestBean
+{
+ int i = 4711;
+
+ public int getI()
+ {
+ return i;
+ }
+
+ public void setI(int i)
+ {
+ this.i = i;
+ }
+}
diff --git a/owb_1.2.x/webbeans-tomcat6/src/it/servletinjection/src/main/java/org/apache/webbeans/web/tomcat6/test/TestServlet.java b/owb_1.2.x/webbeans-tomcat6/src/it/servletinjection/src/main/java/org/apache/webbeans/web/tomcat6/test/TestServlet.java
new file mode 100644
index 0000000..51b0102
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat6/src/it/servletinjection/src/main/java/org/apache/webbeans/web/tomcat6/test/TestServlet.java
@@ -0,0 +1,65 @@
+/*
+ * 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.webbeans.web.tomcat6.test;
+
+import javax.inject.Inject;
+import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import java.io.IOException;
+
+/**
+ * Dummy Servlet which just checks whether CDI injection works
+ */
+public class TestServlet implements Servlet
+{
+
+ @Inject
+ private TestBean tb;
+
+ public void destroy()
+ {
+ // nothing to do
+ }
+
+ public void init(ServletConfig config) throws ServletException
+ {
+ // nothing to do
+ }
+
+ public ServletConfig getServletConfig()
+ {
+ return null;
+ }
+
+ public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException
+ {
+ if (tb == null || tb.getI() != 4711)
+ {
+ throw new RuntimeException("CDI Injction doesn not work!");
+ }
+ }
+
+ public String getServletInfo()
+ {
+ return null;
+ }
+}
diff --git a/owb_1.2.x/webbeans-tomcat6/src/it/servletinjection/src/main/resources/META-INF/beans.xml b/owb_1.2.x/webbeans-tomcat6/src/it/servletinjection/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000..7d56d3d
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat6/src/it/servletinjection/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+<beans/>
diff --git a/owb_1.2.x/webbeans-tomcat6/src/it/servletinjection/src/main/webapp/META-INF/context.xml b/owb_1.2.x/webbeans-tomcat6/src/it/servletinjection/src/main/webapp/META-INF/context.xml
new file mode 100644
index 0000000..9b10a7e
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat6/src/it/servletinjection/src/main/webapp/META-INF/context.xml
@@ -0,0 +1,19 @@
+<!--
+
+ 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.
+-->
+<Context>
+ <Listener className="org.apache.webbeans.web.tomcat.ContextLifecycleListener" />
+</Context>
diff --git a/owb_1.2.x/webbeans-tomcat6/src/it/servletinjection/src/main/webapp/WEB-INF/beans.xml b/owb_1.2.x/webbeans-tomcat6/src/it/servletinjection/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 0000000..7d56d3d
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat6/src/it/servletinjection/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+<beans/>
diff --git a/owb_1.2.x/webbeans-tomcat6/src/it/servletinjection/src/main/webapp/WEB-INF/web.xml b/owb_1.2.x/webbeans-tomcat6/src/it/servletinjection/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..cc17ba8
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat6/src/it/servletinjection/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,33 @@
+<?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.
+-->
+<web-app id="owb-it" version="3.0"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+ <servlet>
+ <servlet-name>TestServlet</servlet-name>
+ <servlet-class>org.apache.webbeans.web.tomcat6.test.TestServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>TestServlet</servlet-name>
+ <url-pattern>*.test</url-pattern>
+ </servlet-mapping>
+</web-app>
diff --git a/owb_1.2.x/webbeans-tomcat6/src/it/servletinjection/src/test/java/org/apache/webbeans/web/tomcat6/test/OwbTomcatPluginIT.java b/owb_1.2.x/webbeans-tomcat6/src/it/servletinjection/src/test/java/org/apache/webbeans/web/tomcat6/test/OwbTomcatPluginIT.java
new file mode 100644
index 0000000..c08832f
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat6/src/it/servletinjection/src/test/java/org/apache/webbeans/web/tomcat6/test/OwbTomcatPluginIT.java
@@ -0,0 +1,60 @@
+/*
+ * 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.webbeans.web.tomcat6.test;
+
+
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.DefaultHttpClient;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.lang.StringBuilder;
+
+/**
+ * Simple requests to the tomcat installation
+ */
+public class OwbTomcatPluginIT
+{
+ @Test
+ public void testTomcatRequest() throws Exception
+ {
+ DefaultHttpClient httpclient = new DefaultHttpClient();
+ HttpGet httpGet = new HttpGet("http://localhost:9086/owbtomcat6it/test.test");
+
+ HttpResponse response = httpclient.execute(httpGet);
+
+ // Get the response
+ BufferedReader rd = new BufferedReader
+ (new InputStreamReader(response.getEntity().getContent()));
+
+ StringBuilder builder = new StringBuilder();
+ String line = "";
+ while ((line = rd.readLine()) != null) {
+ builder.append(line);
+ }
+
+ Assert.assertNotNull(response);
+ Assert.assertEquals("Got " + builder.toString(), 200, response.getStatusLine().getStatusCode());
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-tomcat6/src/it/settings.xml b/owb_1.2.x/webbeans-tomcat6/src/it/settings.xml
new file mode 100644
index 0000000..c8f77f0
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat6/src/it/settings.xml
@@ -0,0 +1,55 @@
+<?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.
+-->
+
+<settings>
+ <profiles>
+ <profile>
+ <id>it-repo</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <repositories>
+ <repository>
+ <id>local.central</id>
+ <url>@localRepositoryUrl@</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>local.central</id>
+ <url>@localRepositoryUrl@</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+ </profiles>
+</settings>
diff --git a/owb_1.2.x/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/ContextLifecycleListener.java b/owb_1.2.x/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/ContextLifecycleListener.java
new file mode 100644
index 0000000..68e0587
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/ContextLifecycleListener.java
@@ -0,0 +1,443 @@
+/*
+ * 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.webbeans.web.tomcat;
+
+import org.apache.AnnotationProcessor;
+import org.apache.catalina.Container;
+import org.apache.catalina.ContainerEvent;
+import org.apache.catalina.ContainerListener;
+import org.apache.catalina.LifecycleEvent;
+import org.apache.catalina.LifecycleListener;
+import org.apache.catalina.Service;
+import org.apache.catalina.Lifecycle;
+import org.apache.catalina.core.ContainerBase;
+import org.apache.catalina.core.StandardContext;
+import org.apache.catalina.core.StandardEngine;
+import org.apache.catalina.core.StandardHost;
+import org.apache.catalina.core.StandardServer;
+import org.apache.naming.ContextAccessController;
+import org.apache.webbeans.servlet.WebBeansConfigurationListener;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Field;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+
+import javax.servlet.ServletContext;
+
+/**
+ * Context lifecycle listener. Adapted from
+ * OpenEJB Tomcat and updated.
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public class ContextLifecycleListener implements PropertyChangeListener, LifecycleListener, ContainerListener
+{
+
+ private StandardServer standardServer;
+
+ public ContextLifecycleListener()
+ {
+ System.out.println("MSX TODO REMOVE ContextLifecycleListener invoked");
+ }
+
+ @Override
+ public void lifecycleEvent(LifecycleEvent event)
+ {
+ try
+ {
+ if (event.getSource() instanceof StandardServer)
+ {
+ if (event.getType().equals(Lifecycle.START_EVENT))
+ {
+ this.standardServer = (StandardServer) event.getSource();
+ start();
+ }
+ }
+ else if (event.getSource() instanceof StandardContext)
+ {
+ StandardContext context = (StandardContext) event.getSource();
+
+ if (event.getType().equals(Lifecycle.START_EVENT))
+ {
+ ServletContext scontext = context.getServletContext();
+ URL url = getBeansXml(scontext);
+ if (url != null)
+ {
+ //Registering ELResolver with JSP container
+ System.setProperty("org.apache.webbeans.application.jsp", "true");
+
+ String[] oldListeners = context.findApplicationListeners();
+ LinkedList<String> listeners = new LinkedList<String>();
+ listeners.addFirst(WebBeansConfigurationListener.class.getName());
+ for(String listener : oldListeners)
+ {
+ listeners.add(listener);
+ context.removeApplicationListener(listener);
+ }
+
+ for(String listener : listeners)
+ {
+ context.addApplicationListener(listener);
+ }
+
+ context.addApplicationListener(TomcatSecurityListener.class.getName());
+ context.addContainerListener(this);
+
+ //context.addInstanceListener(TomcatInstanceListener.class.getName());
+ }
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public void containerEvent(ContainerEvent event)
+ {
+ StandardContext context = null;
+
+ try
+ {
+ if(event.getSource() instanceof StandardContext)
+ {
+ context = (StandardContext)event.getSource();
+
+ if(event.getType().equals("beforeContextInitialized"))
+ {
+ ClassLoader loader = context.getLoader().getClassLoader();
+ Object listener = event.getData();
+
+ if(listener.getClass().getName().equals(WebBeansConfigurationListener.class.getName()))
+ {
+ ContextAccessController.setWritable(context.getNamingContextListener().getName(), context);
+ return;
+ }
+ else
+ {
+ URL url = getBeansXml(context.getServletContext());
+ if(url != null)
+ {
+ TomcatUtil.inject(listener, loader);
+ }
+ }
+
+ }
+ else if(event.getType().equals("afterContextInitialized"))
+ {
+ ClassLoader loader = context.getLoader().getClassLoader();
+ Object listener = event.getData();
+
+ if(listener.getClass().getName().equals(WebBeansConfigurationListener.class.getName()))
+ {
+ AnnotationProcessor processor = context.getAnnotationProcessor();
+ AnnotationProcessor custom = new TomcatAnnotProcessor(context.getLoader().getClassLoader(),processor);
+ context.setAnnotationProcessor(custom);
+
+ context.getServletContext().setAttribute(AnnotationProcessor.class.getName(), custom);
+
+ ContextAccessController.setReadOnly(context.getNamingContextListener().getName());
+
+ URL url = getBeansXml(context.getServletContext());
+ if(url != null)
+ {
+ Object[] listeners = context.getApplicationEventListeners();
+ for(Object instance : listeners)
+ {
+ if(!instance.getClass().getName().equals(WebBeansConfigurationListener.class.getName()))
+ {
+ TomcatUtil.inject(instance, loader);
+ }
+ }
+ }
+ }
+ }
+ else if(event.getType().equals("beforeContextDestroyed"))
+ {
+ Object listener = event.getData();
+ if(listener.getClass().getName().equals(WebBeansConfigurationListener.class.getName()))
+ {
+ ContextAccessController.setWritable(context.getNamingContextListener().getName(),context);
+ }
+ }
+ }
+
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void start()
+ {
+ // hook the hosts so we get notified before contexts are started
+ standardServer.addPropertyChangeListener(this);
+ standardServer.addLifecycleListener(this);
+ for (Service service : standardServer.findServices())
+ {
+ serviceAdded(service);
+ }
+ }
+
+ public void stop()
+ {
+ standardServer.removePropertyChangeListener(this);
+ }
+
+ private void serviceAdded(Service service)
+ {
+ Container container = service.getContainer();
+ if (container instanceof StandardEngine)
+ {
+ StandardEngine engine = (StandardEngine) container;
+ engineAdded(engine);
+ }
+ }
+
+ private void engineAdded(StandardEngine engine)
+ {
+ addContextListener(engine);
+ for (Container child : engine.findChildren())
+ {
+ if (child instanceof StandardHost)
+ {
+ StandardHost host = (StandardHost) child;
+ hostAdded(host);
+ }
+ }
+ }
+
+
+ private void hostAdded(StandardHost host)
+ {
+ addContextListener(host);
+ host.addLifecycleListener(this);
+ for (Container child : host.findChildren())
+ {
+ if (child instanceof StandardContext)
+ {
+ StandardContext context = (StandardContext) child;
+ contextAdded(context);
+ }
+ }
+ }
+
+
+ private void contextAdded(StandardContext context)
+ {
+ // put this class as the first listener so we can process the
+ // application before any classes are loaded
+ forceFirstLifecycleListener(context);
+ }
+
+ private void forceFirstLifecycleListener(StandardContext context)
+ {
+ LifecycleListener[] listeners = context.findLifecycleListeners();
+
+ // if we are already first return
+ if (listeners.length > 0 && listeners[0] == this)
+ {
+ return;
+ }
+
+ // remove all of the current listeners
+ for (LifecycleListener listener : listeners)
+ {
+ context.removeLifecycleListener(listener);
+ }
+
+ // add this class (as first)
+ context.addLifecycleListener(this);
+ context.addContainerListener(this);
+
+ // add back all listeners
+ for (LifecycleListener listener : listeners)
+ {
+ if (listener != this)
+ {
+ context.addLifecycleListener(listener);
+ }
+ }
+ }
+
+
+ @Override
+ public void propertyChange(PropertyChangeEvent event)
+ {
+ if ("service".equals(event.getPropertyName()))
+ {
+ Object oldValue = event.getOldValue();
+ Object newValue = event.getNewValue();
+ if (oldValue == null && newValue instanceof Service)
+ {
+ serviceAdded((Service) newValue);
+ }
+ }
+ if ("children".equals(event.getPropertyName()))
+ {
+ Object source = event.getSource();
+ Object oldValue = event.getOldValue();
+ Object newValue = event.getNewValue();
+ if (source instanceof StandardEngine)
+ {
+ if (oldValue == null && newValue instanceof StandardHost)
+ {
+ hostAdded((StandardHost) newValue);
+ }
+ }
+ if (source instanceof StandardHost)
+ {
+ if (oldValue == null && newValue instanceof StandardContext)
+ {
+ contextAdded((StandardContext) newValue);
+ }
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void addContextListener(ContainerBase containerBase)
+ {
+ try
+ {
+ Field field = (Field)AccessController.doPrivileged(new PrivilegedActionForClass(ContainerBase.class, "children"));
+ AccessController.doPrivileged(new PrivilegedActionForAccessibleObject(field, true));
+ Map<Object,Object> children = (Map<Object,Object>) field.get(containerBase);
+ if (children instanceof ContextLifecycleListener.MoniterableHashMap)
+ {
+ return;
+ }
+ children = new ContextLifecycleListener.MoniterableHashMap(children, containerBase, "children", this);
+ field.set(containerBase, children);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ public static class MoniterableHashMap extends HashMap<Object,Object>
+ {
+ private static final long serialVersionUID = 1L;
+
+ private final Object source;
+ private final String propertyName;
+ private final PropertyChangeListener listener;
+
+ public MoniterableHashMap(Map<Object,Object> m, Object source, String propertyName, PropertyChangeListener listener)
+ {
+ super(m);
+ this.source = source;
+ this.propertyName = propertyName;
+ this.listener = listener;
+ }
+
+ @Override
+ public Object put(Object key, Object value)
+ {
+ Object oldValue = super.put(key, value);
+ PropertyChangeEvent event = new PropertyChangeEvent(source, propertyName, null, value);
+ listener.propertyChange(event);
+ return oldValue;
+ }
+
+ @Override
+ public Object remove(Object key)
+ {
+ Object value = super.remove(key);
+ PropertyChangeEvent event = new PropertyChangeEvent(source, propertyName, value, null);
+ listener.propertyChange(event);
+ return value;
+ }
+ }
+
+ private URL getBeansXml(ServletContext scontext) throws MalformedURLException
+ {
+ URL url = scontext.getResource("/WEB-INF/beans.xml");
+ if (url == null)
+ {
+ url = scontext.getResource("/WEB-INF/classes/META-INF/beans.xml");
+ }
+ return url;
+ }
+
+
+ protected static class PrivilegedActionForAccessibleObject implements PrivilegedAction<Object>
+ {
+
+ AccessibleObject object;
+
+ boolean flag;
+
+ protected PrivilegedActionForAccessibleObject(AccessibleObject object, boolean flag)
+ {
+ this.object = object;
+ this.flag = flag;
+ }
+
+ @Override
+ public Object run()
+ {
+ object.setAccessible(flag);
+ return null;
+ }
+ }
+
+ protected static class PrivilegedActionForClass implements PrivilegedAction<Object>
+ {
+ Class<?> clazz;
+
+ Object parameters;
+
+ protected PrivilegedActionForClass(Class<?> clazz, Object parameters)
+ {
+ this.clazz = clazz;
+ this.parameters = parameters;
+ }
+
+ @Override
+ public Object run()
+ {
+ try
+ {
+ return clazz.getDeclaredField((String)parameters);
+ }
+ catch (NoSuchFieldException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/TomcatAnnotProcessor.java b/owb_1.2.x/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/TomcatAnnotProcessor.java
new file mode 100644
index 0000000..0d9da22
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/TomcatAnnotProcessor.java
@@ -0,0 +1,90 @@
+/*
+ * 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.webbeans.web.tomcat;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.naming.NamingException;
+
+import org.apache.AnnotationProcessor;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+
+public class TomcatAnnotProcessor implements AnnotationProcessor
+{
+ private final static Logger logger = WebBeansLoggerFacade.getLogger(TomcatAnnotProcessor.class);
+
+ private AnnotationProcessor processor;
+
+ private ClassLoader loader;
+
+ private Map<Object, Object> objects = new ConcurrentHashMap<Object, Object>();
+
+ public TomcatAnnotProcessor(ClassLoader loader, AnnotationProcessor processor)
+ {
+ this.processor = processor;
+ this.loader = loader;
+ }
+
+ @Override
+ public void postConstruct(Object obj) throws IllegalAccessException, InvocationTargetException
+ {
+ processor.postConstruct(obj);
+ }
+
+ @Override
+ public void preDestroy(Object obj) throws IllegalAccessException, InvocationTargetException
+ {
+ Object injectorInstance = objects.get(obj);
+ if(injectorInstance != null)
+ {
+ try
+ {
+ TomcatUtil.destroy(injectorInstance, loader);
+ }
+ catch (Exception e)
+ {
+ logger.log(Level.SEVERE, "TomcatAnnotProcessor", e);
+ }
+ }
+ processor.preDestroy(obj);
+ }
+
+ @Override
+ public void processAnnotations(Object obj) throws IllegalAccessException, InvocationTargetException, NamingException
+ {
+ processor.processAnnotations(obj);
+ try
+ {
+ Object injectorInstance = TomcatUtil.inject(obj, loader);
+ if(injectorInstance != null)
+ {
+ objects.put(obj, injectorInstance);
+ }
+ }
+ catch (Exception e)
+ {
+ logger.log(Level.SEVERE, "TomcatAnnotProcessor", e);
+ }
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/TomcatSecurityListener.java b/owb_1.2.x/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/TomcatSecurityListener.java
new file mode 100644
index 0000000..f91eee2
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/TomcatSecurityListener.java
@@ -0,0 +1,61 @@
+/*
+ * 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.webbeans.web.tomcat;
+
+import java.security.Principal;
+
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletRequestEvent;
+import javax.servlet.ServletRequestListener;
+import javax.servlet.http.HttpServletRequest;
+
+public class TomcatSecurityListener implements ServletRequestListener
+{
+ public static ThreadLocal<Principal> principal = new ThreadLocal<Principal>();
+
+ public TomcatSecurityListener()
+ {
+
+ }
+
+ @Override
+ public void requestDestroyed(ServletRequestEvent event)
+ {
+ if(principal.get() != null)
+ {
+ principal.remove();
+ }
+ }
+
+ @Override
+ public void requestInitialized(ServletRequestEvent event)
+ {
+ ServletRequest request = event.getServletRequest();
+ if(request instanceof HttpServletRequest)
+ {
+ Principal p = ((HttpServletRequest)request).getUserPrincipal();
+ if(p != null)
+ {
+ principal.set(p);
+ }
+ }
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/TomcatSecurityService.java b/owb_1.2.x/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/TomcatSecurityService.java
new file mode 100644
index 0000000..10d6693
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/TomcatSecurityService.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.web.tomcat;
+
+import java.security.Principal;
+
+import org.apache.webbeans.corespi.security.SimpleSecurityService;
+import org.apache.webbeans.spi.SecurityService;
+
+public class TomcatSecurityService extends SimpleSecurityService implements SecurityService
+{
+
+ @Override
+ public Principal getCurrentPrincipal()
+ {
+ return TomcatSecurityListener.principal.get();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/TomcatUtil.java b/owb_1.2.x/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/TomcatUtil.java
new file mode 100644
index 0000000..1ccd847
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/TomcatUtil.java
@@ -0,0 +1,84 @@
+/*
+ * 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.webbeans.web.tomcat;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.inject.OWBInjector;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.Producer;
+
+public class TomcatUtil
+{
+ public static Object inject(Object object, ClassLoader loader) throws Exception
+ {
+ final ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(loader);
+ CreationalContext<?> context = null;
+ try
+ {
+ final BeanManager beanManager = WebBeansContext.currentInstance().getBeanManagerImpl();
+ context = beanManager.createCreationalContext(null);
+ OWBInjector.inject(beanManager, object, context);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(oldLoader);
+ }
+ return new Instance(object, context);
+ }
+
+ public static void destroy(Object injectorInstance, ClassLoader loader) throws Exception
+ {
+ final Instance instance = (TomcatUtil.Instance) injectorInstance;
+ final ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(loader);
+ try
+ {
+ final BeanManagerImpl beanManager = WebBeansContext.currentInstance().getBeanManagerImpl();
+ final Producer producer = beanManager.getProducerForJavaEeComponent(instance.object.getClass());
+ if (producer != null)
+ {
+ producer.dispose(instance.object);
+ }
+ else if (instance.context != null)
+ {
+ instance.context.release();
+ }
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(oldLoader);
+ }
+ }
+
+ private static class Instance
+ {
+ private Object object;
+ private CreationalContext<?> context;
+
+ private Instance(Object object, CreationalContext<?> context)
+ {
+ this.object = object;
+ this.context = context;
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/TomcatWebPlugin.java b/owb_1.2.x/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/TomcatWebPlugin.java
new file mode 100644
index 0000000..2c35ac6
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/TomcatWebPlugin.java
@@ -0,0 +1,132 @@
+/*
+ * 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.webbeans.web.tomcat;
+
+import javax.jws.WebService;
+import javax.servlet.Filter;
+import javax.servlet.Servlet;
+import javax.servlet.ServletContextAttributeListener;
+import javax.servlet.ServletContextListener;
+import javax.servlet.ServletRequestAttributeListener;
+import javax.servlet.ServletRequestListener;
+import javax.servlet.http.HttpSessionActivationListener;
+import javax.servlet.http.HttpSessionAttributeListener;
+import javax.servlet.http.HttpSessionBindingListener;
+import javax.servlet.http.HttpSessionListener;
+
+import org.apache.webbeans.exception.inject.DefinitionException;
+import org.apache.webbeans.spi.SecurityService;
+import org.apache.webbeans.spi.plugins.AbstractOwbPlugin;
+import org.apache.webbeans.spi.plugins.OpenWebBeansWebPlugin;
+
+/**
+ * Tomcat plugin for OWB.
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public class TomcatWebPlugin extends AbstractOwbPlugin implements OpenWebBeansWebPlugin
+{
+ //Security service implementation.
+ private final TomcatSecurityService securityService = new TomcatSecurityService();
+
+ /**
+ * Default constructor.
+ */
+ public TomcatWebPlugin()
+ {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public <T> T getSupportedService(Class<T> serviceClass)
+ {
+ if(serviceClass.equals(SecurityService.class))
+ {
+ return serviceClass.cast(this.securityService);
+ }
+
+ return null;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void isManagedBean(Class<?> clazz)
+ {
+ if(Servlet.class.isAssignableFrom(clazz) ||
+ Filter.class.isAssignableFrom(clazz) ||
+ ServletContextListener.class.isAssignableFrom(clazz) ||
+ ServletContextAttributeListener.class.isAssignableFrom(clazz) ||
+ HttpSessionActivationListener.class.isAssignableFrom(clazz) ||
+ HttpSessionAttributeListener.class.isAssignableFrom(clazz) ||
+ HttpSessionBindingListener.class.isAssignableFrom(clazz) ||
+ HttpSessionListener.class.isAssignableFrom(clazz) ||
+ ServletRequestListener.class.isAssignableFrom(clazz) ||
+ ServletRequestAttributeListener.class.isAssignableFrom(clazz) )
+ {
+ throw new DefinitionException("Given class : " + clazz.getName() + " is not managed bean");
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean supportsJavaEeComponentInjections(Class<?> clazz)
+ {
+ if(Servlet.class.isAssignableFrom(clazz) ||
+ Filter.class.isAssignableFrom(clazz) ||
+ ServletContextListener.class.isAssignableFrom(clazz) ||
+ ServletContextAttributeListener.class.isAssignableFrom(clazz) ||
+ HttpSessionActivationListener.class.isAssignableFrom(clazz) ||
+ HttpSessionAttributeListener.class.isAssignableFrom(clazz) ||
+ HttpSessionBindingListener.class.isAssignableFrom(clazz) ||
+ HttpSessionListener.class.isAssignableFrom(clazz) ||
+ ServletRequestListener.class.isAssignableFrom(clazz) ||
+ ServletRequestAttributeListener.class.isAssignableFrom(clazz) ||
+ clazz.isAnnotationPresent(WebService.class))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean supportService(Class<?> serviceClass)
+ {
+ if(serviceClass.equals(SecurityService.class))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-tomcat6/src/main/resources/META-INF/services/org.apache.webbeans.spi.plugins.OpenWebBeansPlugin b/owb_1.2.x/webbeans-tomcat6/src/main/resources/META-INF/services/org.apache.webbeans.spi.plugins.OpenWebBeansPlugin
new file mode 100644
index 0000000..d824eb8
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat6/src/main/resources/META-INF/services/org.apache.webbeans.spi.plugins.OpenWebBeansPlugin
@@ -0,0 +1,17 @@
+#Licensed to the Apache Software Foundation (ASF) under one
+#or more contributor license agreements. See the NOTICE file
+#distributed with this work for additional information
+#regarding copyright ownership. The ASF licenses this file
+#to you under the Apache License, Version 2.0 (the
+#"License"); you may not use this file except in compliance
+#with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+#Unless required by applicable law or agreed to in writing,
+#software distributed under the License is distributed on an
+#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#KIND, either express or implied. See the License for the
+#specific language governing permissions and limitations
+#under the License.
+org.apache.webbeans.web.tomcat.TomcatWebPlugin
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-tomcat6/src/site/site.xml b/owb_1.2.x/webbeans-tomcat6/src/site/site.xml
new file mode 100644
index 0000000..424a1c1
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat6/src/site/site.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<project name="OpenWebBeans">
+ <bannerLeft>
+ <name>Apache OpenWebBeans</name>
+ <src>http://openwebbeans.apache.org/owb/images/logos/openwebbeans_hor.png</src>
+ <href>http://openwebbeans.apache.org</href>
+ </bannerLeft>
+
+ <bannerRight>
+ <name>Apache Banner</name>
+ <src>http://www.apache.org/images/asf-logo.gif</src>
+ <href>http://www.apache.org</href>
+ </bannerRight>
+
+ <publishDate format="dd MMM yyyy" />
+ <version position="left"/>
+
+ <body>
+ <breadcrumbs>
+ <item name="Apache" href="http://www.apache.org"/>
+ <item name="OpenWebBeans" href="http://openwebbeans.apache.org"/>
+ <item name="OWB-Tomcat-6" href="http://openwebbeans.apache.org/${project.version}/openwebbeans-tomcat6"/>
+ </breadcrumbs>
+
+ <menu ref="reports"/>
+ </body>
+</project>
+
diff --git a/owb_1.2.x/webbeans-tomcat7/pom.xml b/owb_1.2.x/webbeans-tomcat7/pom.xml
new file mode 100644
index 0000000..caad25e
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat7/pom.xml
@@ -0,0 +1,105 @@
+<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">
+<!--
+
+ 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.
+-->
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>1.2.5</version>
+ </parent>
+
+ <artifactId>openwebbeans-tomcat7</artifactId>
+ <name>Tomcat 7 plugin</name>
+ <description>Apache OpenWebBeans Tomcat 7 Web Profile</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-catalina</artifactId>
+ <version>7.0.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-web</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+
+ <profiles>
+ <profile>
+ <id>run-its</id>
+ <build>
+ <plugins>
+ <!-- invoke the integration tests under src/it -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <configuration>
+ <debug>true</debug>
+ <projectsDirectory>src/it</projectsDirectory>
+ <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+ <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
+ <settingsFile>src/it/settings.xml</settingsFile>
+ <pomIncludes>
+ <pomInclude>*/pom.xml</pomInclude>
+ </pomIncludes>
+ <goals>
+ <goal>install</goal>
+ </goals>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>install</goal>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/owb_1.2.x/webbeans-tomcat7/src/it/servletinjection/pom.xml b/owb_1.2.x/webbeans-tomcat7/src/it/servletinjection/pom.xml
new file mode 100644
index 0000000..3e4b397
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat7/src/it/servletinjection/pom.xml
@@ -0,0 +1,312 @@
+<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">
+ <!--
+
+ 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.
+ -->
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>@project.version@</version>
+ </parent>
+
+ <groupId>org.apache.openwebbeans.it</groupId>
+ <artifactId>openwebbeans-tomcat7-it-servletinjection</artifactId>
+ <version>@project.version@</version>
+ <packaging>war</packaging>
+ <name>Tomcat 7 plugin IT</name>
+
+ <properties>
+ <tomcat.port.it>9081</tomcat.port.it>
+ <tomcat7.version>7.0.30</tomcat7.version>
+ <jstl.version>1.2</jstl.version>
+ <projectStage>Development</projectStage>
+ </properties>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>4.2.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_3.0_spec</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>owbtomcat7it</finalName>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <!-- needed for the tomcat7 integration tests -->
+ <groupId>org.apache.tomcat.maven</groupId>
+ <artifactId>tomcat7-maven-plugin</artifactId>
+ <version>2.0</version>
+ <dependencies>
+ <dependency>
+ <groupId>jstl</groupId>
+ <artifactId>jstl</artifactId>
+ <version>${jstl.version}</version>
+ </dependency>
+
+ <!--
+ tomcat7-maven-plugin dependencies
+ We need to add those for specifying the version
+ -->
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-core</artifactId>
+ <version>${tomcat7.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-util</artifactId>
+ <version>${tomcat7.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-coyote</artifactId>
+ <version>${tomcat7.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-api</artifactId>
+ <version>${tomcat7.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-jdbc</artifactId>
+ <version>${tomcat7.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-dbcp</artifactId>
+ <version>${tomcat7.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-servlet-api</artifactId>
+ <version>${tomcat7.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-jsp-api</artifactId>
+ <version>${tomcat7.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-jasper</artifactId>
+ <version>${tomcat7.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-jasper-el</artifactId>
+ <version>${tomcat7.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-el-api</artifactId>
+ <version>${tomcat7.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-catalina</artifactId>
+ <version>${tomcat7.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-tribes</artifactId>
+ <version>${tomcat7.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-catalina-ha</artifactId>
+ <version>${tomcat7.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-annotations-api</artifactId>
+ <version>${tomcat7.version}</version>
+ </dependency>
+
+ <!-- tomcat i18n too ?? -->
+
+ <!-- not sure we need that -->
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-juli</artifactId>
+ <version>${tomcat7.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-logging-juli</artifactId>
+ <version>${tomcat7.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-logging-log4j</artifactId>
+ <version>${tomcat7.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <version>@project.version@</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ <version>@project.version@</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-web</artifactId>
+ <version>@project.version@</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-tomcat7</artifactId>
+ <version>@project.version@</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>2.11</version>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>integration-test</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>verify</id>
+ <goals>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.tomcat.maven</groupId>
+ <artifactId>tomcat7-maven-plugin</artifactId>
+ <version>2.0</version>
+ <configuration>
+ <path>/${project.build.finalName}</path>
+ <addContextWarDependencies>true</addContextWarDependencies>
+ <port>${tomcat.port.it}</port>
+ <fork>true</fork> <!-- needed for testing ITs -->
+ <systemProperties>
+ <org.apache.myfaces.PROJECT_STAGE>${projectStage}</org.apache.myfaces.PROJECT_STAGE>
+ <faces.PROJECT_STAGE>${projectStage}</faces.PROJECT_STAGE>
+ </systemProperties>
+ </configuration>
+ <executions>
+ <execution>
+ <id>start-tomcat</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>run-war</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>stop-tomcat</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>shutdown</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+
+</project>
diff --git a/owb_1.2.x/webbeans-tomcat7/src/it/servletinjection/src/main/java/org/apache/webbeans/web/tomcat7/test/TestBean.java b/owb_1.2.x/webbeans-tomcat7/src/it/servletinjection/src/main/java/org/apache/webbeans/web/tomcat7/test/TestBean.java
new file mode 100644
index 0000000..3b88f53
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat7/src/it/servletinjection/src/main/java/org/apache/webbeans/web/tomcat7/test/TestBean.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.web.tomcat7.test;
+
+import javax.enterprise.context.ApplicationScoped;
+
+/**
+ * Test bean which gets used in the TestServlet.
+ */
+@ApplicationScoped
+public class TestBean
+{
+ int i = 4711;
+
+ public int getI()
+ {
+ return i;
+ }
+
+ public void setI(int i)
+ {
+ this.i = i;
+ }
+}
diff --git a/owb_1.2.x/webbeans-tomcat7/src/it/servletinjection/src/main/java/org/apache/webbeans/web/tomcat7/test/TestServlet.java b/owb_1.2.x/webbeans-tomcat7/src/it/servletinjection/src/main/java/org/apache/webbeans/web/tomcat7/test/TestServlet.java
new file mode 100644
index 0000000..42b1d3f
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat7/src/it/servletinjection/src/main/java/org/apache/webbeans/web/tomcat7/test/TestServlet.java
@@ -0,0 +1,65 @@
+/*
+ * 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.webbeans.web.tomcat7.test;
+
+import javax.inject.Inject;
+import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import java.io.IOException;
+
+/**
+ * Dummy Servlet which just checks whether CDI injection works
+ */
+public class TestServlet implements Servlet
+{
+
+ @Inject
+ private TestBean tb;
+
+ public void destroy()
+ {
+ // nothing to do
+ }
+
+ public void init(ServletConfig config) throws ServletException
+ {
+ // nothing to do
+ }
+
+ public ServletConfig getServletConfig()
+ {
+ return null;
+ }
+
+ public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException
+ {
+ if (tb == null || tb.getI() != 4711)
+ {
+ throw new RuntimeException("CDI Injction doesn not work!");
+ }
+ }
+
+ public String getServletInfo()
+ {
+ return null;
+ }
+}
diff --git a/owb_1.2.x/webbeans-tomcat7/src/it/servletinjection/src/main/webapp/META-INF/context.xml b/owb_1.2.x/webbeans-tomcat7/src/it/servletinjection/src/main/webapp/META-INF/context.xml
new file mode 100644
index 0000000..1de7796
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat7/src/it/servletinjection/src/main/webapp/META-INF/context.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+<Context>
+ <Listener className="org.apache.webbeans.web.tomcat.ContextLifecycleListener" />
+</Context>
diff --git a/owb_1.2.x/webbeans-tomcat7/src/it/servletinjection/src/main/webapp/WEB-INF/beans.xml b/owb_1.2.x/webbeans-tomcat7/src/it/servletinjection/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 0000000..7d56d3d
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat7/src/it/servletinjection/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+<beans/>
diff --git a/owb_1.2.x/webbeans-tomcat7/src/it/servletinjection/src/main/webapp/WEB-INF/web.xml b/owb_1.2.x/webbeans-tomcat7/src/it/servletinjection/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..21291ab
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat7/src/it/servletinjection/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,33 @@
+<?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.
+-->
+<web-app id="owb-it" version="3.0"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+ <servlet>
+ <servlet-name>TestServlet</servlet-name>
+ <servlet-class>org.apache.webbeans.web.tomcat7.test.TestServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>TestServlet</servlet-name>
+ <url-pattern>*.test</url-pattern>
+ </servlet-mapping>
+</web-app>
diff --git a/owb_1.2.x/webbeans-tomcat7/src/it/servletinjection/src/test/java/org/apache/webbeans/web/tomcat7/test/OwbTomcatPluginIT.java b/owb_1.2.x/webbeans-tomcat7/src/it/servletinjection/src/test/java/org/apache/webbeans/web/tomcat7/test/OwbTomcatPluginIT.java
new file mode 100644
index 0000000..8fd372e
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat7/src/it/servletinjection/src/test/java/org/apache/webbeans/web/tomcat7/test/OwbTomcatPluginIT.java
@@ -0,0 +1,60 @@
+/*
+ * 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.webbeans.web.tomcat7.test;
+
+
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.DefaultHttpClient;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.lang.StringBuilder;
+
+/**
+ * Simple requests to the tomcat installation
+ */
+public class OwbTomcatPluginIT
+{
+ @Test
+ public void testTomcatRequest() throws Exception
+ {
+ DefaultHttpClient httpclient = new DefaultHttpClient();
+ HttpGet httpGet = new HttpGet("http://localhost:9081/owbtomcat7it/test.test");
+
+ HttpResponse response = httpclient.execute(httpGet);
+
+ // Get the response
+ BufferedReader rd = new BufferedReader
+ (new InputStreamReader(response.getEntity().getContent()));
+
+ StringBuilder builder = new StringBuilder();
+ String line = "";
+ while ((line = rd.readLine()) != null) {
+ builder.append(line);
+ }
+
+ Assert.assertNotNull(response);
+ Assert.assertEquals("Got " + builder.toString(), 200, response.getStatusLine().getStatusCode());
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-tomcat7/src/it/settings.xml b/owb_1.2.x/webbeans-tomcat7/src/it/settings.xml
new file mode 100644
index 0000000..c8f77f0
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat7/src/it/settings.xml
@@ -0,0 +1,55 @@
+<?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.
+-->
+
+<settings>
+ <profiles>
+ <profile>
+ <id>it-repo</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <repositories>
+ <repository>
+ <id>local.central</id>
+ <url>@localRepositoryUrl@</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>local.central</id>
+ <url>@localRepositoryUrl@</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+ </profiles>
+</settings>
diff --git a/owb_1.2.x/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat/ContextLifecycleListener.java b/owb_1.2.x/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat/ContextLifecycleListener.java
new file mode 100644
index 0000000..63559ad
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat/ContextLifecycleListener.java
@@ -0,0 +1,497 @@
+/*
+ * 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.webbeans.web.tomcat;
+
+import org.apache.catalina.Container;
+import org.apache.catalina.ContainerEvent;
+import org.apache.catalina.ContainerListener;
+import org.apache.catalina.Lifecycle;
+import org.apache.catalina.LifecycleEvent;
+import org.apache.catalina.LifecycleListener;
+import org.apache.catalina.Service;
+import org.apache.catalina.core.ContainerBase;
+import org.apache.catalina.core.StandardContext;
+import org.apache.catalina.core.StandardEngine;
+import org.apache.catalina.core.StandardHost;
+import org.apache.catalina.core.StandardServer;
+import org.apache.naming.ContextAccessController;
+import org.apache.tomcat.InstanceManager;
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.servlet.WebBeansConfigurationListener;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextAttributeEvent;
+import javax.servlet.ServletContextAttributeListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Field;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+
+
+/**
+ * Context lifecycle listener. Adapted from
+ * OpenEJB Tomcat and updated.
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public class ContextLifecycleListener implements PropertyChangeListener, LifecycleListener, ContainerListener, ServletContextAttributeListener
+{
+
+ private StandardServer standardServer;
+
+ public ContextLifecycleListener()
+ {
+ }
+
+ @Override
+ public void lifecycleEvent(LifecycleEvent event)
+ {
+ try
+ {
+ if (event.getSource() instanceof StandardServer)
+ {
+ if (event.getType().equals(Lifecycle.START_EVENT))
+ {
+ this.standardServer = (StandardServer) event.getSource();
+ start();
+ }
+ }
+ else if (event.getSource() instanceof StandardContext)
+ {
+ StandardContext context = (StandardContext) event.getSource();
+
+ if (event.getType().equals(Lifecycle.CONFIGURE_START_EVENT))
+ {
+ ServletContext scontext = context.getServletContext();
+ URL url = getBeansXml(scontext);
+ if (url != null)
+ {
+ //Registering ELResolver with JSP container
+ System.setProperty("org.apache.webbeans.application.jsp", "true");
+
+ String[] oldListeners = context.findApplicationListeners();
+ LinkedList<String> listeners = new LinkedList<String>();
+
+ listeners.addFirst(WebBeansConfigurationListener.class.getName());
+
+ for(String listener : oldListeners)
+ {
+ listeners.add(listener);
+ context.removeApplicationListener(listener);
+ }
+
+ for(String listener : listeners)
+ {
+ context.addApplicationListener(listener);
+ }
+
+ context.addApplicationListener(TomcatSecurityListener.class.getName());
+ context.addApplicationEventListener(this);
+ //context.addInstanceListener(TomcatInstanceListener.class.getName());
+ }
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private URL getBeansXml(ServletContext scontext) throws MalformedURLException
+ {
+ URL url = scontext.getResource("/WEB-INF/beans.xml");
+ if (url == null)
+ {
+ url = scontext.getResource("/WEB-INF/classes/META-INF/beans.xml");
+ }
+ return url;
+ }
+
+ @Override
+ public void containerEvent(ContainerEvent event)
+ {
+ StandardContext context;
+ try
+ {
+ if(event.getSource() instanceof StandardContext)
+ {
+ context = (StandardContext)event.getSource();
+
+ if(event.getType().equals("beforeContextInitialized"))
+ {
+ ClassLoader loader = context.getLoader().getClassLoader();
+ Object listener = event.getData();
+
+ if(listener.getClass().getName().equals(WebBeansConfigurationListener.class.getName()))
+ {
+ ContextAccessController.setWritable(context.getNamingContextListener().getName(), context);
+ return;
+ }
+ else
+ {
+ URL url = getBeansXml(context.getServletContext());
+ if(url != null)
+ {
+ TomcatUtil.inject(listener, loader);
+ }
+ }
+ }
+ else if(event.getType().equals("afterContextInitialized"))
+ {
+ ClassLoader loader = context.getLoader().getClassLoader();
+ Object listener = event.getData();
+ if(listener.getClass().getName().equals(WebBeansConfigurationListener.class.getName()))
+ {
+ setInstanceManager(context);
+
+ ContextAccessController.setReadOnly(context.getNamingContextListener().getName());
+
+ URL url = getBeansXml(context.getServletContext());
+ if(url != null)
+ {
+ Object[] listeners = context.getApplicationEventListeners();
+ for(Object instance : listeners)
+ {
+ if(!instance.getClass().getName().equals(WebBeansConfigurationListener.class.getName()))
+ {
+ TomcatUtil.inject(instance, loader);
+ }
+ }
+ }
+ }
+ }
+ else if(event.getType().equals("beforeContextDestroyed"))
+ {
+ Object listener = event.getData();
+ if(listener.getClass().getName().equals(WebBeansConfigurationListener.class.getName()))
+ {
+ ContextAccessController.setWritable(context.getNamingContextListener().getName(),context);
+ }
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private void setInstanceManager(final StandardContext context)
+ {
+ if (context.getInstanceManager() instanceof TomcatInstanceManager)
+ {
+ return;
+ }
+
+ InstanceManager processor = context.getInstanceManager();
+ InstanceManager custom = new TomcatInstanceManager(context.getLoader().getClassLoader(), processor);
+ context.setInstanceManager(custom);
+
+ context.getServletContext().setAttribute(InstanceManager.class.getName(), custom);
+ }
+
+ public void start()
+ {
+ // hook the hosts so we get notified before contexts are started
+ standardServer.addPropertyChangeListener(this);
+ standardServer.addLifecycleListener(this);
+ for (Service service : standardServer.findServices())
+ {
+ serviceAdded(service);
+ }
+ }
+
+ public void stop()
+ {
+ standardServer.removePropertyChangeListener(this);
+ }
+
+ private void serviceAdded(Service service)
+ {
+ Container container = service.getContainer();
+ if (container instanceof StandardEngine)
+ {
+ StandardEngine engine = (StandardEngine) container;
+ engineAdded(engine);
+ }
+ }
+
+ private void engineAdded(StandardEngine engine)
+ {
+ addContextListener(engine);
+ for (Container child : engine.findChildren())
+ {
+ if (child instanceof StandardHost)
+ {
+ StandardHost host = (StandardHost) child;
+ hostAdded(host);
+ }
+ }
+ }
+
+ private void hostAdded(StandardHost host)
+ {
+ addContextListener(host);
+ host.addLifecycleListener(this);
+ for (Container child : host.findChildren())
+ {
+ if (child instanceof StandardContext)
+ {
+ StandardContext context = (StandardContext) child;
+ contextAdded(context);
+ }
+ }
+ }
+
+ private void contextAdded(StandardContext context)
+ {
+ // put this class as the first listener so we can process the
+ // application before any classes are loaded
+ forceFirstLifecycleListener(context);
+ }
+
+ private void forceFirstLifecycleListener(StandardContext context)
+ {
+ LifecycleListener[] listeners = context.findLifecycleListeners();
+
+ // if we are already first return
+ if (listeners.length > 0 && listeners[0] == this)
+ {
+ return;
+ }
+
+ // remove all of the current listeners
+ for (LifecycleListener listener : listeners)
+ {
+ context.removeLifecycleListener(listener);
+ }
+
+ // add this class (as first)
+ context.addLifecycleListener(this);
+ context.addContainerListener(this);
+
+ // add back all listeners
+ for (LifecycleListener listener : listeners)
+ {
+ if (listener != this)
+ {
+ context.addLifecycleListener(listener);
+ }
+ }
+ }
+
+ @Override
+ public void propertyChange(PropertyChangeEvent event)
+ {
+ if ("service".equals(event.getPropertyName()))
+ {
+ Object oldValue = event.getOldValue();
+ Object newValue = event.getNewValue();
+ if (oldValue == null && newValue instanceof Service)
+ {
+ serviceAdded((Service) newValue);
+ }
+ }
+ if ("children".equals(event.getPropertyName()))
+ {
+ Object source = event.getSource();
+ Object oldValue = event.getOldValue();
+ Object newValue = event.getNewValue();
+ if (source instanceof StandardEngine)
+ {
+ if (oldValue == null && newValue instanceof StandardHost)
+ {
+ hostAdded((StandardHost) newValue);
+ }
+ }
+ if (source instanceof StandardHost)
+ {
+ if (oldValue == null && newValue instanceof StandardContext)
+ {
+ contextAdded((StandardContext) newValue);
+ }
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void addContextListener(ContainerBase containerBase)
+ {
+ try
+ {
+ Field field = (Field)AccessController.doPrivileged(new PrivilegedActionForClass(ContainerBase.class, "children"));
+ AccessController.doPrivileged(new PrivilegedActionForAccessibleObject(field, true));
+ Map<Object,Object> children = (Map<Object,Object>) field.get(containerBase);
+ if (children instanceof ContextLifecycleListener.MoniterableHashMap)
+ {
+ return;
+ }
+ children = new ContextLifecycleListener.MoniterableHashMap(children, containerBase, "children", this);
+ field.set(containerBase, children);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ @Override
+ public void attributeAdded(ServletContextAttributeEvent servletContextAttributeEvent)
+ {
+ if (InstanceManager.class.getName().equals(servletContextAttributeEvent.getName()))
+ { // used as a hook to know we can override eagerly the InstanceManager
+ try
+ {
+ final StandardContext context = (StandardContext) getContext(
+ getContext(servletContextAttributeEvent.getServletContext()));
+ setInstanceManager(context);
+ }
+ catch (NoSuchFieldException e)
+ {
+ throw new WebBeansException(e.getMessage(), e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new WebBeansException(e.getMessage(), e);
+ }
+ }
+ }
+
+ private static Object getContext(final Object o) throws NoSuchFieldException, IllegalAccessException
+ {
+ final Field getContext = o.getClass().getDeclaredField("context");
+ final boolean acc = getContext.isAccessible();
+ getContext.setAccessible(true);
+ try
+ {
+ return getContext.get(o);
+ }
+ finally
+ {
+ getContext.setAccessible(acc);
+ }
+ }
+
+ @Override
+ public void attributeRemoved(ServletContextAttributeEvent servletContextAttributeEvent)
+ {
+ // no-op
+ }
+
+ @Override
+ public void attributeReplaced(ServletContextAttributeEvent servletContextAttributeEvent)
+ {
+ // no-op
+ }
+
+ public static class MoniterableHashMap extends HashMap<Object,Object>
+ {
+ private static final long serialVersionUID = 1L;
+
+ private final Object source;
+ private final String propertyName;
+ private final PropertyChangeListener listener;
+
+ public MoniterableHashMap(Map<Object,Object> m, Object source, String propertyName, PropertyChangeListener listener)
+ {
+ super(m);
+ this.source = source;
+ this.propertyName = propertyName;
+ this.listener = listener;
+ }
+
+ @Override
+ public Object put(Object key, Object value)
+ {
+ Object oldValue = super.put(key, value);
+ PropertyChangeEvent event = new PropertyChangeEvent(source, propertyName, null, value);
+ listener.propertyChange(event);
+ return oldValue;
+ }
+
+ @Override
+ public Object remove(Object key)
+ {
+ Object value = super.remove(key);
+ PropertyChangeEvent event = new PropertyChangeEvent(source, propertyName, value, null);
+ listener.propertyChange(event);
+ return value;
+ }
+ }
+
+ protected static class PrivilegedActionForAccessibleObject implements PrivilegedAction<Object>
+ {
+
+ AccessibleObject object;
+
+ boolean flag;
+
+ protected PrivilegedActionForAccessibleObject(AccessibleObject object, boolean flag)
+ {
+ this.object = object;
+ this.flag = flag;
+ }
+
+ @Override
+ public Object run()
+ {
+ object.setAccessible(flag);
+ return null;
+ }
+ }
+
+ protected static class PrivilegedActionForClass implements PrivilegedAction<Object>
+ {
+ Class<?> clazz;
+
+ Object parameters;
+
+ protected PrivilegedActionForClass(Class<?> clazz, Object parameters)
+ {
+ this.clazz = clazz;
+ this.parameters = parameters;
+ }
+
+ @Override
+ public Object run()
+ {
+ try
+ {
+ return clazz.getDeclaredField((String)parameters);
+ }
+ catch (NoSuchFieldException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ }
+
+
+}
diff --git a/owb_1.2.x/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat/TomcatInstanceManager.java b/owb_1.2.x/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat/TomcatInstanceManager.java
new file mode 100644
index 0000000..b13ca43
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat/TomcatInstanceManager.java
@@ -0,0 +1,123 @@
+/*
+ * 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.webbeans.web.tomcat;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.naming.NamingException;
+
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
+import org.apache.tomcat.InstanceManager;
+
+public class TomcatInstanceManager implements InstanceManager
+{
+ private static final Log log = LogFactory.getLog(TomcatInstanceManager.class);
+
+ private InstanceManager processor;
+
+ private ClassLoader loader;
+
+ private Map<Object, Object> objects = new ConcurrentHashMap<Object, Object>();
+
+ public TomcatInstanceManager(ClassLoader loader, InstanceManager processor)
+ {
+ this.processor = processor;
+ this.loader = loader;
+ }
+
+ @Override
+ public void destroyInstance(Object instance) throws IllegalAccessException, InvocationTargetException
+ {
+ Object injectorInstance = objects.get(instance);
+ if (injectorInstance != null)
+ {
+ try
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug("Destroying the OpenWebBeans injector instance");
+ }
+ TomcatUtil.destroy(injectorInstance, loader);
+ }
+ catch (Exception e)
+ {
+ log.error("Erros is occured while destroying the OpenWebBeans injector instance", e);
+ }
+ }
+ this.processor.destroyInstance(instance);
+ }
+
+ @Override
+ public Object newInstance(String str) throws IllegalAccessException, InvocationTargetException, NamingException, InstantiationException, ClassNotFoundException
+ {
+ // Creates a defaut instance
+ Object object = this.processor.newInstance(str);
+
+ // Inject dependencies
+ inject(object);
+
+ return object;
+ }
+
+ @Override
+ public void newInstance(Object object) throws IllegalAccessException, InvocationTargetException, NamingException
+ {
+ // Inject dependencies
+ inject(object);
+ }
+
+ @Override
+ public Object newInstance(String str, ClassLoader cl) throws IllegalAccessException, InvocationTargetException, NamingException, InstantiationException, ClassNotFoundException
+ {
+ // Creates a defaut instance
+ Object object = this.processor.newInstance(str, cl);
+
+ // Inject dependencies
+ inject(object);
+
+ return object;
+ }
+
+ private void inject(Object object)
+ {
+ try
+ {
+ if(log.isDebugEnabled())
+ {
+ log.debug("Injecting the dependencies for OpenWebBeans, " +
+ "instance : " + object);
+ }
+
+ Object injectorInstance = TomcatUtil.inject(object, loader);
+ if (injectorInstance != null)
+ {
+ objects.put(object, injectorInstance);
+ }
+ }
+ catch (Exception e)
+ {
+ log.error("Error is occured while injecting the OpenWebBeans " +
+ "dependencies for instance " + object,e);
+ }
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat/TomcatSecurityListener.java b/owb_1.2.x/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat/TomcatSecurityListener.java
new file mode 100644
index 0000000..f91eee2
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat/TomcatSecurityListener.java
@@ -0,0 +1,61 @@
+/*
+ * 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.webbeans.web.tomcat;
+
+import java.security.Principal;
+
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletRequestEvent;
+import javax.servlet.ServletRequestListener;
+import javax.servlet.http.HttpServletRequest;
+
+public class TomcatSecurityListener implements ServletRequestListener
+{
+ public static ThreadLocal<Principal> principal = new ThreadLocal<Principal>();
+
+ public TomcatSecurityListener()
+ {
+
+ }
+
+ @Override
+ public void requestDestroyed(ServletRequestEvent event)
+ {
+ if(principal.get() != null)
+ {
+ principal.remove();
+ }
+ }
+
+ @Override
+ public void requestInitialized(ServletRequestEvent event)
+ {
+ ServletRequest request = event.getServletRequest();
+ if(request instanceof HttpServletRequest)
+ {
+ Principal p = ((HttpServletRequest)request).getUserPrincipal();
+ if(p != null)
+ {
+ principal.set(p);
+ }
+ }
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat/TomcatSecurityService.java b/owb_1.2.x/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat/TomcatSecurityService.java
new file mode 100644
index 0000000..10d6693
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat/TomcatSecurityService.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.web.tomcat;
+
+import java.security.Principal;
+
+import org.apache.webbeans.corespi.security.SimpleSecurityService;
+import org.apache.webbeans.spi.SecurityService;
+
+public class TomcatSecurityService extends SimpleSecurityService implements SecurityService
+{
+
+ @Override
+ public Principal getCurrentPrincipal()
+ {
+ return TomcatSecurityListener.principal.get();
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat/TomcatUtil.java b/owb_1.2.x/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat/TomcatUtil.java
new file mode 100644
index 0000000..7c173ec
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat/TomcatUtil.java
@@ -0,0 +1,84 @@
+/*
+ * 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.webbeans.web.tomcat;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.inject.OWBInjector;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.Producer;
+
+public class TomcatUtil
+{
+ public static Object inject(Object object, ClassLoader loader) throws Exception
+ {
+ final ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(loader);
+ CreationalContext<?> context = null;
+ try
+ {
+ final BeanManager beanManager = WebBeansContext.currentInstance().getBeanManagerImpl();
+ context = beanManager.createCreationalContext(null);
+ OWBInjector.inject(beanManager, object, context);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(oldLoader);
+ }
+ return new Instance(object, context);
+ }
+
+ public static void destroy(Object injectorInstance, ClassLoader loader) throws Exception
+ {
+ final Instance instance = (TomcatUtil.Instance) injectorInstance;
+ final ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(loader);
+ try
+ {
+ final BeanManagerImpl beanManager = WebBeansContext.currentInstance().getBeanManagerImpl();
+ final Producer producer = beanManager.getProducerForJavaEeComponent(instance.object.getClass());
+ if (producer != null)
+ {
+ producer.dispose(instance.object);
+ }
+ else if (instance.context != null)
+ {
+ instance.context.release();
+ }
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(oldLoader);
+ }
+ }
+
+ private static class Instance
+ {
+ private Object object;
+ private CreationalContext<?> context;
+
+ private Instance(Object object, CreationalContext<?> context)
+ {
+ this.object = object;
+ this.context = context;
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat/TomcatWebPlugin.java b/owb_1.2.x/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat/TomcatWebPlugin.java
new file mode 100644
index 0000000..f844f4f
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat/TomcatWebPlugin.java
@@ -0,0 +1,132 @@
+/*
+ * 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.webbeans.web.tomcat;
+
+import javax.jws.WebService;
+import javax.servlet.Filter;
+import javax.servlet.Servlet;
+import javax.servlet.ServletContextAttributeListener;
+import javax.servlet.ServletContextListener;
+import javax.servlet.ServletRequestAttributeListener;
+import javax.servlet.ServletRequestListener;
+import javax.servlet.http.HttpSessionActivationListener;
+import javax.servlet.http.HttpSessionAttributeListener;
+import javax.servlet.http.HttpSessionBindingListener;
+import javax.servlet.http.HttpSessionListener;
+
+import org.apache.webbeans.exception.inject.DefinitionException;
+import org.apache.webbeans.spi.SecurityService;
+import org.apache.webbeans.spi.plugins.AbstractOwbPlugin;
+import org.apache.webbeans.spi.plugins.OpenWebBeansWebPlugin;
+
+/**
+ * Tomcat plugin for OWB.
+ *
+ * @version $Rev: 940336 $ $Date: 2010-05-03 02:32:18 +0300 (Mon, 03 May 2010) $
+ *
+ */
+public class TomcatWebPlugin extends AbstractOwbPlugin implements OpenWebBeansWebPlugin
+{
+ //Security service implementation.
+ private final TomcatSecurityService securityService = new TomcatSecurityService();
+
+ /**
+ * Default constructor.
+ */
+ public TomcatWebPlugin()
+ {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public <T> T getSupportedService(Class<T> serviceClass)
+ {
+ if(serviceClass.equals(SecurityService.class))
+ {
+ return serviceClass.cast(this.securityService);
+ }
+
+ return null;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void isManagedBean(Class<?> clazz)
+ {
+ if(Servlet.class.isAssignableFrom(clazz) ||
+ Filter.class.isAssignableFrom(clazz) ||
+ ServletContextListener.class.isAssignableFrom(clazz) ||
+ ServletContextAttributeListener.class.isAssignableFrom(clazz) ||
+ HttpSessionActivationListener.class.isAssignableFrom(clazz) ||
+ HttpSessionAttributeListener.class.isAssignableFrom(clazz) ||
+ HttpSessionBindingListener.class.isAssignableFrom(clazz) ||
+ HttpSessionListener.class.isAssignableFrom(clazz) ||
+ ServletRequestListener.class.isAssignableFrom(clazz) ||
+ ServletRequestAttributeListener.class.isAssignableFrom(clazz) )
+ {
+ throw new DefinitionException("Given class : " + clazz.getName() + " is not managed bean");
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean supportsJavaEeComponentInjections(Class<?> clazz)
+ {
+ if(Servlet.class.isAssignableFrom(clazz) ||
+ Filter.class.isAssignableFrom(clazz) ||
+ ServletContextListener.class.isAssignableFrom(clazz) ||
+ ServletContextAttributeListener.class.isAssignableFrom(clazz) ||
+ HttpSessionActivationListener.class.isAssignableFrom(clazz) ||
+ HttpSessionAttributeListener.class.isAssignableFrom(clazz) ||
+ HttpSessionBindingListener.class.isAssignableFrom(clazz) ||
+ HttpSessionListener.class.isAssignableFrom(clazz) ||
+ ServletRequestListener.class.isAssignableFrom(clazz) ||
+ ServletRequestAttributeListener.class.isAssignableFrom(clazz) ||
+ clazz.isAnnotationPresent(WebService.class))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean supportService(Class<?> serviceClass)
+ {
+ if(serviceClass.equals(SecurityService.class))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-tomcat7/src/main/resources/META-INF/services/org.apache.webbeans.spi.plugins.OpenWebBeansPlugin b/owb_1.2.x/webbeans-tomcat7/src/main/resources/META-INF/services/org.apache.webbeans.spi.plugins.OpenWebBeansPlugin
new file mode 100644
index 0000000..d824eb8
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat7/src/main/resources/META-INF/services/org.apache.webbeans.spi.plugins.OpenWebBeansPlugin
@@ -0,0 +1,17 @@
+#Licensed to the Apache Software Foundation (ASF) under one
+#or more contributor license agreements. See the NOTICE file
+#distributed with this work for additional information
+#regarding copyright ownership. The ASF licenses this file
+#to you under the Apache License, Version 2.0 (the
+#"License"); you may not use this file except in compliance
+#with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+#Unless required by applicable law or agreed to in writing,
+#software distributed under the License is distributed on an
+#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#KIND, either express or implied. See the License for the
+#specific language governing permissions and limitations
+#under the License.
+org.apache.webbeans.web.tomcat.TomcatWebPlugin
\ No newline at end of file
diff --git a/owb_1.2.x/webbeans-tomcat7/src/site/site.xml b/owb_1.2.x/webbeans-tomcat7/src/site/site.xml
new file mode 100644
index 0000000..bc67aed
--- /dev/null
+++ b/owb_1.2.x/webbeans-tomcat7/src/site/site.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<project name="OpenWebBeans">
+ <bannerLeft>
+ <name>Apache OpenWebBeans</name>
+ <src>http://openwebbeans.apache.org/owb/images/logos/openwebbeans_hor.png</src>
+ <href>http://openwebbeans.apache.org</href>
+ </bannerLeft>
+
+ <bannerRight>
+ <name>Apache Banner</name>
+ <src>http://www.apache.org/images/asf-logo.gif</src>
+ <href>http://www.apache.org</href>
+ </bannerRight>
+
+ <publishDate format="dd MMM yyyy" />
+ <version position="left"/>
+
+ <body>
+ <breadcrumbs>
+ <item name="Apache" href="http://www.apache.org"/>
+ <item name="OpenWebBeans" href="http://openwebbeans.apache.org"/>
+ <item name="OWB-Tomcat-7" href="http://openwebbeans.apache.org/${project.version}/openwebbeans-tomcat7"/>
+ </breadcrumbs>
+
+ <menu ref="reports"/>
+ </body>
+</project>
+
diff --git a/owb_1.2.x/webbeans-web/pom.xml b/owb_1.2.x/webbeans-web/pom.xml
new file mode 100644
index 0000000..1d81dd3
--- /dev/null
+++ b/owb_1.2.x/webbeans-web/pom.xml
@@ -0,0 +1,103 @@
+<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">
+<!--
+
+ 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.
+-->
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans</artifactId>
+ <version>1.2.5</version>
+ </parent>
+
+ <artifactId>openwebbeans-web</artifactId>
+ <name>Web plugin</name>
+ <description>Apache OpenWebBeans Java EE Web and Serlvet plugin</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-el_2.2_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.xbean</groupId>
+ <artifactId>xbean-finder-shaded</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_2.5_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-el22</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ <version>${project.version}</version>
+ <classifier>tests</classifier>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jsp_2.1_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/owb_1.2.x/webbeans-web/src/main/java/META-INF/MANIFEST.MF b/owb_1.2.x/webbeans-web/src/main/java/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..254272e
--- /dev/null
+++ b/owb_1.2.x/webbeans-web/src/main/java/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
diff --git a/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationFilter.java b/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationFilter.java
new file mode 100644
index 0000000..7f3312a
--- /dev/null
+++ b/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationFilter.java
@@ -0,0 +1,230 @@
+/*
+ * 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.webbeans.servlet;
+
+
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.el.ELContextStore;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.spi.ContainerLifecycle;
+import org.apache.webbeans.spi.FailOverService;
+import org.apache.webbeans.util.WebBeansUtil;
+import org.apache.webbeans.web.context.WebContextsService;
+import org.apache.webbeans.web.util.ServletCompatibilityUtil;
+
+import javax.enterprise.context.RequestScoped;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletRequestEvent;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Initializing the beans container for using in a web application
+ * environment. Caution: Only for buggy containers that do not fire
+ * properly ServletRequestEvents or in pre-Servlet 2.5 environments.
+ * @see WebBeansConfigurationListener
+ *
+ * This is the alternative entry point for starting the CDI container
+ * for a servlet.
+ *
+ */
+public class WebBeansConfigurationFilter implements Filter
+{
+
+ private static final String CALL_COUNT_ATTRIBUTE_NAME = WebBeansConfigurationFilter.class.getName();
+
+ /**Logger instance*/
+ private static final Logger logger = WebBeansLoggerFacade.getLogger(WebBeansConfigurationFilter.class);
+
+ /**Manages the container lifecycle*/
+ protected ContainerLifecycle lifeCycle = null;
+
+ protected FailOverService failoverService = null;
+ private WebBeansContext webBeansContext;
+ private ServletContext servletContext;
+
+ /**
+ * Default constructor
+ */
+ public WebBeansConfigurationFilter()
+ {
+ webBeansContext = WebBeansContext.getInstance();
+ failoverService = webBeansContext.getService(FailOverService.class);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void init(FilterConfig filterConfig) throws ServletException
+ {
+ this.lifeCycle = webBeansContext.getService(ContainerLifecycle.class);
+
+ try
+ {
+ this.servletContext = filterConfig.getServletContext();
+ this.lifeCycle.startApplication(new ServletContextEvent(this.servletContext));
+
+ }
+ catch (Exception e)
+ {
+ logger.log(Level.SEVERE,
+ WebBeansLoggerFacade.constructMessage(OWBLogConst.ERROR_0018, ServletCompatibilityUtil.getServletInfo(servletContext)));
+ WebBeansUtil.throwRuntimeExceptions(e);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
+ throws IOException, ServletException
+ {
+ try
+ {
+ if (firstInit(servletRequest))
+ {
+ requestInitialized(servletRequest);
+ }
+
+ filterChain.doFilter(servletRequest, servletResponse);
+ }
+ finally
+ {
+ if (lastDestroy(servletRequest))
+ {
+ requestDestroyed(servletRequest);
+ }
+ }
+ }
+
+ private boolean firstInit(ServletRequest servletRequest)
+ {
+ Integer callCount = (Integer) servletRequest.getAttribute(CALL_COUNT_ATTRIBUTE_NAME);
+ if (callCount == null)
+ {
+ callCount = 0;
+ }
+ callCount++;
+ servletRequest.setAttribute(CALL_COUNT_ATTRIBUTE_NAME, callCount);
+
+ return callCount == 1;
+ }
+
+ private boolean lastDestroy(ServletRequest servletRequest)
+ {
+ Integer callCount = (Integer) servletRequest.getAttribute(CALL_COUNT_ATTRIBUTE_NAME);
+ callCount--;
+ servletRequest.setAttribute(CALL_COUNT_ATTRIBUTE_NAME, callCount);
+ return callCount == 0;
+ }
+
+ public void requestInitialized(ServletRequest servletRequest)
+ {
+ try
+ {
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.log(Level.FINE, "Starting a new request : [{0}]", servletRequest.getRemoteAddr());
+ }
+
+ this.lifeCycle.getContextService().startContext(RequestScoped.class,
+ new ServletRequestEvent(this.servletContext, servletRequest));
+
+ // we don't initialise the Session here but do it lazily if it gets requested
+ // the first time. See OWB-457
+ }
+ catch (Exception e)
+ {
+ logger.log(Level.SEVERE,
+ WebBeansLoggerFacade.constructMessage(OWBLogConst.ERROR_0019, servletRequest));
+ WebBeansUtil.throwRuntimeExceptions(e);
+ }
+ }
+
+ public void requestDestroyed(ServletRequest request)
+ {
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.log(Level.FINE, "Destroying a request : [{0}]", request.getRemoteAddr());
+ }
+
+ if (failoverService != null &&
+ failoverService.isSupportFailOver())
+ {
+ if(request instanceof HttpServletRequest)
+ {
+ HttpServletRequest httpRequest = (HttpServletRequest)request;
+ HttpSession session = httpRequest.getSession(false);
+ if (session != null)
+ {
+ failoverService.sessionIsIdle(session);
+ }
+ }
+ }
+
+ // clean up the EL caches after each request
+ ELContextStore elStore = ELContextStore.getInstance(false);
+ if (elStore != null)
+ {
+ elStore.destroyELContextStore();
+ }
+
+ this.lifeCycle.getContextService().endContext(RequestScoped.class,
+ new ServletRequestEvent(this.servletContext, request));
+
+ this.cleanupRequestThreadLocals();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void destroy()
+ {
+ this.lifeCycle.stopApplication(new ServletContextEvent(this.servletContext));
+ this.lifeCycle = null;
+ this.servletContext = null;
+
+ // just to be sure that we didn't lazily create anything...
+ cleanupRequestThreadLocals();
+ }
+
+ /**
+ * Ensures that all ThreadLocals, which could have been set in this
+ * requests Thread, are removed in order to prevent memory leaks.
+ */
+ private void cleanupRequestThreadLocals()
+ {
+ // TODO maybe there are more to cleanup
+ WebContextsService.removeThreadLocals();
+ }
+}
diff --git a/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationHttpSessionListener.java b/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationHttpSessionListener.java
new file mode 100644
index 0000000..1618eef
--- /dev/null
+++ b/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationHttpSessionListener.java
@@ -0,0 +1,83 @@
+/*
+ * 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.webbeans.servlet;
+
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.spi.ContainerLifecycle;
+import org.apache.webbeans.util.WebBeansUtil;
+
+import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.context.SessionScoped;
+import javax.servlet.http.HttpSessionEvent;
+import javax.servlet.http.HttpSessionListener;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class WebBeansConfigurationHttpSessionListener implements HttpSessionListener
+{
+
+ /**Logger instance*/
+ private static final Logger logger = WebBeansLoggerFacade.getLogger(WebBeansConfigurationHttpSessionListener.class);
+
+ /**Manages the container lifecycle*/
+ protected ContainerLifecycle lifeCycle = null;
+
+ public WebBeansConfigurationHttpSessionListener()
+ {
+ this.lifeCycle = WebBeansContext.getInstance().getService(ContainerLifecycle.class);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void sessionCreated(HttpSessionEvent event)
+ {
+ try
+ {
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.log(Level.FINE, "Starting a session with session id : [{0}]", event.getSession().getId());
+ }
+ this.lifeCycle.getContextService().startContext(SessionScoped.class, event.getSession());
+ }
+ catch (Exception e)
+ {
+ logger.log(Level.SEVERE,
+ WebBeansLoggerFacade.constructMessage(OWBLogConst.ERROR_0020, event.getSession()));
+ WebBeansUtil.throwRuntimeExceptions(e);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void sessionDestroyed(HttpSessionEvent event)
+ {
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.log(Level.FINE, "Destroying a session with session id : [{0}]", event.getSession().getId());
+ }
+ this.lifeCycle.getContextService().endContext(SessionScoped.class, event.getSession());
+ this.lifeCycle.getContextService().endContext(ConversationScoped.class, event.getSession());
+ }
+}
diff --git a/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationListener.java b/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationListener.java
new file mode 100644
index 0000000..70873cf
--- /dev/null
+++ b/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationListener.java
@@ -0,0 +1,225 @@
+/*
+ * 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.webbeans.servlet;
+
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.el.ELContextStore;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.spi.ContainerLifecycle;
+import org.apache.webbeans.spi.FailOverService;
+import org.apache.webbeans.util.WebBeansUtil;
+import org.apache.webbeans.web.context.WebContextsService;
+import org.apache.webbeans.web.util.ServletCompatibilityUtil;
+
+import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.context.spi.Context;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import javax.servlet.ServletRequestEvent;
+import javax.servlet.ServletRequestListener;
+import javax.servlet.http.HttpSessionEvent;
+import javax.servlet.http.HttpSessionListener;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Initializing the beans container for using in an web application
+ * environment.
+ *
+ * This is the main entry point for starting the CDI container
+ * for a servlet.
+ *
+ *
+ * If you have a container with < Servlet-2.5 then use
+ * {@link WebBeansConfigurationFilter} and {@link WebBeansConfigurationHttpSessionListener}
+ * instead.
+ */
+public class WebBeansConfigurationListener implements ServletContextListener, ServletRequestListener, HttpSessionListener
+{
+ /**Logger instance*/
+ private static final Logger logger = WebBeansLoggerFacade.getLogger(WebBeansConfigurationListener.class);
+
+ /**Manages the container lifecycle*/
+ protected ContainerLifecycle lifeCycle = null;
+
+ protected FailOverService failoverService = null;
+ private WebBeansContext webBeansContext;
+
+ /**
+ * Default constructor
+ */
+ public WebBeansConfigurationListener()
+ {
+ webBeansContext = WebBeansContext.getInstance();
+ failoverService = webBeansContext.getService(FailOverService.class);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void contextInitialized(ServletContextEvent event)
+ {
+ this.lifeCycle = webBeansContext.getService(ContainerLifecycle.class);
+
+ try
+ {
+ this.lifeCycle.startApplication(event);
+ }
+ catch (Exception e)
+ {
+ logger.log(Level.SEVERE,
+ WebBeansLoggerFacade.constructMessage(
+ OWBLogConst.ERROR_0018,
+ ServletCompatibilityUtil.getServletInfo(event.getServletContext())));
+ WebBeansUtil.throwRuntimeExceptions(e);
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void contextDestroyed(ServletContextEvent event)
+ {
+ this.lifeCycle.stopApplication(event);
+ this.lifeCycle = null;
+
+ // just to be sure that we didn't lazily create anything...
+ cleanupRequestThreadLocals();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void requestDestroyed(ServletRequestEvent event)
+ {
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.log(Level.FINE, "Destroying a request : [{0}]", event == null ? "null" : event.getServletRequest().getRemoteAddr());
+ }
+
+ // clean up the EL caches after each request
+ ELContextStore elStore = ELContextStore.getInstance(false);
+ if (elStore != null)
+ {
+ elStore.destroyELContextStore();
+ }
+
+ this.lifeCycle.getContextService().endContext(RequestScoped.class, event);
+
+ this.cleanupRequestThreadLocals();
+ }
+
+ /**
+ * Ensures that all ThreadLocals, which could have been set in this
+ * requests Thread, are removed in order to prevent memory leaks.
+ */
+ private void cleanupRequestThreadLocals()
+ {
+ WebContextsService.removeThreadLocals();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void requestInitialized(ServletRequestEvent event)
+ {
+ try
+ {
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.log(Level.FINE, "Starting a new request : [{0}]", event == null ? "null" : event.getServletRequest().getRemoteAddr());
+ }
+
+ this.lifeCycle.getContextService().startContext(RequestScoped.class, event);
+
+ // we don't initialise the Session here but do it lazily if it gets requested
+ // the first time. See OWB-457
+ }
+ catch (Exception e)
+ {
+ logger.log(Level.SEVERE,
+ WebBeansLoggerFacade.constructMessage(OWBLogConst.ERROR_0019, event == null ? "null" : event.getServletRequest()));
+ WebBeansUtil.throwRuntimeExceptions(e);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void sessionCreated(HttpSessionEvent event)
+ {
+ try
+ {
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.log(Level.FINE, "Starting a session with session id : [{0}]", event.getSession().getId());
+ }
+ this.lifeCycle.getContextService().startContext(SessionScoped.class, event.getSession());
+ }
+ catch (Exception e)
+ {
+ logger.log(Level.SEVERE,
+ WebBeansLoggerFacade.constructMessage(OWBLogConst.ERROR_0020, event.getSession()));
+ WebBeansUtil.throwRuntimeExceptions(e);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void sessionDestroyed(HttpSessionEvent event)
+ {
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.log(Level.FINE, "Destroying a session with session id : [{0}]", event.getSession().getId());
+ }
+ boolean mustDestroy = ensureRequestScope();
+
+ this.lifeCycle.getContextService().endContext(SessionScoped.class, event.getSession());
+ this.lifeCycle.getContextService().endContext(ConversationScoped.class, event.getSession());
+
+ if (mustDestroy)
+ {
+ requestDestroyed(null);
+ }
+ }
+
+ private boolean ensureRequestScope()
+ {
+ Context context = this.lifeCycle.getContextService().getCurrentContext(RequestScoped.class);
+
+ if (context == null || !context.isActive())
+ {
+ requestInitialized(null);
+ return true;
+ }
+ return false;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/context/ServletRequestContext.java b/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/context/ServletRequestContext.java
new file mode 100644
index 0000000..d38dd36
--- /dev/null
+++ b/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/context/ServletRequestContext.java
@@ -0,0 +1,67 @@
+/*
+ * 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.webbeans.web.context;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.webbeans.context.RequestContext;
+
+/**
+ * RequestContext which additionally holds the current servletRequest
+ * for being able to lazily initialise the SessionContext if needed.
+ */
+public class ServletRequestContext extends RequestContext
+{
+
+ private static final long serialVersionUID = -8375349845543590243L;
+
+ // this can only be accessed when the context is active
+ private transient HttpServletRequest servletRequest;
+
+
+ public ServletRequestContext()
+ {
+ super();
+ }
+
+ public HttpServletRequest getServletRequest()
+ {
+ if (active)
+ {
+ return servletRequest;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public void setServletRequest(HttpServletRequest servletRequest)
+ {
+ this.servletRequest = servletRequest;
+ }
+
+ @Override
+ public void destroy()
+ {
+ super.destroy();
+ servletRequest = null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/context/SessionContextManager.java b/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/context/SessionContextManager.java
new file mode 100644
index 0000000..7dca423
--- /dev/null
+++ b/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/context/SessionContextManager.java
@@ -0,0 +1,88 @@
+/*
+ * 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.webbeans.web.context;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.webbeans.context.SessionContext;
+import org.apache.webbeans.util.Asserts;
+
+/**
+ * Session context manager.
+ * <p>
+ * Each session is identified by the session id.
+ * </p>
+ * @version $Rev$ $Date$
+ *
+ */
+public class SessionContextManager
+{
+ /** Session id to SessionContext map*/
+ private final Map<String, SessionContext> sessionContexts;
+
+
+ /**
+ * Creates a new session context manager.
+ */
+ public SessionContextManager()
+ {
+ sessionContexts = new ConcurrentHashMap<String, SessionContext>();
+ }
+
+ /**
+ * Adds new session context for the given session id.
+ * @param sessionId session id
+ * @param context session context
+ */
+ public void addNewSessionContext(String sessionId, SessionContext context)
+ {
+ Asserts.assertNotNull(sessionId, "sessionId parameter can not be null");
+ Asserts.assertNotNull(context, "context parameter can not be null");
+
+ sessionContexts.put(sessionId, context);
+ }
+
+ /**
+ * Gets session context related with given session id.
+ * @param sessionId session id
+ * @return session context related with given session id
+ */
+ public SessionContext getSessionContextWithSessionId(String sessionId)
+ {
+ Asserts.assertNotNull(sessionId, "sessionId parameter can not be null");
+
+ return sessionContexts.get(sessionId);
+ }
+
+ /**
+ * Removes the {@link SessionContext} for the given id.
+ *
+ * @param sessionId session id
+ */
+ public void removeSessionContextWithSessionId(String sessionId)
+ {
+ this.sessionContexts.remove(sessionId);
+ }
+
+ public Map<String, SessionContext> getAllSessionContexts()
+ {
+ return sessionContexts;
+ }
+}
diff --git a/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java b/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java
new file mode 100644
index 0000000..98277f4
--- /dev/null
+++ b/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java
@@ -0,0 +1,873 @@
+/*
+ * 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.webbeans.web.context;
+
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.AbstractContextsService;
+import org.apache.webbeans.context.ApplicationContext;
+import org.apache.webbeans.context.ConversationContext;
+import org.apache.webbeans.context.DependentContext;
+import org.apache.webbeans.context.RequestContext;
+import org.apache.webbeans.context.SessionContext;
+import org.apache.webbeans.context.SingletonContext;
+import org.apache.webbeans.conversation.ConversationImpl;
+import org.apache.webbeans.conversation.ConversationManager;
+import org.apache.webbeans.el.ELContextStore;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.spi.FailOverService;
+import org.apache.webbeans.util.WebBeansUtil;
+import org.apache.webbeans.web.intercept.RequestScopedBeanInterceptorHandler;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.ContextException;
+import javax.enterprise.context.Conversation;
+import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.context.spi.Context;
+import javax.inject.Singleton;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletRequestEvent;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import java.lang.annotation.Annotation;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Web container {@link org.apache.webbeans.spi.ContextsService}
+ * implementation.
+ */
+public class WebContextsService extends AbstractContextsService
+{
+ /**Logger instance*/
+ private static final Logger logger = WebBeansLoggerFacade.getLogger(WebContextsService.class);
+
+ /**Current request context*/
+ private static ThreadLocal<RequestContext> requestContexts = null;
+
+ /**Current session context*/
+ private static ThreadLocal<SessionContext> sessionContexts = null;
+
+ /**
+ * This applicationContext will be used for all non servlet-request threads
+ */
+ private ApplicationContext sharedApplicationContext ;
+
+ private SingletonContext sharedSingletonContext;
+
+ /**Current conversation context*/
+ private static ThreadLocal<ConversationContext> conversationContexts = null;
+
+ /**Current dependent context*/
+ private static DependentContext dependentContext;
+
+ /**Current application contexts*/
+ private static Map<ServletContext, ApplicationContext> currentApplicationContexts = new ConcurrentHashMap<ServletContext, ApplicationContext>();
+
+ /**Current singleton contexts*/
+ private static Map<ServletContext, SingletonContext> currentSingletonContexts = new ConcurrentHashMap<ServletContext, SingletonContext>();
+
+ private static Map<ClassLoader, ServletContext> classLoaderToServletContextMapping = new ConcurrentHashMap<ClassLoader, ServletContext>();
+
+ /**Session context manager*/
+ private final SessionContextManager sessionCtxManager = new SessionContextManager();
+
+ /**Conversation context manager*/
+ private final ConversationManager conversationManager;
+
+ private boolean supportsConversation = false;
+
+ protected FailOverService failoverService = null;
+
+ private WebBeansContext webBeansContext;
+
+ /**Initialize thread locals*/
+ static
+ {
+ requestContexts = new ThreadLocal<RequestContext>();
+ sessionContexts = new ThreadLocal<SessionContext>();
+ conversationContexts = new ThreadLocal<ConversationContext>();
+
+ //Dependent context is always active
+ dependentContext = new DependentContext();
+ dependentContext.setActive(true);
+ }
+
+ /**
+ * Removes the ThreadLocals from the ThreadMap to prevent memory leaks.
+ */
+ public static void removeThreadLocals()
+ {
+ requestContexts.remove();
+ sessionContexts.remove();
+ conversationContexts.remove();
+ RequestScopedBeanInterceptorHandler.removeThreadLocals();
+ }
+
+ /**
+ * Creates a new instance.
+ */
+ public WebContextsService(WebBeansContext webBeansContext)
+ {
+ this.webBeansContext = webBeansContext;
+ supportsConversation = webBeansContext.getOpenWebBeansConfiguration().supportsConversation();
+ failoverService = webBeansContext.getService(FailOverService.class);
+ conversationManager = webBeansContext.getConversationManager();
+
+ sharedApplicationContext = new ApplicationContext();
+ sharedApplicationContext.setActive(true);
+ }
+
+ public SessionContextManager getSessionContextManager()
+ {
+ return sessionCtxManager;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void init(Object initializeObject)
+ {
+ //Start application context
+ startContext(ApplicationScoped.class, initializeObject);
+
+ //Start signelton context
+ startContext(Singleton.class, initializeObject);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void destroy(Object destroyObject)
+ {
+ //Destroy application context
+ endContext(ApplicationScoped.class, destroyObject);
+
+ // we also need to destroy the shared ApplicationContext
+ sharedApplicationContext.destroy();
+
+ //Destroy singleton context
+ endContext(Singleton.class, destroyObject);
+ sharedSingletonContext.destroy();
+
+ //Clear saved contexts related with
+ //this servlet context
+ currentApplicationContexts.clear();
+ currentSingletonContexts.clear();
+
+ //Thread local values to null
+ requestContexts.set(null);
+ sessionContexts.set(null);
+ conversationContexts.set(null);
+
+ //Remove thread locals
+ //for preventing memory leaks
+ requestContexts.remove();
+ sessionContexts.remove();
+ conversationContexts.remove();
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void endContext(Class<? extends Annotation> scopeType, Object endParameters)
+ {
+ if(scopeType.equals(RequestScoped.class))
+ {
+ destroyRequestContext((ServletRequestEvent)endParameters);
+ }
+ else if(scopeType.equals(SessionScoped.class))
+ {
+ destroySessionContext((HttpSession)endParameters);
+ }
+ else if(scopeType.equals(ApplicationScoped.class))
+ {
+ destroyApplicationContext((ServletContext)endParameters);
+ }
+ else if(supportsConversation && scopeType.equals(ConversationScoped.class))
+ {
+ if (endParameters != null && endParameters instanceof HttpSession)
+ {
+ destoryAllConversationsForSession((HttpSession) endParameters);
+ }
+
+ destroyConversationContext();
+ }
+ else if(scopeType.equals(Dependent.class))
+ {
+ //Do nothing
+ }
+ else if (scopeType.equals(Singleton.class))
+ {
+ destroySingletonContext((ServletContext)endParameters);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Context getCurrentContext(Class<? extends Annotation> scopeType)
+ {
+ if(scopeType.equals(RequestScoped.class))
+ {
+ return getRequestContext();
+ }
+ else if(scopeType.equals(SessionScoped.class))
+ {
+ return getSessionContext();
+ }
+ else if(scopeType.equals(ApplicationScoped.class))
+ {
+ ServletContext servletContext = classLoaderToServletContextMapping.get(WebBeansUtil.getCurrentClassLoader());
+
+ if (servletContext == null)
+ {
+ return null;
+ }
+ return currentApplicationContexts.get(servletContext);
+ }
+ else if(supportsConversation && scopeType.equals(ConversationScoped.class))
+ {
+ return getConversationContext();
+ }
+ else if(scopeType.equals(Dependent.class))
+ {
+ return dependentContext;
+ }
+ else if (scopeType.equals(Singleton.class))
+ {
+ ServletContext servletContext = classLoaderToServletContextMapping.get(WebBeansUtil.getCurrentClassLoader());
+
+ if (servletContext == null)
+ {
+ return null;
+ }
+ return currentSingletonContexts.get(servletContext);
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void startContext(Class<? extends Annotation> scopeType, Object startParameter) throws ContextException
+ {
+ if(scopeType.equals(RequestScoped.class))
+ {
+ initRequestContext((ServletRequestEvent)startParameter);
+ }
+ else if(scopeType.equals(SessionScoped.class))
+ {
+ initSessionContext((HttpSession)startParameter);
+ }
+ else if(scopeType.equals(ApplicationScoped.class))
+ {
+ initApplicationContext((ServletContext)startParameter);
+ }
+ else if(supportsConversation && scopeType.equals(ConversationScoped.class))
+ {
+ initConversationContext((ConversationContext)startParameter);
+ }
+ else if(scopeType.equals(Dependent.class))
+ {
+ //Do nothing
+ }
+ else if (scopeType.equals(Singleton.class))
+ {
+ initSingletonContext((ServletContext)startParameter);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean supportsContext(Class<? extends Annotation> scopeType)
+ {
+ if(scopeType.equals(RequestScoped.class) ||
+ scopeType.equals(SessionScoped.class) ||
+ scopeType.equals(ApplicationScoped.class) ||
+ scopeType.equals(Dependent.class) ||
+ scopeType.equals(Singleton.class) ||
+ (scopeType.equals(ConversationScoped.class) && supportsConversation))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Initialize requext context with the given request object.
+ * @param event http servlet request event
+ */
+ private void initRequestContext(ServletRequestEvent event)
+ {
+
+ RequestContext rq = new ServletRequestContext();
+ rq.setActive(true);
+
+ requestContexts.set(rq);// set thread local
+
+ if(event != null)
+ {
+ HttpServletRequest request = (HttpServletRequest) event.getServletRequest();
+ ((ServletRequestContext)rq).setServletRequest(request);
+
+ if (request != null)
+ {
+ //Re-initialize thread local for session
+ HttpSession session = request.getSession(false);
+
+ if(session != null)
+ {
+ initSessionContext(session);
+ }
+
+ //Init thread local application context
+ initApplicationContext(event.getServletContext());
+
+ //Init thread local singleton context
+ initSingletonContext(event.getServletContext());
+ }
+ }
+ else
+ {
+ //Init thread local application context
+ initApplicationContext(null);
+
+ //Init thread local singleton context
+ initSingletonContext(null);
+ }
+ }
+
+ /**
+ * Destroys the request context and all of its components.
+ * @param request http servlet request object
+ */
+ private void destroyRequestContext(ServletRequestEvent request)
+ {
+ // cleanup open conversations first
+ if (supportsConversation)
+ {
+ cleanupConversations();
+ }
+
+
+ //Get context
+ RequestContext context = getRequestContext();
+
+ //Destroy context
+ if (context != null)
+ {
+ context.destroy();
+ }
+
+ // clean up the EL caches after each request
+ ELContextStore elStore = ELContextStore.getInstance(false);
+ if (elStore != null)
+ {
+ elStore.destroyELContextStore();
+ }
+
+ //Clear thread locals
+ requestContexts.set(null);
+ requestContexts.remove();
+
+ RequestScopedBeanInterceptorHandler.removeThreadLocals();
+ }
+
+ private void cleanupConversations()
+ {
+ ConversationContext conversationContext = getConversationContext();
+
+ if (conversationContext == null)
+ {
+ return;
+ }
+
+ Conversation conversation = conversationManager.getConversationBeanReference();
+
+ if (conversation == null)
+ {
+ return;
+ }
+
+ if (conversation.isTransient())
+ {
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.log(Level.FINE, "Destroying the transient conversation context with cid : [{0}]", conversation.getId());
+ }
+ destroyConversationContext();
+ }
+ else
+ {
+ //Conversation must be used by one thread at a time
+ ConversationImpl owbConversation = (ConversationImpl)conversation;
+ owbConversation.updateTimeOut();
+ //Other threads can now access propogated conversation.
+ owbConversation.setInUsed(false);
+ }
+ }
+
+ /**
+ * Creates the session context at the session start.
+ * @param session http session object
+ */
+ private void initSessionContext(HttpSession session)
+ {
+ SessionContext currentSessionContext;
+
+ if (session == null)
+ {
+ // no session -> create a dummy SessionContext
+ // this is handy if you create asynchronous tasks or
+ // batches which use a 'admin' user.
+ currentSessionContext = new SessionContext();
+ }
+ else
+ {
+ String sessionId = session.getId();
+
+ //Current context
+ currentSessionContext = sessionCtxManager.getSessionContextWithSessionId(sessionId);
+
+ //No current context
+ if (currentSessionContext == null)
+ {
+ currentSessionContext = new SessionContext();
+ sessionCtxManager.addNewSessionContext(sessionId, currentSessionContext);
+ }
+ }
+
+ //Activate
+ currentSessionContext.setActive(true);
+
+ //Set thread local
+ sessionContexts.set(currentSessionContext);
+ }
+
+ /**
+ * Destroys the session context and all of its components at the end of the
+ * session.
+ * @param session http session object
+ */
+ private void destroySessionContext(HttpSession session)
+ {
+ if (session != null)
+ {
+ //Get current session context
+ SessionContext context = sessionContexts.get();
+
+ if (context == null)
+ {
+ initSessionContext(session);
+ context = sessionContexts.get();
+ }
+
+ //Destroy context
+ if (context != null)
+ {
+ context.destroy();
+ }
+
+ //Clear thread locals
+ sessionContexts.set(null);
+ sessionContexts.remove();
+
+ //Remove session from manager
+ sessionCtxManager.removeSessionContextWithSessionId(session.getId());
+ }
+ }
+
+ /**
+ * Creates the application context at the application startup
+ * @param servletContext servlet context object
+ */
+ private void initApplicationContext(ServletContext servletContext)
+ {
+ if (servletContext != null && currentApplicationContexts.containsKey(servletContext))
+ {
+ return;
+ }
+
+ if (sharedApplicationContext != null && servletContext == null)
+ {
+ return;
+ }
+
+ ApplicationContext newApplicationContext = new ApplicationContext();
+ newApplicationContext.setActive(true);
+
+ if (servletContext != null)
+ {
+ currentApplicationContexts.put(servletContext, newApplicationContext);
+
+ ClassLoader currentClassLoader = WebBeansUtil.getCurrentClassLoader();
+ if (!classLoaderToServletContextMapping.containsKey(currentClassLoader))
+ {
+ classLoaderToServletContextMapping.put(currentClassLoader, servletContext);
+ }
+ }
+
+ if (sharedApplicationContext == null)
+ {
+ sharedApplicationContext = newApplicationContext;
+ }
+ }
+
+ /**
+ * Destroys the application context and all of its components at the end of
+ * the application.
+ * @param servletContext servlet context object
+ */
+ private void destroyApplicationContext(ServletContext servletContext)
+ {
+ //look for thread local
+ //this can be set by initRequestContext
+ ApplicationContext context = null;
+
+ //Looking the context from saved context
+ //This is used in real web applications
+ if(servletContext != null)
+ {
+ context = currentApplicationContexts.get(servletContext);
+ }
+
+ //using in tests
+ if(context == null)
+ {
+ context = this.sharedApplicationContext;
+ }
+
+ //Destroy context
+ if(context != null)
+ {
+ context.destroy();
+ }
+
+ //Remove from saved contexts
+ if(servletContext != null)
+ {
+ currentApplicationContexts.remove(servletContext);
+ }
+
+ //destroyDependents all sessions
+ Collection<SessionContext> allSessionContexts = sessionCtxManager.getAllSessionContexts().values();
+ if (allSessionContexts != null && allSessionContexts.size() > 0)
+ {
+ for (SessionContext sessionContext : allSessionContexts)
+ {
+ sessionContexts.set(sessionContext);
+
+ sessionContext.destroy();
+
+ sessionContexts.set(null);
+ sessionContexts.remove();
+ }
+
+ //Clear map
+ allSessionContexts.clear();
+ }
+
+ //destroyDependents all conversations
+ Collection<ConversationContext> allConversationContexts = conversationManager.getAllConversationContexts().values();
+ if (allConversationContexts != null && allConversationContexts.size() > 0)
+ {
+ for (ConversationContext conversationContext : allConversationContexts)
+ {
+ conversationContexts.set(conversationContext);
+
+ conversationContext.destroy();
+
+ conversationContexts.set(null);
+ conversationContexts.remove();
+ }
+
+ //Clear conversations
+ allConversationContexts.clear();
+ }
+
+ // this is needed to get rid of ApplicationScoped beans which are cached inside the proxies...
+ webBeansContext.getBeanManagerImpl().clearCacheProxies();
+
+ classLoaderToServletContextMapping.remove(WebBeansUtil.getCurrentClassLoader());
+ }
+
+ /**
+ * Initialize singleton context.
+ * @param servletContext servlet context
+ */
+ private void initSingletonContext(ServletContext servletContext)
+ {
+ if (servletContext != null && currentSingletonContexts.containsKey(servletContext))
+ {
+ return;
+ }
+
+ if (currentSingletonContexts != null && servletContext == null)
+ {
+ return;
+ }
+
+ SingletonContext newSingletonContext = new SingletonContext();
+ newSingletonContext.setActive(true);
+
+ if (servletContext != null)
+ {
+ currentSingletonContexts.put(servletContext, newSingletonContext);
+
+ ClassLoader currentClassLoader = WebBeansUtil.getCurrentClassLoader();
+ if (!classLoaderToServletContextMapping.containsKey(currentClassLoader))
+ {
+ classLoaderToServletContextMapping.put(currentClassLoader, servletContext);
+ }
+ }
+
+ if (sharedSingletonContext == null)
+ {
+ sharedSingletonContext = newSingletonContext;
+ }
+ }
+
+ /**
+ * Destroy singleton context.
+ * @param servletContext servlet context
+ */
+ private void destroySingletonContext(ServletContext servletContext)
+ {
+ SingletonContext context = null;
+
+ //look for saved context
+ if(servletContext != null)
+ {
+ context = currentSingletonContexts.get(servletContext);
+ }
+
+ //using in tests
+ if(context == null)
+ {
+ context = this.sharedSingletonContext;
+ }
+
+ //context is not null
+ //destroyDependents it
+ if(context != null)
+ {
+ context.destroy();
+ }
+
+ //remove it from saved contexts
+ if(servletContext != null)
+ {
+ currentSingletonContexts.remove(servletContext);
+ }
+
+ classLoaderToServletContextMapping.remove(WebBeansUtil.getCurrentClassLoader());
+ }
+
+ /**
+ * Initialize conversation context.
+ * @param context context
+ */
+ private void initConversationContext(ConversationContext context)
+ {
+ if (context == null)
+ {
+ if(conversationContexts.get() == null)
+ {
+ ConversationContext newContext = new ConversationContext();
+ newContext.setActive(true);
+
+ conversationContexts.set(newContext);
+ }
+ else
+ {
+ conversationContexts.get().setActive(true);
+ }
+
+ }
+ else
+ {
+ context.setActive(true);
+ conversationContexts.set(context);
+ }
+ }
+
+ /**
+ * Destroy conversation context.
+ */
+ private void destroyConversationContext()
+ {
+ ConversationContext context = getConversationContext();
+
+ if (context != null)
+ {
+ context.destroy();
+ }
+
+ conversationContexts.set(null);
+ conversationContexts.remove();
+ }
+
+ /**
+ * Workaround for OWB-841
+ *
+ * @param session The current {@link HttpSession}
+ */
+ private void destoryAllConversationsForSession(HttpSession session)
+ {
+ Map<Conversation, ConversationContext> conversations =
+ conversationManager.getAndRemoveConversationMapWithSessionId(session.getId());
+
+ for (Entry<Conversation, ConversationContext> entry : conversations.entrySet())
+ {
+ conversationContexts.set(entry.getValue());
+
+ entry.getValue().destroy();
+
+ conversationContexts.set(null);
+ conversationContexts.remove();
+ }
+ }
+
+ /**
+ * Get current request ctx.
+ * @return request context
+ */
+ private RequestContext getRequestContext()
+ {
+ return requestContexts.get();
+ }
+
+ /**
+ * Get current session ctx.
+ * @return session context
+ */
+ private SessionContext getSessionContext()
+ {
+ SessionContext context = sessionContexts.get();
+ if (null == context)
+ {
+ lazyStartSessionContext();
+ context = sessionContexts.get();
+ }
+
+ return context;
+ }
+
+ /**
+ * Get current conversation ctx.
+ * @return conversation context
+ */
+ private ConversationContext getConversationContext()
+ {
+ return conversationContexts.get();
+ }
+
+ private Context lazyStartSessionContext()
+ {
+
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.log(Level.FINE, ">lazyStartSessionContext");
+ }
+
+ Context webContext = null;
+ Context context = getCurrentContext(RequestScoped.class);
+ if (context instanceof ServletRequestContext)
+ {
+ ServletRequestContext requestContext = (ServletRequestContext) context;
+ HttpServletRequest servletRequest = requestContext.getServletRequest();
+ if (null != servletRequest)
+ { // this could be null if there is no active request context
+ try
+ {
+ HttpSession currentSession = servletRequest.getSession();
+ initSessionContext(currentSession);
+ if (failoverService != null && failoverService.isSupportFailOver())
+ {
+ failoverService.sessionIsInUse(currentSession);
+ }
+
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.log(Level.FINE, "Lazy SESSION context initialization SUCCESS");
+ }
+ }
+ catch (Exception e)
+ {
+ logger.log(Level.SEVERE, WebBeansLoggerFacade.constructMessage(OWBLogConst.ERROR_0013, e));
+ }
+
+ }
+ else
+ {
+ logger.log(Level.WARNING, "Could NOT lazily initialize session context because NO active request context");
+ }
+ }
+ else
+ {
+ logger.log(Level.WARNING, "Could NOT lazily initialize session context because of "+context+" RequestContext");
+ }
+
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.log(Level.FINE, "<lazyStartSessionContext "+ webContext);
+ }
+ return webContext;
+ }
+
+
+ /**
+ * This might be needed when you aim to start a new thread in a WebApp.
+ * @param scopeType
+ */
+ @Override
+ public void activateContext(Class<? extends Annotation> scopeType)
+ {
+ if (scopeType.equals(SessionScoped.class))
+ {
+ // getSessionContext() implicitely creates and binds the SessionContext
+ // to the current Thread if it doesn't yet exist.
+ getSessionContext().setActive(true);
+ }
+ else
+ {
+ super.activateContext(scopeType);
+ }
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/intercept/RequestScopedBeanInterceptorHandler.java b/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/intercept/RequestScopedBeanInterceptorHandler.java
new file mode 100644
index 0000000..a5cacc9
--- /dev/null
+++ b/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/intercept/RequestScopedBeanInterceptorHandler.java
@@ -0,0 +1,85 @@
+/*
+ * 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.webbeans.web.intercept;
+
+import org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import java.util.HashMap;
+
+
+/**
+ * <p>This is a {@link javax.inject.Provider} especially
+ * made for @RequestScoped beans used in web applications.</p>
+ *
+ * <p>Since there is only one single contextual instance of an @RequestScoped bean per thread,
+ * we can simply cache this instance inside our bean. We only need to reload this instance
+ * if it is null or if the thread ends.</p>
+ */
+public class RequestScopedBeanInterceptorHandler extends NormalScopedBeanInterceptorHandler
+{
+ /**default serial id*/
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Cached bean instance for each thread
+ */
+ private static ThreadLocal<HashMap<Bean<?>, Object>> cachedInstances = new ThreadLocal<HashMap<Bean<?>, Object>>();
+
+
+ public static void removeThreadLocals()
+ {
+ cachedInstances.set(null);
+ cachedInstances.remove();
+ }
+
+ /**
+ * Creates a new handler.
+ */
+ public RequestScopedBeanInterceptorHandler(BeanManager beanManager, Bean<?> bean)
+ {
+ super(beanManager, bean);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Object getContextualInstance()
+ {
+ HashMap<Bean<?>, Object> beanMap = cachedInstances.get();
+ if (beanMap == null)
+ {
+ beanMap = new HashMap<Bean<?>, Object>();
+ cachedInstances.set(beanMap);
+ }
+
+ Object cachedInstance = beanMap.get(bean);
+ if (cachedInstance == null)
+ {
+
+ cachedInstance = super.getContextualInstance();
+ beanMap.put(bean, cachedInstance);
+ }
+
+ return cachedInstance;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/WebContainerLifecycle.java b/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/WebContainerLifecycle.java
new file mode 100644
index 0000000..6c61b49
--- /dev/null
+++ b/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/WebContainerLifecycle.java
@@ -0,0 +1,254 @@
+/*
+ * 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.webbeans.web.lifecycle;
+
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.OpenWebBeansConfiguration;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.lifecycle.AbstractLifeCycle;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.spi.ResourceInjectionService;
+import org.apache.webbeans.spi.adaptor.ELAdaptor;
+import org.apache.webbeans.web.context.WebContextsService;
+import org.apache.webbeans.web.util.ServletCompatibilityUtil;
+
+import javax.el.ELResolver;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.jsp.JspApplicationContext;
+import javax.servlet.jsp.JspFactory;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+import java.util.logging.Level;
+
+/**
+ * Manages container lifecycle.
+ *
+ * <p>
+ * Behaves according to the request, session, and application
+ * contexts of the web application.
+ * </p>
+ *
+ * @version $Rev: 911764 $ $Date: 2010-02-19 11:52:54 +0200 (Fri, 19 Feb 2010) $
+ * @see org.apache.webbeans.servlet.WebBeansConfigurationListener
+ */
+public final class WebContainerLifecycle extends AbstractLifeCycle
+{
+ /**Manages unused conversations*/
+ private ScheduledExecutorService service = null;
+
+
+ /**
+ * Creates a new lifecycle instance and initializes
+ * the instance variables.
+ */
+ public WebContainerLifecycle()
+ {
+ super(null);
+ this.logger = WebBeansLoggerFacade.getLogger(WebContainerLifecycle.class);
+ }
+
+ /**
+ * Creates a new lifecycle instance and initializes
+ * the instance variables.
+ */
+ public WebContainerLifecycle(WebBeansContext webBeansContext)
+ {
+ super(null, webBeansContext);
+ this.logger = WebBeansLoggerFacade.getLogger(WebContainerLifecycle.class);
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void startApplication(Object startupObject)
+ {
+ ServletContext servletContext = getServletContext(startupObject);
+ super.startApplication(servletContext);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void stopApplication(Object endObject)
+ {
+ ServletContext servletContext = getServletContext(endObject);
+ super.stopApplication(servletContext);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void afterStartApplication(final Object startupObject)
+ {
+ String strDelay = getWebBeansContext().getOpenWebBeansConfiguration().getProperty(OpenWebBeansConfiguration.CONVERSATION_PERIODIC_DELAY,"150000");
+ long delay = Long.parseLong(strDelay);
+
+ service = Executors.newScheduledThreadPool(1, new ThreadFactory()
+ {
+ @Override
+ public Thread newThread(Runnable runable)
+ {
+ Thread t = new Thread(runable, "OwbConversationCleaner-"
+ + ServletCompatibilityUtil.getServletInfo((ServletContext) (startupObject)));
+ t.setDaemon(true);
+ return t;
+ }
+ });
+ service.scheduleWithFixedDelay(new ConversationCleaner(), delay, delay, TimeUnit.MILLISECONDS);
+
+ ELAdaptor elAdaptor = getWebBeansContext().getService(ELAdaptor.class);
+ ELResolver resolver = elAdaptor.getOwbELResolver();
+ //Application is configured as JSP
+ if(getWebBeansContext().getOpenWebBeansConfiguration().isJspApplication())
+ {
+ logger.log(Level.FINE, "Application is configured as JSP. Adding EL Resolver.");
+
+ JspFactory factory = JspFactory.getDefaultFactory();
+ if (factory != null)
+ {
+ JspApplicationContext applicationCtx = factory.getJspApplicationContext((ServletContext)(startupObject));
+ applicationCtx.addELResolver(resolver);
+ }
+ else
+ {
+ logger.log(Level.FINE, "Default JSPFactroy instance has not found");
+ }
+ }
+
+ // Add BeanManager to the 'javax.enterprise.inject.spi.BeanManager' servlet context attribute
+ ServletContext servletContext = (ServletContext)(startupObject);
+ servletContext.setAttribute(BeanManager.class.getName(), getBeanManager());
+
+ }
+
+ @Override
+ protected void beforeStartApplication(Object startupObject)
+ {
+ this.scannerService.init(startupObject);
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void beforeStopApplication(Object stopObject)
+ {
+ if(service != null)
+ {
+ service.shutdownNow();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void afterStopApplication(Object stopObject)
+ {
+ ServletContext servletContext;
+
+ if(stopObject instanceof ServletContext)
+ {
+ servletContext = (ServletContext)stopObject;
+ }
+ else
+ {
+ servletContext = getServletContext(stopObject);
+ }
+
+ //Clear the resource injection service
+ ResourceInjectionService injectionServices = getWebBeansContext().getService(ResourceInjectionService.class);
+ if(injectionServices != null)
+ {
+ injectionServices.clear();
+ }
+
+ //Comment out for commit OWB-502
+ //ContextFactory.cleanUpContextFactory();
+
+ this.cleanupShutdownThreadLocals();
+
+ if (logger.isLoggable(Level.INFO))
+ {
+ logger.log(Level.INFO, OWBLogConst.INFO_0002, ServletCompatibilityUtil.getServletInfo(servletContext));
+ }
+ }
+
+ /**
+ * Ensures that all ThreadLocals, which could have been set in this
+ * (shutdown-) Thread, are removed in order to prevent memory leaks.
+ */
+ private void cleanupShutdownThreadLocals()
+ {
+ WebContextsService.removeThreadLocals();
+ }
+
+ /**
+ * Returns servelt context otherwise throws exception.
+ * @param object object
+ * @return servlet context
+ */
+ private ServletContext getServletContext(Object object)
+ {
+ if(object != null)
+ {
+ if(object instanceof ServletContextEvent)
+ {
+ object = ((ServletContextEvent) object).getServletContext();
+ return (ServletContext)object;
+ }
+ else
+ {
+ throw new WebBeansException(WebBeansLoggerFacade.getTokenString(OWBLogConst.EXCEPT_0018));
+ }
+ }
+
+ throw new IllegalArgumentException("ServletContextEvent object but found null");
+ }
+
+ /**
+ * Conversation cleaner thread, that
+ * clears unused conversations.
+ *
+ */
+ private static class ConversationCleaner implements Runnable
+ {
+ public ConversationCleaner()
+ {
+
+ }
+
+ @Override
+ public void run()
+ {
+ WebBeansContext.getInstance().getConversationManager().destroyWithRespectToTimout();
+
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/test/EnterpriseTestLifeCycle.java b/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/test/EnterpriseTestLifeCycle.java
new file mode 100644
index 0000000..8305b7f
--- /dev/null
+++ b/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/test/EnterpriseTestLifeCycle.java
@@ -0,0 +1,86 @@
+/*
+ * 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.webbeans.web.lifecycle.test;
+
+import java.util.Properties;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.corespi.se.DefaultScannerService;
+import org.apache.webbeans.el.ELContextStore;
+import org.apache.webbeans.lifecycle.StandaloneLifeCycle;
+
+/**
+ * Ease the writing of the tests. Simulates container
+ * startup and stop functionality. This will scan all
+ * classes on the classpaths which have a beans.xml file.
+ * @version $Rev: 892509 $ $Date: 2009-12-19 23:47:15 +0200 (Sat, 19 Dec 2009) $
+ */
+public class EnterpriseTestLifeCycle extends StandaloneLifeCycle
+{
+ private MockServletContextEvent servletContextEvent;
+
+ private MockHttpSession mockHttpSession;
+
+ public EnterpriseTestLifeCycle()
+ {
+ super();
+ }
+
+ @Override
+ public void beforeStartApplication(Object object)
+ {
+ this.mockHttpSession = new MockHttpSession();
+ this.servletContextEvent = new MockServletContextEvent();
+ WebBeansContext webBeansContext = getWebBeansContext();
+ ContextFactory contextFactory = webBeansContext.getContextFactory();
+ contextFactory.initRequestContext(null);
+ contextFactory.initSessionContext(mockHttpSession);
+ contextFactory.initConversationContext(null);
+ contextFactory.initApplicationContext(this.servletContextEvent.getServletContext());
+ }
+
+ @Override
+ public void initApplication(Properties properties)
+ {
+ this.scannerService = new DefaultScannerService();
+ }
+
+ @Override
+ public void beforeStopApplication(Object endObject)
+ {
+ WebBeansContext webBeansContext = getWebBeansContext();
+ ContextFactory contextFactory = webBeansContext.getContextFactory();
+ contextFactory.destroyRequestContext(null);
+ contextFactory.destroySessionContext(this.mockHttpSession);
+ contextFactory.destroyConversationContext();
+ contextFactory.destroyApplicationContext(this.servletContextEvent.getServletContext());
+
+ //Comment out for OWB-502
+ //ContextFactory.cleanUpContextFactory();
+
+ // clean up the EL caches after each request
+ ELContextStore elStore = ELContextStore.getInstance(false);
+ if (elStore != null)
+ {
+ elStore.destroyELContextStore();
+ }
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/test/MockHttpSession.java b/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/test/MockHttpSession.java
new file mode 100644
index 0000000..d8ff5f2
--- /dev/null
+++ b/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/test/MockHttpSession.java
@@ -0,0 +1,157 @@
+/*
+ * 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.webbeans.web.lifecycle.test;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionContext;
+import java.util.Enumeration;
+import java.util.concurrent.atomic.AtomicInteger;
+
+@SuppressWarnings("unchecked")
+public class MockHttpSession implements HttpSession
+{
+ private static final AtomicInteger ID = new AtomicInteger(0);
+
+ private final String id;
+
+ public MockHttpSession()
+ {
+ id = Integer.toString(ID.incrementAndGet());
+ }
+
+ @Override
+ public Object getAttribute(String arg0)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Enumeration getAttributeNames()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public long getCreationTime()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public String getId()
+ {
+ return id;
+ }
+
+ @Override
+ public long getLastAccessedTime()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getMaxInactiveInterval()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public ServletContext getServletContext()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public HttpSessionContext getSessionContext()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Object getValue(String arg0)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String[] getValueNames()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void invalidate()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean isNew()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void putValue(String arg0, Object arg1)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void removeAttribute(String arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void removeValue(String arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setAttribute(String arg0, Object arg1)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setMaxInactiveInterval(int arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/test/MockServletContext.java b/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/test/MockServletContext.java
new file mode 100644
index 0000000..4a7dfb7
--- /dev/null
+++ b/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/test/MockServletContext.java
@@ -0,0 +1,293 @@
+/*
+ * 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.webbeans.web.lifecycle.test;
+
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+/**
+ * Implement the ServletContext interface for testing.
+ */
+public class MockServletContext implements ServletContext
+{
+
+ @SuppressWarnings("unchecked")
+ private Hashtable attributes = new Hashtable();
+
+ @Override
+ public Object getAttribute(String name)
+ {
+ return attributes.get(name);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Enumeration getAttributeNames()
+ {
+ return attributes.keys();
+ }
+
+ @Override
+ public ServletContext getContext(String uripath)
+ {
+ return this;
+ }
+
+ @Override
+ public String getContextPath()
+ {
+ return "mockContextpath";
+ }
+
+ @Override
+ public String getInitParameter(String name)
+ {
+ return null;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Enumeration getInitParameterNames()
+ {
+ return new StringTokenizer(""); // 'standard' empty Enumeration
+ }
+
+ @Override
+ public int getMajorVersion()
+ {
+ return 2;
+ }
+
+ @Override
+ public String getMimeType(String file)
+ {
+ return null;
+ }
+
+ @Override
+ public int getMinorVersion()
+ {
+ return 0;
+ }
+
+ @Override
+ public RequestDispatcher getNamedDispatcher(String name)
+ {
+ return null;
+ }
+
+ @Override
+ public String getRealPath(String path)
+ {
+ return "mockRealPath";
+ }
+
+ @Override
+ public RequestDispatcher getRequestDispatcher(String path)
+ {
+ return null;
+ }
+
+ @Override
+ public URL getResource(String path) throws MalformedURLException
+ {
+ return null;
+ }
+
+ @Override
+ public InputStream getResourceAsStream(String path)
+ {
+ return null;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Set getResourcePaths(String path)
+ {
+ return null;
+ }
+
+ @Override
+ public String getServerInfo()
+ {
+ return "mockServer";
+ }
+
+ @Override
+ public Servlet getServlet(String name) throws ServletException
+ {
+ return null;
+ }
+
+ @Override
+ public String getServletContextName()
+ {
+ return null;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Enumeration getServletNames()
+ {
+ return null;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Enumeration getServlets()
+ {
+ return null;
+ }
+
+ @Override
+ public void log(String msg)
+ {
+ // TODO
+ }
+
+ @Override
+ public void log(Exception exception, String msg)
+ {
+ // TODO
+
+ }
+
+ @Override
+ public void log(String message, Throwable throwable)
+ {
+ // TODO
+
+ }
+
+ @Override
+ public void removeAttribute(String name)
+ {
+ attributes.remove(name);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void setAttribute(String name, Object object)
+ {
+ attributes.put(name, object);
+ }
+
+ /*--- NEW SERVLET 3.0 FUNCTIONS! -- */
+ /*X
+ public Dynamic addFilter(String arg0, String arg1) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Dynamic addFilter(String arg0, Filter arg1) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Dynamic addFilter(String arg0, Class<? extends Filter> arg1) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public javax.servlet.ServletRegistration.Dynamic addServlet(String arg0,
+ String arg1) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public javax.servlet.ServletRegistration.Dynamic addServlet(String arg0,
+ Servlet arg1) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public javax.servlet.ServletRegistration.Dynamic addServlet(String arg0,
+ Class<? extends Servlet> arg1) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public <T extends Filter> T createFilter(Class<T> arg0)
+ throws ServletException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public <T extends Servlet> T createServlet(Class<T> arg0)
+ throws ServletException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Set<SessionTrackingMode> getDefaultSessionTrackingModes() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Set<SessionTrackingMode> getEffectiveSessionTrackingModes() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public FilterRegistration getFilterRegistration(String arg0) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Map<String, FilterRegistration> getFilterRegistrations() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ServletRegistration getServletRegistration(String arg0) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Map<String, ServletRegistration> getServletRegistrations() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public SessionCookieConfig getSessionCookieConfig() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean setInitParameter(String arg0, String arg1) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void setSessionTrackingModes(Set<SessionTrackingMode> arg0) {
+ // TODO Auto-generated method stub
+
+ }
+ */
+}
diff --git a/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/test/MockServletContextEvent.java b/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/test/MockServletContextEvent.java
new file mode 100644
index 0000000..6ada405
--- /dev/null
+++ b/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/test/MockServletContextEvent.java
@@ -0,0 +1,33 @@
+/*
+ * 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.webbeans.web.lifecycle.test;
+
+import javax.servlet.ServletContextEvent;
+
+
+public class MockServletContextEvent extends ServletContextEvent
+{
+ private static final long serialVersionUID = 1L;
+
+ public MockServletContextEvent()
+ {
+ super(new MockServletContext());
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/scanner/WebScannerService.java b/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/scanner/WebScannerService.java
new file mode 100644
index 0000000..dc27713
--- /dev/null
+++ b/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/scanner/WebScannerService.java
@@ -0,0 +1,216 @@
+/*
+ * 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.webbeans.web.scanner;
+
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery;
+import org.apache.webbeans.corespi.scanner.xbean.CdiArchive;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.util.WebBeansUtil;
+import org.apache.xbean.finder.AnnotationFinder;
+
+import javax.servlet.ServletContext;
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Configures the web application to find beans.
+ */
+public class WebScannerService extends AbstractMetaDataDiscovery
+{
+ private final static Logger logger = WebBeansLoggerFacade.getLogger(WebScannerService.class);
+
+ protected ServletContext servletContext = null;
+
+ public WebScannerService()
+ {
+
+ }
+
+ @Override
+ protected AnnotationFinder initFinder()
+ {
+ final Collection<URL> trimmedUrls = new ArrayList<URL>();
+ try
+ {
+ for (final String trimmed : getArchives())
+ {
+ try
+ {
+ String file = trimmed;
+ if (file.endsWith(META_INF_BEANS_XML))
+ {
+ file = file.substring(0, file.length() - META_INF_BEANS_XML.length());
+ }
+ trimmedUrls.add(new URL(file));
+ }
+ catch (MalformedURLException e)
+ {
+ throw new WebBeansConfigurationException("Can't trim url " + trimmed);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ throw new WebBeansConfigurationException(WebBeansLoggerFacade.getTokenString(OWBLogConst.ERROR_0002), e);
+ }
+
+ archive = new CdiArchive(WebBeansUtil.getCurrentClassLoader(), trimmedUrls);
+ finder = new AnnotationFinder(archive);
+
+ return finder;
+ }
+
+ @Override
+ public void init(Object context)
+ {
+ super.init(context);
+ this.servletContext = (ServletContext) context;
+ }
+
+ @Override
+ protected void configure()
+ {
+ }
+
+ /**
+ * @return all beans.xml paths
+ */
+ private Set<String> getArchives() throws Exception
+ {
+ Set<String> lists = createURLFromMarkerFile();
+ String warUrlPath = createURLFromWARFile();
+
+ if (warUrlPath != null)
+ {
+ lists.add(warUrlPath);
+ }
+
+ return lists;
+ }
+
+ /* Creates URLs from the marker file */
+ protected Set<String> createURLFromMarkerFile() throws Exception
+ {
+ Set<String> listURL = new HashSet<String>();
+
+ // Root with beans.xml marker.
+ String[] urls = findBeansXmlBases(META_INF_BEANS_XML, WebBeansUtil.getCurrentClassLoader());
+
+ if (urls != null)
+ {
+ String addPath;
+ for (String url : urls)
+ {
+ String fileDir = new URL(url).getFile();
+ if (fileDir.endsWith(".jar!/"))
+ {
+ fileDir = fileDir.substring(0, fileDir.lastIndexOf("/") + 1) + META_INF_BEANS_XML;
+
+ //fix for weblogic
+ if (!fileDir.startsWith("file:/"))
+ {
+ fileDir = "file:/" + fileDir;
+ }
+
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.log(Level.FINE, "OpenWebBeans found the following url while doing web scanning: " + fileDir);
+ }
+
+ addPath = "jar:" + fileDir;
+
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.log(Level.FINE, "OpenWebBeans added the following jar based path while doing web scanning: " +
+ addPath);
+ }
+ }
+ else
+ {
+ //X TODO check!
+ addPath = "file:" + url + "META-INF/beans.xml";
+
+ if (logger.isLoggable(Level.FINE))
+ {
+ logger.log(Level.FINE, "OpenWebBeans added the following file based path while doing web scanning: " +
+ addPath);
+ }
+
+ }
+
+ listURL.add(addPath);
+ }
+ }
+
+ return listURL;
+ }
+
+ /**
+ * Returns the web application class path if it contains
+ * a beans.xml marker file.
+ *
+ * @return the web application class path
+ * @throws Exception if any exception occurs
+ */
+ protected String createURLFromWARFile() throws Exception
+ {
+ if (servletContext == null)
+ {
+ // this may happen if we are running in a test container, in IDE development, etc
+ return null;
+ }
+
+ URL url = servletContext.getResource("/WEB-INF/beans.xml");
+
+ if (url != null)
+ {
+ addWebBeansXmlLocation(url);
+
+ URL resourceUrl = null;
+ final String path = servletContext.getRealPath("/WEB-INF/classes");
+ if (path != null)
+ {
+ final File fp = new File(path);
+ if (fp.exists())
+ {
+ resourceUrl = fp.toURI().toURL();
+ }
+ }
+
+ if (resourceUrl == null)
+ {
+ return null;
+ }
+
+ return resourceUrl.toExternalForm();
+ }
+
+ return null;
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/util/ServletCompatibilityUtil.java b/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/util/ServletCompatibilityUtil.java
new file mode 100644
index 0000000..bbcfe19
--- /dev/null
+++ b/owb_1.2.x/webbeans-web/src/main/java/org/apache/webbeans/web/util/ServletCompatibilityUtil.java
@@ -0,0 +1,61 @@
+/*
+ * 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.webbeans.web.util;
+
+import javax.servlet.ServletContext;
+
+/**
+ * This utility helps to be compatible with Servlet API 2.4
+ */
+public class ServletCompatibilityUtil
+{
+
+ // avoid instantiation
+
+ private ServletCompatibilityUtil()
+ {
+ }
+
+ /**
+ * Returns an information about the given servlet context.
+ * In case of Servlet API 2.5 or higher the context name will be returned.
+ *
+ * @param servletContext A given servlet context or null.
+ * @return The info, or the string "null"
+ */
+ public static String getServletInfo(ServletContext servletContext)
+ {
+ if (servletContext != null)
+ {
+ if (servletContext.getMajorVersion() >= 3 ||
+ servletContext.getMajorVersion() == 2 && servletContext.getMinorVersion() >= 5)
+ {
+ return servletContext.getContextPath();
+ }
+ else
+ {
+ return servletContext.getServletContextName();
+ }
+ }
+ else
+ {
+ return "null";
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-web/src/main/resources/META-INF/openwebbeans/openwebbeans.properties b/owb_1.2.x/webbeans-web/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
new file mode 100644
index 0000000..2610675
--- /dev/null
+++ b/owb_1.2.x/webbeans-web/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
@@ -0,0 +1,56 @@
+#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.
+#---------------------------------------------------------------
+# The configuration for OpenWebBeans Web container integration
+#---------------------------------------------------------------
+
+################################################################################################
+################################### WEB SPI CONFIGURATION SECTION ##########################
+################################################################################################
+
+configuration.ordinal=11
+
+################################### WEB Container Lifecycle ################################
+#Default implementation of org.apache.webbeans.corespi.ContainerLifecycle.
+org.apache.webbeans.spi.ContainerLifecycle=org.apache.webbeans.web.lifecycle.WebContainerLifecycle
+################################################################################################
+
+################################### WEB Scanner Service ####################################
+#Default implementation of org.apache.webbeans.corespi.ScannerService.
+org.apache.webbeans.spi.ScannerService=org.apache.webbeans.web.scanner.WebScannerService
+################################################################################################
+
+################################### WEB Contexts Service ####################################
+#Default implementation of org.apache.webbeans.corespi.ContextsService.
+org.apache.webbeans.spi.ContextsService=org.apache.webbeans.web.context.WebContextsService
+################################################################################################
+
+################################################################################################
+#################################### SEVERAL WEB CONFIGURATION PARAMETERS ######################
+################################################################################################
+
+################################## Application Development is JSP ##############################
+#Used to register WebBeansELResolver with JSP EL
+org.apache.webbeans.application.jsp=false
+################################################################################################
+
+########################### Proxy Implmenentation Mapping ######################################
+# This allows mapping a Scope Annotation class to a specific InterceptorProxy which are
+# typically sub classes of NormalScopedBeanInterceptorHandler
+#
+org.apache.webbeans.proxy.mapping.javax.enterprise.context.RequestScoped=org.apache.webbeans.web.intercept.RequestScopedBeanInterceptorHandler
+################################################################################################
diff --git a/owb_1.2.x/webbeans-web/src/site/site.xml b/owb_1.2.x/webbeans-web/src/site/site.xml
new file mode 100644
index 0000000..1cfed87
--- /dev/null
+++ b/owb_1.2.x/webbeans-web/src/site/site.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<project name="OpenWebBeans">
+ <bannerLeft>
+ <name>Apache OpenWebBeans</name>
+ <src>http://openwebbeans.apache.org/owb/images/logos/openwebbeans_hor.png</src>
+ <href>http://openwebbeans.apache.org</href>
+ </bannerLeft>
+
+ <bannerRight>
+ <name>Apache Banner</name>
+ <src>http://www.apache.org/images/asf-logo.gif</src>
+ <href>http://www.apache.org</href>
+ </bannerRight>
+
+ <publishDate format="dd MMM yyyy" />
+ <version position="left"/>
+
+ <body>
+ <breadcrumbs>
+ <item name="Apache" href="http://www.apache.org"/>
+ <item name="OpenWebBeans" href="http://openwebbeans.apache.org"/>
+ <item name="OWB-Web" href="http://openwebbeans.apache.org/${project.version}/openwebbeans-web"/>
+ </breadcrumbs>
+
+ <menu ref="reports"/>
+ </body>
+</project>
+
diff --git a/owb_1.2.x/webbeans-web/src/test/java/org/apache/webbeans/web/tests/MockHttpSession.java b/owb_1.2.x/webbeans-web/src/test/java/org/apache/webbeans/web/tests/MockHttpSession.java
new file mode 100644
index 0000000..40f5b9b
--- /dev/null
+++ b/owb_1.2.x/webbeans-web/src/test/java/org/apache/webbeans/web/tests/MockHttpSession.java
@@ -0,0 +1,136 @@
+/*
+ * 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.webbeans.web.tests;
+
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionContext;
+
+public class MockHttpSession implements HttpSession
+{
+ public static final String SESSION_ID = "testSessionId";
+
+ private Map<String, Object> attributes = new HashMap<String, Object>();
+
+ @Override
+ public Object getAttribute(String key)
+ {
+ return attributes.get(key);
+ }
+
+ @Override
+ public Enumeration getAttributeNames()
+ {
+ return null;
+ }
+
+ @Override
+ public long getCreationTime()
+ {
+ return 0;
+ }
+
+ @Override
+ public String getId()
+ {
+ return SESSION_ID;
+ }
+
+ @Override
+ public long getLastAccessedTime()
+ {
+ return 0;
+ }
+
+ @Override
+ public int getMaxInactiveInterval()
+ {
+ return 0;
+ }
+
+ @Override
+ public ServletContext getServletContext()
+ {
+ return null;
+ }
+
+ @Override
+ public HttpSessionContext getSessionContext()
+ {
+ return null;
+ }
+
+ @Override
+ public Object getValue(String arg0)
+ {
+ return null;
+ }
+
+ @Override
+ public String[] getValueNames()
+ {
+ return null;
+ }
+
+ @Override
+ public void invalidate()
+ {
+
+ }
+
+ @Override
+ public boolean isNew()
+ {
+ return false;
+ }
+
+ @Override
+ public void putValue(String arg0, Object arg1)
+ {
+
+ }
+
+ @Override
+ public void removeAttribute(String key)
+ {
+ attributes.remove(key);
+ }
+
+ @Override
+ public void removeValue(String arg0)
+ {
+
+ }
+
+ @Override
+ public void setAttribute(String key, Object value)
+ {
+ attributes.put(key, value);
+ }
+
+ @Override
+ public void setMaxInactiveInterval(int arg0)
+ {
+
+ }
+}
diff --git a/owb_1.2.x/webbeans-web/src/test/java/org/apache/webbeans/web/tests/MockServletContext.java b/owb_1.2.x/webbeans-web/src/test/java/org/apache/webbeans/web/tests/MockServletContext.java
new file mode 100644
index 0000000..cf37086
--- /dev/null
+++ b/owb_1.2.x/webbeans-web/src/test/java/org/apache/webbeans/web/tests/MockServletContext.java
@@ -0,0 +1,180 @@
+/*
+ * 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.webbeans.web.tests;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:struberg@yahoo.de">Mark Struberg</a>
+ */
+public class MockServletContext implements ServletContext
+{
+ @Override
+ public Object getAttribute(String name)
+ {
+ return null;
+ }
+
+ @Override
+ public ServletContext getContext(String uripath)
+ {
+ return null;
+ }
+
+ @Override
+ public String getContextPath()
+ {
+ return null;
+ }
+
+ @Override
+ public int getMajorVersion()
+ {
+ return 0;
+ }
+
+ @Override
+ public int getMinorVersion()
+ {
+ return 0;
+ }
+
+ @Override
+ public String getMimeType(String file)
+ {
+ return null;
+ }
+
+ @Override
+ public Set getResourcePaths(String path)
+ {
+ return null;
+ }
+
+ @Override
+ public URL getResource(String path) throws MalformedURLException
+ {
+ return null;
+ }
+
+ @Override
+ public InputStream getResourceAsStream(String path)
+ {
+ return null;
+ }
+
+ @Override
+ public RequestDispatcher getRequestDispatcher(String path)
+ {
+ return null;
+ }
+
+ @Override
+ public RequestDispatcher getNamedDispatcher(String name)
+ {
+ return null;
+ }
+
+ @Override
+ public Servlet getServlet(String name) throws ServletException
+ {
+ return null;
+ }
+
+ @Override
+ public Enumeration getServlets()
+ {
+ return null;
+ }
+
+ @Override
+ public Enumeration getServletNames()
+ {
+ return null;
+ }
+
+ @Override
+ public void log(String msg)
+ {
+ }
+
+ @Override
+ public void log(Exception exception, String msg)
+ {
+ }
+
+ @Override
+ public void log(String message, Throwable throwable)
+ {
+ }
+
+ @Override
+ public String getRealPath(String path)
+ {
+ return null;
+ }
+
+ @Override
+ public String getServerInfo()
+ {
+ return null;
+ }
+
+ @Override
+ public String getInitParameter(String name)
+ {
+ return null;
+ }
+
+ @Override
+ public Enumeration getInitParameterNames()
+ {
+ return null;
+ }
+
+ @Override
+ public Enumeration getAttributeNames()
+ {
+ return null;
+ }
+
+ @Override
+ public void setAttribute(String name, Object object)
+ {
+ }
+
+ @Override
+ public void removeAttribute(String name)
+ {
+ }
+
+ @Override
+ public String getServletContextName()
+ {
+ return null;
+ }
+}
diff --git a/owb_1.2.x/webbeans-web/src/test/java/org/apache/webbeans/web/tests/MockServletRequest.java b/owb_1.2.x/webbeans-web/src/test/java/org/apache/webbeans/web/tests/MockServletRequest.java
new file mode 100644
index 0000000..5251cd1
--- /dev/null
+++ b/owb_1.2.x/webbeans-web/src/test/java/org/apache/webbeans/web/tests/MockServletRequest.java
@@ -0,0 +1,360 @@
+/*
+ * 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.webbeans.web.tests;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.security.Principal;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:struberg@yahoo.de">Mark Struberg</a>
+ */
+public class MockServletRequest implements HttpServletRequest
+{
+
+ @Override
+ public Object getAttribute(String name)
+ {
+ return null;
+ }
+
+ @Override
+ public Enumeration getAttributeNames()
+ {
+ return null;
+ }
+
+ @Override
+ public String getCharacterEncoding()
+ {
+ return null;
+ }
+
+ @Override
+ public void setCharacterEncoding(String env) throws UnsupportedEncodingException
+ {
+ }
+
+ @Override
+ public int getContentLength()
+ {
+ return 0;
+ }
+
+ @Override
+ public String getContentType()
+ {
+ return null;
+ }
+
+ @Override
+ public ServletInputStream getInputStream() throws IOException
+ {
+ return null;
+ }
+
+ @Override
+ public String getParameter(String name)
+ {
+ return null;
+ }
+
+ @Override
+ public Enumeration getParameterNames()
+ {
+ return null;
+ }
+
+ @Override
+ public String[] getParameterValues(String name)
+ {
+ return new String[0];
+ }
+
+ @Override
+ public Map getParameterMap()
+ {
+ return null;
+ }
+
+ @Override
+ public String getProtocol()
+ {
+ return null;
+ }
+
+ @Override
+ public String getScheme()
+ {
+ return null;
+ }
+
+ @Override
+ public String getServerName()
+ {
+ return null;
+ }
+
+ @Override
+ public int getServerPort()
+ {
+ return 0;
+ }
+
+ @Override
+ public BufferedReader getReader() throws IOException
+ {
+ return null;
+ }
+
+ @Override
+ public String getRemoteAddr()
+ {
+ return null;
+ }
+
+ @Override
+ public String getRemoteHost()
+ {
+ return null;
+ }
+
+ @Override
+ public void setAttribute(String name, Object o)
+ {
+ }
+
+ @Override
+ public void removeAttribute(String name)
+ {
+ }
+
+ @Override
+ public Locale getLocale()
+ {
+ return null;
+ }
+
+ @Override
+ public Enumeration getLocales()
+ {
+ return null;
+ }
+
+ @Override
+ public boolean isSecure()
+ {
+ return false;
+ }
+
+ @Override
+ public RequestDispatcher getRequestDispatcher(String path)
+ {
+ return null;
+ }
+
+ @Override
+ public String getRealPath(String path)
+ {
+ return null;
+ }
+
+ @Override
+ public int getRemotePort()
+ {
+ return 0;
+ }
+
+ @Override
+ public String getLocalName()
+ {
+ return null;
+ }
+
+ @Override
+ public String getLocalAddr()
+ {
+ return null;
+ }
+
+ @Override
+ public int getLocalPort()
+ {
+ return 0;
+ }
+
+ @Override
+ public String getAuthType()
+ {
+ return null;
+ }
+
+ @Override
+ public Cookie[] getCookies()
+ {
+ return new Cookie[0];
+ }
+
+ @Override
+ public long getDateHeader(String name)
+ {
+ return 0;
+ }
+
+ @Override
+ public String getHeader(String name)
+ {
+ return null;
+ }
+
+ @Override
+ public Enumeration getHeaders(String name)
+ {
+ return null;
+ }
+
+ @Override
+ public Enumeration getHeaderNames()
+ {
+ return null;
+ }
+
+ @Override
+ public int getIntHeader(String name)
+ {
+ return 0;
+ }
+
+ @Override
+ public String getMethod()
+ {
+ return null;
+ }
+
+ @Override
+ public String getPathInfo()
+ {
+ return null;
+ }
+
+ @Override
+ public String getPathTranslated()
+ {
+ return null;
+ }
+
+ @Override
+ public String getContextPath()
+ {
+ return null;
+ }
+
+ @Override
+ public String getQueryString()
+ {
+ return null;
+ }
+
+ @Override
+ public String getRemoteUser()
+ {
+ return null;
+ }
+
+ @Override
+ public boolean isUserInRole(String role)
+ {
+ return false;
+ }
+
+ @Override
+ public Principal getUserPrincipal()
+ {
+ return null;
+ }
+
+ @Override
+ public String getRequestedSessionId()
+ {
+ return null;
+ }
+
+ @Override
+ public String getRequestURI()
+ {
+ return null;
+ }
+
+ @Override
+ public StringBuffer getRequestURL()
+ {
+ return null;
+ }
+
+ @Override
+ public String getServletPath()
+ {
+ return null;
+ }
+
+ @Override
+ public HttpSession getSession(boolean create)
+ {
+ return null;
+ }
+
+ @Override
+ public HttpSession getSession()
+ {
+ return null;
+ }
+
+ @Override
+ public boolean isRequestedSessionIdValid()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isRequestedSessionIdFromCookie()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isRequestedSessionIdFromURL()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isRequestedSessionIdFromUrl()
+ {
+ return false;
+ }
+}
diff --git a/owb_1.2.x/webbeans-web/src/test/java/org/apache/webbeans/web/tests/interceptor/CachedInterceptorHandlerTest.java b/owb_1.2.x/webbeans-web/src/test/java/org/apache/webbeans/web/tests/interceptor/CachedInterceptorHandlerTest.java
new file mode 100644
index 0000000..a7b8723
--- /dev/null
+++ b/owb_1.2.x/webbeans-web/src/test/java/org/apache/webbeans/web/tests/interceptor/CachedInterceptorHandlerTest.java
@@ -0,0 +1,116 @@
+/*
+ * 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.webbeans.web.tests.interceptor;
+
+import junit.framework.Assert;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.interceptors.beans.ApplicationScopedBean;
+import org.apache.webbeans.newtests.interceptors.beans.DependentScopedBean;
+import org.apache.webbeans.newtests.interceptors.beans.RequestScopedBean;
+import org.apache.webbeans.newtests.interceptors.common.TransactionInterceptor;
+import org.apache.webbeans.web.tests.MockServletContext;
+import org.apache.webbeans.web.tests.MockServletRequest;
+import org.junit.Test;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.servlet.ServletRequestEvent;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * This test checks the performance of simple interceptor invocations.
+ * It is usually enabled with only a few iteration cycles.
+ */
+@SuppressWarnings("unchecked")
+public class CachedInterceptorHandlerTest extends AbstractUnitTest
+{
+
+ private static final int ITERATIONS = 100000;
+
+ private static Logger logger = WebBeansLoggerFacade.getLogger(CachedInterceptorHandlerTest.class);
+
+
+ @Test
+ public void testInterceptorPerformance() throws Exception
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(ApplicationScopedBean.class);
+ beanClasses.add(RequestScopedBean.class);
+ beanClasses.add(DependentScopedBean.class);
+
+ TransactionInterceptor.count = 0;
+
+ startContainer(beanClasses, null);
+
+ MockServletContext mockServletContext = new MockServletContext();
+ MockServletRequest mockServletRequest = new MockServletRequest();
+ ServletRequestEvent servletRequestEvent = new ServletRequestEvent(mockServletContext, mockServletRequest);
+
+
+
+ long start = System.nanoTime();
+
+ for (int req = 0; req < 10; req++)
+ {
+ getWebBeansContext().getContextsService().startContext(RequestScoped.class, servletRequestEvent);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans(RequestScopedBean.class);
+ Assert.assertNotNull(beans);
+ Bean<RequestScopedBean> bean = (Bean<RequestScopedBean>)beans.iterator().next();
+
+ CreationalContext<RequestScopedBean> ctx = getBeanManager().createCreationalContext(bean);
+
+ Object reference1 = getBeanManager().getReference(bean, RequestScopedBean.class, ctx);
+ Assert.assertNotNull(reference1);
+
+ Assert.assertTrue(reference1 instanceof RequestScopedBean);
+
+ RequestScopedBean beanInstance1 = (RequestScopedBean)reference1;
+
+ TransactionInterceptor.count = 0;
+
+ for (int i= 1; i < ITERATIONS; i++)
+ {
+ beanInstance1.getMyService();
+ }
+
+ getWebBeansContext().getContextsService().endContext(RequestScoped.class, servletRequestEvent);
+ }
+
+ long end = System.nanoTime();
+
+ logger.log(Level.INFO, "Executing {0} iterations took {1} ns", WebBeansLoggerFacade.args(ITERATIONS, end - start));
+
+ shutDownContainer();
+
+ if ((end - start) / 1e6 > ITERATIONS*10)
+ {
+ // if it takes longer than 1ms for each iteration, then this is really a performance blocker!
+ Assert.fail("Performance test took more than 20 times longer than it should");
+ }
+
+ }
+
+}
diff --git a/owb_1.2.x/webbeans-web/src/test/java/org/apache/webbeans/web/tests/interceptor/SerializationTest.java b/owb_1.2.x/webbeans-web/src/test/java/org/apache/webbeans/web/tests/interceptor/SerializationTest.java
new file mode 100644
index 0000000..f863223
--- /dev/null
+++ b/owb_1.2.x/webbeans-web/src/test/java/org/apache/webbeans/web/tests/interceptor/SerializationTest.java
@@ -0,0 +1,93 @@
+/*
+* 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.webbeans.web.tests.interceptor;
+
+
+import junit.framework.Assert;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.web.tests.MockServletContext;
+import org.apache.webbeans.web.tests.MockServletRequest;
+import org.junit.Test;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.servlet.ServletRequestEvent;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+
+/**
+ * Tests for various serialization issues
+ */
+public class SerializationTest extends AbstractUnitTest
+{
+ @Test
+ public void testDeserializationOfRequestScopedBean() throws Exception
+ {
+ final MockServletContext mockServletContext = new MockServletContext();
+ final MockServletRequest mockServletRequest = new MockServletRequest();
+ final ServletRequestEvent servletRequestEvent = new ServletRequestEvent(mockServletContext, mockServletRequest);
+
+ final Collection<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(ReqBean.class);
+ startContainer(classes);
+
+ getWebBeansContext().getContextsService().startContext(RequestScoped.class, servletRequestEvent);
+
+ final BeanManager bm = getBeanManager();
+ final Set<Bean<?>> beans = getBeanManager().getBeans(ReqBean.class);
+ final Bean pdbBean = beans.iterator().next();
+ final ReqBean instance = ReqBean.class.cast(getBeanManager().getReference(pdbBean, ReqBean.class, bm.createCreationalContext(pdbBean)));
+ Assert.assertNotNull(instance);
+
+ final Object deserial = deSerializeObject(serializeObject(instance));
+ Assert.assertTrue(ReqBean.class.isInstance(deserial));
+
+ getWebBeansContext().getContextsService().endContext(RequestScoped.class, servletRequestEvent);
+ }
+
+ private byte[] serializeObject(Object o) throws IOException
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(o);
+ return baos.toByteArray();
+ }
+
+ private Object deSerializeObject(byte[] serial) throws IOException, ClassNotFoundException
+ {
+ ByteArrayInputStream bais = new ByteArrayInputStream(serial);
+ ObjectInputStream ois = new ObjectInputStream(bais);
+ return ois.readObject();
+ }
+
+ @RequestScoped
+ public static class ReqBean {
+ public String ok() {
+ return "ok";
+ }
+ }
+}
diff --git a/owb_1.2.x/webbeans-web/src/test/resources/META-INF/openwebbeans/openwebbeans.properties b/owb_1.2.x/webbeans-web/src/test/resources/META-INF/openwebbeans/openwebbeans.properties
new file mode 100644
index 0000000..3d3a3a4
--- /dev/null
+++ b/owb_1.2.x/webbeans-web/src/test/resources/META-INF/openwebbeans/openwebbeans.properties
@@ -0,0 +1,33 @@
+#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.
+#---------------------------------------------------------------
+# The configuration for OpenWebBeans Web tests
+#---------------------------------------------------------------
+
+################################################################################################
+################################### WEB SPI CONFIGURATION SECTION ##########################
+################################################################################################
+
+configuration.ordinal=15
+
+########################### Proxy Implmenentation Mapping ######################################
+# This allows mapping a Scope Annotation class to a specific InterceptorProxy which are
+# typically sub classes of NormalScopedBeanInterceptorHandler
+# We need to register this with a higher ordinal again, since webbeans-impl/tests have ordinal 11 too!
+#
+org.apache.webbeans.proxy.mapping.javax.enterprise.context.RequestScoped=org.apache.webbeans.web.intercept.RequestScopedBeanInterceptorHandler
+################################################################################################