You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2005/08/30 12:30:18 UTC
svn commit: r264755 [1/4] - in /cocoon/branches/BRANCH_2_1_X: ./ legal/ lib/
lib/optional/ src/blocks/portal/conf/
src/blocks/portal/java/org/apache/cocoon/portal/wsrp/
src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/
src/blocks/portal/jav...
Author: cziegeler
Date: Tue Aug 30 03:29:21 2005
New Revision: 264755
URL: http://svn.apache.org/viewcvs?rev=264755&view=rev
Log:
Add WSRP Consumer support (through WSRP4J) to the portal block.
Added:
cocoon/branches/BRANCH_2_1_X/legal/wsrp4j-consumer-0.3-dev.jar.license.txt (with props)
cocoon/branches/BRANCH_2_1_X/legal/wsrp4j-shared-0.3-dev.jar.license.txt (with props)
cocoon/branches/BRANCH_2_1_X/lib/optional/wsrp4j-consumer-0.3-dev.jar (with props)
cocoon/branches/BRANCH_2_1_X/lib/optional/wsrp4j-shared-0.3-dev.jar (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPEvent.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPEventAspect.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPPortletWindowAspect.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/ConsumerEnvironmentImpl.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/GroupSessionImpl.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/PortletDriverImpl.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/PortletDriverRegistryImpl.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/PortletRegistryImpl.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/PortletSessionImpl.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/ProducerDescription.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/ProducerRegistryImpl.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/Request.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/RequestImpl.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/RequiresConsumerEnvironment.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/RequiresPortalService.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/RequiresWSRPAdapter.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/SessionHandlerImpl.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/SimplePortletWindowSession.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/SimplePortletWindowSessionImpl.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/URLGeneratorImpl.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/URLRewriterImpl.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/URLTemplateComposerImpl.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/UserContextExtension.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/UserContextProvider.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/UserContextProviderImpl.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/UserRegistryImpl.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/UserSessionImpl.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/consumer/WSRPRequestImpl.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/logging/
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/logging/WSRPLogManager.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/logging/WSRPLogger.java (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/wsrp-config.xml (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/skins/basic/css/wsrp.css (with props)
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/skins/common/css/wsrp.css (with props)
Modified:
cocoon/branches/BRANCH_2_1_X/gump.xml
cocoon/branches/BRANCH_2_1_X/lib/jars.xml
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/conf/portal.samplesxconf
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/conf/portal.xconf
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/docs/portal-demo.xml
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/copletbasedata/portal.xml
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/copletdata/portal.xml
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/copletinstancedata/portal.xml
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/layout/portal.xml
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/sitemap-auth.xmap
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/sitemap.xmap
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/skins/basic/styles/portal-page.xsl
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/skins/common/styles/portal-page.xsl
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/skins/common/styles/window.xsl
cocoon/branches/BRANCH_2_1_X/status.xml
Modified: cocoon/branches/BRANCH_2_1_X/gump.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/gump.xml?rev=264755&r1=264754&r2=264755&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/gump.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/gump.xml Tue Aug 30 03:29:21 2005
@@ -1038,6 +1038,10 @@
<depend project="portals-pluto" inherit="runtime"/>
<depend project="portals-bridges-common"/>
<depend project="cowarp"/>
+ <depend project="ws-axis"/>
+ <depend project="wsdl4j"/>
+ <depend project="wsrp4j"/>
+ <depend project="commons-discovery"/>
<library name="jtidy"/>
<library name="nekohtml"/>
@@ -1047,6 +1051,14 @@
<library name="portlet-api"/>
<library name="portals-bridges-common"/>
<library name="cowarp"/>
+ <library name="axis"/>
+ <library name="axis-saaj"/>
+ <library name="axis-jaxrpc"/>
+ <library name="wsdl4j"/>
+ <library name="commons-discovery"/>
+ <library name="wsrp4j-shared"/>
+ <library name="wsrp4j-consumer"/>
+
<work nested="tools/anttasks"/>
<home nested="build/cocoon-@@DATE@@"/>
@@ -1745,5 +1757,12 @@
<url href="http://osoco.sourceforge.net/cowarp/"/>
<package>org.osoco.cowarp</package>
<jar name="lib/optional/cowarp-0.3.jar"/>
+ </project>
+
+ <project name="wsrp4j">
+ <url href="http://ws.apache.org/wsrp4j/"/>
+ <package>org.apache.wsrp4j</package>
+ <jar name="lib/optional/wsrp4j-shared-0.3-dev.jar"/>
+ <jar name="lib/optional/wsrp4j-consumer-0.3-dev.jar"/>
</project>
</module>
Added: cocoon/branches/BRANCH_2_1_X/legal/wsrp4j-consumer-0.3-dev.jar.license.txt
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/legal/wsrp4j-consumer-0.3-dev.jar.license.txt?rev=264755&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/legal/wsrp4j-consumer-0.3-dev.jar.license.txt (added)
+++ cocoon/branches/BRANCH_2_1_X/legal/wsrp4j-consumer-0.3-dev.jar.license.txt Tue Aug 30 03:29:21 2005
@@ -0,0 +1,190 @@
+ 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 2004 The Apache Software Foundation
+
Propchange: cocoon/branches/BRANCH_2_1_X/legal/wsrp4j-consumer-0.3-dev.jar.license.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/branches/BRANCH_2_1_X/legal/wsrp4j-consumer-0.3-dev.jar.license.txt
------------------------------------------------------------------------------
svn:keywords = Id
Added: cocoon/branches/BRANCH_2_1_X/legal/wsrp4j-shared-0.3-dev.jar.license.txt
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/legal/wsrp4j-shared-0.3-dev.jar.license.txt?rev=264755&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/legal/wsrp4j-shared-0.3-dev.jar.license.txt (added)
+++ cocoon/branches/BRANCH_2_1_X/legal/wsrp4j-shared-0.3-dev.jar.license.txt Tue Aug 30 03:29:21 2005
@@ -0,0 +1,190 @@
+ 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 2004 The Apache Software Foundation
+
Propchange: cocoon/branches/BRANCH_2_1_X/legal/wsrp4j-shared-0.3-dev.jar.license.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/branches/BRANCH_2_1_X/legal/wsrp4j-shared-0.3-dev.jar.license.txt
------------------------------------------------------------------------------
svn:keywords = Id
Modified: cocoon/branches/BRANCH_2_1_X/lib/jars.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/lib/jars.xml?rev=264755&r1=264754&r2=264755&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/lib/jars.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/lib/jars.xml Tue Aug 30 03:29:21 2005
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--
- Copyright 1999-2004 The Apache Software Foundation
+ Copyright 1999-2005 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -1257,4 +1257,23 @@
<homepage>http://incubator.apache.org/jackrabbit/</homepage>
</file>
+ <file>
+ <title>WSRP4J Shared</title>
+ <description>
+ WSRP implementation from the WSRP4J project.
+ </description>
+ <used-by>Portal block</used-by>
+ <lib>optional/wsrp4j-shared-0.3-dev.jar</lib>
+ <homepage>http://ws.apache.org/wsrp4j/</homepage>
+ </file>
+
+ <file>
+ <title>WSRP4J Consumer</title>
+ <description>
+ WSRP implementation from the WSRP4J project.
+ </description>
+ <used-by>Portal block</used-by>
+ <lib>optional/wsrp4j-consumer-0.3-dev.jar</lib>
+ <homepage>http://ws.apache.org/wsrp4j/</homepage>
+ </file>
</jars>
Added: cocoon/branches/BRANCH_2_1_X/lib/optional/wsrp4j-consumer-0.3-dev.jar
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/lib/optional/wsrp4j-consumer-0.3-dev.jar?rev=264755&view=auto
==============================================================================
Binary file - no diff available.
Propchange: cocoon/branches/BRANCH_2_1_X/lib/optional/wsrp4j-consumer-0.3-dev.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: cocoon/branches/BRANCH_2_1_X/lib/optional/wsrp4j-shared-0.3-dev.jar
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/lib/optional/wsrp4j-shared-0.3-dev.jar?rev=264755&view=auto
==============================================================================
Binary file - no diff available.
Propchange: cocoon/branches/BRANCH_2_1_X/lib/optional/wsrp4j-shared-0.3-dev.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/conf/portal.samplesxconf
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/conf/portal.samplesxconf?rev=264755&r1=264754&r2=264755&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/conf/portal.samplesxconf (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/conf/portal.samplesxconf Tue Aug 30 03:29:21 2005
@@ -168,6 +168,25 @@
<aspect type="coplet-cinclude"/>
</aspects>
</renderer>
+ <renderer name="wsrp-window"
+ class="org.apache.cocoon.portal.layout.renderer.impl.AspectRenderer"
+ logger="portal">
+ <aspects>
+ <aspect type="xslt">
+ <parameter name="style" value="{portal-skin:skin.basepath}/styles/window.xsl"/>
+ </aspect>
+ <aspect type="parameter">
+ <parameter name="tag-name" value="window"/>
+ </aspect>
+ <aspect type="wsrp-window">
+ <parameter name="root-tag" value="false"/>
+ </aspect>
+ <aspect type="coplet-removing"/>
+ <aspect type="history"/>
+ <aspect type="basket"/>
+ <aspect type="coplet-cinclude"/>
+ </aspects>
+ </renderer>
<renderer name="link"
class="org.apache.cocoon.portal.layout.renderer.impl.DefaultLinkRenderer"
logger="portal"/>
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/conf/portal.xconf
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/conf/portal.xconf?rev=264755&r1=264754&r2=264755&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/conf/portal.xconf (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/conf/portal.xconf Tue Aug 30 03:29:21 2005
@@ -29,6 +29,8 @@
<!-- This aspect sets headers on the response that tell the client to not cache the response: -->
<aspect logger="portal" name="no-client-caching" class="org.apache.cocoon.portal.event.aspect.impl.NoClientCachingEventAspect"/>
+ <!-- This aspect is required for wsrp: -->
+ <aspect logger="portal" name="wsrp" class="org.apache.cocoon.portal.wsrp.adapter.WSRPEventAspect"/>
</component>
<!-- Portal Manager Aspect Configuration -->
@@ -51,6 +53,8 @@
<!-- Uncomment the following when using PageLabels
<aspect type="page-label"/>
-->
+ <!-- Comment the following out if you don't need WSRP: -->
+ <aspect type="wsrp"/>
<aspect type="request-parameter">
<!-- Uncomment the following when marshalling JSR168 portlet events
<parameter name="parameter-name" value="cocoon-portal-event,url"/>
@@ -90,12 +94,15 @@
The portal manager can be extended with different aspects.
Currently the JSR-168 aspect is configured/activated.
If you don't need the JSR-168 support uncomment the aspect.
+ In a similar manner the wsrp support works.
-->
<component class="org.apache.cocoon.portal.impl.PortalManagerImpl"
logger="portal" role="org.apache.cocoon.portal.PortalManager">
<aspects>
<!-- JSR-168 support: -->
<aspect adapter="portlet"/>
+ <!-- wsrp support: -->
+ <aspect adapter="wsrp"/>
</aspects>
</component>
@@ -142,6 +149,13 @@
<coplet-adapter name="application"
class="org.apache.cocoon.portal.coplet.adapter.impl.ApplicationCopletAdapter"
logger="portal"/>
+ <!-- This is the wsrp adapter -->
+ <coplet-adapter name="wsrp"
+ class="org.apache.cocoon.portal.wsrp.adapter.WSRPAdapter"
+ logger="portal">
+ <!-- This is the wsrp configuration containing the producers etc. -->
+ <parameter name="wsrp-config" value="profiles/wsrp-config.xml"/>
+ </coplet-adapter>
</component>
@@ -152,6 +166,8 @@
<aspect logger="portal" name="window" class="org.apache.cocoon.portal.layout.renderer.aspect.impl.WindowAspect"/>
<aspect logger="portal" name="portlet-window"
class="org.apache.cocoon.portal.layout.renderer.aspect.impl.PortletWindowAspect"/>
+ <aspect logger="portal" name="wsrp-window"
+ class="org.apache.cocoon.portal.wsrp.adapter.WSRPPortletWindowAspect"/>
<!-- This aspect can be used to render the minimize/maximize buttons -->
<aspect logger="portal" name="coplet-sizing" class="org.apache.cocoon.portal.layout.renderer.aspect.impl.SizingAspect"/>
@@ -199,6 +215,12 @@
<component class="org.apache.cocoon.portal.profile.impl.MapProfileLS" role="org.apache.cocoon.portal.profile.ProfileLS" logger="portal"/>
<component class="org.apache.cocoon.components.variables.DefaultVariableResolverFactory" role="org.apache.cocoon.components.variables.VariableResolverFactory" logger="portal"/>
+
+ <!-- User Context Provider for WSRP -->
+ <component role="org.apache.cocoon.portal.wsrp.consumer.UserContextProvider"
+ class="org.apache.cocoon.portal.wsrp.consumer.UserContextProviderImpl"
+ logger="portal"/>
+
<!-- This is the basket manager -->
<component class="org.apache.cocoon.portal.coplets.basket.BasketManagerImpl"
role="org.apache.cocoon.portal.coplets.basket.BasketManager"
Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java?rev=264755&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java Tue Aug 30 03:29:21 2005
@@ -0,0 +1,913 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.portal.wsrp.adapter;
+
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.servlet.ServletConfig;
+
+import oasis.names.tc.wsrp.v1.types.BlockingInteractionResponse;
+import oasis.names.tc.wsrp.v1.types.MarkupContext;
+import oasis.names.tc.wsrp.v1.types.MarkupResponse;
+import oasis.names.tc.wsrp.v1.types.MarkupType;
+import oasis.names.tc.wsrp.v1.types.PortletContext;
+import oasis.names.tc.wsrp.v1.types.PortletDescription;
+import oasis.names.tc.wsrp.v1.types.SessionContext;
+import oasis.names.tc.wsrp.v1.types.UpdateResponse;
+
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
+import org.apache.avalon.framework.container.ContainerUtil;
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.ContextException;
+import org.apache.avalon.framework.context.Contextualizable;
+import org.apache.avalon.framework.parameters.ParameterException;
+import org.apache.avalon.framework.parameters.Parameterizable;
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.environment.ObjectModelHelper;
+import org.apache.cocoon.environment.Session;
+import org.apache.cocoon.environment.wrapper.RequestParameters;
+import org.apache.cocoon.portal.PortalManagerAspect;
+import org.apache.cocoon.portal.PortalManagerAspectPrepareContext;
+import org.apache.cocoon.portal.PortalManagerAspectRenderContext;
+import org.apache.cocoon.portal.PortalService;
+import org.apache.cocoon.portal.coplet.CopletData;
+import org.apache.cocoon.portal.coplet.CopletInstanceData;
+import org.apache.cocoon.portal.coplet.adapter.impl.AbstractCopletAdapter;
+import org.apache.cocoon.portal.coplet.status.SizingStatus;
+import org.apache.cocoon.portal.event.EventManager;
+import org.apache.cocoon.portal.event.Receiver;
+import org.apache.cocoon.portal.event.impl.ChangeCopletInstanceAspectDataEvent;
+import org.apache.cocoon.portal.event.impl.FullScreenCopletEvent;
+import org.apache.cocoon.portal.layout.Layout;
+import org.apache.cocoon.portal.serialization.IncludingHTMLSerializer;
+import org.apache.cocoon.portal.util.HtmlSaxParser;
+import org.apache.cocoon.portal.wsrp.consumer.ConsumerEnvironmentImpl;
+import org.apache.cocoon.portal.wsrp.consumer.ProducerDescription;
+import org.apache.cocoon.portal.wsrp.consumer.ProducerRegistryImpl;
+import org.apache.cocoon.portal.wsrp.consumer.Request;
+import org.apache.cocoon.portal.wsrp.consumer.RequestImpl;
+import org.apache.cocoon.portal.wsrp.consumer.RequiresConsumerEnvironment;
+import org.apache.cocoon.portal.wsrp.consumer.RequiresPortalService;
+import org.apache.cocoon.portal.wsrp.consumer.RequiresWSRPAdapter;
+import org.apache.cocoon.portal.wsrp.consumer.SimplePortletWindowSession;
+import org.apache.cocoon.portal.wsrp.consumer.UserContextProvider;
+import org.apache.cocoon.portal.wsrp.consumer.WSRPRequestImpl;
+import org.apache.cocoon.portal.wsrp.logging.WSRPLogManager;
+import org.apache.cocoon.portal.wsrp.logging.WSRPLogger;
+import org.apache.cocoon.servlet.CocoonServlet;
+import org.apache.cocoon.util.ClassUtils;
+import org.apache.cocoon.xml.AbstractXMLPipe;
+import org.apache.cocoon.xml.AttributesImpl;
+import org.apache.cocoon.xml.XMLUtils;
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceResolver;
+import org.apache.wsrp4j.consumer.GroupSession;
+import org.apache.wsrp4j.consumer.PortletDriver;
+import org.apache.wsrp4j.consumer.PortletKey;
+import org.apache.wsrp4j.consumer.PortletSession;
+import org.apache.wsrp4j.consumer.Producer;
+import org.apache.wsrp4j.consumer.SessionHandler;
+import org.apache.wsrp4j.consumer.User;
+import org.apache.wsrp4j.consumer.UserSession;
+import org.apache.wsrp4j.consumer.WSRPPortlet;
+import org.apache.wsrp4j.consumer.driver.PortletKeyImpl;
+import org.apache.wsrp4j.consumer.driver.UserImpl;
+import org.apache.wsrp4j.consumer.driver.WSRPPortletImpl;
+import org.apache.wsrp4j.exception.ErrorCodes;
+import org.apache.wsrp4j.exception.WSRPException;
+import org.apache.wsrp4j.log.LogManager;
+import org.apache.wsrp4j.util.Constants;
+import org.apache.wsrp4j.util.WindowStates;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.ext.LexicalHandler;
+
+/**
+ * Adapter to use wsrp-portlets as coplets <br/>
+ * It provides the wsrp support by initializing wsrp4j <br/>
+ * The aspect/adapter can be configured at the portal manager.<br/>
+ *
+ * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
+ * @author <a href="mailto:malessandrini@s-und-n.de">Michel Alessandrini</a>
+ *
+ * @version $Id$
+ */
+public class WSRPAdapter
+ extends AbstractCopletAdapter
+ implements Contextualizable,
+ PortalManagerAspect,
+ Serviceable,
+ Initializable,
+ Disposable,
+ Parameterizable,
+ Receiver {
+
+ /** Key to store the consumer map into the coplet instance data object as a temporary attribute. */
+ public static final String ATTRIBUTE_NAME_CONSUMER_MAP = "wsrp-consumer-map";
+
+ /** Key to store the portlet instance key into the coplet instance data object as a temporary attribute. */
+ public static final String ATTRIBUTE_NAME_PORTLET_INSTANCE_KEY = "wsrp-portlet-instance-key";
+
+ /** Key to store the portlet key into the coplet instance data objectt as a temporary attribute. */
+ public static final String ATTRIBUTE_NAME_PORTLET_KEY = "wsrp-portletkey";
+
+ /** Key to store the wsrp user into the coplet instance data object as a temporary attribute. */
+ public static final String ATTRIBUTE_NAME_USER = "wsrp-user";
+
+ /** Key to store the layout for the wsrp portlet into the coplet instance data object as a temporary attribute. */
+ public static final String ATTRIBUTE_NAME_LAYOUT = "wsrp-layout";
+
+ /** Key to store the wsrp title into the coplet instance data object as a temporary attribute. */
+ public static final String ATTRIBUTE_NAME_PORTLET_TITLE = "wsrp-title";
+
+ /** Key to store the wsrp modes into the coplet instance data object as a temporary attribute. */
+ public static final String ATTRIBUTE_NAME_PORTLET_MODES = "wsrp-modes";
+
+ /** Key to store the window states into the coplet instance data object as a temporary attribute. */
+ public static final String ATTRIBUTE_NAME_PORTLET_WINDOWSTATES = "wsrp-window-states";
+
+ /** Unique name of the consumer. */
+ public static final String CONSUMER_URL = "http://cocoon.apache.org/portal/wsrp-consumer";
+
+ /** Name of the service. */
+ public static final String consumerAgent = "Apache Cocoon Portal." + org.apache.cocoon.Constants.VERSION;
+
+ /** The avalon context. */
+ protected Context context;
+
+ /** The consumer environment implementation. */
+ protected ConsumerEnvironmentImpl consumerEnvironment;
+
+ /** Stores the current coplet instance data per thread. */
+ protected final ThreadLocal copletInstanceData = new InheritableThreadLocal();
+
+ /** The servlet configuration. */
+ protected ServletConfig servletConfig;
+
+ /** The service locator. */
+ protected ServiceManager manager;
+
+ /** The portal service. */
+ protected PortalService service;
+
+ /** The user context provider. */
+ protected UserContextProvider userContextProvider;
+
+ /** Location of the wsrp configuration. */
+ protected String wsrpConfigLocation;
+
+ /** Initialized? */
+ protected boolean initialized = false;
+
+ /** The wsrp configuration. */
+ protected Configuration wsrpConfiguration;
+
+ /** The configuration for this adapter. */
+ protected Parameters parameters;
+
+ /**
+ * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
+ */
+ public void contextualize(Context context) throws ContextException {
+ this.context = context;
+ try {
+ this.servletConfig = (ServletConfig) context.get(CocoonServlet.CONTEXT_SERVLET_CONFIG);
+ // we have to somehow pass this component down to other components!
+ // This is ugly, but it's the only chance for sofisticated component containers
+ // that wrap component implementations!
+ this.servletConfig.getServletContext().setAttribute(WSRPAdapter.class.getName(), this);
+ } catch (ContextException ignore) {
+ // we ignore the context exception
+ // this avoids startup errors if the portal is configured for the CLI
+ // environment
+ this.getLogger().warn("The wsrp support is disabled as the servlet context is not available.", ignore);
+ }
+ }
+
+ /**
+ * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
+ */
+ public void service(ServiceManager manager) throws ServiceException {
+ this.manager = manager;
+ EventManager eventManager = null;
+ try {
+ eventManager = (EventManager)this.manager.lookup(EventManager.ROLE);
+ eventManager.subscribe(this);
+ } finally {
+ this.manager.release(eventManager);
+ }
+ this.service = (PortalService)this.manager.lookup(PortalService.ROLE);
+ this.userContextProvider = (UserContextProvider)this.manager.lookup(UserContextProvider.ROLE);
+ }
+
+ /**
+ * @see org.apache.avalon.framework.parameters.Parameterizable#parameterize(org.apache.avalon.framework.parameters.Parameters)
+ */
+ public void parameterize(Parameters params) throws ParameterException {
+ this.wsrpConfigLocation = params.getParameter("wsrp-config");
+ this.parameters = params;
+ }
+
+ /**
+ * Sets the <tt>WSRPLogger</tt>, the <tt>producerConfig</tt> and the <tt>consumerEnvironment</tt><br/>
+ *
+ * @see org.apache.avalon.framework.activity.Initializable#initialize()
+ */
+ public void initialize() throws Exception {
+ LogManager.setLogManager(new WSRPLogManager(new WSRPLogger(this.getLogger())));
+ this.consumerEnvironment = new ConsumerEnvironmentImpl();
+ this.consumerEnvironment.init(this.service,
+ this);
+ consumerEnvironment.setConsumerAgent(consumerAgent);
+ }
+
+ /**
+ * Removes all portlets, producers and users out of the <tt>consumerEnvironment</tt>-registries<br/>
+ *
+ * @see org.apache.avalon.framework.activity.Disposable#dispose()
+ */
+ public void dispose() {
+
+ consumerEnvironment.getPortletRegistry().removeAllPortlets();
+
+ Iterator producers = consumerEnvironment.getProducerRegistry().getAllProducers();
+ Producer producer;
+ while (producers.hasNext()) {
+ producer = (Producer) producers.next();
+ try {
+ producer.deregister();
+ } catch (WSRPException e) {
+ this.getLogger().error("deregister() producer: " + producer.getName());
+ }
+ }
+ consumerEnvironment.getProducerRegistry().removeAllProducers();
+
+ consumerEnvironment.getUserRegistry().removeAllUsers();
+
+ if ( this.manager != null ) {
+ EventManager eventManager = null;
+ try {
+ eventManager = (EventManager)this.manager.lookup(EventManager.ROLE);
+ eventManager.unsubscribe(this);
+ } catch (Exception ignore) {
+ // let's ignore it
+ } finally {
+ this.manager.release(eventManager);
+ }
+ this.manager.release(this.service);
+ this.manager.release(this.userContextProvider);
+ this.service = null;
+ this.userContextProvider = null;
+ this.manager = null;
+ }
+ try {
+ ContainerUtil.dispose(this.consumerEnvironment);
+ this.consumerEnvironment = null;
+ } catch (Throwable t) {
+ this.getLogger().error("Destruction failed!", t);
+ }
+
+ if ( this.servletConfig != null ) {
+ this.servletConfig.getServletContext().removeAttribute(WSRPAdapter.class.getName());
+ this.servletConfig = null;
+ }
+ }
+
+ /**
+ * Gets the required information of the producer, user, wsrp-portlet, window-states, window-modes<br/>
+ * and stores its into the copletInstanceData<br/>
+ * After that it initiates the <tt>getServiceDescription()</tt>-call<br/>
+ *
+ * @see org.apache.cocoon.portal.coplet.adapter.impl.AbstractCopletAdapter#login(org.apache.cocoon.portal.coplet.CopletInstanceData)
+ */
+ public void login(CopletInstanceData coplet) {
+ super.login(coplet);
+
+ final CopletData copletData = coplet.getCopletData();
+
+ // get the producer
+ final String producerId = (String) copletData.getAttribute("producer-id");
+ if ( producerId == null ) {
+ // if the producer can't be found, we simply return
+ this.getLogger().error("Producer not configured in wsrp coplet " + copletData.getId());
+ return;
+ }
+ final Producer producer = consumerEnvironment.getProducerRegistry().getProducer(producerId);
+ if ( producer == null ) {
+ // if the producer can't be found, we simply return
+ this.getLogger().error("Producer with id " + producerId + " not found.");
+ return;
+ }
+
+ // get the wsrp user and store it as an attribute on the instance
+ final String currentUserID = this.service.getComponentManager().getProfileManager().getUser().getUserName();
+ User user = this.consumerEnvironment.getUserRegistry().getUser(currentUserID);
+ if ( user == null ) {
+ // create a new user
+ user = new UserImpl(currentUserID);
+ user.setUserContext(this.userContextProvider.createUserContext(currentUserID));
+ this.consumerEnvironment.getUserRegistry().addUser(user);
+ }
+ coplet.setTemporaryAttribute(ATTRIBUTE_NAME_USER, user);
+
+ // get the portlet handle
+ final String portletHandle = (String) copletData.getAttribute("portlet-handle");
+ if ( portletHandle == null ) {
+ // if the portlet handle can't be found, we simply return
+ this.getLogger().error("Portlet handle not configured in wsrp coplet " + copletData.getId());
+ return;
+ }
+
+ // get the wsrp portlet
+ final PortletKey portletKey = new PortletKeyImpl(portletHandle, producerId);
+ WSRPPortlet wsrpportlet = this.consumerEnvironment.getPortletRegistry().getPortlet(portletKey);
+ if ( wsrpportlet == null ) {
+ wsrpportlet = new WSRPPortletImpl(portletKey);
+ final PortletContext portletContext = new PortletContext(null, portletKey.getPortletHandle(), null);
+ wsrpportlet.setPortletContext(portletContext);
+ try {
+ consumerEnvironment.getPortletRegistry().addPortlet(wsrpportlet);
+ } catch (WSRPException we) {
+ this.getLogger().error("Exception adding wsrp portlet.", we);
+ return;
+ }
+ }
+ coplet.setTemporaryAttribute(ATTRIBUTE_NAME_PORTLET_KEY, portletKey);
+ final Session session = ObjectModelHelper.getRequest(this.service.getObjectModel()).getSession();
+ final String portletInstanceKey = this.getPortletInstanceKey(portletKey, coplet, session.getId());
+ coplet.setTemporaryAttribute(ATTRIBUTE_NAME_PORTLET_INSTANCE_KEY, portletInstanceKey);
+
+ // create consumer parameters
+ final Map addParams = new HashMap();
+ addParams.put(Constants.PORTLET_INSTANCE_KEY, portletInstanceKey);
+ coplet.setTemporaryAttribute(ATTRIBUTE_NAME_CONSUMER_MAP, addParams);
+
+ // get the window-state and -mode
+ SimplePortletWindowSession windowSession;
+ wsrpportlet = consumerEnvironment.getPortletRegistry().getPortlet(portletKey);
+
+ try {
+ // this call includes the getServiceDescription()-Invocation
+ // additionally register() initCookie() and so on will be handled
+ // (within ProducerImpl and PortletDriverImpl)
+ windowSession = getSimplePortletWindowSession(wsrpportlet,
+ portletInstanceKey,
+ user);
+ final PortletDescription desc = producer.getPortletDescription(portletHandle);
+ coplet.setTemporaryAttribute(ATTRIBUTE_NAME_PORTLET_TITLE,
+ desc.getTitle());
+ final MarkupType markupType = desc.getMarkupTypes(0);
+ coplet.setTemporaryAttribute(ATTRIBUTE_NAME_PORTLET_MODES, markupType.getModes());
+ coplet.setTemporaryAttribute(ATTRIBUTE_NAME_PORTLET_WINDOWSTATES, markupType.getWindowStates());
+
+ } catch (WSRPException e) {
+ this.getLogger().error("Invoking getServiceDescription()", e);
+ }
+ }
+
+ /**
+ * Checks the values of the <tt>portlet-key</tt> and the <tt>user</tt> for current portlet-instance<br/>
+ * After that all passed the <tt>getMarkup()</tt>-call will be initiated<br />
+ *
+ * @see org.apache.cocoon.portal.coplet.adapter.impl.AbstractCopletAdapter#streamContent(org.apache.cocoon.portal.coplet.CopletInstanceData, org.xml.sax.ContentHandler)
+ */
+ public void streamContent(CopletInstanceData coplet, ContentHandler contentHandler)
+ throws SAXException {
+ try {
+ // set the coplet in the thread local variable to give other components access to
+ // the instance
+ this.setCurrentCopletInstanceData(coplet);
+
+ // get the portlet key and the user
+ final PortletKey portletKey = (PortletKey)coplet.getTemporaryAttribute(ATTRIBUTE_NAME_PORTLET_KEY);
+ if ( portletKey == null ) {
+ throw new SAXException("WSRP configuration is missing: portlet key.");
+ }
+ final User user = (User)coplet.getTemporaryAttribute(ATTRIBUTE_NAME_USER);
+ if ( user == null ) {
+ throw new SAXException("WSRP configuration is missing: user.");
+ }
+
+ final String portletInstanceKey = (String)coplet.getTemporaryAttribute(ATTRIBUTE_NAME_PORTLET_INSTANCE_KEY);
+
+ // getMarkup()
+ final WSRPPortlet wsrpportlet = consumerEnvironment.getPortletRegistry().getPortlet(portletKey);
+
+ SimplePortletWindowSession windowSession = getSimplePortletWindowSession(wsrpportlet, portletInstanceKey, user);
+ final MarkupContext markupContext = this.getMarkupContext(wsrpportlet, windowSession, user);
+ if ( markupContext == null || markupContext.getMarkupString() == null ) {
+ throw new SAXException("No markup received from wsrp coplet " + coplet.getId());
+ }
+ final String content = markupContext.getMarkupString();
+
+ final Boolean usePipeline;
+ final boolean usesGet;
+ // If the portlet uses the method get we always have to rewrite form elements
+ final Producer producer = this.consumerEnvironment.getProducerRegistry().getProducer(portletKey.getProducerId());
+ final PortletDescription desc = producer.getPortletDescription(portletKey.getPortletHandle());
+ if ( desc.getUsesMethodGet() != null && desc.getUsesMethodGet().booleanValue() ) {
+ usePipeline = Boolean.TRUE;
+ usesGet = true;
+ } else {
+ usePipeline = (Boolean)this.getConfiguration(coplet, "use-pipeline", Boolean.FALSE);
+ usesGet = false;
+ }
+ if ( usePipeline.booleanValue() ) {
+ if ( usesGet ) {
+ contentHandler = new FormRewritingHandler(contentHandler);
+ }
+ HtmlSaxParser.parseString(content, contentHandler);
+ } else {
+ // stream out the include for the serializer
+ IncludingHTMLSerializer.addPortlet(portletInstanceKey, content);
+ contentHandler.startPrefixMapping("portal", IncludingHTMLSerializer.NAMESPACE);
+ final AttributesImpl attr = new AttributesImpl();
+ attr.addCDATAAttribute("portlet", portletInstanceKey);
+ contentHandler.startElement(IncludingHTMLSerializer.NAMESPACE,
+ "include",
+ "portal:include",
+ attr);
+ contentHandler.endElement(IncludingHTMLSerializer.NAMESPACE,
+ "include",
+ "portal:include");
+ contentHandler.endPrefixMapping("portal");
+ }
+ } catch (WSRPException e) {
+ throw new SAXException("Exception during getMarkup of wsrp coplet: " + coplet.getId(), e);
+ } catch (SAXException se) {
+ throw se;
+ } finally {
+ this.setCurrentCopletInstanceData(null);
+ }
+ }
+
+ /**
+ * Releases all sessions (<tt>userSession, groupSession, portletSession</tt>)<br/>
+ *
+ * @see org.apache.cocoon.portal.coplet.adapter.impl.AbstractCopletAdapter#logout(org.apache.cocoon.portal.coplet.CopletInstanceData)
+ */
+ public void logout(CopletInstanceData coplet) {
+ super.logout(coplet);
+
+ PortletKey portletKey = (PortletKey)coplet.getTemporaryAttribute(ATTRIBUTE_NAME_PORTLET_KEY);
+ User user = (User)coplet.getTemporaryAttribute(ATTRIBUTE_NAME_USER);
+ final String portletInstanceKey = (String)coplet.getTemporaryAttribute(ATTRIBUTE_NAME_PORTLET_INSTANCE_KEY);
+ Producer producer = consumerEnvironment.getProducerRegistry().getProducer(portletKey.getProducerId());
+
+ // releaseSession()
+ try {
+ UserSession userSession = consumerEnvironment.getSessionHandler().getUserSession(portletKey.getProducerId(), user.getUserID());
+ PortletDescription portletDescription = producer.getPortletDescription(portletKey.getPortletHandle());
+ GroupSession groupSession = userSession.getGroupSession(portletDescription.getGroupID());
+ PortletSession portletSession = groupSession.getPortletSession(portletInstanceKey);
+ SessionContext sessionContext = portletSession.getSessionContext();
+ WSRPPortlet wsrpportlet = consumerEnvironment.getPortletRegistry().getPortlet(portletKey);
+ PortletDriver portletDriver = consumerEnvironment.getPortletDriverRegistry().getPortletDriver(wsrpportlet);
+
+ if (sessionContext != null) {
+ String[] sessions = new String[1];
+ sessions[0] = new String (sessionContext.getSessionID());
+ portletDriver.releaseSessions(sessions, user.getUserID());
+ }
+
+ userSession.removeGroupSession(portletDescription.getGroupID());
+ } catch (WSRPException e) {
+ this.getLogger().error("session deregister()", e);
+ }
+ }
+
+ /**
+ * After getting the <tt>userSession</tt> and <tt>groupSession</tt> it performs the <tt>getServiceDescription()</tt>-call<br/>
+ *
+ * @param portlet
+ * @param portletInstanceKey
+ * @param user
+ * @return SimplePortletWindowSession
+ * @throws WSRPException
+ */
+ public SimplePortletWindowSession getSimplePortletWindowSession(WSRPPortlet portlet,
+ String portletInstanceKey,
+ User user)
+ throws WSRPException {
+ SimplePortletWindowSession windowSession = null;
+
+ // get the user session
+ SessionHandler sessionHandler = consumerEnvironment.getSessionHandler();
+ UserSession userSession = sessionHandler.getUserSession(portlet.getPortletKey().getProducerId(), user.getUserID());
+
+ if (userSession != null) {
+ // get the group session
+ String groupID = null;
+ try {
+ Producer producer = consumerEnvironment.getProducerRegistry().getProducer(portlet.getPortletKey().getProducerId());
+ // *********************************
+ // getServiceDescription()
+ // *********************************
+ PortletDescription portletDescription = producer.getPortletDescription(portlet.getPortletKey().getPortletHandle());
+
+ if (portletDescription != null) {
+ groupID = portletDescription.getGroupID();
+ }
+ } catch (WSRPException e) {
+ groupID = "default_group_id";
+ this.getLogger().info("using default-group");
+ }
+
+ GroupSession groupSession = userSession.getGroupSession(groupID);
+
+ if (groupSession != null) {
+ PortletSession portletSession = groupSession.getPortletSession(portlet.getPortletKey().getPortletHandle());
+
+ if (portletSession != null) {
+ windowSession = (SimplePortletWindowSession) portletSession.getPortletWindowSession(portletInstanceKey);
+ } else {
+ this.getLogger().error("WSRP-Errorcode: " + Integer.toString(ErrorCodes.PORTLET_SESSION_NOT_FOUND));
+ }
+ } else {
+ this.getLogger().error("WSRP-Errorcode: " + Integer.toString(ErrorCodes.GROUP_SESSION_NOT_FOUND));
+ }
+ } else {
+ this.getLogger().error("WSRP-Errorcode: " + Integer.toString(ErrorCodes.USER_SESSION_NOT_FOUND));
+ }
+ return windowSession;
+ }
+
+ /**
+ * Performs an blocking interaction with the given portlet and session.<br/>
+ * If the response to this call is a redirect URL's it won't be followed.<br/>
+ *
+ * An optionally returned markup context is store in the window session<br/>
+ * and should be processed by the portlet driver instead of making a new<br/>
+ * getMarkup() call.<br/>
+ *
+ * @param portlet The portlet on which this action should be performed
+ * @param windowSession The window session of the portlet on which the action should
+ * be performed
+ * @param user The user on which this action should be performed
+ * @param request The request with all required information for the call
+ **/
+ protected void performBlockingInteraction(WSRPPortlet portlet,
+ SimplePortletWindowSession windowSession,
+ User user,
+ Request request) {
+ try {
+ PortletDriver portletDriver = consumerEnvironment.getPortletDriverRegistry().getPortletDriver(portlet);
+ BlockingInteractionResponse response = portletDriver.performBlockingInteraction(
+ new WSRPRequestImpl(windowSession, request, consumerEnvironment), user.getUserID());
+
+ if (response != null) {
+ UpdateResponse update = response.getUpdateResponse();
+ if (update != null) {
+ //update the WSRP portlet sessionContext
+ windowSession.getPortletSession().setSessionContext(update.getSessionContext());
+
+ MarkupContext markupContext = update.getMarkupContext();
+ if (markupContext != null) {
+ windowSession.updateMarkupCache(markupContext);
+ }
+
+ windowSession.setNavigationalState(update.getNavigationalState());
+
+ String windowState = null;
+ if ((windowState = update.getNewWindowState()) != null) {
+ windowSession.setWindowState(windowState);
+ }
+
+ String windowMode = null;
+ if ((windowMode = update.getNewMode()) != null) {
+ windowSession.setMode(windowMode);
+ }
+ } else if (response.getRedirectURL() != null) {
+ this.getLogger().debug("response.getRedirectURL() != null");
+ }
+ }
+ } catch (WSRPException e) {
+ this.getLogger().error("Error occured during performInteraction!", e);
+ }
+ }
+
+ /**
+ * Retrieves the markup generated by the portlet.
+ *
+ * @param portlet
+ * @param windowSession
+ * @param user
+ * @return The markup context.
+ **/
+ protected MarkupContext getMarkupContext(WSRPPortlet portlet,
+ SimplePortletWindowSession windowSession,
+ User user)
+ throws WSRPException {
+ WSRPRequestImpl wsrpRequest = new WSRPRequestImpl(windowSession, null, this.consumerEnvironment);
+
+ PortletDriver portletDriver = consumerEnvironment.getPortletDriverRegistry().getPortletDriver(portlet);
+ MarkupResponse response = portletDriver.getMarkup(wsrpRequest, user.getUserID());
+
+ if (response != null) {
+ SessionContext sessionContext = response.getSessionContext();
+ if (sessionContext != null && windowSession != null) {
+ windowSession.getPortletSession().setSessionContext(sessionContext);
+ }
+
+ return response.getMarkupContext();
+ }
+ return null;
+ }
+
+ /**
+ * Creates a <tt>String</tt> consists of the producer-id_portlet-handle_coplet-id_user-name <br/>
+ *
+ * @param key includes the essential values
+ * @param coplet current <tt>CopletInstanceData</tt>-object
+ * @param userName
+ * @return the unique string which represents the portlet-instance
+ * */
+ protected String getPortletInstanceKey(PortletKey key,
+ CopletInstanceData coplet,
+ String userName) {
+ final StringBuffer buffer = new StringBuffer(key.getProducerId());
+ buffer.append('_').append(key.getPortletHandle()).append('_');
+ buffer.append(coplet.getId()).append('_').append(userName);
+ return buffer.toString();
+ }
+
+ /**
+ * Gets all required information like <tt>portletKey, portletInstanceKey, userName, portletModes, windowStates,
+ * interactionState</tt> and the <tt>navigationalStat</tt><br/>
+ *
+ * After that it decides with the <tt>URL_TYPE</tt> to perform the <tt>performBlockingInteraction()</tt>-call or
+ * do some render- alternatively some resource-specific things<br/>
+ *
+ * @see Receiver
+ */
+ public void inform(WSRPEvent event, PortalService service) {
+ final CopletInstanceData coplet = (CopletInstanceData)event.getTarget();
+ this.setCurrentCopletInstanceData(coplet);
+
+ try {
+ PortletKey portletKey = (PortletKey)coplet.getTemporaryAttribute(ATTRIBUTE_NAME_PORTLET_KEY);
+ final String portletInstanceKey = (String)coplet.getTemporaryAttribute(ATTRIBUTE_NAME_PORTLET_INSTANCE_KEY);
+ WSRPPortlet wsrpPortlet = consumerEnvironment.getPortletRegistry().getPortlet(portletKey);
+ User user = (User) coplet.getTemporaryAttribute(ATTRIBUTE_NAME_USER);
+
+ org.apache.cocoon.environment.Request requestObject = ObjectModelHelper.getRequest(service.getObjectModel());
+ java.util.Enumeration formParameter = requestObject.getParameterNames();
+
+ Request request = new RequestImpl();
+ String portletMode = requestObject.getParameter(Constants.PORTLET_MODE);
+ String windowState = requestObject.getParameter(Constants.WINDOW_STATE);
+
+ request.setInteractionState(requestObject.getParameter(Constants.INTERACTION_STATE));
+ SimplePortletWindowSession windowSession = getSimplePortletWindowSession(wsrpPortlet, portletInstanceKey, user);
+ windowSession.setNavigationalState(requestObject.getParameter(Constants.NAVIGATIONAL_STATE));
+
+ if (portletMode != null) {
+ windowSession.setMode(portletMode);
+ }
+ if (windowState != null) {
+ if ( !windowState.equals(windowSession.getWindowState()) ) {
+ final Layout layout = (Layout)coplet.getTemporaryAttribute(ATTRIBUTE_NAME_LAYOUT);
+ final Layout fullScreenLayout = service.getEntryLayout(null);
+ if ( fullScreenLayout != null
+ && fullScreenLayout.equals( layout )
+ && !windowState.equals(WindowStates._maximized) ) {
+ FullScreenCopletEvent e = new FullScreenCopletEvent( coplet, null );
+ service.getComponentManager().getEventManager().send(e);
+ }
+ if ( windowState.equals(WindowStates._minimized) ) {
+ ChangeCopletInstanceAspectDataEvent e = new ChangeCopletInstanceAspectDataEvent(coplet, "size", SizingStatus.STATUS_MINIMIZED);
+ service.getComponentManager().getEventManager().send(e);
+ }
+ if ( windowState.equals(WindowStates._normal) ) {
+ ChangeCopletInstanceAspectDataEvent e = new ChangeCopletInstanceAspectDataEvent(coplet, "size", SizingStatus.STATUS_MAXIMIZED);
+ service.getComponentManager().getEventManager().send(e);
+ }
+ if ( windowState.equals(WindowStates._maximized) ) {
+ FullScreenCopletEvent e = new FullScreenCopletEvent( coplet, layout );
+ service.getComponentManager().getEventManager().send(e);
+ }
+ windowSession.setWindowState(windowState);
+ }
+ }
+ if (requestObject.getParameter(Constants.URL_TYPE).equals(Constants.URL_TYPE_BLOCKINGACTION)) {
+ // performBlockingInteraction()
+ String parameter;
+ while (formParameter.hasMoreElements()) {
+ parameter = (String) formParameter.nextElement();
+ request.addFormParameter(parameter, requestObject.getParameter(parameter));
+ }
+ performBlockingInteraction(wsrpPortlet, windowSession, user, request);
+
+ }
+
+ } catch (WSRPException e) {
+ this.getLogger().error("Error during processing wsrp event.", e);
+ } finally {
+ this.setCurrentCopletInstanceData(null);
+ }
+ }
+
+ /**
+ * @see org.apache.cocoon.portal.PortalManagerAspect#prepare(org.apache.cocoon.portal.PortalManagerAspectPrepareContext, org.apache.cocoon.portal.PortalService)
+ */
+ public void prepare(PortalManagerAspectPrepareContext aspectContext,
+ PortalService service)
+ throws ProcessingException {
+ // process the events
+ aspectContext.invokeNext();
+ }
+
+ /**
+ * @see org.apache.cocoon.portal.PortalManagerAspect#render(org.apache.cocoon.portal.PortalManagerAspectRenderContext, org.apache.cocoon.portal.PortalService, org.xml.sax.ContentHandler, org.apache.avalon.framework.parameters.Parameters)
+ */
+ public void render(PortalManagerAspectRenderContext aspectContext,
+ PortalService service,
+ ContentHandler ch,
+ Parameters parameters)
+ throws SAXException {
+ aspectContext.invokeNext(ch, parameters);
+ }
+
+ /**
+ * @return Returns the <tt>consumerEnvironmentImpl</tt>
+ */
+ public ConsumerEnvironmentImpl getConsumerEnvironment() {
+ return consumerEnvironment;
+ }
+
+ /**
+ * Add a new producer<br/>
+ *
+ * @param desc The producer description.
+ * @return Returns true if the producer could be added.
+ */
+ public boolean addProducer(ProducerDescription desc) {
+ return ((ProducerRegistryImpl)this.consumerEnvironment.getProducerRegistry()).addProducer(desc);
+ }
+
+ /**
+ * This sets the current coplet instance data for the thread <br/>
+ *
+ * @param coplet The coplet instance data or null to clear the information.
+ */
+ public void setCurrentCopletInstanceData(CopletInstanceData coplet) {
+ this.copletInstanceData.set(coplet);
+ }
+
+ /**
+ * Return the current coplet instance data<br/>
+ *
+ * @return Returns the instance or null.
+ */
+ public CopletInstanceData getCurrentCopletInstanceData() {
+ return (CopletInstanceData)this.copletInstanceData.get();
+ }
+
+ /**
+ * This handler is triggered by a form element. It rewrites the
+ * action if the method get is used. In this case all request parameters
+ * of the action are added as hidden fields.
+ */
+ public static final class FormRewritingHandler extends AbstractXMLPipe {
+
+ public FormRewritingHandler(ContentHandler ch) {
+ this.setContentHandler(ch);
+ if ( ch instanceof LexicalHandler ) {
+ this.setLexicalHandler((LexicalHandler)ch);
+ }
+ }
+
+ /**
+ * @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ */
+ public void startElement(String uri, String loc, String raw, Attributes a) throws SAXException {
+ if ( loc.equalsIgnoreCase("form") && a.getValue("method").equalsIgnoreCase("get") ) {
+ final String action = a.getValue("action");
+ int pos = action.indexOf('?');
+ if ( pos != -1 ) {
+ AttributesImpl ai = new AttributesImpl(a);
+ a = ai;
+ final String queryString = action.substring(pos+1);
+ ai.removeAttribute("action");
+ ai.addCDATAAttribute("action", action.substring(0, pos));
+ super.startElement(uri, loc, raw, a);
+ RequestParameters rp = new RequestParameters(queryString);
+
+ final Enumeration e = rp.getParameterNames();
+ while ( e.hasMoreElements() ) {
+ final String key = (String)e.nextElement();
+ final String value = rp.getParameter(key);
+ AttributesImpl attributes = new AttributesImpl();
+ attributes.addCDATAAttribute("type", "hidden");
+ attributes.addCDATAAttribute("name", key);
+ attributes.addCDATAAttribute("value", value);
+ XMLUtils.createElement(this.contentHandler, "input", attributes);
+ }
+ return;
+ }
+ }
+ super.startElement(uri, loc, raw, a);
+ }
+
+ }
+
+ /**
+ * Check if we have read our configuration already.
+ * If not, read the config and invoke the configure method.
+ */
+ protected void checkInitialized() {
+ if ( !this.initialized ) {
+ synchronized (this) {
+ if (! this.initialized ) {
+ this.initialized = true;
+ SourceResolver resolver = null;
+ Source source = null;
+ try {
+ resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
+ source = resolver.resolveURI(this.wsrpConfigLocation);
+ DefaultConfigurationBuilder dcb = new DefaultConfigurationBuilder();
+ this.wsrpConfiguration = dcb.build(source.getInputStream());
+ } catch (ConfigurationException ce) {
+ this.getLogger().error("Unable to read wsrp configuration: " + this.wsrpConfigLocation, ce);
+ } catch (IOException ioe) {
+ this.getLogger().error("Unable to read wsrp configuration: " + this.wsrpConfigLocation, ioe);
+ } catch (SAXException sae) {
+ this.getLogger().error("Unable to read wsrp configuration: " + this.wsrpConfigLocation, sae);
+ } catch (ServiceException se) {
+ throw new RuntimeException("Unable to get source resolver.", se);
+ } finally {
+ if ( resolver != null ) {
+ resolver.release(source);
+ }
+ this.manager.release(resolver);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Get the wsrp configuration.
+ */
+ public Configuration getWsrpConfiguration() {
+ this.checkInitialized();
+ return this.wsrpConfiguration;
+ }
+
+ /**
+ * Get the adapter configuration.
+ */
+ public Parameters getAdapterConfiguration() {
+ return this.parameters;
+ }
+
+ /**
+ * Create a component.
+ */
+ public Object createObject(String className)
+ throws Exception {
+ final Object component = ClassUtils.newInstance(className);
+ ContainerUtil.enableLogging(component, this.getLogger());
+ if (component instanceof RequiresConsumerEnvironment) {
+ ((RequiresConsumerEnvironment)component).setConsumerEnvironment(this.consumerEnvironment);
+ }
+ if (component instanceof RequiresWSRPAdapter) {
+ ((RequiresWSRPAdapter)component).setWSRPAdapter(this);
+ }
+ if (component instanceof RequiresPortalService) {
+ ((RequiresPortalService)component).setPortalService(this.service);
+ }
+ ContainerUtil.contextualize(component, context);
+ ContainerUtil.service(component, manager);
+ ContainerUtil.initialize(component);
+
+ return component;
+ }
+
+}
Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPEvent.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPEvent.java?rev=264755&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPEvent.java (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPEvent.java Tue Aug 30 03:29:21 2005
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.portal.wsrp.adapter;
+
+import java.util.Map;
+
+import org.apache.cocoon.portal.coplet.CopletInstanceData;
+import org.apache.cocoon.portal.event.CopletInstanceEvent;
+
+/**
+ * This event is fired for every wsrp action. <br/>
+ *
+ * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
+ * @author <a href="mailto:malessandrini@s-und-n.de">Michel Alessandrini</a>
+ *
+ * @version $Id$
+ */
+public class WSRPEvent
+ implements CopletInstanceEvent {
+
+ /** The corresponding coplet instance data. */
+ protected final CopletInstanceData coplet;
+
+ /** The parameters for the wsrp url. */
+ protected final Map producerParams;
+
+ /**
+ * constructor
+ *
+ * @param coplet corresponding coplet instance data
+ * @param pParams producer-parameters
+ */
+ public WSRPEvent(CopletInstanceData coplet, Map pParams) {
+ this.coplet = coplet;
+ this.producerParams = pParams;
+ }
+
+ /**
+ * @see org.apache.cocoon.portal.event.ActionEvent#getTarget()
+ */
+ public Object getTarget() {
+ return this.coplet;
+ }
+
+ /**
+ * @return Map all parameters for the wsrp url.
+ */
+ public Map getUrlParameters() {
+ return this.producerParams;
+ }
+
+}
Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPEvent.java
------------------------------------------------------------------------------
svn:keywords = Id